X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Factions%2FHelp.java;fp=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Factions%2FHelp.java;h=ba124310800bb29b87988d85144176fa19f7bc96;hp=20a2e997551638232776dac570d0b6a36acfd815;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/actions/Help.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/actions/Help.java index 20a2e9975..ba1243108 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/actions/Help.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/actions/Help.java @@ -1,53 +1,53 @@ -/******************************************************************************* - * Copyright (c) 2016 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: - * Semantum Oy - initial API and implementation - *******************************************************************************/ -package org.simantics.modeling.actions; - -import org.eclipse.ui.PlatformUI; -import org.simantics.Simantics; -import org.simantics.databoard.Bindings; -import org.simantics.db.Resource; -import org.simantics.db.common.primitiverequest.PossibleRelatedValue2; -import org.simantics.db.common.utils.Logger; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.adapter.ActionFactory; -import org.simantics.modeling.ModelingResources; - -public class Help implements ActionFactory { - - @Override - public Runnable create(Object target) { - - if(!(target instanceof Resource)) - return null; - - final Resource resource = (Resource)target; - - return new Runnable() { - @Override - public void run() { - - try { - ModelingResources MOD = ModelingResources.getInstance(Simantics.getSession()); - String id = Simantics.sync(new PossibleRelatedValue2(resource, MOD.contextualHelpId, Bindings.STRING)); - if(id == null) { - PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp(); - return; - } - PlatformUI.getWorkbench().getHelpSystem().displayHelp(id); - } catch (DatabaseException e) { - Logger.defaultLogError(e); - } - - } - }; - } -} +/******************************************************************************* + * Copyright (c) 2016 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: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.modeling.actions; + +import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; +import org.simantics.databoard.Bindings; +import org.simantics.db.Resource; +import org.simantics.db.common.primitiverequest.PossibleRelatedValue2; +import org.simantics.db.common.utils.Logger; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.adapter.ActionFactory; +import org.simantics.modeling.ModelingResources; + +public class Help implements ActionFactory { + + @Override + public Runnable create(Object target) { + + if(!(target instanceof Resource)) + return null; + + final Resource resource = (Resource)target; + + return new Runnable() { + @Override + public void run() { + + try { + ModelingResources MOD = ModelingResources.getInstance(Simantics.getSession()); + String id = Simantics.sync(new PossibleRelatedValue2(resource, MOD.contextualHelpId, Bindings.STRING)); + if(id == null) { + PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp(); + return; + } + PlatformUI.getWorkbench().getHelpSystem().displayHelp(id); + } catch (DatabaseException e) { + Logger.defaultLogError(e); + } + + } + }; + } +}