+ public void setSelectionWithoutFiring(ISelection selection) {
+ this.selection = selection;
+ }
+
+
+ /**
+ * Sets a new selection and always fires a SelectionChangedEvent about it.
+ *
+ * @param selection the new selection
+ */
+ public void setAndFireSelection(ISelection selection) {
+ setSelection(selection);
+ fireSelection(selection);
+ }
+
+ /**
+ * Sets the new selection for this provider and fires all selection change
+ * listeners if the specified selection differs from the current selection.
+ * If the selection is either the same object or considered equal to the
+ * current selection, the listeners are not fired.
+ *
+ * @param selection the new selection
+ */
+ public void setAndFireNonEqualSelection(ISelection selection) {
+ ISelection old = getSelection();
+ if (ObjectUtils.objectEquals(old, selection))
+ return;
+
+ this.selection = selection;
+ if (selection != null && !selection.equals(old))
+ fireSelection(selection);
+ }
+
+ public boolean selectionEquals(ISelection s) {
+ if (s == selection)
+ return true;
+ if (s == null)
+ // Old selection had to be non-null
+ return true;
+ return s.equals(selection);
+ }
+