X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FmodelBrowser%2Fhandlers%2FRenameNodeHandler.java;fp=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FmodelBrowser%2Fhandlers%2FRenameNodeHandler.java;h=bc3735abb3052408aa2d9c541f8dc69e2023f0c1;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=65011498c9612ba973b8285fa4aff4a63832fbb8;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/RenameNodeHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/RenameNodeHandler.java index 65011498c..bc3735abb 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/RenameNodeHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/RenameNodeHandler.java @@ -1,58 +1,58 @@ -/******************************************************************************* - * 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.modeling.ui.modelBrowser.handlers; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.handlers.HandlerUtil; -import org.simantics.browsing.ui.GraphExplorer; -import org.simantics.browsing.ui.NodeContext; -import org.simantics.browsing.ui.common.ColumnKeys; -import org.simantics.utils.ui.ISelectionUtils; -import org.simantics.utils.ui.workbench.WorkbenchUtils; - -public class RenameNodeHandler extends AbstractHandler { - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection sel = HandlerUtil.getCurrentSelection(event); - NodeContext ctx = ISelectionUtils.filterSingleSelection(sel, NodeContext.class); - if (ctx == null) - return null; - - IWorkbenchPart part = HandlerUtil.getActivePart(event); - if (part == null) - return null; - - IActionBars bars = WorkbenchUtils.getActionBars(part); - IStatusLineManager status = bars.getStatusLineManager(); - - GraphExplorer graphExplorer = (GraphExplorer) part.getAdapter(GraphExplorer.class); - if (graphExplorer != null) { - String error = graphExplorer.startEditing(ctx, ColumnKeys.SINGLE); - if (error != null) { - status.setErrorMessage(error); - } else { - status.setErrorMessage(null); - } - } - - return null; - } - - -} +/******************************************************************************* + * 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.modeling.ui.modelBrowser.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.browsing.ui.GraphExplorer; +import org.simantics.browsing.ui.NodeContext; +import org.simantics.browsing.ui.common.ColumnKeys; +import org.simantics.utils.ui.ISelectionUtils; +import org.simantics.utils.ui.workbench.WorkbenchUtils; + +public class RenameNodeHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + ISelection sel = HandlerUtil.getCurrentSelection(event); + NodeContext ctx = ISelectionUtils.filterSingleSelection(sel, NodeContext.class); + if (ctx == null) + return null; + + IWorkbenchPart part = HandlerUtil.getActivePart(event); + if (part == null) + return null; + + IActionBars bars = WorkbenchUtils.getActionBars(part); + IStatusLineManager status = bars.getStatusLineManager(); + + GraphExplorer graphExplorer = (GraphExplorer) part.getAdapter(GraphExplorer.class); + if (graphExplorer != null) { + String error = graphExplorer.startEditing(ctx, ColumnKeys.SINGLE); + if (error != null) { + status.setErrorMessage(error); + } else { + status.setErrorMessage(null); + } + } + + return null; + } + + +}