[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[CASHeW-s-editor-patches] solveParserCannotCreateMoreConnFromOneNodeBug
From: |
Xianfeng Liu |
Subject: |
[CASHeW-s-editor-patches] solveParserCannotCreateMoreConnFromOneNodeBugs |
Date: |
Sun, 10 Apr 2005 23:48:36 +0100 |
Index: resource/plugin.xml
===================================================================
RCS file: plugin.xml
diff -N plugin.xml
--- /tmp/cvsAAADKaGRV Sun Apr 10 23:46:59 2005
+++ /dev/null Sun Apr 10 23:46:51 2005
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin id="nongnu.cashews.eclipse.composer"
- name="CASheW-s"
- version="0.0.0"
- provider-name="The CASheW-s Project"
- class="nongnu.cashews.eclipse.composer.Plugin">
-
- <runtime>
- <library name="composer.jar"/>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.gef"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.ui.views"/>
- <import plugin="org.eclipse.jface"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.ui.workbench"/>
- <import plugin="org.eclipse.ui.cheatsheets"/>
- <import plugin="org.eclipse.ui.console"/>
- <import plugin="org.eclipse.ui.editors"/>
- <import plugin="org.eclipse.ui.externaltools"/>
- <import plugin="org.eclipse.ui.forms"/>
- <import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.ui.intro"/>
- </requires>
-
- <extension point="org.eclipse.ui.editors">
- <editor id="nongnu.cashews.eclipse.composer.editor"
- name="Cashews Editor"
- default="true"
- icon=""
- extensions="composer"
-
contributorClass="nongnu.cashews.eclipse.composer.actions.DiagramActionBarContributor"
- class="nongnu.cashews.eclipse.composer.ui.DiagramEditor">
- </editor>
- </extension>
-
- <extension point="org.eclipse.ui.newWizards">
- <category id="nongnu.cashews.eclipse.composer" name="Composer"/>
- <wizard id="nongnu.cashews.eclipse.composer.wizard.new.file"
- name="Composer Model"
- category="nongnu.cashews.eclipse.composer"
- class="nongnu.cashews.eclipse.composer.ui.DiagramCreationWizard">
- <description>Wizard for creating a new CASheW-s process
diagram.</description>
- <selection class="org.eclipse.core.resources.IResource">
- </selection>
- </wizard>
- </extension>
-
-</plugin>
\ No newline at end of file
Index: src/nongnu/cashews/eclipse/composer/model/DiagramParser.java
===================================================================
RCS file:
/share/darwin/darwin4/cvs/java/src/nongnu/cashews/eclipse/composer/model/DiagramParser.java,v
retrieving revision 1.9
diff -u -r1.9 DiagramParser.java
--- src/nongnu/cashews/eclipse/composer/model/DiagramParser.java 2005/04/10
17:29:03 1.9
+++ src/nongnu/cashews/eclipse/composer/model/DiagramParser.java 2005/04/10
22:46:59
@@ -1,39 +1,39 @@
/* DiagramParser.java -- Deserializer for diagrams.
-Copyright (C) 2005 The University of Sheffield.
+ Copyright (C) 2005 The University of Sheffield.
-This file is part of the CASheW-s editor Eclipse plug-in.
+ This file is part of the CASheW-s editor Eclipse plug-in.
-The CASheW-s editor Eclipse plug-in is free software; you may copy, modify,
-and redistribute it under the terms of the GNU General Public License
-version 2 (or, at your option, any later version), and/or the Eclipse
-Public License version 1.0.
-
-The CASheW-s editor is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with The CASheW-s editor; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-The University of Sheffield makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to
-you under the terms and conditions of the Eclipse Public License Version
-1.0 ("EPL"). A copy of the EPL is available at
-http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL,
-"Program" will mean the Content.
-
-If you did not receive this Content directly from the University of Sheffield,
-the Content is being redistributed by another party ("Redistributor") and
-different terms and conditions may apply to your use of any object code in
-the Content. Check the Redistributor's license that was provided with the
-Content. If no such license exists, contact the Redistributor. Unless
-otherwise indicated below, the terms and conditions of the EPL still apply
-to any source code in the Content.
+ The CASheW-s editor Eclipse plug-in is free software; you may copy, modify,
+ and redistribute it under the terms of the GNU General Public License
+ version 2 (or, at your option, any later version), and/or the Eclipse
+ Public License version 1.0.
+
+ The CASheW-s editor is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with The CASheW-s editor; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ The University of Sheffield makes available all content in this plug-in
+ ("Content"). Unless otherwise indicated below, the Content is provided to
+ you under the terms and conditions of the Eclipse Public License Version
+ 1.0 ("EPL"). A copy of the EPL is available at
+ http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL,
+ "Program" will mean the Content.
+
+ If you did not receive this Content directly from the University of Sheffield,
+ the Content is being redistributed by another party ("Redistributor") and
+ different terms and conditions may apply to your use of any object code in
+ the Content. Check the Redistributor's license that was provided with the
+ Content. If no such license exists, contact the Redistributor. Unless
+ otherwise indicated below, the terms and conditions of the EPL still apply
+ to any source code in the Content.
-*/
+ */
package nongnu.cashews.eclipse.composer.model;
@@ -48,137 +48,172 @@
import org.xml.sax.helpers.DefaultHandler;
/**
-* @author Ravish
-* @author Xianfeng Liu
-*
-*
-*/
+ * @author Ravish
+ * @author Xianfeng Liu
+ *
+ *
+ */
public class DiagramParser extends DefaultHandler
{
- private Diagram d;
+ private Diagram d;
- private List<String> sourceList;
+ private List<String> sourceList;
- private List<String> targetList;
+ private List<String> targetList;
- // protected List<Node> nodes = new ArrayList<Node>();
- public DiagramParser()
- {
- super();
- }
-
- public void startDocument()
- {
- d = new Diagram();
- sourceList = new ArrayList<String>();
- targetList = new ArrayList<String>();
- }
-
- public void endDocument()
- {
- if (d.nodes.size() <= 1)
- {
- return;
- }
- Iterator targetNames = targetList.iterator();
- Iterator sourceNames = sourceList.iterator();
-
- int diagramNodeCount = 0;
- List diagramNodes = d.getNodes();
- String targetNodeName;
- String sourceNodeName;
-
- while (targetNames.hasNext())
- {
- targetNodeName = (String) targetNames.next();
- sourceNodeName = (String) sourceNames.next();
- Node sourceNode = (Node) diagramNodes.get(diagramNodeCount);
- if (sourceNode.getName().equals(sourceNodeName)){
- Iterator j = d.getNodes().iterator();
- Node targetNode;
-
- while (j.hasNext())
- {
- targetNode = (Node) j.next();
- if (targetNode.getName().equals(targetNodeName))
- {
- // if (sourceNode.outputs == null)
-
- sourceNode.outputs = null;
-
- sourceNode.outputs = new ArrayList<Connection>();
-
- new Connection(sourceNode, targetNode);
- }
- }
- diagramNodeCount++;
- }
- }
- /*
- * int max = 0; for (int k = 0; k < d.nodes.size(); k++) { Node cur = (Node)
- * d.nodes.get(k); int tmp = Integer.parseInt(cur.getName().substring(8));
- * if (cur.getName().startsWith("Untitled") && tmp > max) { max = tmp; } }
- * NodeRegistrar.setMax(max);
- */
-
- }
-
- public void startElement(String uri, String name, String qName,
- Attributes atts)
- {
- if (name.equals("WorkflowDiagram"))
- {
- return;
- }
- Node n;
- Point p;
- p = new Point();
-
- if (name.equals("RectangleNode"))
- {
- p.setLocation(Integer.parseInt(atts.getValue(1)),
- Integer.parseInt(atts.getValue(2)));
- RectangleNodeFactory rFactory = new RectangleNodeFactory(
-
EllipseNode.class);
- n = rFactory.getNewObject(atts.getValue(0));
- n.setLocation(p);
- n.outputs = null;
- d.addNode(n);
- }
- else if (name.equals("EllipseNode"))
- {
- p.setLocation(Integer.parseInt(atts.getValue(1)),
- Integer.parseInt(atts.getValue(2)));
- EllipseNodeFactory eFactory = new EllipseNodeFactory(EllipseNode.class);
- n = eFactory.getNewObject(atts.getValue(0));
- n.setLocation(p);
- n.outputs = null;
- d.addNode(n);
- }
- else if (name.equals("OutgoingEdge"))
- {
- List temp = d.getNodes();
-
- Node s = (Node) temp.get(temp.size() - 1);
- String source = s.getName();
- String target = (String) atts.getValue(0);
- sourceList.add(source);
- System.out.println("Source node is: " + source);
- System.out.println("Target node is: " + target);
- targetList.add(target);
- System.out.println("sourcr list are: " + sourceList);
- System.out.println("target list are: " + targetList);
-
- }
- }
-
- public void endElement(String uri, String name, String qName)
- {
-
- }
-
- public Diagram getDiagram()
- {
- return d;
- }
+ public DiagramParser()
+ {
+ super();
+ }
+
+ public void startDocument()
+ {
+ d = new Diagram();
+ sourceList = new ArrayList<String>();
+ targetList = new ArrayList<String>();
+ }
+
+ public void endDocument()
+ {
+ if (d.nodes.size() <= 1)
+ {
+ return;
+ }
+
+ Iterator targetNames = targetList.iterator();
+ Iterator sourceNames = sourceList.iterator();
+
+ int diagramNodeCount = 0;
+
+ List diagramNodes = d.getNodes();
+
+ String targetNodeName;
+ String sourceNodeName;
+
+ while (targetNames.hasNext())
+ {
+ targetNodeName = (String) targetNames.next();
+ sourceNodeName = (String) sourceNames.next();
+ Node sourceNode = (Node) diagramNodes.get(diagramNodeCount);
+ if (sourceNode.getName().equals(sourceNodeName))
+ {
+ Iterator j = d.getNodes().iterator();
+ Node targetNode;
+
+ while (j.hasNext())
+ {
+ targetNode = (Node) j.next();
+ if (targetNode.getName().equals(targetNodeName))
+ {
+ sourceNode.outputs = new ArrayList<Connection>();
+ new Connection(sourceNode, targetNode);
+ }
+ }
+ diagramNodeCount++;
+ }
+ else
+ {
+ Node tempNode = (Node) diagramNodes.get(diagramNodeCount - 1);
+ if (sourceNodeName.equals(tempNode.getName()))
+ {
+ diagramNodeCount--;
+ sourceNode = (Node) diagramNodes.get(diagramNodeCount);
+ Iterator j = d.getNodes().iterator();
+ Node targetNode;
+
+ while (j.hasNext())
+ {
+ targetNode = (Node) j.next();
+ if (targetNode.getName().equals(targetNodeName))
+ {
+ sourceNode.outputs.add(new Connection(sourceNode,
+ targetNode));
+ }
+ }
+ }
+
+ else
+ {
+ while (!sourceNode.getName().equals(sourceNodeName))
+ {
+ diagramNodeCount++;
+ sourceNode = (Node) diagramNodes.get(diagramNodeCount);
+ }
+ Iterator j = d.getNodes().iterator();
+ Node targetNode;
+
+ while (j.hasNext())
+ {
+ targetNode = (Node) j.next();
+ if (targetNode.getName().equals(targetNodeName))
+ {
+ sourceNode.outputs = new ArrayList<Connection>();
+ new Connection(sourceNode, targetNode);
+
+ }
+ }
+ }
+ diagramNodeCount++;
+ }
+ }
+ }
+
+ public void startElement(String uri, String name, String qName,
+ Attributes atts)
+ {
+ if (name.equals("WorkflowDiagram"))
+ {
+ return;
+ }
+ Node n;
+ Point p;
+ p = new Point();
+
+ if (name.equals("RectangleNode"))
+ {
+ p.setLocation(Integer.parseInt(atts.getValue(1)),
+ Integer.parseInt(atts.getValue(2)));
+ RectangleNodeFactory rFactory = new RectangleNodeFactory(
+
EllipseNode.class);
+ n = rFactory.getNewObject(atts.getValue(0));
+ n.setLocation(p);
+ n.outputs = null;
+ d.addNode(n);
+ }
+ else if (name.equals("EllipseNode"))
+ {
+ p.setLocation(Integer.parseInt(atts.getValue(1)),
+ Integer.parseInt(atts.getValue(2)));
+ EllipseNodeFactory eFactory = new
EllipseNodeFactory(EllipseNode.class);
+ n = eFactory.getNewObject(atts.getValue(0));
+ n.setLocation(p);
+ n.outputs = null;
+ d.addNode(n);
+ }
+ else if (name.equals("OutgoingEdge"))
+ {
+ List temp = d.getNodes();
+
+ Node s = (Node) temp.get(temp.size() - 1);
+ String source = s.getName();
+ String target = (String) atts.getValue(0);
+ sourceList.add(source);
+ System.out.println("Source node is: " + source);
+ System.out.println("Target node is: " + target);
+ targetList.add(target);
+ System.out.println("sourcr list are: " + sourceList);
+ System.out.println("target list are: " + targetList);
+
+ }
+ }
+
+ public void endElement(String uri, String name, String qName)
+ {
+
+ }
+
+ public Diagram getDiagram()
+ {
+ return d;
+ }
}
Index: plugin.xml
===================================================================
RCS file: plugin.xml
diff -N plugin.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ plugin.xml 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin id="nongnu.cashews.eclipse.composer"
+ name="CASheW-s"
+ version="0.0.0"
+ provider-name="The CASheW-s Project"
+ class="nongnu.cashews.eclipse.composer.Plugin">
+
+ <runtime>
+ <library name="composer.jar"/>
+ </runtime>
+ <requires>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.gef"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.ui.views"/>
+ <import plugin="org.eclipse.jface"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.ui.workbench"/>
+ <import plugin="org.eclipse.ui.cheatsheets"/>
+ <import plugin="org.eclipse.ui.console"/>
+ <import plugin="org.eclipse.ui.editors"/>
+ <import plugin="org.eclipse.ui.externaltools"/>
+ <import plugin="org.eclipse.ui.forms"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.ui.intro"/>
+ </requires>
+
+ <extension point="org.eclipse.ui.editors">
+ <editor id="nongnu.cashews.eclipse.composer.editor"
+ name="Cashews Editor"
+ default="true"
+ icon=""
+ extensions="composer"
+
contributorClass="nongnu.cashews.eclipse.composer.actions.DiagramActionBarContributor"
+ class="nongnu.cashews.eclipse.composer.ui.DiagramEditor">
+ </editor>
+ </extension>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <category id="nongnu.cashews.eclipse.composer" name="Composer"/>
+ <wizard id="nongnu.cashews.eclipse.composer.wizard.new.file"
+ name="Composer Model"
+ category="nongnu.cashews.eclipse.composer"
+ class="nongnu.cashews.eclipse.composer.ui.DiagramCreationWizard">
+ <description>Wizard for creating a new CASheW-s process
diagram.</description>
+ <selection class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ </extension>
+
+</plugin>
solveParserCannotCreateMoreConnFromOneNodeBugs.diff
Description: Binary data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [CASHeW-s-editor-patches] solveParserCannotCreateMoreConnFromOneNodeBugs,
Xianfeng Liu <=