X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Fworkbench%2Faction%2FPerformDefaultAction.java;fp=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Fworkbench%2Faction%2FPerformDefaultAction.java;h=22164e5042dd714aa3f42d3a35a89d7e6d853637;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=640e58f56cd9b273dcadf2c51bff16207472db82;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/PerformDefaultAction.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/PerformDefaultAction.java index 640e58f56..22164e504 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/PerformDefaultAction.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/PerformDefaultAction.java @@ -1,53 +1,53 @@ -/******************************************************************************* - * Copyright (c) 2012 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.ui.workbench.action; - -import org.eclipse.jface.action.Action; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.simantics.db.Resource; -import org.simantics.ui.SimanticsUI; -import org.simantics.utils.ui.workbench.WorkbenchUtils; - -/** - * @author Tuukka Lehtonen - */ -public class PerformDefaultAction extends Action { - - private Control control; - private Resource component; - - public PerformDefaultAction(String name, Control control, Resource component) { - super(name); - this.control = control; - this.component = component; - } - - @Override - public void run() { - final String perspectiveId = WorkbenchUtils.getCurrentPerspectiveId(); - Shell shell = null; - if (control != null) { - shell = control.getShell(); - } else { - IWorkbench wb = PlatformUI.getWorkbench(); - IWorkbenchWindow window = wb.getActiveWorkbenchWindow(); - if (window != null) - shell = window.getShell(); - } - SimanticsUI.getSession().asyncRequest(new ChooseActionRequest(shell, control, component, perspectiveId)); - } - +/******************************************************************************* + * Copyright (c) 2012 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.ui.workbench.action; + +import org.eclipse.jface.action.Action; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.simantics.db.Resource; +import org.simantics.ui.SimanticsUI; +import org.simantics.utils.ui.workbench.WorkbenchUtils; + +/** + * @author Tuukka Lehtonen + */ +public class PerformDefaultAction extends Action { + + private Control control; + private Resource component; + + public PerformDefaultAction(String name, Control control, Resource component) { + super(name); + this.control = control; + this.component = component; + } + + @Override + public void run() { + final String perspectiveId = WorkbenchUtils.getCurrentPerspectiveId(); + Shell shell = null; + if (control != null) { + shell = control.getShell(); + } else { + IWorkbench wb = PlatformUI.getWorkbench(); + IWorkbenchWindow window = wb.getActiveWorkbenchWindow(); + if (window != null) + shell = window.getShell(); + } + SimanticsUI.getSession().asyncRequest(new ChooseActionRequest(shell, control, component, perspectiveId)); + } + } \ No newline at end of file