1 /*******************************************************************************
2 * Copyright (c) 2016 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Semantum Oy - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.modeling.actions;
14 import org.eclipse.ui.PlatformUI;
15 import org.simantics.Simantics;
16 import org.simantics.databoard.Bindings;
17 import org.simantics.db.Resource;
18 import org.simantics.db.common.primitiverequest.PossibleRelatedValue2;
19 import org.simantics.db.common.utils.Logger;
20 import org.simantics.db.exception.DatabaseException;
21 import org.simantics.db.layer0.adapter.ActionFactory;
22 import org.simantics.modeling.ModelingResources;
24 public class Help implements ActionFactory {
27 public Runnable create(Object target) {
29 if(!(target instanceof Resource))
32 final Resource resource = (Resource)target;
34 return new Runnable() {
39 ModelingResources MOD = ModelingResources.getInstance(Simantics.getSession());
40 String id = Simantics.sync(new PossibleRelatedValue2<String>(resource, MOD.contextualHelpId, Bindings.STRING));
42 PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp();
45 PlatformUI.getWorkbench().getHelpSystem().displayHelp(id);
46 } catch (DatabaseException e) {
47 Logger.defaultLogError(e);