/*******************************************************************************
- * Copyright (c) 2007, 2018 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.simantics.utils.ObjectUtils;
/**
* BaseSelectionProvider is a base implementation ISelectionProvider -interface.
*/
public class BaseSelectionProvider implements ISelectionProvider {
- protected ListenerList<ISelectionChangedListener> selectionListeners = new ListenerList<>();
+ protected ListenerList selectionListeners = new ListenerList();
protected ISelection selection = StructuredSelection.EMPTY;
return selection;
}
- public void clearListeners() {
- clearSelectionChangedListeners();
- }
-
- public void clearSelectionChangedListeners() {
- selectionListeners.clear();
- }
-
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
selectionListeners.remove(listener);
}
*
* @param selection the new selection
*/
- public boolean setAndFireNonEqualSelection(ISelection selection) {
+ public void setAndFireNonEqualSelection(ISelection selection) {
ISelection old = getSelection();
- if (ObjectUtils.objectEquals(old, selection))
- return false;
+ if (selection == old)
+ return;
this.selection = selection;
- if (selection != null)
+ if (selection != null && !selection.equals(old))
fireSelection(selection);
- return true;
}
public boolean selectionEquals(ISelection s) {