-/*******************************************************************************\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.core.runtime.IAdaptable;\r
-import org.simantics.browsing.ui.NodeContext;\r
-import org.simantics.browsing.ui.SelectionDataResolver;\r
-import org.simantics.ui.selection.ExplorerInputContentType;\r
-import org.simantics.ui.selection.WorkbenchSelectionElement;\r
-import org.simantics.ui.utils.ResourceAdaptionUtils;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class DefaultSelectionDataResolver implements SelectionDataResolver {\r
-\r
- @Override\r
- public Object resolve(Object o) {\r
- \r
- if(o instanceof NodeContext)\r
- return (NodeContext)o;\r
- if(o instanceof IAdaptable) {\r
- IAdaptable adaptable = (IAdaptable)o;\r
- NodeContext nodeContext = (NodeContext)adaptable.getAdapter(NodeContext.class);\r
- if(nodeContext != null)\r
- return nodeContext;\r
- WorkbenchSelectionElement wse = (WorkbenchSelectionElement)adaptable.getAdapter(WorkbenchSelectionElement.class);\r
- if(wse != null)\r
- return wse.getContent(ExplorerInputContentType.INSTANCE);\r
- }\r
- if(o instanceof WorkbenchSelectionElement) {\r
- WorkbenchSelectionElement wse = (WorkbenchSelectionElement)o;\r
- if(wse != null) return wse.getContent(ExplorerInputContentType.INSTANCE);\r
- }\r
- return ResourceAdaptionUtils.adaptToResource(o);\r
- \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.core.runtime.IAdaptable;
+import org.simantics.browsing.ui.NodeContext;
+import org.simantics.browsing.ui.SelectionDataResolver;
+import org.simantics.ui.selection.ExplorerInputContentType;
+import org.simantics.ui.selection.WorkbenchSelectionElement;
+import org.simantics.ui.utils.ResourceAdaptionUtils;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class DefaultSelectionDataResolver implements SelectionDataResolver {
+
+ @Override
+ public Object resolve(Object o) {
+
+ if(o instanceof NodeContext)
+ return (NodeContext)o;
+ if(o instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable)o;
+ NodeContext nodeContext = (NodeContext)adaptable.getAdapter(NodeContext.class);
+ if(nodeContext != null)
+ return nodeContext;
+ WorkbenchSelectionElement wse = (WorkbenchSelectionElement)adaptable.getAdapter(WorkbenchSelectionElement.class);
+ if(wse != null)
+ return wse.getContent(ExplorerInputContentType.INSTANCE);
+ }
+ if(o instanceof WorkbenchSelectionElement) {
+ WorkbenchSelectionElement wse = (WorkbenchSelectionElement)o;
+ if(wse != null) return wse.getContent(ExplorerInputContentType.INSTANCE);
+ }
+ return ResourceAdaptionUtils.adaptToResource(o);
+
+ }
+
+}