Skip to content

Commit

Permalink
Remove unnecessary re-implementation of selection methods
Browse files Browse the repository at this point in the history
The methods for adding and removing ISelectionChangedListener is already
implemented by the GEF viewer. No need for us to re-implement them.
  • Loading branch information
ptziegler committed Apr 30, 2024
1 parent dacbc77 commit 75336b7
Showing 1 changed file with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.eclipse.gef.ui.parts.GraphicalViewerImpl;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
Expand Down Expand Up @@ -645,19 +644,6 @@ private PropertyInfo getPropertyInfo(Property property) {
// ISelectionProvider
//
////////////////////////////////////////////////////////////////////////////
private final List<ISelectionChangedListener> m_selectionListeners = new ArrayList<>();

@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
if (!m_selectionListeners.contains(listener)) {
m_selectionListeners.add(listener);
}
}

@Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
m_selectionListeners.add(listener);
}

@Override
public ISelection getSelection() {
Expand Down Expand Up @@ -697,10 +683,7 @@ private void setActivePropertyInfo(PropertyInfo activePropertyInfo) {
}
}
// send events
SelectionChangedEvent selectionEvent = new SelectionChangedEvent(this, getSelection());
for (ISelectionChangedListener listener : m_selectionListeners) {
listener.selectionChanged(selectionEvent);
}
fireSelectionChanged();
// re-draw
getControl().redraw();
}
Expand Down

0 comments on commit 75336b7

Please sign in to comment.