diff --git a/Build/Tools/BundleGenerator/BundleDefaults.cmake b/Build/Tools/BundleGenerator/BundleDefaults.cmake
deleted file mode 100755
index 6da6afaf82..0000000000
--- a/Build/Tools/BundleGenerator/BundleDefaults.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-set(BUNDLE_NAMESPACE "")
-set(DEFAULT_REQUIRED_BUNDLES "org.mitk.core.services")
-set(DEFAULT_REQUIRED_BUNDLES_FOR_GUI "org.mitk.gui.qt.common")
-set(DEFAULT_PLUGIN_VERSION "0.1")
-set(DEFAULT_PLUGIN_VENDOR "DKFZ, Medical and Biological Informatics")
-set(DEFAULT_VIEW_BASEID "org.mitk.views.")
-set(DEFAULT_VIEW_CLASS_BEGIN "Qmitk")
-set(DEFAULT_VIEW_BASE_CLASS "QmitkFunctionality")
-set(DEFAULT_VIEW_BASE_CLASS_H "QmitkFunctionality.h")
-set(PROJECT_STATIC_VAR "MITK_STATIC")
-set(DOXYGEN_INGROUP "MITKPlugins")
-set(DEFAULT_CREATE_PLUGIN_MACRO "MACRO_CREATE_MITK_PLUGIN()")
-set(DEFAULT_CREATE_GUI_PLUGIN_MACRO "MACRO_CREATE_MITK_PLUGIN(QmitkExt)")
-set(PLUGIN_TEMPLATE "${PROJECT_SOURCE_DIR}/../../../CMake/QBundleTemplate" CACHE PATH "Path to the plugin templates" FORCE)
-set(PLUGIN_COPYRIGHT "/*===================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center,
-Division of Medical and Biological Informatics.
-All rights reserved.
-
-This software is distributed WITHOUT ANY WARRANTY; without
-even the implied warranty of MERCHANTABILITY or FITNESS FOR
-A PARTICULAR PURPOSE.
-
-See LICENSE.txt or http://www.mitk.org for details.
-
-===================================================================*/")
diff --git a/Build/Tools/BundleGenerator/CMakeLists.txt b/Build/Tools/BundleGenerator/CMakeLists.txt
deleted file mode 100755
index e4817c1333..0000000000
--- a/Build/Tools/BundleGenerator/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-project(MITKBundleGenerator)
-
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
-set(BUNDLE_DEFAULTS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/BundleDefaults.cmake")
-
-add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../../BlueBerry/Build/BundleGenerator"
- "${CMAKE_CURRENT_BINARY_DIR}/Generated")
-#include(${CMAKE_CURRENT_SOURCE_DIR}/../../../Utilities/BlueBerry/Build/CMakeLists.txt)
diff --git a/Build/Tools/FilterFactoryItemGenerator/CMakeLists.txt b/Build/Tools/FilterFactoryItemGenerator/CMakeLists.txt
deleted file mode 100644
index 8b13789179..0000000000
--- a/Build/Tools/FilterFactoryItemGenerator/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/Build/Tools/FilterFactoryItemGenerator/CopyTemplate.java b/Build/Tools/FilterFactoryItemGenerator/CopyTemplate.java
deleted file mode 100644
index 59c1a6788a..0000000000
--- a/Build/Tools/FilterFactoryItemGenerator/CopyTemplate.java
+++ /dev/null
@@ -1,90 +0,0 @@
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-
-/**
- * This Class first opens and reads the template file at the sprecified path.
- * It them replaces all names by the title entered in the window.
- */
-public class CopyTemplate {
-
- String Title, mitkPath;
- FileReader fReader;
- BufferedWriter bWriter;
- StringWriter sWriter;
- StringReader sReader;
- FileWriter fWriter;
- String fileContent, newFileContent;
- int c;
-
- public CopyTemplate(String Title, String mitkPath) {
- this.Title = Title;
- this.mitkPath = mitkPath;
- }
-
-public void run()
- throws IOException
- {
- File mitkDir = new File(mitkPath);
- File algDir = new File(mitkDir, "Algorithms");
- File FFIDir = new File(algDir, "mitkFilterFactoryItem");
- File newFFI = new File(FFIDir, "mitk" + Title + "FFI.h");
- File templ = new File(FFIDir, "mitkFilterTemplateFFI.h");
- // open file
- try {
- fReader = new FileReader(templ);
- } catch (IOException e) {
- System.out.println("Fehler bei FileReader("
- + templ.getName()
- + ") @ "
- + FFIDir.getAbsolutePath()
- + "! "
- + e.getMessage());
- }
-
- // read file and replace title
- try {
- sWriter = new StringWriter();
- while ((c=fReader.read())!= -1) {
- sWriter.write(((char)c));
- }
- fileContent = sWriter.toString();
- newFileContent = fileContent.replaceAll(
- "FilterTemplate", Title);
- newFileContent = newFileContent.replaceAll(
- "FILTERTEMPLATE", Title.toUpperCase());
- } catch (IOException e) {
- System.out.println("Fehler bei StringWriter("
- + templ.getName()
- + ") @ "
- + FFIDir.getAbsolutePath()
- + "! "
- + e.getMessage());
- }
-
- // save new file
- try {
- sReader = new StringReader(newFileContent);
- fWriter = new FileWriter(newFFI);
- bWriter = new BufferedWriter(fWriter);
- while ((c=sReader.read())!= -1) {
- bWriter.write(((char)c));
- }
- bWriter.close();
- fReader.close();
- } catch (IOException e) {
- System.out.println("Fehler bei FileWriter("
- + newFFI.getName()
- + ") @ "
- + FFIDir.getAbsolutePath()
- + "! "
- + e.getMessage());
- }
- }
-}
diff --git a/Build/Tools/FilterFactoryItemGenerator/FilterFactoryItemGenerator.jar b/Build/Tools/FilterFactoryItemGenerator/FilterFactoryItemGenerator.jar
deleted file mode 100644
index 2b2a14bcbd..0000000000
Binary files a/Build/Tools/FilterFactoryItemGenerator/FilterFactoryItemGenerator.jar and /dev/null differ
diff --git a/Build/Tools/FilterFactoryItemGenerator/FilterFactoryItemGenerator.java b/Build/Tools/FilterFactoryItemGenerator/FilterFactoryItemGenerator.java
deleted file mode 100644
index 9745412225..0000000000
--- a/Build/Tools/FilterFactoryItemGenerator/FilterFactoryItemGenerator.java
+++ /dev/null
@@ -1,254 +0,0 @@
-import java.awt.FlowLayout;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.IOException;
-
-import javax.swing.Icon;
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.Border;
-
-
-/**
- * The tool autmaticaly creates a FilterFactoryItem from a template file
- * and inserts lines in several files, where the FilterFactoryItems ar listed.
- * This class creates a new window with input fields for text, like directory paths
- * and then starts start.class.
- *
- */
-
-public class FilterFactoryItemGenerator
-extends JFrame
-implements ActionListener
-{
- JFrame frameO;
- JPanel inputPanel, input1, input2, input2a, input3, input4, buttonPanel;
- JTextField textf1, textf2, textf2a, textf3, textf3a, textf4, textf4a;
- JLabel label1, label2, label2a, label3, label4, labelOut;
- JButton startButton, exitButton, explorerButton, textB2, textB2a;
- JFileChooser fChooser2, fChooser2a;
-
- public FilterFactoryItemGenerator()
- {
- frameO = new JFrame("FilterFactoryItemGenerator");
- String nameOS = new String(System.getProperty("os.name"));
- String userHome = System.getProperty("user.home");
- if (nameOS.equals("Windows XP")) {
- userHome = "C:" + File.separator + "home"
- + File.separator + System.getProperty("user.name");
- }
- Icon folder = new javax.swing.plaf.metal.MetalIconFactory.TreeFolderIcon();
- Border emptyBorder = new javax.swing.border.EmptyBorder(0,0,0,0);
-
- // Inputfeld
- inputPanel = new JPanel();
- inputPanel.setLayout(new GridLayout(5,1));
-
- input1 = new JPanel();
- input1.setLayout(new FlowLayout(FlowLayout.RIGHT));
- label1 = new JLabel("Filtername:");
- input1.add(label1);
- textf1 = new JTextField("NewFilter", 35);
- input1.add(textf1);
- inputPanel.add(input1);
-
- input2 = new JPanel();
- input2.setLayout(new FlowLayout(FlowLayout.RIGHT));
- label2 = new JLabel("Mitk Pfad:");
- input2.add(label2);
- fChooser2 = new JFileChooser();
- fChooser2.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- textB2 = new JButton(folder);
- textB2.setBorder(emptyBorder);
- textB2.addActionListener(this);
- input2.add(textB2);
- textf2 = new JTextField(userHome
- + File.separator
- + "ip++",
- 35);
- input2.add(textf2);
- inputPanel.add(input2);
-
- input2a = new JPanel();
- input2a.setLayout(new FlowLayout(FlowLayout.RIGHT));
- label2a = new JLabel("Alle.xml Pfad:");
- input2a.add(label2a);
- fChooser2a = new JFileChooser();
- fChooser2a.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- textB2a = new JButton(folder);
- textB2a.setBorder(emptyBorder);
- textB2a.addActionListener(this);
- input2a.add(textB2a);
- textf2a = new JTextField(userHome
- + File.separator
- + "ip++"
- + File.separator
- + "AppModules"
- + File.separator
- + "QmitkSegmentationToolBox",
- 35);
- input2a.add(textf2a);
- inputPanel.add(input2a);
-
- input3 = new JPanel();
- input3.setLayout(new FlowLayout(FlowLayout.RIGHT));
- label3 = new JLabel("Inputdatentyp, ~dimension");
- input3.add(label3);
- textf3 = new JTextField("float", 27);
- textf3a = new JTextField("3", 3);
- input3.add(textf3);
- input3.add(textf3a);
- inputPanel.add(input3);
-
- input4 = new JPanel();
- input4.setLayout(new FlowLayout(FlowLayout.RIGHT));
- label4 = new JLabel("Inputdatentyp, ~dimension");
- input4.add(label4);
- textf4 = new JTextField("float", 27);
- textf4a = new JTextField("3", 3);
- input4.add(textf4);
- input4.add(textf4a);
- inputPanel.add(input4);
-
- frameO.getContentPane().add("North", inputPanel);
-
- // Buttons
- buttonPanel = new JPanel();
- buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
-
- startButton = new JButton("Start");
- startButton.addActionListener(this);
- buttonPanel.add(startButton);
-
- explorerButton = new JButton("Explorer");
- explorerButton.addActionListener(this);
- buttonPanel.add(explorerButton);
-
- exitButton = new JButton("Exit");
- exitButton.addActionListener(this);
- buttonPanel.add(exitButton);
-
- labelOut = new JLabel("Programm bereit. (" + nameOS + ")");
- buttonPanel.add(labelOut);
-
- frameO.getContentPane().add("South", buttonPanel);
-
- // [x]-Button
- frameO.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- //show
- frameO.setLocation(100,100);
- frameO.pack();
- frameO.setVisible(true);
- }
-
- public void actionPerformed(ActionEvent event)
- {
- Object cmd = event.getSource();
- String nameOS = new String(System.getProperty("os.name"));
- String explorer = "konqueror ";
- if (nameOS.equals("Windows XP")) {
- explorer = "explorer ";
- }
-
- if (cmd.equals(startButton)) {
- // look for mitkFilterTemplateFFI.h
- File mitkDir = new File(textf2.getText());
- File algDir = new File(mitkDir, "Algorithms");
- File FFIDir = new File(algDir, "mitkFilterFactoryItem");
- File templ = new File(FFIDir, "mitkFilterTemplateFFI.h");
- if (!templ.exists()) {
- labelOut.setText("mitkFilterTemplateFFI.h nicht gefunden!");
- } else {
- // check, if FilterFactoryItem already exits
- File newFFI = new File(FFIDir, "mitk" + textf1.getText() + "FFI.h");
- if (newFFI.exists()) {
- labelOut.setText("Datei \"" + "mitk" + textf1.getText()
- + "FFI.h" + "\" existiert bereits!");
- } else {
- labelOut.setText("Programm gestartet...");
- start prog = new start(textf1.getText(),
- textf2.getText(),
- textf2a.getText(),
- textf3.getText(),
- textf3a.getText(),
- textf4.getText(),
- textf4a.getText());
- try {
- prog.run();
- labelOut.setText("Programm ausgeführt.");
- } catch (IOException e) {
- System.out.println("Fehler beim Ausführen des Programms!");
- }
- }
- }
- } else if (cmd.equals(exitButton)) {
- setVisible(false);
- dispose();
- System.exit(0);
- } else if (cmd.equals(explorerButton)) {
- File mitkDir = new File(textf2.getText());
- File algDir = new File(mitkDir, "Algorithms");
- File FFIDir = new File(algDir, "mitkFilterFactoryItem");
- if (FFIDir.exists()) {
- if (FFIDir.isDirectory()) {
- try {
- Runtime.getRuntime().exec(explorer
- + FFIDir.getAbsolutePath());
- } catch (Exception e) {
- labelOut.setText("Fehler, kann " + explorer
- + "nicht öffnen.");
- }
- } else {
- try {
- Runtime.getRuntime().exec(explorer
- + textf2.getText());
- } catch (Exception e) {
- labelOut.setText("Fehler, kann " + explorer
- + "nicht öffnen.");
- }
- }
- } else {
- try {
- Runtime.getRuntime().exec(explorer
- + textf2.getText());
- } catch (Exception e) {
- labelOut.setText("Fehler, kann " + explorer
- + "nicht öffnen.");
- }
- }
- } else if (cmd.equals(textB2)) {
- File curDir = new File(textf2.getText());
- if (curDir.exists()) {
- fChooser2.setCurrentDirectory(curDir);
- }
- int retV = fChooser2.showOpenDialog(FilterFactoryItemGenerator.this);
- if (retV == JFileChooser.APPROVE_OPTION) {
- File file = fChooser2.getSelectedFile();
- textf2.setText(file.getAbsolutePath());
- }
- } else if (cmd.equals(textB2a)) {
- File curDir = new File(textf2a.getText());
- if (curDir.exists()) {
- fChooser2a.setCurrentDirectory(curDir);
- }
- int retV = fChooser2a.showOpenDialog(FilterFactoryItemGenerator.this);
- if (retV == JFileChooser.APPROVE_OPTION) {
- File file = fChooser2a.getSelectedFile();
- textf2a.setText(file.getAbsolutePath());
- }
- }
- }
-
-
- public static void main(String[] args)
- throws IOException{
- FilterFactoryItemGenerator frame = new FilterFactoryItemGenerator();
- }
-}
diff --git a/Build/Tools/FilterFactoryItemGenerator/UpdateFiles.java b/Build/Tools/FilterFactoryItemGenerator/UpdateFiles.java
deleted file mode 100644
index d3cc3bfbad..0000000000
--- a/Build/Tools/FilterFactoryItemGenerator/UpdateFiles.java
+++ /dev/null
@@ -1,240 +0,0 @@
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-/**
- * This class opens the files
- * mitkFilterFactoryItem.cpp
- * mitkFilterFactoryItem.cmake
- * Alle.xml
- * and inserts lines there, that add the new FilterFactoryItem to the list.
- */
-
-public class UpdateFiles {
-
- String Title, mitkPath, xmlPath, inputClass, inputDim, outputClass, outputDim;
- FileReader fReader;
- BufferedWriter bWriter;
- StringWriter sWriter;
- StringReader sReader;
- FileWriter fWriter;
- StringBuffer fileContent, newFileContent;
- int c;
-
- public UpdateFiles(String Title, String mitkPath, String xmlPath,
- String inputClass, String inputDim, String outputClass,
- String outputDim) {
- this.Title = Title;
- this.mitkPath = mitkPath;
- this.xmlPath = xmlPath;
- this.inputClass = inputClass;
- this.inputDim = inputDim;
- this.outputClass = outputClass;
- this.outputDim = outputDim;
- }
-
- public void run() {
- File mitkDir = new File(mitkPath);
- File algDir = new File(mitkDir, "Algorithms");
- File FFIDir = new File(algDir, "mitkFilterFactoryItem");
-
- // update mitkFilterFactoryItem.cpp
- File cpp = new File(FFIDir, "mitkFilterFactoryItem.cpp");
- try {
- fReader = new FileReader(cpp);
- } catch (IOException e) {
- System.out.println("Fehler bei FileReader("
- + cpp.getName()
- + ") @ "
- + FFIDir.getAbsolutePath()
- + "! "
- + e.getMessage());
- }
-
- try {
- sWriter = new StringWriter();
- while ((c=fReader.read())!= -1) {
- sWriter.write(((char)c));
- }
- StringBuffer fileContent = sWriter.getBuffer();
-
- c = fileContent.indexOf("// Automatic FilterFactoryItemGenerator inserts line \"#define MITK_...\" here, please keep comment");
- newFileContent = fileContent.insert(c,
- "#define MITK_" + Title.toUpperCase() + "_INCLUDE"
- + System.getProperty("line.separator"));
-
- c = newFileContent.indexOf("// Automatic FilterFactoryItemGenerator inserts lines \"#ifdef MITK_...\" here, please keep comment");
- newFileContent = newFileContent.insert(c,
- "#ifdef MITK_" + Title.toUpperCase() + "_INCLUDE"
- + System.getProperty("line.separator")
- + "#include
- * Note: Calling this method, deactivates reconnection of the source - * endpoint. A single instance of this command can only reconnect either the - * source or the target endpoint. - *
- * - * @param connectionTarget - * a non-null State instance, to be used as a new target endpoint - * @throws IllegalArgumentException - * if connectionTarget is null - */ - public void setNewTarget(States connectionTarget) { - if (connectionTarget == null) { - throw new IllegalArgumentException(); - } - setLabel("move connection endpoint"); - newSource = null; - newTarget = connectionTarget; - } - - /** - * Reconnect the connection to its original source and target endpoints. - */ - public void undo() { - connection.reconnect(oldSource, oldTarget); - } - -} diff --git a/Build/Tools/StateMachineEditor/src/commands/RemoveActionCommand.java b/Build/Tools/StateMachineEditor/src/commands/RemoveActionCommand.java deleted file mode 100644 index 8122c8ec60..0000000000 --- a/Build/Tools/StateMachineEditor/src/commands/RemoveActionCommand.java +++ /dev/null @@ -1,49 +0,0 @@ -package commands; - -import model.Action; -import model.Connection; - -import org.eclipse.gef.commands.Command; - -public class RemoveActionCommand extends Command { - - private final Connection con; - private Action act; - - /** - * Instantiate a command that removes an action - * @param con connection on which to remove the action - * @param act action to be removed - */ - public RemoveActionCommand(Connection con, Action act){ - if (con == null) { - throw new IllegalArgumentException(); - } - setLabel("Remove action"); - this.con = con; - this.act = act; - } - - /** - * removes the action from the connection - * - * @see org.eclipse.gef.commands.Command#execute() - */ - public void execute(){ - con.removeAction(act, act.getActionId()); - } - - /* (non-Javadoc) - * @see org.eclipse.gef.commands.Command#undo() - */ - public void undo(){ - con.addAction(act, act.getActionId()); - } - - /* (non-Javadoc) - * @see org.eclipse.gef.commands.Command#redo() - */ - public void redo(){ - con.removeAction(act, act.getActionId()); - } -} diff --git a/Build/Tools/StateMachineEditor/src/commands/StatesCreateCommand.java b/Build/Tools/StateMachineEditor/src/commands/StatesCreateCommand.java deleted file mode 100644 index d5cb175d13..0000000000 --- a/Build/Tools/StateMachineEditor/src/commands/StatesCreateCommand.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package commands; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; - -import org.eclipse.gef.commands.Command; - -import model.EndState; -import model.StartState; -import model.States; -import model.StateMachinesDiagram; - -/** - * @author Daniel - */ -public class StatesCreateCommand extends Command { - - /** The new state. */ - private States newState; - - /** StateMachinesDiagram to add to. */ - private final StateMachinesDiagram parent; - - /** The bounds of the new State. */ - private Rectangle bounds; - - /** - * Create a command that will add a new State to a StateMachinesDiagram. - * - * @param newState - * the new State that is to be added - * @param parent - * the StateMachinesDiagram that will hold the new element - * @param bounds - * the bounds of the new state; the size can be (-1, -1) if not - * known - * @throws IllegalArgumentException - * if any parameter is null, or the request does not provide a - * new State instance - */ - public StatesCreateCommand(States newState, StateMachinesDiagram parent, - Rectangle bounds) { - this.newState = newState; - this.parent = parent; - this.bounds = bounds; - setLabel("State creation"); - } - - /** - * Can execute if all the necessary information has been provided. - * - * @see org.eclipse.gef.commands.Command#canExecute() - */ - public boolean canExecute() { - return newState != null && parent != null && bounds != null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#execute() - */ - public void execute() { - newState.setStateName("Statename"); - newState.setParent(parent); - newState.setStateId(Integer.toString(parent.getMaxID())); - if (newState instanceof StartState) { - ((StartState) newState).setStartState(); - } - if (newState instanceof EndState) { - ((EndState) newState).setEndState(); - } - newState.setLocation(bounds.getLocation()); - Dimension size = new Dimension(); - size.height = 50; - size.width = 100; - newState.setSize(size); - redo(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#redo() - */ - public void redo() { - parent.addChild(newState); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#undo() - */ - public void undo() { - parent.removeChild(newState); - } - -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/commands/StatesDeleteCommand.java b/Build/Tools/StateMachineEditor/src/commands/StatesDeleteCommand.java deleted file mode 100644 index 0a696cdad3..0000000000 --- a/Build/Tools/StateMachineEditor/src/commands/StatesDeleteCommand.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package commands; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.gef.commands.Command; - -import model.Connection; -import model.States; -import model.StateMachinesDiagram; - -/** - * @author Daniel - */ -public class StatesDeleteCommand extends Command { - /** State to remove. */ - private final States child; - - /** StateMachinesDiagram to remove from. */ - private final StateMachinesDiagram parent; - - /** Holds a copy of the outgoing connections of child. */ - private List sourceConnections; - - /** Holds a copy of the incoming connections of child. */ - private List targetConnections; - - /** True, if child was removed from its parent. */ - private boolean wasRemoved; - - /** - * Create a command that will remove the state from its parent. - * - * @param parent - * the StateMachinesDiagram containing the child - * @param child - * the State to remove - * @throws IllegalArgumentException - * if any parameter is null - */ - public StatesDeleteCommand(StateMachinesDiagram parent, States child) { - if (parent == null || child == null) { - throw new IllegalArgumentException(); - } - setLabel("state deletion"); - this.parent = parent; - this.child = child; - } - - /** - * Reconnects a List of Connections with their previous endpoints. - * - * @param connections - * a non-null List of connections - */ - private void addConnections(List connections) { - for (Iterator iter = connections.iterator(); iter.hasNext();) { - Connection conn = (Connection) iter.next(); - conn.reconnect(); - } - } - - /** - * Reconnects a List of Connections with their previous endpoints. - * - * @param connections - * a non-null List of connections - */ - private void addConnections2(List connections) { - for (Iterator iter = connections.iterator(); iter.hasNext();) { - Connection conn = (Connection) iter.next(); - if (!(conn.getSource() == conn.getTarget())) { - conn.reconnect(); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#canUndo() - */ - public boolean canUndo() { - return wasRemoved; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#execute() - */ - public void execute() { - // store a copy of incoming & outgoing connections before proceeding - sourceConnections = child.getSourceConnections(); - targetConnections = child.getTargetConnections(); - redo(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#redo() - */ - public void redo() { - // remove the child and disconnect its connections - wasRemoved = parent.removeChild(child); - if (wasRemoved) { - removeConnections(sourceConnections); - removeConnections(targetConnections); - } - } - - /** - * Disconnects a List of Connections from their endpoints. - * - * @param connections - * a non-null List of connections - */ - private void removeConnections(List connections) { - for (Iterator iter = connections.iterator(); iter.hasNext();) { - Connection conn = (Connection) iter.next(); - conn.disconnect(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#undo() - */ - public void undo() { - // add the child and reconnect its connections - if (parent.addChild(child)) { - addConnections(sourceConnections); - addConnections2(targetConnections); - } - } -} diff --git a/Build/Tools/StateMachineEditor/src/commands/StatesSetConstraintCommand.java b/Build/Tools/StateMachineEditor/src/commands/StatesSetConstraintCommand.java deleted file mode 100644 index 15aefaf0ab..0000000000 --- a/Build/Tools/StateMachineEditor/src/commands/StatesSetConstraintCommand.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package commands; - -import org.eclipse.draw2d.geometry.Rectangle; - -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.ChangeBoundsRequest; - -import model.States; - -/** - * @author Daniel - */ -public class StatesSetConstraintCommand extends Command { - /** Stores the new size and location. */ - private final Rectangle newBounds; - - /** Stores the old size and location. */ - private Rectangle oldBounds; - - /** A request to move/resize an edit part. */ - private final ChangeBoundsRequest request; - - /** State to manipulate. */ - private final States state; - - /** - * Create a command that can resize and/or move a state. - * - * @param state - * the state to manipulate - * @param req - * the move and resize request - * @param newBounds - * the new size and location - * @throws IllegalArgumentException - * if any of the parameters is null - */ - public StatesSetConstraintCommand(States state, ChangeBoundsRequest req, - Rectangle newBounds) { - if (state == null || req == null || newBounds == null) { - throw new IllegalArgumentException(); - } - this.state = state; - this.request = req; - this.newBounds = newBounds.getCopy(); - setLabel("Move / Resize"); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#canExecute() - */ - public boolean canExecute() { - Object type = request.getType(); - // make sure the Request is of a type we support: - return (RequestConstants.REQ_MOVE.equals(type) - || RequestConstants.REQ_MOVE_CHILDREN.equals(type) - || RequestConstants.REQ_RESIZE.equals(type) || RequestConstants.REQ_RESIZE_CHILDREN - .equals(type)); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#execute() - */ - public void execute() { - oldBounds = new Rectangle(state.getLocation(), state.getSize()); - redo(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#redo() - */ - public void redo() { - state.setSize(newBounds.getSize()); - state.setLocation(newBounds.getLocation()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#undo() - */ - public void undo() { - state.setSize(oldBounds.getSize()); - state.setLocation(oldBounds.getLocation()); - } -} diff --git a/Build/Tools/StateMachineEditor/src/debug/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/debug/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/debug/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/debug/DebugEventsList.java b/Build/Tools/StateMachineEditor/src/debug/DebugEventsList.java deleted file mode 100644 index 443920d3bc..0000000000 --- a/Build/Tools/StateMachineEditor/src/debug/DebugEventsList.java +++ /dev/null @@ -1,179 +0,0 @@ -package debug; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import model.Connection; -import model.StartState; -import model.StateMachinesDiagram; -import model.States; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; - -import dom.DOMGetInstance; -import dom.ReadActionAndEventDOMTree; - -public class DebugEventsList extends ViewPart implements ISelectionChangedListener { - - private static DebugEventsList view; - private static ListViewer viewer = null; - private static Map transitionToEvent = new HashMap(); - private static Map countEvents = new HashMap(); - private static Map notExistingCon = new HashMap(); - private static States activeState = null; - private static Connection activeCon = null; - private static Connection doubleClickedCon = null; - private static StateMachinesDiagram diagram1 = null; - private static List allStates = null; - private static String instanceAddress = null; - private static int counter = 1; - private static States active = null; - - public DebugEventsList() { - super(); - counter = 1; - view = this; - } - - public static void addEventToList(String eventId) { - ReadActionAndEventDOMTree eventNames = DOMGetInstance.getActionAndEventInstance(); - String event = eventNames.getEventName(eventId); - String countEvent = Integer.toString(counter) + " " + event; - counter++; - viewer.add(countEvent); - countEvents.put(countEvent, event); - if (!(activeState == null)) { - boolean conExists = false; - List allConnections = activeState.getSourceConnections(); - for (int i = 0; i < allConnections.size(); i++) { - Connection connection = (Connection) allConnections.get(i); - if (event.equals(connection.getEvent())) { - conExists = true; - if (!(active == null)) { - active.setInactive(); - } - if (!(doubleClickedCon == null)) { - doubleClickedCon.setInactive(); - doubleClickedCon.getTarget().setInactive(); - } - if (!(activeCon == null)) { - activeCon.setInactive(); - } - activeCon = connection; - activeCon.setActive(); - transitionToEvent.put(countEvent, connection); - if (!(activeState == null)) { - activeState.setInactive(); - } - activeState = activeCon.getTarget(); - activeCon.getTarget().setActive(); - break; - } - } - if (conExists == false) { - notExistingCon.put(countEvent, activeState); - if (!(activeCon == null)) { - activeCon.setInactive(); - } - if (!(doubleClickedCon == null)) { - doubleClickedCon.setInactive(); - } - } - } - } - - /** - * hides this view - */ - public static void closeView() { - IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - page1.hideView(view); - } - - public void createPartControl(Composite parent) { - viewer = new ListViewer(parent); - viewer.addSelectionChangedListener(this); - } - - public void setFocus() { - viewer.getControl().setFocus(); - } - - public static void clear() { - if (!(diagram1 == null)) { - diagram1.resetFromDebugMode(); - } - viewer.getList().removeAll(); - } - - public static void setDiagram(StateMachinesDiagram diagram) { - diagram1 = diagram; - allStates = diagram1.getChildren(); - for (int i = 0; i < allStates.size(); i++) { - if ((States)allStates.get(i) instanceof StartState) { - activeState = (States)allStates.get(i); - activeState.setActive(); - break; - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - diagram1.resetFromDebugMode(); - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true); - closeView(); - } - - public static void setInstanceAddress(String instanceAddress1) { - instanceAddress = instanceAddress1; - } - - public static String getInstanceAddress() { - return instanceAddress; - } - - public void selectionChanged(SelectionChangedEvent event) { - String eventString = (String) ((IStructuredSelection)viewer.getSelection()).getFirstElement(); - if (!(active == null)) { - active.setInactive(); - } - if (!(doubleClickedCon == null)) { - doubleClickedCon.setInactive(); - //doubleClickedCon.getTarget().setInactive(); - } - if (!(activeCon == null)) { - activeCon.setInactive(); - } - if(!(transitionToEvent.get(eventString) == null)) { - if (!(doubleClickedCon == null)) { - doubleClickedCon.getTarget().setInactive(); - } - doubleClickedCon = (Connection) transitionToEvent.get(eventString); - doubleClickedCon.setActive(); - if (!(activeState == null)) { - activeState.setInactive(); - } - doubleClickedCon.getTarget().setActive(); - } - else { - if (notExistingCon.containsKey(eventString)){ - if (!(doubleClickedCon == null)) { - doubleClickedCon.getTarget().setInactive(); - } - active = (States) notExistingCon.get(eventString); - active.setActive(); - } - } - } -} diff --git a/Build/Tools/StateMachineEditor/src/debug/DebugServer.java b/Build/Tools/StateMachineEditor/src/debug/DebugServer.java deleted file mode 100644 index 1ce6b56f98..0000000000 --- a/Build/Tools/StateMachineEditor/src/debug/DebugServer.java +++ /dev/null @@ -1,48 +0,0 @@ -package debug; - -import javax.swing.JOptionPane; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; - -import dom.DOMGetInstance; - -import stateMachinesList.StateMachinesList; - -public class DebugServer implements IWorkbenchWindowActionDelegate { - - public DebugServer() { - } - - public void dispose() { - } - - public void init(IWorkbenchWindow window) { - } - - public void run(IAction action) { - if (!(DOMGetInstance.getInstance() == null)) { - StateMachinesList.setDebugMode(true); - IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - try { - page1.showView("DebugStateMachinesList"); - } catch (PartInitException e1) { - e1.printStackTrace(); - } - new DebugServerThread().start(); - } - else { - JOptionPane.showMessageDialog(null, - "You have to open a statemachine xml file first!", "Error Message", - JOptionPane.ERROR_MESSAGE); - } - } - - public void selectionChanged(IAction action, ISelection selection) { - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/debug/DebugServerThread.java b/Build/Tools/StateMachineEditor/src/debug/DebugServerThread.java deleted file mode 100644 index 9fef37619f..0000000000 --- a/Build/Tools/StateMachineEditor/src/debug/DebugServerThread.java +++ /dev/null @@ -1,224 +0,0 @@ -package debug; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; - -import javax.swing.JOptionPane; - -import stateMachinesList.StateMachinesList; - -import dom.DOMGetInstance; - -/** - * Because Eclipse can not do anything else while listening to sockets we have to - * implement a thread which overtakes the job for listening. - * - * @author Daniel - */ -public class DebugServerThread extends Thread { - - private java.util.List m_MessageList = new Vector(); - - private Map eventsToMachine = new HashMap(); - private static BufferedReader in = null; - private static Socket clientSocket = null; - private static ServerSocket serverSocket = null; - private static final int OPEN_CONNECTION = 1; - private static final int NEW_STATE_MACHINE = 2; - private static final int EVENT = 3; - private static final int TRANSITION = 4; - private static final int ACTION = 5; - private static final int DELETE_STATE_MACHINE = 6; - - public DebugServerThread() { - super("ServerThread"); - } - - public EventsForStatemachine getEventsForStatemachine(String instanceAddress) { - if (eventsToMachine.containsKey(instanceAddress)) { - return (EventsForStatemachine) eventsToMachine.get(instanceAddress); - } - return null; - } - - /** - * - * @param messages - * @return false: no massages, true new mesaages - */ - synchronized boolean getNewMessages( java.util.List messages ) { - - if ( m_MessageList.size() == 0 ) - return false; - - messages.clear(); - messages.addAll( m_MessageList ); - m_MessageList.clear(); - return true; - } - - synchronized void addNewMessage( Object message ) { - m_MessageList.add( message ); - } - - /** - * @param in - * @return - * @throws IOException - */ - long readUnsignedInteger( BufferedReader in ) throws IOException { - - long value = 0; - char buffer[] = new char[4]; - in.read( buffer, 0, 4 ); - - value = (long)(buffer[0] & 0xff); - value |= ((long)(buffer[1] & 0xff))<<8; - value |= ((long)(buffer[2] & 0xff))<<16; - value |= ((long)(buffer[3] & 0xff))<<24; - - return value; - } - - /** - * - * @param in - * @param size length of the string - * @return string - * @throws IOException - */ - String readString( BufferedReader in, long length ) throws IOException { - - char buffer[] = new char[255]; - in.read( buffer, 0, (int)length ); - String string = new String( buffer, 0, (int)length ); - return string; - } - - public void run() { - DebugStateMachinesList.setServer(this); - try { - serverSocket = new ServerSocket(34768); - } catch (IOException e) { - System.err.println("Could not listen on port: 34768."); - System.exit(1); - } - - try { - clientSocket = serverSocket.accept(); - in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); - - boolean exitLoop = false; - - while (true) { - - int messageType = (int) readUnsignedInteger( in ); - long bodysize = readUnsignedInteger( in ); - - System.out.print("\nMITK Interaction Debugger: MessageType: "); - System.out.print( messageType ); - System.out.print(" BodySize: "); - System.out.print( bodysize ); - - switch ( messageType ) { - - case OPEN_CONNECTION: { - long hashValue = readUnsignedInteger( in ); - long stringlength = readUnsignedInteger( in ); - String name = readString( in, stringlength ); - if (!(name.equals(DOMGetInstance.getFilename()))) { - JOptionPane.showMessageDialog(null, - "Used xml file is not the same! Exit Debug-Mode.", "Error Message", - JOptionPane.ERROR_MESSAGE); - exitLoop = true; - } - System.out.println(hashValue + name); - break; - } - case NEW_STATE_MACHINE: { - long instanceAddress = readUnsignedInteger( in ); - long stringlength = readUnsignedInteger( in ); - String name = readString( in, stringlength ); - EventsForStatemachine eventObject = new EventsForStatemachine(); - eventsToMachine.put(Integer.toString((int) instanceAddress), eventObject); - Message message = new Message(); - message.setInstanceAddress(Integer.toString((int) instanceAddress)); - message.setName(name); - addNewMessage(message); - //DebugStateMachinesList.addStateMachineToList(); - - //DebugStateMachinesList.addStateMachineToList2(name); - System.out.println(instanceAddress + name); - break; - } - case EVENT: { - long instanceAddress = readUnsignedInteger( in ); - long eventId = readUnsignedInteger( in ); - EventsForStatemachine eventObject = (EventsForStatemachine) eventsToMachine.get(Integer.toString((int) instanceAddress)); - eventObject.addEvent(Integer.toString((int) eventId)); - /*if (DebugEventsList.getInstanceAddress().equals(Integer.toString(instanceAddress))) { - DebugEventsList.addEventToList(Integer.toString(eventId)); - }*/ - System.out.println(instanceAddress + eventId); - break; - } - case TRANSITION: { - long instanceAddress = readUnsignedInteger( in ); - long stringlength = readUnsignedInteger( in ); - String name = readString( in, stringlength ); - System.out.println(instanceAddress + name); - break; - } - case ACTION: { - long instanceAddress = readUnsignedInteger( in ); - long stringlength = readUnsignedInteger( in ); - String name = readString( in, stringlength ); - System.out.println(instanceAddress + name); - break; - } - - case DELETE_STATE_MACHINE: { - long instanceAddress = readUnsignedInteger( in ); - //DebugStateMachinesList.removeStateMachineFromList(Integer.toString(instanceAddress)); - eventsToMachine.remove(Integer.toString((int) instanceAddress)); - System.out.println(instanceAddress); - break; - } - case 7: { - long counter = readUnsignedInteger( in ); - System.out.print(" -->>Counter: "); - System.out.print( counter ); - break; - } - default: - System.out.println(messageType); - System.out.println("unknown messagetype!!"); - } - if (exitLoop) { - System.out.println("exit"); - break; - } - } - //PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true); - //DebugStateMachinesList.closeView(); - StateMachinesList.setDebugMode(false); - in.close(); - clientSocket.close(); - serverSocket.close(); - } - catch (IOException e) { - System.err.println(e); - } - finally { - //PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true); - //DebugStateMachinesList.closeView(); - StateMachinesList.setDebugMode(false); - } - } -} diff --git a/Build/Tools/StateMachineEditor/src/debug/DebugStateMachinesList.java b/Build/Tools/StateMachineEditor/src/debug/DebugStateMachinesList.java deleted file mode 100644 index b68507cd76..0000000000 --- a/Build/Tools/StateMachineEditor/src/debug/DebugStateMachinesList.java +++ /dev/null @@ -1,197 +0,0 @@ -package debug; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import model.StateMachinesDiagram; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.part.ViewPart; -import org.jdom.Element; - -import stateMachines.StateMachinesEditor; -import stateMachinesList.StateMachinesList; - -import dom.DOMGetInstance; -import dom.ReadDOMTree; - -public class DebugStateMachinesList extends ViewPart implements IDoubleClickListener { - - private static DebugStateMachinesList view; - private static ListViewer viewer = null; - private static DebugServerThread server1 = null; - //private static Map instanceToName = new HashMap(); - private static Map nameToInstance = new HashMap(); - private static Map countNameToInstance = new HashMap(); - private static Map instanceToCountName = new HashMap(); - private static int counter = 1; - - public DebugStateMachinesList() { - super(); - view = this; - counter = 1; - } - - public static void setServer(DebugServerThread server) { - server1 = server; - } - - /** - * hides this view - */ - public static void closeView() { - IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - page1.hideView(view); - DebugEventsList.closeView(); - } - - public static void addStateMachineToList() { - List messages = new ArrayList(); - server1.getNewMessages(messages); - for (int i = 0; i < messages.size(); i++) { - Message message = (Message) messages.get(i); - //instanceToName.put(message.getName(), message.getInstanceAddress()); - String countName = Integer.toString(counter) + " " + message.getName(); - counter++; - countNameToInstance.put(countName, message.getInstanceAddress()); - nameToInstance.put(message.getInstanceAddress(), message.getName()); - viewer.add(countName); - } - messages.clear(); - } - - - /*public static void addStateMachineToList2(String machineName) { - List list = Collections.synchronizedList(new ArrayList()); - list.add(machineName); - synchronized(list) { - Iterator i = list.iterator(); // Must be in synchronized block - while (i.hasNext()) - viewer.add(i.next()); - } - String machine = machineName; - System.out.println(machine + "hier"); - System.out.println(list); - //viewer.add(list.get(0)); - }*/ - - public void createPartControl(Composite parent) { - viewer = new ListViewer(parent); - viewer.addDoubleClickListener(this); - - /*javax.swing.Timer t= new javax.swing.Timer(1000, - new ActionListener() { - public void actionPerformed(ActionEvent e) { - List messages = new ArrayList(); - if (!(server1 == null)) { - server1.getNewMessages(messages); - for (int i = 0; i < messages.size(); i++) { - Message message = (Message) messages.get(i); - instanceToName.put(message.getName(), message.getInstanceAddress()); - nameToInstance.put(message.getInstanceAddress(), message.getName()); - System.out.println(message.getName() + " hier"); - viewer.add(message.getName()); - } - } - } - }); - t.start(); */ - - /*int delay = 1000; //milliseconds - ActionListener taskPerformer = new ActionListener() { - public void actionPerformed(ActionEvent evt) { - List messages = new ArrayList(); - if (!(server1 == null)) { - server1.getNewMessages(messages); - for (int i = 0; i < messages.size(); i++) { - Message message = (Message) messages.get(i); - instanceToName.put(message.getName(), message.getInstanceAddress()); - nameToInstance.put(message.getInstanceAddress(), message.getName()); - System.out.println(message.getName() + " hier"); - //viewer.add(message.getName()); - } - } - } - }; - new Timer(delay, taskPerformer).start();*/ - } - - public void setFocus() { - viewer.getControl().setFocus(); - } - - public void doubleClick(DoubleClickEvent event) { - // opens the selected statemachine editor in debug mode - String counterFileName = (String) ((IStructuredSelection)viewer.getSelection()).getFirstElement(); - String instanceAddress = (String) countNameToInstance.get(counterFileName); - String fileName = (String) nameToInstance.get(instanceAddress); - final IFile machineName = DOMGetInstance.getContainer().getFile(new Path(fileName + ".states")); - try { - Element machine = null; - ReadDOMTree tree = DOMGetInstance.getInstance(); - List allMachines = tree.getStateMachines(); - for (int i = 0; i < allMachines.size(); i++) { - machine = (Element) allMachines.get(i); - if (machine.getAttributeValue("NAME").equals(fileName)) { - break; - } - } - if (!(machine == null)) { - StateMachinesDiagram diagram = new StateMachinesDiagram(machine); - tree.addDiagram(diagram); - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true); - IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), machineName, true); - diagram.setDebugMode(); - IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - page1.showView("DebugEventsList"); - DebugEventsList.clear(); - DebugEventsList.setDiagram(diagram); - DebugEventsList.setInstanceAddress(instanceAddress); - EventsForStatemachine stateMachineEvents = server1.getEventsForStatemachine(instanceAddress); - if (!(stateMachineEvents == null)) { - List allEvents = stateMachineEvents.getEvents(); - for (int i = 0; i < allEvents.size(); i++) { - DebugEventsList.addEventToList((String) allEvents.get(i)); - } - } - } - } catch (PartInitException e) { - e.printStackTrace(); - } - } - - public static void removeStateMachineFromList(String instanceAddress) { - ReadDOMTree tree = DOMGetInstance.getInstance(); - String machineName = (String) nameToInstance.get(instanceAddress); - StateMachinesDiagram diagram = tree.getStateMachinesDiagram(machineName); - // close the editor - if (!(diagram == null)) { - StateMachinesEditor editor1 = diagram.getEditor(); - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(editor1, true); - tree.removeDiagram(diagram); - } - String countMachineName = (String) instanceToCountName.get(instanceAddress); - viewer.remove(countMachineName); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - closeView(); - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true); - StateMachinesList.setDebugMode(false); - } -} diff --git a/Build/Tools/StateMachineEditor/src/debug/EventsForStatemachine.java b/Build/Tools/StateMachineEditor/src/debug/EventsForStatemachine.java deleted file mode 100644 index 17f859d393..0000000000 --- a/Build/Tools/StateMachineEditor/src/debug/EventsForStatemachine.java +++ /dev/null @@ -1,22 +0,0 @@ -package debug; - -import java.util.ArrayList; -import java.util.List; - -public class EventsForStatemachine { - - private List eventList = new ArrayList(); - - public EventsForStatemachine() { - super(); - } - - public void addEvent(String eventId) { - eventList.add(eventId); - } - - public List getEvents() { - return eventList; - } - -} diff --git a/Build/Tools/StateMachineEditor/src/debug/GetData.java b/Build/Tools/StateMachineEditor/src/debug/GetData.java deleted file mode 100644 index 7e34d50033..0000000000 --- a/Build/Tools/StateMachineEditor/src/debug/GetData.java +++ /dev/null @@ -1,34 +0,0 @@ -package debug; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; - -import stateMachinesList.StateMachinesList; - -public class GetData implements IWorkbenchWindowActionDelegate { - - public GetData() { - super(); - } - - public void dispose() { - - } - - public void init(IWorkbenchWindow window) { - - } - - public void run(IAction action) { - if (StateMachinesList.isDebugMode()) { - DebugStateMachinesList.addStateMachineToList(); - } - } - - public void selectionChanged(IAction action, ISelection selection) { - - } - -} diff --git a/Build/Tools/StateMachineEditor/src/debug/Message.java b/Build/Tools/StateMachineEditor/src/debug/Message.java deleted file mode 100644 index 6504ca996b..0000000000 --- a/Build/Tools/StateMachineEditor/src/debug/Message.java +++ /dev/null @@ -1,28 +0,0 @@ -package debug; - -public class Message { - private String name; - private String instanceAddress; - - - public Message() { - super(); - } - - public void setInstanceAddress(String instanceAddress) { - this.instanceAddress = instanceAddress; - } - - public void setName(String name) { - this.name = name; - } - - public String getInstanceAddress () { - return this.instanceAddress; - } - - public String getName() { - return this.name; - } - -} diff --git a/Build/Tools/StateMachineEditor/src/dialog/ActionAndEventInfo.java b/Build/Tools/StateMachineEditor/src/dialog/ActionAndEventInfo.java deleted file mode 100644 index 1ae11f399e..0000000000 --- a/Build/Tools/StateMachineEditor/src/dialog/ActionAndEventInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -package dialog; - -import java.util.Vector; - -public class ActionAndEventInfo { - String actionEventComment; - String actionEventName; - Vector actionParameter; - - /** - * constructor for an info object containing comment, name and parameter - * @param comment the comment on the action or event - * @param name the name of the action or event - * @param parameter the parameter for the action - */ - ActionAndEventInfo(String comment, String name, Vector parameter) { - actionEventComment = comment; - actionEventName = name; - actionParameter = parameter; - } - - /** - * @return the comment for the action or event - */ - public String getActionEventComment() { - return actionEventComment; - } - - /** - * @return the name for the action or event - */ - public String getActionEventName(){ - return actionEventName; - } - - /** - * @return the parameter for the action - */ - public Vector getActionParameter() { - return actionParameter; - } -} diff --git a/Build/Tools/StateMachineEditor/src/dialog/ActionDialog.java b/Build/Tools/StateMachineEditor/src/dialog/ActionDialog.java deleted file mode 100644 index cc775cd217..0000000000 --- a/Build/Tools/StateMachineEditor/src/dialog/ActionDialog.java +++ /dev/null @@ -1,569 +0,0 @@ -package dialog; - -import java.awt.Component; -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; - -import javax.swing.DefaultCellEditor; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JTextField; -import javax.swing.JComboBox; -import javax.swing.JButton; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.plaf.basic.BasicComboBoxRenderer; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableColumn; - -import org.jdom.Comment; -import org.jdom.Element; - -import dom.DOMGetInstance; -import dom.ReadActionAndEventDOMTree; - -import model.Action; - -public class ActionDialog extends JDialog { - - /** - * - */ - private static final long serialVersionUID = 1L; - private javax.swing.JPanel jContentPane = null; - private JLabel actionCommentLabel = null; - private JTextField actionCommentTextField = null; - private JLabel actionCategoryLabel = null; - private JComboBox actionCategoryComboBox = null; - private JButton newCategoryButton = null; - private JTable jTable = null; - private JButton oKButton = null; - private JButton cancelButton = null; - private ActionAndEventInfo info; - private JButton addParameterButton = null; - private JButton removeParameterButton = null; - private JScrollPane jScrollPane = null; - private DefaultTableModel model; - private JLabel actionNameLabel = null; - private JComboBox actionNameComboBox = null; - private JButton newActionButton = null; - private Action action = null; - private ReadActionAndEventDOMTree actionTree = null; - private String category; - private List tooltips = new ArrayList(); - - /** - * This is the default constructor for add action - */ - public ActionDialog() { - super(); - initialize(); - } - - /** - * constructor for change action with action to fill dialog with values - * @param action the action according to this dialog - */ - public ActionDialog(Action action) { - super(); - this.action = action; - initialize(); - } - - /** - * This method initializes this - * - * @return void - */ - private void initialize() { - actionTree = DOMGetInstance.getActionAndEventInstance(); - this.setSize(680, 360); - // add action - if (action == null) { - this.setName("ActionDialog"); - this.setTitle("Add action"); - } - // change action - else { - this.setName("ChangeActionDialog"); - this.setTitle("Change action"); - } - this.setLocationRelativeTo(null); - this.setResizable(false); - this.setModal(true); - this.setAlwaysOnTop(true); - this.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - this.setContentPane(getJContentPane()); - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel - */ - private javax.swing.JPanel getJContentPane() { - if(jContentPane == null) { - actionNameLabel = new JLabel(); - actionNameLabel.setBounds(new java.awt.Rectangle(30,40,120,20)); - actionNameLabel.setText("Action name:"); - actionCategoryLabel = new JLabel(); - actionCategoryLabel.setBounds(new java.awt.Rectangle(30,10,120,20)); - actionCategoryLabel.setText("Action category:"); - actionCommentLabel = new JLabel(); - actionCommentLabel.setText("Comment on action:"); - actionCommentLabel.setBounds(new java.awt.Rectangle(30,70,120,20)); - jContentPane = new javax.swing.JPanel(); - jContentPane.setLayout(null); - jContentPane.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - jContentPane.add(actionCommentLabel, null); - jContentPane.add(getActionCommentTextField(), null); - jContentPane.add(actionCategoryLabel, null); - jContentPane.add(getActionCategoryComboBox(), null); - jContentPane.add(getNewCategoryButton(), null); - jContentPane.add(getNewActionButton(), null); - jContentPane.add(getOKButton(), null); - jContentPane.add(getCancelButton(), null); - jContentPane.add(getAddParameterButton(), null); - jContentPane.add(getRemoveParameterButton(), null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(actionNameLabel, null); - jContentPane.add(getActionNameComboBox(), null); - } - return jContentPane; - } - - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private JTextField getActionCommentTextField() { - if (actionCommentTextField == null) { - actionCommentTextField = new JTextField(); - actionCommentTextField.setBounds(new java.awt.Rectangle(160,70,360,20)); - actionCommentTextField.setText(""); - if (!(action == null)) { - actionCommentTextField.setText(action.getActionComment()); - } - } - return actionCommentTextField; - } - - /** - * This method initializes jComboBox - * - * @return javax.swing.JComboBox - */ - private JComboBox getActionCategoryComboBox() { - if (actionCategoryComboBox == null) { - actionCategoryComboBox = new JComboBox(); - actionCategoryComboBox.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent e) { - category = actionCategoryComboBox.getSelectedItem().toString(); - if (!(actionNameComboBox == null)) { - actionNameComboBox.removeAllItems(); - List allActions = actionTree.getActions(category); - tooltips.clear(); - for (int i = 0; i < allActions.size(); i++) { - Element act = (Element) allActions.get(i); - String action = act.getAttributeValue("NAME"); - actionNameComboBox.addItem(action); - List commentList = act.getContent(); - // set comments for each category to the tooltip - String toolTip = ""; - for (int j = 0; j < commentList.size(); j++) { - Object comEle = commentList.get(j); - if (comEle instanceof Comment) { - Comment comment = (Comment) comEle; - toolTip = comment.getText(); - break; - } - } - if (toolTip.equals("")) { - toolTip = "No comment available"; - } - tooltips.add(toolTip); - } - actionNameComboBox.setRenderer(new MyComboBoxRenderer()); - } - } - }); - actionCategoryComboBox.setMaximumRowCount(5); - List allCategories = actionTree.getActionCategories(); - for (int i = 0; i < allCategories.size(); i++) { - actionCategoryComboBox.addItem(allCategories.get(i).toString()); - } - actionCategoryComboBox.setBounds(new java.awt.Rectangle(160,10,360,20)); - // for change action set correct combobox entry - if (!(action == null)) { - String id = action.getActionId(); - if (!(actionTree.getActionCategoryName(actionTree.getActionName(id)) == null)) { - actionCategoryComboBox.setSelectedItem(actionTree.getActionCategoryName(actionTree.getActionName(id))); - } - } - } - return actionCategoryComboBox; - } - - /** - * This method initializes jButton - * - * @return javax.swing.JButton - */ - private JButton getNewCategoryButton() { - if (newCategoryButton == null) { - newCategoryButton = new JButton(); - newCategoryButton.setBounds(new java.awt.Rectangle(530,10,120,20)); - newCategoryButton.setText("New category"); - newCategoryButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - while (true) { - String inputValue = JOptionPane.showInputDialog(ActionDialog.this, "New category name:"); - if (inputValue == null) { - //cancel - break; - } - else if (!(inputValue == null) && !inputValue.equals("") && !actionTree.containsActionCategory(inputValue)) { - Object[] options = { "OK", "CANCEL" }; - int option = JOptionPane.showOptionDialog(ActionDialog.this, "Do you really want to add this category?\nAdded categories can not be removed!", "Click OK to continue", - JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, - null, options, options[0]); - if (option == 0) { - actionTree.addActionCategory(inputValue); - actionCategoryComboBox.addItem(inputValue); - actionCategoryComboBox.setSelectedItem(inputValue); - } - break; - } - else if (actionTree.containsActionCategory(inputValue)) { - JOptionPane.showMessageDialog(ActionDialog.this, - "Action category already exists, please choose another one!", "Error Message", - JOptionPane.ERROR_MESSAGE); - } - else { - JOptionPane.showMessageDialog(ActionDialog.this, - "You have to enter a category name!", "Error Message", - JOptionPane.ERROR_MESSAGE); - } - } - } - }); - } - return newCategoryButton; - } - - /** - * This method initializes jTable - * - * @return javax.swing.JTable - */ - private JTable getJTable() { - String[] columnNames = {"Parametername", "Parametertype", "Parametervalue", "Parametercomment"}; - if (jTable == null) { - model = new DefaultTableModel(columnNames, 0); - jTable = new JTable(model); - } - jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS); - jTable.setColumnSelectionAllowed(false); - jTable.setCellSelectionEnabled(true); - jTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - jTable.setRowSelectionAllowed(true); - TableColumn typeColumn = jTable.getColumnModel().getColumn(1); - JComboBox comboBox = new JComboBox(); - comboBox.addItem("intParameter"); - comboBox.addItem("stringParameter"); - comboBox.addItem("floatParameter"); - comboBox.addItem("boolParameter"); - typeColumn.setCellEditor(new DefaultCellEditor(comboBox)); - // if change action: set parameters - if (!(action == null)) { - List allParas = action.getParameter(); - for (int i = 0; i < allParas.size(); i++) { - Vector paraVec = (Vector) allParas.get(i); - model.addRow(paraVec); - } - } - return jTable; - } - - /** - * This method initializes jButton1 - * - * @return javax.swing.JButton - */ - private JButton getOKButton() { - if (oKButton == null) { - oKButton = new JButton(); - oKButton.setBounds(new java.awt.Rectangle(480,280,80,30)); - oKButton.setText("OK"); - oKButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (!(actionCategoryComboBox.getSelectedItem() == null)) { - Vector paraVector = model.getDataVector(); - TableCellEditor cellEditor = jTable.getCellEditor(); - if (jTable.getSelectedRowCount() > 0) { - if (!(jTable.getSelectedColumn() == 1)) { - if (!(jTable.getEditingRow() == -1)) { - cellEditor.stopCellEditing(); - } - } - else { - jTable.clearSelection(); - } - } - for (int i = 0; i < paraVector.size(); i++) { - Vector para = (Vector) paraVector.get(i); - if ((para.get(0) == null) || (para.get(0).toString().equals(""))) { - JOptionPane.showMessageDialog(ActionDialog.this, - "One or more parameters have no name! Please enter a name", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - else if ((para.get(2) == null) || (para.get(2).toString().equals(""))) { - JOptionPane.showMessageDialog(ActionDialog.this, - "One or more parameters have no value! Please enter a value", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - else if ((para.get(1) == null) || (para.get(1).toString().equals(""))) { - JOptionPane.showMessageDialog(ActionDialog.this, - "One or more parameters have no type! Please select a type", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - } - - if (actionNameComboBox.getSelectedItem() == null) { - JOptionPane.showMessageDialog(ActionDialog.this, - "You have to select an action name!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - String id = actionTree.getActionId(actionNameComboBox.getSelectedItem().toString()); - info = new ActionAndEventInfo(actionCommentTextField.getText(), id, model.getDataVector()); - } - cancel(); - } - }); - } - return oKButton; - } - - /** - * This method initializes jButton2 - * - * @return javax.swing.JButton - */ - private JButton getCancelButton() { - if (cancelButton == null) { - cancelButton = new JButton(); - cancelButton.setBounds(new java.awt.Rectangle(570,280,80,30)); - cancelButton.setText("Cancel"); - cancelButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - cancel(); - } - }); - } - return cancelButton; - } - - /** - * disposes this dialog - */ - void cancel() { - dispose(); - } - - /** - * @return the info object with comment, name and parameter - */ - public ActionAndEventInfo getInfo() { - return info; - } - - /** - * This method initializes jButton - * - * @return javax.swing.JButton - */ - private JButton getAddParameterButton() { - if (addParameterButton == null) { - addParameterButton = new JButton(); - addParameterButton.setBounds(new java.awt.Rectangle(30,280,150,30)); - addParameterButton.setText("Add Parameter"); - addParameterButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - Vector newElement = new Vector(4); - newElement.add(0,""); - newElement.add(1,""); - newElement.add(2,""); - newElement.add(3,""); - model.addRow(newElement); - } - }); - } - return addParameterButton; - } - - /** - * This method initializes jButton - * - * @return javax.swing.JButton - */ - private JButton getRemoveParameterButton() { - if (removeParameterButton == null) { - removeParameterButton = new JButton(); - removeParameterButton.setBounds(new java.awt.Rectangle(190,280,150,30)); - removeParameterButton.setText("Remove Parameter"); - removeParameterButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (!(jTable.getSelectedRow() == -1)) { - model.removeRow(jTable.getSelectedRow()); - } - } - }); - } - return removeParameterButton; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(30,110,620,150)); - jScrollPane.setViewportView(getJTable()); - } - return jScrollPane; - } - - /** - * This method initializes jComboBox - * - * @return javax.swing.JComboBox - */ - private JComboBox getActionNameComboBox() { - boolean contains = false; - if (actionNameComboBox == null) { - actionNameComboBox = new JComboBox(); - actionNameComboBox.setMaximumRowCount(5); - List allActions = actionTree.getActions(category); - for (int i = 0; i < allActions.size(); i++) { - Element act = (Element) allActions.get(i); - String action = act.getAttributeValue("NAME"); - actionNameComboBox.addItem(action); - List commentList = act.getContent(); - // set comments for each action to the tooltip - String toolTip = ""; - for (int j = 0; j < commentList.size(); j++) { - Object comEle = commentList.get(j); - if (comEle instanceof Comment) { - Comment comment = (Comment) comEle; - toolTip = comment.getText(); - break; - } - } - if (toolTip.equals("")) { - toolTip = "No comment available"; - } - tooltips.add(toolTip); - } - // if change action: set combobox to the correct entry - if (!(action == null)) { - String id = action.getActionId(); - for (int i = 0; i < actionNameComboBox.getItemCount(); i++) { - String actionName = (String) actionNameComboBox.getItemAt(i); - if (actionName.equals(actionTree.getActionName(id))) { - contains = true; - break; - } - } - if (contains == false) { - actionNameComboBox.addItem(actionTree.getActionName(id)); - tooltips.add("No comment available"); - } - actionNameComboBox.setSelectedItem(actionTree.getActionName(id)); - } - actionNameComboBox.setRenderer(new MyComboBoxRenderer()); - actionNameComboBox.setBounds(new java.awt.Rectangle(160,40,360,20)); - } - return actionNameComboBox; - } - - /** - * @author Daniel - * adds a tooltip to each combobox entry - */ - class MyComboBoxRenderer extends BasicComboBoxRenderer { - private static final long serialVersionUID = 1L; - - public Component getListCellRendererComponent( JList list, - Object value, int index, boolean isSelected, boolean cellHasFocus) { - if (isSelected) { - setBackground(list.getSelectionBackground()); - setForeground(list.getSelectionForeground()); - if (-1 < index) { - list.setToolTipText(tooltips.get(index).toString()); - } - } else { - setBackground(list.getBackground()); - setForeground(list.getForeground()); - } - setFont(list.getFont()); - setText((value == null) ? "" : value.toString()); - return this; - } - } - - /** - * This method initializes jButton - * - * @return javax.swing.JButton - */ - private JButton getNewActionButton() { - if (newActionButton == null) { - newActionButton = new JButton(); - newActionButton.setBounds(new java.awt.Rectangle(530,40,120,20)); - newActionButton.setText("New action"); - newActionButton.setActionCommand("New action"); - newActionButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - NewActionDialog acDlg = new NewActionDialog(ActionDialog.this); - acDlg.setVisible(true); - String newComment = acDlg.getActionComment(); - String newName = acDlg.getActionName(); - String newId = acDlg.getActionId(); - if (!(acDlg.isCanceled())) { - if (!(newName == null || newId == null) && (!(newName.equals("") || newId.equals("")))) { - Object[] options = { "OK", "CANCEL" }; - int option = JOptionPane.showOptionDialog(ActionDialog.this, "Do you really want to add this action?\nAdded actions can not be removed!", "Click OK to continue", - JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, - null, options, options[0]); - if (option == 0) { - actionTree.addAction(actionCategoryComboBox.getSelectedItem().toString(), newComment, newName, newId); - actionNameComboBox.addItem(newName); - if (!newComment.equals("")) { - tooltips.add(newComment); - } - else { - tooltips.add("No comment available"); - } - actionNameComboBox.setSelectedItem(newName); - } - } - } - } - }); - } - return newActionButton; - } - -} // @jve:decl-index=0:visual-constraint="10,10" diff --git a/Build/Tools/StateMachineEditor/src/dialog/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/dialog/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/dialog/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/dialog/EventDialog.java b/Build/Tools/StateMachineEditor/src/dialog/EventDialog.java deleted file mode 100644 index 566a5d1c95..0000000000 --- a/Build/Tools/StateMachineEditor/src/dialog/EventDialog.java +++ /dev/null @@ -1,384 +0,0 @@ -package dialog; - -import java.awt.Component; -import java.util.ArrayList; -import java.util.List; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JDialog; -import javax.swing.plaf.basic.BasicComboBoxRenderer; - -import model.Connection; - -import org.jdom.Comment; -import org.jdom.Element; - -import dom.DOMGetInstance; -import dom.ReadActionAndEventDOMTree; - -public class EventDialog extends JDialog { - - /** - * - */ - private static final long serialVersionUID = 1L; - private javax.swing.JPanel jContentPane = null; - private JLabel eventCategoryLabel = null; - private JComboBox eventCategoryComboBox = null; - private JButton newCategoryButton = null; - private JButton oKButton = null; - private JButton cancelButton = null; - private ActionAndEventInfo info; - private JLabel eventNameLabel = null; - private JComboBox eventNameComboBox = null; - private JButton newEventButton = null; - private String event = null; - private String category; - private List tooltips = new ArrayList(); - private ReadActionAndEventDOMTree eventTree = null; - - /** - * This is the default constructor - */ - public EventDialog() { - super(); - initialize(); - } - - /** - * constructor to change an event - * @param con the connection to which the event belongs - */ - public EventDialog(Connection con) { - super(); - this.event = con.getEvent(); - initialize(); - - } - - /** - * This method initializes this - * - * @return void - */ - private void initialize() { - eventTree = DOMGetInstance.getActionAndEventInstance(); - this.setSize(680, 200); - this.setName("ChangeEventDialog"); - this.setTitle("Change event"); - this.setLocationRelativeTo(null); - this.setResizable(false); - this.setModal(true); - this.setAlwaysOnTop(true); - this.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - this.setContentPane(getJContentPane()); - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel - */ - private javax.swing.JPanel getJContentPane() { - if(jContentPane == null) { - eventNameLabel = new JLabel(); - eventNameLabel.setBounds(new java.awt.Rectangle(30,40,120,20)); - eventNameLabel.setText("Event name:"); - eventCategoryLabel = new JLabel(); - eventCategoryLabel.setBounds(new java.awt.Rectangle(30,10,120,20)); - eventCategoryLabel.setText("Event category:"); - jContentPane = new javax.swing.JPanel(); - jContentPane.setLayout(null); - jContentPane.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - jContentPane.add(eventCategoryLabel, null); - jContentPane.add(getEventCategoryComboBox(), null); - jContentPane.add(getNewCategoryButton(), null); - jContentPane.add(getNewEventButton(), null); - jContentPane.add(getOKButton(), null); - jContentPane.add(getCancelButton(), null); - jContentPane.add(eventNameLabel, null); - jContentPane.add(getEventNameComboBox(), null); - } - return jContentPane; - } - - /** - * This method initializes jComboBox - * - * @return javax.swing.JComboBox - */ - private JComboBox getEventCategoryComboBox() { - if (eventCategoryComboBox == null) { - eventCategoryComboBox = new JComboBox(); - eventCategoryComboBox.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent e) { - category = eventCategoryComboBox.getSelectedItem().toString(); - if (!(eventNameComboBox == null)) { - eventNameComboBox.removeAllItems(); - List allEvents = eventTree.getEvents(category); - tooltips.clear(); - for (int i = 0; i < allEvents.size(); i++) { - Element ev = (Element) allEvents.get(i); - String event = ev.getAttributeValue("NAME"); - eventNameComboBox.addItem(event); - List commentList = ev.getContent(); - // set comments for each category to the tooltip - String toolTip = ""; - for (int j = 0; j < commentList.size(); j++) { - Object comEle = commentList.get(j); - if (comEle instanceof Comment) { - Comment comment = (Comment) comEle; - toolTip = comment.getText(); - break; - } - } - if (toolTip.equals("")) { - toolTip = "No comment available"; - } - tooltips.add(toolTip); - } - eventNameComboBox.setRenderer(new MyComboBoxRenderer()); - } - } - }); - eventCategoryComboBox.setMaximumRowCount(5); - List allCategories = eventTree.getEventCategories(); - for (int i = 0; i < allCategories.size(); i++) { - eventCategoryComboBox.addItem(allCategories.get(i).toString()); - } - eventCategoryComboBox.setBounds(new java.awt.Rectangle(160,10,360,20)); - if (!(eventTree.getEventCategoryName(event) == null)) { - eventCategoryComboBox.setSelectedItem(eventTree.getEventCategoryName(event)); - } - } - return eventCategoryComboBox; - } - - /** - * This method initializes jButton - * - * @return javax.swing.JButton - */ - private JButton getNewCategoryButton() { - if (newCategoryButton == null) { - newCategoryButton = new JButton(); - newCategoryButton.setBounds(new java.awt.Rectangle(530,10,120,20)); - newCategoryButton.setText("New category"); - newCategoryButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - while (true) { - String inputValue = JOptionPane.showInputDialog(EventDialog.this, "New category name:"); - if (inputValue == null) { - //cancel - break; - } - else if (!(inputValue == null) && !inputValue.equals("") && !eventTree.containsEventCategory(inputValue)) { - Object[] options = { "OK", "CANCEL" }; - int option = JOptionPane.showOptionDialog(EventDialog.this, "Do you really want to add this category?\nAdded categories can not be removed!", "Click OK to continue", - JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, - null, options, options[0]); - if (option == 0) { - eventTree.addEventCategory(inputValue); - eventCategoryComboBox.addItem(inputValue); - eventCategoryComboBox.setSelectedItem(inputValue); - } - break; - } - else if (eventTree.containsEventCategory(inputValue)) { - JOptionPane.showMessageDialog(EventDialog.this, - "Event category already exists, please choose another one!", "Error Message", - JOptionPane.ERROR_MESSAGE); - } - else { - JOptionPane.showMessageDialog(EventDialog.this, - "You have to enter a category name!", "Error Message", - JOptionPane.ERROR_MESSAGE); - } - } - } - }); - } - return newCategoryButton; - } - - /** - * This method initializes jButton1 - * - * @return javax.swing.JButton - */ - private JButton getOKButton() { - if (oKButton == null) { - oKButton = new JButton(); - oKButton.setBounds(new java.awt.Rectangle(480,100,80,30)); - oKButton.setText("OK"); - oKButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (eventNameComboBox.getSelectedItem() == null) { - JOptionPane.showMessageDialog(EventDialog.this, - "You have to select an event name!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - info = new ActionAndEventInfo(null, eventNameComboBox.getSelectedItem().toString(), null); - cancel(); - } - }); - } - return oKButton; - } - - /** - * This method initializes jButton2 - * - * @return javax.swing.JButton - */ - private JButton getCancelButton() { - if (cancelButton == null) { - cancelButton = new JButton(); - cancelButton.setBounds(new java.awt.Rectangle(570,100,80,30)); - cancelButton.setText("Cancel"); - cancelButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - cancel(); - } - }); - } - return cancelButton; - } - - /** - * disposes this dialog - */ - void cancel() { - dispose(); - } - - /** - * @return the info object with comment and name - */ - public ActionAndEventInfo getInfo() { - return info; - } - - /** - * This method initializes jComboBox - * - * @return javax.swing.JComboBox - */ - private JComboBox getEventNameComboBox() { - boolean contains = false; - if (eventNameComboBox == null) { - eventNameComboBox = new JComboBox(); - eventNameComboBox.setMaximumRowCount(5); - List allEvents = eventTree.getEvents(category); - for (int i = 0; i < allEvents.size(); i++) { - Element ev = (Element) allEvents.get(i); - String event = ev.getAttributeValue("NAME"); - eventNameComboBox.addItem(event); - List commentList = ev.getContent(); - // set comments for each event to the tooltip - String toolTip = ""; - for (int j = 0; j < commentList.size(); j++) { - Object comEle = commentList.get(j); - if (comEle instanceof Comment) { - Comment comment = (Comment) comEle; - toolTip = comment.getText(); - break; - } - } - if (toolTip.equals("")) { - toolTip = "No comment available"; - } - tooltips.add(toolTip); - } - if (!(event == null)) { - for (int i = 0; i < eventNameComboBox.getItemCount(); i++) { - String eventName = (String) eventNameComboBox.getItemAt(i); - if (eventName.equals(event)) { - contains = true; - break; - } - } - if (contains == false) { - eventNameComboBox.addItem(event); - tooltips.add("No comment available"); - } - eventNameComboBox.setSelectedItem(event); - } - eventNameComboBox.setRenderer(new MyComboBoxRenderer()); - eventNameComboBox.setBounds(new java.awt.Rectangle(160,40,360,20)); - } - return eventNameComboBox; - } - - /** - * @author Daniel - * adds a tooltip to each combobox entry - */ - class MyComboBoxRenderer extends BasicComboBoxRenderer { - private static final long serialVersionUID = 1L; - - public Component getListCellRendererComponent( JList list, - Object value, int index, boolean isSelected, boolean cellHasFocus) { - if (isSelected) { - setBackground(list.getSelectionBackground()); - setForeground(list.getSelectionForeground()); - if (-1 < index) { - list.setToolTipText(tooltips.get(index).toString()); - } - } else { - setBackground(list.getBackground()); - setForeground(list.getForeground()); - } - setFont(list.getFont()); - setText((value == null) ? "" : value.toString()); - return this; - } - } - - /** - * This method initializes jButton - * - * @return javax.swing.JButton - */ - private JButton getNewEventButton() { - if (newEventButton == null) { - newEventButton = new JButton(); - newEventButton.setBounds(new java.awt.Rectangle(530,40,120,20)); - newEventButton.setText("New event"); - newEventButton.setActionCommand("New event"); - newEventButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - NewEventDialog evDlg = new NewEventDialog(EventDialog.this); - evDlg.setVisible(true); - String newComment = evDlg.getEventComment(); - String newName = evDlg.getEventName(); - String newId = evDlg.getEventId(); - if (!evDlg.isCanceled()) { - if (!(newName == null || newId == null) && !(newName.equals("") || newId.equals(""))) { - Object[] options = { "OK", "CANCEL" }; - int option = JOptionPane.showOptionDialog(EventDialog.this, "Do you really want to add this event?\nAdded events can not be removed!", "Click OK to continue", - JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, - null, options, options[0]); - if (option == 0) { - eventTree.addEvent(eventCategoryComboBox.getSelectedItem().toString(), newComment, newName, newId); - eventNameComboBox.addItem(newName); - if (!newComment.equals("")) { - tooltips.add(newComment); - } - else { - tooltips.add("No comment available"); - } - eventNameComboBox.setSelectedItem(newName); - } - } - } - } - }); - } - return newEventButton; - } -} diff --git a/Build/Tools/StateMachineEditor/src/dialog/IntegerTextField.java b/Build/Tools/StateMachineEditor/src/dialog/IntegerTextField.java deleted file mode 100644 index f7b32077f1..0000000000 --- a/Build/Tools/StateMachineEditor/src/dialog/IntegerTextField.java +++ /dev/null @@ -1,126 +0,0 @@ -package dialog; - -import java.awt.*; -import javax.swing.*; -import javax.swing.text.*; - -public class IntegerTextField extends JTextField { - /** - * - */ - private static final long serialVersionUID = 1L; - - private long maxValue = Long.MAX_VALUE; - - private long minValue = 0; - - private int maxLength = String.valueOf(maxValue).length(); - - private boolean isIPField = false; - - /** - * Default constructor for IntegerTextField. - */ - public IntegerTextField() { - super(); - } - - protected Document createDefaultModel() { - return new IntegerDocument(); - } - - public void setMinValue(long value) { - minValue = value; - } - - public long getMinValue() { - return minValue; - } - - public void setIPField(boolean value) { - isIPField = value; - } - - public boolean getIPField() { - return isIPField; - } - - public void setMaxValue(long value) { - maxValue = value; - } - - public long getMaxValue() { - return maxValue; - } - - public void setMaxLength(int value) { - maxLength = value; - } - - public int getMaxLength() { - return maxLength; - } - - private class IntegerDocument extends PlainDocument { - /** - * - */ - private static final long serialVersionUID = 1L; - - public void insertString(int offs, String str, AttributeSet a) - throws BadLocationException { - long typedValue = -1; - - StringBuffer textBuffer = new StringBuffer(IntegerTextField.this - .getText().trim()); - //The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer - if ((offs >= 0) && (offs <= textBuffer.length())) { - textBuffer.insert(offs, str); - String textValue = textBuffer.toString(); - if (textBuffer.length() > maxLength) { - JOptionPane.showMessageDialog(IntegerTextField.this, - "The number of characters must be less than or equal to " - + getMaxLength(), "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - - if ((textValue == null) || (textValue.equals(""))) { - remove(0, getLength()); - super.insertString(0, "", null); - return; - } - - if (textValue.equals("-") && minValue < 0) { - super.insertString(offs, new String(str), a); - return; - } - - // if(maxLength == 3 && str.equals(".") && isIPField) - if (str.equals(".") && isIPField) { - super.insertString(offs, new String(str), a); - return; - } else { - try { - typedValue = Long.parseLong(textValue); - if ((typedValue > maxValue) || (typedValue < minValue)) { - JOptionPane.showMessageDialog( - IntegerTextField.this, - "The value can only be from " - + getMinValue() + " to " - + getMaxValue(), "Error Message", - JOptionPane.ERROR_MESSAGE); - } else { - super.insertString(offs, new String(str), a); - } - } catch (NumberFormatException ex) { - Toolkit.getDefaultToolkit().beep(); - JOptionPane.showMessageDialog(IntegerTextField.this, - "Only numeric values allowed.", - "Error Message", JOptionPane.ERROR_MESSAGE); - } - } - } - } - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/dialog/NewActionDialog.java b/Build/Tools/StateMachineEditor/src/dialog/NewActionDialog.java deleted file mode 100644 index 8e2be3b1de..0000000000 --- a/Build/Tools/StateMachineEditor/src/dialog/NewActionDialog.java +++ /dev/null @@ -1,219 +0,0 @@ -package dialog; - -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.JTextField; - -import dom.DOMGetInstance; -import dom.ReadActionAndEventDOMTree; - -public class NewActionDialog extends JDialog { - - /** - * - */ - private static final long serialVersionUID = 1L; - private javax.swing.JPanel jContentPane = null; - private JButton oKButton = null; - private JButton cancelButton = null; - private JLabel actionCommentLabel = null; - private JTextField actionCommentTextField = null; - private JLabel actionNameLabel = null; - private JTextField actionNameTextField = null; - private JLabel actionIdLabel = null; - private IntegerTextField actionIdTextField = null; - private boolean isCanceled = false; - - /** - * This is the default constructor - * @param dialog - */ - public NewActionDialog(ActionDialog dialog) { - super(dialog); - initialize(); - } - - /** - * This method initializes this - * - * @return void - */ - private void initialize() { - this.setSize(680, 200); - this.setName("NewActionDialog"); - this.setTitle("New action"); - this.setLocationRelativeTo(null); - this.setResizable(false); - this.setModal(true); - this.setAlwaysOnTop(true); - this.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - this.setContentPane(getJContentPane()); - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel - */ - private javax.swing.JPanel getJContentPane() { - if(jContentPane == null) { - actionCommentLabel = new JLabel(); - actionCommentLabel.setBounds(new java.awt.Rectangle(30,70,120,20)); - actionCommentLabel.setText("Action comment:"); - actionNameLabel = new JLabel(); - actionNameLabel.setBounds(new java.awt.Rectangle(30,10,120,20)); - actionNameLabel.setText("Action name:"); - actionIdLabel = new JLabel(); - actionIdLabel.setBounds(new java.awt.Rectangle(30,40,120,20)); - actionIdLabel.setText("Action id:"); - jContentPane = new javax.swing.JPanel(); - jContentPane.setLayout(null); - jContentPane.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - jContentPane.add(actionCommentLabel, null); - jContentPane.add(getActionCommentTextField(), null); - jContentPane.add(actionNameLabel, null); - jContentPane.add(getActionNameTextField(), null); - jContentPane.add(actionIdLabel, null); - jContentPane.add(getActionIdTextField(), null); - jContentPane.add(getOKButton(), null); - jContentPane.add(getCancelButton(), null); - } - return jContentPane; - } - - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private JTextField getActionCommentTextField() { - if (actionCommentTextField == null) { - actionCommentTextField = new JTextField(); - actionCommentTextField.setBounds(new java.awt.Rectangle(160,70,490,20)); - actionCommentTextField.setText(""); - } - return actionCommentTextField; - } - - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private JTextField getActionNameTextField() { - if (actionNameTextField == null) { - actionNameTextField = new JTextField(); - actionNameTextField.setBounds(new java.awt.Rectangle(160,10,490,20)); - actionNameTextField.setText(""); - } - return actionNameTextField; - } - - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private IntegerTextField getActionIdTextField() { - if (actionIdTextField == null) { - actionIdTextField = new IntegerTextField(); - actionIdTextField.setBounds(new java.awt.Rectangle(160,40,490,20)); - actionIdTextField.setText(""); - } - return actionIdTextField; - } - - /** - * This method initializes jButton1 - * - * @return javax.swing.JButton - */ - private JButton getOKButton() { - if (oKButton == null) { - oKButton = new JButton(); - oKButton.setBounds(new java.awt.Rectangle(480,100,80,30)); - oKButton.setText("OK"); - oKButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - ReadActionAndEventDOMTree actionTree = DOMGetInstance.getActionAndEventInstance(); - if (actionNameTextField.getText().equals("")) { - JOptionPane.showMessageDialog(NewActionDialog.this, - "You have to enter an action name!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - else if (actionTree.containsActionName(actionNameTextField.getText())) { - JOptionPane.showMessageDialog(NewActionDialog.this, - "Action name already exists, please choose another one!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - else if (actionIdTextField.getText().equals("")) { - JOptionPane.showMessageDialog(NewActionDialog.this, - "You have to enter an ID!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - else if (actionTree.containsActionId(actionIdTextField.getText())) { - JOptionPane.showMessageDialog(NewActionDialog.this, - "ID already exists, please choose another one!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - dispose(); - } - }); - } - return oKButton; - } - - /** - * This method initializes jButton2 - * - * @return javax.swing.JButton - */ - private JButton getCancelButton() { - if (cancelButton == null) { - cancelButton = new JButton(); - cancelButton.setBounds(new java.awt.Rectangle(570,100,80,30)); - cancelButton.setText("Cancel"); - cancelButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - isCanceled = true; - dispose(); - } - }); - } - return cancelButton; - } - - /** - * @return the comment on the new action - */ - public String getActionComment() { - return actionCommentTextField.getText(); - } - - /** - * @return the name of the new action - */ - public String getActionName() { - return actionNameTextField.getText(); - } - - /** - * @return the ID of the new action - */ - public String getActionId() { - return actionIdTextField.getText(); - } - - /** - * @return returns whether this dialog is canceled - */ - public boolean isCanceled() { - return isCanceled; - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/dialog/NewEventDialog.java b/Build/Tools/StateMachineEditor/src/dialog/NewEventDialog.java deleted file mode 100644 index 30d74657bd..0000000000 --- a/Build/Tools/StateMachineEditor/src/dialog/NewEventDialog.java +++ /dev/null @@ -1,217 +0,0 @@ -package dialog; - -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.JTextField; - -import dom.DOMGetInstance; -import dom.ReadActionAndEventDOMTree; - -public class NewEventDialog extends JDialog { - - private static final long serialVersionUID = 1L; - private javax.swing.JPanel jContentPane = null; - private JButton oKButton = null; - private JButton cancelButton = null; - private JLabel eventCommentLabel = null; - private JTextField eventCommentTextField = null; - private JLabel eventNameLabel = null; - private JTextField eventNameTextField = null; - private JLabel eventIdLabel = null; - private IntegerTextField eventIdTextField = null; - private boolean isCanceled = false; - - /** - * This is the default constructor - * @param dialog - */ - public NewEventDialog(EventDialog dialog) { - super(dialog); - initialize(); - } - - /** - * This method initializes this - * - * @return void - */ - private void initialize() { - this.setSize(680, 200); - this.setName("NewEventDialog"); - this.setTitle("New event"); - this.setLocationRelativeTo(null); - this.setResizable(false); - this.setModal(true); - this.setAlwaysOnTop(true); - this.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - this.setContentPane(getJContentPane()); - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel - */ - private javax.swing.JPanel getJContentPane() { - if(jContentPane == null) { - eventCommentLabel = new JLabel(); - eventCommentLabel.setBounds(new java.awt.Rectangle(30,70,120,20)); - eventCommentLabel.setText("Event comment:"); - eventNameLabel = new JLabel(); - eventNameLabel.setBounds(new java.awt.Rectangle(30,10,120,20)); - eventNameLabel.setText("Event name:"); - eventIdLabel = new JLabel(); - eventIdLabel.setBounds(new java.awt.Rectangle(30,40,120,20)); - eventIdLabel.setText("Event id:"); - jContentPane = new javax.swing.JPanel(); - jContentPane.setLayout(null); - jContentPane.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - jContentPane.add(eventCommentLabel, null); - jContentPane.add(getEventCommentTextField(), null); - jContentPane.add(eventNameLabel, null); - jContentPane.add(getEventNameTextField(), null); - jContentPane.add(eventIdLabel, null); - jContentPane.add(getEventIdTextField(), null); - jContentPane.add(getOKButton(), null); - jContentPane.add(getCancelButton(), null); - } - return jContentPane; - } - - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private JTextField getEventCommentTextField() { - if (eventCommentTextField == null) { - eventCommentTextField = new JTextField(); - eventCommentTextField.setBounds(new java.awt.Rectangle(160,70,490,20)); - eventCommentTextField.setText(""); - } - return eventCommentTextField; - } - - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private JTextField getEventNameTextField() { - if (eventNameTextField == null) { - eventNameTextField = new JTextField(); - eventNameTextField.setBounds(new java.awt.Rectangle(160,10,490,20)); - eventNameTextField.setText(""); - } - return eventNameTextField; - } - - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private IntegerTextField getEventIdTextField() { - if (eventIdTextField == null) { - eventIdTextField = new IntegerTextField(); - eventIdTextField.setBounds(new java.awt.Rectangle(160,40,490,20)); - eventIdTextField.setText(""); - } - return eventIdTextField; - } - - /** - * This method initializes jButton1 - * - * @return javax.swing.JButton - */ - private JButton getOKButton() { - if (oKButton == null) { - oKButton = new JButton(); - oKButton.setBounds(new java.awt.Rectangle(480,100,80,30)); - oKButton.setText("OK"); - oKButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - ReadActionAndEventDOMTree eventTree = DOMGetInstance.getActionAndEventInstance(); - if (eventNameTextField.getText().equals("")) { - JOptionPane.showMessageDialog(NewEventDialog.this, - "You have to enter an event name!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - else if (eventTree.containsEventName(eventNameTextField.getText())) { - JOptionPane.showMessageDialog(NewEventDialog.this, - "Event name already exists, please choose another one!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - else if (eventIdTextField.getText().equals("")) { - JOptionPane.showMessageDialog(NewEventDialog.this, - "You have to enter an ID!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - else if (eventTree.containsEventId(eventIdTextField.getText())) { - JOptionPane.showMessageDialog(NewEventDialog.this, - "ID already exists, please choose another one!", "Error Message", - JOptionPane.ERROR_MESSAGE); - return; - } - dispose(); - } - }); - } - return oKButton; - } - - /** - * This method initializes jButton2 - * - * @return javax.swing.JButton - */ - private JButton getCancelButton() { - if (cancelButton == null) { - cancelButton = new JButton(); - cancelButton.setBounds(new java.awt.Rectangle(570,100,80,30)); - cancelButton.setText("Cancel"); - cancelButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - isCanceled = true; - dispose(); - } - }); - } - return cancelButton; - } - - /** - * @return the comment on this new event - */ - public String getEventComment() { - return eventCommentTextField.getText(); - } - - /** - * @return the name of this new event - */ - public String getEventName() { - return eventNameTextField.getText(); - } - - /** - * @return the ID of this new event - */ - public String getEventId() { - return eventIdTextField.getText(); - } - - - /** - * @return returns whether this dialog is canceled - */ - public boolean isCanceled() { - return isCanceled; - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/dom/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/dom/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/dom/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/dom/ConvertToHeader.java b/Build/Tools/StateMachineEditor/src/dom/ConvertToHeader.java deleted file mode 100644 index deb8d31eed..0000000000 --- a/Build/Tools/StateMachineEditor/src/dom/ConvertToHeader.java +++ /dev/null @@ -1,93 +0,0 @@ -package dom; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; - -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.eclipse.ui.PlatformUI; - -public class ConvertToHeader implements IWorkbenchWindowActionDelegate { - - /** - * constructor to convert the xml file with the constants to a C++ header - * used when new actions or events are created - * @param filename the filename from the constants xml file - * @throws FileNotFoundException - * @throws TransformerException - */ - public ConvertToHeader(File filename) throws FileNotFoundException, TransformerException { - // change filename to match xsl file - String file = filename.getParentFile() + File.separator + "mitkEventAndActionConstants.xsl"; - TransformerFactory tFactory = TransformerFactory.newInstance(); - Transformer transformer = tFactory.newTransformer(new StreamSource(file)); - transformer.transform(new StreamSource(filename), new StreamResult(new FileOutputStream(filename.getParentFile() + File.separator + "mitkInteractionConst_h.h"))); - } - - /** - * constructor to convert the xml file with the constants to a C++ header - * used when the button in the workspace is pressed - */ - public ConvertToHeader() { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - // get the constants xml file - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - FileDialog fileDialog = new FileDialog(shell); - fileDialog.setFilterExtensions(new String[] {"*.xml"}); - fileDialog.open(); - if (!(fileDialog.getFileName().equals(""))) { - String file = fileDialog.getFilterPath(); - String file1 = fileDialog.getFileName(); - String file2 = file + File.separator + file1; - File xmlfilename = new File(file2); - File xslfilename = new File(xmlfilename.getParent() + File.separator + "mitkEventAndActionConstants.xsl"); - TransformerFactory tFactory = TransformerFactory.newInstance(); - Transformer transformer; - try { - transformer = tFactory.newTransformer(new StreamSource(xslfilename)); - transformer.transform(new StreamSource(xmlfilename), new StreamResult(new FileOutputStream(xmlfilename.getParentFile() + File.separator + "mitkInteractionConst_h.h"))); - } catch (TransformerConfigurationException e) { - e.printStackTrace(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (TransformerException e) { - e.printStackTrace(); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() - */ - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) - */ - public void init(IWorkbenchWindow window) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { - } -} diff --git a/Build/Tools/StateMachineEditor/src/dom/DOMGetInstance.java b/Build/Tools/StateMachineEditor/src/dom/DOMGetInstance.java deleted file mode 100644 index 0eb023b0c0..0000000000 --- a/Build/Tools/StateMachineEditor/src/dom/DOMGetInstance.java +++ /dev/null @@ -1,82 +0,0 @@ -package dom; - -import java.io.File; - -import org.eclipse.core.resources.IContainer; - -public class DOMGetInstance { - private static ReadDOMTree tree = null; - private static String filename1 = null; - private static IContainer container1 = null; - - /** - * creates a DOMTree from an specified xml file - * @param filename the xml file with the statemachines - * @return the ReadDOMTree instance - */ - public static ReadDOMTree getFromXML(String filename) { - filename1 = filename; - tree = new ReadDOMTree(filename, false); - return tree; - } - - /** - * @return the ReadDOMTree instance - */ - public static ReadDOMTree getInstance() { - return tree; - } - - /** - * creates a new xml file with the specified name - * @param filename the name for the new xml file - * @return the ReadDOMTree instance - */ - public static ReadDOMTree createNew(String filename) { - filename1 = filename; - tree = new ReadDOMTree(filename, true); - return tree; - } - - /** - * resets the ReadDOMTree instance - */ - public static void reset() { - tree = null; - } - - private static ReadActionAndEventDOMTree actionAndEventTree = null; - - /** - * creates a new ReadActionAndEventDOMTree instance from mitkEventAndActionConstants.xml - * which has to be located in the same folder as the xml file with the statemachines - * @return the ReadActionAndEventDOMTree instance - */ - public static ReadActionAndEventDOMTree getActionAndEventInstance() { - if (actionAndEventTree == null) { - File file = new File(filename1); - file.getAbsolutePath(); - File file1 = new File(file.getParentFile() + File.separator + "mitkEventAndActionConstants.xml"); - actionAndEventTree = new ReadActionAndEventDOMTree(file1); - } - return actionAndEventTree; - } - - /** - * sets the file container - * @param container the file container - */ - public static void setContainer(IContainer container) { - container1 = container; - } - - public static IContainer getContainer() { - return container1; - } - - public static String getFilename() { - File file = new File(filename1); - String filename = file.getName(); - return filename; - } -} diff --git a/Build/Tools/StateMachineEditor/src/dom/ReadActionAndEventDOMTree.java b/Build/Tools/StateMachineEditor/src/dom/ReadActionAndEventDOMTree.java deleted file mode 100644 index f684f196e3..0000000000 --- a/Build/Tools/StateMachineEditor/src/dom/ReadActionAndEventDOMTree.java +++ /dev/null @@ -1,410 +0,0 @@ -package dom; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.transform.TransformerException; - -import org.jdom.Comment; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.input.SAXBuilder; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; - -public class ReadActionAndEventDOMTree { - - private Document doc = null; - private Map eventIdMap = new HashMap(); - private Map eventNameMap = new HashMap(); - private Map eventCategoryMap = new HashMap(); - private Map actionIdMap = new HashMap(); - private Map actionNameMap = new HashMap(); - private Map actionCategoryMap = new HashMap(); - private List allEventCats = new ArrayList(); - private List allActionCats = new ArrayList(); - private File filename = null; - - /** - * constructor for ReadActionAndEventDOMTree - * builds the DOMTree from the xml file and Maps the id´s names and categories - * @param filename - */ - public ReadActionAndEventDOMTree(File filename) { - try { - // Build the document with SAX and Xerces, no validation - SAXBuilder builder = new SAXBuilder(); - // Create the document - this.filename = filename; - if (!filename.exists()) { - Element root = new Element("mitkInteraktionEvents"); - Element events = new Element("events"); - Element evcat = new Element ("eventCategory"); - evcat.setAttribute("NAME", "NullEvent"); - Element event = new Element("event"); - event.setAttribute("NAME", "EIDNULLEVENT"); - event.setAttribute("ID", "0"); - evcat.addContent(event); - events.addContent(evcat); - root.addContent(events); - Element actions = new Element("actions"); - Element accat = new Element ("actionCategory"); - accat.setAttribute("NAME", "DoNothing"); - Element action = new Element("action"); - action.setAttribute("NAME", "AcDONOTHING"); - action.setAttribute("ID", "0"); - accat.addContent(action); - actions.addContent(accat); - root.addContent(actions); - doc = new Document(root); - } - else { - doc = builder.build(filename); - List allEventCategories = getAllEventCategories(); - for (int i = 0; i < allEventCategories.size(); i++) { - Element cat = (Element) allEventCategories.get(i); - if (!allEventCats.contains(cat.getAttributeValue("NAME"))) { - allEventCats.add(cat.getAttributeValue("NAME")); - } - List allEvents = getEvents(cat.getAttributeValue("NAME")); - for (int j = 0; j < allEvents.size(); j++) { - Element ev = (Element) allEvents.get(j); - eventCategoryMap.put(ev.getAttributeValue("NAME"), cat.getAttributeValue("NAME")); - eventIdMap.put(ev.getAttributeValue("ID"), ev.getAttributeValue("NAME")); - eventNameMap.put(ev.getAttributeValue("NAME"), ev.getAttributeValue("ID")); - } - } - List allActionCategories = getAllActionCategories(); - for (int i = 0; i < allActionCategories.size(); i++) { - Element cat = (Element) allActionCategories.get(i); - if (!allActionCats.contains(cat.getAttributeValue("NAME"))) { - allActionCats.add(cat.getAttributeValue("NAME")); - } - List allActions = getActions(cat.getAttributeValue("NAME")); - for (int j = 0; j < allActions.size(); j++) { - Element act = (Element) allActions.get(j); - actionCategoryMap.put(act.getAttributeValue("NAME"), cat.getAttributeValue("NAME")); - actionIdMap.put(act.getAttributeValue("ID"), act.getAttributeValue("NAME")); - actionNameMap.put(act.getAttributeValue("NAME"), act.getAttributeValue("ID")); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * saves the DOMTree to the same xml file and - * calls the method to convert the xml file to a C++ header - */ - public void writeTree() { - Format format = Format.getPrettyFormat(); - format.setEncoding("utf-8"); - XMLOutputter xmlOut = new XMLOutputter(format); - try { - xmlOut.output(doc, new FileOutputStream(filename)); - new ConvertToHeader(filename); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (TransformerException e) { - e.printStackTrace(); - } - } - - /** - * @return all event category elements - */ - public List getAllEventCategories() { - Element events = doc.getRootElement().getChild("events", doc.getRootElement().getNamespace()); - return events.getChildren("eventCategory", events.getNamespace()); - } - - /** - * @return all event category names - */ - public List getEventCategories() { - Element events = doc.getRootElement().getChild("events", doc.getRootElement().getNamespace()); - List eventCategories = events.getChildren("eventCategory", events.getNamespace()); - List eventCategorieNames = new ArrayList(); - for (int i = 0; i < eventCategories.size(); i++) { - Element eventCategory = (Element) eventCategories.get(i); - eventCategorieNames.add(eventCategory.getAttributeValue("NAME")); - } - return eventCategorieNames; - } - - /** - * @param category the category from which all events should be - * @return all event elements - */ - public List getEvents(String category) { - Element events = doc.getRootElement().getChild("events", doc.getRootElement().getNamespace()); - List eventCategories = events.getChildren("eventCategory", events.getNamespace()); - List eventsList = null; - for (int i = 0; i < eventCategories.size(); i++) { - Element cat = (Element) eventCategories.get(i); - if (cat.getAttributeValue("NAME").equals(category)) { - eventsList = cat.getChildren("event", doc.getRootElement().getNamespace()); - } - } - return eventsList; - } - - /** - * @param categoryName the event category name which should be added - */ - public void addEventCategory(String categoryName) { - Element evCat = new Element("eventCategory", doc.getRootElement().getNamespace()); - evCat.setAttribute("NAME", categoryName); - Element events = doc.getRootElement().getChild("events", doc.getRootElement().getNamespace()); - events.addContent(evCat); - writeTree(); - } - - /** - * @param category the event category to which the event should be added - * @param comment the comment to this event - * @param event the name of this event - * @param id the id of this event - */ - public void addEvent(String category, String comment, String event, String id) { - Element ev = new Element("event", doc.getRootElement().getNamespace()); - ev.setAttribute("NAME", event); - ev.setAttribute("ID", id); - Comment com = new Comment(comment); - ev.addContent(com); - Element events = doc.getRootElement().getChild("events", doc.getRootElement().getNamespace()); - List eventCategories = events.getChildren("eventCategory", events.getNamespace()); - for (int i = 0; i < eventCategories.size(); i++) { - Element evCat = (Element) eventCategories.get(i); - if (evCat.getAttributeValue("NAME").equals(category)) { - evCat.addContent(ev); - break; - } - } - eventIdMap.put(id, event); - eventNameMap.put(event, id); - eventCategoryMap.put(event, category); - writeTree(); - } - - /** - * @param id the id of the searched event name - * @return the name according to this event id - */ - public String getEventName(String id) { - if (eventIdMap.containsKey(id)) { - return eventIdMap.get(id).toString(); - } - return id; - } - - /** - * @param eventName the name of the searched event id - * @return the id according to this event name - */ - public String getEventId(String eventName) { - if (eventNameMap.containsKey(eventName)) { - return eventNameMap.get(eventName).toString(); - } - return null; - } - - /** - * @param eventName the name of the event to which the category should be found - * @return the category according to this event name - */ - public String getEventCategoryName(String eventName) { - if (eventCategoryMap.containsKey(eventName)) { - return eventCategoryMap.get(eventName).toString(); - } - return null; - } - - /** - * @return all action category names - */ - public List getActionCategories() { - Element actions = doc.getRootElement().getChild("actions", doc.getRootElement().getNamespace()); - List actionCategories = actions.getChildren("actionCategory", actions.getNamespace()); - List categorieNames = new ArrayList(); - for (int i = 0; i < actionCategories.size(); i++) { - Element actionCategory = (Element) actionCategories.get(i); - categorieNames.add(actionCategory.getAttributeValue("NAME")); - } - return categorieNames; - } - - /** - * @return all action category elements - */ - public List getAllActionCategories() { - Element actions = doc.getRootElement().getChild("actions", doc.getRootElement().getNamespace()); - return actions.getChildren("actionCategory", actions.getNamespace()); - } - - /** - * @param category the category from which all actions should be - * @return all action elements - */ - public List getActions(String category) { - Element actions = doc.getRootElement().getChild("actions", doc.getRootElement().getNamespace()); - List actionCategories = actions.getChildren("actionCategory", actions.getNamespace()); - List actionsList = null; - for (int i = 0; i < actionCategories.size(); i++) { - Element acCat = (Element) actionCategories.get(i); - if (acCat.getAttributeValue("NAME").equals(category)) { - actionsList = acCat.getChildren("action", doc.getRootElement().getNamespace()); - } - } - return actionsList; - } - - /** - * @param categoryName the action category name which should be added - */ - public void addActionCategory(String categoryName) { - Element acCat = new Element("actionCategory", doc.getRootElement().getNamespace()); - acCat.setAttribute("NAME", categoryName); - Element actions = doc.getRootElement().getChild("actions", doc.getRootElement().getNamespace()); - actions.addContent(acCat); - writeTree(); - } - - /** - * @param category the action category to which the action should be added - * @param comment the comment to this action - * @param action the name of this action - * @param id the id of this action - */ - public void addAction(String category, String comment, String action, String id) { - Element ac = new Element("action", doc.getRootElement().getNamespace()); - ac.setAttribute("NAME", action); - ac.setAttribute("ID", id); - actionIdMap.put(id, action); - actionNameMap.put(action, id); - actionCategoryMap.put(action, category); - if (!(comment == null || comment == "")) { - Comment com = new Comment(comment); - ac.addContent(com); - } - Element actions = doc.getRootElement().getChild("actions", doc.getRootElement().getNamespace()); - List actionCategories = actions.getChildren("actionCategory", actions.getNamespace()); - for (int i = 0; i < actionCategories.size(); i++) { - Element acCat = (Element) actionCategories.get(i); - if (acCat.getAttributeValue("NAME").equals(category)) { - acCat.addContent(ac); - break; - } - } - writeTree(); - } - - /** - * @param id the id of the searched action name - * @return the name according to this action id - */ - public String getActionName(String id) { - if (actionIdMap.containsKey(id)) { - return actionIdMap.get(id).toString(); - } - return id; - } - - /** - * @param actionName the name of the searched action id - * @return the id according to this action name - */ - public String getActionId(String actionName) { - if (actionNameMap.containsKey(actionName)) { - return actionNameMap.get(actionName).toString(); - } - return null; - } - - /** - * @param actionName the name of the action to which the category should be found - * @return the category according to this action name - */ - public String getActionCategoryName(String actionName) { - if (actionCategoryMap.containsKey(actionName)) { - return actionCategoryMap.get(actionName).toString(); - } - return null; - } - - /** - * @param id the searched event id - * @return true if the event id is already in use, false otherwise - */ - public boolean containsEventId (String id) { - if (eventIdMap.containsKey(id)) { - return true; - } - return false; - } - - /** - * @param id the searched event name - * @return true if the event name is already in use, false otherwise - */ - public boolean containsEventName (String eventName) { - if (eventNameMap.containsKey(eventName)) { - return true; - } - return false; - } - - /** - * @param id the searched event category - * @return true if the event category is already in use, false otherwise - */ - public boolean containsEventCategory (String eventCategory) { - if (allEventCats.contains(eventCategory)) { - return true; - } - return false; - } - - /** - * @param id the searched action id - * @return true if the action id is already in use, false otherwise - */ - public boolean containsActionId (String id) { - if (actionIdMap.containsKey(id)) { - return true; - } - return false; - } - - /** - * @param actionName the searched action name - * @return true if the action name is already in use, false otherwise - */ - public boolean containsActionName (String actionName) { - if (actionNameMap.containsKey(actionName)) { - return true; - } - return false; - } - - /** - * @param actionCategory the searched action category - * @return true if the action category is already in use, false otherwise - */ - public boolean containsActionCategory (String actionCategory) { - if (allActionCats.contains(actionCategory)) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/dom/ReadDOMTree.java b/Build/Tools/StateMachineEditor/src/dom/ReadDOMTree.java deleted file mode 100644 index f4c93fbef9..0000000000 --- a/Build/Tools/StateMachineEditor/src/dom/ReadDOMTree.java +++ /dev/null @@ -1,193 +0,0 @@ -package dom; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import model.StateMachinesDiagram; - -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.Namespace; -import org.jdom.input.SAXBuilder; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; - -public class ReadDOMTree { - private List allMachines = new ArrayList(); - private Document doc = null; - private String filename; - - /** - * adds an open editor to the list allMachines - * @param diagram StateMAchinesDiagram of an open editor - */ - public void addDiagram(StateMachinesDiagram diagram) { - allMachines.add(diagram); - } - - /** - * removes an open editor from list allMachines - * @param diagram StateMachinesDiagram of an open editor - */ - public void removeDiagram(StateMachinesDiagram diagram) { - allMachines.remove(diagram); - } - - /** - * @return a list of all currently open editors - */ - public List getAllDiagrams() { - return allMachines; - } - - /** - * @return a list of all statemachines in the DOMTree - */ - public List getStateMachines() { - return doc.getRootElement().getChildren("stateMachine", doc.getRootElement().getNamespace()); - } - - /** - * adds a statemachine with an open editor to the DOMTree - * @param machine the stateMachinesDiagram with an open editor - * @param stateMachine the DOM element of the statemachine - */ - public void addStateMachine(StateMachinesDiagram machine, Element stateMachine) { - stateMachine.setNamespace(doc.getRootElement().getNamespace()); - doc.getRootElement().addContent(stateMachine); - allMachines.add(machine); - } - - /** - * adds a statemachine with no open editor to the DOMTree - * @param stateMachine the DOM element of the statemachine - */ - public void addStateMachine1(Element stateMachine) { - stateMachine.setNamespace(doc.getRootElement().getNamespace()); - doc.getRootElement().addContent(stateMachine); - } - - /** - * removes a statemachine with an open editor from DOMTree - * @param machine the stateMachinesDiagram with an open editor - * @param stateMachine the DOM element of the statemachine - */ - public void removeStateMachine(StateMachinesDiagram machine, Element stateMachine) { - doc.getRootElement().removeContent(stateMachine); - allMachines.remove(machine); - } - - - /** - * removes a statemachine with no open editor from DOMTree - * @param stateMachine the DOM element of the statemachine - * @return the DOM element of the removed statemachine - */ - public Element removeStateMachine1(String stateMachine) { - List stateMachines = getStateMachines(); - for (int i = 0; i < stateMachines.size(); i++) { - Element ele = (Element) stateMachines.get(i); - if (ele.getAttributeValue("NAME").equals(stateMachine)) { - doc.getRootElement().removeContent(ele); - return ele; - } - } - return null; - } - - /** - * returns a diagram from the statemachine with the specified name - * @param machineName name of the statemachine with the diagram - * @return a StateMachinesDiagram with an open editor - */ - public StateMachinesDiagram getStateMachinesDiagram(String machineName) { - StateMachinesDiagram machine = null; - for (int j = 0; j < allMachines.size(); j++) { - machine = (StateMachinesDiagram) allMachines.get(j); - if (machine.getStateMachineName().equals(machineName)) { - return machine; - } - } - return null; - } - - /** - * constructor to build the DOMTree from the xml file - * @param file the xml file - * @param newTree boolean value to show if it has to create a new xml file - * true = has to create - */ - public ReadDOMTree(String file, boolean newTree) { - filename = file; - if (!(newTree)) { - try { - // Build the document with SAX and Xerces, no validation - SAXBuilder builder = new SAXBuilder(); - // Create the document - doc = builder.build(new File(filename)); - } catch (Exception e) { - e.printStackTrace(); - } - } - // create new xml file - else { - Element root = new Element("mitkInteraktionStates"); - Namespace xmlns = Namespace.getNamespace( - "", "http://tempuri.org/StateMachine.xsd"); - root.setNamespace(xmlns); - root.setAttribute("STYLE", "User001"); - doc = new Document(root); - } - } - - /** - * saves the DOMTree on file location - * @param file file location to save the xml file - */ - public void writeTree(String file) { - Format format = Format.getPrettyFormat(); - format.setEncoding("utf-8"); - XMLOutputter xmlOut = new XMLOutputter(format); - try { - xmlOut.output(doc, new FileOutputStream(file)); - filename = file; - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * saves the DOMTree on the same location where it has been loaded - */ - public void writeTree() { - Format format = Format.getPrettyFormat(); - format.setEncoding("utf-8"); - XMLOutputter xmlOut = new XMLOutputter(format); - try { - xmlOut.output(doc, new FileOutputStream(filename)); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * @return returns a list of all names from the statemachine in the DOMTree - */ - public List getStateMachineNames() { - List stateMachines = doc.getRootElement().getChildren("stateMachine", doc.getRootElement().getNamespace()); - List stateMachineNames = new ArrayList(); - for (int i = 0; i < stateMachines.size(); i++) { - Element machine = (Element) stateMachines.get(i); - stateMachineNames.add(machine.getAttributeValue("NAME")); - } - return stateMachineNames; - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/javax/COPYRIGHT.txt b/Build/Tools/StateMachineEditor/src/javax/COPYRIGHT.txt deleted file mode 100644 index 311bfd3aea..0000000000 --- a/Build/Tools/StateMachineEditor/src/javax/COPYRIGHT.txt +++ /dev/null @@ -1,77 +0,0 @@ -Copyright (c) 2005 Sun Microsystems, Inc., 4150 Network Circle, Santa -Clara, California 95054, U.S.A. All rights reserved. - -Sun Microsystems, Inc. has intellectual property rights relating to -technology embodied in the product that is described in this -document. In particular, and without limitation, these intellectual -property rights may include one or more of the U.S. patents listed at -http://www.sun.com/patents and one or more additional patents or -pending patent applications in the U.S. and in other countries. - -U.S. Government Rights - Commercial software. Government users are -subject to the Sun Microsystems, Inc. standard license agreement and -applicable provisions of the FAR and its supplements. - -Use is subject to license terms. - -This distribution may include materials developed by third parties. - -Parts of the product may be derived from Berkeley BSD systems, -licensed from the University of California. UNIX is a registered -trademark in the U.S. and in other countries, exclusively licensed -through X/Open Company, Ltd. - -Sun, Sun Microsystems, the Sun logo, Java, Solaris, Java 3D, the 100% -Pure Java logo, the Duke logo and the Java Coffee Cup logo are -trademarks or registered trademarks of Sun Microsystems, Inc. in the -U.S. and other countries. - -This product is covered and controlled by U.S. Export Control laws and -may be subject to the export or import laws in other countries. -Nuclear, missile, chemical biological weapons or nuclear maritime end -uses or end users, whether direct or indirect, are strictly -prohibited. Export or reexport to countries subject to U.S. embargo or -to entities identified on U.S. export exclusion lists, including, but -not limited to, the denied persons and specially designated nationals -lists is strictly prohibited. - -Copyright (c) 2005 Sun Microsystems, Inc., 4150 Network Circle, Santa -Clara, California 95054, Etats-Unis. Tous droits réservés. - -Sun Microsystems, Inc. détient les droits de propriété intellectuels -relatifs à la technologie incorporée dans le produit qui est décrit -dans ce document. En particulier, et ce sans limitation, ces droits de -propriété intellectuelle peuvent inclure un ou plus des brevets -américains listés à l'adresse http://www.sun.com/patents et un ou les -brevets supplémentaires ou les applications de brevet en attente aux -Etats - Unis et dans les autres pays. - -L'utilisation est soumise aux termes de la Licence. - -Cette distribution peut comprendre des composants développés par des -tierces parties. - -Des parties de ce produit pourront être dérivées des systèmes Berkeley -BSD licenciés par l'Université de Californie. UNIX est une marque -déposée aux Etats-Unis et dans d'autres pays et licenciée -exclusivement par X/Open Company, Ltd. - -Sun, Sun Microsystems, le logo Sun, Java, Solaris, Java 3D, le logo -100% Pure Java, le logo Duke et le logo Java Coffee Cup sont des -marques de fabrique ou des marques déposées de Sun Microsystems, -Inc. aux Etats-Unis et dans d'autres pays. - -Ce produit est soumis à la législation américaine en matière de -contrôle des exportations et peut être soumis à la règlementation en -vigueur dans d'autres pays dans le domaine des exportations et -importations. Les utilisations, ou utilisateurs finaux, pour des armes -nucléaires,des missiles, des armes biologiques et chimiques ou du -nucléaire maritime, directement ou indirectement, sont strictement -interdites. Les exportations ou réexportations vers les pays sous -embargo américain, ou vers des entités figurant sur les listes -d'exclusion d'exportation américaines, y compris, mais de manière non -exhaustive, la liste de personnes qui font objet d'un ordre de ne pas -participer, d'une façon directe ou indirecte, aux exportations des -produits ou des services qui sont régis par la législation américaine -en matière de contrôle des exportations et la liste de ressortissants -spécifiquement désignés, sont rigoureusement interdites. diff --git a/Build/Tools/StateMachineEditor/src/javax/LICENSE-JDL.txt b/Build/Tools/StateMachineEditor/src/javax/LICENSE-JDL.txt deleted file mode 100644 index 86b11716df..0000000000 --- a/Build/Tools/StateMachineEditor/src/javax/LICENSE-JDL.txt +++ /dev/null @@ -1,332 +0,0 @@ -JAVA DISTRIBUTION LICENSE (VER. 1.0) -Java 3D - -I. LICENSE GRANTS, TERMS AND RESTRICTIONS - -1.0 General License Terms. This Java Distribution License ("JDL") is -between Sun Microsystems, Inc. ("Sun") and You where "You" means the -individual or legal entity exercising rights under this -JDL. "Technology" means the following as provided under this JDL: (i) -the source code and binary code from the Reference Implementation -("RI") of the Java 3DTM version 1.3 Specification (the -"Specification") and related documentation, all as revised or upgraded -and made available hereunder; and (ii) the associated technology -compatibility kit ("TCK"). The TCK contains the TCK documentation, -user's guide ("TCK User's Guide"), test tools and test suite -associated with the Specification, as revised or upgraded by Sun. The -TCK is provided so that You may determine if Your implementation is -compliant with the Specification. "Modifications" means any (i) change -or addition to or derivative of the Technology; or (ii) new source or -object code implementing the Specification for the -Technology. "Commercial Use" means: (i) Your use of the RI and/or -Modifications as part of a Compatible Implementation within Your -business or organization, but only by Your employees or agents; and/or -(ii) any use or distribution, directly or indirectly by You of the RI -and/or Modifications as part of a Compatible Implementation to any -third party, alone or bundled with any other software or hardware, for -direct or indirect commercial or strategic gain or advantage. By Your -use or distribution of the Technology and Modifications, You agree to -the terms of this JDL. - -2.0 License Grants, Restrictions and Termination. - -2.1 Commercial Use and Internal Deployment License Grants. Subject to -the terms of this JDL, Sun grants to You, to the extent of Sun's -licensable copyrights, patents and trade secrets in the RI, a limited, -non-exclusive, non-transferable, worldwide and royalty-free license to -modify, compile, reproduce, distribute, internally use and internally -deploy code and related documentation from the RI and/or Modifications -for Commercial Use, but only as part of Your own Compatible -Implementation (as defined below), and only if You make such -distributions as follows: - -(i) Source Code. You can only distribute source code for the RI and -Modifications under all of the following conditions: (a) You make such -distribution under the terms of this JDL; (b) without offering or -imposing any different terms; (c) to a receipient who has accepted the -terms of this JDL; and (d) You provide a copy of this JDL to each such -receipient; - -(ii) Binary Code. You can distribute binary code for the RI and -Modifications but only under license terms which (a) have been -accepted by the receipient; (b) are consistent, and not conflicting, -with the terms of the JDL; and (c) where such terms are no less -protective of Sun than the terms of this JDL. - -2.2 TCK License Grant. Subject to the terms of this JDL, Sun grants to -You, to the extent of Sun's licensable copyrights, patents and trade -secrets in the TCK, a limited, non-exclusive, non-transferable, -worldwide and royalty-free license to internally use the TCK for the -sole purpose of developing and testing Your Compatible Implementations -(as defined below). - -2.2.1 TCK Master Support Agreement. If you desire support for the TCK, -You may execute a separate TCK master support with Sun as described on -the Technology Site or on such other URL as Sun may designate from -time to time. - -2.2.2 TCK Use Terms. Your TCK license grant hereunder is expressly -conditioned upon your continued adherance to the following -restrictions: - -(i) You may not sublicense or distribute the TCK to any third party -except for any specific TCK code files identified as redistributables -in the TCK User's Guide ("Redistributables"), but only: (a) as part of -a TCK Adaptor accompanying a Compatible Implementation (where a "TCK -Adaptor" means a program that effects interoperability between the TCK -and the Compatible Implementation); and (b) pursuant to a license -agreement that protects Sun's interests consistent with the terms of -the JDL; - -(ii) You may not create derivative works of the TCK nor of any of its -components except for the Redistributables in a TCK Adaptor; - -(iii) You may not disassemble or decompile binary portions of the -TCK's test suites or test tools or otherwise attempt to derive the -source code from such binary portions; - -(iv) You may not develop other test suites intended to validate -compatibility with the Specification to which the TCK licensed -hereunder corresponds; - -(v) You may not use the TCK to test a third party's product; - -(vi) You may not make Commercial Use of code which implements any -portion of the Specification unless such code is included in a -Compatible Implementation; - -(vii) You may disclose Test Reports (where "Test Reports" means those -reports generated by the TCK which identify only configuration -information and the status of individual or aggregate test executions) -for an implementation which You are attempting to certified in -accordance with the terms of this JDL for the sole purpose of making -Your implementation a Compatible Implementation, but you may not make -any claims of comparative compatibility nor disclose any other TCK -testing information to any party. For example, You cannot claim that -Your implementation is "nearly compatible" or "98% compatible." When -You share Test Reports in any public forum, including mailing lists, -marketing material or press releases, and Your implementation is not a -Compatible Implementation, You must state that Your implementation is -"not compatible;" and - -(viii) You will protect the TCK as confidential information of Sun -and, except as expressly authorized herein, You may not disclose the -TCK to any third party. This obligation of confidentiality with -respect to the TCK will survive any termination or expiration of this -JDL. - -2.3 Term and Termination. This JDL shall have an initial term of two -(2) years after your acceptance of this JDL and shall thereafter -automatically renew for additional one year terms unless either party -provides notice to the other party sixty (60) days prior to an -anniversary date. The license grants of this JDL, are expressly -conditioned upon Your not acting outside their scope, and Your -continued compliance with the material provisions of this JDL. All -license grants under this JDL will automatically and immediately be -revoked without notice if You fail to so comply. Upon termination or -expiration of this JDL, You must discontinue all use and distribution -of the Technology and any Compatible Implementation licensed under -this JDL. All sublicenses You have properly granted hereunder shall -survive termination or expiration of Your rights under the -JDL. Provisions which should, by their nature, remain in effect after -termination or expiration shall survive, including, without -limitation, the provisions of Article II (General Terms) and the TCK -confidentiality obligations under this JDL. - -2.4 General License Restrictions. Some portions of the Technology are -provided with notices and/or open source or other licenses from other -parties which govern the use of those portions. Your use or -distribution of encryption technology contained within the Technlogy -is subject to all applicable governmental regulations of the United -States of America and the country where the Technology is -deployed. You agree to comply with the U.S. export controls and trade -laws of other countries that apply to the Technology and Compatible -Implementations. You acknowledge that the Technology is not designed, -licensed or intended for use in the design, construction, operation or -maintenance of any nuclear facility. Other than the rights granted -herein, Sun retains all rights, title, and interest in the Technlogy. - -3.0 Compatibility and Use of the TCK. - -3.1 Compatible Implementation TCK Requirements. Your use of the RI -and/or Modifications as part of an implementation of the Specification -is a "Compatible Implementation" if the implementation meets the -following requirements: - -3.1.1 A Compatible Implementation must comply with the full -Specification, including all its required interfaces and -functionality; - -3.1.2 A Compatible Implementation must either: (i) pass the most -current compatibility requirements (as defined by the TCK User's -Guide) which were made available by Sun one hundred twenty (120) days -before first commercial shipment ("FCS") of each version of the -Compatible Implementation (eg. if Your FCS was December 31, 2003, You -must have passed the most current version of the TCK as of September -2, 2003); or (ii) at Your option, pass all the compatibility -requirements of a newer version of the TCK and its associated TCK -User's Guide; - -3.1.3 A Compatible Implementation may not modify the functional -behavior of the "Java Classes" which means the specific class -libraries associated with the Technology; and - -3.1.4 A Compatible Implementation may not modify, subset, superset or -otherwise extend the Licensor Name Space, nor include any public or -protected packages, classes, Java interfaces, fields or methods within -the Licensor Name Space other than those required and/or authorized by -the Specification. "Licensor Name Space" means the public class or -interface declarations whose names begin with "java", "javax", -"com.sun" or their equivalents in any subsequent naming convention -adopted by Sun through the Java Community Process, or any recognized -successors or replacements thereof. - -3.2 Self-Certification for Compatibility. You shall self-certify that -Your Compatible Implementation passes the applicable TCK as set forth -above, if and when Your Compatible Implementation in fact does so, -provided that: - -3.2.1 If Sun policy also requires verification of compatibility for -Your Compatible Implementation then You shall, prior to the FCS of the -Compatible Implementation, submit verification of compatibility to Sun -or to an independent test facility designated by Sun. If such -verification is by an independent test facility, then the reasonable -costs of such activity (including any applicable fees) shall be at -Your expense. Sun may publish or otherwise disclose Your test results. - -3.2.2 Upon thirty (30) days written notice by Sun, and no more than -two (2) times per calendar year, You shall permit Sun or its -authorized representative to inspect and test any Compatible -Implementation which has been self-certified per this subsection 3.2 -to ensure that such Compatible Implementation meets the compatibility -and other requirements for a Compatible Implementation as set forth -herein. The reasonable costs of such inspection shall be at Sun's -expense; provided, however, that You shall reimburse Sun for such -costs if the inspection reveals that the Compatible Implementation -does not meet such requirements and these deficiencies are not cured -within thirty (30) days. - -4.0 Fees and Royalties. There are no fees or royalites associated with -the license grants for the Technology licensed under this JDL. - -II. GENERAL TERMS - -5.0 No Warranty. THE TECHNOLOGY AND/OR MODIFICATIONS ARE PROVIDED "AS -IS", WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS, IMPLIED OR -STATUTORY INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE -TECHNOLOGY AND/OR MODIFICATIONS ARE FREE OF DEFECTS, MERCHANTABLE, FIT -FOR A PARTICULAR PURPOSE, OR NON-INFRINGING OF THIRD PARTY RIGHTS. YOU -AGREE THAT YOU BEAR THE ENTIRE RISK IN CONNECTION WITH YOUR USE AND -DISTRIBUTION OF ANY AND ALL TECHNOLOGY AND/OR MODIFICATIONS ARE UNDER -THIS JDL. SOME JURISDICTIONS DO NOT PERMIT THE EXCLUSION OF IMPLIED -WARRANTIES SO THE ABOVE EXCLUSIONS MAY NOT APPLY TO YOU - -6.0 Infringement Claims. Sun may terminate this JDL, in Sun's sole -discretion, upon any action initiated by You alleging that the use or -distribution of the Technology and/or Modifications by Sun, or any -other licensee of the Technology and/or Modifications, infringes a -patent owned or controlled by You. In addition, if any portion of, or -functionality implemented by, the Technology becomes the subject of a -claim or threatened claim of infringement ("Affected Materials"), Sun -may, at its sole option, (i) attempt to procure the rights necessary -for You to continue using the Affected Materials, (ii) modify the -Affected Materials so that they are no longer infringing, or (iii) -immediately suspend Your rights to use and distribute the Affected -Materials under this JDL by posting of notice of suspension on the -Technology Site, and refund toYou the amount, if any, having then -actually been paid by You to Sun under this JDL, on a straight line, -five year basis . - -7.0 Limitation of Liability. Sun will be not be liable for any claims -relating to, or arising out of, this JDL, whether in tort, contract or -otherwise, in an amount in excess of any annual license fees You paid -to Sun for the Technology. IN NO EVENT WILL SUN BE LIABLE FOR ANY -INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR PUNITIVE DAMAGES IN -CONNECTION WITH OR ARISING OUT OF THIS JDL (INCLUDING, WITHOUT -LIMITATION, LOSS OF PROFITS, USE, DATA, OR ECONOMIC ADVANTAGE OF ANY -SORT), HOWEVER IT ARISES AND UNDER ANY THEORY OF LIABILITY (including -negligence), REGARDLESS OF WHETHER OR NOT SUN HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. FURTHERMORE, LIABILITY UNDER THIS JDL -SHALL BE SO LIMITED AND EXCLUDED, NOTWITHSTANDING FAILURE OF THE -ESSENTIAL PURPOSE OF ANY REMEDY. TO THE EXTENT ANY INDIRECT, PUNITIVE, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES YOU INCUR FOR ANY REASON -WHATSOEVER CANNOT BE DISCLAIMED THEN THE ENTIRE LIABILITY OF SUN UNDER -ANY PROVISION OF THIS JDL, AND YOUR EXCLUSIVE REMEDY FOR ANY SUCH -DAMAGES, SHALL BE LIMITED TO THE GREATER OF THE AMOUNT ACTALLY PAID BY -YOU FOR THE TECHNOLOGY OR FIVE HUNDRED US DOLLARS, WHICHEVER IS -GREATER. SOME JURISDICTIONS DO NOT PERMIT THE EXCLUSION OR LIMITATION -OF INCIDENTALS OR CONSEQUENTIAL DAMAGES SO THE ABOVE EXCLUSION AND -LIMITATION MAY NOT APPLY TO YOU. - -8.0 Support. Sun does not provide any support for the Technology or -the TCK to either You or Your customers under this JDL. Support for -the TCK is provided under a separate TCK master support agreement. If -You desire support for the RI, You may contact Sun. You are solely -reponsible for providing all support to Your customers with respect to -the Technology, TCK, Modifications and/or Compatible Implementation. - -9.0 Marketing and Press Announcements. Your initial press announcement -concerning execution of this JDL must be reviewed and approved by Sun -prior to its release. You hereby authorizes Sun to include You in a -published list of licensees of the Technology. Sun shall also be -authorized to use Your name in advertising, marketing collateral, and -customer success stories prepared by or on behalf of Sun for the -Technology subject to Your prior approval, such approval not to be -unreasonably withheld or delayed. - -10.0 Notices. All notices required by this JDL must be in writing. Sun -shall deliver notice to You via either e-mail or by physical mail -based on the information You provided to Sun when you accepted this -JDL. Notices by You to Sun will be effective only upon receipt by Sun -at the following physical addresses: Sun Microsystems, Inc., 4150 -Network Circle, Santa Clara, California 95054, Attn.: Sun Software VP -of Sales, cc: General Counsel, cc: Product Law Legal Department or to -such different address as Sun provides on the Technology Site for such -purpose. - -11.0 Proprietary Rights Notices and Branding Requirements. There are -no specific branding requirements associated with the Technology under -this JDL. You may not remove any copyright notices, trademark notices -or other proprietary legends of Sun or its suppliers contained on or -in the Technology, including any notices of licenses for open source -components. You agree to comply with the Sun Trademark and Logo Usage -Requirements currently located at -http://www.sun.com/policies/trademarks. Except as provided in this -JDL, no right, title or interest to Sun's trademarks, brands or logos -is granted herein. - -12.0 U.S. Government End Users. The Technology and Modifications are a -"commercial item," as that term is defined in 48 C.F.R. 2.101 -(Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used -in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and -48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all -U.S. Government End Users acquire Technology and/or Modifications with -only those rights set forth herein. You agree to pass this notice to -Your licensees. - -13.0 Miscellaneous. This JDL is governed by the laws of the United -States and the State of California, as applied to contracts entered -into and performed in California between California residents. The -relationship created under this JDL is that of licensor and licensee -and does not create any other relationship such as a partnership, -franchise, joint venture, agency or employment relationship between -the parties. This JDL may not be assigned or transferred by either -party without the prior written consent of the other party, which -consent shall not be unreasonably withheld or delayed, except that Sun -may assign: (i) to an affiliated company, or (ii) in the event of a -merger, acquisition or sale of all or substantially all of the assets -of Sun. Any express waiver or failure to exercise promptly any right -under this Agreement will not create a continuing waiver nor any -expectation of non-enforcement. The disclaimer of warranties and -limitations of liability constitute an essential basis of the bargain -in this JDL. This JDL represents the complete agreement of the parties -concerning the subject matter hereof and may not be modified or -amended in whole or part, except by a written instrument signed by the -parties' authorized representatives. Nothing herein shall supersede or -modify the terms of any separate signed written license agreement You -may have executed with Sun regarding the Technology. - -YOU: By: ___________________________________ Name: ___________________________________ - - Title: __________________________________ Date: _____________________________________ diff --git a/Build/Tools/StateMachineEditor/src/javax/LICENSE-JRL.txt b/Build/Tools/StateMachineEditor/src/javax/LICENSE-JRL.txt deleted file mode 100644 index 80439e029f..0000000000 --- a/Build/Tools/StateMachineEditor/src/javax/LICENSE-JRL.txt +++ /dev/null @@ -1,157 +0,0 @@ -JAVA RESEARCH LICENSE -Version 1.2 - -I. DEFINITIONS. - -"Licensee " means You and any other party that has entered into and has -in effect a version of this License. - -"Modifications" means any (a) change or addition to the Technology or -(b) new source or object code implementing any portion of the Technology. - -"Sun" means Sun Microsystems, Inc. and its successors and assignees. - -"Research Use" means research, evaluation, or development for the -purpose of advancing knowledge, teaching, learning, or customizing the -Technology or Modifications for personal use. Research Use expressly -excludes use or distribution for direct or indirect commercial -(including strategic) gain or advantage. - -"Technology" means the source code, object code and specifications of -the technology made available by Sun pursuant to this License. - -"Technology Site" means the website designated by Sun for accessing the -Technology. - -"You" means the individual executing this License or the legal entity or -entities represented by the individual executing this License. - -II. PURPOSE. - -Sun is licensing the Technology under this Java Research License (the -"License") to promote research, education, innovation, and development -using the Technology. - -COMMERCIAL USE AND DISTRIBUTION OF TECHNOLOGY AND MODIFICATIONS IS -PERMITTED ONLY UNDER THE JAVA DISTRIBUTION LICENSE OR A SUN COMMERCIAL -LICENSE AVAILABLE AT http://www.sun.com/software/communitysource. - -III. RESEARCH USE RIGHTS. - -A. License Grant. Subject to the conditions contained herein, Sun -grants to You a non-exclusive, non-transferable, worldwide, and -royalty-free license to do the following for Your Research Use only: - -1. Reproduce, create Modifications of, and use the Technology alone, or -with Modifications; - -2. Share source code of the Technology alone, or with Modifications, -with other Licensees; - -3. Distribute object code of the Technology, alone, or with -Modifications, to any third parties for Research Use only, under a -license of Your choice that is consistent with this License; and publish -papers and books discussing the Technology which may include relevant -excerpts that do not in the aggregate constitute a significant portion -of the Technology. - -B. Residual Rights. You may use any information in intangible form -that you remember after accessing the Technology, except when such use -violates Sun's copyrights or patent rights. - -C. No Implied Licenses. Other than the rights granted herein, Sun -retains all rights, title, and interest in Technology, and You retain -all rights, title, and interest in Your Modifications and associated -specifications, subject to the terms of this License. - -IV. INTELLECTUAL PROPERTY REQUIREMENTS - -As a condition to Your License, You agree to comply with the following -restrictions and responsibilities: - -A. Notices. You will not remove or alter any copyright or other -proprietary notices in any Technology that You distribute. The -statement, "Use and Distribution is subject to the Java Research License -available at http://java3d.dev.java.net/jrl.html," -must appear prominently in the source code and specifications of the -Technology and Your Modifications, and in the same file as all Your -copyright and other proprietary notices for object code. - -B. Licensee Exchanges. Any Technology and Modifications You receive -from any Licensee are governed by this License. - -V. GENERAL TERMS. - -A. Disclaimer Of Warranties. - -THE TECHNOLOGY IS PROVIDED "AS IS", WITHOUT WARRANTIES OF ANY KIND, -EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT -THE TECHNOLOGY IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR -PURPOSE, OR NON-INFRINGING OF THIRD PARTY RIGHTS. YOU AGREE THAT YOU -BEAR THE ENTIRE RISK IN CONNECTION WITH YOUR USE AND DISTRIBUTION OF ANY -AND ALL TECHNOLOGY UNDER THIS LICENSE. - -B. Infringement; Limitation Of Liability. - -1. If any portion of, or functionality implemented by, the Technology -becomes the subject of a claim or threatened claim of infringement -("Affected Materials"), Sun may, in its unrestricted discretion, suspend -Your rights to use and distribute the Affected Materials under this -License. Such suspension of rights will be effective immediately upon -Sun's posting of notice of suspension on the Technology Site. - -2. IN NO EVENT WILL SUN BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR -ARISING OUT OF THIS LICENSE (INCLUDING, WITHOUT LIMITATION, LOSS OF -PROFITS, USE, DATA, OR ECONOMIC ADVANTAGE OF ANY SORT), HOWEVER IT -ARISES AND ON ANY THEORY OF LIABILITY (including negligence), WHETHER OR -NOT SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. LIABILITY -UNDER THIS SECTION V.B.2 SHALL BE SO LIMITED AND EXCLUDED, -NOTWITHSTANDING FAILURE OF THE ESSENTIAL PURPOSE OF ANY REMEDY. - -C. Termination. - -1. You may terminate this License at any time by notifying Sun in writing. - -2. All Your rights will terminate under this License if You fail to -comply with any of its material terms or conditions and do not cure such -failure within thirty (30) days after becoming aware of such noncompliance. - -3. Upon termination, You must discontinue all uses and distribution of -the Technology, and all provisions of this Section V ("General Terms") -shall survive termination. - -D. Miscellaneous. - -1. Trademark. You agree to comply with Sun's Trademark & Logo Usage -Requirements, as modified from time to time, available at the Technology -Site. Except as expressly provided in this License, You are granted no -rights in or to any Sun trademarks now or hereafter used or licensed by Sun. - -2. Integration. This License represents the complete agreement of the -parties concerning the subject matter hereof. - -3. Severability. If any provision of this License is held -unenforceable, such provision shall be reformed to the extent necessary -to make it enforceable unless to do so would defeat the intent of the -parties, in which case, this License shall terminate. - -4. Governing Law. This License is governed by the laws of the United -States and the State of California, as applied to contracts entered into -and performed in California between California residents. In no event -shall this License be construed against the drafter. - -5. Export Control. As further described at http://www.sun.com/its, you -agree to comply with the U.S. export controls and trade laws of other -countries that apply to Technology and Modifications. - -READ ALL THE TERMS OF THIS LICENSE CAREFULLY BEFORE ACCEPTING. - -BY CLICKING ON THE YES BUTTON BELOW, YOU ARE ACCEPTING AND AGREEING TO -ABIDE BY THE TERMS AND CONDITIONS OF THIS LICENSE. YOU MUST BE AT LEAST -18 YEARS OF AGE AND OTHERWISE COMPETENT TO ENTER INTO CONTRACTS. - -IF YOU DO NOT MEET THESE CRITERIA, OR YOU DO NOT AGREE TO ANY OF THE -TERMS OF THIS LICENSE, CLICK ON THE NO BUTTON AND EXIT NOW. - -Java Research License 05/20/04 diff --git a/Build/Tools/StateMachineEditor/src/javax/LICENSE.txt b/Build/Tools/StateMachineEditor/src/javax/LICENSE.txt deleted file mode 100644 index 930cc774ba..0000000000 --- a/Build/Tools/StateMachineEditor/src/javax/LICENSE.txt +++ /dev/null @@ -1,9 +0,0 @@ -This software is licensed by Sun: - -i) for research use under terms of the Java Research License (JRL) as -specified in the LICENSE-JRL.txt file and on the web at -"http://java3d.dev.java.net/jrl.html"; or - -ii) for commercial use under the terms of the Java Distribution License -(JDL) as specified in the LICENSE-JDL.txt file and on the web at -"http://java3d.dev.java.net/jdl-java3d.pdf". diff --git a/Build/Tools/StateMachineEditor/src/javax/vecmath/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/javax/vecmath/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/javax/vecmath/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/javax/vecmath/ExceptionStrings.properties b/Build/Tools/StateMachineEditor/src/javax/vecmath/ExceptionStrings.properties deleted file mode 100644 index ca56746ce8..0000000000 --- a/Build/Tools/StateMachineEditor/src/javax/vecmath/ExceptionStrings.properties +++ /dev/null @@ -1,86 +0,0 @@ -Matrix3d0=Matrix3d setElement -Matrix3d1=Matrix3d getElement -Matrix3d2=Matrix3d getRow -Matrix3d4=Matrix3d getColumn -Matrix3d6=Matrix3d setRow -Matrix3d9=Matrix3d setColumn -Matrix3d12=cannot invert matrix -Matrix3d13=Logic error: imax < 0 -Matrix3f0=Matrix3f setElement -Matrix3f1=Matrix3d getRow -Matrix3f3=Matrix3d getColumn -Matrix3f5=Matrix3f getElement -Matrix3f6=Matrix3f setRow -Matrix3f9=Matrix3f setColumn -Matrix3f12=cannot invert matrix -Matrix3f13=Logic error: imax < 0 -Matrix4d0=Matrix4d setElement -Matrix4d1=Matrix4d getElement -Matrix4d2=Matrix4d getRow -Matrix4d3=Matrix4d getColumn -Matrix4d4=Matrix4d setRow -Matrix4d7=Matrix4d setColumn -Matrix4d10=cannot invert matrix -Matrix4d11=Logic error: imax < 0 -Matrix4f0=Matrix4f setElement -Matrix4f1=Matrix4f getElement -Matrix4f2=Matrix4f getRow -Matrix4f4=Matrix4f getColumn -Matrix4f6=Matrix4f setRow -Matrix4f9=Matrix4f setColumn -Matrix4f12=cannot invert matrix -Matrix4f13=Logic error: imax < 0 -GMatrix0=GMatrix.mul:array dimension mismatch -GMatrix1=GMatrix.mul(GMatrix, GMatrix) dimension mismatch -GMatrix2=GMatrix.mul(GVector, GVector): matrix does not have enough rows -GMatrix3=GMatrix.mul(GVector, GVector): matrix does not have enough columns -GMatrix4=GMatrix.add(GMatrix): row dimension mismatch -GMatrix5=GMatrix.add(GMatrix): column dimension mismatch -GMatrix6=GMatrix.add(GMatrix, GMatrix): row dimension mismatch -GMatrix7=GMatrix.add(GMatrix, GMatrix): column dimension mismatch -GMatrix8=GMatrix.add(GMatrix): input matrices dimensions do not match this matrix dimensions -GMatrix9=GMatrix.sub(GMatrix): row dimension mismatch -GMatrix10=GMatrix.sub(GMatrix, GMatrix): row dimension mismatch -GMatrix11=GMatrix.sub(GMatrix, GMatrix): column dimension mismatch -GMatrix12=GMatrix.sub(GMatrix, GMatrix): input matrix dimensions do not match dimensions for this matrix -GMatrix13=GMatrix.negate(GMatrix, GMatrix): input matrix dimensions do not match dimensions for this matrix -GMatrix14=GMatrix.mulTransposeBoth matrix dimension mismatch -GMatrix15=GMatrix.mulTransposeRight matrix dimension mismatch -GMatrix16=GMatrix.mulTransposeLeft matrix dimension mismatch -GMatrix17=GMatrix.transpose(GMatrix) mismatch in matrix dimensions -GMatrix18=GMatrix.SVD: dimension mismatch with V matrix -GMatrix19=cannot perform LU decomposition on a non square matrix -GMatrix20=row permutation must be same dimension as matrix -GMatrix21=cannot invert matrix -GMatrix22=cannot invert non square matrix -GMatrix24=Logic error: imax < 0 -GMatrix25=GMatrix.SVD: dimension mismatch with U matrix -GMatrix26=GMatrix.SVD: dimension mismatch with W matrix -GMatrix27=LU must have same dimensions as this matrix -GMatrix28=GMatrix.sub(GMatrix): column dimension mismatch -GVector0=GVector.normalize( GVector) input vector and this vector lengths not matched -GVector1=GVector.scale(double, GVector) input vector and this vector lengths not matched -GVector2=GVector.scaleAdd(GVector, GVector) input vector dimensions not matched -GVector3=GVector.scaleAdd(GVector, GVector) input vectors and this vector dimensions not matched -GVector4=GVector.add(GVector) input vectors and this vector dimensions not matched -GVector5=GVector.add(GVector, GVector) input vector dimensions not matched -GVector6=GVector.add(GVector, GVector) input vectors and this vector dimensions not matched -GVector7=GVector.sub(GVector) input vector and this vector dimensions not matched -GVector8=GVector.sub(GVector, GVector) input vector dimensions not matched -GVector9=GVector.sub(GMatrix, GVector) input vectors and this vector dimensions not matched -GVector10=GVector.mul(GMatrix, GVector) matrix and vector dimensions not matched -GVector11=GVector.mul(GMatrix, GVector) matrix this vector dimensions not matched -GVector12=GVector.mul(GVector, GMatrix) matrix and vector dimensions not matched -GVector13=GVector.mul(GVector, GMatrix) matrix this vector dimensions not matched -GVector14=GVector.dot(GVector) input vector and this vector have different sizes -GVector15=matrix dimensions are not compatible -GVector16=b vector does not match matrix dimension -GVector17=GVector.interpolate(GVector, GVector, float) input vectors have different lengths -GVector18=GVector.interpolate(GVector, GVector, float) input vectors and this vector have different lengths -GVector19=GVector.interpolate(GVector, float) input vector and this vector have different lengths -GVector20=GVector.interpolate(GVector, GVector, double) input vectors have different lengths -GVector21=GVector.interpolate(GVector, GVector, double) input vectors and this vector have different lengths -GVector22=GVector.interpolate(GVector, double) input vectors and this vector have different lengths -GVector23=matrix dimensions are not compatible -GVector24=permutation vector does not match matrix dimension -GVector25=LUDBackSolve non square matrix diff --git a/Build/Tools/StateMachineEditor/src/model/Action.java b/Build/Tools/StateMachineEditor/src/model/Action.java deleted file mode 100644 index 03f55709ac..0000000000 --- a/Build/Tools/StateMachineEditor/src/model/Action.java +++ /dev/null @@ -1,90 +0,0 @@ -package model; - -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; - -import org.jdom.Comment; -import org.jdom.Element; - -public class Action { - - private static final long serialVersionUID = 1; - - private Element action = null; - - /** - * @return the jDOM action element - */ - public Element getActionElement() { - return action; - } - - /** - * sets the jDOM element of this action - * @param action1 the jDOM element - */ - public void setActionElement(Element action1) { - action = action1; - } - - /** - * @return the id of this action - */ - public String getActionId() { - String action2 = action.getAttributeValue("ID"); - return action2; - } - - /** - * sets the id on this action - * @param id the new id - */ - public void setAction(String id) { - this.getActionElement().setAttribute("ID", id); - } - - /** - * @return all parameters the action element has as children - */ - public List getParameter() { - List paraList = action.getChildren(); - List allVectors = new ArrayList(); - for (int i = 0; i < paraList.size(); i++) { - Object paraEle1 = paraList.get(i); - if(!(paraEle1 instanceof Comment)) { - Element paraEle = (Element) paraEle1; - Vector para = new Vector(4); - para.add(0, paraEle.getAttributeValue("NAME")); - para.add(1, paraEle.getName()); - para.add(2, paraEle.getAttributeValue("VALUE")); - List comment = paraEle.getContent(); - para.add(3, ""); - for (int j = 0; j < comment.size(); j++) { - Object o = comment.get(j); - if (o instanceof Comment) { - Comment ele = (Comment) o; - para.add(3,ele.getText()); - } - } - allVectors.add(para); - } - } - return allVectors; - } - - /** - * @return the comment on this action - */ - public String getActionComment() { - List actionComment = action.getContent(); - for (int i = 0; i < actionComment.size(); i++) { - Object o = actionComment.get(i); - if (o instanceof Comment) { - Comment ele = (Comment) o; - return ele.getText(); - } - } - return ""; - } -} diff --git a/Build/Tools/StateMachineEditor/src/model/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/model/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/model/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/model/Connection.java b/Build/Tools/StateMachineEditor/src/model/Connection.java deleted file mode 100644 index a16469ca19..0000000000 --- a/Build/Tools/StateMachineEditor/src/model/Connection.java +++ /dev/null @@ -1,534 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.Graphics; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.ui.views.properties.IPropertyDescriptor; -import org.eclipse.ui.views.properties.PropertyDescriptor; -import org.eclipse.ui.views.properties.TextPropertyDescriptor; -import org.jdom.Comment; -import org.jdom.Element; - -import dom.DOMGetInstance; -import dom.ReadActionAndEventDOMTree; - -/** - * @author Daniel - */ -public class Connection extends ModelElement { - - private static IPropertyDescriptor[] descriptors; - - /** - * Used for indicating that a Connection with solid line style should be - * created. - * - * @see parts.StateMachinesEditPart#createEditPolicies() - */ - public static final Integer SOLID_CONNECTION = new Integer( - Graphics.LINE_SOLID); - - /** property id for changes on the connection comment. */ - public static final String COMMENT_PROP = "Connection.comment"; - - /** property id for changes on the connection name. */ - public static final String NAME_PROP = "Connection.name"; - - /** property id for changes on the connection event. */ - public static final String EVENT_PROP = "Connection.event"; - - /** property id for changes on the connection actions. */ - public static final String ACTION_PROP = "Connection.action"; - - /** Property ID to use when a connection is active in debug mode. */ - public static final String ACTIVE_PROP = "Connection.active"; - - /** Property ID to use when a connection is inactive in debug mode. */ - public static final String INACTIVE_PROP = "Connection.inactive"; - - /** Property ID to use when the EditPolicies should be deactivated in debug mode. */ - public static final String DEACTIVATE_POLICY_PROP = "Connection.deactivatePolicy"; - - /** Property ID to use when the EditPolicies should be deactivated in debug mode. */ - public static final String ACTIVATE_POLICY_PROP = "Connection.activatePolicy"; - - private static final long serialVersionUID = 1; - - /** True, if the connection is attached to its endpoints. */ - private boolean isConnected; - - private String action = new String(""); - - private String actionPropertyValue = new String(""); - - private String event = new String("event"); - - private String name = new String("name"); - - private String comment = new String(""); - - /** Connection's source endpoint. */ - private States source; - - /** Connection's target endpoint. */ - private States target; - - /** List with all jDOM action elements. */ - private List allActions = new ArrayList(); - - private Element transition1; - private Comment comment1; - private boolean hasComment = false; - - /** List with all action names. */ - private List actions = new ArrayList(); - - /* - * Initializes the property descriptors array. - * - * @see #getPropertyDescriptors() - * @see #getPropertyValue(Object) - * @see #setPropertyValue(Object, Object) - */ - static { - descriptors = new IPropertyDescriptor[] { - new TextPropertyDescriptor(COMMENT_PROP, "Comment"), - new TextPropertyDescriptor(NAME_PROP, "Transition name"), - new PropertyDescriptor(EVENT_PROP, "Event"), - new PropertyDescriptor(ACTION_PROP, "Action") - }; - ((PropertyDescriptor) descriptors[0]).setCategory("Comment"); - ((PropertyDescriptor) descriptors[1]).setCategory("Transition name"); - } - - - /** - * Create a connection between two distinct states. - * - * @param source - * a source endpoint for this connection (non null) - * @param target - * a target endpoint for this connection (non null) - * @param transition JDOMElement - */ - public Connection(States source, States target, Element transition) { - transition1 = transition; - List transContent = transition1.getContent(); - for (int i = 0; i < transContent.size(); i++) { - Object o = transContent.get(i); - if (o instanceof Comment) { - hasComment = true; - comment1 = (Comment) o; - this.setComment(comment1.getText()); - } - } - reconnect(source, target); - } - - /** - * Create a connection between two distinct states. - * - * @param transition JDOMElement - * @param parentState source state - * @param diagram parent StateMachinesDiagram - */ - public Connection(Element transition, States parentState, StateMachinesDiagram diagram) { - List actionList = transition.getChildren("action", transition.getNamespace()); - for (int i = 0; i < actionList.size(); i++) { - Element ele1 = (Element) actionList.get(i); - Action action = new Action(); - action.setActionElement(ele1); - allActions.add(action); - } - transition1 = transition; - List allStates = diagram.getChildren(); - for (int i = 0; i < allStates.size(); i++) { - States state = (States) allStates.get(i); - if (state.getStateId().equals(transition1.getAttributeValue("NEXT_STATE_ID"))) { - target = state; - break; - } - } - String action1 = ""; - ReadActionAndEventDOMTree actionTree = DOMGetInstance.getActionAndEventInstance(); - for (int k = 0; k < allActions.size(); k++) { - Action action = (Action) allActions.get(k); - String act = action.getActionId(); - actions.add(actionTree.getActionName(act)); - // Fill action value in Propertysheet - this.actionPropertyValue = this.actionPropertyValue + actionTree.getActionName(act); - if (k < allActions.size() - 1) { - this.actionPropertyValue = this.actionPropertyValue + "; "; - } - } - if (allActions.size() > 1) { - Action action = (Action) allActions.get(0); - String act = action.getActionId(); - action1 = "<" + actionTree.getActionName(act) + ">" + "\n" + "<...>"; - } - else if (allActions.size() == 1) { - Action action = (Action) allActions.get(0); - String act = action.getActionId(); - action1 = "<" + actionTree.getActionName(act) + ">"; - } - else action1 = ""; - this.setAction(action1); - this.setName(transition1.getAttributeValue("NAME")); - this.setEvent(transition1.getAttributeValue("EVENT_ID")); - List transComment = transition1.getContent(); - for (int i = 0; i < transComment.size(); i++) { - Object o = transComment.get(i); - if (o instanceof Comment) { - hasComment = true; - comment1 = (Comment) o; - this.setComment(comment1.getText()); - break; - } - } - reconnect(parentState, target); - - } - - /** - * Disconnect this connection from the states it is attached to. - */ - public void disconnect() { - if (isConnected) { - source.removeConnection(this, transition1); - target.removeConnection(this, transition1); - isConnected = false; - } - } - - /** - * Returns the descriptor for the properties - * - * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors() - */ - public IPropertyDescriptor[] getPropertyDescriptors() { - return descriptors; - } - - /** - * Returns the String for the Property Sheet - * - * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object) - */ - public Object getPropertyValue(Object id) { - if (id.equals(EVENT_PROP)) { - return event; - } - else if (id.equals(ACTION_PROP)) { - return actionPropertyValue; - } - else if (id.equals(NAME_PROP)) { - return name; - } - else if (id.equals(COMMENT_PROP)) { - return comment; - } - return super.getPropertyValue(id); - } - - /** - * Returns the source endpoint of this connection. - * - * @return a non-null States instance - */ - public States getSource() { - return source; - } - - /** - * Returns the target endpoint of this connection. - * - * @return a non-null States instance - */ - public States getTarget() { - return target; - } - - /** - * Reconnect this connection. The connection will reconnect with the states - * it was previously attached to. - */ - public void reconnect() { - if (source.equals(target)) { - source.addConnection(this, transition1); - transition1.setAttribute("NEXT_STATE_ID", target.getStateId()); - } - else { - source.addConnection(this, transition1); - target.addConnection(this, transition1); - transition1.setAttribute("NEXT_STATE_ID", target.getStateId()); - } - isConnected = true; - } - - - - /** - * Reconnect to a different source and/or target state. The connection will - * disconnect from its current attachments and reconnect to the new source - * and target. - * - * @param newSource - * a new source endpoint for this connection (non null) - * @param newTarget - * a new target endpoint for this connection (non null) - * @throws IllegalArgumentException - * if any of the paramers are null - */ - public void reconnect(States newSource, States newTarget) { - if (newSource == null || newTarget == null) { - throw new IllegalArgumentException(); - } - disconnect(); - this.source = newSource; - this.target = newTarget; - reconnect(); - } - - /** - * set the action of this connection - * @param newAction the new action - */ - public void setAction(String newAction) { - ReadActionAndEventDOMTree actionTree = DOMGetInstance.getActionAndEventInstance(); - action = newAction; - if (!(actionTree.getActionName(newAction) == null)) { - action = actionTree.getActionName(newAction); - } - firePropertyChange(ACTION_PROP, null, action); - } - - /** - * set the event of this connection - * @param newEvent the new event - */ - public void setEvent(String newEvent) { - ReadActionAndEventDOMTree eventTree = DOMGetInstance.getActionAndEventInstance(); - event = newEvent; - if ((eventTree.getEventId(newEvent) == null)) { - transition1.setAttribute("EVENT_ID", newEvent); - } - else { - transition1.setAttribute("EVENT_ID", eventTree.getEventId(newEvent)); - } - if (!(eventTree.getEventName(newEvent) == null)) { - event = eventTree.getEventName(newEvent); - } - firePropertyChange(EVENT_PROP, null, event); - } - - /** - * Set the backgroundcolor of this connection to orange - * if it is the active state in debug mode. - */ - public void setActive() { - firePropertyChange(ACTIVE_PROP, null, null); - } - - /** - * Set the backgroundcolor of this connection to its normal color - * if it is not the active state in debug mode anymore. - */ - public void setInactive() { - firePropertyChange(INACTIVE_PROP, null, null); - } - - /** - * Deactivates the editpolicies for remove connections. - */ - public void deactivatePolicy() { - for (int i = 0; i < descriptors.length; i++) { - ((PropertyDescriptor) descriptors[i]).setValidator(new ICellEditorValidator() - { - public String isValid(Object value) { - return "no changes possible during debug mode"; - } - }); - } - firePropertyChange(DEACTIVATE_POLICY_PROP, null, null); - } - - /** - * Reactivates the editpolicies for remove connections. - */ - public void activatePolicy() { - for (int i = 0; i < descriptors.length; i++) { - ((PropertyDescriptor) descriptors[i]).setValidator(null); - } - firePropertyChange(ACTIVATE_POLICY_PROP, null, null); - } - - /** - * set the name of this connection - * @param newName the new name - */ - public void setName(String newName) { - name = newName; - transition1.setAttribute("NAME", newName); - firePropertyChange(NAME_PROP, null, name); - } - - /** - * set the comment of this connection - * @param newComment the new comment - */ - public void setComment(String newComment) { - comment = newComment; - if (!(comment.equals("") && !(comment == null))) { - if (!(hasComment)) { - hasComment = true; - comment1 = new Comment(""); - transition1.addContent(0, comment1); - } - comment1.setText(comment); - } - else if (hasComment) { - hasComment = false; - transition1.removeContent(comment1); - } - firePropertyChange(COMMENT_PROP, null, comment); - } - - /** - * set the id of the target connection - * @param id the id of the target connection - */ - public void setNextStateID(String id) { - transition1.setAttribute("NEXT_STATE_ID", id); - } - - /** - * Sets the properties based on the String provided by the PropertySheet - * - * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, - * java.lang.Object) - */ - public void setPropertyValue(Object id, Object value) { - if (id.equals(EVENT_PROP)) { - String eventName = (String) value; - setEvent(eventName); - } - else if (id.equals(ACTION_PROP)) { - String actionName = (String) value; - setAction("<" + actionName + ">"); - } - else if (id.equals(NAME_PROP)) { - String newName = (String) value; - setName(newName); - } - else if (id.equals(COMMENT_PROP)) { - String newComment = (String) value; - setComment(newComment); - } - else - super.setPropertyValue(id, value); - } - - /** - * @return the action name - */ - public String getAction() { - return action; - } - - /** - * @return the event name - */ - public String getEvent() { - return event; - } - - /** - * @return the connection name - */ - public String getName() { - return name; - } - - /** - * @return the connection comment - */ - public String getComment() { - return comment; - } - - /** - * @return a list with all action names - */ - public List getActionList() { - return actions; - } - - /** - * @return a list with all action elements - */ - public List getAllActions() { - return allActions; - } - - /** - * @return this connection element - */ - public Element getElement() { - return transition1; - } - - /** - * adds an action to this connection - * @param act the action element - * @param act1 the action name - */ - public void addAction(Action act, String act1) { - ReadActionAndEventDOMTree actionTree = DOMGetInstance.getActionAndEventInstance(); - if (allActions.size() == 0) { - this.setAction("<" + actionTree.getActionName(act1) + ">"); - this.actionPropertyValue = actionTree.getActionName(act1); - } - else if (allActions.size() == 1) { - this.setAction(this.getAction() + "\n" + "<...>"); - this.actionPropertyValue = actionPropertyValue + "; " + actionTree.getActionName(act1); - } - else { - this.actionPropertyValue = actionPropertyValue + "; " + actionTree.getActionName(act1); - } - allActions.add(act); - actions.add(actionTree.getActionName(act1)); - transition1.addContent(act.getActionElement()); - } - - /** - * removes an action from this connection - * @param act the action element - * @param act1 the action name - */ - public void removeAction(Action act, String act1) { - ReadActionAndEventDOMTree actionTree = DOMGetInstance.getActionAndEventInstance(); - allActions.remove(act); - actions.remove(actionTree.getActionName(act1)); - if (actions.size() == 0) { - this.setAction(""); - this.actionPropertyValue = ""; - } - else if (actions.size() == 1) { - this.setAction("<" + actions.get(0).toString() + ">"); - this.actionPropertyValue = actions.get(0).toString(); - } - else { - this.setAction("<" + actions.get(0).toString() + ">" + "\n" + "<...>"); - this.actionPropertyValue = actions.get(0).toString(); - for (int i = 1; i < allActions.size(); i++) { - this.actionPropertyValue = this.actionPropertyValue + "; " + actions.get(i).toString(); - } - } - transition1.removeContent(act.getActionElement()); - } -} diff --git a/Build/Tools/StateMachineEditor/src/model/EndState.java b/Build/Tools/StateMachineEditor/src/model/EndState.java deleted file mode 100644 index 95caf99359..0000000000 --- a/Build/Tools/StateMachineEditor/src/model/EndState.java +++ /dev/null @@ -1,132 +0,0 @@ -package model; - -import java.util.List; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.swt.graphics.Image; -import org.jdom.Attribute; -import org.jdom.Comment; -import org.jdom.Element; - -/** - * @author Daniel - */ -public class EndState extends States { - /** A 16x16 pictogram of a end state. */ - private static final Image RECTANGLE_ICON = createImage("rectangle16.gif"); - - private static final long serialVersionUID = 1; - - private Element state = new Element("state"); - private Comment comment = null; - private boolean hasComment = false; - private StateMachinesDiagram parent = null; - - /* (non-Javadoc) - * @see model.States#getIcon() - */ - public Image getIcon() { - return RECTANGLE_ICON; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - return "Endstate " + getStateName() + " ID " + getStateId(); - } - - /** - * sets the "END_STATE" attribute value of this state in the jDOM element to true - */ - public void setEndState() { - state.setAttribute("END_STATE", "TRUE"); - } - - /* (non-Javadoc) - * @see model.States#getStateElement() - */ - public Element getStateElement() { - return state; - } - - /* (non-Javadoc) - * @see model.States#getStateComment() - */ - public Comment getStateComment() { - if (comment == null || !hasComment) { - comment = new Comment(""); - state.addContent(0, comment); - hasComment = true; - } - return comment; - } - - /* (non-Javadoc) - * @see model.States#removeStateComment() - */ - public void removeStateComment() { - if (!(comment == null)) { - state.removeContent(comment); - comment = null; - hasComment = false; - } - } - - /* (non-Javadoc) - * @see model.States#setStateElement(org.jdom.Element) - */ - public void setStateElement(Element state1) { - state = state1; - Point location = new Point(0,0); - Dimension size = new Dimension(100, 50); - List attributes = state1.getAttributes(); - for (int i = 0; i < attributes.size(); i++) { - Attribute attr = (Attribute) attributes.get(i); - if (attr.getName().equals("NAME")) { - this.setStateName(state1.getAttributeValue("NAME")); - } - if (attr.getName().equals("ID")) { - this.setStateId(state1.getAttributeValue("ID")); - } - if (attr.getName().equals("X_POS")) { - location.x = Integer.parseInt(state1.getAttributeValue("X_POS")); - } - if (attr.getName().equals("Y_POS")) { - location.y = Integer.parseInt(state1.getAttributeValue("Y_POS")); - } - if (attr.getName().equals("HEIGHT")) { - size.height = Integer.parseInt(state1.getAttributeValue("HEIGHT")); - } - if (attr.getName().equals("WIDTH")) { - size.width = Integer.parseInt(state1.getAttributeValue("WIDTH")); - } - } - this.setLocation(location); - this.setSize(size); - List stateComment = state.getContent(); - for (int i = 0; i < stateComment.size(); i++) { - Object o = stateComment.get(i); - if (o instanceof Comment) { - hasComment = true; - comment = (Comment) o; - this.setComment(comment.getText()); - } - } - } - - /* (non-Javadoc) - * @see model.States#getParent() - */ - public StateMachinesDiagram getParent() { - return parent; - } - - /* (non-Javadoc) - * @see model.States#setParent(model.StateMachinesDiagram) - */ - public void setParent(StateMachinesDiagram parent) { - this.parent = parent; - } -} diff --git a/Build/Tools/StateMachineEditor/src/model/ModelElement.java b/Build/Tools/StateMachineEditor/src/model/ModelElement.java deleted file mode 100644 index 620498c6ae..0000000000 --- a/Build/Tools/StateMachineEditor/src/model/ModelElement.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package model; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - -import org.eclipse.ui.views.properties.IPropertyDescriptor; -import org.eclipse.ui.views.properties.IPropertySource; - -/** - * @author Daniel - */ -public abstract class ModelElement implements IPropertySource, Serializable { - /** An empty property descriptor. */ - private static final IPropertyDescriptor[] EMPTY_ARRAY = new IPropertyDescriptor[0]; - - private static final long serialVersionUID = 1; - - /** Delegate used to implemenent property-change-support. */ - private transient PropertyChangeSupport pcsDelegate = new PropertyChangeSupport( - this); - - /** - * Attach a non-null PropertyChangeListener to this object. - * - * @param l - * a non-null PropertyChangeListener instance - * @throws IllegalArgumentException - * if the parameter is null - */ - public synchronized void addPropertyChangeListener(PropertyChangeListener l) { - if (l == null) { - throw new IllegalArgumentException(); - } - pcsDelegate.addPropertyChangeListener(l); - } - - /** - * Report a property change to registered listeners (for example edit - * parts). - * - * @param property - * the programmatic name of the property that changed - * @param oldValue - * the old value of this property - * @param newValue - * the new value of this property - */ - protected void firePropertyChange(String property, Object oldValue, - Object newValue) { - if (pcsDelegate.hasListeners(property)) { - pcsDelegate.firePropertyChange(property, oldValue, newValue); - } - } - - /** - * Returns a value for this property source that can be edited in a property - * sheet. - *- * My personal rule of thumb: - *
- *- * Override only if necessary. - *
- * - * @return this instance - */ - public Object getEditableValue() { - return this; - } - - /** - * Children should override this. The default implementation returns an - * empty array. - */ - public IPropertyDescriptor[] getPropertyDescriptors() { - return EMPTY_ARRAY; - } - - /** - * Children should override this. The default implementation returns null. - */ - public Object getPropertyValue(Object id) { - return null; - } - - /** - * Children should override this. The default implementation returns false. - */ - public boolean isPropertySet(Object id) { - return false; - } - - /** - * Deserialization constructor. Initializes transient fields. - * - * @see java.io.Serializable - */ - private void readObject(ObjectInputStream in) throws IOException, - ClassNotFoundException { - in.defaultReadObject(); - pcsDelegate = new PropertyChangeSupport(this); - } - - /** - * Remove a PropertyChangeListener from this component. - * - * @param l - * a PropertyChangeListener instance - */ - public synchronized void removePropertyChangeListener( - PropertyChangeListener l) { - if (l != null) { - pcsDelegate.removePropertyChangeListener(l); - } - } - - /** - * Children should override this. The default implementation does nothing. - */ - public void resetPropertyValue(Object id) { - // do nothing - } - - /** - * Children should override this. The default implementation does nothing. - */ - public void setPropertyValue(Object id, Object value) { - // do nothing - } -} diff --git a/Build/Tools/StateMachineEditor/src/model/NormalState.java b/Build/Tools/StateMachineEditor/src/model/NormalState.java deleted file mode 100644 index 0f708ffdb5..0000000000 --- a/Build/Tools/StateMachineEditor/src/model/NormalState.java +++ /dev/null @@ -1,126 +0,0 @@ -package model; - -import java.util.List; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.swt.graphics.Image; -import org.jdom.Attribute; -import org.jdom.Comment; -import org.jdom.Element; - -/** - * @author Daniel - */ -public class NormalState extends States { - /** A 16x16 pictogram of a normal state. */ - private static final Image RECTANGLE_ICON = createImage("rectangle16.gif"); - - private static final long serialVersionUID = 1; - - private Element state = new Element("state"); - private Comment comment = null; - private boolean hasComment = false; - private StateMachinesDiagram parent = null; - - /* (non-Javadoc) - * @see model.States#getIcon() - */ - public Image getIcon() { - return RECTANGLE_ICON; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - return "Normalstate " + getStateName() + " ID " + getStateId(); - } - - /* (non-Javadoc) - * @see model.States#getStateElement() - */ - public Element getStateElement() { - return state; - } - - /* (non-Javadoc) - * @see model.States#getStateComment() - */ - public Comment getStateComment() { - if (comment == null || !hasComment) { - comment = new Comment(""); - state.addContent(0, comment); - hasComment = true; - } - return comment; - } - - /* (non-Javadoc) - * @see model.States#removeStateComment() - */ - public void removeStateComment() { - if (!(comment == null)) { - state.removeContent(comment); - comment = null; - hasComment = false; - } - } - - /* (non-Javadoc) - * @see model.States#setStateElement(org.jdom.Element) - */ - public void setStateElement(Element state1) { - state = state1; - Point location = new Point(0,0); - Dimension size = new Dimension(100, 50); - List attributes = state1.getAttributes(); - for (int i = 0; i < attributes.size(); i++) { - Attribute attr = (Attribute) attributes.get(i); - if (attr.getName().equals("NAME")) { - this.setStateName(state1.getAttributeValue("NAME")); - } - if (attr.getName().equals("ID")) { - this.setStateId(state1.getAttributeValue("ID")); - } - if (attr.getName().equals("X_POS")) { - location.x = Integer.parseInt(state1.getAttributeValue("X_POS")); - } - if (attr.getName().equals("Y_POS")) { - location.y = Integer.parseInt(state1.getAttributeValue("Y_POS")); - } - if (attr.getName().equals("HEIGHT")) { - size.height = Integer.parseInt(state1.getAttributeValue("HEIGHT")); - } - if (attr.getName().equals("WIDTH")) { - size.width = Integer.parseInt(state1.getAttributeValue("WIDTH")); - } - } - this.setLocation(location); - this.setSize(size); - List stateComment = state.getContent(); - for (int i = 0; i < stateComment.size(); i++) { - Object o = stateComment.get(i); - if (o instanceof Comment) { - hasComment = true; - comment = (Comment) o; - this.setComment(comment.getText()); - } - } - } - - /* (non-Javadoc) - * @see model.States#getParent() - */ - public StateMachinesDiagram getParent() { - return parent; - } - - /* (non-Javadoc) - * @see model.States#setParent(model.StateMachinesDiagram) - */ - public void setParent(StateMachinesDiagram parent) { - this.parent = parent; - } -} - diff --git a/Build/Tools/StateMachineEditor/src/model/RoundLabel.java b/Build/Tools/StateMachineEditor/src/model/RoundLabel.java deleted file mode 100644 index e1acede2df..0000000000 --- a/Build/Tools/StateMachineEditor/src/model/RoundLabel.java +++ /dev/null @@ -1,643 +0,0 @@ -package model; - -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.FigureUtilities; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Insets; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; - -/** - * A figure that can display text and/or an image. - */ -public class RoundLabel extends Figure implements PositionConstants { - - private static String ELLIPSIS = "..."; //$NON-NLS-1$ - - - private Image icon; - private String text = "";//$NON-NLS-1$ - private String subStringText; - private Dimension textSize; - private Dimension subStringTextSize; - private Dimension iconSize = new Dimension(0, 0); - private Point iconLocation; - private Point textLocation; - private int textAlignment = CENTER; - private int iconAlignment = CENTER; - private int labelAlignment = CENTER; - private int textPlacement = EAST; - private int iconTextGap = 3; - - /** - * Construct an empty Label. - * - * @since 2.0 - */ - public RoundLabel() { } - - /** - * Construct a Label with passed String as its text. - * - * @param s the label text - * @since 2.0 - */ - public RoundLabel(String s) { - setText(s); - } - - /** - * Construct a Label with passed Image as its icon. - * - * @param i the label image - * @since 2.0 - */ - public RoundLabel(Image i) { - setIcon(i); - } - - /** - * Construct a Label with passed String as text and passed Image as its icon. - * - * @param s the label text - * @param i the label image - * @since 2.0 - */ - public RoundLabel(String s, Image i) { - setText(s); - setIcon(i); - } - - private void alignOnHeight(Point loc, Dimension size, int alignment) { - Insets insets = getInsets(); - switch(alignment) { - case TOP: - loc.y = insets.top; - break; - case BOTTOM: - loc.y = bounds.height - size.height - insets.bottom; - break; - default: - loc.y = (bounds.height - size.height) / 2; - } - } - - private void alignOnWidth(Point loc, Dimension size, int alignment) { - Insets insets = getInsets(); - switch(alignment) { - case LEFT: - loc.x = insets.left; - break; - case RIGHT: - loc.x = bounds.width - size.width - insets.right; - break; - default: - loc.x = (bounds.width - size.width) / 2; - } - } - - private void calculateAlignment() { - switch(textPlacement) { - case EAST: - case WEST: - alignOnHeight(textLocation, getTextSize(), textAlignment); - alignOnHeight(iconLocation, iconSize, iconAlignment); - break; - case NORTH: - case SOUTH: - alignOnWidth(textLocation, getSubStringTextSize(), textAlignment); - alignOnWidth(iconLocation, iconSize, iconAlignment); - break; - } - } - - /** - * Calculates the size of the Label using the passed Dimension as the size of the Label's - * text. - * - * @param txtSize the precalculated size of the label's text - * @return the label's size - * @since 2.0 - */ - protected Dimension calculateLabelSize(Dimension txtSize) { - int gap = iconTextGap; - if (getIcon() == null || getText().equals("")) //$NON-NLS-1$ - gap = 0; - Dimension d = new Dimension(0, 0); - if (textPlacement == WEST || textPlacement == EAST) { - d.width = iconSize.width + gap + txtSize.width; - d.height = Math.max(iconSize.height, txtSize.height); - } else { - d.width = Math.max(iconSize.width, txtSize.width); - d.height = iconSize.height + gap + txtSize.height; - } - return d; - } - - private void calculateLocations() { - textLocation = new Point(); - iconLocation = new Point(); - - calculatePlacement(); - calculateAlignment(); - Dimension offset = getSize().getDifference(getPreferredSize()); - offset.width += getTextSize().width - getSubStringTextSize().width; - switch (labelAlignment) { - case CENTER: - offset.scale(0.5f); - break; - case LEFT: - offset.scale(0.0f); - break; - case RIGHT: - offset.scale(1.0f); - break; - case TOP: - offset.height = 0; - offset.scale(0.5f); - break; - case BOTTOM: - offset.height = offset.height * 2; - offset.scale(0.5f); - break; - default: - offset.scale(0.5f); - break; - } - - switch (textPlacement) { - case EAST: - case WEST: - offset.height = 0; - break; - case NORTH: - case SOUTH: - offset.width = 0; - break; - } - - textLocation.translate(offset); - iconLocation.translate(offset); - } - - private void calculatePlacement() { - int gap = iconTextGap; - if (icon == null || text.equals("")) //$NON-NLS-1$ - gap = 0; - Insets insets = getInsets(); - - switch(textPlacement) { - case EAST: - iconLocation.x = insets.left; - textLocation.x = iconSize.width + gap + insets.left; - break; - case WEST: - textLocation.x = insets.left; - iconLocation.x = getSubStringTextSize().width + gap + insets.left; - break; - case NORTH: - textLocation.y = insets.top; - iconLocation.y = getTextSize().height + gap + insets.top; - break; - case SOUTH: - textLocation.y = iconSize.height + gap + insets.top; - iconLocation.y = insets.top; - } - } - - /** - * Calculates the size of the Label's text size. The text size calculated takes into - * consideration if the Label's text is currently truncated. If text size without - * considering current truncation is desired, use {@link #calculateTextSize()}. - * - * @return the size of the label's text, taking into account truncation - * @since 2.0 - */ - protected Dimension calculateSubStringTextSize() { - return FigureUtilities.getTextExtents(getSubStringText(), getFont()); - } - - /** - * Calculates and returns the size of the Label's text. Note that this Dimension is - * calculated using the Label's full text, regardless of whether or not its text is - * currently truncated. If text size considering current truncation is desired, use - * {@link #calculateSubStringTextSize()}. - * - * @return the size of the label's text, ignoring truncation - * @since 2.0 - */ - protected Dimension calculateTextSize() { - return FigureUtilities.getTextExtents(getText(), getFont()); - } - - private void clearLocations() { - iconLocation = textLocation = null; - } - - /** - * Returns the Label's icon. - * - * @return the label icon - * @since 2.0 - */ - public Image getIcon() { - return icon; - } - - /** - * Returns the current alignment of the Label's icon. The default is - * {@link PositionConstants#CENTER}. - * - * @return the icon alignment - * @since 2.0 - */ - public int getIconAlignment() { - return iconAlignment; - } - - /** - * Returns the bounds of the Label's icon. - * - * @return the icon's bounds - * @since 2.0 - */ - public Rectangle getIconBounds() { - Rectangle bounds = getBounds(); - return new Rectangle(bounds.getLocation().translate(getIconLocation()), iconSize); - } - - /** - * Returns the location of the Label's icon relative to the Label. - * - * @return the icon's location - * @since 2.0 - */ - protected Point getIconLocation() { - if (iconLocation == null) - calculateLocations(); - return iconLocation; - } - - /** - * Returns the gap in pixels between the Label's icon and its text. - * - * @return the gap - * @since 2.0 - */ - public int getIconTextGap() { - return iconTextGap; - } - - /** - * @see IFigure#getMinimumSize(int, int) - */ - public Dimension getMinimumSize(int w, int h) { - if (minSize != null) - return minSize; - minSize = new Dimension(); - if (getLayoutManager() != null) - minSize.setSize(getLayoutManager().getMinimumSize(this, w, h)); - - Dimension labelSize = - calculateLabelSize(FigureUtilities.getTextExtents(ELLIPSIS, getFont()) - .intersect(FigureUtilities.getTextExtents(getText(), getFont()))); - Insets insets = getInsets(); - labelSize.expand(insets.getWidth(), insets.getHeight()); - minSize.union(labelSize); - return minSize; - } - - /** - * @see IFigure#getPreferredSize(int, int) - */ - public Dimension getPreferredSize(int wHint, int hHint) { - if (prefSize == null) { - prefSize = calculateLabelSize(getTextSize()); - Insets insets = getInsets(); - prefSize.expand(insets.getWidth(), insets.getHeight()); - if (getLayoutManager() != null) - prefSize.union(getLayoutManager().getPreferredSize(this, wHint, hHint)); - } - if (wHint >= 0 && wHint < prefSize.width) { - Dimension minSize = getMinimumSize(wHint, hHint); - Dimension result = prefSize.getCopy(); - result.width = Math.min(result.width, wHint); - result.width = Math.max(minSize.width, result.width); - return result; - } - return prefSize; - } - - /** - * Calculates the amount of the Label's current text will fit in the Label, including an - * elipsis "..." if truncation is required. - * - * @return the substring - * @since 2.0 - */ - public String getSubStringText() { - if (subStringText != null) - return subStringText; - - subStringText = text; - int widthShrink = getPreferredSize().width - getSize().width; - if (widthShrink <= 0) - return subStringText; - - Dimension effectiveSize = getTextSize().getExpanded(-widthShrink, 0); - Font currentFont = getFont(); - int dotsWidth = FigureUtilities.getTextWidth(ELLIPSIS, currentFont); - - if (effectiveSize.width < dotsWidth) - effectiveSize.width = dotsWidth; - - //int subStringLength = FigureUtilities.getLargestSubstringConfinedTo(text, - // currentFont, - // effectiveSize.width - dotsWidth); - //subStringText = new String(text.substring(0, subStringLength) + ELLIPSIS); - return subStringText; - } - - /** - * Returns the size of the Label's current text. If the text is currently truncated, the - * truncated text with its ellipsis is used to calculate the size. - * - * @return the size of this label's text, taking into account truncation - * @since 2.0 - */ - protected Dimension getSubStringTextSize() { - if (subStringTextSize == null) - subStringTextSize = calculateSubStringTextSize(); - return subStringTextSize; - } - - /** - * Returns the text of the label. Note that this is the complete text of the label, - * regardless of whether it is currently being truncated. Call {@link #getSubStringText()} - * to return the label's current text contents with truncation considered. - * - * @return the complete text of this label - * @since 2.0 - */ - public String getText() { - return text; - } - - /** - * Returns the current alignment of the Label's text. The default text alignment is - * {@link PositionConstants#CENTER}. - * - * @return the text alignment - */ - public int getTextAlignment() { - return textAlignment; - } - - /** - * Returns the bounds of the label's text. Note that the bounds are calculated using the - * label's complete text regardless of whether the label's text is currently truncated. - * - * @return the bounds of this label's complete text - * @since 2.0 - */ - public Rectangle getTextBounds() { - Rectangle bounds = getBounds(); - return new Rectangle(bounds.getLocation().translate(getTextLocation()), textSize); - } - - /** - * Returns the location of the label's text relative to the label. - * - * @return the text location - * @since 2.0 - */ - protected Point getTextLocation() { - if (textLocation != null) - return textLocation; - calculateLocations(); - return textLocation; - } - - /** - * Returns the current placement of the label's text relative to its icon. The default - * text placement is {@link PositionConstants#EAST}. - * - * @return the text placement - * @since 2.0 - */ - public int getTextPlacement() { - return textPlacement; - } - - /** - * Returns the size of the label's complete text. Note that the text used to make this - * calculation is the label's full text, regardless of whether the label's text is - * currently being truncated and is displaying an ellipsis. If the size considering - * current truncation is desired, call {@link #getSubStringTextSize()}. - * - * @return the size of this label's complete text - * @since 2.0 - */ - protected Dimension getTextSize() { - if (textSize == null) - textSize = calculateTextSize(); - return textSize; - } - - /** - * @see IFigure#invalidate() - */ - public void invalidate() { - prefSize = null; - minSize = null; - clearLocations(); - textSize = null; - subStringTextSize = null; - subStringText = null; - super.invalidate(); - } - - /** - * Returnstrue
if the label's text is currently truncated and is displaying
- * an ellipsis, false
otherwise.
- *
- * @return true
if the label's text is truncated
- * @since 2.0
- */
- public boolean isTextTruncated() {
- return !getSubStringText().equals(getText());
- }
-
- /**
- * @see Figure#paintFigure(Graphics)
- */
- protected void paintFigure(Graphics graphics) {
- if (isOpaque())
- graphics.fillRoundRectangle(bounds, bounds.width/6, bounds.height/4);
- graphics.translate(bounds.x, bounds.y);
- if (icon != null)
- graphics.drawImage(icon, getIconLocation());
- if (!isEnabled()) {
- graphics.translate(1, 1);
- graphics.setForegroundColor(ColorConstants.buttonLightest);
- graphics.drawText(getSubStringText(), getTextLocation());
- graphics.translate(-1, -1);
- graphics.setForegroundColor(ColorConstants.buttonDarker);
- }
- graphics.drawText(getSubStringText(), getTextLocation());
- graphics.translate(-bounds.x, -bounds.y);
-
- }
-
- /**
- * Sets the label's icon to the passed image.
- *
- * @param image the new label image
- * @since 2.0
- */
- public void setIcon(Image image) {
- if (icon == image)
- return;
- icon = image;
- //Call repaint, in case the image dimensions are the same.
- repaint();
- if (icon == null)
- setIconDimension(new Dimension());
- else
- setIconDimension(new Dimension(image));
- }
-
- /**
- * This method sets the alignment of the icon within the icon dimension. The dimension
- * should be the same size as the Image itself, so calling this method should have no
- * affect.
- * @deprecated The icons should be displayed at 1:1
- * @param align the icon alignment
- * @since 2.0
- */
- public void setIconAlignment (int align) {
- if (iconAlignment == align)
- return;
- iconAlignment = align;
- clearLocations();
- repaint();
- }
-
- /**
- * Sets the label's icon size to the passed Dimension.
- *
- * @param d the new icon size
- * @deprecated the icon is automatically displayed at 1:1
- * @since 2.0
- */
- public void setIconDimension(Dimension d) {
- if (d.equals(iconSize))
- return;
- iconSize = d;
- revalidate();
- }
-
- /**
- * Sets the gap in pixels between the label's icon and text to the passed value. The
- * default is 4.
- *
- * @param gap the gap
- * @since 2.0
- */
- public void setIconTextGap(int gap) {
- if (iconTextGap == gap)
- return;
- iconTextGap = gap;
- repaint();
- revalidate();
- }
-
- /**
- * Sets the alignment of the entire label (icon and text). If this figure's bounds
- * are larger than the size needed to display the label, the label will be aligned
- * accordingly. Valid values are:
- * - * The returned array is used to fill the property dialog, when the edit-part - * corresponding to this model element is selected. - *
- * - * @see #descriptors - * @see #getPropertyValue(Object) - * @see #setPropertyValue(Object, Object) - */ - public IPropertyDescriptor[] getPropertyDescriptors() { - return descriptors; - } - - /** - * Return the property value for the given propertyId, or null. - *- * The property dialog uses the IDs from the IPropertyDescriptors array to - * obtain the value of the corresponding properties. - *
- * - * @see #descriptors - * @see #getPropertyDescriptors() - */ - public Object getPropertyValue(Object propertyId) { - if (XPOS_PROP.equals(propertyId)) { - return Integer.toString(location.x); - } - if (YPOS_PROP.equals(propertyId)) { - return Integer.toString(location.y); - } - if (HEIGHT_PROP.equals(propertyId)) { - return Integer.toString(size.height); - } - if (WIDTH_PROP.equals(propertyId)) { - return Integer.toString(size.width); - } - if (STATE_NAME_PROP.equals(propertyId)) { - return stateName; - } - if (COMMENT_PROP.equals(propertyId)) { - return commentText; - } - if (STATE_ID_PROP.equals(propertyId)) { - return stateId; - } - return super.getPropertyValue(propertyId); - } - - /** - * Return the Size of this state. - * - * @return a non-null Dimension instance - */ - public Dimension getSize() { - return size.getCopy(); - } - - public String getStateName() { - return stateName; - } - - public String getComment() { - return commentText; - } - - public String getStateId() { - return stateId; - } - - /** - * Return a List of outgoing Connections. - */ - public List getSourceConnections() { - return new ArrayList(sourceConnections); - } - - /** - * Return a List of incoming Connections. - */ - public List getTargetConnections() { - return new ArrayList(targetConnections); - } - - /** - * @return all jDOM elements of type transition - */ - public List getAllTransitions() { - List allTransitions = this.getStateElement().getChildren("transition", this.getStateElement().getNamespace()); - return allTransitions; - } - - /** - * Remove an incoming or outgoing connection from this state. - * - * @param conn - * a non-null connection instance - * @throws IllegalArgumentException - * if the parameter is null - */ - void removeConnection(Connection conn, Element transition) { - if (conn == null) { - throw new IllegalArgumentException(); - } - if (conn.getSource() == this) { - sourceConnections.remove(conn); - if (!(transition.getParent() == null)) { - this.getStateElement().removeContent(transition); - } - firePropertyChange(SOURCE_CONNECTIONS_PROP, null, conn); - } - if (conn.getTarget() == this) { - targetConnections.remove(conn); - firePropertyChange(TARGET_CONNECTIONS_PROP, null, conn); - } - } - - /** - * Set the Location of this state. - * - * @param newLocation - * a non-null Point instance - * @throws IllegalArgumentException - * if the parameter is null - */ - public void setLocation(Point newLocation) { - if (newLocation == null) { - throw new IllegalArgumentException(); - } - Element state = getStateElement(); - location.setLocation(newLocation); - state.setAttribute("X_POS", Integer.toString(location.x)); - state.setAttribute("Y_POS", Integer.toString(location.y)); - firePropertyChange(LOCATION_PROP, null, location); - } - - /** - * Set the property value for the given property id. If no matching id is - * found, the call is forwarded to the superclass. - *- * The property dialog uses the IDs from the IPropertyDescriptors array to set - * the values of the corresponding properties. - *
- * - * @see #descriptors - * @see #getPropertyDescriptors() - */ - public void setPropertyValue(Object propertyId, Object value) { - //Element state = getStateElement(); - if (XPOS_PROP.equals(propertyId)) { - int x = Integer.parseInt((String) value); - setLocation(new Point(x, location.y)); - //state.setAttribute("X_POS", value.toString()); - } else if (YPOS_PROP.equals(propertyId)) { - int y = Integer.parseInt((String) value); - setLocation(new Point(location.x, y)); - //state.setAttribute("Y_POS", value.toString()); - } else if (HEIGHT_PROP.equals(propertyId)) { - int height = Integer.parseInt((String) value); - setSize(new Dimension(size.width, height)); - //state.setAttribute("HEIGHT", Integer.toString(height)); - } else if (WIDTH_PROP.equals(propertyId)) { - int width = Integer.parseInt((String) value); - setSize(new Dimension(width, size.height)); - //state.setAttribute("WIDTH", Integer.toString(width)); - } else if (STATE_NAME_PROP.equals(propertyId)) { - String name = (String) value; - setStateName(name); - //state.setAttribute("NAME", name); - } else if (COMMENT_PROP.equals(propertyId)) { - String commentText = (String) value; - setComment(commentText); - /*if (!(commentText.equals("")) && !(commentText == null)) { - Comment comment = getStateComment(); - comment.setText(commentText); - }*/ - } else if (STATE_ID_PROP.equals(propertyId)) { - String id = (String)value; - setStateId(id); - //state.setAttribute("ID", id); - List connToChange = this.getTargetConnections(); - for (int i = 0; i < connToChange.size(); i++) { - Connection conn1 = (Connection) connToChange.get(i); - conn1.setNextStateID(id); - } - } else { - super.setPropertyValue(propertyId, value); - } - } - - /** - * Set the Size of this state. Will not modify the size if newSize is null. - * - * @param newSize - * a non-null Dimension instance or null - */ - public void setSize(Dimension newSize) { - Element state = getStateElement(); - if (newSize != null) { - size.setSize(newSize); - state.setAttribute("WIDTH", Integer.toString(size.width)); - state.setAttribute("HEIGHT", Integer.toString(size.height)); - firePropertyChange(SIZE_PROP, null, size); - } - } - - /** - * Set the states name. - * - * @param newName the name that is displayed in the states label. - */ - public void setStateName(String newName) { - Element state = getStateElement(); - stateName = newName; - state.setAttribute("NAME", newName); - firePropertyChange(STATE_NAME_PROP, null, stateName); - } - - /** - * Set the backgroundcolor of this state to orange - * if it is the active state in debug mode. - */ - public void setActive() { - firePropertyChange(ACTIVE_PROP, null, null); - } - - /** - * Set the backgroundcolor of this state to its normal color - * if it is not the active state in debug mode anymore. - */ - public void setInactive() { - firePropertyChange(INACTIVE_PROP, null, null); - } - - /** - * Deactivates the editpolicies for remove states and create connections. - */ - public void deactivatePolicy() { - for (int i = 0; i < sourceConnections.size(); i++) { - Connection con = (Connection) sourceConnections.get(i); - con.deactivatePolicy(); - } - for (int i = 0; i < descriptors.length; i++) { - ((PropertyDescriptor) descriptors[i]).setValidator(new ICellEditorValidator() - { - public String isValid(Object value) { - return "no changes possible during debug mode"; - } - }); - } - firePropertyChange(DEACTIVATE_POLICY_PROP, null, null); - } - - /** - * Reactivates the editpolicies for remove states and create connections. - */ - public void activatePolicy() { - for (int i = 0; i < sourceConnections.size(); i++) { - Connection con = (Connection) sourceConnections.get(i); - con.activatePolicy(); - } - for (int i = 0; i < descriptors.length; i++) { - ((PropertyDescriptor) descriptors[i]).setValidator(null); - } - for (int i = 0; i < descriptors.length - 3; i++) { - ((PropertyDescriptor) descriptors[i]) - .setValidator(new ICellEditorValidator() { - public String isValid(Object value) { - int intValue = -1; - try { - intValue = Integer.parseInt((String) value); - } catch (NumberFormatException exc) { - return "Not a number"; - } - return (intValue >= 0) ? null - : "Value must be >= 0"; - } - }); - ((PropertyDescriptor) descriptors[descriptors.length - 3]) - .setValidator(new ICellEditorValidator() { - public String isValid(Object value) { - int intValue = -1; - try { - intValue = Integer.parseInt((String) value); - } catch (NumberFormatException exc) { - return "Not a number"; - } - IWorkbenchWindow ui = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - StateMachinesEditor activeEditor = (StateMachinesEditor) ui.getActivePage().getActiveEditor(); - if (activeEditor.getDiagram().containsStateID((String)value)) { - return "ID already in use"; - } - return (intValue >= 0) ? null - : "Value must be >= 0"; - } - }); - } - firePropertyChange(ACTIVATE_POLICY_PROP, null, null); - } - - /** - * Set the states comment. - * - * @param newComment the new comment for the state - */ - public void setComment(String newComment) { - if (!(newComment.equals("") && !(newComment == null))) { - Comment comment = getStateComment(); - commentText = newComment; - comment.setText(commentText); - } - else if (newComment.equals("") || newComment == null) { - commentText = newComment; - removeStateComment(); - } - firePropertyChange(COMMENT_PROP, null, commentText); - } - - /** - * Set the states id. - * - * @param newId the new id for the state - */ - public void setStateId(String newId) { - Element state = getStateElement(); - stateId = newId; - String oldID = state.getAttributeValue("ID"); - parent = this.getParent(); - if (this.getParent().containsStateID(oldID)) { - this.getParent().removeStateID(oldID); - } - this.getParent().addStateID(newId); - state.setAttribute("ID", newId); - firePropertyChange(STATE_ID_PROP, null, newId); - } -} diff --git a/Build/Tools/StateMachineEditor/src/parts/ActionAndEventEditPolicy.java b/Build/Tools/StateMachineEditor/src/parts/ActionAndEventEditPolicy.java deleted file mode 100644 index 4e52f885c6..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/ActionAndEventEditPolicy.java +++ /dev/null @@ -1,115 +0,0 @@ -package parts; - -import java.util.Map; - -import model.Action; -import model.Connection; - -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.ComponentEditPolicy; - - -import commands.AddActionCommand; -import commands.ChangeActionCommand; -import commands.ChangeEventCommand; -import commands.RemoveActionCommand; -import dialog.ActionDialog; -import dialog.ActionAndEventInfo; -import dialog.EventDialog; - -public class ActionAndEventEditPolicy extends ComponentEditPolicy { - - private static final String CHANGE_ACTION_REQUEST = "Change action"; //$NON-NLS-1$ - private static final String ADD_ACTION_REQUEST = "Add action"; //$NON-NLS-1$ - private static final String REMOVE_ACTION_REQUEST = "Remove action"; //$NON-NLS-1$ - private static final String CHANGE_EVENT_REQUEST = "Change event"; //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.gef.EditPolicy#getCommand(org.eclipse.gef.Request) - */ - public Command getCommand(Request request) { - if (CHANGE_ACTION_REQUEST.equals(request.getType())) { - // map contains the connection to which the action belongs - Map map = request.getExtendedData(); - ActionDialog dlg = new ActionDialog((Action) map.get("1")); - dlg.setVisible(true); - ActionAndEventInfo info = dlg.getInfo(); - if (info == null || info.getActionEventName() == null) { - return null; - } - return getChangeActionCommand((Action) map.get("1"), info); - } - if (ADD_ACTION_REQUEST.equals(request.getType())) { - ActionDialog dlg = new ActionDialog(); - dlg.setVisible(true); - ActionAndEventInfo info = dlg.getInfo(); - if (info == null || info.getActionEventName() == null) { - return null; - } - return getAddActionCommand(info); - } - if (REMOVE_ACTION_REQUEST.equals(request.getType())) { - // map contains the connection to which the action belongs - Map map = request.getExtendedData(); - return getRemoveActionCommand((Action) map.get("1")); - } - if (CHANGE_EVENT_REQUEST.equals(request.getType())) { - // map contains the connection to which the event belongs - Map map = request.getExtendedData(); - EventDialog dlg = new EventDialog((Connection)map.get("1")); - dlg.setVisible(true); - ActionAndEventInfo info = dlg.getInfo(); - if (info == null || info.getActionEventName() == null) { - return null; - } - return getChangeEventCommand(info); - } - return super.getCommand(request); - } - - /** - * creates a new command to change an action - * @param act the action which should be changed - * @param info the info object with the new values - * @return the command - */ - protected Command getChangeActionCommand(Action act, ActionAndEventInfo info){ - Connection con = (Connection) getHost().getModel(); - ChangeActionCommand command = new ChangeActionCommand(con, act, info); - return command; - } - - /** - * creates a new command to add an action - * @param info the info object with the new values - * @return the command - */ - protected Command getAddActionCommand(ActionAndEventInfo info){ - Connection con = (Connection) getHost().getModel(); - AddActionCommand command = new AddActionCommand(con, info); - return command; - } - - /** - * creates a new command to remove an action - * @param act the action which should be changed - * @return the command - */ - protected Command getRemoveActionCommand(Action act){ - Connection con = (Connection) getHost().getModel(); - RemoveActionCommand command = new RemoveActionCommand(con, act); - return command; - } - - /** - * creates a new command to change an event - * @param info the info object with the new values - * @return the command - */ - protected Command getChangeEventCommand(ActionAndEventInfo info){ - Connection con = (Connection) getHost().getModel(); - ChangeEventCommand command = new ChangeEventCommand(con, info); - return command; - } -} diff --git a/Build/Tools/StateMachineEditor/src/parts/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/parts/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/parts/ConnectionEditPart.java b/Build/Tools/StateMachineEditor/src/parts/ConnectionEditPart.java deleted file mode 100644 index 12554fc2ba..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/ConnectionEditPart.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package parts; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PolygonDecoration; -import org.eclipse.draw2d.PolylineConnection; -import org.eclipse.draw2d.PositionConstants; - -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editparts.AbstractConnectionEditPart; -import org.eclipse.gef.editpolicies.ConnectionEditPolicy; -import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy; -import org.eclipse.gef.requests.GroupRequest; - -import model.Connection; -import model.ModelElement; -import commands.ConnectionDeleteCommand; - -/** - * @author Daniel - */ -class ConnectionEditPart extends AbstractConnectionEditPart implements - PropertyChangeListener { - - private Label actionName = new Label("action"); - private Label eventName = new Label("event"); - - /** - * Upon activation, attach to the model element as a property change - * listener. - */ - public void activate() { - if (!isActive()) { - super.activate(); - ((ModelElement) getModel()).addPropertyChangeListener(this); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies() - */ - protected void createEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new ActionAndEventEditPolicy()); - // Selection handle edit policy. - // Makes the connection show a feedback, when selected by the user. - installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, - new ConnectionEndpointEditPolicy()); - // Allows the removal of the connection model element - installEditPolicy(EditPolicy.CONNECTION_ROLE, - new ConnectionEditPolicy() { - protected Command getDeleteCommand(GroupRequest request) { - return new ConnectionDeleteCommand(getCastedModel()); - } - }); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure() - */ - protected IFigure createFigure() { - PolylineConnection connection = (PolylineConnection) super.createFigure(); - connection.setTargetDecoration(new PolygonDecoration()); // arrow at - // target - // endpoint - ConnectionLocator midpointLocator = new ConnectionLocator(connection, PositionConstants.RIGHT); - actionName.setOpaque(true); - //actionName.setBackgroundColor(ColorConstants.green); - actionName.setForegroundColor(ColorConstants.black); - actionName.setText(getCastedModel().getAction()); // actionName of this connection - // add action on midpoint - midpointLocator.setRelativePosition(PositionConstants.RIGHT); - connection.add(actionName, midpointLocator); - ConnectionLocator midpointLocator2 = new ConnectionLocator(connection, PositionConstants.RIGHT); - eventName.setOpaque(true); - //eventName.setBackgroundColor(ColorConstants.red); - eventName.setForegroundColor(ColorConstants.black); - eventName.setText(getCastedModel().getEvent()); // eventName of this connection - // add event on midpoint - midpointLocator2.setRelativePosition(PositionConstants.LEFT); - connection.add(eventName, midpointLocator2); - - return connection; - } - - /** - * Upon deactivation, detach from the model element as a property change - * listener. - */ - public void deactivate() { - if (isActive()) { - super.deactivate(); - ((ModelElement) getModel()).removePropertyChangeListener(this); - } - } - - /** - * @return the Connection model - */ - private Connection getCastedModel() { - return (Connection) getModel(); - } - - /* - * (non-Javadoc) - * - * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - String property = event.getPropertyName(); - if (Connection.EVENT_PROP.equals(property)) { - eventName.setText(getCastedModel().getEvent()); - } - else if (Connection.ACTION_PROP.equals(property)) { - actionName.setText(getCastedModel().getAction()); - } else if (Connection.ACTIVE_PROP.equals(property)) { - PolylineConnection connection = (PolylineConnection) getFigure(); - connection.setForegroundColor(ColorConstants.red); - } else if (Connection.INACTIVE_PROP.equals(property)) { - PolylineConnection connection = (PolylineConnection) getFigure(); - connection.setForegroundColor(ColorConstants.black); - } else if (Connection.DEACTIVATE_POLICY_PROP.equals(property)) { - this.removeEditPolicy(EditPolicy.COMPONENT_ROLE); - this.removeEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE); - this.removeEditPolicy(EditPolicy.CONNECTION_ROLE); - } else if (Connection.ACTIVATE_POLICY_PROP.equals(property)) { - createEditPolicies(); - } - } - -} diff --git a/Build/Tools/StateMachineEditor/src/parts/DiagramEditPart.java b/Build/Tools/StateMachineEditor/src/parts/DiagramEditPart.java deleted file mode 100644 index 0e078f90e5..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/DiagramEditPart.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package parts; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.List; - -import org.eclipse.draw2d.ConnectionLayer; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.FreeformLayer; -import org.eclipse.draw2d.FreeformLayout; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.geometry.Rectangle; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.LayerConstants; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.editpolicies.RootComponentEditPolicy; -import org.eclipse.gef.editpolicies.XYLayoutEditPolicy; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.gef.requests.CreateRequest; - -import router.SpreadRouter; - -import model.StartState; -import model.ModelElement; -import model.NormalState; -import model.EndState; -import model.States; -import model.StateMachinesDiagram; -import commands.StatesCreateCommand; -import commands.StatesSetConstraintCommand; - -/** - * @author Daniel - */ -class DiagramEditPart extends AbstractGraphicalEditPart implements - PropertyChangeListener { - - /** - * Upon activation, attach to the model element as a property change - * listener. - */ - public void activate() { - if (!isActive()) { - super.activate(); - ((ModelElement) getModel()).addPropertyChangeListener(this); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies() - */ - protected void createEditPolicies() { - // disallows the removal of this edit part from its parent - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new RootComponentEditPolicy()); - // handles constraint changes (e.g. moving and/or resizing) of model - // elements - // and creation of new model elements - installEditPolicy(EditPolicy.LAYOUT_ROLE, - new StateMachinesXYLayoutEditPolicy()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure() - */ - protected IFigure createFigure() { - Figure f = new FreeformLayer(); - f.setBorder(new MarginBorder(3)); - f.setLayoutManager(new FreeformLayout()); - // Create the static router for the connection layer - ConnectionLayer connLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER); - SpreadRouter router = new SpreadRouter(); - router.setSeparation(30); - connLayer.setConnectionRouter(router); - return f; - } - - /** - * Upon deactivation, detach from the model element as a property change - * listener. - */ - public void deactivate() { - if (isActive()) { - super.deactivate(); - ((ModelElement) getModel()).removePropertyChangeListener(this); - } - } - - /** - * @return the StateMachinesDiagram model - */ - private StateMachinesDiagram getCastedModel() { - return (StateMachinesDiagram) getModel(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren() - */ - protected List getModelChildren() { - return getCastedModel().getChildren(); // return a list of states - } - - /* - * (non-Javadoc) - * - * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent evt) { - String prop = evt.getPropertyName(); - // these properties are fired when States are added into or removed from - // the StateMachinesDiagram instance and must cause a call of refreshChildren() - // to update the diagram's contents. - if (StateMachinesDiagram.CHILD_ADDED_PROP.equals(prop) - || StateMachinesDiagram.CHILD_REMOVED_PROP.equals(prop)) { - refreshChildren(); - } else if (StateMachinesDiagram.DEACTIVATE_POLICY_PROP.equals(prop)) { - this.removeEditPolicy(EditPolicy.LAYOUT_ROLE); - } else if (StateMachinesDiagram.ACTIVATE_POLICY_PROP.equals(prop)) { - installEditPolicy(EditPolicy.LAYOUT_ROLE, - new StateMachinesXYLayoutEditPolicy()); - } - } - - /** - * EditPolicy for the Figure used by this edit part. Children of - * XYLayoutEditPolicy can be used in Figures with XYLayout. - */ - private static class StateMachinesXYLayoutEditPolicy extends XYLayoutEditPolicy { - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createAddCommand(org.eclipse.gef.EditPart, - * java.lang.Object) - */ - protected Command createAddCommand(EditPart child, Object constraint) { - // not used in this example - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.requests.ChangeBoundsRequest, - * org.eclipse.gef.EditPart, java.lang.Object) - */ - protected Command createChangeConstraintCommand( - ChangeBoundsRequest request, EditPart child, Object constraint) { - if (child instanceof StateMachinesEditPart - && constraint instanceof Rectangle) { - // return a command that can move and/or resize a State - return new StatesSetConstraintCommand((States) child.getModel(), - request, (Rectangle) constraint); - } - return super.createChangeConstraintCommand(request, child, - constraint); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart, - * java.lang.Object) - */ - protected Command createChangeConstraintCommand(EditPart child, - Object constraint) { - // not used in this example - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest) - */ - protected Command getCreateCommand(CreateRequest request) { - Object childClass = request.getNewObjectType(); - if (childClass == StartState.class - || childClass == NormalState.class - || childClass == EndState.class) { - // return a command that can add a State to a StateMachinesDiagram - return new StatesCreateCommand((States) request.getNewObject(), - (StateMachinesDiagram) getHost().getModel(), - (Rectangle) getConstraintFor(request)); - } - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getDeleteDependantCommand(org.eclipse.gef.Request) - */ - protected Command getDeleteDependantCommand(Request request) { - // not used in this example - return null; - } - - } - -} diff --git a/Build/Tools/StateMachineEditor/src/parts/DiagrammTreeEditPart.java b/Build/Tools/StateMachineEditor/src/parts/DiagrammTreeEditPart.java deleted file mode 100644 index 6cf26e0ef5..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/DiagrammTreeEditPart.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package parts; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.List; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.RootEditPart; -import org.eclipse.gef.editparts.AbstractTreeEditPart; -import org.eclipse.gef.editpolicies.RootComponentEditPolicy; - -import model.ModelElement; -import model.StateMachinesDiagram; - -/** - * @author Daniel - */ -class DiagramTreeEditPart extends AbstractTreeEditPart implements - PropertyChangeListener { - - /** - * Create a new instance of this edit part using the given model element. - * - * @param model - * a non-null StateMachinesDiagram instance - */ - DiagramTreeEditPart(StateMachinesDiagram model) { - super(model); - } - - /** - * Upon activation, attach to the model element as a property change - * listener. - */ - public void activate() { - if (!isActive()) { - super.activate(); - ((ModelElement) getModel()).addPropertyChangeListener(this); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.examples.stateMachines.parts.StateMachinesTreeEditPart#createEditPolicies() - */ - protected void createEditPolicies() { - // If this editpart is the root content of the viewer, then disallow - // removal - if (getParent() instanceof RootEditPart) { - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new RootComponentEditPolicy()); - } - } - - /** - * Upon deactivation, detach from the model element as a property change - * listener. - */ - public void deactivate() { - if (isActive()) { - super.deactivate(); - ((ModelElement) getModel()).removePropertyChangeListener(this); - } - } - - /** - * @return the StateMAchinesDiagram model - */ - private StateMachinesDiagram getCastedModel() { - return (StateMachinesDiagram) getModel(); - } - - /** - * Convenience method that returns the EditPart corresponding to a given - * child. - * - * @param child - * a model element instance - * @return the corresponding EditPart or null - */ - private EditPart getEditPartForChild(Object child) { - return (EditPart) getViewer().getEditPartRegistry().get(child); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren() - */ - protected List getModelChildren() { - return getCastedModel().getChildren(); // a list of states - } - - /* - * (non-Javadoc) - * - * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent evt) { - String prop = evt.getPropertyName(); - if (StateMachinesDiagram.CHILD_ADDED_PROP.equals(prop)) { - // add a child to this edit part - // causes an additional entry to appear in the tree of the outline - // dialog - addChild(createChild(evt.getNewValue()), -1); - } else if (StateMachinesDiagram.CHILD_REMOVED_PROP.equals(prop)) { - // remove a child from this edit part - // causes the corresponding edit part to disappear from the tree in - // the outline dialog - removeChild(getEditPartForChild(evt.getNewValue())); - } else { - refreshVisuals(); - } - } -} diff --git a/Build/Tools/StateMachineEditor/src/parts/StateMachinesComponentEditPolicy.java b/Build/Tools/StateMachineEditor/src/parts/StateMachinesComponentEditPolicy.java deleted file mode 100644 index 3989c08f2e..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/StateMachinesComponentEditPolicy.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package parts; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.ComponentEditPolicy; -import org.eclipse.gef.requests.GroupRequest; - -import model.States; -import model.StateMachinesDiagram; -import commands.StatesDeleteCommand; - -/** - * @author Daniel - */ -class StateMachinesComponentEditPolicy extends ComponentEditPolicy { - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.ComponentEditPolicy#createDeleteCommand(org.eclipse.gef.requests.GroupRequest) - */ - protected Command createDeleteCommand(GroupRequest deleteRequest) { - Object parent = getHost().getParent().getModel(); - Object child = getHost().getModel(); - if (parent instanceof StateMachinesDiagram && child instanceof States) { - return new StatesDeleteCommand((StateMachinesDiagram) parent, - (States) child); - } - return super.createDeleteCommand(deleteRequest); - } -} diff --git a/Build/Tools/StateMachineEditor/src/parts/StateMachinesEditPart.java b/Build/Tools/StateMachineEditor/src/parts/StateMachinesEditPart.java deleted file mode 100644 index 2bbe253bee..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/StateMachinesEditPart.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package parts; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.List; - -import org.eclipse.draw2d.ChopboxAnchor; -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.ConnectionAnchor; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.geometry.Rectangle; - -import org.eclipse.gef.ConnectionEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.NodeEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy; -import org.eclipse.gef.requests.CreateConnectionRequest; -import org.eclipse.gef.requests.ReconnectRequest; - -import model.Connection; -import model.RoundLabel; -import model.StartState; -import model.NormalState; -import model.EndState; -import model.ModelElement; -import model.States; -import commands.ConnectionCreateCommand; -import commands.ConnectionReconnectCommand; - -/** - * @author Daniel - */ -class StateMachinesEditPart extends AbstractGraphicalEditPart implements - PropertyChangeListener, NodeEditPart { - - private ConnectionAnchor anchor; - - /** - * Upon activation, attach to the model element as a property change - * listener. - */ - public void activate() { - if (!isActive()) { - super.activate(); - ((ModelElement) getModel()).addPropertyChangeListener(this); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies() - */ - protected void createEditPolicies() { - // allow removal of the associated model element - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new StateMachinesComponentEditPolicy()); - // allow the creation of connections and - // the reconnection of connections between States instances - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new GraphicalNodeEditPolicy() { - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getConnectionCompleteCommand(org.eclipse.gef.requests.CreateConnectionRequest) - */ - protected Command getConnectionCompleteCommand( - CreateConnectionRequest request) { - ConnectionCreateCommand cmd = (ConnectionCreateCommand) request - .getStartCommand(); - cmd.setTarget((States) getHost().getModel()); - return cmd; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getConnectionCreateCommand(org.eclipse.gef.requests.CreateConnectionRequest) - */ - protected Command getConnectionCreateCommand( - CreateConnectionRequest request) { - States source = (States) getHost().getModel(); - ConnectionCreateCommand cmd = new ConnectionCreateCommand( - source); - request.setStartCommand(cmd); - return cmd; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getReconnectSourceCommand(org.eclipse.gef.requests.ReconnectRequest) - */ - protected Command getReconnectSourceCommand( - ReconnectRequest request) { - Connection conn = (Connection) request - .getConnectionEditPart().getModel(); - States newSource = (States) getHost().getModel(); - ConnectionReconnectCommand cmd = new ConnectionReconnectCommand( - conn); - cmd.setNewSource(newSource); - return cmd; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getReconnectTargetCommand(org.eclipse.gef.requests.ReconnectRequest) - */ - protected Command getReconnectTargetCommand( - ReconnectRequest request) { - Connection conn = (Connection) request - .getConnectionEditPart().getModel(); - States newTarget = (States) getHost().getModel(); - ConnectionReconnectCommand cmd = new ConnectionReconnectCommand( - conn); - cmd.setNewTarget(newTarget); - return cmd; - } - }); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure() - */ - protected IFigure createFigure() { - IFigure f = createFigureForModel(); - f.setOpaque(true); // non-transparent figure - if (getModel() instanceof StartState) { - f.setBackgroundColor(ColorConstants.green); - f.setForegroundColor(ColorConstants.black); - } - else if (getModel() instanceof NormalState){ - f.setBackgroundColor(ColorConstants.yellow); - f.setForegroundColor(ColorConstants.black); - } - else if (getModel() instanceof EndState){ - f.setBackgroundColor(ColorConstants.orange); - f.setForegroundColor(ColorConstants.black); - } - else { - // if States gets extended the conditions above must be updated - throw new IllegalArgumentException(); - } - return f; - } - - /** - * Return a IFigure depending on the instance of the current model element. - * This allows this EditPart to be used for all subclasses of States. - */ - private IFigure createFigureForModel() { - if (getModel() instanceof StartState) { - return new RoundLabel(); - } - else if (getModel() instanceof NormalState) { - return new RoundLabel(); - } - else if (getModel() instanceof EndState) { - return new RoundLabel(); - } - else { - // if States gets extended the conditions above must be updated - throw new IllegalArgumentException(); - } - } - - /** - * Upon deactivation, detach from the model element as a property change - * listener. - */ - public void deactivate() { - if (isActive()) { - super.deactivate(); - ((ModelElement) getModel()).removePropertyChangeListener(this); - } - } - - private States getCastedModel() { - return (States) getModel(); - } - - protected ConnectionAnchor getConnectionAnchor() { - if (anchor == null) { - if (getModel() instanceof StartState) { - anchor = new ChopboxAnchor(getFigure()); - } - else if (getModel() instanceof NormalState) { - anchor = new ChopboxAnchor(getFigure()); - } - else if (getModel() instanceof EndState) { - anchor = new ChopboxAnchor(getFigure()); - } - else { - // if States gets extended the conditions above must be updated - throw new IllegalArgumentException("unexpected model"); - } - } - return anchor; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelSourceConnections() - */ - protected List getModelSourceConnections() { - return getCastedModel().getSourceConnections(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelTargetConnections() - */ - protected List getModelTargetConnections() { - return getCastedModel().getTargetConnections(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart) - */ - public ConnectionAnchor getSourceConnectionAnchor( - ConnectionEditPart connection) { - return getConnectionAnchor(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request) - */ - public ConnectionAnchor getSourceConnectionAnchor(Request request) { - return getConnectionAnchor(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart) - */ - public ConnectionAnchor getTargetConnectionAnchor( - ConnectionEditPart connection) { - return getConnectionAnchor(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.Request) - */ - public ConnectionAnchor getTargetConnectionAnchor(Request request) { - return getConnectionAnchor(); - } - - /* - * (non-Javadoc) - * - * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent evt) { - String prop = evt.getPropertyName(); - if (States.SIZE_PROP.equals(prop) || States.LOCATION_PROP.equals(prop) - || States.STATE_NAME_PROP.equals(prop)) { - refreshSourceConnections(); - refreshTargetConnections(); - refreshVisuals(); - } else if (States.SOURCE_CONNECTIONS_PROP.equals(prop)) { - refreshSourceConnections(); - refreshTargetConnections(); - refreshVisuals(); - } else if (States.TARGET_CONNECTIONS_PROP.equals(prop)) { - refreshSourceConnections(); - refreshTargetConnections(); - refreshVisuals(); - } else if (States.ACTIVE_PROP.equals(prop)) { - RoundLabel label = (RoundLabel)getFigure(); - label.setBackgroundColor(ColorConstants.red); - } else if (States.INACTIVE_PROP.equals(prop)) { - RoundLabel label = (RoundLabel)getFigure(); - if (getModel() instanceof StartState) { - label.setBackgroundColor(ColorConstants.green); - } - else if (getModel() instanceof NormalState){ - label.setBackgroundColor(ColorConstants.yellow); - } - else if (getModel() instanceof EndState){ - label.setBackgroundColor(ColorConstants.orange); - } - } else if (States.DEACTIVATE_POLICY_PROP.equals(prop)) { - this.removeEditPolicy(EditPolicy.COMPONENT_ROLE); - this.removeEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE); - } else if (States.ACTIVATE_POLICY_PROP.equals(prop)) { - createEditPolicies(); - } - } - - protected void refreshVisuals() { - // notify parent container of changed position & location - // if this line is removed, the XYLayoutManager used by the parent - // container - // (the Figure of the StateMachinesDiagramEditPart), will not know the bounds - // of this figure - // and will not draw it correctly. - RoundLabel label = (RoundLabel)getFigure(); - label.setText(getCastedModel().getStateName()); - Rectangle bounds = new Rectangle(getCastedModel().getLocation(), - getCastedModel().getSize()); - ((GraphicalEditPart) getParent()).setLayoutConstraint(this, - getFigure(), bounds); - } -} diff --git a/Build/Tools/StateMachineEditor/src/parts/StateMachinesEditPartFactory.java b/Build/Tools/StateMachineEditor/src/parts/StateMachinesEditPartFactory.java deleted file mode 100644 index 43bd30a246..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/StateMachinesEditPartFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package parts; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; - -import model.Connection; -import model.States; -import model.StateMachinesDiagram; - -/** - * @author Daniel - */ -public class StateMachinesEditPartFactory implements EditPartFactory { - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.EditPartFactory#createEditPart(org.eclipse.gef.EditPart, - * java.lang.Object) - */ - public EditPart createEditPart(EditPart context, Object modelElement) { - // get EditPart for model element - EditPart part = getPartForElement(modelElement); - // store model element in EditPart - part.setModel(modelElement); - return part; - } - - /** - * Maps an object to an EditPart. - * - * @throws RuntimeException - * if no match was found (programming error) - */ - private EditPart getPartForElement(Object modelElement) { - if (modelElement instanceof StateMachinesDiagram) { - return new DiagramEditPart(); - } - if (modelElement instanceof States) { - return new StateMachinesEditPart(); - } - if (modelElement instanceof Connection) { - return new ConnectionEditPart(); - } - throw new RuntimeException("Can't create part for model element: " - + ((modelElement != null) ? modelElement.getClass().getName() - : "null")); - } - -} diff --git a/Build/Tools/StateMachineEditor/src/parts/StateMachinesTreeEditPart.java b/Build/Tools/StateMachineEditor/src/parts/StateMachinesTreeEditPart.java deleted file mode 100644 index 85135a8039..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/StateMachinesTreeEditPart.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package parts; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.editparts.AbstractTreeEditPart; - -import model.ModelElement; -import model.States; - -/** - * @author Daniel - */ -class StateMachinesTreeEditPart extends AbstractTreeEditPart implements - PropertyChangeListener { - - /** - * Create a new instance of this edit part using the given model element. - * - * @param model - * a non-null GetDOMStates instance - */ - StateMachinesTreeEditPart(States model) { - super(model); - } - - /** - * Upon activation, attach to the model element as a property change - * listener. - */ - public void activate() { - if (!isActive()) { - super.activate(); - ((ModelElement) getModel()).addPropertyChangeListener(this); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractTreeEditPart#createEditPolicies() - */ - protected void createEditPolicies() { - // allow removal of the associated model element - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new StateMachinesComponentEditPolicy()); - } - - /** - * Upon deactivation, detach from the model element as a property change - * listener. - */ - public void deactivate() { - if (isActive()) { - super.deactivate(); - ((ModelElement) getModel()).removePropertyChangeListener(this); - } - } - - /** - * @return the States model - */ - private States getCastedModel() { - return (States) getModel(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractTreeEditPart#getImage() - */ - protected Image getImage() { - return getCastedModel().getIcon(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractTreeEditPart#getText() - */ - protected String getText() { - return getCastedModel().toString(); - } - - /* - * (non-Javadoc) - * - * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent evt) { - refreshVisuals(); // this will cause an invocation of getImage() and - // getText(), see below - } -} diff --git a/Build/Tools/StateMachineEditor/src/parts/StateMachinesTreeEditPartFactory.java b/Build/Tools/StateMachineEditor/src/parts/StateMachinesTreeEditPartFactory.java deleted file mode 100644 index 3fc2ce0964..0000000000 --- a/Build/Tools/StateMachineEditor/src/parts/StateMachinesTreeEditPartFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package parts; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; - -import model.States; -import model.StateMachinesDiagram; - -/** - * @author Daniel - */ -public class StateMachinesTreeEditPartFactory implements EditPartFactory { - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.EditPartFactory#createEditPart(org.eclipse.gef.EditPart, - * java.lang.Object) - */ - public EditPart createEditPart(EditPart context, Object model) { - if (model instanceof States) { - return new StateMachinesTreeEditPart((States) model); - } - if (model instanceof StateMachinesDiagram) { - return new DiagramTreeEditPart((StateMachinesDiagram) model); - } - return null; // will not show an entry for the corresponding model - // instance - } - -} diff --git a/Build/Tools/StateMachineEditor/src/router/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/router/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/router/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/router/MyAbstractRouter.java b/Build/Tools/StateMachineEditor/src/router/MyAbstractRouter.java deleted file mode 100644 index 376cae84da..0000000000 --- a/Build/Tools/StateMachineEditor/src/router/MyAbstractRouter.java +++ /dev/null @@ -1,109 +0,0 @@ -package router; - -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.ConnectionRouter; -import org.eclipse.draw2d.geometry.Point; - -/** - * Generic support for ConnectionRouters. - */ -public abstract class MyAbstractRouter - implements ConnectionRouter -{ - -private static final Point START = new Point(); -private static final Point END = new Point(); - -/** - * Returns the constraint for the given Connection. - * - * @param connection The connection - * @return The constraint - * @since 2.0 - */ -public Object getConstraint(Connection connection) { - return null; -} - -/** - * A convenience method for obtaining a connection's endpoint. The connection's endpoint - * is a point in absolute coordinates obtained by using its source and target {@link - * ConnectionAnchor}. The returned Point is a static singleton that is reused to reduce - * garbage collection. The caller may modify this point in any way. However, the point - * will be reused and its values overwritten during the next call to this method. - * - * @param connection The connection - * @return The endpoint - * @since 2.0 - */ -protected Point getEndPoint(Connection connection) { - Point ref; - if (connection.getSourceAnchor().getReferencePoint().equals(connection.getTargetAnchor().getReferencePoint())) { - int height = connection.getTargetAnchor().getOwner().getSize().height; - int width = connection.getTargetAnchor().getOwner().getSize().width; - ref = connection.getSourceAnchor().getReferencePoint(); - ref.x = ref.x + width / 2; - ref.y = ref.y - height / 4; - return END.setLocation(connection.getTargetAnchor().getLocation(ref)); - } - else { - ref = connection.getSourceAnchor().getReferencePoint(); - } - return END.setLocation(connection.getTargetAnchor().getLocation(ref)); -} - -/** - * A convenience method for obtaining a connection's start point. The connection's - * startpoint is a point in absolute coordinates obtained by using its source and target - * {@link ConnectionAnchor}. The returned Point is a static singleton that is reused to - * reduce garbage collection. The caller may modify this point in any way. However, the - * point will be reused and its values overwritten during the next call to this method. - * - * @param conn The connection - * @return The start point - * @since 2.0 - */ -protected Point getStartPoint(Connection conn) { - Point ref; - if (conn.getSourceAnchor().getReferencePoint().equals(conn.getTargetAnchor().getReferencePoint())) { - int height = conn.getTargetAnchor().getOwner().getSize().height; - int width = conn.getTargetAnchor().getOwner().getSize().width; - ref = conn.getTargetAnchor().getReferencePoint(); - ref.x = ref.x + width / 2; - ref.y = ref.y - height / 2; - ref.x = ref.x - width / 6; - return START.setLocation(conn.getSourceAnchor().getLocation(ref)); - } - else { - ref = conn.getTargetAnchor().getReferencePoint(); - } - return START.setLocation(conn.getSourceAnchor().getLocation(ref)); -} - -/** - * Causes the router to discard any cached information about the given Connection. - * - * @param connection The connection to invalidate - * @since 2.0 - */ -public void invalidate(Connection connection) { } - -/** - * Removes the given Connection from this routers list of Connections it is responsible - * for. - * - * @param connection The connection to remove - * @since 2.0 - */ -public void remove(Connection connection) { } - -/** - * Sets the constraint for the given Connection. - * - * @param connection The connection - * @param constraint The constraint - * @since 2.0 - */ -public void setConstraint(Connection connection, Object constraint) { } - -} diff --git a/Build/Tools/StateMachineEditor/src/router/MyAutomaticRouter.java b/Build/Tools/StateMachineEditor/src/router/MyAutomaticRouter.java deleted file mode 100644 index 7bb81439f9..0000000000 --- a/Build/Tools/StateMachineEditor/src/router/MyAutomaticRouter.java +++ /dev/null @@ -1,308 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package router; - -import java.util.ArrayList; - -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.ConnectionAnchor; -import org.eclipse.draw2d.ConnectionRouter; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.PointList; - -import router.MyMultiValueMap; - -/** - * The AutomaticRouter provides the facility to prevent {@link Connection Connections} - * from overlapping. Subclasses implement the abstract method - * {@link #handleCollision(PointList, int)} to determine how to handle Connection - * collisions. - *- * Also provides access to its 'next' router so that manual routing in subclasses is - * possible. - */ -public abstract class MyAutomaticRouter extends MyAbstractRouter { - - private ConnectionRouter nextRouter; - private MyMultiValueMap connections = new MyMultiValueMap(); - - private class HashKey { - - private ConnectionAnchor anchor1, anchor2; - - HashKey(Connection conn) { - anchor1 = conn.getSourceAnchor(); - anchor2 = conn.getTargetAnchor(); - } - - public boolean equals(Object object) { - boolean isEqual = false; - HashKey hashKey; - - if (object instanceof HashKey) { - hashKey = (HashKey)object; - ConnectionAnchor hkA1 = hashKey.getFirstAnchor(); - ConnectionAnchor hkA2 = hashKey.getSecondAnchor(); - - isEqual = (hkA1.equals(anchor1) && hkA2.equals(anchor2)) - || (hkA1.equals(anchor2) && hkA2.equals(anchor1)); - } - return isEqual; - } - - public ConnectionAnchor getFirstAnchor() { - return anchor1; - } - - public ConnectionAnchor getSecondAnchor() { - return anchor2; - } - - public int hashCode() { - return anchor1.hashCode() ^ anchor2.hashCode(); - } - } - - /** - * @see org.eclipse.draw2d.ConnectionRouter#getConstraint(Connection) - */ - public Object getConstraint(Connection connection) { - if (next() != null) - return next().getConstraint(connection); - return null; - } - - /** - * Handles collisions between 2 or more Connections. Collisions are currently defined as 2 - * connections with no bendpoints and whose start and end points coincide. In other - * words, the 2 connections are the exact same line. - * - * @param list The PointList of a connection that collides with another connection - * @param index The index of the current connection in the list of colliding connections - */ - protected abstract void handleCollision(PointList list, int index); - - /** - * Handles collisions between 2 or more Connections. Collisions are currently defined as 2 - * connections with no bendpoints and whose start and end points coincide. In other - * words, the 2 connections are the exact same line. - * - * @param list The PointList of a connection that collides with another connection - * @param index The index of the current connection in the list of colliding connections - */ - protected abstract void handleCollision1(PointList list, int index); - - /** - * @see org.eclipse.draw2d.ConnectionRouter#invalidate(Connection) - */ - public void invalidate(Connection conn) { - if (next() != null) - next().invalidate(conn); - if (conn.getSourceAnchor() == null || conn.getTargetAnchor() == null) - return; - HashKey connectionKey = new HashKey(conn); - ArrayList connectionList = connections.get(connectionKey); - int affected = connections.remove(connectionKey, conn); - if (affected != -1) { - for (int i = 0/*affected*/; i < connectionList.size(); i++) { - ((Connection)connectionList.get(i)).revalidate(); - } - } else - connections.removeValue(conn); - } - - /** - * Returns the next router in the chain. - * @return The next router - * @since 2.0 - */ - protected ConnectionRouter next() { - return nextRouter; - } - - - - /** - * @see org.eclipse.draw2d.ConnectionRouter#remove(Connection) - */ - public void remove(Connection conn) { - if (conn.getSourceAnchor() == null || conn.getTargetAnchor() == null) - return; - HashKey connectionKey = new HashKey(conn); - ArrayList connectionList = connections.get(connectionKey); - if (connectionList != null) { - for (int i = 0; i < connectionList.size(); i++) { - ((Connection)connectionList.get(i)).revalidate(); - } - } - if (next() != null) - next().remove(conn); - } - - /** - * Routes the given connection. Calls the 'next' router first (if one exists) and if no - * bendpoints were added by the next router, collisions are dealt with by calling - * {@link #handleCollision(PointList, int)}. - * @param conn The connection to route - */ - - int index1 = 0; - int index2 = 0; - Point sourcePoint; - ConnectionAnchor sourceAnchor; - public void route(Connection conn) { - if (conn.getSourceAnchor().equals(conn.getTargetAnchor())) { - if (next() != null) - next().route(conn); - else { - conn.getPoints().removeAllPoints(); - setEndPoints(conn); - } - - if (conn.getPoints().size() == 2) { - PointList points = conn.getPoints(); - HashKey connectionKey = new HashKey(conn); - ArrayList connectionList = connections.get(connectionKey); - - if (connectionList != null) { - sourceAnchor = ((Connection)connectionList.get(0)).getSourceAnchor(); - int index; - - if (connectionList.contains(conn)) { - index = connectionList.indexOf(conn) + 1; - } else { - index = connectionList.size() + 1; - connections.put(connectionKey, conn); - } - index1 = 0; - index2 = 0; - if (sourcePoint == null) { - sourcePoint = points.getFirstPoint(); - } - if (connectionList.size() > 0) { - connectionList = connections.get(connectionKey); - for (int i = 0; i < connectionList.size(); i++) { - ConnectionAnchor anchor3 = ((Connection)connectionList.get(i)).getSourceAnchor(); - if (anchor3 == sourceAnchor) { - index1++; - index = index1; - } - else { - index2++; - index = index2; - } - } - } - handleCollision1(points, index); - conn.setPoints(points); - } - else { - sourceAnchor = conn.getSourceAnchor(); - handleCollision1(points, 1); - conn.setPoints(points); - connections.put(connectionKey, conn); - } - } - } - - else { - if (next() != null) - next().route(conn); - else { - conn.getPoints().removeAllPoints(); - setEndPoints(conn); - } - - if (conn.getPoints().size() == 2) { - PointList points = conn.getPoints(); - HashKey connectionKey = new HashKey(conn); - ArrayList connectionList = connections.get(connectionKey); - - if (connectionList != null) { - sourceAnchor = ((Connection)connectionList.get(0)).getSourceAnchor(); - int index; - - if (connectionList.contains(conn)) { - index = connectionList.indexOf(conn) + 1; - } else { - index = connectionList.size() + 1; - connections.put(connectionKey, conn); - } - index1 = 0; - index2 = 0; - if (sourcePoint == null) { - sourcePoint = points.getFirstPoint(); - } - if (connectionList.size() > 0) { - connectionList = connections.get(connectionKey); - for (int i = 0; i < connectionList.size(); i++) { - ConnectionAnchor anchor3 = ((Connection)connectionList.get(i)).getSourceAnchor(); - if (anchor3 == sourceAnchor) { - index1++; - index = index1; - } - else { - index2++; - index = index2; - } - } - } - handleCollision(points, index); - conn.setPoints(points); - } - else { - sourceAnchor = conn.getSourceAnchor(); - handleCollision(points, 1); - conn.setPoints(points); - connections.put(connectionKey, conn); - } - } - } - } - - /** - * An AutomaticRouter needs no constraints for the connections it routes. This method - * invalidates the connections and calls {@link #setConstraint(Connection, Object)} on the - * {@link #next()} router. - * @see org.eclipse.draw2d.ConnectionRouter#setConstraint(Connection, Object) - */ - public void setConstraint(Connection connection, Object constraint) { - invalidate(connection); - if (next() != null) - next().setConstraint(connection, constraint); - } - - /** - * Sets the start and end points for the given connection. - * @param conn The connection - */ - protected void setEndPoints(Connection conn) { - PointList points = conn.getPoints(); - points.removeAllPoints(); - Point start = getStartPoint(conn); - Point end = getEndPoint(conn); - conn.translateToRelative(start); - conn.translateToRelative(end); - points.addPoint(start); - points.addPoint(end); - conn.setPoints(points); - } - - /** - * Sets the next router. - * @param router The ConnectionRouter - * @since 2.0 - */ - public void setNextRouter(ConnectionRouter router) { - nextRouter = router; - } - -} diff --git a/Build/Tools/StateMachineEditor/src/router/MyMultiValueMap.java b/Build/Tools/StateMachineEditor/src/router/MyMultiValueMap.java deleted file mode 100644 index 17d88f6ae2..0000000000 --- a/Build/Tools/StateMachineEditor/src/router/MyMultiValueMap.java +++ /dev/null @@ -1,87 +0,0 @@ -package router; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -public class MyMultiValueMap { - private HashMap map = new HashMap(); - - public MyMultiValueMap() { super(); } - - public ArrayList get(Object key) { - Object value = map.get(key); - if (value == null) return null; - - if (value instanceof ArrayList) - return (ArrayList) value; - ArrayList v = new ArrayList(1); - v.add(value); - return v; - } - - - - public void put(Object key, Object value) { - Object existingValues = map.get(key); - if (existingValues == null) { - map.put(key, value); - return; - } - if (existingValues instanceof ArrayList) { - ArrayList v = (ArrayList) existingValues; - if (!v.contains(value)) - v.add(value); - return; - } - if (existingValues != value) { - ArrayList v = new ArrayList(2); - v.add(existingValues); - v.add(value); - map.put(key, v); - } - } - - public int remove(Object key, Object value) { - Object existingValues = map.get(key); - if (existingValues != null) { - if (existingValues instanceof ArrayList) { - ArrayList v = (ArrayList) existingValues; - int result = v.indexOf(value); - if (result == -1) - return -1; - v.remove(result); - if (v.isEmpty()) - map.remove(key); - return result; - } - if (map.remove(key) != null) - return 0; - } - return -1; - } - - public Object removeValue(Object value) { - Iterator iter = map.values().iterator(); - Object current; - while (iter.hasNext()) { - current = iter.next(); - if (value.equals(current)) { - iter.remove(); - return value; - } else if (current instanceof List) { - if (((List)current).remove(value)) { - if (((List)current).isEmpty()) - iter.remove(); - return value; - } - } - } - return null; - } - - public int size() { - return map.size(); - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/router/SpreadRouter.java b/Build/Tools/StateMachineEditor/src/router/SpreadRouter.java deleted file mode 100644 index f8576204ff..0000000000 --- a/Build/Tools/StateMachineEditor/src/router/SpreadRouter.java +++ /dev/null @@ -1,173 +0,0 @@ -package router; - - -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.PointList; -import javax.vecmath.*; -import router.MyAutomaticRouter; - -/** - * Automatic router that spreads its {@link Connection Connections} in a - * fan-like fashion upon collision. - */ -public class SpreadRouter extends MyAutomaticRouter { - private int separation = 10; - - /** - * Returns the separation in pixels between fanned connections. - * - * @return the separation - * @since 2.0 - */ - public int getSeparation() { - return separation; - } - - /** - * Modifies a given PointList that collides with some other PointList. The - * given index indicates that this is the ith PointList - * in a group of colliding points. - * - * @param points - * the colliding points - * @param index - * the index - */ - protected void handleCollision(PointList points, int index) { - Point start = points.getFirstPoint(); - Point end = points.getLastPoint(); - - if (start.equals(end)) { - return; - } - - double k = 20; - - Point2d s = new Point2d( start.x, start.y ); - Point2d e = new Point2d( end.x, end.y ); - Vector2d v = new Vector2d( e ); - v.sub( s ); - Vector2d vk = new Vector2d( v ); - vk.scale( 1.0 / k ); - Vector2d h = new Vector2d( vk.y, -vk.x ); - h.normalize(); - Point2d help = new Point2d(); - Point2d p = new Point2d(); - for ( int i=1; i < k; i++){ - double fact = Math.sin( Math.PI * (double) i / k ) * separation * (double) index; - p.set( vk ); - p.scale( i ); - p.add( s ); - - help.set( h ); - help.scale( fact ); - p.add( help ); - Point pp = new Point( p.x, p.y ); - points.insertPoint( pp, i ); - } - } - - /** - * Modifies a given PointList that collides with some other PointList. The - * given index indicates that this is the ith PointList - * in a group of colliding points. - * - * @param points - * the colliding points - * @param index - * the index - */ - /* (non-Javadoc) - * @see router.MyAutomaticRouter#handleCollision1(org.eclipse.draw2d.geometry.PointList, int) - */ - protected void handleCollision1(PointList points, int index) { - int i = -1; - Point start = points.getFirstPoint(); - Point end = points.getLastPoint(); - Point2d s = new Point2d(start.x, start.y); - Point2d e = new Point2d(end.x, end.y); - Vector2d vk = new Vector2d(s.x, s.y); - vk.sub(e); - - double radius = vk.length() / 2 + index * separation / 2; - double r = radius*radius; - double xa = e.x; - double ya = e.y; - double xb = s.x; - double yb = s.y; - - - double a = -((-2*ya)-(-2*yb))/((-2*xa)-(-2*xb)); - double b = -((xa*xa+ya*ya-r)-(xb*xb+yb*yb-r))/((-2*xa)-(-2*xb)); - double p = (-2*(xa-b)*a-2*ya)/(a*a+1); - double q = ((xa-b)*(xa-b)+ya*ya-r)/(a*a+1); - double y1 = -p/2 - Math.sqrt((p*p)/4 -q); - double x1 = a*y1+b; - - Point2d midPoint = new Point2d(x1, y1); - - double xmin = 0; - double xmax = 0; - xmin = midPoint.x - radius; - xmax = midPoint.x + radius; - points.removeAllPoints(); - double xmaxi = 0; - // test if the state is in the -X area - if (xmax < 0) { - xmaxi = xmax; - } - else { - xmaxi = xmax + 1; - } - if (s.y > midPoint.y) { - if (xmin > 0) { - for ( int x = (int) s.x; x > (int) xmin; x--) { - double y = midPoint.y + Math.sqrt(radius * radius - (x - midPoint.x) * (x - midPoint.x)); - Point v = new Point(x, y); - i++; - points.insertPoint(v, i); - } - } - else { - for ( int x = (int) s.x; x >= (int) xmin; x--) { - double y = midPoint.y + Math.sqrt(radius * radius - (x - midPoint.x) * (x - midPoint.x)); - Point v = new Point(x, y); - i++; - points.insertPoint(v, i); - } - } - for (int x = (int) xmin + 1; x < (int) xmaxi; x++) { - double y = midPoint.y - Math.sqrt(radius * radius - (x - midPoint.x) * (x - midPoint.x)); - Point v = new Point(x, y); - i++; - points.insertPoint(v, i); - } - } - else if (xmin < s.x) { - for (int x = (int) s.x; x < (int) xmaxi; x++) { - double y = midPoint.y - Math.sqrt(radius * radius - (x - midPoint.x) * (x - midPoint.x)); - Point v = new Point(x, y); - i++; - points.insertPoint(v, i); - } - } - for (int x = (int) xmax - 1; x >= (int) e.x; x--) { - double y = midPoint.y + Math.sqrt(radius * radius - (x - midPoint.x) * (x - midPoint.x)); - Point v = new Point(x, y); - i++; - points.insertPoint(v, i); - } - } - - /** - * Sets the colliding {@link Connection Connection's} separation in pixels. - * - * @param value - * the separation - * @since 2.0 - */ - public void setSeparation(int value) { - separation = value; - } - -} diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/stateMachines/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachines/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditor.java b/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditor.java deleted file mode 100644 index 4f3a3757c2..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditor.java +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package stateMachines; - -import java.io.File; -import java.util.ArrayList; -import java.util.EventObject; -import java.util.List; - -import model.StateMachinesDiagram; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gef.ContextMenuProvider; -import org.eclipse.gef.DefaultEditDomain; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.gef.dnd.TemplateTransferDragSourceListener; -import org.eclipse.gef.dnd.TemplateTransferDropTargetListener; -import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; -import org.eclipse.gef.editparts.ZoomManager; -import org.eclipse.gef.palette.PaletteRoot; -import org.eclipse.gef.requests.CreationFactory; -import org.eclipse.gef.requests.SimpleFactory; -import org.eclipse.gef.ui.actions.ActionRegistry; -import org.eclipse.gef.ui.actions.ZoomInAction; -import org.eclipse.gef.ui.actions.ZoomOutAction; -import org.eclipse.gef.ui.palette.PaletteViewer; -import org.eclipse.gef.ui.palette.PaletteViewerProvider; -import org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferences; -import org.eclipse.gef.ui.parts.ContentOutlinePage; -import org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette; -import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; -import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer; -import org.eclipse.gef.ui.parts.TreeViewer; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.util.TransferDropTargetListener; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.part.IPageSite; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; - -import actions.AddAction; -import actions.ChangeAction; -import actions.ChangeEvent; -import actions.RemoveAction; - -import parts.StateMachinesEditPartFactory; -import parts.StateMachinesTreeEditPartFactory; -import stateMachinesList.StateMachinesList; -import debug.DebugEventsList; -import dom.DOMGetInstance; -import dom.ReadDOMTree; - -/** - * @author Daniel - */ -public class StateMachinesEditor extends GraphicalEditorWithFlyoutPalette { - - private boolean saved = false; - - /** This is the root of the editor's model. */ - private StateMachinesDiagram diagram; - - /** Palette component, holding the tools and states. */ - private static PaletteRoot PALETTE_MODEL; - - /** Create a new StateMachinesEditor instance. This is called by the Workspace. */ - public StateMachinesEditor() { - setEditDomain(new DefaultEditDomain(this)); - } - - /** - * Configure the graphical viewer before it receives contents. - *
- * This is the place to choose an appropriate RootEditPart and - * EditPartFactory for your editor. The RootEditPart determines the behavior - * of the editor's "work-area". For example, GEF includes zoomable and - * scrollable root edit parts. The EditPartFactory maps model elements to - * edit parts (controllers). - *
- * - * @see org.eclipse.gef.ui.parts.GraphicalEditor#configureGraphicalViewer() - */ - protected void configureGraphicalViewer() { - super.configureGraphicalViewer(); - ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer)getGraphicalViewer(); - - ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart(); - - // adding all actions to the editor - List zoomLevels = new ArrayList(3); - zoomLevels.add(ZoomManager.FIT_ALL); - zoomLevels.add(ZoomManager.FIT_WIDTH); - zoomLevels.add(ZoomManager.FIT_HEIGHT); - root.getZoomManager().setZoomLevelContributions(zoomLevels); - - IAction zoomIn = new ZoomInAction(root.getZoomManager()); - IAction zoomOut = new ZoomOutAction(root.getZoomManager()); - IAction changeAction = new ChangeAction(this); - IAction addAction = new AddAction(this); - IAction removeAction = new RemoveAction(this); - IAction changeEvent = new ChangeEvent(this); - getActionRegistry().registerAction(zoomIn); - getActionRegistry().registerAction(zoomOut); - getActionRegistry().registerAction(changeAction); - getActionRegistry().registerAction(addAction); - getActionRegistry().registerAction(removeAction); - getActionRegistry().registerAction(changeEvent); - getSite().getKeyBindingService().registerAction(zoomIn); - getSite().getKeyBindingService().registerAction(zoomOut); - getSite().getKeyBindingService().registerAction(changeAction); - getSite().getKeyBindingService().registerAction(addAction); - getSite().getKeyBindingService().registerAction(removeAction); - getSite().getKeyBindingService().registerAction(changeEvent); - getSelectionActions().add(changeAction.getId()); - getSelectionActions().add(addAction.getId()); - getSelectionActions().add(removeAction.getId()); - getSelectionActions().add(changeEvent.getId()); - - viewer.setEditPartFactory(new StateMachinesEditPartFactory()); - viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer)); - viewer.setRootEditPart(root); - - // configure the context menu provider - ContextMenuProvider cmProvider = new StateMachinesEditorContextMenuProvider( - viewer, getActionRegistry()); - viewer.setContextMenu(cmProvider); - getSite().registerContextMenu(cmProvider, viewer); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.ui.parts.GraphicalEditor#commandStackChanged(java.util.EventObject) - */ - - public void commandStackChanged(EventObject event) { - firePropertyChange(IEditorPart.PROP_DIRTY); - super.commandStackChanged(event); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette#createPaletteViewerProvider() - */ - - protected PaletteViewerProvider createPaletteViewerProvider() { - return new PaletteViewerProvider(getEditDomain()) { - protected void configurePaletteViewer(PaletteViewer viewer) { - super.configurePaletteViewer(viewer); - // create a drag source listener for this palette viewer - // together with an appropriate transfer drop target listener, - // this will enable - // model element creation by dragging a - // CombinatedTemplateCreationEntries - // from the palette into the editor - // @see StateMachinesEditor#createTransferDropTargetListener() - viewer.addDragSourceListener(new TemplateTransferDragSourceListener( - viewer)); - } - }; - } - - /** - * Create a transfer drop target listener. When using a - * CombinedTemplateCreationEntry tool in the palette, this will enable model - * element creation by dragging from the palette. - * - * @see #createPaletteViewerProvider() - */ - - private TransferDropTargetListener createTransferDropTargetListener() { - return new TemplateTransferDropTargetListener(getGraphicalViewer()) { - protected CreationFactory getFactory(Object template) { - return new SimpleFactory((Class) template); - } - }; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor) - */ - - public void doSave(IProgressMonitor monitor) { - saved = true; - getCommandStack().markSaveLocation(); - ReadDOMTree tree = DOMGetInstance.getInstance(); - diagram.removeFromRoot(tree); - diagram.addToRoot(tree); - tree.writeTree(); - } - - /** - * @return the StateMachinesDiagram for this editor - */ - public StateMachinesDiagram getDiagram() { - return diagram; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.ISaveablePart#doSaveAs() - */ - - public void doSaveAs() { - saved = true; - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - FileDialog fileDialog = new FileDialog(shell, SWT.SAVE); - fileDialog.setFilterExtensions(new String[] {"*.xml"}); - fileDialog.open(); - String file2 = fileDialog.getFilterPath().toString() + File.separator + fileDialog.getFileName().toString(); - getCommandStack().markSaveLocation(); - ReadDOMTree tree = DOMGetInstance.getInstance(); - diagram.removeFromRoot(tree); - diagram.addToRoot(tree); - tree.writeTree(file2); - } - - public Object getAdapter(Class type) { - if (type == ZoomManager.class) - return getGraphicalViewer().getProperty(ZoomManager.class.toString()); - if (type == IContentOutlinePage.class) - return new StateMachinesOutlinePage(new TreeViewer()); - return super.getAdapter(type); - } - - StateMachinesDiagram getModel() { - return diagram; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette#getPalettePreferences() - */ - - protected FlyoutPreferences getPalettePreferences() { - return StateMachinesEditorPaletteFactory.createPalettePreferences(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette#getPaletteRoot() - */ - - protected PaletteRoot getPaletteRoot() { - if (PALETTE_MODEL == null) - PALETTE_MODEL = StateMachinesEditorPaletteFactory.createPalette(); - return PALETTE_MODEL; - } - - /** - * Opens an editor for the selected diagram "stateMachineName" - * @param stateMachineName Name of statemachine in this diagram - */ - - private void openEditor(String stateMachineName) { - ReadDOMTree tree = DOMGetInstance.getInstance(); - // open diagram in editor - List allDiagrams = tree.getAllDiagrams(); - for (int j = 0; j < allDiagrams.size(); j++) { - StateMachinesDiagram dia = (StateMachinesDiagram) allDiagrams.get(j); - if (dia.getStateMachineName().equals(stateMachineName)) { - diagram = dia; - diagram.setEditor(this); - break; - } - } - setPartName1(stateMachineName); - } - - public void setPartName1(String name) { - setPartName(name); - } - - /** - * Set up the editor's inital content (after creation). - * - * @see org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette#initializeGraphicalViewer() - */ - - protected void initializeGraphicalViewer() { - super.initializeGraphicalViewer(); - GraphicalViewer viewer = getGraphicalViewer(); - // set the contents of this editor - viewer.setContents(getModel()); - // listen for dropped parts - viewer.addDropTargetListener(createTransferDropTargetListener()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed() - */ - - public boolean isSaveAsAllowed() { - return true; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.part.EditorPart#setInput(org.eclipse.ui.IEditorInput) - */ - protected void setInput(IEditorInput input) { - super.setInput(input); - IFile file = ((IFileEditorInput) input).getFile(); - // get filename without .states extension - String file1 = file.getName().toString(); - int length = file1.length(); - String filename = file1.subSequence(0, length-7).toString(); - openEditor(filename); - } - - public void dispose() { - if (!saved) { - diagram.changeToOldName(); - } - if (StateMachinesList.isDebugMode()) { - DebugEventsList.closeView(); - } - ReadDOMTree tree = DOMGetInstance.getInstance(); - tree.removeDiagram(diagram); - } - - /** - * Creates an outline pagebook for this editor. - */ - - public class StateMachinesOutlinePage extends ContentOutlinePage { - /** - * Create a new outline page for the GetDOMStateMachines editor. - * - * @param viewer - * a viewer (TreeViewer instance) used for this outline page - * @throws IllegalArgumentException - * if editor is null - */ - - public StateMachinesOutlinePage(EditPartViewer viewer) { - super(viewer); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite) - */ - - public void createControl(Composite parent) { - // create outline viewer page - getViewer().createControl(parent); - // configure outline viewer - getViewer().setEditDomain(getEditDomain()); - getViewer().setEditPartFactory( - new StateMachinesTreeEditPartFactory()); - // configure & add context menu to viewer - ContextMenuProvider cmProvider = new StateMachinesEditorContextMenuProvider( - getViewer(), getActionRegistry()); - getViewer().setContextMenu(cmProvider); - getSite().registerContextMenu("stateMachines.outline.contextmenu", - cmProvider, getSite().getSelectionProvider()); - // hook outline viewer - getSelectionSynchronizer().addViewer(getViewer()); - // initialize outline viewer with model - getViewer().setContents(getModel()); - // show outline viewer - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.part.IPage#dispose() - */ - - public void dispose() { - // unhook outline viewer - getSelectionSynchronizer().removeViewer(getViewer()); - // dispose - super.dispose(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.part.IPage#getControl() - */ - - public Control getControl() { - return getViewer().getControl(); - } - - /** - * @see org.eclipse.ui.part.IPageBookViewPage#init(org.eclipse.ui.part.IPageSite) - */ - - public void init(IPageSite pageSite) { - super.init(pageSite); - ActionRegistry registry = getActionRegistry(); - IActionBars bars = pageSite.getActionBars(); - String id = ActionFactory.UNDO.getId(); - bars.setGlobalActionHandler(id, registry.getAction(id)); - id = ActionFactory.REDO.getId(); - bars.setGlobalActionHandler(id, registry.getAction(id)); - id = ActionFactory.DELETE.getId(); - bars.setGlobalActionHandler(id, registry.getAction(id)); - } - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditorActionBarContributor.java b/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditorActionBarContributor.java deleted file mode 100644 index a44eab3775..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditorActionBarContributor.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package stateMachines; - -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.ui.actions.ActionFactory; - -import org.eclipse.gef.editparts.ZoomManager; -import org.eclipse.gef.ui.actions.ActionBarContributor; -import org.eclipse.gef.ui.actions.DeleteRetargetAction; -import org.eclipse.gef.ui.actions.GEFActionConstants; -import org.eclipse.gef.ui.actions.RedoRetargetAction; -import org.eclipse.gef.ui.actions.UndoRetargetAction; -import org.eclipse.gef.ui.actions.ZoomComboContributionItem; -import org.eclipse.gef.ui.actions.ZoomInRetargetAction; -import org.eclipse.gef.ui.actions.ZoomOutRetargetAction; - -import actions.AddRetargetAction; -import actions.ChangeRetargetAction; -import actions.ChangeRetargetEvent; -import actions.RemoveRetargetAction; - -/** - * @author Daniel - */ -public class StateMachinesEditorActionBarContributor extends - ActionBarContributor { - - /** - * Create actions managed by this contributor. - * - * @see org.eclipse.gef.ui.actions.ActionBarContributor#buildActions() - */ - protected void buildActions() { - addRetargetAction(new DeleteRetargetAction()); - addRetargetAction(new UndoRetargetAction()); - addRetargetAction(new RedoRetargetAction()); - addRetargetAction(new ZoomOutRetargetAction()); - addRetargetAction(new ZoomInRetargetAction()); - addRetargetAction(new ChangeRetargetAction()); - addRetargetAction(new AddRetargetAction()); - addRetargetAction(new RemoveRetargetAction()); - addRetargetAction(new ChangeRetargetEvent()); - } - - /** - * Add actions to the given toolbar. - * - * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(org.eclipse.jface.action.IToolBarManager) - */ - public void contributeToToolBar(IToolBarManager toolBarManager) { - toolBarManager.add(getAction(ActionFactory.DELETE.getId())); - toolBarManager.add(getAction(ActionFactory.UNDO.getId())); - toolBarManager.add(getAction(ActionFactory.REDO.getId())); - toolBarManager.add(new Separator()); - toolBarManager.add(getAction(GEFActionConstants.ZOOM_OUT)); - toolBarManager.add(getAction(GEFActionConstants.ZOOM_IN)); - toolBarManager.add(new Separator()); - String[] zoomStrings = new String[] { ZoomManager.FIT_ALL, - ZoomManager.FIT_HEIGHT, - ZoomManager.FIT_WIDTH }; - toolBarManager.add(new ZoomComboContributionItem(getPage(), zoomStrings)); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.ui.actions.ActionBarContributor#declareGlobalActionKeys() - */ - protected void declareGlobalActionKeys() { - // currently none - } -} diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditorContextMenuProvider.java b/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditorContextMenuProvider.java deleted file mode 100644 index 859b4b8a3d..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditorContextMenuProvider.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package stateMachines; - -import java.util.ArrayList; -import java.util.List; - -import model.Action; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.ui.actions.ActionFactory; - -import org.eclipse.gef.ContextMenuProvider; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.ui.actions.ActionRegistry; -import org.eclipse.gef.ui.actions.GEFActionConstants; - -import stateMachinesList.StateMachinesList; - -import dom.DOMGetInstance; -import dom.ReadActionAndEventDOMTree; - -import actions.AddAction; -import actions.ChangeAction; -import actions.ChangeEvent; -import actions.RemoveAction; - -/** - * @author Daniel - */ -public class StateMachinesEditorContextMenuProvider extends ContextMenuProvider implements IMenuListener { - - /** The editor's action registry. */ - private ActionRegistry actionRegistry; - private static Action action; - private List actions = new ArrayList(); - - private MenuManager submenu = null; - - /** - * Instantiate a new menu context provider for the specified EditPartViewer - * and ActionRegistry. - * - * @param viewer - * the editor's graphical viewer - * @param registry - * the editor's action registry - * @param editor - * @throws IllegalArgumentException - * if registry is null. - */ - public StateMachinesEditorContextMenuProvider(EditPartViewer viewer, - ActionRegistry registry) { - super(viewer); - if (registry == null) { - throw new IllegalArgumentException(); - } - setActionRegistry(registry); - } - - /** - * Called when the context menu is about to show. Actions, whose state is - * enabled, will appear in the context menu. - * - * @see org.eclipse.gef.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager) - */ - public void buildContextMenu(IMenuManager menu) { - - // Add standard action groups to the menu - GEFActionConstants.addStandardActionGroups(menu); - - IAction action; - if (!(StateMachinesList.isDebugMode())) { - action = getActionRegistry().getAction(ActionFactory.UNDO.getId()); - menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); - - action = getActionRegistry().getAction(ActionFactory.REDO.getId()); - menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); - - action = getActionRegistry().getAction(ActionFactory.SAVE.getId()); - menu.appendToGroup(GEFActionConstants.GROUP_SAVE, action); - - action = getActionRegistry().getAction(ActionFactory.DELETE.getId()); - if (action.isEnabled()) - menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action); - - action = getActionRegistry().getAction(ChangeEvent.CHANGE_EVENT); - if (action.isEnabled()) - menu.appendToGroup(GEFActionConstants.GROUP_ADD, action); - - action = getActionRegistry().getAction(AddAction.ADD_ACTION); - if (action.isEnabled()) - menu.appendToGroup(GEFActionConstants.GROUP_ADD, action); - - action = getActionRegistry().getAction(RemoveAction.REMOVE_ACTION); - if (action.isEnabled()) { - actions = RemoveAction.actionList; - if (!(actions.isEmpty())) { - for (int i = 0; i < actions.size(); i++) { - Action act = (Action) actions.get(i); - ReadActionAndEventDOMTree actionTree = DOMGetInstance.getActionAndEventInstance(); - submenu = new MenuManager(actionTree.getActionName(act.getActionId()), Integer.toString(i)); - submenu.addMenuListener(listener); - action = getActionRegistry().getAction(RemoveAction.REMOVE_ACTION); - submenu.add(action); - action = getActionRegistry().getAction(ChangeAction.CHANGE_ACTION); - submenu.add(action); - if (!submenu.isEmpty()) { - menu.appendToGroup(GEFActionConstants.GROUP_REST, submenu); - } - } - } - } - } - } - - - - /** - * registers the selected action in the context menu - */ - IMenuListener listener = new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - action = (Action) actions.get(Integer.parseInt(manager.getId())); - } - }; - - /** - * returns the selected action from the context menu - */ - public static Action getAction() { - return action; - } - - /** - * @return the editor's action registry - */ - private ActionRegistry getActionRegistry() { - return actionRegistry; - } - - /** - * @param registry sets the editor's action registry - */ - private void setActionRegistry(ActionRegistry registry) { - actionRegistry = registry; - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditorPaletteFactory.java b/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditorPaletteFactory.java deleted file mode 100644 index dc0daf694a..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesEditorPaletteFactory.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Created on 05.07.2005 - */ -package stateMachines; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.ImageDescriptor; - -import org.eclipse.gef.palette.CombinedTemplateCreationEntry; -import org.eclipse.gef.palette.ConnectionCreationToolEntry; -import org.eclipse.gef.palette.MarqueeToolEntry; -import org.eclipse.gef.palette.PaletteContainer; -import org.eclipse.gef.palette.PaletteDrawer; -import org.eclipse.gef.palette.PaletteGroup; -import org.eclipse.gef.palette.PaletteRoot; -import org.eclipse.gef.palette.PaletteSeparator; -import org.eclipse.gef.palette.PanningSelectionToolEntry; -import org.eclipse.gef.palette.ToolEntry; -import org.eclipse.gef.requests.CreationFactory; -import org.eclipse.gef.requests.SimpleFactory; -import org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferences; - -import model.Connection; -import model.StartState; -import model.NormalState; -import model.EndState; - - -/** - * Utility class that can create a GEF Palette. - * - * @see #createPalette() - * @author Daniel - */ -final class StateMachinesEditorPaletteFactory { - - /** Preference ID used to persist the palette location. */ - private static final String PALETTE_DOCK_LOCATION = "StateMachinesEditorPaletteFactory.Location"; - - /** Preference ID used to persist the palette size. */ - private static final String PALETTE_SIZE = "StateMachinesEditorPaletteFactory.Size"; - - /** Preference ID used to persist the flyout palette's state. */ - private static final String PALETTE_STATE = "StateMachinesEditorPaletteFactory.State"; - - /** Create the "States" drawer. */ - private static PaletteContainer createStatesDrawer() { - PaletteDrawer componentsDrawer = new PaletteDrawer("States"); - - CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry( - "Startstate", "Create a startstate", StartState.class, - new SimpleFactory(StartState.class), ImageDescriptor - .createFromFile(StateMachinesPlugin.class, - "ellipse16.gif"), ImageDescriptor - .createFromFile(StateMachinesPlugin.class, - "ellipse24.gif")); - componentsDrawer.add(component); - - component = new CombinedTemplateCreationEntry("Normalstate", - "Create a state", NormalState.class, new SimpleFactory( - NormalState.class), ImageDescriptor - .createFromFile(StateMachinesPlugin.class, - "rectangle16.gif"), ImageDescriptor - .createFromFile(StateMachinesPlugin.class, - "rectangle24.gif")); - componentsDrawer.add(component); - - component = new CombinedTemplateCreationEntry("Endstate", - "Create an endstate", EndState.class, - new SimpleFactory(EndState.class), ImageDescriptor - .createFromFile(StateMachinesPlugin.class, - "rectangle16.gif"), ImageDescriptor - .createFromFile(StateMachinesPlugin.class, - "rectangle24.gif")); - componentsDrawer.add(component); - - return componentsDrawer; - } - - /** - * Creates the PaletteRoot and adds all palette elements. Use this factory - * method to create a new palette for your graphical editor. - * - * @return a new PaletteRoot - */ - static PaletteRoot createPalette() { - PaletteRoot palette = new PaletteRoot(); - palette.add(createToolsGroup(palette)); - palette.add(createStatesDrawer()); - return palette; - } - - /** - * Return a FlyoutPreferences instance used to save/load the preferences of - * a flyout palette. - */ - static FlyoutPreferences createPalettePreferences() { - return new FlyoutPreferences() { - private IPreferenceStore getPreferenceStore() { - return StateMachinesPlugin.getDefault().getPreferenceStore(); - } - - public int getDockLocation() { - return getPreferenceStore().getInt(PALETTE_DOCK_LOCATION); - } - - public int getPaletteState() { - return getPreferenceStore().getInt(PALETTE_STATE); - } - - public int getPaletteWidth() { - return getPreferenceStore().getInt(PALETTE_SIZE); - } - - public void setDockLocation(int location) { - getPreferenceStore().setValue(PALETTE_DOCK_LOCATION, location); - } - - public void setPaletteState(int state) { - getPreferenceStore().setValue(PALETTE_STATE, state); - } - - public void setPaletteWidth(int width) { - getPreferenceStore().setValue(PALETTE_SIZE, width); - } - }; - } - - /** Create the "Tools" group. */ - private static PaletteContainer createToolsGroup(PaletteRoot palette) { - PaletteGroup toolGroup = new PaletteGroup("Tools"); - - // Add a selection tool to the group - ToolEntry tool = new PanningSelectionToolEntry(); - toolGroup.add(tool); - palette.setDefaultEntry(tool); - - // Add a marquee tool to the group - toolGroup.add(new MarqueeToolEntry()); - - // Add a (unnamed) separator to the group - toolGroup.add(new PaletteSeparator()); - - // Add (solid-line) connection tool - tool = new ConnectionCreationToolEntry("Transition", - "Create a transition between states", new CreationFactory() { - public Object getNewObject() { - return null; - } - - // see StateMachinesEditPart#createEditPolicies() - // this is abused to transmit the desired line style - public Object getObjectType() { - return Connection.SOLID_CONNECTION; - } - }, ImageDescriptor.createFromFile(StateMachinesPlugin.class, - "connection_s16.gif"), ImageDescriptor.createFromFile( - StateMachinesPlugin.class, "connection_s24.gif")); - toolGroup.add(tool); - - return toolGroup; - } - - /** Utility class. */ - private StateMachinesEditorPaletteFactory() { - // Utility class - } - -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesPlugin.java b/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesPlugin.java deleted file mode 100644 index ff84874ebb..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachines/StateMachinesPlugin.java +++ /dev/null @@ -1,32 +0,0 @@ -package stateMachines; - -import org.eclipse.ui.IWorkbenchPreferenceConstants; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * The main plugin class to be used in the desktop. - */ -public class StateMachinesPlugin extends AbstractUIPlugin implements IWorkbenchPreferenceConstants{ - - /** Single plugin instance. */ - private static StateMachinesPlugin singleton; - - /** - * Returns the shared plugin instance. - */ - public static StateMachinesPlugin getDefault() { - // all editors should be closed on exit eclipse - PlatformUI.getPreferenceStore().putValue(CLOSE_EDITORS_ON_EXIT, "true"); - return singleton; - } - - /** - * The constructor. - */ - public StateMachinesPlugin() { - if (singleton == null) { - singleton = this; - } - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/connection_d16.gif b/Build/Tools/StateMachineEditor/src/stateMachines/connection_d16.gif deleted file mode 100644 index 44a7e413a2..0000000000 Binary files a/Build/Tools/StateMachineEditor/src/stateMachines/connection_d16.gif and /dev/null differ diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/connection_d24.gif b/Build/Tools/StateMachineEditor/src/stateMachines/connection_d24.gif deleted file mode 100644 index 628db5ce80..0000000000 Binary files a/Build/Tools/StateMachineEditor/src/stateMachines/connection_d24.gif and /dev/null differ diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/connection_s16.gif b/Build/Tools/StateMachineEditor/src/stateMachines/connection_s16.gif deleted file mode 100644 index de4a2d0f10..0000000000 Binary files a/Build/Tools/StateMachineEditor/src/stateMachines/connection_s16.gif and /dev/null differ diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/connection_s24.gif b/Build/Tools/StateMachineEditor/src/stateMachines/connection_s24.gif deleted file mode 100644 index 66a5fe72be..0000000000 Binary files a/Build/Tools/StateMachineEditor/src/stateMachines/connection_s24.gif and /dev/null differ diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/ellipse16.gif b/Build/Tools/StateMachineEditor/src/stateMachines/ellipse16.gif deleted file mode 100644 index 03f9cdc690..0000000000 Binary files a/Build/Tools/StateMachineEditor/src/stateMachines/ellipse16.gif and /dev/null differ diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/ellipse24.gif b/Build/Tools/StateMachineEditor/src/stateMachines/ellipse24.gif deleted file mode 100644 index 2d60c0ca87..0000000000 Binary files a/Build/Tools/StateMachineEditor/src/stateMachines/ellipse24.gif and /dev/null differ diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/rectangle16.gif b/Build/Tools/StateMachineEditor/src/stateMachines/rectangle16.gif deleted file mode 100644 index d441c8d0e3..0000000000 Binary files a/Build/Tools/StateMachineEditor/src/stateMachines/rectangle16.gif and /dev/null differ diff --git a/Build/Tools/StateMachineEditor/src/stateMachines/rectangle24.gif b/Build/Tools/StateMachineEditor/src/stateMachines/rectangle24.gif deleted file mode 100644 index a87c8819f7..0000000000 Binary files a/Build/Tools/StateMachineEditor/src/stateMachines/rectangle24.gif and /dev/null differ diff --git a/Build/Tools/StateMachineEditor/src/stateMachinesList/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/stateMachinesList/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachinesList/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/stateMachinesList/CopyStateMachine.java b/Build/Tools/StateMachineEditor/src/stateMachinesList/CopyStateMachine.java deleted file mode 100644 index 3399396be7..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachinesList/CopyStateMachine.java +++ /dev/null @@ -1,94 +0,0 @@ -package stateMachinesList; - -import java.util.List; - -import model.StateMachinesDiagram; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Path; -import org.eclipse.ui.PlatformUI; -import org.jdom.Element; - -import stateMachines.StateMachinesEditor; - -import dom.DOMGetInstance; -import dom.ReadDOMTree; - -public class CopyStateMachine { - - private String machine; - private String name; - private IContainer container; - private IFile file; - private StateMachinesDiagram diagram; - private Element machineElement; - - /** - * constructor for copy action - * @param machine statemachine which should be copied - * @param name name for the new statemachine - * @param container container in which the statemachine is located - */ - public CopyStateMachine(String machine, String name, IContainer container) { - this.machine = machine; - this.name = name; - this.container = container; - } - - /** - * executes the copy command - */ - public void execute(){ - Element machineEle = null; - StateMachinesList.allNames.add(name); - StateMachinesList.viewer.add(name); - ReadDOMTree tree = DOMGetInstance.getInstance(); - List allMachineEles = tree.getStateMachines(); - for (int i = 0; i < allMachineEles.size(); i++) { - machineEle = (Element) allMachineEles.get(i); - if (machineEle.getAttributeValue("NAME").equals(machine)) { - break; - } - } - Element machineEle1 = (Element) machineEle.clone(); - machineEle1.setAttribute("NAME", name); - tree.addStateMachine1(machineEle1); - file = container.getFile(new Path(name + ".states")); - StateMachinesList.stateMachinesList.add(file); - } - - /** - * deletes the new statemachine - */ - public void undo(){ - ReadDOMTree tree = DOMGetInstance.getInstance(); - diagram = tree.getStateMachinesDiagram(name); - if (!(diagram == null)) { - StateMachinesEditor editor1 = diagram.getEditor(); - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(editor1, true); - } - machineElement = tree.removeStateMachine1(name); - StateMachinesList.viewer.remove(name); - StateMachinesList.stateMachinesList.remove(file); - } - - /** - * undo functionallity when the listview is closed without saving - */ - public void undoForDispose(){ - ReadDOMTree tree = DOMGetInstance.getInstance(); - tree.removeStateMachine1(name); - } - - /** - * recreates the new statemachine - */ - public void redo(){ - StateMachinesList.allNames.add(name); - StateMachinesList.viewer.add(name); - ReadDOMTree tree = DOMGetInstance.getInstance(); - tree.addStateMachine1(machineElement); - StateMachinesList.stateMachinesList.add(file); - } -} diff --git a/Build/Tools/StateMachineEditor/src/stateMachinesList/DeleteStateMachine.java b/Build/Tools/StateMachineEditor/src/stateMachinesList/DeleteStateMachine.java deleted file mode 100644 index ae088b479c..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachinesList/DeleteStateMachine.java +++ /dev/null @@ -1,82 +0,0 @@ -package stateMachinesList; - -import model.StateMachinesDiagram; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Path; -import org.eclipse.ui.PlatformUI; -import org.jdom.Element; - -import stateMachines.StateMachinesEditor; -import dom.DOMGetInstance; -import dom.ReadDOMTree; - -public class DeleteStateMachine { - - private String machine; - private IContainer container; - private IFile file; - private StateMachinesDiagram diagram; - private Element machineElement; - - /** - * constructor for delete action - * @param machine statemachine which should be deleted - * @param container container in which the statemachine is located - */ - public DeleteStateMachine(String machine, IContainer container) { - this.machine = machine; - this.container = container; - } - - /** - * executes the delete command - * @return successful - */ - public boolean execute(){ - ReadDOMTree tree = DOMGetInstance.getInstance(); - diagram = tree.getStateMachinesDiagram(machine); - // close the editor - if (!(diagram == null)) { - StateMachinesEditor editor1 = diagram.getEditor(); - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(editor1, true); - } - machineElement = tree.removeStateMachine1(machine); - StateMachinesList.viewer.remove(machine); - for (int i = 0; i < StateMachinesList.stateMachinesList.size(); i++) { - file = (IFile) StateMachinesList.stateMachinesList.get(i); - if (file.getName().equals(machine + ".states")) { - StateMachinesList.stateMachinesList.remove(i); - return true; - } - } - return false; - } - - /** - * recreates the statemachine - */ - public void undo(){ - ReadDOMTree tree = DOMGetInstance.getInstance(); - tree.addStateMachine1(machineElement); - StateMachinesList.viewer.add(machine); - file = container.getFile(new Path(machine + ".states")); - StateMachinesList.stateMachinesList.add(file); - } - - /** - * undo functionallity when the listview is closed without saving - */ - public void undoForDispose(){ - ReadDOMTree tree = DOMGetInstance.getInstance(); - tree.addStateMachine1(machineElement); - } - - /** - * redeletes the statemachine - */ - public void redo(){ - execute(); - } -} diff --git a/Build/Tools/StateMachineEditor/src/stateMachinesList/StateMachinesList.java b/Build/Tools/StateMachineEditor/src/stateMachinesList/StateMachinesList.java deleted file mode 100644 index 7561261bb5..0000000000 --- a/Build/Tools/StateMachineEditor/src/stateMachinesList/StateMachinesList.java +++ /dev/null @@ -1,606 +0,0 @@ -package stateMachinesList; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.JOptionPane; - -import model.StateMachinesDiagram; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.GroupMarker; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.ISaveablePart; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.part.ViewPart; -import org.jdom.Element; - -import dom.DOMGetInstance; -import dom.ReadDOMTree; - -public class StateMachinesList extends ViewPart implements ISaveablePart, IDoubleClickListener { - - Action deleteItemAction, renameItemAction, copyItemAction; - static Action redoAction, undoAction; - static List stateMachinesList = new ArrayList(); - static Composite parent; - static ListViewer viewer = null; - static IFile machineName; - static String fileName; - public static List allNames = new ArrayList(); - private static List undoList = new ArrayList(); - private static List redoList = new ArrayList(); - private static List undoNewStateMachine = new ArrayList(); - - public static final String DELETE = "delete statemachine"; - public static final String RENAME = "rename statemachine"; - public static final String COPY = "copy statemachine"; - public static final String DOUBLE_CLICK_ACTION = "Double_Click_ActionId"; - private static boolean dirty = false; - private boolean isSaved = false; - private boolean workbenchIsClosing = false; - private static StateMachinesList view; - private static boolean debugMode = false; - - /** - * the constructor for this view - */ - public StateMachinesList() { - super(); - view = this; - } - - /** - * hides this view, asks for save if it is modified - */ - public static void closeView() { - IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - page1.hideView(view); - } - - /** - * adds a statemachine to this view at startup - * @param file statemachine name with .states extension - * @param fileName the name of the statemachine - */ - public static void addToStateMachinesList(IFile file, String fileName) { - stateMachinesList.add(file); - viewer.add(fileName); - allNames.add(fileName); - } - - /** - * adds a newly created statemachine to this view - * @param file statemachine name with .states extension - * @param fileName the name of the statemachine - */ - public static void addToStateMachinesList2(IFile file, String fileName) { - ReadDOMTree tree = DOMGetInstance.getInstance(); - Element machine = new Element("stateMachine"); - machine.setAttribute("NAME", fileName); - tree.addStateMachine1(machine); - undoNewStateMachine.add(machine); - stateMachinesList.add(file); - viewer.add(fileName); - allNames.add(fileName); - dirty = true; - } - - /** - * deletes all new statemachines if StateMachinesList is not saved. - * New statemachines with an open modified Editor can still be saved - * when the editor closes. - */ - private void undoCreateNewStateMachine() { - ReadDOMTree tree = DOMGetInstance.getInstance(); - for (int i = 0; i < undoNewStateMachine.size(); i++) { - Element machineEle = (Element) undoNewStateMachine.get(i); - tree.removeStateMachine1(machineEle.getAttributeValue("NAME")); - } - } - - /** - * changes the name of a statemachine in the view - * @param oldName old name to remove from list - * @param newName new name to add to list - */ - public static void changeStateMachineName(String oldName, String newName) { - for (int i = 0; i < stateMachinesList.size(); i++) { - IFile name = (IFile) stateMachinesList.get(i); - if (name.getName().equals(oldName + ".states")) { - stateMachinesList.remove(i); - final IFile file1 = DOMGetInstance.getContainer().getFile(new Path(newName + ".states")); - stateMachinesList.add(file1); - viewer.remove(oldName); - viewer.add(newName); - break; - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ - public void createPartControl(Composite parent) { - viewer = new ListViewer(parent); - viewer.setSorter(new ViewerSorter()); - for (int i = 0; i < stateMachinesList.size(); i++) { - machineName = (IFile) stateMachinesList.get(i); - fileName = machineName.getName(); - int length = fileName.length(); - fileName = fileName.subSequence(0, length-7).toString(); - viewer.add(fileName); - } - viewer.addDoubleClickListener(this); - createActions(); - createContextMenu(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#setFocus() - */ - public void setFocus() { - viewer.getControl().setFocus(); - } - - /** - * clears all lists in this view - */ - public static void reset() { - dirty = false; - for (int i = 0; i < stateMachinesList.size(); i++) { - machineName = (IFile) stateMachinesList.get(i); - fileName = machineName.getName(); - int length = fileName.length(); - fileName = fileName.subSequence(0, length-7).toString(); - viewer.remove(fileName); - } - stateMachinesList.clear(); - allNames.clear(); - undoList.clear(); - redoList.clear(); - undoAction.setEnabled(false); - undoAction.setText("Undo"); - redoAction.setEnabled(false); - redoAction.setText("Redo"); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) - */ - public void doubleClick(DoubleClickEvent event) { - // opens the selected statemachine editor if not in debug-mode - if (!(debugMode)) { - fileName = (String) ((IStructuredSelection)viewer.getSelection()).getFirstElement(); - for (int i = 0; i < stateMachinesList.size(); i++) { - machineName = (IFile) stateMachinesList.get(i); - if (machineName.getName().equals(fileName + ".states")) { - break; - } - } - try { - Element machine = null; - ReadDOMTree tree = DOMGetInstance.getInstance(); - List allMachines = tree.getStateMachines(); - for (int i = 0; i < allMachines.size(); i++) { - machine = (Element) allMachines.get(i); - if (machine.getAttributeValue("NAME").equals(fileName)) { - break; - } - } - if (!(machine == null)) { - StateMachinesDiagram diagram = new StateMachinesDiagram(machine); - tree.addDiagram(diagram); - IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), machineName, true); - } - } catch (PartInitException e) { - e.printStackTrace(); - } - } - } - - /** - * creates the context menu for this view - */ - private void createContextMenu() { - //create menu manager - MenuManager menuMgr = new MenuManager(); - menuMgr.setRemoveAllWhenShown(true); - menuMgr.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager mgr) { - fillContextMenu(mgr); - } - }); - - // Create menu - Menu menu = menuMgr.createContextMenu(viewer.getControl()); - viewer.getControl().setMenu(menu); - - // Register menu for extension - getSite().registerContextMenu(menuMgr, viewer); - } - - /** - * fills the context menu with actions - * @param mgr the IMenuManager - */ - private void fillContextMenu(IMenuManager mgr) { - mgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - mgr.add(undoAction); - mgr.add(redoAction); - mgr.add(new Separator()); - mgr.add(deleteItemAction); - mgr.add(copyItemAction); - mgr.add(new Separator("Additions")); - } - - /** - * creates the actions for the context menu - */ - private void createActions() { - undoAction = new Action("Undo") { - public void run() { - undo(); - } - }; - undoAction.setEnabled(false); - Image image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_UNDO); - undoAction.setImageDescriptor(ImageDescriptor.createFromImage(image)); - - - redoAction = new Action("Redo") { - public void run() { - redo(); - } - }; - redoAction.setEnabled(false); - Image imag = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_REDO); - redoAction.setImageDescriptor(ImageDescriptor.createFromImage(imag)); - - - deleteItemAction = new Action("Delete") { - public void run() { - deleteItem(); - } - }; - deleteItemAction.setEnabled(false); - Image ima = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE); - deleteItemAction.setImageDescriptor(ImageDescriptor.createFromImage(ima)); - - copyItemAction = new Action("Copy") { - public void run() { - copyItem(); - } - }; - copyItemAction.setEnabled(false); - Image i = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_COPY); - copyItemAction.setImageDescriptor(ImageDescriptor.createFromImage(i)); - - // Add selection listener. - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateActionEnablement(); - } - }); - } - - /** - * updates whether an actionitem is selectable - */ - private void updateActionEnablement() { - if (debugMode) { - deleteItemAction.setEnabled(false); - copyItemAction.setEnabled(false); - } - else { - IStructuredSelection sel = (IStructuredSelection)viewer.getSelection(); - deleteItemAction.setEnabled(sel.size() > 0 && sel.size() < 2); - copyItemAction.setEnabled(sel.size() > 0 && sel.size() < 2); - } - } - - /** - * the undo functionality for this view - */ - private void undo() { - // undo delete statemachine - if (undoList.get(undoList.size()-1) instanceof DeleteStateMachine) { - DeleteStateMachine delete = (DeleteStateMachine) undoList.get(undoList.size()-1); - delete.undo(); - redoAction.setText("Redo " + DELETE); - redoList.add(delete); - redoAction.setEnabled(true); - undoList.remove(undoList.size()-1); - } - // undo create statemachine - else if (undoList.get(undoList.size()-1) instanceof CopyStateMachine) { - CopyStateMachine copy = (CopyStateMachine) undoList.get(undoList.size()-1); - copy.undo(); - redoAction.setText("Redo " + COPY); - redoList.add(copy); - redoAction.setEnabled(true); - undoList.remove(undoList.size()-1); - } - if (undoList.size() == 0) { - dirty = false; - undoAction.setEnabled(false); - undoAction.setText("Undo"); - } - else if (undoList.get(undoList.size()-1) instanceof DeleteStateMachine){ - undoAction.setText("Undo " + DELETE); - } - else if (undoList.get(undoList.size()-1) instanceof CopyStateMachine){ - undoAction.setText("Undo " + COPY); - } - } - - /** - * the redo functionality for this view - */ - private void redo() { - // redo delete statemachine - if (redoList.get(redoList.size()-1) instanceof DeleteStateMachine) { - DeleteStateMachine delete = (DeleteStateMachine) redoList.get(redoList.size()-1); - delete.redo(); - undoAction.setText("Undo " + DELETE); - undoList.add(delete); - undoAction.setEnabled(true); - redoList.remove(redoList.size()-1); - } - // redo copy statemachine - else if (redoList.get(redoList.size()-1) instanceof CopyStateMachine) { - CopyStateMachine copy = (CopyStateMachine) redoList.get(redoList.size()-1); - copy.redo(); - undoAction.setText("Undo " + COPY); - undoList.add(copy); - undoAction.setEnabled(true); - redoList.remove(redoList.size()-1); - } - if (redoList.size() == 0) { - redoAction.setEnabled(false); - redoAction.setText("Redo"); - } - else if (redoList.get(redoList.size()-1) instanceof DeleteStateMachine){ - redoAction.setText("Redo " + DELETE); - } - else if (redoList.get(redoList.size()-1) instanceof CopyStateMachine){ - redoAction.setText("Redo " + COPY); - } - } - - /** - * Remove item from list. - */ - private void deleteItem() { - fileName = (String) ((IStructuredSelection)viewer.getSelection()).getFirstElement(); - DeleteStateMachine delete = new DeleteStateMachine(fileName, DOMGetInstance.getContainer()); - if (delete.execute()) { - dirty = true; - redoList.clear(); - redoAction.setEnabled(false); - redoAction.setText("Redo"); - undoList.add(delete); - undoAction.setText("Undo " + DELETE); - undoAction.setEnabled(true); - } - } - - /** - * makes a copy of the selected statemachine and saves it under an entered name - */ - private void copyItem() { - String machine = (String) ((IStructuredSelection)viewer.getSelection()).getFirstElement(); - String name = promptForValue("Enter name for copy:", null); - boolean exist = false; - for (int j = 0; j < allNames.size(); j++) { - if (allNames.get(j).toString().equals(name)) { - exist = true; - break; - } - } - if (!(name == null) && !(name.equals("")) && exist == false) { - dirty = true; - redoList.clear(); - redoAction.setEnabled(false); - redoAction.setText("Redo"); - CopyStateMachine copy = new CopyStateMachine(machine, name, DOMGetInstance.getContainer()); - undoList.add(copy); - copy.execute(); - undoAction.setEnabled(true); - undoAction.setText("Undo " + COPY); - } - else if (name == null || name.equals("")) { - JOptionPane.showMessageDialog(null, "You have to enter a name for the new statemachine!", - "Error Message", JOptionPane.ERROR_MESSAGE); - } - else if (exist == true) { - JOptionPane.showMessageDialog(null, "Name already exists!", - "Error Message", JOptionPane.ERROR_MESSAGE); - } - } - - /** - * input dialog - * @param text the text which the dialog should show - * @param oldValue the old value which should be changed - * @return the new value - */ - private String promptForValue(String text, String oldValue) { - InputDialog dlg = new InputDialog(getSite().getShell(), - "List View", text, oldValue, null); - if (dlg.open() != Window.OK) - return null; - return dlg.getValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor) - */ - public void doSave(IProgressMonitor monitor) { - isSaved = true; - ReadDOMTree tree = DOMGetInstance.getInstance(); - tree.writeTree(); - undoList.clear(); - redoList.clear(); - undoAction.setEnabled(false); - undoAction.setText("Undo"); - redoAction.setEnabled(false); - redoAction.setText("Redo"); - dirty = false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#doSaveAs() - */ - public void doSaveAs() { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - FileDialog fileDialog = new FileDialog(shell, SWT.SAVE); - fileDialog.setFilterExtensions(new String[] {"*.xml"}); - fileDialog.open(); - String file2 = fileDialog.getFilterPath().toString() + File.separator + fileDialog.getFileName().toString(); - isSaved = true; - ReadDOMTree tree = DOMGetInstance.getInstance(); - tree.writeTree(file2.toString()); - undoList.clear(); - redoList.clear(); - undoAction.setEnabled(false); - undoAction.setText("Undo"); - redoAction.setEnabled(false); - redoAction.setText("Redo"); - dirty = false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#isDirty() - */ - public boolean isDirty() { - if (dirty) { - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed() - */ - public boolean isSaveAsAllowed() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded() - */ - public boolean isSaveOnCloseNeeded() { - // when eclipse is closing, close this view and ask separate for save, then return false - if (PlatformUI.getWorkbench().isClosing() && (workbenchIsClosing == false)) { - workbenchIsClosing = true; - IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - page1.hideView(this); - return false; - } - else if (workbenchIsClosing) { - return false; - } - if (dirty) { - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - // close all editors when closing this view if eclipse remains open - if (!PlatformUI.getWorkbench().isClosing()) { - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true); - } - // if eclipse is closing and this view is dirty => ask for save - if (PlatformUI.getWorkbench().isClosing()) { - if (dirty) { - int result = JOptionPane.showConfirmDialog(null,"'StateMachinesList' has been modified. Save changes?", "Save Resource", JOptionPane.YES_NO_OPTION); - if (result == JOptionPane.YES_OPTION) { - doSave(null); - } - } - } - // if not saved undo every change, reset every list and close - if (!(isSaved)) { - int listSize = undoList.size(); - for(int i = 0; i < listSize; i++) { - if (undoList.get(i) instanceof DeleteStateMachine) { - DeleteStateMachine delete = (DeleteStateMachine) undoList.get(i); - delete.undoForDispose(); - } - else if (undoList.get(i) instanceof CopyStateMachine) { - CopyStateMachine copy = (CopyStateMachine) undoList.get(i); - copy.undoForDispose(); - } - } - undoCreateNewStateMachine(); - } - isSaved = false; - workbenchIsClosing = false; - stateMachinesList.clear(); - allNames.clear(); - undoList.clear(); - redoList.clear(); - undoAction.setEnabled(false); - undoAction.setText("Undo"); - redoAction.setEnabled(false); - redoAction.setText("Redo"); - // reset the DOMTree - if (!PlatformUI.getWorkbench().isClosing()) { - DOMGetInstance.reset(); - } - } - - public static void setDebugMode(boolean debugMode1) { - debugMode = debugMode1; - //PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true); - if (debugMode) { - undoAction.setEnabled(false); - redoAction.setEnabled(false); - } - else { - if (undoList.size() > 0) { - undoAction.setEnabled(true); - } - if (redoList.size() > 0) { - redoAction.setEnabled(true); - } - } - } - - public static boolean isDebugMode() { - return debugMode; - } -} diff --git a/Build/Tools/StateMachineEditor/src/wizard/CMakeLists.txt b/Build/Tools/StateMachineEditor/src/wizard/CMakeLists.txt deleted file mode 100644 index 8b13789179..0000000000 --- a/Build/Tools/StateMachineEditor/src/wizard/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Build/Tools/StateMachineEditor/src/wizard/CreateFromXML.java b/Build/Tools/StateMachineEditor/src/wizard/CreateFromXML.java deleted file mode 100644 index a732101cb4..0000000000 --- a/Build/Tools/StateMachineEditor/src/wizard/CreateFromXML.java +++ /dev/null @@ -1,81 +0,0 @@ -package wizard; - -import java.io.File; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.eclipse.ui.PlatformUI; - - -/** - * Our sample action implements workbench action delegate. - * The action proxy will be created by the workbench and - * shown in the UI. When the user tries to use the action, - * this delegate will be created and execution will be - * delegated to it. - * @see IWorkbenchWindowActionDelegate - */ -public class CreateFromXML implements IWorkbenchWindowActionDelegate { - IWorkbench workbench; - IStructuredSelection selection; - /** - * The constructor. - */ - public CreateFromXML() { - } - - /** - * The action has been activated. The argument of the - * method represents the 'real' action sitting - * in the workbench UI. - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - FileDialog fileDialog = new FileDialog(shell); - fileDialog.setFilterExtensions(new String[] {"*.xml"}); - fileDialog.open(); - if (!(fileDialog.getFileName().equals(""))) { - String file = fileDialog.getFilterPath(); - String file1 = fileDialog.getFileName(); - String file2 = file + File.separator + file1; - StateMachinesWizard2 wizard= new StateMachinesWizard2(file2); - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.create(); - dialog.open(); - } - } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - } - - /** - * We will cache window object in order to - * be able to provide parent shell for the message dialog. - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - } -} diff --git a/Build/Tools/StateMachineEditor/src/wizard/NewStateMachine.java b/Build/Tools/StateMachineEditor/src/wizard/NewStateMachine.java deleted file mode 100644 index 36480318f8..0000000000 --- a/Build/Tools/StateMachineEditor/src/wizard/NewStateMachine.java +++ /dev/null @@ -1,71 +0,0 @@ -package wizard; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.eclipse.ui.PlatformUI; - - -/** - * Our sample action implements workbench action delegate. - * The action proxy will be created by the workbench and - * shown in the UI. When the user tries to use the action, - * this delegate will be created and execution will be - * delegated to it. - * @see IWorkbenchWindowActionDelegate - */ -public class NewStateMachine implements IWorkbenchWindowActionDelegate { - IWorkbench workbench; - IStructuredSelection selection; - /** - * The constructor. - */ - public NewStateMachine() { - } - - /** - * The action has been activated. The argument of the - * method represents the 'real' action sitting - * in the workbench UI. - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - StateMachinesWizard wizard = new StateMachinesWizard(); - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.create(); - dialog.open(); - } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - } - - /** - * We will cache window object in order to - * be able to provide parent shell for the message dialog. - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - } -} diff --git a/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizard.java b/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizard.java deleted file mode 100644 index 3fd2d5228e..0000000000 --- a/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizard.java +++ /dev/null @@ -1,166 +0,0 @@ -package wizard; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.operation.*; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.ui.*; - -import dom.DOMGetInstance; -import dom.ReadDOMTree; - -import stateMachinesList.StateMachinesList; - -/** - * This is a new wizard. Its role is to create a new statemachine - * in the provided container. If the container resource - * (a folder or a project) is selected in the workspace - * when the wizard is opened, it will accept it as the target - * container. The wizard creates one statemachine with the extension - * ".states". If an editor is registered for the same extension, it will - * be able to open it. - */ - -public class StateMachinesWizard extends Wizard implements INewWizard { - private StateMachinesWizardPage page; - private ISelection selection; - - /** - * Constructor for StateMachinesWizard. - */ - public StateMachinesWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * Adding the page to the wizard. - */ - - public void addPages() { - page = new StateMachinesWizardPage(selection); - addPage(page); - } - - /** - * This method is called when 'Finish' button is pressed in - * the wizard. We will create an operation and run it - * using wizard as execution context. - */ - public boolean performFinish() { - IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - try { - page1.showView("StatemachinesList"); - } catch (PartInitException e1) { - e1.printStackTrace(); - } - final String containerName = page.getContainerName(); - final String fileName = page.getFileName(); - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - try { - doFinish(containerName, fileName, monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - try { - getContainer().run(true, false, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException e) { - MessageDialog.openError(getShell(), "Error", "Project does not exist!"); - return false; - } - return true; - } - - /** - * The worker method. It will find the container and create the - * statemachine. - */ - - private void doFinish( - String containerName, - String fileName, - IProgressMonitor monitor) - throws CoreException { - // create a new file - monitor.beginTask("Creating " + fileName, 2); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IResource resource = root.findMember(new Path(containerName)); - if (!resource.exists() || !(resource instanceof IContainer)) { - throwCoreException("Container \"" + containerName + "\" does not exist."); - } - - IContainer container = (IContainer) resource; - final IFile file = container.getFile(new Path(fileName)); - DOMGetInstance.setContainer(container); - monitor.worked(1); - monitor.setTaskName("Opening file for editing..."); - getShell().getDisplay().asyncExec(new Runnable() { - public void run() { - ReadDOMTree tree = DOMGetInstance.getInstance(); - // tree already exists, add statemachine to tree - if (!(tree == null)) { - String file1 = file.getName().toString(); - int length = file1.length(); - String filename = file1.subSequence(0, length-7).toString(); - StateMachinesList.addToStateMachinesList2(file, filename); - } - // tree does not exist, create a new tree and add a statemachine - else { - DOMGetInstance.reset(); - StateMachinesList.reset(); - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - FileDialog fileDialog = new FileDialog(shell, SWT.SAVE); - fileDialog.setFilterExtensions(new String[] {"*.xml"}); - fileDialog.open(); - String file2 = fileDialog.getFilterPath().toString() + File.separator + fileDialog.getFileName().toString(); - if (!(fileDialog.getFileName() == null) && !(fileDialog.getFileName().equals(""))) { - DOMGetInstance.createNew(file2); - String file1 = file.getName().toString(); - int length = file1.length(); - String filename = file1.subSequence(0, length-7).toString(); - StateMachinesList.addToStateMachinesList2(file, filename); - } - } - } - }); - monitor.worked(1); - } - - private void throwCoreException(String message) throws CoreException { - IStatus status = - new Status(IStatus.ERROR, "GetStateMachines", IStatus.OK, message, null); - throw new CoreException(status); - } - - /** - * We will accept the selection in the workbench to see if - * we can initialize from it. - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizard2.java b/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizard2.java deleted file mode 100644 index 6d53f12a57..0000000000 --- a/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizard2.java +++ /dev/null @@ -1,166 +0,0 @@ -package wizard; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PartInitException; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.operation.*; - -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.ui.*; -import org.jdom.Element; - -import dom.DOMGetInstance; -import dom.ReadDOMTree; - -import stateMachinesList.StateMachinesList; - -/** - * This is a new wizard. Its role is to create new statemachines - * from the *.xml file in the provided container. If the container resource - * (a folder or a project) is selected in the workspace - * when the wizard is opened, it will accept it as the target - * container. The wizard creates statemachines with the extension - * ".states". If an editor is registered for the same extension, it will - * be able to open it. - */ - -public class StateMachinesWizard2 extends Wizard implements INewWizard { - private String file; - private StateMachinesWizardPage2 page; - private ISelection selection; - private ReadDOMTree tree = null; - - /** - * Constructor for StateMachinesWizard2. - */ - - public StateMachinesWizard2() { - super(); - setNeedsProgressMonitor(true); - } - - public StateMachinesWizard2(String file2) { - super(); - setNeedsProgressMonitor(true); - file = file2; - } - - /** - * Adding the page to the wizard. - */ - - public void addPages() { - page = new StateMachinesWizardPage2(selection); - addPage(page); - } - - /** - * This method is called when 'Finish' button is pressed in - * the wizard. We will create an operation and run it - * using wizard as execution context. - */ - public boolean performFinish() { - IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - StateMachinesList.closeView(); - try { - page1.showView("StatemachinesList"); - } catch (PartInitException e1) { - e1.printStackTrace(); - } - DOMGetInstance.reset(); - StateMachinesList.reset(); - final String containerName = page.getContainerName(); - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - tree = DOMGetInstance.getFromXML(file); - List filenames = tree.getStateMachineNames(); - for (int i = 0; i < filenames.size(); i++) { - try { - String filename = filenames.get(i).toString() + ".states"; - doFinish(containerName, filename, monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - finally { - monitor.done(); - } - } - } - }; - try { - getContainer().run(true, false, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException e) { - MessageDialog.openError(getShell(), "Error", "Project does not exist!"); - return false; - } - return true; - } - - /** - * The worker method. It will find the container and create the - * statemachines. - */ - - private void doFinish( - String containerName, - String fileName, - IProgressMonitor monitor) - throws CoreException { - // create a file - monitor.beginTask("Creating " + fileName, 2); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IResource resource = root.findMember(new Path(containerName)); - if (!resource.exists() || !(resource instanceof IContainer)) { - throwCoreException("Container \"" + containerName + "\" does not exist."); - } - IContainer container = (IContainer) resource; - final IFile file1 = container.getFile(new Path(fileName)); - DOMGetInstance.setContainer(container); - monitor.worked(1); - monitor.setTaskName("Opening file for editing..."); - getShell().getDisplay().asyncExec(new Runnable() { - public void run() { - // create StateMachinesList view from xml file - List allMachines = tree.getStateMachines(); - for (int i = 0; i < allMachines.size(); i++) { - Element machine = (Element) allMachines.get(i); - String file2 = file1.getName().toString(); - int length = file2.length(); - String filename = file2.subSequence(0, length-7).toString(); - if (filename.equals(machine.getAttributeValue("NAME"))) { - StateMachinesList.addToStateMachinesList(file1, filename); - break; - } - } - } - }); - monitor.worked(1); - } - - private void throwCoreException(String message) throws CoreException { - IStatus status = - new Status(IStatus.ERROR, "Container", IStatus.OK, message, null); - throw new CoreException(status); - } - - /** - * We will accept the selection in the workbench to see if - * we can initialize from it. - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } -} \ No newline at end of file diff --git a/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizardPage.java b/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizardPage.java deleted file mode 100644 index b1d9cbb2de..0000000000 --- a/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizardPage.java +++ /dev/null @@ -1,171 +0,0 @@ -package wizard; - -import java.util.ArrayList; - -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.SWT; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.Path; -import org.eclipse.swt.events.*; -import org.eclipse.ui.dialogs.ContainerSelectionDialog; -import org.eclipse.jface.viewers.*; - -import stateMachinesList.StateMachinesList; - -/** - * The wizard page allows setting the container for - * the new file as well as the file name. The page - * will only accept file name with the extension that - * matches the expected one and does not exist already. - */ - -public class StateMachinesWizardPage extends WizardPage { - private Text containerText; - private Text fileText; - private ISelection selection; - - /** - * Constructor for StateMachinesWizardPage. - * @param pageName - */ - public StateMachinesWizardPage(ISelection selection) { - super("wizardPage"); - setTitle("Editor File"); - setDescription("This wizard creates a new file with *.states extension that can be opened by a editor."); - this.selection = selection; - } - - /** - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 3; - layout.verticalSpacing = 9; - Label label = new Label(container, SWT.NULL); - label.setText("&Container:"); - - containerText = new Text(container, SWT.BORDER | SWT.SINGLE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - containerText.setLayoutData(gd); - containerText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - Button button = new Button(container, SWT.PUSH); - button.setText("Browse..."); - button.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - handleBrowse(); - } - }); - label = new Label(container, SWT.NULL); - label.setText("&File name:"); - - fileText = new Text(container, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - fileText.setLayoutData(gd); - fileText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - initialize(); - dialogChanged(); - setControl(container); - } - - /** - * Tests if the current workbench selection is a suitable - * container to use. - */ - - private void initialize() { - if (selection!=null && selection.isEmpty()==false && selection instanceof IStructuredSelection) { - IStructuredSelection ssel = (IStructuredSelection)selection; - if (ssel.size()>1) return; - Object obj = ssel.getFirstElement(); - if (obj instanceof IResource) { - IContainer container; - if (obj instanceof IContainer) - container = (IContainer)obj; - else - container = ((IResource)obj).getParent(); - containerText.setText(container.getFullPath().toString()); - } - } - fileText.setText("StateMachines.states"); - } - - /** - * Uses the standard container selection dialog to - * choose the new value for the container field. - */ - - private void handleBrowse() { - ContainerSelectionDialog dialog = - new ContainerSelectionDialog( - getShell(), - ResourcesPlugin.getWorkspace().getRoot(), - false, - "Select new file container"); - if (dialog.open() == ContainerSelectionDialog.OK) { - Object[] result = dialog.getResult(); - if (result.length == 1) { - containerText.setText(((Path)result[0]).toOSString()); - } - } - } - - /** - * Ensures that both text fields are set, extension is ".states" and statemachine does not exist already. - */ - - private void dialogChanged() { - String container = getContainerName(); - String fileName = getFileName(); - - if (container.length() == 0) { - updateStatus("File container must be specified"); - return; - } - if (fileName.length() == 0) { - updateStatus("File name must be specified"); - return; - } - ArrayList allNames = (ArrayList) StateMachinesList.allNames; - int length = fileName.length(); - String filename = fileName.subSequence(0, length-7).toString(); - for (int i = 0; i < allNames.size(); i++) { - if (allNames.get(i).equals(filename)) { - updateStatus("File already exist"); - return; - } - } - int dotLoc = fileName.lastIndexOf('.'); - String ext = fileName.substring(dotLoc + 1); - if (ext.equalsIgnoreCase("states") == false) { - updateStatus("File extension must be \".states\""); - return; - } - updateStatus(null); - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - public String getContainerName() { - return containerText.getText(); - } - public String getFileName() { - return fileText.getText(); - } -} diff --git a/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizardPage2.java b/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizardPage2.java deleted file mode 100644 index a440594e36..0000000000 --- a/Build/Tools/StateMachineEditor/src/wizard/StateMachinesWizardPage2.java +++ /dev/null @@ -1,128 +0,0 @@ -package wizard; - -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.SWT; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.Path; -import org.eclipse.swt.events.*; -import org.eclipse.ui.dialogs.ContainerSelectionDialog; -import org.eclipse.jface.viewers.*; - -/** - * The wizard page allows setting the container for - * the new file. - */ - -public class StateMachinesWizardPage2 extends WizardPage { - private Text containerText; - private ISelection selection; - - /** - * Constructor for StateMachinesWizardPage2. - * @param pageName - */ - public StateMachinesWizardPage2(ISelection selection) { - super("wizardPage"); - setTitle("Editor File"); - setDescription("This wizard creates all statemachines with *.states extension that are in the *.xml file."); - this.selection = selection; - } - - /** - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 3; - layout.verticalSpacing = 9; - Label label = new Label(container, SWT.NULL); - label.setText("&Container:"); - - containerText = new Text(container, SWT.BORDER | SWT.SINGLE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - containerText.setLayoutData(gd); - containerText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - Button button = new Button(container, SWT.PUSH); - button.setText("Browse..."); - button.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - handleBrowse(); - } - }); - initialize(); - dialogChanged(); - setControl(container); - } - - /** - * Tests if the current workbench selection is a suitable - * container to use. - */ - - private void initialize() { - if (selection!=null && selection.isEmpty()==false && selection instanceof IStructuredSelection) { - IStructuredSelection ssel = (IStructuredSelection)selection; - if (ssel.size()>1) return; - Object obj = ssel.getFirstElement(); - if (obj instanceof IResource) { - IContainer container; - if (obj instanceof IContainer) - container = (IContainer)obj; - else - container = ((IResource)obj).getParent(); - containerText.setText(container.getFullPath().toString()); - } - } - } - - /** - * Uses the standard container selection dialog to - * choose the new value for the container field. - */ - - private void handleBrowse() { - ContainerSelectionDialog dialog = - new ContainerSelectionDialog( - getShell(), - ResourcesPlugin.getWorkspace().getRoot(), - false, - "Select new file container"); - if (dialog.open() == ContainerSelectionDialog.OK) { - Object[] result = dialog.getResult(); - if (result.length == 1) { - containerText.setText(((Path)result[0]).toOSString()); - } - } - } - - /** - * Ensures that File container is specified. - */ - - private void dialogChanged() { - String container = getContainerName(); - if (container.length() == 0) { - updateStatus("File container must be specified"); - return; - } - updateStatus(null); - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - public String getContainerName() { - return containerText.getText(); - } -} diff --git a/Build/Tools/StateMachineEditor/states.gif b/Build/Tools/StateMachineEditor/states.gif deleted file mode 100644 index 983eb61c83..0000000000 Binary files a/Build/Tools/StateMachineEditor/states.gif and /dev/null differ diff --git a/Build/Tools/Xml2Const/CMakeLists.txt b/Build/Tools/Xml2Const/CMakeLists.txt deleted file mode 100644 index f68b163ea4..0000000000 --- a/Build/Tools/Xml2Const/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(xml2const xml2const.cpp) - diff --git a/Build/Tools/Xml2Const/xml2const.cpp b/Build/Tools/Xml2Const/xml2const.cpp deleted file mode 100644 index 030bc6ed06..0000000000 --- a/Build/Tools/Xml2Const/xml2const.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include