Repository: workcraft/workcraft
Issue: Name of a transformed STG work remains the same

To reproduce:
1. Create an STG work with a basic non-dedalock specification, e.g. p0->out- -> out+ ->p0 and p0 marked.
2. Save it as a.work
3. Do Tools->Convert->Net synthesis [Petrify]

Observed behaviour:
  The produced STG is named "a" (without ".work", but still confusing)

Expected behaviour:
  Add a numerical suffix to distinguish this new work, e.g. "a 1"

Note, if the new work "a" is transformed again, then the result is called "a 1" as expected. So, the problem only appears when transforming the original "a.work".

---

This issue was imported from Launchpad bug.
- date created: 2015-02-28T23:07:06Z
- owner: danilovesky
- assignee: danilovesky
- the launchpad url was https://bugs.launchpad.net/bugs/1426786

Changed files:
WorkcraftCore/src/org/workcraft/Framework.java
MpsatSynthesisPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatSynthesisResultHandler.java
PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifySynthesisResultHandler.java
WorkcraftCore/src/org/workcraft/gui/graph/commands/AbstractConversionCommand.java
FstPlugin/src/org/workcraft/plugins/fst/tasks/StgToFstConversionResultHandler.java
MpsatVerificationPlugin/src/org/workcraft/plugins/mpsat/MpsatCscConflictResolutionResultHandler.java
StgPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java
PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifyTransformationResultHandler.java
CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitToStgConverter.java
WtgPlugin/src/org/workcraft/plugins/wtg/tasks/WtgToStgConversionResultHandler.java
CpogPlugin/src/org/workcraft/plugins/cpog/tasks/PGMinerResultHandler.java
FstPlugin/src/org/workcraft/plugins/fst/tasks/PetriToFsmConversionResultHandler.java
CpogPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoResultHandler.java

diff --git a/CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitToStgConverter.java b/CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitToStgConverter.java
index 5190aa60d..854908f72 100644
--- a/CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitToStgConverter.java
+++ b/CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitToStgConverter.java
@@ -515,20 +515,22 @@ public class CircuitToStgConverter {
                 Hierarchy.getChildrenOfType(stg.getRoot(), VisualComponent.class));
         movedComponents.removeAll(unmovedPlaces);
         movedComponents.removeAll(unmovedTransition);
-        Rectangle2D bb = BoundingBoxHelper.mergeBoundingBoxes((Collection) movedComponents);
-        double xPlace = bb.getCenterX() - SCALE_X * 0.5 * unmovedPlaces.size();
-        double yPlace = bb.getMinY() - 2.0 * SCALE_Y;
-        for (VisualComponent component: unmovedPlaces) {
-            Point2D pos = new Point2D.Double(xPlace, yPlace);
-            component.setPosition(pos);
-            xPlace += SCALE_X;
-        }
-        double xTransition = bb.getCenterX() - SCALE_X * 0.5 * unmovedTransition.size();
-        double yTransition = bb.getMinY() - SCALE_Y;
-        for (VisualComponent component: unmovedTransition) {
-            Point2D pos = new Point2D.Double(xTransition, yTransition);
-            component.setPosition(pos);
-            xTransition += SCALE_X;
+        if (!movedComponents.isEmpty()) {
+            Rectangle2D bb = BoundingBoxHelper.mergeBoundingBoxes((Collection) movedComponents);
+            double xPlace = bb.getCenterX() - SCALE_X * 0.5 * unmovedPlaces.size();
+            double yPlace = bb.getMinY() - 2.0 * SCALE_Y;
+            for (VisualComponent component: unmovedPlaces) {
+                Point2D pos = new Point2D.Double(xPlace, yPlace);
+                component.setPosition(pos);
+                xPlace += SCALE_X;
+            }
+            double xTransition = bb.getCenterX() - SCALE_X * 0.5 * unmovedTransition.size();
+            double yTransition = bb.getMinY() - SCALE_Y;
+            for (VisualComponent component: unmovedTransition) {
+                Point2D pos = new Point2D.Double(xTransition, yTransition);
+                component.setPosition(pos);
+                xTransition += SCALE_X;
+            }
         }
     }
 
diff --git a/CpogPlugin/src/org/workcraft/plugins/cpog/tasks/PGMinerResultHandler.java b/CpogPlugin/src/org/workcraft/plugins/cpog/tasks/PGMinerResultHandler.java
index 4980c4eb6..d9b0a6d77 100644
--- a/CpogPlugin/src/org/workcraft/plugins/cpog/tasks/PGMinerResultHandler.java
+++ b/CpogPlugin/src/org/workcraft/plugins/cpog/tasks/PGMinerResultHandler.java
@@ -1,6 +1,5 @@
 package org.workcraft.plugins.cpog.tasks;
 
-import java.io.File;
 import java.lang.reflect.InvocationTargetException;
 
 import javax.swing.JOptionPane;
@@ -21,7 +20,6 @@ import org.workcraft.plugins.shared.tasks.ExternalProcessResult;
 import org.workcraft.tasks.DummyProgressMonitor;
 import org.workcraft.tasks.Result;
 import org.workcraft.tasks.Result.Outcome;
-import org.workcraft.util.FileUtils;
 import org.workcraft.workspace.ModelEntry;
 import org.workcraft.workspace.WorkspaceEntry;
 
@@ -32,21 +30,21 @@ public class PGMinerResultHandler extends DummyProgressMonitor<ExternalProcessRe
     private final boolean createNewWindow;
     private WorkspaceEntry weResult;
 
-    public PGMinerResultHandler(VisualCpog visualCpog, WorkspaceEntry we, boolean createNewWindow) {
+    public PGMinerResultHandler(final VisualCpog visualCpog, final WorkspaceEntry we, final boolean createNewWindow) {
         this.visualCpog = visualCpog;
         this.we = we;
         this.createNewWindow = createNewWindow;
         this.weResult = null;
     }
 
-    public void finished(final Result<? extends ExternalProcessResult> result, String description) {
+    public void finished(final Result<? extends ExternalProcessResult> result, final String description) {
         try {
             SwingUtilities.invokeAndWait(new Runnable() {
 
                 @Override
                 public void run() {
                     final Framework framework = Framework.getInstance();
-                    MainWindow mainWindow = framework.getMainWindow();
+                    final MainWindow mainWindow = framework.getMainWindow();
                     final GraphEditorPanel editor = framework.getMainWindow().getCurrentEditor();
                     final ToolboxPanel toolbox = editor.getToolBox();
                     final CpogSelectionTool tool = toolbox.getToolInstance(CpogSelectionTool.class);
@@ -55,35 +53,33 @@ public class PGMinerResultHandler extends DummyProgressMonitor<ExternalProcessRe
                                 "Concurrency extraction failed", JOptionPane.ERROR_MESSAGE);
                     } else {
                         if (createNewWindow) {
-                            CpogDescriptor cpogModel = new CpogDescriptor();
-                            MathModel mathModel = cpogModel.createMathModel();
-                            Path<String> path = we.getWorkspacePath();
-                            VisualModelDescriptor v = cpogModel.getVisualModelDescriptor();
+                            final CpogDescriptor cpogModel = new CpogDescriptor();
+                            final MathModel mathModel = cpogModel.createMathModel();
+                            final VisualModelDescriptor v = cpogModel.getVisualModelDescriptor();
                             try {
                                 if (v == null) {
                                     throw new VisualModelInstantiationException(
                                             "visual model is not defined for '" + cpogModel.getDisplayName() + "'.");
                                 }
                                 visualCpog = (VisualCpog) v.create(mathModel);
-                                final Path<String> directory = we.getWorkspacePath().getParent();
-                                final String name = FileUtils.getFileNameWithoutExtension(new File(path.getNode()));
                                 final ModelEntry me = new ModelEntry(cpogModel, visualCpog);
-                                weResult = framework.createWork(me, directory, name);
-                            } catch (VisualModelInstantiationException e) {
+                                final Path<String> path = we.getWorkspacePath();
+                                weResult = framework.createWork(me, path);
+                            } catch (final VisualModelInstantiationException e) {
                                 e.printStackTrace();
                             }
                         }
-                        String[] output = new String(result.getReturnValue().getOutput()).split("\\n");
+                        final String[] output = new String(result.getReturnValue().getOutput()).split("\\n");
 
                         we.captureMemento();
                         try {
                             for (int i = 0; i < output.length; i++) {
-                                String exp = output[i];
+                                final String exp = output[i];
                                 tool.insertExpression(exp, visualCpog, false, false, true, false);
                             }
 
                             we.saveMemento();
-                        } catch (Exception e) {
+                        } catch (final Exception e) {
                             we.cancelMemento();
                         }
                     }
diff --git a/CpogPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoResultHandler.java b/CpogPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoResultHandler.java
index 59eebd865..f8e7bc327 100644
--- a/CpogPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoResultHandler.java
+++ b/CpogPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoResultHandler.java
@@ -43,25 +43,22 @@ public class ScencoResultHandler extends DummyProgressMonitor<ScencoResult> {
             String resultDirectory = result.getReturnValue().getResultDirectory();
             solver.handleResult(stdoutLines, resultDirectory);
 
-            // import verilog file into circuit
+            // Import Verilog file into circuit
             if (solver.isVerilog()) {
                 try {
                     byte[] verilogBytes = solver.getVerilog();
-                    ByteArrayInputStream in = new ByteArrayInputStream(verilogBytes);
-                    VerilogImporter verilogImporter = new VerilogImporter(false);
+                    final ByteArrayInputStream in = new ByteArrayInputStream(verilogBytes);
+                    final VerilogImporter verilogImporter = new VerilogImporter(false);
                     final Circuit circuit = verilogImporter.importCircuit(in);
-                    Path<String> path = we.getWorkspacePath();
-                    final Path<String> directory = path.getParent();
-                    final String name = FileUtils.getFileNameWithoutExtension(new File(path.getNode()));
                     final ModelEntry me = new ModelEntry(new CircuitDescriptor(), circuit);
-
+                    final Path<String> path = we.getWorkspacePath();
                     final Framework framework = Framework.getInstance();
                     final MainWindow mainWindow = framework.getMainWindow();
-                    WorkspaceEntry weCircuit = framework.createWork(me, directory, name);
-                    VisualModel visualModel = weCircuit.getModelEntry().getVisualModel();
+                    final WorkspaceEntry weCircuit = framework.createWork(me, path);
+                    final VisualModel visualModel = weCircuit.getModelEntry().getVisualModel();
                     if (visualModel instanceof VisualCircuit) {
-                        VisualCircuit visualCircuit = (VisualCircuit) visualModel;
-                        String title = we.getModelEntry().getModel().getTitle();
+                        final VisualCircuit visualCircuit = (VisualCircuit) visualModel;
+                        final String title = we.getModelEntry().getModel().getTitle();
                         visualCircuit.setTitle(title);
                         SwingUtilities.invokeLater(new Runnable() {
                             @Override
@@ -75,19 +72,19 @@ public class ScencoResultHandler extends DummyProgressMonitor<ScencoResult> {
                 }
             }
         } else if (result.getOutcome() == Outcome.FAILED) {
-            String errorMessage = getErrorMessage(result.getReturnValue());
+            final String errorMessage = getErrorMessage(result.getReturnValue());
             final Framework framework = Framework.getInstance();
 
             // In case of an internal error, activate automatically verbose mode
             if (errorMessage.equals(INTERNAL_ERROR_MSG)) {
-                String[] sentence = result.getReturnValue().getStdout().split("\\n");
+                final String[] sentence = result.getReturnValue().getStdout().split("\\n");
                 for (int i = 0; i < sentence.length; i++) {
                     System.out.println(sentence[i]);
                 }
             }
 
             //Removing temporary files
-            File dir = solver.getDirectory();
+            final File dir = solver.getDirectory();
             FileUtils.deleteOnExitRecursively(dir);
 
             //Display the error
diff --git a/FstPlugin/src/org/workcraft/plugins/fst/tasks/PetriToFsmConversionResultHandler.java b/FstPlugin/src/org/workcraft/plugins/fst/tasks/PetriToFsmConversionResultHandler.java
index c4fa16e80..d44f2eb42 100644
--- a/FstPlugin/src/org/workcraft/plugins/fst/tasks/PetriToFsmConversionResultHandler.java
+++ b/FstPlugin/src/org/workcraft/plugins/fst/tasks/PetriToFsmConversionResultHandler.java
@@ -1,7 +1,5 @@
 package org.workcraft.plugins.fst.tasks;
 
-import java.io.File;
-
 import javax.swing.JOptionPane;
 
 import org.workcraft.Framework;
@@ -18,7 +16,6 @@ import org.workcraft.plugins.shared.tasks.ExternalProcessResult;
 import org.workcraft.tasks.DummyProgressMonitor;
 import org.workcraft.tasks.Result;
 import org.workcraft.tasks.Result.Outcome;
-import org.workcraft.util.FileUtils;
 import org.workcraft.workspace.ModelEntry;
 import org.workcraft.workspace.WorkspaceEntry;
 
@@ -26,30 +23,26 @@ public class PetriToFsmConversionResultHandler extends DummyProgressMonitor<Writ
     private final WriteSgConversionTask task;
     private WorkspaceEntry result;
 
-    public PetriToFsmConversionResultHandler(WriteSgConversionTask task) {
+    public PetriToFsmConversionResultHandler(final WriteSgConversionTask task) {
         this.task = task;
         this.result = null;
     }
 
     @Override
-    public void finished(final Result<? extends WriteSgConversionResult> result, String description) {
+    public void finished(final Result<? extends WriteSgConversionResult> result, final String description) {
         final Framework framework = Framework.getInstance();
-        WorkspaceEntry we = task.getWorkspaceEntry();
-        Path<String> path = we.getWorkspacePath();
         if (result.getOutcome() == Outcome.FINISHED) {
             final VisualFst fst = new VisualFst(result.getReturnValue().getConversionResult());
             final VisualFsm fsm = new VisualFsm(new Fsm());
             final FstToFsmConverter converter = new FstToFsmConverter(fst, fsm);
-
-            MathModel model = converter.getDstModel().getMathModel();
-            final Path<String> directory = path.getParent();
-            final String name = FileUtils.getFileNameWithoutExtension(new File(path.getNode()));
+            final MathModel model = converter.getDstModel().getMathModel();
             final ModelEntry me = new ModelEntry(new FsmDescriptor(), model);
-            this.result = framework.createWork(me, directory, name);
+            final Path<String> path = task.getWorkspaceEntry().getWorkspacePath();
+            this.result = framework.createWork(me, path);
         } else if (result.getOutcome() != Outcome.CANCELLED) {
-            MainWindow mainWindow = framework.getMainWindow();
+            final MainWindow mainWindow = framework.getMainWindow();
             if (result.getCause() == null) {
-                Result<? extends ExternalProcessResult> writeSgResult = result.getReturnValue().getResult();
+                final Result<? extends ExternalProcessResult> writeSgResult = result.getReturnValue().getResult();
                 JOptionPane.showMessageDialog(mainWindow,
                         "Petrify output:\\n" + writeSgResult.getReturnValue().getErrorsHeadAndTail(),
                         "Conversion failed", JOptionPane.WARNING_MESSAGE);
diff --git a/FstPlugin/src/org/workcraft/plugins/fst/tasks/StgToFstConversionResultHandler.java b/FstPlugin/src/org/workcraft/plugins/fst/tasks/StgToFstConversionResultHandler.java
index 1d243831f..e252a1129 100644
--- a/FstPlugin/src/org/workcraft/plugins/fst/tasks/StgToFstConversionResultHandler.java
+++ b/FstPlugin/src/org/workcraft/plugins/fst/tasks/StgToFstConversionResultHandler.java
@@ -1,7 +1,6 @@
 package org.workcraft.plugins.fst.tasks;
 
 import java.awt.Color;
-import java.io.File;
 import java.util.HashMap;
 
 import javax.swing.JOptionPane;
@@ -21,7 +20,6 @@ import org.workcraft.tasks.Result;
 import org.workcraft.tasks.Result.Outcome;
 import org.workcraft.util.ColorGenerator;
 import org.workcraft.util.ColorUtils;
-import org.workcraft.util.FileUtils;
 import org.workcraft.workspace.ModelEntry;
 import org.workcraft.workspace.WorkspaceEntry;
 
@@ -34,30 +32,27 @@ public class StgToFstConversionResultHandler extends DummyProgressMonitor<WriteS
     private final WriteSgConversionTask task;
     private WorkspaceEntry result;
 
-    public StgToFstConversionResultHandler(WriteSgConversionTask task) {
+    public StgToFstConversionResultHandler(final WriteSgConversionTask task) {
         this.task = task;
         this.result = null;
     }
 
     @Override
-    public void finished(final Result<? extends WriteSgConversionResult> result, String description) {
+    public void finished(final Result<? extends WriteSgConversionResult> result, final String description) {
         final Framework framework = Framework.getInstance();
-        WorkspaceEntry we = task.getWorkspaceEntry();
-        Path<String> path = we.getWorkspacePath();
         if (result.getOutcome() == Outcome.FINISHED) {
-            Fst model = result.getReturnValue().getConversionResult();
-            final Path<String> directory = path.getParent();
-            final String name = FileUtils.getFileNameWithoutExtension(new File(path.getNode()));
+            final Fst model = result.getReturnValue().getConversionResult();
             final ModelEntry me = new ModelEntry(new FstDescriptor(), model);
-            this.result = framework.createWork(me, directory, name);
-            VisualModel visualModel = me.getVisualModel();
+            final Path<String> path = task.getWorkspaceEntry().getWorkspacePath();
+            this.result = framework.createWork(me, path);
+            final VisualModel visualModel = me.getVisualModel();
             if (visualModel instanceof VisualFst) {
                 highlightCscConflicts((VisualFst) visualModel);
             }
         } else if (result.getOutcome() != Outcome.CANCELLED) {
-            MainWindow mainWindow = framework.getMainWindow();
+            final MainWindow mainWindow = framework.getMainWindow();
             if (result.getCause() == null) {
-                Result<? extends ExternalProcessResult> petrifyResult = result.getReturnValue().getResult();
+                final Result<? extends ExternalProcessResult> petrifyResult = result.getReturnValue().getResult();
                 JOptionPane.showMessageDialog(mainWindow,
                         "Petrify output:\\n" + petrifyResult.getReturnValue().getErrorsHeadAndTail(),
                         "Conversion failed", JOptionPane.WARNING_MESSAGE);
@@ -67,13 +62,13 @@ public class StgToFstConversionResultHandler extends DummyProgressMonitor<WriteS
         }
     }
 
-    protected void highlightCscConflicts(VisualFst visualFst) {
-        HashMap<String, Color> codeToColorMap = new HashMap<>();
-        for (VisualState state: visualFst.getVisualStates()) {
-            String name = visualFst.getMathName(state);
+    protected void highlightCscConflicts(final VisualFst visualFst) {
+        final HashMap<String, Color> codeToColorMap = new HashMap<>();
+        for (final VisualState state: visualFst.getVisualStates()) {
+            final String name = visualFst.getMathName(state);
             if (name.endsWith("_csc")) {
                 String code = null;
-                String[] nameParts = name.split("_");
+                final String[] nameParts = name.split("_");
                 if (nameParts.length == 3) {
                     code = name.split("_")[1];
                 }
diff --git a/MpsatSynthesisPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatSynthesisResultHandler.java b/MpsatSynthesisPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatSynthesisResultHandler.java
index e968ef568..85edde81f 100644
--- a/MpsatSynthesisPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatSynthesisResultHandler.java
+++ b/MpsatSynthesisPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatSynthesisResultHandler.java
@@ -1,7 +1,6 @@
 package org.workcraft.plugins.mpsat.tasks;
 
 import java.io.ByteArrayInputStream;
-import java.io.File;
 
 import javax.swing.JOptionPane;
 import javax.swing.SwingUtilities;
@@ -24,7 +23,6 @@ import org.workcraft.plugins.shared.tasks.ExternalProcessResult;
 import org.workcraft.tasks.DummyProgressMonitor;
 import org.workcraft.tasks.Result;
 import org.workcraft.tasks.Result.Outcome;
-import org.workcraft.util.FileUtils;
 import org.workcraft.util.LogUtils;
 import org.workcraft.workspace.ModelEntry;
 import org.workcraft.workspace.WorkspaceEntry;
@@ -35,13 +33,13 @@ public class MpsatSynthesisResultHandler extends DummyProgressMonitor<MpsatSynth
     private final MpsatSynthesisChainTask task;
     private WorkspaceEntry result;
 
-    public MpsatSynthesisResultHandler(MpsatSynthesisChainTask task) {
+    public MpsatSynthesisResultHandler(final MpsatSynthesisChainTask task) {
         this.task = task;
         this.result = null;
     }
 
     @Override
-    public void finished(final Result<? extends MpsatSynthesisChainResult> result, String description) {
+    public void finished(final Result<? extends MpsatSynthesisChainResult> result, final String description) {
         switch (result.getOutcome()) {
         case FINISHED:
             handleSuccess(result);
@@ -55,9 +53,9 @@ public class MpsatSynthesisResultHandler extends DummyProgressMonitor<MpsatSynth
     }
 
     private void handleSuccess(final Result<? extends MpsatSynthesisChainResult> result) {
-        MpsatSynthesisChainResult returnValue = result.getReturnValue();
+        final MpsatSynthesisChainResult returnValue = result.getReturnValue();
         final MpsatSynthesisMode mpsatMode = returnValue.getMpsatSettings().getMode();
-        ExternalProcessResult mpsatReturnValue = returnValue.getMpsatResult().getReturnValue();
+        final ExternalProcessResult mpsatReturnValue = returnValue.getMpsatResult().getReturnValue();
         switch (mpsatMode) {
         case COMPLEX_GATE_IMPLEMENTATION:
             handleSynthesisResult(mpsatReturnValue, false, RenderType.GATE);
@@ -72,7 +70,7 @@ public class MpsatSynthesisResultHandler extends DummyProgressMonitor<MpsatSynth
             handleSynthesisResult(mpsatReturnValue, false, RenderType.GATE);
             break;
         default:
-            MainWindow mainWindow = Framework.getInstance().getMainWindow();
+            final MainWindow mainWindow = Framework.getInstance().getMainWindow();
             JOptionPane.showMessageDialog(mainWindow,
                     "Warning: MPSat synthesis mode \\'" + mpsatMode.getArgument() + "\\' is not (yet) supported.",
                     TITLE, JOptionPane.WARNING_MESSAGE);
@@ -80,19 +78,19 @@ public class MpsatSynthesisResultHandler extends DummyProgressMonitor<MpsatSynth
         }
     }
 
-    private void handleSynthesisResult(ExternalProcessResult mpsatResult, boolean sequentialAssign, RenderType renderType) {
+    private void handleSynthesisResult(final ExternalProcessResult mpsatResult, final boolean sequentialAssign, final RenderType renderType) {
         final String log = new String(mpsatResult.getOutput());
         if ((log != null) && !log.isEmpty()) {
             System.out.println(log);
             System.out.println();
         }
-        byte[] eqnOutput = mpsatResult.getFileData(MpsatSynthesisTask.EQN_FILE_NAME);
+        final byte[] eqnOutput = mpsatResult.getFileData(MpsatSynthesisTask.EQN_FILE_NAME);
         if (eqnOutput != null) {
             LogUtils.logInfoLine("MPSat synthesis result in EQN format:");
             System.out.println(new String(eqnOutput));
             System.out.println();
         }
-        byte[] verilogOutput = mpsatResult.getFileData(MpsatSynthesisTask.VERILOG_FILE_NAME);
+        final byte[] verilogOutput = mpsatResult.getFileData(MpsatSynthesisTask.VERILOG_FILE_NAME);
         if (verilogOutput != null) {
             LogUtils.logInfoLine("MPSat synthesis result in Verilog format:");
             System.out.println(new String(verilogOutput));
@@ -100,24 +98,21 @@ public class MpsatSynthesisResultHandler extends DummyProgressMonitor<MpsatSynth
         }
         if (MpsatSynthesisSettings.getOpenSynthesisResult() && (verilogOutput != null)) {
             try {
-                ByteArrayInputStream in = new ByteArrayInputStream(verilogOutput);
-                VerilogImporter verilogImporter = new VerilogImporter(sequentialAssign);
+                final Framework framework = Framework.getInstance();
+                final ByteArrayInputStream in = new ByteArrayInputStream(verilogOutput);
+                final VerilogImporter verilogImporter = new VerilogImporter(sequentialAssign);
                 final Circuit circuit = verilogImporter.importCircuit(in);
-                final WorkspaceEntry we = task.getWorkspaceEntry();
-                Path<String> path = we.getWorkspacePath();
-                final Path<String> directory = path.getParent();
-                final String name = FileUtils.getFileNameWithoutExtension(new File(path.getNode()));
                 final ModelEntry me = new ModelEntry(new CircuitDescriptor(), circuit);
-
-                final Framework framework = Framework.getInstance();
-                result = framework.createWork(me, directory, name);
-                VisualModel visualModel = result.getModelEntry().getVisualModel();
+                final WorkspaceEntry we = task.getWorkspaceEntry();
+                final Path<String> path = we.getWorkspacePath();
+                result = framework.createWork(me, path);
+                final VisualModel visualModel = result.getModelEntry().getVisualModel();
                 if (visualModel instanceof VisualCircuit) {
-                    VisualCircuit visualCircuit = (VisualCircuit) visualModel;
-                    for (VisualFunctionComponent component: visualCircuit.getVisualFunctionComponents()) {
+                    final VisualCircuit visualCircuit = (VisualCircuit) visualModel;
+                    for (final VisualFunctionComponent component: visualCircuit.getVisualFunctionComponents()) {
                         component.setRenderType(renderType);
                     }
-                    String title = we.getModelEntry().getModel().getTitle();
+                    final String title = we.getModelEntry().getModel().getTitle();
                     visualCircuit.setTitle(title);
                     if (!we.getFile().exists()) {
                         JOptionPane.showMessageDialog(null,
@@ -142,7 +137,7 @@ public class MpsatSynthesisResultHandler extends DummyProgressMonitor<MpsatSynth
                         }
                     });
                 }
-            } catch (DeserialisationException e) {
+            } catch (final DeserialisationException e) {
                 throw new RuntimeException(e);
             }
         }
@@ -150,42 +145,42 @@ public class MpsatSynthesisResultHandler extends DummyProgressMonitor<MpsatSynth
 
     private void handleFailure(final Result<? extends MpsatSynthesisChainResult> result) {
         String errorMessage = "Error: MPSat synthesis failed.";
-        Throwable genericCause = result.getCause();
+        final Throwable genericCause = result.getCause();
         if (genericCause != null) {
             // Exception was thrown somewhere in the chain task run() method (not in any of the subtasks)
             errorMessage += ERROR_CAUSE_PREFIX + genericCause.toString();
         } else {
-            MpsatSynthesisChainResult returnValue = result.getReturnValue();
-            Result<? extends Object> exportResult = (returnValue == null) ? null : returnValue.getExportResult();
-            Result<? extends ExternalProcessResult> punfResult = (returnValue == null) ? null : returnValue.getPunfResult();
-            Result<? extends ExternalProcessResult> mpsatResult = (returnValue == null) ? null : returnValue.getMpsatResult();
+            final MpsatSynthesisChainResult returnValue = result.getReturnValue();
+            final Result<? extends Object> exportResult = (returnValue == null) ? null : returnValue.getExportResult();
+            final Result<? extends ExternalProcessResult> punfResult = (returnValue == null) ? null : returnValue.getPunfResult();
+            final Result<? extends ExternalProcessResult> mpsatResult = (returnValue == null) ? null : returnValue.getMpsatResult();
             if ((exportResult != null) && (exportResult.getOutcome() == Outcome.FAILED)) {
                 errorMessage += "\\n\\nCould not export the model as a .g file.";
-                Throwable exportCause = exportResult.getCause();
+                final Throwable exportCause = exportResult.getCause();
                 if (exportCause != null) {
                     errorMessage += ERROR_CAUSE_PREFIX + exportCause.toString();
                 }
             } else if ((punfResult != null) && (punfResult.getOutcome() == Outcome.FAILED)) {
                 errorMessage += "\\n\\nPunf could not build the unfolding prefix.";
-                Throwable punfCause = punfResult.getCause();
+                final Throwable punfCause = punfResult.getCause();
                 if (punfCause != null) {
                     errorMessage += ERROR_CAUSE_PREFIX + punfCause.toString();
                 } else {
-                    ExternalProcessResult punfReturnValue = punfResult.getReturnValue();
+                    final ExternalProcessResult punfReturnValue = punfResult.getReturnValue();
                     if (punfReturnValue != null) {
-                        String punfError = punfReturnValue.getErrorsHeadAndTail();
+                        final String punfError = punfReturnValue.getErrorsHeadAndTail();
                         errorMessage += ERROR_CAUSE_PREFIX + punfError;
                     }
                 }
             } else if ((mpsatResult != null) && (mpsatResult.getOutcome() == Outcome.FAILED)) {
                 errorMessage += "\\n\\nMPSat did not execute as expected.";
-                Throwable mpsatCause = mpsatResult.getCause();
+                final Throwable mpsatCause = mpsatResult.getCause();
                 if (mpsatCause != null) {
                     errorMessage += ERROR_CAUSE_PREFIX + mpsatCause.toString();
                 } else {
-                    ExternalProcessResult mpsatReturnValue = mpsatResult.getReturnValue();
+                    final ExternalProcessResult mpsatReturnValue = mpsatResult.getReturnValue();
                     if (mpsatReturnValue != null) {
-                        String mpsatError = mpsatReturnValue.getErrorsHeadAndTail();
+                        final String mpsatError = mpsatReturnValue.getErrorsHeadAndTail();
                         errorMessage += ERROR_CAUSE_PREFIX + mpsatError;
                     }
                 }
@@ -193,7 +188,7 @@ public class MpsatSynthesisResultHandler extends DummyProgressMonitor<MpsatSynth
                 errorMessage += "\\n\\nMPSat chain task returned failure status without further explanation.";
             }
         }
-        MainWindow mainWindow = Framework.getInstance().getMainWindow();
+        final MainWindow mainWindow = Framework.getInstance().getMainWindow();
         JOptionPane.showMessageDialog(mainWindow, errorMessage, TITLE, JOptionPane.ERROR_MESSAGE);
     }
 
diff --git a/MpsatVerificationPlugin/src/org/workcraft/plugins/mpsat/MpsatCscConflictResolutionResultHandler.java b/MpsatVerificationPlugin/src/org/workcraft/plugins/mpsat/MpsatCscConflictResolutionResultHandler.java
index 226ba1aab..6638e4a29 100644
--- a/MpsatVerificationPlugin/src/org/workcraft/plugins/mpsat/MpsatCscConflictResolutionResultHandler.java
+++ b/MpsatVerificationPlugin/src/org/workcraft/plugins/mpsat/MpsatCscConflictResolutionResultHandler.java
@@ -1,7 +1,6 @@
 package org.workcraft.plugins.mpsat;
 
 import java.io.ByteArrayInputStream;
-import java.io.File;
 
 import javax.swing.JOptionPane;
 
@@ -14,7 +13,6 @@ import org.workcraft.plugins.stg.StgDescriptor;
 import org.workcraft.plugins.stg.StgModel;
 import org.workcraft.plugins.stg.interop.DotGImporter;
 import org.workcraft.tasks.Result;
-import org.workcraft.util.FileUtils;
 import org.workcraft.workspace.ModelEntry;
 import org.workcraft.workspace.WorkspaceEntry;
 
@@ -24,7 +22,7 @@ public class MpsatCscConflictResolutionResultHandler implements Runnable {
     private final Result<? extends ExternalProcessResult> result;
     private WorkspaceEntry weResult;
 
-    public MpsatCscConflictResolutionResultHandler(WorkspaceEntry we, Result<? extends ExternalProcessResult> result) {
+    public MpsatCscConflictResolutionResultHandler(final WorkspaceEntry we, final Result<? extends ExternalProcessResult> result) {
         this.we = we;
         this.result = result;
         this.weResult = null;
@@ -37,7 +35,7 @@ public class MpsatCscConflictResolutionResultHandler implements Runnable {
         }
         try {
             return new DotGImporter().importSTG(new ByteArrayInputStream(content));
-        } catch (DeserialisationException e) {
+        } catch (final DeserialisationException e) {
             throw new RuntimeException(e);
         }
     }
@@ -45,20 +43,16 @@ public class MpsatCscConflictResolutionResultHandler implements Runnable {
     @Override
     public void run() {
         final Framework framework = Framework.getInstance();
-        Path<String> path = we.getWorkspacePath();
-        String fileName = FileUtils.getFileNameWithoutExtension(new File(path.getNode()));
-
-        StgModel model = getResolvedStg();
+        final StgModel model = getResolvedStg();
         if (model == null) {
-            String errorMessage = result.getReturnValue().getErrorsHeadAndTail();
+            final String errorMessage = result.getReturnValue().getErrorsHeadAndTail();
             JOptionPane.showMessageDialog(framework.getMainWindow(),
                     "MPSat output: \\n" + errorMessage,
                     "Conflict resolution failed", JOptionPane.WARNING_MESSAGE);
         } else {
-            Path<String> directory = path.getParent();
-            String name = fileName + "_resolved";
-            ModelEntry me = new ModelEntry(new StgDescriptor(), model);
-            weResult = framework.createWork(me, directory, name);
+            final ModelEntry me = new ModelEntry(new StgDescriptor(), model);
+            final Path<String> path = we.getWorkspacePath();
+            weResult = framework.createWork(me, path);
         }
     }
 
diff --git a/PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifySynthesisResultHandler.java b/PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifySynthesisResultHandler.java
index dac70d8ea..b5d3618ae 100644
--- a/PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifySynthesisResultHandler.java
+++ b/PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifySynthesisResultHandler.java
@@ -1,7 +1,6 @@
 package org.workcraft.plugins.petrify.tasks;
 
 import java.io.ByteArrayInputStream;
-import java.io.File;
 
 import javax.swing.JOptionPane;
 import javax.swing.SwingUtilities;
@@ -20,7 +19,6 @@ import org.workcraft.plugins.circuit.renderers.ComponentRenderingResult.RenderTy
 import org.workcraft.plugins.petrify.PetrifySettings;
 import org.workcraft.tasks.DummyProgressMonitor;
 import org.workcraft.tasks.Result;
-import org.workcraft.util.FileUtils;
 import org.workcraft.util.LogUtils;
 import org.workcraft.workspace.ModelEntry;
 import org.workcraft.workspace.WorkspaceEntry;
@@ -34,8 +32,8 @@ public class PetrifySynthesisResultHandler extends DummyProgressMonitor<PetrifyS
     private final boolean sequentialAssign;
     private WorkspaceEntry result;
 
-    public PetrifySynthesisResultHandler(WorkspaceEntry we, boolean boxSequentialComponents,
-            boolean boxCombinationalComponents, boolean sequentialAssign) {
+    public PetrifySynthesisResultHandler(final WorkspaceEntry we, final boolean boxSequentialComponents,
+            final boolean boxCombinationalComponents, final boolean sequentialAssign) {
         this.we = we;
         this.boxSequentialComponents = boxSequentialComponents;
         this.boxCombinationalComponents = boxCombinationalComponents;
@@ -44,7 +42,7 @@ public class PetrifySynthesisResultHandler extends DummyProgressMonitor<PetrifyS
     }
 
     @Override
-    public void finished(final Result<? extends PetrifySynthesisResult> result, String description) {
+    public void finished(final Result<? extends PetrifySynthesisResult> result, final String description) {
         switch (result.getOutcome()) {
         case FINISHED:
             handleSuccess(result);
@@ -58,39 +56,36 @@ public class PetrifySynthesisResultHandler extends DummyProgressMonitor<PetrifyS
     }
 
     private void handleSuccess(final Result<? extends PetrifySynthesisResult> result) {
-        String log = result.getReturnValue().getLog();
+        final String log = result.getReturnValue().getLog();
         if ((log != null) && !log.isEmpty()) {
             LogUtils.logInfoLine("Petrify synthesis log:");
             System.out.println(log);
         }
 
-        String equations = result.getReturnValue().getEquation();
+        final String equations = result.getReturnValue().getEquation();
         if ((equations != null) && !equations.isEmpty()) {
             LogUtils.logInfoLine("Petrify synthesis result in EQN format:");
             System.out.println(equations);
         }
 
-        String verilog = result.getReturnValue().getVerilog();
+        final String verilog = result.getReturnValue().getVerilog();
         if (PetrifySettings.getOpenSynthesisResult() && (verilog != null) && !verilog.isEmpty()) {
             LogUtils.logInfoLine("Petrify synthesis result in Verilog format:");
             System.out.println(verilog);
             try {
-                ByteArrayInputStream in = new ByteArrayInputStream(verilog.getBytes());
-                VerilogImporter verilogImporter = new VerilogImporter(sequentialAssign);
+                final ByteArrayInputStream in = new ByteArrayInputStream(verilog.getBytes());
+                final VerilogImporter verilogImporter = new VerilogImporter(sequentialAssign);
                 final Circuit circuit = verilogImporter.importCircuit(in);
-                Path<String> path = we.getWorkspacePath();
-                final Path<String> directory = path.getParent();
-                final String name = FileUtils.getFileNameWithoutExtension(new File(path.getNode()));
+                final Path<String> path = we.getWorkspacePath();
                 final ModelEntry me = new ModelEntry(new CircuitDescriptor(), circuit);
-
                 final Framework framework = Framework.getInstance();
                 final MainWindow mainWindow = framework.getMainWindow();
-                this.result = framework.createWork(me, directory, name);
-                VisualModel visualModel = this.result.getModelEntry().getVisualModel();
+                this.result = framework.createWork(me, path);
+                final VisualModel visualModel = this.result.getModelEntry().getVisualModel();
                 if (visualModel instanceof VisualCircuit) {
-                    VisualCircuit visualCircuit = (VisualCircuit) visualModel;
+                    final VisualCircuit visualCircuit = (VisualCircuit) visualModel;
                     setComponentsRenderStyle(visualCircuit);
-                    String title = we.getModelEntry().getModel().getTitle();
+                    final String title = we.getModelEntry().getModel().getTitle();
                     visualCircuit.setTitle(title);
                     if (!we.getFile().exists()) {
                         JOptionPane.showMessageDialog(mainWindow,
@@ -113,14 +108,14 @@ public class PetrifySynthesisResultHandler extends DummyProgressMonitor<PetrifyS
                         }
                     });
                 }
-            } catch (DeserialisationException e) {
+            } catch (final DeserialisationException e) {
                 throw new RuntimeException(e);
             }
         }
     }
 
-    private void setComponentsRenderStyle(VisualCircuit visualCircuit) {
-        for (VisualFunctionComponent component: visualCircuit.getVisualFunctionComponents()) {
+    private void setComponentsRenderStyle(final VisualCircuit visualCircuit) {
+        for (final VisualFunctionComponent component: visualCircuit.getVisualFunctionComponents()) {
             if (component.isSequentialGate()) {
                 if (boxSequentialComponents) {
                     component.setRenderType(RenderType.BOX);
@@ -135,11 +130,11 @@ public class PetrifySynthesisResultHandler extends DummyProgressMonitor<PetrifyS
 
     private void handleFailure(final Result<? extends PetrifySynthesisResult> result) {
         String errorMessage = "Error: Petrify synthesis failed.";
-        PetrifySynthesisResult returnValue = result.getReturnValue();
+        final PetrifySynthesisResult returnValue = result.getReturnValue();
         if (returnValue != null) {
             errorMessage += ERROR_CAUSE_PREFIX + returnValue.getStderr();
         }
-        MainWindow mainWindow = Framework.getInstance().getMainWindow();
+        final MainWindow mainWindow = Framework.getInstance().getMainWindow();
         JOptionPane.showMessageDialog(mainWindow, errorMessage, TITLE, JOptionPane.ERROR_MESSAGE);
     }
 
diff --git a/PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifyTransformationResultHandler.java b/PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifyTransformationResultHandler.java
index 312e287d1..114c3da13 100644
--- a/PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifyTransformationResultHandler.java
+++ b/PetrifyPlugin/src/org/workcraft/plugins/petrify/tasks/PetrifyTransformationResultHandler.java
@@ -1,6 +1,5 @@
 package org.workcraft.plugins.petrify.tasks;
 
-import java.io.File;
 import java.util.HashMap;
 
 import javax.swing.JOptionPane;
@@ -28,7 +27,6 @@ import org.workcraft.plugins.stg.StgModel;
 import org.workcraft.tasks.DummyProgressMonitor;
 import org.workcraft.tasks.Result;
 import org.workcraft.tasks.Result.Outcome;
-import org.workcraft.util.FileUtils;
 import org.workcraft.workspace.ModelEntry;
 import org.workcraft.workspace.WorkspaceEntry;
 
@@ -50,15 +48,13 @@ public class PetrifyTransformationResultHandler extends DummyProgressMonitor<Pet
     @Override
     public void finished(final Result<? extends PetrifyTransformationResult> result, String description) {
         final Framework framework = Framework.getInstance();
-        Path<String> path = we.getWorkspacePath();
         if (result.getOutcome() == Outcome.FINISHED) {
             StgModel stgModel = result.getReturnValue().getResult();
             PetriNetModel model = convertResultStgToPetriNet ? stgModel : convertStgToPetriNet(stgModel);
-            final Path<String> directory = path.getParent();
-            final String name = FileUtils.getFileNameWithoutExtension(new File(path.getNode()));
             final ModelDescriptor modelDescriptor = convertResultStgToPetriNet ? new StgDescriptor() : new PetriNetDescriptor();
             final ModelEntry me = new ModelEntry(modelDescriptor, model);
-            this.result = framework.createWork(me, directory, name);
+            final Path<String> path = we.getWorkspacePath();
+            this.result = framework.createWork(me, path);
         } else if (result.getOutcome() == Outcome.FAILED) {
             MainWindow mainWindow = framework.getMainWindow();
             if (result.getCause() == null) {
diff --git a/StgPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java b/StgPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java
index 76a189f41..7e4e8c507 100644
--- a/StgPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java
+++ b/StgPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java
@@ -60,7 +60,6 @@ import org.workcraft.plugins.stg.converters.StgToDtdConverter;
 import org.workcraft.util.ColorGenerator;
 import org.workcraft.util.Pair;
 import org.workcraft.workspace.ModelEntry;
-import org.workcraft.workspace.WorkspaceEntry;
 
 public class StgSimulationTool extends PetriSimulationTool {
     private static final int COLUMN_SIGNAL = 0;
@@ -83,7 +82,7 @@ public class StgSimulationTool extends PetriSimulationTool {
 
         private final String name;
 
-        SignalState(String name) {
+        SignalState(final String name) {
             this.name = name;
         }
 
@@ -110,12 +109,12 @@ public class StgSimulationTool extends PetriSimulationTool {
         public Boolean visible = true;
         public Color color = Color.BLACK;
 
-        public SignalData(String name, SignalTransition.Type type) {
+        public SignalData(final String name, final SignalTransition.Type type) {
             this.name = name;
             this.type = type;
         }
 
-        public void copy(SignalData signalData) {
+        public void copy(final SignalData signalData) {
             if (signalData != null) {
                 value = signalData.value;
                 excited = signalData.excited;
@@ -127,7 +126,7 @@ public class StgSimulationTool extends PetriSimulationTool {
 
     @SuppressWarnings("serial")
     private final class StateTable extends JTable {
-        StateTable(StateTableModel model) {
+        StateTable(final StateTableModel model) {
             super(model);
             getTableHeader().setReorderingAllowed(false);
             setDragEnabled(true);
@@ -143,12 +142,12 @@ public class StgSimulationTool extends PetriSimulationTool {
         }
 
         @Override
-        public void editingStopped(ChangeEvent e) {
-            TableCellEditor cellEditor = getCellEditor();
-            String signalName = signals.get(editingRow);
+        public void editingStopped(final ChangeEvent e) {
+            final TableCellEditor cellEditor = getCellEditor();
+            final String signalName = signals.get(editingRow);
             if ((cellEditor != null) && (signalName != null)) {
-                SignalData signalData = signalDataMap.get(signalName);
-                Object value = cellEditor.getCellEditorValue();
+                final SignalData signalData = signalDataMap.get(signalName);
+                final Object value = cellEditor.getCellEditorValue();
                 if ((signalData != null) && (value != null)) {
                     switch (editingColumn) {
                     case COLUMN_VISIBILE:
@@ -173,7 +172,7 @@ public class StgSimulationTool extends PetriSimulationTool {
         }
 
         @Override
-        public String getColumnName(int column) {
+        public String getColumnName(final int column) {
             switch (column) {
             case COLUMN_SIGNAL: return "Signal";
             case COLUMN_STATE: return "State";
@@ -184,7 +183,7 @@ public class StgSimulationTool extends PetriSimulationTool {
         }
 
         @Override
-        public Class<?> getColumnClass(int col) {
+        public Class<?> getColumnClass(final int col) {
             switch (col) {
             case COLUMN_SIGNAL: return SignalData.class;
             case COLUMN_STATE: return SignalData.class;
@@ -200,10 +199,10 @@ public class StgSimulationTool extends PetriSimulationTool {
         }
 
         @Override
-        public Object getValueAt(int row, int col) {
+        public Object getValueAt(final int row, final int col) {
             if (row < signalDataMap.size()) {
-                String signalName = signals.get(row);
-                SignalData signalData = signalDataMap.get(signalName);
+                final String signalName = signals.get(row);
+                final SignalData signalData = signalDataMap.get(signalName);
                 if (signalData != null) {
                     switch (col) {
                     case COLUMN_SIGNAL: return signalData;
@@ -218,7 +217,7 @@ public class StgSimulationTool extends PetriSimulationTool {
         }
 
         @Override
-        public boolean isCellEditable(int row, int col) {
+        public boolean isCellEditable(final int row, final int col) {
             switch (col) {
             case COLUMN_SIGNAL: return false;
             case COLUMN_STATE: return false;
@@ -228,9 +227,9 @@ public class StgSimulationTool extends PetriSimulationTool {
             }
         }
 
-        public void reorder(int from, int to) {
+        public void reorder(final int from, final int to) {
             if ((from >= 0) && (from < signals.size()) && (to >= 0) && (to < signals.size()) && (from != to)) {
-                String name = signals.remove(from);
+                final String name = signals.remove(from);
                 signals.add(to, name);
                 fireTableDataChanged();
             }
@@ -241,7 +240,7 @@ public class StgSimulationTool extends PetriSimulationTool {
         @SuppressWarnings("serial")
         final JLabel label = new JLabel() {
             @Override
-            public void paint(Graphics g) {
+            public void paint(final Graphics g) {
                 g.setColor(getBackground());
                 g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
                 super.paint(g);
@@ -249,15 +248,15 @@ public class StgSimulationTool extends PetriSimulationTool {
         };
 
         @Override
-        public Component getTableCellRendererComponent(JTable table, Object value,
-                boolean isSelected, boolean hasFocus, int row, int column) {
+        public Component getTableCellRendererComponent(final JTable table, final Object value,
+                final boolean isSelected, final boolean hasFocus, final int row, final int column) {
             label.setText("");
             label.setBorder(PropertyEditorTable.BORDER_RENDER);
             label.setForeground(table.getForeground());
             label.setBackground(table.getBackground());
             label.setFont(table.getFont().deriveFont(Font.PLAIN));
             if (isActivated() && (value instanceof SignalData)) {
-                SignalData st = (SignalData) value;
+                final SignalData st = (SignalData) value;
                 switch (column) {
                 case COLUMN_SIGNAL:
                     label.setText(st.name);
@@ -282,57 +281,57 @@ public class StgSimulationTool extends PetriSimulationTool {
         private final DataFlavor localObjectFlavor = new ActivationDataFlavor(Integer.class, "Integer Row Index");
         private final JTable table;
 
-        public StateTableRowTransferHandler(JTable table) {
+        public StateTableRowTransferHandler(final JTable table) {
             this.table = table;
         }
 
         @Override
-        protected Transferable createTransferable(JComponent c) {
+        protected Transferable createTransferable(final JComponent c) {
             assert c == table;
             return new DataHandler(new Integer(table.getSelectedRow()), localObjectFlavor.getMimeType());
         }
 
         @Override
-        public boolean canImport(TransferHandler.TransferSupport info) {
-            boolean b = (info.getComponent() == table) && info.isDrop() && info.isDataFlavorSupported(localObjectFlavor);
+        public boolean canImport(final TransferHandler.TransferSupport info) {
+            final boolean b = (info.getComponent() == table) && info.isDrop() && info.isDataFlavorSupported(localObjectFlavor);
             table.setCursor(b ? DragSource.DefaultMoveDrop : DragSource.DefaultMoveNoDrop);
             return b;
         }
 
         @Override
-        public int getSourceActions(JComponent c) {
+        public int getSourceActions(final JComponent c) {
             return TransferHandler.COPY_OR_MOVE;
         }
 
         @Override
-        public boolean importData(TransferHandler.TransferSupport info) {
-            JTable target = (JTable) info.getComponent();
-            JTable.DropLocation dl = (JTable.DropLocation) info.getDropLocation();
+        public boolean importData(final TransferHandler.TransferSupport info) {
+            final JTable target = (JTable) info.getComponent();
+            final JTable.DropLocation dl = (JTable.DropLocation) info.getDropLocation();
             int rowTo = dl.getRow();
-            int max = table.getModel().getRowCount();
+            final int max = table.getModel().getRowCount();
             if ((rowTo < 0) || (rowTo > max)) {
                 rowTo = max;
             }
             target.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
             try {
-                Integer rowFrom = (Integer) info.getTransferable().getTransferData(localObjectFlavor);
+                final Integer rowFrom = (Integer) info.getTransferable().getTransferData(localObjectFlavor);
                 if (rowTo > rowFrom) {
                     rowTo--;
                 }
                 if ((rowFrom != -1) && (rowFrom != rowTo)) {
-                    StateTableModel stateTableModel = (StateTableModel) table.getModel();
+                    final StateTableModel stateTableModel = (StateTableModel) table.getModel();
                     stateTableModel.reorder(rowFrom, rowTo);
                     target.getSelectionModel().addSelectionInterval(rowTo, rowTo);
                     return true;
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 e.printStackTrace();
             }
             return false;
         }
 
         @Override
-        protected void exportDone(JComponent c, Transferable t, int act) {
+        protected void exportDone(final JComponent c, final Transferable t, final int act) {
             if ((act == TransferHandler.MOVE) || (act == TransferHandler.NONE)) {
                 table.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
             }
@@ -344,21 +343,21 @@ public class StgSimulationTool extends PetriSimulationTool {
         @SuppressWarnings("serial")
         private final JLabel label = new JLabel() {
             @Override
-            public void paint(Graphics g) {
+            public void paint(final Graphics g) {
                 g.setColor(getBackground());
                 g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
                 super.paint(g);
             }
         };
 
-        boolean isActive(int row, int column) {
+        boolean isActive(final int row, final int column) {
             if (column == 0) {
                 if (!mainTrace.isEmpty() && branchTrace.isEmpty()) {
                     return row == mainTrace.getPosition();
                 }
             } else {
-                int absoluteBranchSize = mainTrace.getPosition() + branchTrace.size();
-                int absoluteBranchPosition = mainTrace.getPosition() + branchTrace.getPosition();
+                final int absoluteBranchSize = mainTrace.getPosition() + branchTrace.size();
+                final int absoluteBranchPosition = mainTrace.getPosition() + branchTrace.getPosition();
                 if (!branchTrace.isEmpty() && (row >= mainTrace.getPosition()) && (row < absoluteBranchSize)) {
                     return row == absoluteBranchPosition;
                 }
@@ -367,14 +366,14 @@ public class StgSimulationTool extends PetriSimulationTool {
         }
 
         @Override
-        public Component getTableCellRendererComponent(JTable table, Object value,
-                boolean isSelected, boolean hasFocus, int row, int column) {
+        public Component getTableCellRendererComponent(final JTable table, final Object value,
+                final boolean isSelected, final boolean hasFocus, final int row, final int column) {
             JLabel result = null;
             label.setBorder(PropertyEditorTable.BORDER_RENDER);
             if (isActivated() && (value instanceof String)) {
                 label.setText(value.toString());
-                Node node = getUnderlyingStg().getNodeByReference(value.toString());
-                Color color = getNodeColor(node);
+                final Node node = getUnderlyingStg().getNodeByReference(value.toString());
+                final Color color = getNodeColor(node);
                 label.setForeground(color);
                 if (isActive(row, column)) {
                     label.setBackground(table.getSelectionBackground());
@@ -408,7 +407,7 @@ public class StgSimulationTool extends PetriSimulationTool {
 
     public void updateSignalState() {
         initialiseSignalState();
-        ArrayList<String> combinedTrace = new ArrayList<>();
+        final ArrayList<String> combinedTrace = new ArrayList<>();
         if (!mainTrace.isEmpty()) {
             combinedTrace.addAll(mainTrace.subList(0, mainTrace.getPosition()));
         }
@@ -416,12 +415,12 @@ public class StgSimulationTool extends PetriSimulationTool {
             combinedTrace.addAll(branchTrace.subList(0, branchTrace.getPosition()));
         }
 
-        for (String ref : combinedTrace) {
-            Node node = getUnderlyingStg().getNodeByReference(ref);
+        for (final String ref : combinedTrace) {
+            final Node node = getUnderlyingStg().getNodeByReference(ref);
             if (node instanceof SignalTransition) {
-                SignalTransition transition = (SignalTransition) node;
-                String signalReference = getUnderlyingStg().getSignalReference(transition);
-                SignalData signalState = signalDataMap.get(signalReference);
+                final SignalTransition transition = (SignalTransition) node;
+                final String signalReference = getUnderlyingStg().getSignalReference(transition);
+                final SignalData signalState = signalDataMap.get(signalReference);
                 if (signalState != null) {
                     switch (transition.getDirection()) {
                     case MINUS:
@@ -440,11 +439,11 @@ public class StgSimulationTool extends PetriSimulationTool {
             }
         }
 
-        for (Node node: getUnderlyingStg().getTransitions()) {
+        for (final Node node: getUnderlyingStg().getTransitions()) {
             if (node instanceof SignalTransition) {
-                SignalTransition transition = (SignalTransition) node;
-                String signalReference = getUnderlyingStg().getSignalReference(transition);
-                SignalData signalData = signalDataMap.get(signalReference);
+                final SignalTransition transition = (SignalTransition) node;
+                final String signalReference = getUnderlyingStg().getSignalReference(transition);
+                final SignalData signalData = signalDataMap.get(signalReference);
                 if (signalData != null) {
                     signalData.excited |= isEnabledNode(transition);
                 }
@@ -453,8 +452,8 @@ public class StgSimulationTool extends PetriSimulationTool {
     }
 
     public void initialiseSignalState() {
-        for (String signalName: signalDataMap.keySet()) {
-            SignalData signalData = signalDataMap.get(signalName);
+        for (final String signalName: signalDataMap.keySet()) {
+            final SignalData signalData = signalDataMap.get(signalName);
             signalData.value = SignalState.UNDEFINED;
             signalData.excited = false;
         }
@@ -469,30 +468,27 @@ public class StgSimulationTool extends PetriSimulationTool {
 
     @Override
     public void generateTraceGraph(final GraphEditor editor) {
-        Framework framework = Framework.getInstance();
-        Stg stg = getUnderlyingStg();
-        Trace trace = getCombinedTrace();
+        final Framework framework = Framework.getInstance();
+        final Trace trace = getCombinedTrace();
         if (trace.isEmpty()) {
             JOptionPane.showMessageDialog(framework.getMainWindow(),
                     "Cannot generate a timing diagram for an empty trace.",
                     "Generation of Timing Diagram", JOptionPane.WARNING_MESSAGE);
         } else {
-            LinkedList<Pair<String, Color>> visibleSignals = getVisibleSignals(stg);
-            StgToDtdConverter converter = new StgToDtdConverter(stg, trace, visibleSignals);
-            VisualDtd dtd = converter.getVisualDtd();
-
-            WorkspaceEntry we = editor.getWorkspaceEntry();
-            final Path<String> directory = we.getWorkspacePath().getParent();
-            final String desiredName = we.getWorkspacePath().getNode();
+            final Stg stg = getUnderlyingStg();
+            final LinkedList<Pair<String, Color>> visibleSignals = getVisibleSignals(stg);
+            final StgToDtdConverter converter = new StgToDtdConverter(stg, trace, visibleSignals);
+            final VisualDtd dtd = converter.getVisualDtd();
+            final Path<String> path = editor.getWorkspaceEntry().getWorkspacePath();
             final ModelEntry me = new ModelEntry(new DtdDescriptor(), dtd);
-            framework.createWork(me, directory, desiredName);
+            framework.createWork(me, path);
         }
     }
 
-    private LinkedList<Pair<String, Color>> getVisibleSignals(Stg stg) {
-        LinkedList<Pair<String, Color>> result = new LinkedList<>();
-        for (String signalRef: signals) {
-            SignalData signalData = signalDataMap.get(signalRef);
+    private LinkedList<Pair<String, Color>> getVisibleSignals(final Stg stg) {
+        final LinkedList<Pair<String, Color>> result = new LinkedList<>();
+        for (final String signalRef: signals) {
+            final SignalData signalData = signalDataMap.get(signalRef);
             if ((signalData != null) && signalData.visible) {
                 result.add(new Pair<String, Color>(signalData.name, signalData.color));
             }
@@ -501,13 +497,13 @@ public class StgSimulationTool extends PetriSimulationTool {
     }
 
     @Override
-    public String getTraceLabelByReference(String ref) {
+    public String getTraceLabelByReference(final String ref) {
         String result = null;
         if (ref != null) {
-            String name = NamespaceHelper.getReferenceName(ref);
-            String nameWithoutInstance = LabelParser.getTransitionName(name);
+            final String name = NamespaceHelper.getReferenceName(ref);
+            final String nameWithoutInstance = LabelParser.getTransitionName(name);
             if (nameWithoutInstance != null) {
-                String path = NamespaceHelper.getReferencePath(ref);
+                final String path = NamespaceHelper.getReferencePath(ref);
                 result = path + nameWithoutInstance;
             }
         }
@@ -515,14 +511,14 @@ public class StgSimulationTool extends PetriSimulationTool {
     }
 
     protected void initialiseStateMap() {
-        Stg stg = getUnderlyingStg();
-        HashMap<String, SignalData> newStateMap = new HashMap<>();
-        LinkedList<String> allSignals = new LinkedList<>();
-        for (Type type: Type.values()) {
-            Set<String> typedSignals = stg.getSignalReferences(type);
+        final Stg stg = getUnderlyingStg();
+        final HashMap<String, SignalData> newStateMap = new HashMap<>();
+        final LinkedList<String> allSignals = new LinkedList<>();
+        for (final Type type: Type.values()) {
+            final Set<String> typedSignals = stg.getSignalReferences(type);
             allSignals.addAll(typedSignals);
-            for (String signal: typedSignals) {
-                SignalData signalData = new SignalData(signal, type);
+            for (final String signal: typedSignals) {
+                final SignalData signalData = new SignalData(signal, type);
                 signalData.copy(signalDataMap.get(signal));
                 signalData.visible = type != Type.INTERNAL;
                 newStateMap.put(signal, signalData);
@@ -536,15 +532,15 @@ public class StgSimulationTool extends PetriSimulationTool {
         updateSignalState();
     }
 
-    private Color getNodeColor(Node node) {
+    private Color getNodeColor(final Node node) {
         if (node instanceof SignalTransition) {
-            SignalTransition transition = (SignalTransition) node;
+            final SignalTransition transition = (SignalTransition) node;
             return getTypeColor(transition.getSignalType());
         }
         return Color.BLACK;
     }
 
-    private Color getTypeColor(SignalTransition.Type type) {
+    private Color getTypeColor(final SignalTransition.Type type) {
         switch (type) {
         case INPUT:    return CommonSignalSettings.getInputColor();
         case OUTPUT:   return CommonSignalSettings.getOutputColor();
@@ -553,26 +549,26 @@ public class StgSimulationTool extends PetriSimulationTool {
         }
     }
 
-    public void coloriseTokens(Transition t) {
-        VisualStg visualStg = (VisualStg) getUnderlyingModel();
-        VisualTransition vt = visualStg.getVisualTransition(t);
+    public void coloriseTokens(final Transition t) {
+        final VisualStg visualStg = (VisualStg) getUnderlyingModel();
+        final VisualTransition vt = visualStg.getVisualTransition(t);
         if (vt == null) return;
         Color tokenColor = Color.black;
-        ColorGenerator tokenColorGenerator = vt.getTokenColorGenerator();
+        final ColorGenerator tokenColorGenerator = vt.getTokenColorGenerator();
         if (tokenColorGenerator != null) {
             // generate token colour
             tokenColor = tokenColorGenerator.updateColor();
         } else {
             // combine preset token colours
-            for (Connection c: visualStg.getConnections(vt)) {
+            for (final Connection c: visualStg.getConnections(vt)) {
                 if ((c.getSecond() == vt) && (c instanceof VisualConnection)) {
-                    VisualConnection vc = (VisualConnection) c;
+                    final VisualConnection vc = (VisualConnection) c;
                     if (vc.isTokenColorPropagator()) {
                         if (vc.getFirst() instanceof VisualPlace) {
-                            VisualPlace vp = (VisualPlace) c.getFirst();
+                            final VisualPlace vp = (VisualPlace) c.getFirst();
                             tokenColor = Coloriser.colorise(tokenColor, vp.getTokenColor());
                         } else if (vc instanceof VisualImplicitPlaceArc) {
-                            VisualImplicitPlaceArc vipa = (VisualImplicitPlaceArc) vc;
+                            final VisualImplicitPlaceArc vipa = (VisualImplicitPlaceArc) vc;
                             tokenColor = Coloriser.colorise(tokenColor, vipa.getTokenColor());
                         }
                     }
@@ -580,15 +576,15 @@ public class StgSimulationTool extends PetriSimulationTool {
             }
         }
         // propagate the colour to postset tokens
-        for (Connection c: visualStg.getConnections(vt)) {
+        for (final Connection c: visualStg.getConnections(vt)) {
             if ((c.getFirst() == vt) && (c instanceof VisualConnection)) {
-                VisualConnection vc = (VisualConnection) c;
+                final VisualConnection vc = (VisualConnection) c;
                 if (vc.isTokenColorPropagator()) {
                     if (vc.getSecond() instanceof VisualPlace) {
-                        VisualPlace vp = (VisualPlace) c.getSecond();
+                        final VisualPlace vp = (VisualPlace) c.getSecond();
                         vp.setTokenColor(tokenColor);
                     } else if (vc instanceof VisualImplicitPlaceArc) {
-                        VisualImplicitPlaceArc vipa = (VisualImplicitPlaceArc) vc;
+                        final VisualImplicitPlaceArc vipa = (VisualImplicitPlaceArc) vc;
                         vipa.setTokenColor(tokenColor);
                     }
                 }
diff --git a/WorkcraftCore/src/org/workcraft/Framework.java b/WorkcraftCore/src/org/workcraft/Framework.java
index d5c745d41..f3a3b33f9 100644
--- a/WorkcraftCore/src/org/workcraft/Framework.java
+++ b/WorkcraftCore/src/org/workcraft/Framework.java
@@ -591,6 +591,12 @@ public final class Framework {
         return null;
     }
 
+    public WorkspaceEntry createWork(ModelEntry me, Path<String> desiredPath) {
+        final Path<String> directory = desiredPath.getParent();
+        final String desiredName = desiredPath.getNode();
+        return createWork(me, directory, desiredName);
+    }
+
     public WorkspaceEntry createWork(ModelEntry me, Path<String> directory, String desiredName) {
         final Path<String> path = getWorkspace().createWorkPath(directory, desiredName);
         boolean open = me.isVisual() || CommonEditorSettings.getOpenNonvisual();
diff --git a/WorkcraftCore/src/org/workcraft/gui/graph/commands/AbstractConversionCommand.java b/WorkcraftCore/src/org/workcraft/gui/graph/commands/AbstractConversionCommand.java
index c6171a22b..2b2e6616c 100644
--- a/WorkcraftCore/src/org/workcraft/gui/graph/commands/AbstractConversionCommand.java
+++ b/WorkcraftCore/src/org/workcraft/gui/graph/commands/AbstractConversionCommand.java
@@ -30,9 +30,8 @@ public abstract class AbstractConversionCommand implements ScriptableCommand, Me
             return null;
         } else {
             final Framework framework = Framework.getInstance();
-            final Path<String> directory = we.getWorkspacePath().getParent();
-            final String name = we.getWorkspacePath().getNode();
-            return framework.createWork(meDst, directory, name);
+            final Path<String> desiredPath = we.getWorkspacePath();
+            return framework.createWork(meDst, desiredPath);
         }
     }
 
diff --git a/WtgPlugin/src/org/workcraft/plugins/wtg/tasks/WtgToStgConversionResultHandler.java b/WtgPlugin/src/org/workcraft/plugins/wtg/tasks/WtgToStgConversionResultHandler.java
index 36c0571a4..59640d986 100644
--- a/WtgPlugin/src/org/workcraft/plugins/wtg/tasks/WtgToStgConversionResultHandler.java
+++ b/WtgPlugin/src/org/workcraft/plugins/wtg/tasks/WtgToStgConversionResultHandler.java
@@ -1,7 +1,5 @@
 package org.workcraft.plugins.wtg.tasks;
 
-import java.io.File;
-
 import javax.swing.JOptionPane;
 
 import org.workcraft.Framework;
@@ -14,7 +12,6 @@ import org.workcraft.plugins.stg.StgDescriptor;
 import org.workcraft.tasks.DummyProgressMonitor;
 import org.workcraft.tasks.Result;
 import org.workcraft.tasks.Result.Outcome;
-import org.workcraft.util.FileUtils;
 import org.workcraft.workspace.ModelEntry;
 import org.workcraft.workspace.WorkspaceEntry;
 
@@ -23,30 +20,27 @@ public class WtgToStgConversionResultHandler extends DummyProgressMonitor<WaverC
     private final WaverConversionTask task;
     private WorkspaceEntry result;
 
-    public WtgToStgConversionResultHandler(WaverConversionTask task) {
+    public WtgToStgConversionResultHandler(final WaverConversionTask task) {
         this.task = task;
         this.result = null;
     }
 
     @Override
-    public void finished(final Result<? extends WaverConversionResult> result, String description) {
+    public void finished(final Result<? extends WaverConversionResult> result, final String description) {
         final Framework framework = Framework.getInstance();
-        WorkspaceEntry we = task.getWorkspaceEntry();
-        Path<String> path = we.getWorkspacePath();
         if (result.getOutcome() == Outcome.FINISHED) {
-            Stg model = result.getReturnValue().getConversionResult();
-            final Path<String> directory = path.getParent();
-            final String name = FileUtils.getFileNameWithoutExtension(new File(path.getNode()));
+            final Stg model = result.getReturnValue().getConversionResult();
             final ModelEntry me = new ModelEntry(new StgDescriptor(), model);
-            this.result = framework.createWork(me, directory, name);
+            final Path<String> path = task.getWorkspaceEntry().getWorkspacePath();
+            this.result = framework.createWork(me, path);
         } else if (result.getOutcome() != Outcome.CANCELLED) {
-            MainWindow mainWindow = framework.getMainWindow();
+            final MainWindow mainWindow = framework.getMainWindow();
             if (result.getCause() != null) {
                 ExceptionDialog.show(mainWindow, result.getCause());
             } else {
                 String message = "Unexpected Waver error";
                 if (result.getReturnValue() != null) {
-                    Result<? extends ExternalProcessResult> waverResult = result.getReturnValue().getResult();
+                    final Result<? extends ExternalProcessResult> waverResult = result.getReturnValue().getResult();
                     message = "Waver output:\\n" + waverResult.getReturnValue().getErrorsHeadAndTail();
                 }
                 JOptionPane.showMessageDialog(mainWindow, message, "Conversion failed", JOptionPane.WARNING_MESSAGE);