JBoss Tools SVN: r9741 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-08-15 09:05:47 -0400 (Fri, 15 Aug 2008)
New Revision: 9741
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2244
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java 2008-08-15 10:53:26 UTC (rev 9740)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java 2008-08-15 13:05:47 UTC (rev 9741)
@@ -73,7 +73,6 @@
ILaunchConfigurationWorkingCopy wc = null;
try {
wc = launchConfigurationType.newInstance(null, projectName + "-hibernate-generate");
- wc.setAttribute(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER, true);
// Create exporters
List<String> exporters = new ArrayList<String>();
exporters.add(exporter_id); //$NON-NLS-1$
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2008-08-15 10:53:26 UTC (rev 9740)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2008-08-15 13:05:47 UTC (rev 9741)
@@ -75,6 +75,7 @@
wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, page2.getOutputDir()); //$NON-NLS-1$
+ wc.setAttribute(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER, true);
wc.setAttribute(HibernateLaunchConstants.ATTR_PACKAGE_NAME, page2.getPackageName());
wc.setAttribute(HibernateLaunchConstants.ATTR_PREFER_BASIC_COMPOSITE_IDS, true);
wc.setAttribute(HibernateLaunchConstants.ATTR_AUTOMATIC_MANY_TO_MANY, true);
17 years, 4 months
JBoss Tools SVN: r9740 - in workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui: gef/editparts and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-08-15 06:53:26 -0400 (Fri, 15 Aug 2008)
New Revision: 9740
Added:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures/CurveLineConnection.java
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/editparts/RootModelEditPart.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/editparts/StructuredDataConnectionEditPart.java
Log:
draw curve line
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-08-15 09:33:33 UTC (rev 9739)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-08-15 10:53:26 UTC (rev 9740)
@@ -11,9 +11,12 @@
package org.jboss.tools.smooks.ui.editors;
import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.ConnectionLayer;
import org.eclipse.gef.DefaultEditDomain;
import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.LayerConstants;
import org.eclipse.gef.dnd.TemplateTransfer;
+import org.eclipse.gef.editparts.LayerManager;
import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
import org.eclipse.gef.ui.parts.SelectionSynchronizer;
import org.eclipse.jface.dialogs.Dialog;
@@ -130,19 +133,18 @@
.getInstance() }, new DragSourceAdapter() {
public void dragStart(DragSourceEvent event) {
event.data = sourceViewer.getSelection();
- System.out.println(event.data);
TemplateTransfer.getInstance().setTemplate(
sourceViewer.getSelection());
event.doit = true;
}
});
- sourceViewer.getTree().addPaintListener(new PaintListener(){
+ sourceViewer.getTree().addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
null, new Object());
}
});
-
+
if (initSourceTreeViewerProviders()) {
initSourceTreeViewer();
}
@@ -182,13 +184,7 @@
new Transfer[] { TemplateTransfer.getInstance() },
new TargetTreeDropTargetListener(targetViewer,
getGraphicalViewer()));
-// targetViewer.getTree().addPaintListener(new PaintListener() {
-// public void paintControl(PaintEvent e) {
-// rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
-// null, new Object());
-// }
-// });
- targetViewer.getTree().addPaintListener(new PaintListener(){
+ targetViewer.getTree().addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
null, new Object());
@@ -274,12 +270,6 @@
}
protected void initSourceTreeViewer() {
- // TODO Test
- // JavaBeanModel model = JavaBeanModelFactory
- // .getJavaBeanModel(Order.class);
- // List modelList = new ArrayList();
- // modelList.add(model);
- // sourceViewer.setInput(modelList);
sourceViewer.expandAll();
}
@@ -388,6 +378,13 @@
this.getGraphicalViewer().setEditPartFactory(
new SmooksEditPartFactory());
this.getGraphicalViewer().setContents(rootModel);
+
+ LayerManager manager = (LayerManager) getGraphicalViewer()
+ .getEditPartRegistry().get(LayerManager.ID);
+ ConnectionLayer layer = (ConnectionLayer) manager
+ .getLayer(LayerConstants.CONNECTION_LAYER);
+ if (layer != null)
+ layer.setAntialias(SWT.SMOOTH);
}
public SelectionSynchronizer getSelectionSynchronizer() {
@@ -459,19 +456,20 @@
viewer.setInput(cw.getTreeViewerInputContents());
// the viewer must be expanded , then the graphics model can
// calculate the location correctly
-// viewer.refresh();
- try{
- viewer.expandAll();
- }catch(Exception e){
+ try {
+ viewer.expandAll();
+ if (viewer == this.sourceViewer) {
+ this.createSourceGraphModels();
+ }
+ if (viewer == this.targetViewer) {
+ this.createTargetGraphModels();
+ }
+ } catch (Exception e) {
e.printStackTrace();
+ MessageDialog.openError(getSite().getShell(), "Error",
+ "a error occurs during filling Data into the viewer:\n"
+ + e.toString());
}
-
- if (viewer == this.sourceViewer) {
- this.createSourceGraphModels();
- }
- if (viewer == this.targetViewer) {
- this.createTargetGraphModels();
- }
} else {
MessageDialog.openError(getSite().getShell(), "Error",
"a error occurs during filling Data into the viewer");
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/editparts/RootModelEditPart.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/editparts/RootModelEditPart.java 2008-08-15 09:33:33 UTC (rev 9739)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/editparts/RootModelEditPart.java 2008-08-15 10:53:26 UTC (rev 9740)
@@ -7,7 +7,6 @@
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.ScalableFreeformLayeredPane;
import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.GraphicalEditPart;
import org.jboss.tools.smooks.ui.gef.figures.GraphRootFigureLayout;
import org.jboss.tools.smooks.ui.gef.model.AbstractStructuredDataModel;
import org.jboss.tools.smooks.ui.gef.policy.RootGraphicsXYLayoutEditPolicy;
@@ -15,14 +14,14 @@
public class RootModelEditPart extends AbstractStructuredDataEditPart {
protected IFigure createFigure() {
- IFigure figure = new ScalableFreeformLayeredPane(){
+ IFigure figure = new ScalableFreeformLayeredPane() {
@Override
public void paintClientArea(Graphics graphics) {
-// graphics.pushState();
-// graphics.setBackgroundColor(ColorConstants.lightGreen);
-// graphics.setForegroundColor(ColorConstants.white);
-// graphics.fillGradient(getBounds(), true);
-// graphics.popState();
+ // graphics.pushState();
+ // graphics.setBackgroundColor(ColorConstants.lightGreen);
+ // graphics.setForegroundColor(ColorConstants.white);
+ // graphics.fillGradient(getBounds(), true);
+ // graphics.popState();
super.paintClientArea(graphics);
}
};
@@ -31,29 +30,34 @@
}
public void propertyChange(PropertyChangeEvent evt) {
- if ( evt.getPropertyName().equals(AbstractStructuredDataModel.P_CHILDREN) ) {
+ if (evt.getPropertyName()
+ .equals(AbstractStructuredDataModel.P_CHILDREN)) {
refreshChildren();
}
- if ( evt.getPropertyName().equals(AbstractStructuredDataModel.P_REFRESH_PANEL) ) {
+ if (evt.getPropertyName().equals(
+ AbstractStructuredDataModel.P_REFRESH_PANEL)) {
this.getFigure().invalidate();
this.getFigure().validate();
-// this.getFigure().validate();
+ // this.getFigure().validate();
}
}
-
+
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
*/
protected void createEditPolicies() {
- this.installEditPolicy(EditPolicy.LAYOUT_ROLE, new RootGraphicsXYLayoutEditPolicy());
+ this.installEditPolicy(EditPolicy.LAYOUT_ROLE,
+ new RootGraphicsXYLayoutEditPolicy());
}
-
+
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
*/
protected List getModelChildren() {
- return ((AbstractStructuredDataModel)getModel()).getChildren();
+ return ((AbstractStructuredDataModel) getModel()).getChildren();
}
}
\ No newline at end of file
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/editparts/StructuredDataConnectionEditPart.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/editparts/StructuredDataConnectionEditPart.java 2008-08-15 09:33:33 UTC (rev 9739)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/editparts/StructuredDataConnectionEditPart.java 2008-08-15 10:53:26 UTC (rev 9740)
@@ -12,7 +12,7 @@
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.editparts.AbstractConnectionEditPart;
import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy;
-import org.eclipse.swt.SWT;
+import org.jboss.tools.smooks.ui.gef.figures.CurveLineConnection;
import org.jboss.tools.smooks.ui.gef.policy.DeleteConnectionEditPolicy;
import org.jboss.tools.smooks.ui.gef.util.GraphicsConstants;
@@ -31,11 +31,12 @@
}
protected IFigure createFigure() {
- PolylineConnection conn = new PolylineConnection(){
+ CurveLineConnection conn = new CurveLineConnection(){
public void paintFigure(Graphics graphics){
super.paintFigure(graphics);
}
};
+// conn.setSmoothness(SmoothPolyLineConnection.SMOOTH_MORE);
Figure targetFlagFigure = new Figure() {
/*
Added: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures/CurveLineConnection.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures/CurveLineConnection.java (rev 0)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures/CurveLineConnection.java 2008-08-15 10:53:26 UTC (rev 9740)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.ui.gef.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author Dart Peng
+ * @Date Aug 16, 2008
+ */
+public class CurveLineConnection extends PolylineConnection {
+ private double[] fBasicCenterCurve;
+
+ private int[] getCenterCurvePoints(int startx, int starty, int endx,
+ int endy) {
+ buildBaseCenterCurve(endx - startx);
+ double height = endy - starty;
+ height = height / 2;
+ int width = Math.abs(startx - endx);
+ int[] points = new int[width];
+ for (int i = 0; i < width; i++) {
+ points[i] = (int) (-height * fBasicCenterCurve[i] + height + starty);
+ }
+ return points;
+ }
+
+ private PointList getcenterCurvePointList() {
+ if (this.getCenterWidth() < 0)
+ return null;
+ PointList list1 = this.getPoints();
+ Point start = this.getStart();
+ Point end = this.getEnd();
+ if (start == null || end == null) {
+ return null;
+ }
+ int[] points = getCenterCurvePoints(start.x + 8, start.y, end.x - 8, end.y);
+ PointList list = new PointList();
+ for (int i = 1; i < points.length; i++) {
+ list.addPoint(start.x + 8 + i - 1, points[i - 1]);
+ }
+ list.addPoint(this.getPoints().getLastPoint());
+ list.insertPoint(this.getStart(), 0);
+ return list;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.Polyline#outlineShape(org.eclipse.draw2d.Graphics)
+ */
+ @Override
+ protected void outlineShape(Graphics g) {
+ try {
+ PointList displayPoints = getcenterCurvePointList();
+ if (displayPoints != null)
+ g.drawPolyline(displayPoints);
+ } catch (Exception e) {
+ e.printStackTrace();
+ super.outlineShape(g);
+ }
+ }
+
+ public Rectangle getBounds() {
+ if (bounds == null) {
+ if (this.getCenterWidth() <= 0)
+ return super.getBounds();
+ bounds = getcenterCurvePointList().getBounds();
+ bounds.expand(lineWidth / 2, lineWidth / 2);
+
+ for (int i = 0; i < getChildren().size(); i++) {
+ IFigure child = (IFigure) getChildren().get(i);
+ bounds.union(child.getBounds());
+ }
+ }
+ return bounds;
+ }
+
+ private void buildBaseCenterCurve(int w) {
+ double width = w;
+ int count = getCenterWidth();
+ if (count < 0)
+ return;
+ fBasicCenterCurve = new double[count];
+ for (int i = 0; i < getCenterWidth(); i++) {
+ double r = i / width;
+ fBasicCenterCurve[i] = Math.cos(Math.PI * r);
+ }
+ }
+
+ private int getCenterWidth() {
+ if (this.getPoints().size() == 0)
+ return -1;
+ Point start = this.getStart();
+ Point end = this.getEnd();
+ int w = Math.abs(start.x - end.x);
+ if (w <= 0)
+ return -1;
+ return Math.abs(w);
+ }
+}
Property changes on: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures/CurveLineConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years, 4 months
JBoss Tools SVN: r9739 - in workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j: messages and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2008-08-15 05:33:33 -0400 (Fri, 15 Aug 2008)
New Revision: 9739
Added:
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/DomXmlWriter.java
Removed:
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java
Modified:
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/action/B2JAction.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2J.properties
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2JMessages.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/TranslateHelper.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/util/B2JUtil.java
Log:
use dom to translate bpmn file
Modified: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/action/B2JAction.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/action/B2JAction.java 2008-08-15 09:10:55 UTC (rev 9738)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/action/B2JAction.java 2008-08-15 09:33:33 UTC (rev 9739)
@@ -1,12 +1,21 @@
package org.jboss.tools.b2j.action;
+import java.io.InputStreamReader;
+
+import org.dom4j.Document;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
+import org.jboss.tools.b2j.messages.B2JMessages;
import org.jboss.tools.b2j.translate.BPMN2JPDL;
+import org.jboss.tools.b2j.util.B2JUtil;
+import org.xml.sax.InputSource;
public class B2JAction implements IObjectActionDelegate{
@@ -18,9 +27,23 @@
}
public void run(IAction arg0) {
- BPMN2JPDL translator = new BPMN2JPDL();
- translator.setBpmnFile(bpmnFile);
+ Document bpmnDocument = null;
+ try {
+ bpmnDocument = B2JUtil.parse(new InputSource(new InputStreamReader(bpmnFile.getContents())));
+ } catch (CoreException e) {
+ System.out.println(B2JMessages.Translate_Error_BpmnFile_CanNotRead + e.getMessage());
+ } catch (Exception e1) {
+ System.out.println(B2JMessages.Translate_Error_BpmnFile_CanNotParse + e1.getMessage());
+ }
+ BPMN2JPDL translator = new BPMN2JPDL(bpmnFile.getName(),bpmnFile.getParent().getLocation().toOSString(),bpmnDocument);
translator.translateToFiles();
+
+ try {
+ ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
public void selectionChanged(IAction arg0, ISelection selection) {
Modified: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2J.properties
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2J.properties 2008-08-15 09:10:55 UTC (rev 9738)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2J.properties 2008-08-15 09:33:33 UTC (rev 9739)
@@ -1,4 +1,4 @@
-Loop_Decision=Loop Decition
+Loop_Decision=Loop_Decition
Loop_Decision_Description=this decision is for mocking bpmn loop activity
To=to
Bpmn_Suffix=bpmn
@@ -17,5 +17,6 @@
Translate_Error_JpdlFile_CanNotGenerate=Couldn't write process definition xml:
Translate_Error_JpdlFile_CanNotWrite=Couldn't write process definition to a jpdl file:
Translate_Error_BpmnFile_CanNotRead=Couldn't read bpmn file:
+Translate_Error_BpmnFile_CanNotParse=Couldn't parse bpmn file to a DOM document:
Translate_Warning_Bpmn_Element_Name= The bpmn element's name is null or same to another element's name:
Translate_Warning_Bpmn_Element_Type=The type of this bpmn element is not translated to corresponding jpdl element:
\ No newline at end of file
Modified: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2JMessages.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2JMessages.java 2008-08-15 09:10:55 UTC (rev 9738)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2JMessages.java 2008-08-15 09:33:33 UTC (rev 9739)
@@ -29,6 +29,7 @@
public static String Translate_Error_JpdlFile_CanNotWrite;
public static String Translate_Error_JpdlFile_CanNotGenerate;
public static String Translate_Error_BpmnFile_CanNotRead;
+ public static String Translate_Error_BpmnFile_CanNotParse;
public static String Translate_Warning_Bpmn_Element_Name;
public static String Translate_Warning_Bpmn_Element_Type;
Modified: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java 2008-08-15 09:10:55 UTC (rev 9738)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java 2008-08-15 09:33:33 UTC (rev 9739)
@@ -1,29 +1,31 @@
package org.jboss.tools.b2j.translate;
import java.io.IOException;
-import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.stp.bpmn.*;
+import org.dom4j.Document;
+import org.dom4j.Element;
import org.jboss.tools.b2j.B2J;
import org.jboss.tools.b2j.messages.B2JMessages;
-import org.jbpm.graph.def.*;
-import org.jbpm.graph.node.*;
+import org.jboss.tools.b2j.util.B2JUtil;
public class BPMN2JPDL {
- IFile bpmnFile;
- IFile[] jpdlFiles;
- List<ProcessDefinition> processDefs = new LinkedList<ProcessDefinition>();
- Map<String, String> map = new HashMap<String, String>();
+ String bpmnFileName;
+ String bpmnFilePath;
+ Document bpmnDocument;
+ List<String> poolIDList;
+ List<Document> processDefs = new LinkedList<Document>();
+ Map<String, Element> map = new HashMap<String, Element>();
+ // the warning messages when translate
List<String> warnings = new ArrayList<String>();
+
+ // the error messages when translate
List<String> errors = new ArrayList<String>();
public List<String> getErrors() {
@@ -42,40 +44,38 @@
this.warnings = warnings;
}
- public IFile[] getJpdlFiles() {
- return jpdlFiles;
+ public BPMN2JPDL() {
}
- public IFile getBpmnFile() {
- return bpmnFile;
+ public BPMN2JPDL(String bpmnFileName, String bpmnFilePath,
+ Document bpmnDocument) {
+ this(bpmnFileName, bpmnFilePath, null, bpmnDocument);
}
- public void setBpmnFile(IFile bpmnFile) {
- this.bpmnFile = bpmnFile;
+ public BPMN2JPDL(String bpmnFileName, String bpmnFilePath,
+ List<String> poolIDList, Document bpmnDocument) {
+ this.bpmnFileName = bpmnFileName;
+ this.bpmnFilePath = bpmnFilePath;
+ this.poolIDList = poolIDList;
+ this.bpmnDocument = bpmnDocument;
}
- public BPMN2JPDL() {
- }
-
- public BPMN2JPDL(IFile bpmnFile) {
- this.bpmnFile = bpmnFile;
- }
-
/*
* Translate a bpmn diagram to string[]. Every string is jpdl process
* definition
*/
public String[] translateToStrings() {
- this.translateDiagram(this.bpmnFile);
+ this.translateDiagram(this.bpmnDocument);
String[] strForProcessDefs = new String[processDefs.size()];
-
- JpdlXmlWriter writer = new JpdlXmlWriter();
int i = 0;
- for (ProcessDefinition def : processDefs) {
- writer.setWriter(new StringWriter());
- writer.setUseNamespace(true);
- strForProcessDefs[i] = translatetoString(writer, def);
- this.errors.addAll(writer.getProblems());
+ for (Document def : processDefs) {
+ try {
+ strForProcessDefs[i] = DomXmlWriter.toString(def);
+ } catch (IOException e) {
+ this.errors
+ .add(B2JMessages.Translate_Error_JpdlFile_CanNotGenerate
+ + e.getMessage());
+ }
i++;
}
@@ -83,13 +83,6 @@
}
/*
- * Tranlate a jpdl process definition to a string
- */
- private String translatetoString(JpdlXmlWriter writer, ProcessDefinition def) {
- return writer.toString(def);
- }
-
- /*
* Translate a bpmn diagram to file[]. Every file is a jpdl file
*/
public void translateToFiles() {
@@ -97,15 +90,15 @@
String[] jpdlFileNames = new String[processDefs.size()];
int i = 0;
- for (ProcessDefinition def : processDefs) {
+ for (Document def : processDefs) {
jpdlFileNames[i] = def.getName();
i++;
}
try {
- jpdlFiles = TranslateHelper.createJpdlFiles(this.getBpmnFile(),
+ B2JUtil.createJpdlFiles(bpmnFilePath, bpmnFileName,
strForProcessDefs, jpdlFileNames);
- } catch (CoreException e) {
+ } catch (Exception e) {
errors.add(B2JMessages.Translate_Error_JpdlFile_CanNotWrite
+ e.getMessage());
}
@@ -124,127 +117,148 @@
}
/*
- * Translate a bpmn diagram to jpdl process definitions
+ * Translate a bpmn diagram Domument tree to some jpdl process Dom trees
*/
- public void translateDiagram(IFile bpmnFile) {
- BpmnDiagram bpmnDiagram = null;
- try {
- bpmnDiagram = TranslateHelper.getBpmnDiagram(bpmnFile);
- } catch (IOException e) {
- errors.add(B2JMessages.Translate_Error_BpmnFile_CanNotRead
- + e.getMessage());
+ public void translateDiagram(Document bpmnDocument) {
+
+ // set the namemap = null
+ TranslateHelper.setNameMap(new HashMap<String, Integer>());
+
+ Element diagram = bpmnDocument.getRootElement();
+ if (this.poolIDList == null || this.poolIDList.size() == 0) {
+ for (Object pool : diagram.elements("pools")) {
+ translateGraph((Element) pool);
+ }
+ } else {
+ for (Object pool : diagram.elements("pools")) {
+ if (this.poolIDList.contains(((Element) pool)
+ .attributeValue("iD"))) {
+ translateGraph((Element) pool);
+ }
+ }
}
- for (Pool pool : bpmnDiagram.getPools()) {
- ProcessDefinition processDef = new ProcessDefinition();
- translateGraph(pool, processDef);
- }
-
}
/*
- * Translate a bpmn graph(pool or subprocess) to a jpdl process difinition
+ * Translate a bpmn pool or subprocess to a jpdl process Dom tree
*/
- private void translateGraph(Graph graph, ProcessDefinition processDef) {
+ private Element translateGraph(Element graph) {
+ Document processDef = DomXmlWriter.createDomTree(true);
+ Element processRoot = processDef.getRootElement();
- // if graph is subprocess type, we will check the name when look it as activity not as sub process
- if (!(graph instanceof SubProcess) && !TranslateHelper.check_mapElementName((NamedBpmnObject) graph,processDef)) {
- warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Name
- + graph.getID());
- }
- processDef.setName(TranslateHelper
- .generateProcessName((NamedBpmnObject) graph));
- processDef.setDescription(graph.getDocumentation());
-
- if (graph instanceof Pool && ((Pool) graph).getLanes().size() != 0) {
- for (Lane lane : ((Pool) graph).getLanes()) {
- for (Activity activity : lane.getActivities()) {
- translateActivity(activity, processDef);
- }
+ DomXmlWriter.addAttribute(processRoot, B2JMessages.Jpdl_Element_Name,
+ TranslateHelper.generateProcessName(graph));
+ processDef.setName(processRoot
+ .attributeValue(B2JMessages.Jpdl_Element_Name));
+
+ for (Object activity : graph.elements()) {
+ if ("vertices".equals(((Element) activity).getName())) {
+ translateActivity(((Element) activity), processRoot);
}
- } else {
- for (Vertex activity : graph.getVertices()) {
- if (activity instanceof Activity) {
- translateActivity((Activity) activity, processDef);
- }
- }
}
- translateSequenceFlows(graph, processDef);
+ translateSequenceFlows(graph, processRoot);
processDefs.add(processDef);
+ return processRoot;
}
/*
* Translate a bpmn activity to a jpdl node according to activity type
*/
- private void translateActivity(Activity activity,
- ProcessDefinition processDef) {
- ActivityType type = activity.getActivityType();
- Node element = null;
+ private void translateActivity(Element activity, Element processRoot) {
+ String type = activity.attributeValue("type");
+ Element element = null;
// According to bpmn activity type, map to different jpdl node
// Some type can not be supported by this translation, we give
// a warining message for it.
- if (ActivityType.TASK == type.getValue()) {
- element = new Node();
- } else if (ActivityType.SUB_PROCESS == type.getValue()) {
- element = new ProcessState();
- translateSubprocess((Graph)activity,
- (ProcessState) element);
- } else if (ActivityType.EVENT_START_EMPTY <= type.getValue()
- && type.getValue() <= ActivityType.EVENT_START_TIMER
- || ActivityType.EVENT_START_SIGNAL == type.getValue()) {
- element = new StartState();
- if (type.getValue() != ActivityType.EVENT_START_EMPTY) {
- warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
- + type.getName());
+ if ("bpmn:Activity".equals(type)) {
+ String activityType = activity.attributeValue("activityType");
+ if (activityType == null) {
+ element = DomXmlWriter.addElement(processRoot, "node");
+ } else if ("EventStartEmpty".equals(activityType)
+ || "EventStartMessage".equals(activityType)
+ || "EventStartRule".equals(activityType)
+ || "EventStartTimer".equals(activityType)
+ || "EventStartLink".equals(activityType)
+ || "EventStartMultiple".equals(activityType)
+ || "EventStartSignal".equals(activityType)) {
+ element = DomXmlWriter.addElement(processRoot, "start-state");
+ if (!"EventStartEmpty".equals(activityType)) {
+ warnings
+ .add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + activityType);
+ }
+ } else if ("EventIntermediateEmpty".equals(activityType)
+ || "EventIntermediateMessage".equals(activityType)
+ || "EventIntermediateTimer".equals(activityType)
+ || "EventIntermediateError".equals(activityType)
+ || "EventIntermediateCompensation".equals(activityType)
+ || "EventIntermediateRule".equals(activityType)
+ || "EventIntermediateMultiple".equals(activityType)
+ || "EventIntermediateCancel".equals(activityType)
+ || "EventIntermediateLink".equals(activityType)
+ || "EventIntermediateSignal".equals(activityType)) {
+
+ element = DomXmlWriter.addElement(processRoot, "state");
+ if (!"EventIntermediateEmpty".equals(activityType)) {
+ warnings
+ .add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + activityType);
+ }
+ } else if ("EventEndEmpty".equals(activityType)
+ || "EventEndMessage".equals(activityType)
+ || "EventEndError".equals(activityType)
+ || "EventEndCompensation".equals(activityType)
+ || "EventEndTerminate".equals(activityType)
+ || "EventEndLink".equals(activityType)
+ || "EventEndMultiple".equals(activityType)
+ || "EventEndCancel".equals(activityType)
+ || "EventEndSignal".equals(activityType)) {
+
+ element = DomXmlWriter.addElement(processRoot, "end-state");
+ if (!"EventEndEmpty".equals(activityType)) {
+ warnings
+ .add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + activityType);
+ }
+ } else if ("GatewayDataBasedExclusive".equals(activityType)
+ || "GatewayEventBasedExclusive".equals(activityType)
+ || "GatewayComplex".equals(activityType)) {
+ element = DomXmlWriter.addElement(processRoot, "decision");
+ if (!"GatewayDataBasedExclusive".equals(activityType)) {
+ warnings
+ .add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + activityType);
+ }
+ } else if ("GatewayParallel".equals(activityType)
+ || "GatewayDataBasedInclusive".equals(activityType)) {
+ if (activity.attributeValue("incomingEdges") == null
+ || activity.attributeValue("incomingEdges").split(" ").length == 1) {
+
+ element = DomXmlWriter.addElement(processRoot, "fork");
+ } else {
+ element = DomXmlWriter.addElement(processRoot, "join");
+ }
+ if (!"GatewayDataBasedInclusive".equals(activityType)) {
+ warnings
+ .add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + activityType);
+ }
}
- } else if (ActivityType.EVENT_INTERMEDIATE_EMPTY <= type.getValue()
- && type.getValue() <= ActivityType.EVENT_INTERMEDIATE_CANCEL
- || ActivityType.EVENT_INTERMEDIATE_SIGNAL == type.getValue()) {
- element = new State();
- if (type.getValue() != ActivityType.EVENT_INTERMEDIATE_EMPTY) {
- warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
- + type.getName());
- }
- } else if (ActivityType.EVENT_END_EMPTY <= type.getValue()
- && type.getValue() <= ActivityType.EVENT_END_CANCEL
- || ActivityType.EVENT_END_SIGNAL == type.getValue()) {
- element = new EndState();
- if (type.getValue() != ActivityType.EVENT_END_EMPTY) {
- warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
- + type.getName());
- }
- } else if (ActivityType.GATEWAY_DATA_BASED_EXCLUSIVE <= type.getValue()
- && type.getValue() <= ActivityType.GATEWAY_EVENT_BASED_EXCLUSIVE
- || ActivityType.GATEWAY_COMPLEX == type.getValue()) {
- element = new Decision();
- if (type.getValue() != ActivityType.GATEWAY_DATA_BASED_EXCLUSIVE) {
- warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
- + type.getName());
- }
- } else if (ActivityType.GATEWAY_PARALLEL == type.getValue()
- || ActivityType.GATEWAY_DATA_BASED_INCLUSIVE == type.getValue()) {
- if (activity.getIncomingEdges().size() <= 1) {
- element = new Fork();
- } else {
- element = new Join();
- }
- if (type.getValue() != ActivityType.GATEWAY_PARALLEL) {
- warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
- + type.getName());
- }
+ } else if ("bpmn:SubProcess".equals(type)) {
+ element = DomXmlWriter.addElement(processRoot, "process-state");
+ translateSubprocess(activity, element);
}
- element.setProcessDefinition(processDef);
- processDef.addNode(element);
- if (!TranslateHelper.check_mapElementName(activity,element)) {
+ if (!TranslateHelper.check_mapElementName(activity, element)) {
warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Name
- + activity.getID());
+ + activity.attributeValue("iD"));
}
- map.put(activity.getID(), element.getName());
+ map.put(activity.attributeValue("id"), element);
// If bpmn activity is loop type, then create a structure to mock it.
- if (activity.isLooping()) {
+ if ("true".equals(activity.attributeValue("looping"))) {
createMockLoop(activity, element);
}
}
@@ -253,79 +267,75 @@
* Translate a bpmn subprocess to a jpdl processstate and a new jpdl process
* difinition
*/
- private void translateSubprocess(Graph subProcess,
- ProcessState element) {
- ProcessDefinition processDef = new ProcessDefinition();
- translateGraph(subProcess, processDef);
- element.setSubProcessDefinition(processDef);
+ private void translateSubprocess(Element subProcess, Element element) {
+ Element processRoot = translateGraph(subProcess);
+ Element ele = DomXmlWriter.addElement(element,
+ B2JMessages.Jpdl_SubProcess_Element_Name);
+ DomXmlWriter.addAttribute(ele, B2JMessages.Jpdl_Element_Name,
+ processRoot.attributeValue(B2JMessages.Jpdl_Element_Name));
}
/*
* Translate bpmn sequenceflows to jpdl transitions
*/
- private void translateSequenceFlows(Graph graph,
- ProcessDefinition processDef) {
- for (SequenceEdge edge : graph.getSequenceEdges()) {
- translateSequenceFlow(edge, processDef);
+ private void translateSequenceFlows(Element graph, Element processRoot) {
+ for (Object edge : graph.elements("sequenceEdges")) {
+ translateSequenceFlow((Element) edge, processRoot);
}
}
/*
* Translate a bpmn sequenceflow to a jpdl transition
*/
- private void translateSequenceFlow(SequenceEdge edge,
- ProcessDefinition processDef) {
- Transition transition = new Transition();
- Node element = processDef.getNode(map.get(edge.getSource().getID()));
- if (!TranslateHelper.check_mapElementName(edge,transition)) {
- warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Name
- + edge.getID());
- }
- transition.setProcessDefinition(processDef);
+ private void translateSequenceFlow(Element edge, Element processRoot) {
- transition.setFrom(element);
- transition.setTo(processDef.getNode(map.get(edge.getTarget().getID())));
- element.addLeavingTransition(transition);
- if (SequenceFlowConditionType.DEFAULT == edge.getConditionType()
- .getValue()) {
+ Element source = map.get(edge.attributeValue("source"));
+
+ Element transition = null;
+ if ("true".equals(edge.attributeValue("isDefault"))
+ && source.element("transition") != null) {
// move default transition to the first of transition list
- element.reorderLeavingTransition(element.getLeavingTransitions()
- .size() - 1, 0);
- } else if (SequenceFlowConditionType.EXPRESSION == edge
- .getConditionType().getValue()) {
- transition.setCondition("");
+ transition = DomXmlWriter.addElement(source, "transition", 0);
+ } else {
+ transition = DomXmlWriter.addElement(source, "transition");
}
+
+ if (!TranslateHelper.check_mapElementName(edge, transition)) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Name
+ + edge.attributeValue("iD"));
+ }
+ transition.addAttribute(B2JMessages.To, map.get(
+ edge.attributeValue("target")).attributeValue(
+ B2JMessages.Jpdl_Element_Name));
}
/*
* create a jpdl decision structure to map bpmn loop activity
*/
- private void createMockLoop(Activity activity, Node element) {
+ private void createMockLoop(Element activity, Element element) {
// create a decision
- Decision decision = new Decision();
- String name = activity.getName() + B2JMessages.Loop_Decision;
- decision.setName(name);
- decision.setDescription(B2JMessages.Loop_Decision_Description);
- decision.setProcessDefinition(element.getProcessDefinition());
- element.getProcessDefinition().addNode(decision);
- map.put(activity.getID(), name);
+ Element decision = DomXmlWriter.addElement(element.getParent(),
+ "decision");
+ String name = activity.attributeValue(B2JMessages.Jpdl_Element_Name)
+ + "_" + B2JMessages.Loop_Decision;
+ DomXmlWriter
+ .addAttribute(decision, B2JMessages.Jpdl_Element_Name, name);
+ map.put(activity.attributeValue("id"), decision);
// create a transition from element to decision
- Transition first = new Transition();
- first.setName(B2JMessages.To + name);
- first.setFrom(element);
- first.setTo(decision);
- first.setProcessDefinition(element.getProcessDefinition());
- element.addLeavingTransition(first);
+ Element first = DomXmlWriter.addElement(element, "transition");
+ first.addAttribute(B2JMessages.Jpdl_Element_Name, B2JMessages.To + " "
+ + name);
+ first.addAttribute(B2JMessages.To, decision
+ .attributeValue(B2JMessages.Jpdl_Element_Name));
// create a transition from decision to element
- Transition second = new Transition();
- second.setName(B2JMessages.To + element.getName());
- second.setFrom(decision);
- second.setTo(element);
- second.setProcessDefinition(element.getProcessDefinition());
- decision.addLeavingTransition(second);
+ Element second = DomXmlWriter.addElement(decision, "transition");
+ second.addAttribute(B2JMessages.Jpdl_Element_Name, B2JMessages.To + " "
+ + element.attributeValue(B2JMessages.Jpdl_Element_Name));
+ second.addAttribute(B2JMessages.To, element
+ .attributeValue(B2JMessages.Jpdl_Element_Name));
}
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/DomXmlWriter.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/DomXmlWriter.java (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/DomXmlWriter.java 2008-08-15 09:33:33 UTC (rev 9739)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tools.b2j.translate;
+
+import java.io.*;
+import java.util.*;
+
+import org.dom4j.*;
+import org.dom4j.io.*;
+import org.jboss.tools.b2j.messages.B2JMessages;
+import org.jbpm.graph.def.*;
+import org.jbpm.graph.node.*;
+
+public class DomXmlWriter {
+
+ public static String toString(Document document) throws IOException {
+ OutputFormat outputFormat = new OutputFormat(" ", true);
+ Writer writer = new StringWriter();
+ XMLWriter xmlWriter = new XMLWriter(writer, outputFormat);
+ xmlWriter.write(document);
+ xmlWriter.flush();
+ writer.flush();
+ return writer.toString();
+ }
+
+
+ public static Document createDomTree(boolean useNamespace) {
+ Document document = DocumentHelper.createDocument();
+ Element root = null;
+
+ if (useNamespace) {
+ Namespace jbpmNamespace = new Namespace(null,
+ B2JMessages.Jpdl_32_Namespace_Url);
+ root = document.addElement(
+ B2JMessages.Jpdl_Process_Definition_Element, jbpmNamespace
+ .getURI());
+ } else {
+ root = document
+ .addElement(B2JMessages.Jpdl_Process_Definition_Element);
+ }
+ // addAttribute(root, B2JMessages.Jpdl_Element_Name, processDefinition
+ // .getName());
+ //
+ // // write the start-state
+ // if (processDefinition.getStartState() != null) {
+ // writeStartNode(root, (StartState) processDefinition.getStartState());
+ // }
+ //
+ // // write the nodeMap
+ // if ((processDefinition.getNodes() != null)
+ // && (processDefinition.getNodes().size() > 0)) {
+ // writeNodes(root, processDefinition.getNodes());
+ // }
+
+ root.addText(System.getProperty("line.separator"));
+
+ return document;
+ }
+
+ private void writeStartNode(Element element, StartState startState) {
+ if (startState != null) {
+ // writeNode(addElement(element, getTypeName(startState)),
+ // startState);
+ }
+ }
+
+ private void writeNodes(Element parentElement, Collection<?> nodes) {
+ Iterator<?> iter = nodes.iterator();
+ while (iter.hasNext()) {
+ org.jbpm.graph.def.Node node = (org.jbpm.graph.def.Node) iter
+ .next();
+ if (!(node instanceof StartState)) {
+ Element nodeElement = addElement(parentElement, ProcessFactory
+ .getTypeName(node));
+ node.write(nodeElement);
+ // writeNode(nodeElement, node);
+ }
+ }
+ }
+
+ public static void writeNode(Element activity, Element node) {
+ addAttribute(node, B2JMessages.Jpdl_Element_Name, activity.getName());
+
+ // if
+ // (B2JMessages.Jpdl_ProcessState_Element_Name.equals(getTypeName(node
+ // ))) {
+ // Element ele =
+ // addElement(node,B2JMessages.Jpdl_SubProcess_Element_Name);
+ // addAttribute(ele, B2JMessages.Jpdl_Element_Name,((ProcessState)
+ // node).getSubProcessDefinition().getName());
+ // }
+ }
+
+ private void writeTransitions(Element element, org.jbpm.graph.def.Node node) {
+ if (node.getLeavingTransitionsMap() != null) {
+ Iterator<?> iter = node.getLeavingTransitionsList().iterator();
+ while (iter.hasNext()) {
+ Transition transition = (Transition) iter.next();
+ writeTransition(element
+ .addElement(B2JMessages.Jpdl_Transition_Element),
+ transition);
+ }
+ }
+ }
+
+ private void writeTransition(Element transitionElement,
+ Transition transition) {
+ if (transition.getTo() != null) {
+ transitionElement.addAttribute(B2JMessages.To, transition.getTo()
+ .getName());
+ }
+ if (transition.getName() != null) {
+ transitionElement.addAttribute(B2JMessages.Jpdl_Element_Name,
+ transition.getName());
+ }
+ }
+
+ public static Element addElement(Element element, String elementName) {
+ Element newElement = element.addElement(elementName);
+ return newElement;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Element addElement(Element element, String elementName,
+ int location) {
+ Element newElement = null;
+ if (element.elements("transtion") != null
+ && element.elements("transtion").size() > location
+ && location >= 0) {
+ element = DocumentHelper.createElement(elementName);
+ element.elements("transtion").add(location, newElement);
+ }
+ return newElement;
+ }
+
+ public static void addAttribute(Element e, String attributeName,
+ String value) {
+ if (value != null) {
+ e.addAttribute(attributeName, value);
+ }
+ }
+
+}
Deleted: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java 2008-08-15 09:10:55 UTC (rev 9738)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java 2008-08-15 09:33:33 UTC (rev 9739)
@@ -1,211 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.tools.b2j.translate;
-
-import java.io.*;
-import java.util.*;
-
-import org.dom4j.*;
-import org.dom4j.io.*;
-import org.jboss.tools.b2j.messages.B2JMessages;
-import org.jbpm.graph.def.*;
-import org.jbpm.graph.node.*;
-
-public class JpdlXmlWriter {
-
- Namespace jbpmNamespace = new Namespace(null,
- B2JMessages.Jpdl_32_Namespace_Url);
- Writer writer;
- boolean useNamespace = false;
-
- List<String> errors;
-
- public List<String> getProblems() {
- return errors;
- }
-
- public void setProblems(List<String> errors) {
- this.errors = errors;
- }
-
- public Namespace getJbpmNamespace() {
- return jbpmNamespace;
- }
-
- public void setJbpmNamespace(Namespace jbpmNamespace) {
- this.jbpmNamespace = jbpmNamespace;
- }
-
- public JpdlXmlWriter() {
- }
-
- public void addError(String msg) {
- errors.add(msg);
- }
-
- public String toString(ProcessDefinition processDefinition) {
- write(processDefinition);
- return writer.toString();
- }
-
- public void setUseNamespace(boolean useNamespace) {
- this.useNamespace = useNamespace;
- }
-
- public void write(ProcessDefinition processDefinition) {
- errors = new ArrayList<String>();
- if (writer == null) {
- addError(B2JMessages.Translate_Error_JpdlWriter_Null);
- }
- if (processDefinition == null) {
- addError(B2JMessages.Translate_Error_JpdlProcess_Definition_Null);
- }
- try {
- // collect the actions of the process definition
- // we will remove each named event action and the remaining ones
- // will be written
- // on the process definition.
- // create a dom4j dom-tree for the process definition
- Document document = createDomTree(processDefinition);
-
- // write the dom-tree to the given writer
- OutputFormat outputFormat = new OutputFormat(" ", true);
- // OutputFormat outputFormat = OutputFormat.createPrettyPrint();
- XMLWriter xmlWriter = new XMLWriter(writer, outputFormat);
- xmlWriter.write(document);
- xmlWriter.flush();
- writer.flush();
- } catch (IOException e) {
- addError(B2JMessages.Translate_Error_JpdlFile_CanNotGenerate
- + e.getMessage());
- }
- }
-
- private Document createDomTree(ProcessDefinition processDefinition) {
- Document document = DocumentHelper.createDocument();
- Element root = null;
-
- if (useNamespace) {
- root = document.addElement(
- B2JMessages.Jpdl_Process_Definition_Element, jbpmNamespace
- .getURI());
- } else {
- root = document
- .addElement(B2JMessages.Jpdl_Process_Definition_Element);
- }
- addAttribute(root, B2JMessages.Jpdl_Element_Name, processDefinition
- .getName());
-
- // write the start-state
- if (processDefinition.getStartState() != null) {
- writeStartNode(root, (StartState) processDefinition.getStartState());
- }
-
- // write the nodeMap
- if ((processDefinition.getNodes() != null)
- && (processDefinition.getNodes().size() > 0)) {
- writeNodes(root, processDefinition.getNodes());
- }
-
- root.addText(System.getProperty("line.separator"));
-
- return document;
- }
-
- private void writeStartNode(Element element, StartState startState) {
- if (startState != null) {
- writeNode(addElement(element, getTypeName(startState)), startState);
- }
- }
-
- private void writeNodes(Element parentElement, Collection<?> nodes) {
- Iterator<?> iter = nodes.iterator();
- while (iter.hasNext()) {
- org.jbpm.graph.def.Node node = (org.jbpm.graph.def.Node) iter
- .next();
- if (!(node instanceof StartState)) {
- Element nodeElement = addElement(parentElement, ProcessFactory
- .getTypeName(node));
- node.write(nodeElement);
- writeNode(nodeElement, node);
- }
- }
- }
-
- private void writeNode(Element element, org.jbpm.graph.def.Node node) {
- addAttribute(element, B2JMessages.Jpdl_Element_Name, node.getName());
-
- if (B2JMessages.Jpdl_ProcessState_Element_Name
- .equals(getTypeName(node))) {
- Element ele = addElement(element,
- B2JMessages.Jpdl_SubProcess_Element_Name);
- addAttribute(ele, B2JMessages.Jpdl_Element_Name,
- ((ProcessState) node).getSubProcessDefinition().getName());
- }
-
- writeTransitions(element, node);
- }
-
- private void writeTransitions(Element element, org.jbpm.graph.def.Node node) {
- if (node.getLeavingTransitionsMap() != null) {
- Iterator<?> iter = node.getLeavingTransitionsList().iterator();
- while (iter.hasNext()) {
- Transition transition = (Transition) iter.next();
- writeTransition(element
- .addElement(B2JMessages.Jpdl_Transition_Element),
- transition);
- }
- }
- }
-
- private void writeTransition(Element transitionElement,
- Transition transition) {
- if (transition.getTo() != null) {
- transitionElement.addAttribute(B2JMessages.To, transition.getTo()
- .getName());
- }
- if (transition.getName() != null) {
- transitionElement.addAttribute(B2JMessages.Jpdl_Element_Name,
- transition.getName());
- }
- }
-
- private Element addElement(Element element, String elementName) {
- Element newElement = element.addElement(elementName);
- return newElement;
- }
-
- private void addAttribute(Element e, String attributeName, String value) {
- if (value != null) {
- e.addAttribute(attributeName, value);
- }
- }
-
- private String getTypeName(Object o) {
- return ProcessFactory.getTypeName((org.jbpm.graph.def.Node) o);
- }
-
- public void setWriter(Writer writer) {
- this.writer = writer;
- }
-
-}
Modified: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/TranslateHelper.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/TranslateHelper.java 2008-08-15 09:10:55 UTC (rev 9738)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/TranslateHelper.java 2008-08-15 09:33:33 UTC (rev 9739)
@@ -1,82 +1,35 @@
package org.jboss.tools.b2j.translate;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory;
-import org.eclipse.stp.bpmn.BpmnDiagram;
-import org.eclipse.stp.bpmn.NamedBpmnObject;
+import org.dom4j.Element;
import org.jboss.tools.b2j.messages.B2JMessages;
-import org.jboss.tools.b2j.util.B2JUtil;
-import org.jbpm.graph.def.GraphElement;
public class TranslateHelper {
static Map<String, Integer> nameMap = new HashMap<String, Integer>();
+
+
- /*
- * get a bpmn diagram from a bpmn file
- */
- public static BpmnDiagram getBpmnDiagram(IFile bpmnFile) throws IOException {
- nameMap.clear();
- GMFResourceFactory RESOURCE_FACTORY = new GMFResourceFactory();
- ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
- .put(B2JMessages.Bpmn_Suffix, RESOURCE_FACTORY);
- URI uriBpmn = URI.createURI(B2JMessages.Workspace_Prefix
- + bpmnFile.getFullPath());
- Resource resBpmn = resourceSet.createResource(uriBpmn);
- resBpmn.load(GMFResourceFactory.getDefaultLoadOptions());
- return (BpmnDiagram) resBpmn.getContents().get(0);
+ public static void setNameMap(Map<String, Integer> nameMap) {
+ TranslateHelper.nameMap = nameMap;
}
- public static IFile[] createJpdlFiles(IFile bpmnFile,
- String[] strForProcessDefs, String[] jpdlFileNames)
- throws CoreException {
- IFolder jpdlFolder = B2JUtil.createFolder(bpmnFile.getParent(),
- B2JMessages.Jpdl_Suffix);
- IFolder diagramFolder = B2JUtil.createFolder(jpdlFolder, bpmnFile
- .getName());
-
- IFile[] jpdlFiles = new IFile[strForProcessDefs.length];
- IFolder processFolder = null;
- int i = 0;
- ByteArrayInputStream bytes = null;
- for (String str : strForProcessDefs) {
- bytes = new ByteArrayInputStream(str.getBytes());
- processFolder = B2JUtil.createFolder(diagramFolder,
- jpdlFileNames[i]);
- jpdlFiles[i] = B2JUtil.createFile(processFolder,
- B2JMessages.Jpdl_Process_Definition_Name, bytes);
- i++;
- }
- return jpdlFiles;
- }
-
/*
* generate a process definition name. the name is composed of the names
* from bpmn diagram to the element
*/
- public static String generateProcessName(NamedBpmnObject graph) {
- if (graph instanceof BpmnDiagram) {
- return graph.getName();
+ public static String generateProcessName(Element graph) {
+ if ("BpmnDiagram".equals(graph.getName())) {
+ return graph.attributeValue("name");
} else {
- String str = generateProcessName((NamedBpmnObject) graph
- .eContainer());
+ String str = generateProcessName(graph.getParent());
if (str == null) {
- return graph.getName();
+ return graph.attributeValue("name");
} else {
return str + B2JMessages.Folder_Name_Separator
- + graph.getName();
+ + graph.attributeValue("name");
}
}
@@ -84,24 +37,25 @@
/*
* check the bpmn element name is null or "" or same to another element name
- * and generate jpdl name
+ * and generate a different name
*/
- public static boolean check_mapElementName(NamedBpmnObject graph,
- GraphElement graphEle) {
+ public static boolean check_mapElementName(Element graph, Element graphEle) {
- boolean isOk = false;
- String name = graph.getName();
- if (graph.getName() == null || "".equals(graph.getName())) {
- name = "graph";
+ boolean isOk = true;
+ String name = graph.attributeValue(B2JMessages.Jpdl_Element_Name);
+
+ if (name == null || "".equals(name)) {
+ name = "jboss_autogen";
+ isOk = false;
}
Integer i = nameMap.get(name);
if (i == null) {
- graphEle.setName(name);
+ DomXmlWriter.addAttribute(graphEle,B2JMessages.Jpdl_Element_Name, name);
nameMap.put(name, new Integer("1"));
- isOk = true;
} else {
- graphEle.setName(name + "_" + i);
+ DomXmlWriter.addAttribute(graphEle,B2JMessages.Jpdl_Element_Name, name + "_" + i);
nameMap.put(name, ++i);
+ isOk = false;
}
return isOk;
Modified: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/util/B2JUtil.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/util/B2JUtil.java 2008-08-15 09:10:55 UTC (rev 9738)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/util/B2JUtil.java 2008-08-15 09:33:33 UTC (rev 9739)
@@ -1,61 +1,117 @@
package org.jboss.tools.b2j.util;
-import java.io.InputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.dom4j.Document;
+import org.dom4j.io.SAXReader;
+import org.jboss.tools.b2j.messages.B2JMessages;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
public class B2JUtil {
- public static IFolder createFolder(IContainer parent, String folderName)
- throws CoreException {
- IResource child = parent.findMember(folderName);
- if (child == null) {
- IFolder folder = parent.getFolder(new Path(folderName));
- folder.create(true, true, null);
- return folder;
+ public static File createFile(String parentFolder, String fileName,
+ String inputStr) throws IOException {
+ File child = new File(parentFolder, fileName);
+ if (inputStr == null) {
+ if (!child.exists()) {
+ child.mkdir();
+ }
} else {
- if (child.getType() == IResource.FOLDER) {
- return (IFolder) child;
- } else {
- return null;
+ if (!child.exists()) {
+ child.createNewFile();
}
+ FileWriter childWriter = new FileWriter(child);
+ PrintWriter printFile = new PrintWriter(childWriter);
+ printFile.println(inputStr);
+ printFile.close();
+ childWriter.close();
+
}
+ return child;
}
- public static IFile createFile(IContainer parent, String fileName,
- InputStream inputStream) throws CoreException {
- IResource child = parent.findMember(fileName);
+ public static File[] createJpdlFiles(String parentFolder,
+ String bpmnFileName, String[] strForProcessDefs,
+ String[] jpdlFileNames) throws IOException {
+ File jpdlFolder = B2JUtil.createFile(parentFolder,
+ B2JMessages.Jpdl_Suffix, null);
+ File diagramFolder = B2JUtil.createFile(jpdlFolder.getAbsolutePath(),
+ bpmnFileName, null);
- if (child != null) {
- if (child.getType() == IResource.FILE) {
+ File[] jpdlFiles = new File[strForProcessDefs.length];
+ File processFolder = null;
+ int i = 0;
+ for (String str : strForProcessDefs) {
+ processFolder = B2JUtil.createFile(diagramFolder.getAbsolutePath(),
+ jpdlFileNames[i], null);
+ jpdlFiles[i] = B2JUtil.createFile(processFolder.getAbsolutePath(),
+ B2JMessages.Jpdl_Process_Definition_Name, str);
+ i++;
+ }
+ return jpdlFiles;
+ }
- // We have permission to overwrite so check if file is read-only
- if (child.getResourceAttributes() != null
- && child.getResourceAttributes().isReadOnly()) {
- IFile[] files = new IFile[1];
- files[0] = (IFile) child;
- }
+ public static InputSource getInpuSource(String path, String name)
+ throws FileNotFoundException {
+ File file = new File(path, name);
+ return new InputSource(new FileReader(file));
- // Change the contents of the existing file.
- IFile file = parent.getFile(new Path(fileName));
- file.setContents(inputStream, true, true, null);
+ }
- return file;
+ public static Document parse(InputSource inputSource) throws Exception {
+ Document document = null;
+ SAXReader saxReader = createSaxReader();
+ document = saxReader.read(inputSource);
+ return document;
+ }
- } else {
- return null;
- }
- } else {
- // Create a new file.
- IFile file = parent.getFile(new Path(fileName));
- file.create(inputStream, true, null);
- return file;
+ public static SAXReader createSaxReader() throws Exception {
+ XMLReader xmlReader = createXmlReader();
+ SAXReader saxReader = new SAXReader(xmlReader);
+ return saxReader;
+ }
+
+ public static XMLReader createXmlReader() throws Exception {
+
+ SAXParser saxParser = createSaxParserFactory().newSAXParser();
+ XMLReader xmlReader = saxParser.getXMLReader();
+
+ try {
+ saxParser.setProperty(
+ "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+ "http://www.w3.org/2001/XMLSchema");
+ } catch (SAXException e) {
+ // log.warn(
+ // "couldn't set xml parser property 'http://java.sun.com/xml/jaxp/properties/schemaLanguage' to 'http://www.w3.org/2001/XMLSchema'"
+ // , e);
}
+
+ try {
+ xmlReader.setFeature(
+ "http://apache.org/xml/features/validation/dynamic", true);
+ } catch (SAXException e) {
+ // log.warn(
+ // "couldn't set xml parser feature 'http://apache.org/xml/features/validation/dynamic'"
+ // , e);
+ }
+ return xmlReader;
}
+ private static SAXParserFactory createSaxParserFactory() {
+ SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ saxParserFactory.setValidating(true);
+ saxParserFactory.setNamespaceAware(true);
+ return saxParserFactory;
+ }
+
}
17 years, 4 months
JBoss Tools SVN: r9738 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-08-15 05:10:55 -0400 (Fri, 15 Aug 2008)
New Revision: 9738
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
Log:
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2008-08-15 03:19:03 UTC (rev 9737)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2008-08-15 09:10:55 UTC (rev 9738)
@@ -47,7 +47,7 @@
super();
this.jpaProject = jpaProject;
this.selection = selection;
- this.setWindowTitle( JptUiMessages.GenerateEntitiesWizard_generateEntities);
+ this.setWindowTitle( JptUiMessages.GenericPlatformUiDialog_notSupportedMessageTitle);
}
@Override
17 years, 4 months
JBoss Tools SVN: r9737 - workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-08-14 23:19:03 -0400 (Thu, 14 Aug 2008)
New Revision: 9737
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
Log:
remove all graphical figure change event to the PaintLitener
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-08-15 03:16:10 UTC (rev 9736)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-08-15 03:19:03 UTC (rev 9737)
@@ -26,12 +26,15 @@
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.TreeEvent;
import org.eclipse.swt.events.TreeListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.forms.IManagedForm;
@@ -133,31 +136,18 @@
event.doit = true;
}
});
-// sourceViewer.getTree().addListener(SWT.m, listener)
- sourceViewer.getTree().addTreeListener(new TreeListener(){
-
- public void treeCollapsed(TreeEvent e) {
- treeExpanded(e);
- }
-
- public void treeExpanded(TreeEvent e) {
+ sourceViewer.getTree().addPaintListener(new PaintListener(){
+ public void paintControl(PaintEvent e) {
rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
null, new Object());
}
-
});
-// (new PaintListener() {
-// public void paintControl(PaintEvent e) {
-// rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
-// null, new Object());
-// }
-// });
+
if (initSourceTreeViewerProviders()) {
initSourceTreeViewer();
}
composite1.setLayoutData(gd);
composite1.setBackground(GraphicsConstants.groupBorderColor);
- // toolkit.paintBordersFor(composite1);
}
{
Composite composite2 = toolkit
@@ -198,17 +188,11 @@
// null, new Object());
// }
// });
- targetViewer.getTree().addTreeListener(new TreeListener(){
-
- public void treeCollapsed(TreeEvent e) {
- treeExpanded(e);
- }
-
- public void treeExpanded(TreeEvent e) {
+ targetViewer.getTree().addPaintListener(new PaintListener(){
+ public void paintControl(PaintEvent e) {
rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
null, new Object());
}
-
});
if (initTargetTreeViewerProviders()) {
initTargetTreeViewer();
17 years, 4 months
JBoss Tools SVN: r9736 - workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-08-14 23:16:10 -0400 (Thu, 14 Aug 2008)
New Revision: 9736
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures/TreeItemRelationFigure.java
Log:
Change the way of calculating of connectionpointfigure's location
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures/TreeItemRelationFigure.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures/TreeItemRelationFigure.java 2008-08-14 21:18:56 UTC (rev 9735)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/figures/TreeItemRelationFigure.java 2008-08-15 03:16:10 UTC (rev 9736)
@@ -14,6 +14,7 @@
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.RectangleFigure;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
@@ -44,46 +45,23 @@
graphics.popState();
}
- protected void setLocationYToTheFigure(TreeItem[] items, boolean addY,
- int addHeight) {
- for (int i = 0; i < items.length; i++) {
- TreeItem item = items[i];
- if (treeItem == item) {
- setLocation(new Point(-1, caculateY));
- return;
- } else {
- if (item.getItemCount() > 0) {
- if (item.getExpanded()) {
- if (addY)
- caculateY += addHeight;
- setLocationYToTheFigure(item.getItems(), true,
- addHeight);
- continue;
- } else {
- setLocationYToTheFigure(item.getItems(), false,
- addHeight);
- if(addY) caculateY += addHeight;
- continue;
- }
- } else {
- if (addY)
- caculateY += addHeight;
- }
- }
- }
- }
public void caculateLocationY() {
if (treeItem != null) {
-
- if (treeItem.getText().startsWith("quantity")) {
- System.out.println();
- }
+ int y = this.collapsedParentItemLocation(treeItem);
Tree tree = treeItem.getParent();
- caculateY = tree.getItemHeight() / 2 + tree.getBorderWidth();
- setLocationYToTheFigure(tree.getItems(), true,
- tree.getItemHeight() + 2);
+ int height = tree.getItemHeight();
+ this.setLocation(new Point(0, y + height/2));
}
}
+ protected int collapsedParentItemLocation(TreeItem item) {
+ int y = item.getBounds().y;
+ if (y == 0) {
+ if (item.getParentItem() != null)
+ return this.collapsedParentItemLocation(item.getParentItem());
+ }
+ return y;
+ }
+
}
17 years, 4 months
JBoss Tools SVN: r9733 - in trunk/hibernatetools/plugins: org.jboss.tools.hibernate.jpt.ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-08-14 17:12:19 -0400 (Thu, 14 Aug 2008)
New Revision: 9733
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/build.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-2244
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2008-08-14 18:44:04 UTC (rev 9732)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2008-08-14 21:12:19 UTC (rev 9733)
@@ -15,5 +15,7 @@
org.eclipse.wst.common.project.facet.core;bundle-version="1.3.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Hibernate Team
+Export-Package: org.jboss.tools.hibernate.jpt.core.internal,
+ org.jboss.tools.hibernate.jpt.core.internal.context
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF 2008-08-14 18:44:04 UTC (rev 9732)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF 2008-08-14 21:12:19 UTC (rev 9733)
@@ -25,3 +25,6 @@
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Hibernate Team
+Export-Package: org.jboss.tools.hibernate.jpt.ui,
+ org.jboss.tools.hibernate.jpt.ui.internal.platform,
+ org.jboss.tools.hibernate.jpt.ui.wizard
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/build.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/build.properties 2008-08-14 18:44:04 UTC (rev 9732)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/build.properties 2008-08-14 21:12:19 UTC (rev 9733)
@@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ plugin.xml
17 years, 4 months
JBoss Tools SVN: r9732 - in trunk/seam/tests/org.jboss.tools.seam.ui.test/projects: TestSeamELContentAssist and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-08-14 14:44:04 -0400 (Thu, 14 Aug 2008)
New Revision: 9732
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/.classpath
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/.classpath
Log:
to fix test exceptions in seam.ui tests server containers references were removed from .classpath files
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/.classpath
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/.classpath 2008-08-14 18:36:19 UTC (rev 9731)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/.classpath 2008-08-14 18:44:04 UTC (rev 9732)
@@ -3,6 +3,5 @@
<classpathentry kind="src" path="JavaSource"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/>
<classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
</classpath>
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/.classpath
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/.classpath 2008-08-14 18:36:19 UTC (rev 9731)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/.classpath 2008-08-14 18:44:04 UTC (rev 9732)
@@ -1,10 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="WebContent/WEB-INF/dev" path="src/action"/>
- <classpathentry kind="src" path="src/model"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeInitializer/JBoss 4.2 Runtime"/>
- <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
- <classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
- <classpathentry kind="output" path="build/classes"/>
-</classpath>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="WebContent/WEB-INF/dev" path="src/action"/>
+ <classpathentry kind="src" path="src/model"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
17 years, 4 months