]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultExplorerSelectionListener.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / DefaultExplorerSelectionListener.java
index d127e8d4455c0db4e80f0e776b16adfd21fb8c33..407fbff3ba8fa750ae823c4148aa71c131d9b129 100644 (file)
@@ -1,64 +1,64 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.browsing.ui.swt;\r
-\r
-import org.eclipse.jface.viewers.IPostSelectionProvider;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.ui.ISelectionListener;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.simantics.browsing.ui.GraphExplorer;\r
-\r
-public class DefaultExplorerSelectionListener implements ISelectionListener {\r
-\r
-    private static final boolean DEBUG = false;\r
-\r
-    IWorkbenchPart           owner;\r
-    GraphExplorer            explorer;\r
-    WorkbenchSelectionFilter filter;\r
-\r
-    public DefaultExplorerSelectionListener(IWorkbenchPart owner, GraphExplorer explorer) {\r
-        this(owner, explorer, ResourceSelectionFilter.FILTER);\r
-    }\r
-\r
-    public DefaultExplorerSelectionListener(IWorkbenchPart owner, GraphExplorer explorer, WorkbenchSelectionFilter filter) {\r
-        this.owner = owner;\r
-        this.explorer = explorer;\r
-        this.filter = filter;\r
-    }\r
-\r
-    @Override\r
-    public void selectionChanged(IWorkbenchPart part, ISelection selection) {\r
-        // Always disregard own selections.\r
-        if (part == owner)\r
-            return;\r
-\r
-        if (DEBUG)\r
-            System.out.println("[" + owner + "] workbench selection changed: part=" + part + ", selection=" + selection);\r
-        ISelection s = selection;\r
-        if (filter != null)\r
-            s = filter.filterSelection(part, selection);\r
-\r
-        if (s != null) {\r
-            if (DEBUG) {\r
-                System.out.println("** [" + owner + "] workbench selection changed: part=" + part + ", selection=" + selection);\r
-                System.out.println("    SETTING NEW SELECTION");\r
-            }\r
-            if(!explorer.isDisposed()) {\r
-                IPostSelectionProvider selectionProvider = (IPostSelectionProvider)explorer.getAdapter(IPostSelectionProvider.class);\r
-                selectionProvider.setSelection(selection);\r
-            }\r
-        } else {\r
-            if (DEBUG)\r
-                System.out.println("[" + owner + "] discarding selection: part=" + part + ", selection=" + selection);\r
-        }\r
-    }\r
-}\r
+/*******************************************************************************
+ * 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.browsing.ui.swt;
+
+import org.eclipse.jface.viewers.IPostSelectionProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.simantics.browsing.ui.GraphExplorer;
+
+public class DefaultExplorerSelectionListener implements ISelectionListener {
+
+    private static final boolean DEBUG = false;
+
+    IWorkbenchPart           owner;
+    GraphExplorer            explorer;
+    WorkbenchSelectionFilter filter;
+
+    public DefaultExplorerSelectionListener(IWorkbenchPart owner, GraphExplorer explorer) {
+        this(owner, explorer, ResourceSelectionFilter.FILTER);
+    }
+
+    public DefaultExplorerSelectionListener(IWorkbenchPart owner, GraphExplorer explorer, WorkbenchSelectionFilter filter) {
+        this.owner = owner;
+        this.explorer = explorer;
+        this.filter = filter;
+    }
+
+    @Override
+    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+        // Always disregard own selections.
+        if (part == owner)
+            return;
+
+        if (DEBUG)
+            System.out.println("[" + owner + "] workbench selection changed: part=" + part + ", selection=" + selection);
+        ISelection s = selection;
+        if (filter != null)
+            s = filter.filterSelection(part, selection);
+
+        if (s != null) {
+            if (DEBUG) {
+                System.out.println("** [" + owner + "] workbench selection changed: part=" + part + ", selection=" + selection);
+                System.out.println("    SETTING NEW SELECTION");
+            }
+            if(!explorer.isDisposed()) {
+                IPostSelectionProvider selectionProvider = (IPostSelectionProvider)explorer.getAdapter(IPostSelectionProvider.class);
+                selectionProvider.setSelection(selection);
+            }
+        } else {
+            if (DEBUG)
+                System.out.println("[" + owner + "] discarding selection: part=" + part + ", selection=" + selection);
+        }
+    }
+}