X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FDefaultSelectionDataResolver.java;h=188bfb28f0d3c6d343bf975206f6141bc2741a39;hp=fd8359f107b1d9318df64e1de26ea2c9df3a216a;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultSelectionDataResolver.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultSelectionDataResolver.java index fd8359f10..188bfb28f 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultSelectionDataResolver.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultSelectionDataResolver.java @@ -1,48 +1,48 @@ -/******************************************************************************* - * 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); - - } - -} +/******************************************************************************* + * 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); + + } + +}