[jboss-svn-commits] JBL Code SVN: r30950 - in labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse: src/main/java/org/drools/eclipse/flow/bpmn2 and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jan 5 15:19:50 EST 2010
Author: KrisVerlaenen
Date: 2010-01-05 15:19:50 -0500 (Tue, 05 Jan 2010)
New Revision: 30950
Added:
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileRuntimePage.java
Removed:
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/bpmn2/NewBPMNProcessFilePage.java
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/bpmn2/NewBPMNProcessFileWizard.java
Modified:
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/plugin.xml
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFilePage.java
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileWizard.java
Log:
- removed BPMN2 wizard, replaced by extended Flow wizard
Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/plugin.xml
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/plugin.xml 2010-01-05 19:10:56 UTC (rev 30949)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/plugin.xml 2010-01-05 20:19:50 UTC (rev 30950)
@@ -452,7 +452,7 @@
<extension
point="org.eclipse.ui.editors">
<editor
- name="RuleFlow Editor"
+ name="Flow Editor"
extensions="rf, ruleflow, rflow"
icon="icons/process.gif"
contributorClass="org.drools.eclipse.flow.common.editor.GenericActionBarContributor"
@@ -464,7 +464,7 @@
<extension
point="org.eclipse.ui.editors">
<editor
- name="BPMN2 Editor"
+ name="Flow Editor"
extensions="bpmn, bpmn2"
icon="icons/process.gif"
contributorClass="org.drools.eclipse.flow.common.editor.GenericActionBarContributor"
@@ -480,10 +480,10 @@
targetID="org.drools.eclipse.flow.ruleflow.editor.RuleFlowModelEditor">
<action
id="org.drools.eclipse.flow.ruleflow.editor.action.CheckRuleFlowAction"
- label="Check RuleFlow"
+ label="Check Flow"
toolbarPath="Drools"
icon="icons/check.gif"
- tooltip="Check the ruleflow model"
+ tooltip="Check the Flow model"
class="org.drools.eclipse.flow.ruleflow.editor.action.CheckRuleFlowAction"
/>
</editorContribution>
@@ -565,32 +565,19 @@
point = "org.eclipse.ui.newWizards">
<category
id = "org.drools.eclipse.flow.new"
- name="RuleFlow">
+ name="Flow">
</category>
<wizard
id = "org.drools.eclipse.flow.ruleflow.NewRuleFlowFileWizard"
- name = "RuleFlow File"
+ name = "Flow File"
class="org.drools.eclipse.flow.ruleflow.NewRuleFlowFileWizard"
category="org.drools.eclipse.new"
icon="icons/process.gif">
- <description>A wizard that creates a new ruleflow file</description>
+ <description>A wizard that creates a new Flow file</description>
<selection class="org.eclipse.core.resources.IResource"/>
</wizard>
</extension>
- <extension
- point = "org.eclipse.ui.newWizards">
- <wizard
- id = "org.drools.eclipse.flow.bpmn2.NewBPMNProcessFileWizard"
- name = "BPMN2 Process"
- class="org.drools.eclipse.flow.bpmn2.NewBPMNProcessFileWizard"
- category="org.drools.eclipse.new"
- icon="icons/process.gif">
- <description>A wizard that creates a new ruleflow file</description>
- <selection class="org.eclipse.core.resources.IResource"/>
- </wizard>
- </extension>
-
<extension-point id="processExtension" name="Process Extension" schema="schema/processExtension.exsd"/>
<extension-point id="runtimeRecognizer" name="Drools Runtime Recognizer" schema="schema/runtimeRecognizer.exsd"/>
Deleted: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/bpmn2/NewBPMNProcessFilePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/bpmn2/NewBPMNProcessFilePage.java 2010-01-05 19:10:56 UTC (rev 30949)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/bpmn2/NewBPMNProcessFilePage.java 2010-01-05 20:19:50 UTC (rev 30950)
@@ -1,73 +0,0 @@
-package org.drools.eclipse.flow.bpmn2;
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.InputStream;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.ui.ide.IDE;
-
-/**
- * Page for creating a new RuleFlow file.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class NewBPMNProcessFilePage extends WizardNewFileCreationPage {
-
- private IWorkbench workbench;
-
- public NewBPMNProcessFilePage(IWorkbench workbench, IStructuredSelection selection) {
- super("createBPMNProcessPage", selection);
- setTitle("Create BPMN Process");
- setDescription("Create a new BPMN process");
- this.workbench = workbench;
- }
-
- public void createControl(Composite parent) {
- super.createControl(parent);
- setPageComplete(true);
- }
-
- public boolean finish() {
- String fileName = getFileName();
- if (!fileName.endsWith(".bpmn")) {
- setFileName(fileName + ".bpmn");
- }
- org.eclipse.core.resources.IFile newFile = createNewFile();
- if (newFile == null)
- return false;
- try {
- IWorkbenchWindow dwindow = workbench.getActiveWorkbenchWindow();
- org.eclipse.ui.IWorkbenchPage page = dwindow.getActivePage();
- if (page != null)
- IDE.openEditor(page, newFile, true);
- } catch (PartInitException e) {
- e.printStackTrace();
- return false;
- }
- return true;
- }
-
- protected InputStream getInitialContents() {
- String s = "org/drools/eclipse/flow/bpmn2/Sample.bpmn.template";
- return getClass().getClassLoader().getResourceAsStream(s);
- }
-}
Deleted: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/bpmn2/NewBPMNProcessFileWizard.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/bpmn2/NewBPMNProcessFileWizard.java 2010-01-05 19:10:56 UTC (rev 30949)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/bpmn2/NewBPMNProcessFileWizard.java 2010-01-05 20:19:50 UTC (rev 30950)
@@ -1,49 +0,0 @@
-package org.drools.eclipse.flow.bpmn2;
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * Wizard for creating a new RuleFlow file.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class NewBPMNProcessFileWizard extends Wizard implements INewWizard {
-
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private NewBPMNProcessFilePage mainPage;
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- setWindowTitle("New BPMN Process");
- }
-
- public void addPages() {
- mainPage = new NewBPMNProcessFilePage(workbench, selection);
- addPage(mainPage);
- }
-
- public boolean performFinish() {
- return mainPage.finish();
- }
-
-}
Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFilePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFilePage.java 2010-01-05 19:10:56 UTC (rev 30949)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFilePage.java 2010-01-05 20:19:50 UTC (rev 30950)
@@ -33,11 +33,12 @@
public class NewRuleFlowFilePage extends WizardNewFileCreationPage {
private IWorkbench workbench;
+ private String targetRuntime;
public NewRuleFlowFilePage(IWorkbench workbench, IStructuredSelection selection) {
super("createRuleFlowPage", selection);
- setTitle("Create RuleFlow File");
- setDescription("Create a new RuleFlow file");
+ setTitle("Create Flow File");
+ setDescription("Create a new Flow file");
this.workbench = workbench;
}
@@ -45,11 +46,21 @@
super.createControl(parent);
setPageComplete(true);
}
+
+ public void setTargetRuntime(String targetRuntime) {
+ this.targetRuntime = targetRuntime;
+ }
public boolean finish() {
String fileName = getFileName();
- if (!fileName.endsWith(".rf")) {
- setFileName(fileName + ".rf");
+ if (NewRuleFlowFileRuntimePage.DROOLS5.equals(targetRuntime)) {
+ if (!fileName.endsWith(".rf")) {
+ setFileName(fileName + ".rf");
+ }
+ } else if (NewRuleFlowFileRuntimePage.DROOLS5_1.equals(targetRuntime)) {
+ if (!fileName.endsWith(".bpmn")) {
+ setFileName(fileName + ".bpmn");
+ }
}
org.eclipse.core.resources.IFile newFile = createNewFile();
if (newFile == null)
@@ -67,7 +78,14 @@
}
protected InputStream getInitialContents() {
- String s = "org/drools/eclipse/flow/ruleflow/SampleRuleFlow.rf.template";
- return getClass().getClassLoader().getResourceAsStream(s);
+ if (NewRuleFlowFileRuntimePage.DROOLS5.equals(targetRuntime)) {
+ String s = "org/drools/eclipse/flow/ruleflow/SampleRuleFlow.rf.template";
+ return getClass().getClassLoader().getResourceAsStream(s);
+ } else if (NewRuleFlowFileRuntimePage.DROOLS5_1.equals(targetRuntime)) {
+ String s = "org/drools/eclipse/flow/bpmn2/Sample.bpmn.template";
+ return getClass().getClassLoader().getResourceAsStream(s);
+ } else {
+ throw new IllegalArgumentException("Unknown target runtime " + targetRuntime);
+ }
}
}
Added: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileRuntimePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileRuntimePage.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileRuntimePage.java 2010-01-05 20:19:50 UTC (rev 30950)
@@ -0,0 +1,62 @@
+package org.drools.eclipse.flow.ruleflow;
+
+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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+public class NewRuleFlowFileRuntimePage extends WizardPage {
+
+ public static final String DROOLS5 = "Drools 5.0.x";
+ public static final String DROOLS5_1 = "Drools 5.1.x";
+
+ private String generationType = DROOLS5;
+ private Combo droolsGenerateCombo;
+
+ public NewRuleFlowFileRuntimePage() {
+ super("extendedNewProjectRuntimePage");
+ setTitle("Drools Runtime");
+ setDescription("Select a Drools Runtime");
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ composite.setLayout(gridLayout);
+
+ Label generateLabel = new Label(composite, SWT.NONE);
+ generateLabel.setText("Generate code compatible with: ");
+ droolsGenerateCombo = new Combo(composite, SWT.READ_ONLY);
+ droolsGenerateCombo.add("Drools 5.0.x");
+ droolsGenerateCombo.add("Drools 5.1.x");
+ droolsGenerateCombo.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ generationType = droolsGenerateCombo.getText();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ generationType = droolsGenerateCombo.getText();
+ }
+ });
+ droolsGenerateCombo.select(0);
+ generationType = DROOLS5;
+ GridData gridData = new GridData();
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ droolsGenerateCombo.setLayoutData(gridData);
+
+ setMessage(null);
+ setPageComplete(true);
+ setControl(composite);
+ }
+
+ public String getGenerationType() {
+ return generationType;
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileWizard.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileWizard.java 2010-01-05 19:10:56 UTC (rev 30949)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileWizard.java 2010-01-05 20:19:50 UTC (rev 30950)
@@ -30,19 +30,23 @@
private IWorkbench workbench;
private IStructuredSelection selection;
private NewRuleFlowFilePage mainPage;
+ private NewRuleFlowFileRuntimePage runtimePage;
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.workbench = workbench;
this.selection = selection;
- setWindowTitle("New RuleFlow File");
+ setWindowTitle("New Flow File");
}
public void addPages() {
mainPage = new NewRuleFlowFilePage(workbench, selection);
addPage(mainPage);
+ runtimePage = new NewRuleFlowFileRuntimePage();
+ addPage(runtimePage);
}
public boolean performFinish() {
+ mainPage.setTargetRuntime(runtimePage.getGenerationType());
return mainPage.finish();
}
More information about the jboss-svn-commits
mailing list