X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.graph.impl%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fgraph%2Fimpl%2FGraphInputSources.java;h=673f5177fd2687ec3140c2e1b393eb1da5b655aa;hp=83be21a5344fcc672264987ffde0b7bdafea0c2c;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/GraphInputSources.java b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/GraphInputSources.java index 83be21a53..673f5177f 100644 --- a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/GraphInputSources.java +++ b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/GraphInputSources.java @@ -1,62 +1,62 @@ -/******************************************************************************* - * 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.graph.impl; - -import org.eclipse.ui.IWorkbenchPart; -import org.simantics.Simantics; -import org.simantics.browsing.ui.GraphExplorer; -import org.simantics.db.Resource; -import org.simantics.db.management.ISessionContext; - -/** - * @author Antti Villberg - */ -public class GraphInputSources { - - public static SessionContextInputSource uriSource(String uri) { - return new URIResourceInputSource(uri); - } - - public static SessionContextInputSource projectSource() { - return new SessionContextInputSource() { - @Override - public Object get(ISessionContext ctx) { - Resource project = Simantics.peekProjectResource(); - return project != null ? project : GraphExplorer.EMPTY_INPUT; - } - @Override - public IWorkbenchPart getProvider() { - return null; - } - }; - } - - public static SessionContextInputSource constant(final Object input) { - if (input == null) - throw new NullPointerException("null input"); - return new SessionContextInputSource() { - @Override - public Object get(ISessionContext ctx) { - return input; - } - @Override - public IWorkbenchPart getProvider() { - return null; - } - }; - } - - public static SessionContextInputSource workbenchSelection() { - return new WorkbenchSelectionInputSource(); - } - -} +/******************************************************************************* + * 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.graph.impl; + +import org.eclipse.ui.IWorkbenchPart; +import org.simantics.Simantics; +import org.simantics.browsing.ui.GraphExplorer; +import org.simantics.db.Resource; +import org.simantics.db.management.ISessionContext; + +/** + * @author Antti Villberg + */ +public class GraphInputSources { + + public static SessionContextInputSource uriSource(String uri) { + return new URIResourceInputSource(uri); + } + + public static SessionContextInputSource projectSource() { + return new SessionContextInputSource() { + @Override + public Object get(ISessionContext ctx) { + Resource project = Simantics.peekProjectResource(); + return project != null ? project : GraphExplorer.EMPTY_INPUT; + } + @Override + public IWorkbenchPart getProvider() { + return null; + } + }; + } + + public static SessionContextInputSource constant(final Object input) { + if (input == null) + throw new NullPointerException("null input"); + return new SessionContextInputSource() { + @Override + public Object get(ISessionContext ctx) { + return input; + } + @Override + public IWorkbenchPart getProvider() { + return null; + } + }; + } + + public static SessionContextInputSource workbenchSelection() { + return new WorkbenchSelectionInputSource(); + } + +}