1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.message.ui.scheme;
\r
14 import org.eclipse.ui.IWorkbenchWindow;
\r
15 import org.eclipse.ui.PlatformUI;
\r
16 import org.simantics.db.Resource;
\r
17 import org.simantics.db.Session;
\r
18 import org.simantics.message.AbstractMessageSchemeHandler;
\r
19 import org.simantics.ui.SimanticsUI;
\r
20 import org.simantics.ui.workbench.action.ChooseActionRequest;
\r
21 import org.simantics.utils.ui.workbench.WorkbenchUtils;
\r
24 * @author Tuukka Lehtonen
\r
26 public class ResourceSchemeHandler extends AbstractMessageSchemeHandler<Resource> {
\r
28 public ResourceSchemeHandler() {
\r
29 super("resource", Resource.class);
\r
33 public void doPerform(Resource r) {
\r
34 Session session = SimanticsUI.peekSession();
\r
35 if (session == null) {
\r
36 // FIXME: not stdout.
\r
37 System.out.println("ResourceSchemeHandler: no session");
\r
41 // Try the doubleClick-extensions
\r
42 IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
\r
46 final String perspectiveId = WorkbenchUtils.getCurrentPerspectiveId();
\r
48 session.asyncRequest(new ChooseActionRequest(window.getShell(), r, perspectiveId, false, true));
\r