Author: Grid.Qian
Date: 2008-11-19 01:48:59 -0500 (Wed, 19 Nov 2008)
New Revision: 11876
Added:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/AbstractConvertWizardPage.java
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2J.properties
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2JMessages.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/BPMN2JPDL.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/GraphicalFileGenerator.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/wizard/B2JExportWizard.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BPMNResourcesChoicePage.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BpmnPoolsChoicePage.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BpmnToWizard.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/ErrorMessagesPage.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/GeneratedFileLocationPage.java
Log:
JBIDE-3218: jbpm converter module codes review
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2J.properties
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2J.properties 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2J.properties 2008-11-19
06:48:59 UTC (rev 11876)
@@ -31,17 +31,18 @@
Bpmn_File_Choose_WizardPage_ViewerTitle=BPMN resources
Bpmn_File_Choose_WizardPage_Message=Select BPMN resources to convert
Bpmn_Pool_Choose_WizardPage_Name=PoolPage
-Bpmn_Pool_Choose_WizardPage_Message=BPMN Pools
-Bpmn_Pool_Choose_WizardPage_Title=Select BPMN pools to translate
+Bpmn_Pool_Choose_WizardPage_Title=BPMN Pools
+Bpmn_Pool_Choose_WizardPage_ViewerTitle=BPMN pools
+Bpmn_Pool_Choose_WizardPage_Message=Select BPMN pools to translate
Bpmn_GeneratedFile_Location_WizardPage_Name=LocationPage
-Bpmn_GeneratedFile_Location_WizardPage_Message=Select the target location
Bpmn_GeneratedFile_Location_WizardPage_Title=Target Location
Bpmn_GeneratedFile_Location_WizardPage_ViewerTitle=Target location
+Bpmn_GeneratedFile_Location_WizardPage_Message=Select the target location
Bpmn_GeneratedFile_Location_WizardPage_CheckBox=Overwrite existing resources
Bpmn_Translate_Message_WizardPage_Name=MessagePage
Bpmn_Translate_Message_WizardPage_Title=Conversion Warnings and Errors
+Bpmn_Translate_Message_WizardpageViewer_Title=Warnings and Errors
Bpmn_Translate_Message_WizardPage_Message=Warnings and Errors that occurred during
conversion
-Bpmn_Translate_Message_WizardpageViewer_Title=Warnings and Errors
Bpmn_EAnnotations_Element_Name=eAnnotations
Bpmn_Details_Element_Name=details
Bpmn_Value_Attribute_Name=value
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2JMessages.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2JMessages.java 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2JMessages.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -58,6 +58,7 @@
public static String Bpmn_Pool_Choose_WizardPage_Name;
public static String Bpmn_Pool_Choose_WizardPage_Message;
public static String Bpmn_Pool_Choose_WizardPage_Title;
+ public static String Bpmn_Pool_Choose_WizardPage_ViewerTitle;
public static String Bpmn_GeneratedFile_Location_WizardPage_Name;
public static String Bpmn_GeneratedFile_Location_WizardPage_Message;
public static String Bpmn_GeneratedFile_Location_WizardPage_Title;
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/BPMN2JPDL.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/BPMN2JPDL.java 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/BPMN2JPDL.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -32,19 +32,10 @@
*/
public class BPMN2JPDL extends BPMNTranslator {
- Document bpmnDocument;
- List<Document> processDefs = new ArrayList<Document>();
+ private Document bpmnDocument;
+ private List<Document> processDefs = new ArrayList<Document>();
+ private Map<String, Element> map = new HashMap<String, Element>();
- Map<String, Element> map = new HashMap<String, Element>();
-
- public Map<String, Element> getMap() {
- return map;
- }
-
- public void setMap(Map<String, Element> map) {
- this.map = map;
- }
-
public BPMN2JPDL() {
}
@@ -408,14 +399,7 @@
warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Name
+ edge.attributeValue(B2JMessages.Bpmn_Element_ID));
}
- transition
- .addAttribute(
- B2JMessages.To,
- map
- .get(
- edge
- .attributeValue(B2JMessages.Bpmn_FlowTarget_Attribute_Name))
- .attributeValue(B2JMessages.Dom_Element_Name));
+ transition.addAttribute(B2JMessages.To,map.get(edge.attributeValue(B2JMessages.Bpmn_FlowTarget_Attribute_Name)).attributeValue(B2JMessages.Dom_Element_Name));
}
/*
@@ -463,4 +447,11 @@
this.processDefs = processDefs;
}
+ public Map<String, Element> getMap() {
+ return map;
+ }
+
+ public void setMap(Map<String, Element> map) {
+ this.map = map;
+ }
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/GraphicalFileGenerator.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/GraphicalFileGenerator.java 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/GraphicalFileGenerator.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -32,14 +32,12 @@
*/
public class GraphicalFileGenerator extends BPMNTranslator {
- Document document;
-
+ private Document document;
// gpd.xml documents list
- List<Document> gpdDefs = new ArrayList<Document>();
-
+ private List<Document> gpdDefs = new ArrayList<Document>();
// the pool of gpd.xml name
- List<String> gpdPoolNames = new ArrayList<String>();
- Map<String, Element> map = new HashMap<String, Element>();
+ private List<String> gpdPoolNames = new ArrayList<String>();
+ private Map<String, Element> map = new HashMap<String, Element>();
public GraphicalFileGenerator(Document bpmnDiagramDocument,
Map<String, Element> map, String rootLocation, String bpmnFileName) {
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/wizard/B2JExportWizard.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/wizard/B2JExportWizard.java 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/wizard/B2JExportWizard.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -38,9 +38,6 @@
private List<String> generatedGpdFoldersList = new ArrayList<String>();
public void createGeneratedFile(boolean isOverWrite) {
- if(!isOverWrite){
- return;
- }
String[] jpdlFolderNames = new String[this.generatedFoldersList.size()];
String location = super.getContainerPath((IContainer) super
Added:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/AbstractConvertWizardPage.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/AbstractConvertWizardPage.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/AbstractConvertWizardPage.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.jbpm.convert.bpmnto.wizard;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Grid Qian
+ *
+ * this class is a abstract wizard page.
+ */
+abstract public class AbstractConvertWizardPage extends WizardPage {
+
+ public String tableTitle;
+
+ public AbstractConvertWizardPage(String pageName, String pageTitle,
+ String tableTitle, String pageDescription) {
+ super(pageName);
+ this.setTitle(pageTitle);
+ this.setDescription(pageDescription);
+ this.tableTitle = tableTitle;
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = createDialogArea(parent);
+ createTableTitleArea(composite);
+ createTableViewer(composite);
+ addOtherAreas(composite);
+ setControl(composite);
+
+ initializePage();
+ }
+
+ private Composite createDialogArea(Composite parent) {
+ // create a composite with standard margins and spacing
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 7;
+ layout.marginWidth = 7;
+ layout.verticalSpacing = 4;
+ layout.horizontalSpacing = 4;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ return composite;
+ }
+
+ private Label createTableTitleArea(Composite composite) {
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(tableTitle);
+ label.setFont(composite.getFont());
+ return label;
+ }
+
+ protected void addOtherAreas(Composite composite) {
+ // TODO if need, sub-class may overwrite this method to add other ui
+ // element
+ }
+
+ protected void initializePage() {
+ // TODO if need, sub-class may overwrite this method to do some
+ // initialize works
+ }
+
+ protected void updateControls() {
+ super.getWizard().getContainer().updateButtons();
+ }
+
+ // create a table view
+ abstract public void createTableViewer(Composite composite);
+
+}
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BPMNResourcesChoicePage.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BPMNResourcesChoicePage.java 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BPMNResourcesChoicePage.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -24,53 +24,30 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.jboss.tools.jbpm.convert.b2j.messages.B2JMessages;
import org.jboss.tools.jbpm.convert.bpmnto.util.BPMNToUtil;
/**
* @author Grid Qian
*
- * the wizardpage used by user to choose the bpmn file
+ * the wizardpage used by user to choose the bpmn file
*/
-public class BPMNResourcesChoicePage extends WizardPage {
-
+public class BPMNResourcesChoicePage extends AbstractConvertWizardPage {
+
private TreeViewer viewer;
private ISelection currentSelection;
private IWizard wizard;
public BPMNResourcesChoicePage(String pageName, String title,
- String description) {
- super(pageName);
- this.setTitle(title);
- this.setDescription(description);
+ String tableTitle, String description) {
+ super(pageName, title, tableTitle, description);
}
- public void createControl(Composite parent) {
- Composite composite = createDialogArea(parent);
-
- createListTitleArea(composite);
- createListViewer(composite);
- super.setControl(composite);
-
- initializePage();
- }
-
- private Label createListTitleArea(Composite composite) {
- Label label = new Label(composite, SWT.NONE);
- label.setText(B2JMessages.Bpmn_File_Choose_WizardPage_ViewerTitle);
- label.setFont(composite.getFont());
- return label;
- }
-
- private void createListViewer(Composite composite) {
+ public void createTableViewer(Composite composite) {
viewer = new TreeViewer(composite, SWT.BORDER | SWT.MULTI
| SWT.H_SCROLL | SWT.V_SCROLL);
viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -89,7 +66,7 @@
});
}
- private void initializePage() {
+ public void initializePage() {
wizard = this.getWizard();
viewer.setInput(ResourcesPlugin.getWorkspace());
if (this.currentSelection != null) {
@@ -105,23 +82,6 @@
return super.isPageComplete();
}
- private void updateControls() {
- super.getWizard().getContainer().updateButtons();
- }
-
- private Composite createDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 7;
- layout.marginWidth = 7;
- layout.verticalSpacing = 4;
- layout.horizontalSpacing = 4;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- return composite;
- }
-
public void setSelection(ISelection selection) {
this.currentSelection = selection;
}
@@ -133,7 +93,7 @@
class ProjectFilter extends ViewerFilter {
private static String BPMN_FILE_EXT = "bpmn";
-
+
@Override
public boolean select(Viewer viewer, Object parent, Object element) {
boolean res = false;
@@ -144,26 +104,27 @@
}
}
if (element instanceof IContainer) {
- IContainer container = (IContainer)element;
+ IContainer container = (IContainer) element;
if (container.getProject().isAccessible()) {
res = hasBPMNResources(container);
}
}
return res;
}
-
+
private boolean hasBPMNResources(IContainer container) {
boolean res = false;
try {
IResource[] resources = container.members();
for (int i = 0; i < resources.length; i++) {
if (resources[i] instanceof IFile
- && ((IFile)resources[i]).getFileExtension().equalsIgnoreCase(BPMN_FILE_EXT))
{
+ && ((IFile) resources[i]).getFileExtension()
+ .equalsIgnoreCase(BPMN_FILE_EXT)) {
res = true;
break;
}
if (resources[i] instanceof IContainer) {
- if (hasBPMNResources((IContainer)resources[i])) {
+ if (hasBPMNResources((IContainer) resources[i])) {
res = true;
break;
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BpmnPoolsChoicePage.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BpmnPoolsChoicePage.java 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BpmnPoolsChoicePage.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -20,7 +20,6 @@
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -29,7 +28,6 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.jboss.tools.jbpm.convert.b2j.messages.B2JMessages;
import org.jboss.tools.jbpm.convert.bpmnto.wizard.BpmnToWizard;
@@ -40,42 +38,21 @@
* the wizardpage used by user to choose the bpmn pool from a bpmn
* diagram
*/
-public class BpmnPoolsChoicePage extends WizardPage {
+public class BpmnPoolsChoicePage extends AbstractConvertWizardPage {
CheckboxTableViewer listViewer;
Button selectButton;
Button deselectButton;
- String listTitle;
private Map<String, String> idMap;
private IWizard wizard;
- public BpmnPoolsChoicePage(String pageName, String title, String listTitle) {
- super(pageName);
- this.listTitle = listTitle;
- this.setDescription(title);
- this.setTitle(listTitle);
+ public BpmnPoolsChoicePage(String pageName, String title,
+ String tableTitle, String description) {
+ super(pageName, title, tableTitle, description);
}
- public void createControl(Composite parent) {
- Composite composite = createDialogArea(parent);
-
- createListTitleArea(composite);
- createListViewer(composite);
- addSelectionButtons(composite);
- setControl(composite);
-
- initializeViewer();
- }
-
- private Label createListTitleArea(Composite composite) {
- Label label = new Label(composite, SWT.NONE);
- label.setText(listTitle);
- label.setFont(composite.getFont());
- return label;
- }
-
- private void createListViewer(Composite composite) {
+ public void createTableViewer(Composite composite) {
listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = 250;
@@ -110,7 +87,7 @@
});
}
- private void addSelectionButtons(Composite composite) {
+ public void addOtherAreas(Composite composite) {
Composite buttonComposite = new Composite(composite, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 0;
@@ -166,7 +143,7 @@
return button;
}
- private void initializeViewer() {
+ public void initializePage() {
if (listViewer == null) {
return;
}
@@ -184,19 +161,6 @@
changeComplete();
}
- private Composite createDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 7;
- layout.marginWidth = 7;
- layout.verticalSpacing = 4;
- layout.horizontalSpacing = 4;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- return composite;
- }
-
public void changeComplete() {
if (listViewer.getCheckedElements().length != 0) {
setPageComplete(true);
@@ -211,7 +175,7 @@
public void setIdMap(Map<String, String> idMap) {
this.idMap = idMap;
- initializeViewer();
+ initializePage();
}
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BpmnToWizard.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BpmnToWizard.java 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/BpmnToWizard.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -37,7 +37,7 @@
/**
* @author Grid Qian
*
- * the wizard for bpmn translation
+ * the wizard for bpmn translation
*/
public abstract class BpmnToWizard extends Wizard implements IExportWizard {
@@ -52,6 +52,7 @@
private IStructuredSelection targetLocationSelection;
// bpmn pool id:name map
private Map<String, String> idMap;
+ private boolean isOverWrite = true;
protected String bpmnFileName;
protected String bpmnFileParentPath;
@@ -70,19 +71,23 @@
bpmnResPage = new BPMNResourcesChoicePage(
B2JMessages.Bpmn_File_Choose_WizardPage_Name,
B2JMessages.Bpmn_File_Choose_WizardPage_Title,
+ B2JMessages.Bpmn_File_Choose_WizardPage_ViewerTitle,
B2JMessages.Bpmn_File_Choose_WizardPage_Message);
bpmnResPage.setSelection(selection);
poolsPage = new BpmnPoolsChoicePage(
B2JMessages.Bpmn_Pool_Choose_WizardPage_Name,
B2JMessages.Bpmn_Pool_Choose_WizardPage_Title,
+ B2JMessages.Bpmn_Pool_Choose_WizardPage_ViewerTitle,
B2JMessages.Bpmn_Pool_Choose_WizardPage_Message);
errorPage = new ErrorMessagesPage(
B2JMessages.Bpmn_Translate_Message_WizardPage_Name,
B2JMessages.Bpmn_Translate_Message_WizardPage_Title,
+ B2JMessages.Bpmn_Translate_Message_WizardpageViewer_Title,
B2JMessages.Bpmn_Translate_Message_WizardPage_Message);
locationPage = new GeneratedFileLocationPage(
B2JMessages.Bpmn_GeneratedFile_Location_WizardPage_Name,
B2JMessages.Bpmn_GeneratedFile_Location_WizardPage_Title,
+ B2JMessages.Bpmn_GeneratedFile_Location_WizardPage_ViewerTitle,
B2JMessages.Bpmn_GeneratedFile_Location_WizardPage_Message);
locationPage.setSelection(selection);
addPage(bpmnResPage);
@@ -128,11 +133,10 @@
}
public IWizardPage getNextPage(IWizardPage page) {
- if (page.getName()
- .equals(B2JMessages.Bpmn_Pool_Choose_WizardPage_Name)) {
+ if (page.getName().equals(B2JMessages.Bpmn_Pool_Choose_WizardPage_Name)) {
errorList = translateBpmnToStrings();
errorPage.setPageComplete(true);
-
+
if (errorList.size() == 0) {
return locationPage;
}
@@ -145,16 +149,15 @@
}
public boolean performFinish() {
-
- createGeneratedFile(locationPage.isOverWrite());
+ createGeneratedFile(this.isOverWrite());
refreshWorkspace();
return true;
}
/*
* do the translation from bpmn to string list the sub class need to create
- * a string list to reserve these strings
- * the return list is error or warning messages
+ * a string list to reserve these strings the return list is error or
+ * warning messages
*/
public abstract List<String> translateBpmnToStrings();
@@ -241,4 +244,12 @@
IStructuredSelection targetLocationSelection) {
this.targetLocationSelection = targetLocationSelection;
}
+
+ public boolean isOverWrite() {
+ return isOverWrite;
+ }
+
+ public void setOverWrite(boolean isOverWrite) {
+ this.isOverWrite = isOverWrite;
+ }
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/ErrorMessagesPage.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/ErrorMessagesPage.java 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/ErrorMessagesPage.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -14,48 +14,26 @@
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.jboss.tools.jbpm.convert.b2j.messages.B2JMessages;
/**
* @author Grid Qian
*
- * the wizardpage for showing the error and warning messages from translating
+ * the wizardpage for showing the error and warning messages from
+ * translating
*/
-public class ErrorMessagesPage extends WizardPage {
+public class ErrorMessagesPage extends AbstractConvertWizardPage {
private TableViewer listViewer;
-
- protected ErrorMessagesPage(String pageName, String title, String description) {
- super(pageName);
- this.setDescription(description);
- this.setTitle(title);
+ protected ErrorMessagesPage(String pageName, String title,
+ String tableTitle, String description) {
+ super(pageName, title, tableTitle, description);
}
- public void createControl(Composite parent) {
- Composite composite = createDialogArea(parent);
-
- createListTitleArea(composite);
- createListViewer(composite);
- setControl(composite);
- initializePage();
- }
-
- private Label createListTitleArea(Composite composite) {
- Label label = new Label(composite, SWT.NONE);
- label
- .setText(B2JMessages.Bpmn_Translate_Message_WizardpageViewer_Title);
- label.setFont(composite.getFont());
- return label;
- }
-
- private void createListViewer(Composite composite) {
+ public void createTableViewer(Composite composite) {
listViewer = new TableViewer(composite, SWT.SINGLE | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.BORDER);
GridData data = new GridData(GridData.FILL_BOTH);
@@ -67,20 +45,7 @@
listViewer.setContentProvider(new ArrayContentProvider());
}
- private Composite createDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 7;
- layout.marginWidth = 7;
- layout.verticalSpacing = 4;
- layout.horizontalSpacing = 4;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- return composite;
- }
-
- private void initializePage() {
+ public void initializePage() {
this.setPageComplete(false);
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/GeneratedFileLocationPage.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/GeneratedFileLocationPage.java 2008-11-19
06:17:32 UTC (rev 11875)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/GeneratedFileLocationPage.java 2008-11-19
06:48:59 UTC (rev 11876)
@@ -12,7 +12,6 @@
package org.jboss.tools.jbpm.convert.bpmnto.wizard;
import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -25,15 +24,12 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.jboss.tools.jbpm.convert.b2j.messages.B2JMessages;
@@ -41,45 +37,21 @@
/**
* @author Grid Qian
*
- * the wizardpage for the generated file location
+ * the wizardpage for the generated file location
*/
-public class GeneratedFileLocationPage extends WizardPage {
+public class GeneratedFileLocationPage extends AbstractConvertWizardPage {
private TreeViewer viewer;
private ISelection currentSelection;
private Button button;
private IWizard wizard;
- private boolean isOverWrite = true;
-
protected GeneratedFileLocationPage(String pageName, String title,
- String description) {
- super(pageName);
- this.setDescription(description);
- this.setTitle(title);
+ String tableTitle, String description) {
+ super(pageName, title, tableTitle, description);
}
- public void createControl(Composite parent) {
- Composite composite = createDialogArea(parent);
-
- createListTitleArea(composite);
- createListViewer(composite);
- createCheckbox(composite);
- super.setControl(composite);
-
- initializePage();
-
- }
-
- private Label createListTitleArea(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label
- .setText(B2JMessages.Bpmn_GeneratedFile_Location_WizardPage_ViewerTitle);
- label.setFont(parent.getFont());
- return label;
- }
-
- private void createListViewer(Composite composite) {
+ public void createTableViewer(Composite composite) {
viewer = new TreeViewer(composite, SWT.BORDER | SWT.MULTI
| SWT.H_SCROLL | SWT.V_SCROLL);
viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -98,58 +70,40 @@
});
}
- private Button createCheckbox(Composite parent) {
- button = new Button(parent, SWT.CHECK | SWT.NONE);
+ public void addOtherAreas(Composite composite) {
+ button = new Button(composite, SWT.CHECK | SWT.NONE);
button
.setText(B2JMessages.Bpmn_GeneratedFile_Location_WizardPage_CheckBox);
- button.setFont(parent.getFont());
- button.addSelectionListener(new SelectionListener(){
- public void widgetDefaultSelected(SelectionEvent arg0) {
+ button.setFont(composite.getFont());
+ button.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent arg0) {
}
+
public void widgetSelected(SelectionEvent arg0) {
- isOverWrite = button.getSelection();
- }});
- return button;
+ ((BpmnToWizard) wizard).setOverWrite(button.getSelection());
+ }
+ });
}
- private void initializePage() {
+ public void initializePage() {
wizard = this.getWizard();
viewer.setInput(ResourcesPlugin.getWorkspace());
- if (this.currentSelection != null) {
- if (currentSelection != null
- && currentSelection instanceof ITreeSelection) {
- // Select the parent project of this first bpmn file chosen
- ITreeSelection node = (ITreeSelection) currentSelection;
- TreePath[] paths = node.getPaths();
- if(paths.length == 0) {
- return;
- }
- TreePath projPath = new TreePath(new Object[] { paths[0]
- .getFirstSegment() });
- TreeSelection projSel = new TreeSelection(projPath);
- viewer.setSelection(projSel, true);
+ if (currentSelection != null
+ && currentSelection instanceof ITreeSelection) {
+ // Select the parent project of this first bpmn file chosen
+ ITreeSelection node = (ITreeSelection) currentSelection;
+ TreePath[] paths = node.getPaths();
+ if (paths.length == 0) {
+ return;
}
+ TreePath projPath = new TreePath(new Object[] { paths[0]
+ .getFirstSegment() });
+ TreeSelection projSel = new TreeSelection(projPath);
+ viewer.setSelection(projSel, true);
}
- button.setSelection(true);
+ button.setSelection(((BpmnToWizard) wizard).isOverWrite());
}
- private void updateControls() {
- super.getWizard().getContainer().updateButtons();
- }
-
- private Composite createDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 7;
- layout.marginWidth = 7;
- layout.verticalSpacing = 4;
- layout.horizontalSpacing = 4;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- return composite;
- }
-
public boolean isPageComplete() {
if (viewer != null && viewer.getSelection() == null) {
return false;
@@ -164,23 +118,14 @@
public void setSelection(ISelection currentSelection) {
this.currentSelection = currentSelection;
}
-
- public boolean isOverWrite() {
- return isOverWrite;
- }
-
- public void setOverWrite(boolean isOverWrite) {
- this.isOverWrite = isOverWrite;
- }
-
}
class ProFilter extends ViewerFilter {
@Override
public boolean select(Viewer viewer, Object parent, Object element) {
if (element instanceof IContainer) {
- return ((IContainer)element).getProject().isAccessible();
+ return ((IContainer) element).getProject().isAccessible();
} else {
return false;
}