X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Factions%2FRenameDiagramComponents.java;h=75bde31781e929abf8010076985670a92aaea96e;hb=560d8aa2e37cb6b0249aec6d7e96e67d5a64c59f;hp=5801213e892266d54a1b1b59a592ba27bcbe3126;hpb=0144ba232323a0e4f7ec8fe0681a150faafd7caf;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/RenameDiagramComponents.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/RenameDiagramComponents.java index 5801213e8..75bde3178 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/RenameDiagramComponents.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/RenameDiagramComponents.java @@ -1,60 +1,60 @@ -package org.simantics.modeling.ui.actions; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.ui.PlatformUI; -import org.simantics.Simantics; -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.common.request.UniqueRead; -import org.simantics.db.common.request.WriteRequest; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.adapter.ActionFactory; -import org.simantics.modeling.ui.Activator; -import org.simantics.modeling.ui.diagram.renaming.ComponentsRenamingDialog; -import org.simantics.modeling.ui.diagram.renaming.ComponentsRenamingModel; - -/** - * @author Hannu Niemistö - */ -public class RenameDiagramComponents implements ActionFactory { - - @Override - public Runnable create(Object target) { - if (!(target instanceof Resource)) - return null; - final Resource composite = (Resource)target; - - return new Runnable() { - @Override - public void run() { - try { - ComponentsRenamingModel model = Simantics.getSession().syncRequest(new UniqueRead() { - @Override - public ComponentsRenamingModel perform(ReadGraph graph) throws DatabaseException { - return new ComponentsRenamingModel().read(graph, composite); - } - }); - ComponentsRenamingDialog dialog = new ComponentsRenamingDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - model); - if(dialog.open() == Dialog.OK) { - Simantics.getSession().syncRequest(new WriteRequest() { - @Override - public void perform(WriteGraph graph) - throws DatabaseException { - graph.markUndoPoint(); - model.write(graph); - } - }); - } - } catch (DatabaseException e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "RenameDiagramComponents action failed, see exception for details", e)); - } - } - }; - } - -} +package org.simantics.modeling.ui.actions; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.common.request.UniqueRead; +import org.simantics.db.common.request.WriteRequest; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.adapter.ActionFactory; +import org.simantics.modeling.ui.Activator; +import org.simantics.modeling.ui.diagram.renaming.ComponentsRenamingDialog; +import org.simantics.modeling.ui.diagram.renaming.ComponentsRenamingModel; + +/** + * @author Hannu Niemistö + */ +public class RenameDiagramComponents implements ActionFactory { + + @Override + public Runnable create(Object target) { + if (!(target instanceof Resource)) + return null; + final Resource composite = (Resource)target; + + return new Runnable() { + @Override + public void run() { + try { + ComponentsRenamingModel model = Simantics.getSession().syncRequest(new UniqueRead() { + @Override + public ComponentsRenamingModel perform(ReadGraph graph) throws DatabaseException { + return new ComponentsRenamingModel().read(graph, composite); + } + }); + ComponentsRenamingDialog dialog = new ComponentsRenamingDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + model); + if(dialog.open() == Dialog.OK) { + Simantics.getSession().syncRequest(new WriteRequest() { + @Override + public void perform(WriteGraph graph) + throws DatabaseException { + graph.markUndoPoint(); + model.write(graph); + } + }); + } + } catch (DatabaseException e) { + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "RenameDiagramComponents action failed, see exception for details", e)); + } + } + }; + } + +}