JBoss Tools SVN: r22960 - in trunk/jbpm/plugins/org.jbpm.gd.jpdl: src/org/jbpm/gd/common/editor and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2010-06-23 12:42:50 -0400 (Wed, 23 Jun 2010)
New Revision: 22960
Added:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java
Removed:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeClassesTreeContentProvider.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeFilesTreeContentProvider.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeInDeploymentTreeViewer.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymentEditorPage.java
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/editor/ActionBarContributor.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlContentProvider.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlEditor.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizardPage.java
Log:
JBIDE-6521
JBIDE-5910
JBIDE-5911
JBIDE-5912
JBIDE-6104
JBIDE-6090
JBIDE-6394
JBIDE-6306
JBIDE-3611
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-06-23 16:42:50 UTC (rev 22960)
@@ -1531,6 +1531,49 @@
</propertySections>
</extension>
+ <extension point="org.eclipse.ui.editorActions">
+ <editorContribution
+ id="org.jbpm.gd.jpdl.actions"
+ targetID="org.jbpm.gd.jpdl.editor">
+ <menu
+ id="org.jbpm.gd.jpdl.menu"
+ label="jBPM"
+ path="additions">
+ <separator name="graphTools"/>
+ <separator name="deployTools"/>
+ </menu>
+ <action
+ id="org.jbpm.gd.jpdl.grid"
+ label="Show Grid"
+ tooltip="Toggle the grid for the jPDL editor"
+ menubarPath="org.jbpm.gd.jpdl.menu/graphTools"
+ style="toggle"
+ class="org.jbpm.gd.jpdl.action.ToggleGridActionDelegate">
+ </action>
+ <action
+ id="org.jbpm.gd.jpdl.deploy"
+ label="Deploy Process"
+ tooltip="Deploy the process to the server"
+ menubarPath="org.jbpm.gd.jpdl.menu/deployTools"
+ class="org.jbpm.gd.jpdl.action.DeployProcessActionDelegate">
+ </action>
+ <action
+ id="org.jbpm.gd.jpdl.ping"
+ label="Ping Server"
+ tooltip="Check if the server can be reached with the current connection parameters."
+ menubarPath="org.jbpm.gd.jpdl.menu/deployTools"
+ class="org.jbpm.gd.jpdl.action.PingServerActionDelegate">
+ </action>
+ <action
+ id="org.jbpm.gd.jpdl.save"
+ label="Save Process Archive..."
+ tooltip="Save the process archive to a local file."
+ menubarPath="org.jbpm.gd.jpdl.menu/deployTools"
+ class="org.jbpm.gd.jpdl.action.SaveProcessArchiveActionDelegate">
+ </action>
+ </editorContribution>
+ </extension>
+
<extension point="org.eclipse.ui.startup">
<startup class="org.jbpm.gd.jpdl.StartupClass"/>
</extension>
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/editor/ActionBarContributor.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/editor/ActionBarContributor.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/editor/ActionBarContributor.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -22,15 +22,10 @@
package org.jbpm.gd.common.editor;
import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.actions.GEFActionConstants;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.RetargetAction;
import org.eclipse.ui.ide.IDEActionFactory;
import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
@@ -39,7 +34,7 @@
public class ActionBarContributor extends
MultiPageEditorActionBarContributor {
- ActionRegistry actionRegistry = new ActionRegistry();
+// ActionRegistry actionRegistry = new ActionRegistry();
private static final String[] WORKBENCH_ACTION_IDS = {
ActionFactory.PRINT.getId(),
@@ -75,8 +70,8 @@
hookGlobalGraphicalEditorActions((GraphPage)activeEditor, actionBars);
} else if (activeEditor instanceof StructuredTextEditor) {
hookGlobalXmlEditorActions((StructuredTextEditor)activeEditor, actionBars);
- } else {
- actionBars.setGlobalActionHandler( GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY, null);
+// } else {
+// actionBars.setGlobalActionHandler( GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY, null);
}
actionBars.updateActionBars();
}
@@ -88,7 +83,7 @@
WORKBENCH_ACTION_IDS[i],
part.getAction(TEXTEDITOR_ACTION_IDS[i]));
}
- actionBars.setGlobalActionHandler( GEFActionConstants.TOGGLE_GRID_VISIBILITY, null);
+// actionBars.setGlobalActionHandler( GEFActionConstants.TOGGLE_GRID_VISIBILITY, null);
}
private void hookGlobalGraphicalEditorActions(
@@ -100,38 +95,38 @@
WORKBENCH_ACTION_IDS[i],
action);
}
- IAction action = registry.getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY);
- actionBars.setGlobalActionHandler( GEFActionConstants.TOGGLE_GRID_VISIBILITY, action);
+// IAction action = registry.getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY);
+// actionBars.setGlobalActionHandler( GEFActionConstants.TOGGLE_GRID_VISIBILITY, action);
}
- protected void addRetargetAction(RetargetAction action) {
- actionRegistry.registerAction(action);
- getPage().addPartListener(action);
- }
+// protected void addRetargetAction(RetargetAction action) {
+// actionRegistry.registerAction(action);
+// getPage().addPartListener(action);
+// }
- public void init(IActionBars bars) {
- buildActions();
- super.init(bars);
- }
+// public void init(IActionBars bars) {
+// buildActions();
+// super.init(bars);
+// }
- public void dispose() {
- RetargetAction action = (RetargetAction)actionRegistry.getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY);
- getPage().removePartListener(action);
- action.dispose();
- actionRegistry.dispose();
- super.dispose();
- }
+// public void dispose() {
+// RetargetAction action = (RetargetAction)actionRegistry.getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY);
+// getPage().removePartListener(action);
+// action.dispose();
+// actionRegistry.dispose();
+// super.dispose();
+// }
- protected void buildActions() {
- addRetargetAction(new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY,
- "Show Grid", IAction.AS_CHECK_BOX));
- }
+// protected void buildActions() {
+// addRetargetAction(new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY,
+// "Show Grid", IAction.AS_CHECK_BOX));
+// }
- public void contributeToMenu(IMenuManager menubar) {
- super.contributeToMenu(menubar);
- MenuManager viewMenu = new MenuManager("View");
- viewMenu.add(actionRegistry.getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY));
- menubar.insertAfter(IWorkbenchActionConstants.M_EDIT, viewMenu);
- }
+// public void contributeToMenu(IMenuManager menubar) {
+// super.contributeToMenu(menubar);
+// MenuManager viewMenu = new MenuManager("View");
+// viewMenu.add(actionRegistry.getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY));
+// menubar.insertAfter(IWorkbenchActionConstants.M_EDIT, viewMenu);
+// }
}
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,39 @@
+package org.jbpm.gd.jpdl.action;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.jbpm.gd.jpdl.deployment.ProcessArchiveBuilder;
+import org.jbpm.gd.jpdl.deployment.ProcessArchiveDeployer;
+import org.jbpm.gd.jpdl.editor.JpdlEditor;
+
+public class DeployProcessAction extends Action {
+
+ private JpdlEditor jpdlEditor;
+
+ public DeployProcessAction(JpdlEditor jpdlEditor) {
+ this.jpdlEditor = jpdlEditor;
+ }
+
+ public void run() {
+ byte[] processArchive = new ProcessArchiveBuilder(jpdlEditor).build();
+ if (processArchive == null) return;
+ boolean success = new ProcessArchiveDeployer(jpdlEditor).deploy(processArchive);
+ if (success) {
+ showSuccessDialog();
+ }
+ }
+
+ private void showSuccessDialog() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Deployment Successful",
+ null,
+ "The process archive deployed successfully.",
+ SWT.ICON_INFORMATION,
+ new String[] { "OK" },
+ 0);
+ dialog.open();
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,28 @@
+package org.jbpm.gd.jpdl.action;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.jbpm.gd.jpdl.editor.JpdlEditor;
+
+public class DeployProcessActionDelegate implements IEditorActionDelegate {
+
+ private JpdlEditor jpdlEditor;
+
+ public void setActiveEditor(IAction action, IEditorPart editorPart) {
+ if (editorPart != null && editorPart instanceof JpdlEditor) {
+ jpdlEditor = (JpdlEditor)editorPart;
+ }
+ }
+
+ public void run(IAction action) {
+ if (jpdlEditor != null) {
+ new DeployProcessAction(jpdlEditor).run();
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,36 @@
+package org.jbpm.gd.jpdl.action;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.jbpm.gd.jpdl.deployment.ProcessArchiveDeployer;
+import org.jbpm.gd.jpdl.editor.JpdlEditor;
+
+public class PingServerAction extends Action {
+
+ private JpdlEditor jpdlEditor;
+
+ public PingServerAction(JpdlEditor jpdlEditor) {
+ this.jpdlEditor = jpdlEditor;
+ }
+
+ public void run() {
+ boolean success = new ProcessArchiveDeployer(jpdlEditor).pingServer();
+ if (success) {
+ showSuccessDialog();
+ }
+ }
+
+ private void showSuccessDialog() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Ping Server Successful",
+ null,
+ "The server could be reached successfully.",
+ SWT.ICON_INFORMATION,
+ new String[] { "OK" },
+ 0);
+ dialog.open();
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,28 @@
+package org.jbpm.gd.jpdl.action;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.jbpm.gd.jpdl.editor.JpdlEditor;
+
+public class PingServerActionDelegate implements IEditorActionDelegate {
+
+ private JpdlEditor jpdlEditor;
+
+ public void setActiveEditor(IAction action, IEditorPart editorPart) {
+ if (editorPart != null && editorPart instanceof JpdlEditor) {
+ jpdlEditor = (JpdlEditor)editorPart;
+ }
+ }
+
+ public void run(IAction action) {
+ if (jpdlEditor != null) {
+ new PingServerAction(jpdlEditor).run();
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,70 @@
+package org.jbpm.gd.jpdl.action;
+
+import java.io.ByteArrayInputStream;
+
+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.core.runtime.IPath;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.jbpm.gd.jpdl.deployment.ProcessArchiveBuilder;
+import org.jbpm.gd.jpdl.editor.JpdlEditor;
+
+public class SaveProcessArchiveAction extends Action {
+
+ private JpdlEditor jpdlEditor;
+
+ public SaveProcessArchiveAction(JpdlEditor jpdlEditor) {
+ this.jpdlEditor = jpdlEditor;
+ }
+
+ public void run() {
+ try {
+ byte[] processArchive = new ProcessArchiveBuilder(jpdlEditor).build();
+ if (processArchive == null) return;
+ SaveAsDialog saveAsDialog = new SaveAsDialog(jpdlEditor.getSite().getShell());
+ saveAsDialog.open();
+ IPath path = saveAsDialog.getResult();
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (!file.exists()) {
+ file.create(new ByteArrayInputStream(new byte[0]), IResource.NONE, null);
+ } else {
+ if (!askIfOverwriteAllowed()) {
+ return;
+ }
+ }
+ file.setContents(new ByteArrayInputStream(processArchive), IResource.NONE, null);
+ } catch (CoreException e) {
+ showSaveProcessArchiveException();
+ }
+ }
+
+ private void showSaveProcessArchiveException() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Save Process Archive Failed",
+ null,
+ "The process archive could not be saved.",
+ SWT.ICON_ERROR,
+ new String[] { "OK" },
+ 0);
+ dialog.open();
+ }
+
+ private boolean askIfOverwriteAllowed() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Overwrite Existing File?",
+ null,
+ "The chosen file exists. Is it OK to overwrite the contents?",
+ SWT.ICON_QUESTION,
+ new String[] { "Yes", "No" },
+ 0);
+ return (dialog.open() == 0);
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,28 @@
+package org.jbpm.gd.jpdl.action;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.jbpm.gd.jpdl.editor.JpdlEditor;
+
+public class SaveProcessArchiveActionDelegate implements IEditorActionDelegate {
+
+ private JpdlEditor jpdlEditor;
+
+ public void setActiveEditor(IAction action, IEditorPart editorPart) {
+ if (editorPart != null && editorPart instanceof JpdlEditor) {
+ jpdlEditor = (JpdlEditor)editorPart;
+ }
+ }
+
+ public void run(IAction action) {
+ if (jpdlEditor != null) {
+ new SaveProcessArchiveAction(jpdlEditor).run();
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,31 @@
+package org.jbpm.gd.jpdl.action;
+
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.ui.actions.ToggleGridAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.jbpm.gd.jpdl.editor.JpdlEditor;
+
+public class ToggleGridActionDelegate implements IEditorActionDelegate {
+
+ private GraphicalViewer graphicalViewer;
+
+ public void setActiveEditor(IAction action, IEditorPart editorPart) {
+ if (editorPart != null && editorPart instanceof JpdlEditor) {
+ graphicalViewer = ((JpdlEditor)editorPart).getGraphicalViewer();
+ }
+ }
+
+ public void run(IAction action) {
+ if (graphicalViewer != null) {
+ ToggleGridAction toggleGridAction = new ToggleGridAction(graphicalViewer);
+ toggleGridAction.run();
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,45 @@
+package org.jbpm.gd.jpdl.deployment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.StandardJavaElementContentProvider;
+
+public class ClassesAndResourcesContentProvider extends
+ StandardJavaElementContentProvider {
+
+ protected Object[] getPackageFragmentRoots(IJavaProject project) throws JavaModelException {
+ Object[] roots = super.getPackageFragmentRoots(project);
+ List<Object> list = new ArrayList<Object>();
+ for (int i = 0; i < roots.length; i++) {
+ if (roots[i] instanceof IPackageFragmentRoot) {
+ IPackageFragmentRoot root = (IPackageFragmentRoot)roots[i];
+ if (root.hasChildren()) {
+ list.add(root);
+ }
+ }
+ }
+ return list.toArray();
+ }
+
+ protected Object[] getPackageFragmentRootContent(IPackageFragmentRoot root) throws JavaModelException {
+ Object[] fragments = super.getPackageFragmentRootContent(root);
+ List<Object> list = new ArrayList<Object>();
+ for (int i = 0; i < fragments.length; i++) {
+ if (fragments[i] instanceof IPackageFragment) {
+ IPackageFragment fragment = (IPackageFragment)fragments[i];
+ if (fragment.hasChildren()) {
+ list.add(fragment);
+ }
+ } else {
+ list.add(fragments[i]);
+ }
+ }
+ return list.toArray();
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -21,33 +21,19 @@
*/
package org.jbpm.gd.jpdl.deployment;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jdt.ui.JavaElementLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -55,73 +41,71 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.FormColors;
-import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.jbpm.gd.jpdl.Logger;
import org.jbpm.gd.jpdl.Plugin;
import org.jbpm.gd.jpdl.editor.JpdlEditor;
-import org.jbpm.gd.jpdl.util.JavaClassNameCollector;
-import org.jbpm.gd.jpdl.util.ProcessDeployer;
public class DeploymentForm {
-
- public static final int NONE = 0;
- public static final int EXPRESSION = 1;
- public static final int HANDLER = 2;
+ private static ILabelProvider LABELPROVIDER = new WorkbenchLabelProvider();
+
private FormToolkit toolkit;
private Composite composite;
- private IFolder processFolder;
private JpdlEditor editor;
private DeploymentInfo deploymentInfo;
- private Form form;
- private Text nameText;
- private Text portText;
- private Text deployerText;
- private Text locationText;
- private Text usernameText;
- private Text passwordText;
- private Button deployButton;
- private Button saveButton;
- private Button locationButton;
- private Button testConnectionButton;
- private Button saveLocallyButton;
+ private ScrolledForm form;
+
+ private Button includeProcessInfoFileButton;
+ private Text processInfoFileText;
+ private Button includeGraphicalInfoFileButton;
+ private Text graphicalInfoFileText;
+ private Button browseGraphicalInfoFileButton;
+ private Button includeImageFileButton;
+ private Text imageFileText;
+ private Button browseImageFileButton;
+ private Button additionalFilesAddButton;
+ private Button additionalFilesRemoveButton;
+ private Table additionalFilesList;
+ private Button classesAndResourcesAddButton;
+ private Button classesAndResourcesRemoveButton;
+ private Table classesAndResourcesList;
+ private Text serverNameText;
+ private Text serverPortText;
+ private Text serverDeployerText;
private Button useCredentialsButton;
+ private Text userNameText;
+ private Text passwordText;
- private IncludeInDeploymentTreeViewer includeFilesTreeViewer;
- private IncludeInDeploymentTreeViewer includeClassesTreeViewer;
-
- public DeploymentForm(FormToolkit toolkit, Composite composite, IFolder processFolder, JpdlEditor editor) {
+ public DeploymentForm(FormToolkit toolkit, Composite composite, JpdlEditor editor) {
this.toolkit = toolkit;
this.composite = composite;
- this.processFolder = processFolder;
this.editor = editor;
+ deploymentInfo = editor.getDeploymentInfo();
}
public void create() {
createMainForm();
- createIncludeFilesSection();
- createIncludeClassesSection();
- createLocalSaveSection();
+ createMainFilesSection();
+ createAdditionalFilesSection();
+ createClassesAndResourcesSection();
+ createUserCredentialsSection();
createServerInfoSection();
- toolkit.createForm(form.getBody()); // Create an empty grid cell
- createDeployButton();
}
private void createMainForm() {
- form = toolkit.createForm(composite);
+ form = toolkit.createScrolledForm(composite);
GridData layoutData = new GridData(GridData.FILL_BOTH);
form.setLayoutData(layoutData);
GridLayout layout = new GridLayout();
@@ -130,631 +114,546 @@
form.getBody().setLayout(layout);
form.getBody().setLayoutData(new GridData(GridData.FILL_BOTH));
}
-
- private void createDeployButton() {
- deployButton = toolkit.createButton(form.getBody(), "Deploy Process Archive...", SWT.PUSH);
- deployButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- deployButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (cancelOrSaveAndContinue()) {
- createProcessDeployer().deploy();
- }
- }
- });
- }
- private IPreferenceStore getPreferenceStore() {
- return Plugin.getDefault().getPreferenceStore();
- }
-
- public DeploymentInfo getDeploymentInfo() {
- if (deploymentInfo == null) {
- deploymentInfo = new DeploymentInfo();
- String serverName = getPreferenceStore().getString("server name");
- deploymentInfo.setServerName(serverName == null ? "localhost" : serverName);
- String serverPort = getPreferenceStore().getString("server port");
- deploymentInfo.setServerPort(serverPort == null ? "8080" : serverPort);
- String serverDeployer = getPreferenceStore().getString("server deployer");
- deploymentInfo.setServerDeployer(serverDeployer == null ? "/jbpm-console/upload" : serverDeployer);
- final IJavaProject project = JavaCore.create(processFolder.getProject());
- deploymentInfo.setClassesAndResources(new ArrayList(getElementsToCheckFor(project)).toArray());
- deploymentInfo.setFilesAndFolders(getElementsToCheckFor(processFolder).toArray());
- }
- return deploymentInfo;
- }
-
- public void setDeploymentInfo(DeploymentInfo deploymentInfo) {
- this.deploymentInfo = deploymentInfo;
- refresh();
- }
-
- private ProcessDeployer createProcessDeployer() {
- ProcessDeployer result = new ProcessDeployer();
- String location = null;
- if (saveButton.isEnabled()) {
- location = locationText.getText();
- }
- result.setTargetLocation(location);
- result.setServerName(nameText.getText());
- result.setServerPort(portText.getText());
- result.setServerDeployer(deployerText.getText());
- result.setUseCredentials(useCredentialsButton.getSelection());
- if (useCredentialsButton.getSelection()) {
- result.setUsername(usernameText.getText() == null ? "" : usernameText.getText());
- result.setPassword(passwordText.getText() == null ? "" : passwordText.getText());
- }
- result.setShell(form.getShell());
- result.setProcessFolder(processFolder);
- result.setFilesAndFolders(getIncludedFiles());
- result.setClassesAndResources(getClassesAndResources());
- return result;
- }
-
- private ArrayList getIncludedFiles() {
- ArrayList result = new ArrayList();
- Object[] objects = includeFilesTreeViewer.getCheckedElements();
- for (int i = 0; i < objects.length; i++) {
- result.add(objects[i]);
- }
- return result;
- }
-
- private ArrayList getClassesAndResources() {
- ArrayList result = new ArrayList();
- Object[] objects = includeClassesTreeViewer.getCheckedElements();
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof ICompilationUnit) {
- String string = getResourceName(((ICompilationUnit)objects[i]).getResource());
- result.add(string.substring(0, string.lastIndexOf(".java")) + ".class");
- } else if (objects[i] instanceof IFile) {
- result.add(getResourceName((IFile)objects[i]));
- }
- }
- return result;
- }
-
- private String getResourceName(IResource resource) {
- IPackageFragmentRoot root = getPackageFragmentRoot(resource);
- if (root == null) {
- return null;
- } else {
- int index = root.getResource().getProjectRelativePath().toString().length() + 1;
- return resource.getProjectRelativePath().toString().substring(index);
- }
- }
-
- private IPackageFragmentRoot getPackageFragmentRoot(IResource resource) {
- IPackageFragmentRoot root = null;
- IResource r = resource;
- while (r != null) {
- IJavaElement javaElement = JavaCore.create(r);
- if (javaElement != null && javaElement instanceof IPackageFragmentRoot) {
- root = (IPackageFragmentRoot)javaElement;
- break;
- }
- r = r.getParent();
- }
- return root;
- }
-
- private Composite createServerInfoFormClient() {
- Section serverInfoDetails = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
- serverInfoDetails.marginWidth = 5;
- serverInfoDetails.setText("Deployment Server Settings");
+ private void createMainFilesSection() {
+ Section mainFilesSection = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
+ mainFilesSection.marginWidth = 5;
+ mainFilesSection.setText("Main Process Files");
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.verticalAlignment = GridData.BEGINNING;
- serverInfoDetails.setLayoutData(gridData);
+ gridData.horizontalSpan = 2;
+ mainFilesSection.setLayoutData(gridData);
- Composite infoFormClient = toolkit.createComposite(serverInfoDetails);
- serverInfoDetails.setClient(infoFormClient);
- serverInfoDetails.setDescription("Specify the settings of the server you wish to deploy to.");
- toolkit.paintBordersFor(infoFormClient);
+ Composite mainFilesClient = toolkit.createComposite(mainFilesSection);
+ mainFilesSection.setClient(mainFilesClient);
+ mainFilesSection.setDescription("Check and select the files to be included in the deployment.");
+ toolkit.paintBordersFor(mainFilesClient);
GridLayout layout = new GridLayout();
layout.marginWidth = 2;
layout.marginHeight = 2;
layout.numColumns = 3;
- infoFormClient.setLayout(layout);
- return infoFormClient;
+ mainFilesClient.setLayout(layout);
+ createProcessInfoFileField(mainFilesClient);
+ createGraphicalInfoFileField(mainFilesClient);
+ createImageFileField(mainFilesClient);
}
- private void createServerInfoSection() {
- Composite serverInfoFormClient = createServerInfoFormClient();
- createServerNameField(serverInfoFormClient);
- createServerPortField(serverInfoFormClient);
- createServerDeployerField(serverInfoFormClient);
- createUseCredentialsButton(serverInfoFormClient);
- createUseCredentialsGroup(serverInfoFormClient);
- createTestConnectionButton(serverInfoFormClient);
+ private void createProcessInfoFileField(Composite parent) {
+ includeProcessInfoFileButton = toolkit.createButton(parent, "Process Info File:", SWT.CHECK);
+ includeProcessInfoFileButton.setSelection(true);
+ includeProcessInfoFileButton.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ processInfoFileText = toolkit.createText(parent, "");
+ processInfoFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ processInfoFileText.setEditable(false);
+ toolkit.createLabel(parent, "");
}
-
- private void createLocalSaveSection() {
- Composite localSaveFormClient = createLocalSaveFormClient();
- createSaveLocallyCheckBox(localSaveFormClient);
- createSaveLocationField(localSaveFormClient);
- createSaveButton(localSaveFormClient);
+
+ private void createGraphicalInfoFileField(Composite parent) {
+ includeGraphicalInfoFileButton = toolkit.createButton(parent, "Graphical Info File:", SWT.CHECK);
+ includeGraphicalInfoFileButton.setSelection(true);
+ includeGraphicalInfoFileButton.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ graphicalInfoFileText = toolkit.createText(parent, "");
+ graphicalInfoFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ graphicalInfoFileText.setEditable(false);
+ browseGraphicalInfoFileButton = toolkit.createButton(parent, "Browse...", SWT.NONE);
}
- private void createServerNameField(Composite infoFormClient) {
- Label nameLabel = toolkit.createLabel(infoFormClient, "Server Name:");
- nameLabel.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- nameText = toolkit.createText(infoFormClient, "");
- String nameString = getDeploymentInfo().getServerName();
- nameText.setText(nameString == null ? "localhost" : nameString);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 2;
- nameText.setLayoutData(gridData);
- nameText.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- updateTestConnectionAndDeployButtons();
- getDeploymentInfo().setServerName(nameText.getText());
- editor.setDirty(true);
- }
- });
+ private void createImageFileField(Composite parent) {
+ includeImageFileButton = toolkit.createButton(parent, "Image File:", SWT.CHECK);
+ includeImageFileButton.setSelection(true);
+ includeImageFileButton.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ imageFileText = toolkit.createText(parent, "");
+ imageFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ imageFileText.setEditable(false);
+ browseImageFileButton = toolkit.createButton(parent, "Browse...", SWT.NONE);
}
- private void createServerPortField(Composite infoFormClient) {
- Label portLabel = toolkit.createLabel(infoFormClient, "Server Port:");
- portLabel.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- portText = toolkit.createText(infoFormClient, "");
- String portString = getDeploymentInfo().getServerPort();
- portText.setText(portString == null ? "8080" : portString);
+ private void createAdditionalFilesSection() {
+ Section additionalFilesSection = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
+ additionalFilesSection.marginWidth = 5;
+ additionalFilesSection.setText("Additional Files");
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 2;
- portText.setLayoutData(gridData);
- portText.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- updateTestConnectionAndDeployButtons();
- getDeploymentInfo().setServerPort(portText.getText());
- editor.setDirty(true);
- }
- });
+// gridData.verticalAlignment = GridData.BEGINNING;
+ additionalFilesSection.setLayoutData(gridData);
+
+ Composite additionalFilesClient = toolkit.createComposite(additionalFilesSection);
+ additionalFilesSection.setClient(additionalFilesClient);
+ additionalFilesSection.setDescription("Add additional files such as forms that need to be included in the deployment.");
+ toolkit.paintBordersFor(additionalFilesClient);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ additionalFilesClient.setLayout(layout);
+ createAdditionalFilesList(additionalFilesClient);
+ createAdditionalFilesButtons(additionalFilesClient);
}
- private void createServerDeployerField(Composite infoFormClient) {
- Label deployerLabel = toolkit.createLabel(infoFormClient, "Server Deployer:");
- deployerLabel.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- deployerText = toolkit.createText(infoFormClient, "");
- String deployerString = deploymentInfo.getServerDeployer();
- deployerText.setText(deployerString == null ? "/jbpm-console/upload" : deployerString);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 2;
- deployerText.setLayoutData(gridData);
- deployerText.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- updateTestConnectionAndDeployButtons();
- getDeploymentInfo().setServerDeployer(deployerText.getText());
- editor.setDirty(true);
- }
- });
+ private void createAdditionalFilesList(Composite parent) {
+ additionalFilesList = toolkit.createTable(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.heightHint = 70;
+ gridData.widthHint = 100;
+ additionalFilesList.setLayoutData(gridData);
}
- private void createUserNameField(Composite composite) {
- Label usernameLabel = toolkit.createLabel(composite, "Username:");
- usernameLabel.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- usernameText = toolkit.createText(composite, "", SWT.BORDER);
- String usernameString = Plugin.getDefault().getPreferenceStore().getString("user name");
- usernameText.setText(usernameString == null ? "" : usernameString);
- usernameText.setEnabled(useCredentialsButton.getSelection());
- usernameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ private void createAdditionalFilesButtons(Composite parent) {
+ Composite composite = toolkit.createComposite(parent);
+ composite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+ composite.setLayout(gridLayout);
+ additionalFilesAddButton = toolkit.createButton(composite, "Add...", SWT.NONE);
+ additionalFilesAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ additionalFilesRemoveButton = toolkit.createButton(composite, "Remove", SWT.NONE);
+ additionalFilesRemoveButton.setEnabled(false);
}
- private void createPasswordField(Composite composite) {
- Label passwordLabel = toolkit.createLabel(composite, "Password:");
- passwordLabel.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- passwordText = toolkit.createText(composite, "", SWT.PASSWORD | SWT.BORDER);
- String passwordString = Plugin.getDefault().getPreferenceStore().getString("password");
- passwordText.setText(passwordString == null ? "" : passwordString);
- passwordText.setEnabled(useCredentialsButton.getSelection());
- passwordText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- private void createUseCredentialsButton(Composite infoFormClient) {
- useCredentialsButton = toolkit.createButton(infoFormClient, "Use credentials", SWT.CHECK);
- useCredentialsButton.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- useCredentialsButton.setSelection(Plugin.getDefault().getPreferenceStore().getBoolean("use credentials"));
- GridData gridData = new GridData();
- gridData.horizontalSpan = 3;
- useCredentialsButton.setLayoutData(gridData);
- useCredentialsButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- usernameText.setEnabled(useCredentialsButton.getSelection());
- passwordText.setEnabled(useCredentialsButton.getSelection());
- }
- });
- }
-
- private void createUseCredentialsGroup(Composite infoFormClient) {
- Composite useCredentialsGroup = toolkit.createComposite(infoFormClient, SWT.BORDER);
+ private void createClassesAndResourcesSection() {
+ Section classesAndResourcesSection = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
+ classesAndResourcesSection.marginWidth = 5;
+ classesAndResourcesSection.setText("Classes and Resources");
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 3;
- useCredentialsGroup.setLayoutData(gridData);
- useCredentialsGroup.setLayout(new GridLayout(2, false));
- createUserNameField(useCredentialsGroup);
- createPasswordField(useCredentialsGroup);
- }
-
- private void createTestConnectionButton(Composite infoFormClient) {
- testConnectionButton = toolkit.createButton(infoFormClient, "Test Connection...", SWT.PUSH);
- testConnectionButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- createProcessDeployer().pingServer();
- }
- });
- }
-
- private Composite createIncludeFilesSection() {
- Section includeFilesDetails = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
- includeFilesDetails.marginWidth = 5;
- includeFilesDetails.setText("Files and Folders");
- includeFilesDetails.setLayoutData(new GridData(GridData.FILL_BOTH));
+ classesAndResourcesSection.setLayoutData(gridData);
- Composite includeFilesFormClient = toolkit.createComposite(includeFilesDetails);
- includeFilesDetails.setClient(includeFilesFormClient);
- includeFilesDetails.setDescription("Select the files and folders to include in the process archive.");
- toolkit.paintBordersFor(includeFilesFormClient);
+ Composite classesAndResourcesClient = toolkit.createComposite(classesAndResourcesSection);
+ classesAndResourcesSection.setClient(classesAndResourcesClient);
+ classesAndResourcesSection.setDescription("Add classes and/or resources that need to be included in the deployment.");
+ toolkit.paintBordersFor(classesAndResourcesClient);
GridLayout layout = new GridLayout();
- layout.marginWidth = 2;
- layout.marginHeight = 2;
- layout.numColumns = 1;
- includeFilesFormClient.setLayout(layout);
+ layout.numColumns = 2;
+ classesAndResourcesClient.setLayout(layout);
+ createClassesAndResourcesList(classesAndResourcesClient);
+ createClassesAndResourcesButtons(classesAndResourcesClient);
+ }
- Tree tree = toolkit.createTree(includeFilesFormClient, SWT.CHECK);
- tree.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- includeFilesTreeViewer = new IncludeInDeploymentTreeViewer(tree);
- includeFilesTreeViewer.setContentProvider(new IncludeFilesTreeContentProvider());
- includeFilesTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
- includeFilesTreeViewer.setInput(processFolder);
- tree.getDisplay().asyncExec(new Runnable() {
- public void run() {
- includeFilesTreeViewer.setCheckedElements(getDeploymentInfo().getFilesAndFolders());
- }
- });
- includeFilesTreeViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- getDeploymentInfo().setFilesAndFolders(includeFilesTreeViewer.getCheckedElements());
- editor.setDirty(true);
- }
- });
-
- final Button includeFilesDefaultButton = toolkit.createButton(includeFilesFormClient, "Reset Defaults", SWT.PUSH);
- includeFilesDefaultButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- includeFilesDefaultButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- includeFilesDefaultButton.getDisplay().asyncExec(new Runnable() {
- public void run() {
- includeFilesTreeViewer.setCheckedElements(getDeploymentInfo().getFilesAndFolders());
- }
- });
- }
- });
-
-
- return includeFilesFormClient;
+ private void createClassesAndResourcesList(Composite parent) {
+ classesAndResourcesList = toolkit.createTable(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
+ GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
+ gridData.heightHint = 70;
+ gridData.widthHint = 100;
+ classesAndResourcesList.setLayoutData(gridData);
}
- private ArrayList getElementsToCheckFor(IFolder folder) {
- ArrayList list = new ArrayList();
- try {
- IResource[] members = folder.members();
- for (int i = 0; i < members.length; i++) {
- list.add(members[i]);
- if (members[i] instanceof IFolder) {
- list.addAll(getElementsToCheckFor((IFolder)members[i]));
- }
- }
- } catch(CoreException e) {
- Logger.logError(e);
- }
- return list;
+ private void createClassesAndResourcesButtons(Composite parent) {
+ Composite composite = toolkit.createComposite(parent);
+ composite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+ composite.setLayout(gridLayout);
+
+ classesAndResourcesAddButton = toolkit.createButton(composite, "Add", SWT.NONE);
+ classesAndResourcesAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ classesAndResourcesRemoveButton = toolkit.createButton(composite, "Remove", SWT.NONE);
+ classesAndResourcesRemoveButton.setEnabled(false);
}
- private Set getElementsToCheckFor(IJavaProject project) {
- Set result = new HashSet();
- try {
- if (project != null) {
- Set javaClassNames = JavaClassNameCollector.getJavaClassNames(editor.getProcessDefinition());
- Iterator iterator = javaClassNames.iterator();
- while (iterator.hasNext()) {
- IType type = project.findType((String)iterator.next());
- if (type != null) {
- result.add(type.getCompilationUnit());
- }
- }
- }
- }
- catch (JavaModelException e) {
- Logger.logError(e);
- }
- return result;
- }
-
- private Composite createIncludeClassesSection() {
- Section includeClassesDetails = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
- includeClassesDetails.marginWidth = 5;
- includeClassesDetails.setText("Java Classes and Resources");
- includeClassesDetails.setLayoutData(new GridData(GridData.FILL_BOTH));
+ private void createUserCredentialsSection() {
+ Section userCredentialsSection = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
+ userCredentialsSection.marginWidth = 5;
+ userCredentialsSection.setText("User Credentials");
+
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ userCredentialsSection.setLayoutData(gridData);
- Composite includeClassesFormClient = toolkit.createComposite(includeClassesDetails);
- includeClassesDetails.setClient(includeClassesFormClient);
- includeClassesDetails.setDescription("Select the Java classes and resources to include in the process archive.");
- toolkit.paintBordersFor(includeClassesFormClient);
+ Composite userCredentialsClient = toolkit.createComposite(userCredentialsSection);
+ userCredentialsSection.setClient(userCredentialsClient);
+ userCredentialsSection.setDescription("Specify the user credentials for the chosen server.");
+ toolkit.paintBordersFor(userCredentialsClient);
GridLayout layout = new GridLayout();
- layout.marginWidth = 2;
- layout.marginHeight = 2;
- layout.numColumns = 1;
- includeClassesFormClient.setLayout(layout);
-
- Tree tree = toolkit.createTree(includeClassesFormClient, SWT.CHECK);
- tree.setLayoutData(new GridData(GridData.FILL_BOTH));
+ layout.numColumns = 2;
+ userCredentialsClient.setLayout(layout);
- includeClassesTreeViewer = new IncludeInDeploymentTreeViewer(tree);
- includeClassesTreeViewer.setContentProvider(new IncludeClassesTreeContentProvider());
- includeClassesTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
- final IJavaProject project = JavaCore.create(processFolder.getProject());
- if (project != null) {
- includeClassesTreeViewer.setInput(project);
- }
- composite.getDisplay().asyncExec(new Runnable() {
- public void run() {
- includeClassesTreeViewer.setCheckedElements(getDeploymentInfo().getClassesAndResources());
- }
- });
- includeClassesTreeViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- getDeploymentInfo().setClassesAndResources(includeClassesTreeViewer.getCheckedElements());
- editor.setDirty(true);
- }
- });
-
- final Button includeClassesDefaultButton = toolkit.createButton(includeClassesFormClient, "Reset Defaults", SWT.PUSH);
- includeClassesDefaultButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- includeClassesDefaultButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- composite.getDisplay().asyncExec(new Runnable() {
- public void run() {
- includeClassesTreeViewer.setCheckedElements(getDeploymentInfo().getClassesAndResources());
- }
- });
- }
- });
+ useCredentialsButton = toolkit.createButton(userCredentialsClient, "Use credentials", SWT.CHECK);
+ useCredentialsButton.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ GridData buttonData = new GridData();
+ buttonData.horizontalSpan = 2;
+ useCredentialsButton.setLayoutData(buttonData);
- return includeClassesFormClient;
+ Label userNameLabel = toolkit.createLabel(userCredentialsClient, "Username:");
+ userNameLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ userNameText = toolkit.createText(userCredentialsClient, "");
+ userNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Label passwordLabel = toolkit.createLabel(userCredentialsClient, "Password:");
+ passwordLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ passwordText = toolkit.createText(userCredentialsClient, "", SWT.PASSWORD);
+ passwordText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
- private Composite createLocalSaveFormClient() {
- Section httpInfoDetails = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
- httpInfoDetails.marginWidth = 5;
- httpInfoDetails.setText("Local Save Settings");
+ private void createServerInfoSection() {
+ Section serverInfoSection = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
+ serverInfoSection.marginWidth = 5;
+ serverInfoSection.setText("Server Settings");
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.verticalAlignment = GridData.BEGINNING;
- httpInfoDetails.setLayoutData(gridData);
+ serverInfoSection.setLayoutData(gridData);
- Composite detailClient = toolkit.createComposite(httpInfoDetails);
- httpInfoDetails.setClient(detailClient);
- httpInfoDetails.setDescription("Choose if and where you wish to save the process archive locally.");
- toolkit.paintBordersFor(detailClient);
+ Composite serverInfoClient = toolkit.createComposite(serverInfoSection);
+ serverInfoSection.setClient(serverInfoClient);
+ serverInfoSection.setDescription("Specify the settings of the server you wish to deploy to.");
+ toolkit.paintBordersFor(serverInfoClient);
GridLayout layout = new GridLayout();
- layout.marginWidth = 2;
- layout.marginHeight = 2;
- layout.numColumns = 3;
- detailClient.setLayout(layout);
- return detailClient;
+ layout.numColumns = 2;
+ serverInfoClient.setLayout(layout);
+
+ Label serverNameLabel = toolkit.createLabel(serverInfoClient, "Server Name:");
+ serverNameLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ serverNameText = toolkit.createText(serverInfoClient, "");
+ serverNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Label serverPortLabel = toolkit.createLabel(serverInfoClient, "Server Port:");
+ serverPortLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ serverPortText = toolkit.createText(serverInfoClient, "");
+ serverPortText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Label serverDeployerLabel = toolkit.createLabel(serverInfoClient, "Server Deployer:");
+ serverDeployerLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ serverDeployerText = toolkit.createText(serverInfoClient, "");
+ serverDeployerText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
-
- private void createSaveLocallyCheckBox(Composite localSaveFormclient) {
- saveLocallyButton = toolkit.createButton(localSaveFormclient, "Save Process Archive Locally", SWT.CHECK);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 3;
- saveLocallyButton.setLayoutData(gridData);
- saveLocallyButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- boolean selection = ((Button)e.widget).getSelection();
- locationText.setEditable(selection);
- locationButton.setEnabled(selection);
- updateSaveAndDeployButtons(selection);
- }
- });
+
+ public void refresh() {
+ unhookListeners();
+ updateControls();
+ hookListeners();
+ }
+
+ private void unhookListeners() {
+ includeGraphicalInfoFileButton.removeSelectionListener(includeGraphicalInfoFileButtonSelectionListener);
+ browseGraphicalInfoFileButton.removeSelectionListener(browseGraphicalInfoFileButtonSelectionListener);
+ includeImageFileButton.removeSelectionListener(includeImageFileButtonSelectionListener);
+ browseImageFileButton.removeSelectionListener(browseImageFileButtonSelectionListener);
+ additionalFilesList.removeSelectionListener(additionalFilesListSelectionListener);
+ additionalFilesAddButton.removeSelectionListener(additionaFilesAddButtonSelectionListener);
+ additionalFilesRemoveButton.removeSelectionListener(additionaFilesRemoveButtonSelectionListener);
+ classesAndResourcesList.removeSelectionListener(classesAndResourcesListSelectionListener);
+ classesAndResourcesAddButton.removeSelectionListener(classesAndResourcesAddButtonSelectionListener);
+ classesAndResourcesRemoveButton.removeSelectionListener(classesAndResourcesRemoveButtonSelectionListener);
+ serverNameText.removeModifyListener(serverNameTextListener);
+ serverPortText.removeModifyListener(serverPortTextListener);
+ serverDeployerText.removeModifyListener(serverDeployerTextListener);
}
- private void updateSaveAndDeployButtons(boolean selection) {
- if (!selection) {
- deployButton.setEnabled(testConnectionButton.isEnabled());
- saveButton.setEnabled(false);
- } else {
- if (notEmpty(locationText)) {
- saveButton.setEnabled(true);
- deployButton.setEnabled(testConnectionButton.isEnabled());
- } else {
- saveButton.setEnabled(false);
- deployButton.setEnabled(false);
- }
+ private void updateControls() {
+ updateProcessInfoFileControls();
+ updateGraphicalInfoFileControls();
+ updateImageFileControls();
+ updateAdditionalFilesControls();
+ updateClassesAndResourcesControls();
+ updateUseCredentialsControls();
+ updateServerInfoControls();
+ }
+
+ private void updateProcessInfoFileControls() {
+ IFile processInfoFile = deploymentInfo.getProcessInfoFile();
+ String value = "";
+ if (processInfoFile != null) {
+ value = processInfoFile.getFullPath().toString();
}
+ includeProcessInfoFileButton.setSelection(!"".equals(value));
+ includeProcessInfoFileButton.setEnabled(false);
+ processInfoFileText.setText(value);
}
- private boolean notEmpty(Text text) {
- String string = text.getText();
- return string != null && !"".equals(string);
+ private void updateGraphicalInfoFileControls() {
+ IFile graphicalInfoFile = deploymentInfo.getGraphicalInfoFile();
+ String value = "";
+ if (graphicalInfoFile != null) {
+ value = graphicalInfoFile.getFullPath().toString();
+ }
+ includeGraphicalInfoFileButton.setSelection(graphicalInfoFile != null);
+ graphicalInfoFileText.setText(value);
+ browseGraphicalInfoFileButton.setEnabled(graphicalInfoFile != null);
}
- private void updateTestConnectionAndDeployButtons() {
- if (notEmpty(nameText) && notEmpty(portText) && notEmpty(deployerText)) {
- testConnectionButton.setEnabled(true);
- if (saveLocallyButton.getSelection()) {
- deployButton.setEnabled(saveButton.isEnabled());
- } else {
- deployButton.setEnabled(true);
+ private void updateImageFileControls() {
+ IFile imageFile = deploymentInfo.getImageFile();
+ String value = "";
+ if (imageFile != null) {
+ value = imageFile.getFullPath().toString();
+ }
+ includeImageFileButton.setSelection(imageFile != null);
+ imageFileText.setText(value);
+ browseImageFileButton.setEnabled(imageFile != null);
+ }
+
+ private void updateAdditionalFilesControls() {
+ Object[] additionalFiles = deploymentInfo.getAdditionalFiles();
+ for (Object object : additionalFiles) {
+ if (object instanceof IFile) {
+ IFile file = (IFile)object;
+ TableItem tableItem = new TableItem(additionalFilesList, SWT.NULL);
+ tableItem.setText(LABELPROVIDER.getText(file) + " (" + file.getFullPath() + ")");
+ tableItem.setImage(LABELPROVIDER.getImage(file));
+ tableItem.setData(object);
}
- } else {
- testConnectionButton.setEnabled(false);
- deployButton.setEnabled(false);
}
}
- private void createSaveLocationField(Composite localSaveFormclient) {
- Label locationLabel = toolkit.createLabel(localSaveFormclient, "Location:");
- locationLabel.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- locationText = toolkit.createText(localSaveFormclient, "");
- locationText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- locationText.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- updateSaveAndDeployButtons(true);
+ private void updateClassesAndResourcesControls() {
+ Object[] classesAndResources = deploymentInfo.getClassesAndResources();
+ for (Object object : classesAndResources) {
+ IPath path = null;
+ if (object instanceof IFile) {
+ path = ((IFile)object).getFullPath();
+ } else if (object instanceof ICompilationUnit) {
+ path = ((ICompilationUnit)object).getPath();
+ } else if (object instanceof IClassFile) {
+ path = ((IClassFile)object).getPath();
}
- });
- locationText.setEditable(false);
- locationButton = toolkit.createButton(localSaveFormclient, "Search...", SWT.PUSH);
- locationButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchLocation();
+ if (path != null) {
+ TableItem tableItem = new TableItem(classesAndResourcesList, SWT.NULL);
+ tableItem.setData(object);
+ tableItem.setText(LABELPROVIDER.getText(object) + " (" + path + ")");
+ tableItem.setImage(LABELPROVIDER.getImage(object));
}
- });
- locationButton.setEnabled(false);
+ }
}
- private void searchLocation() {
- FileDialog dialog = new FileDialog(form.getShell(), SWT.OPEN);
- String result = dialog.open();
- if (result != null) {
- locationText.setText(result);
- updateSaveAndDeployButtons(true);
+ private void updateUseCredentialsControls() {
+ boolean useCredentials = deploymentInfo.getUseCredentials();
+ useCredentialsButton.setSelection(useCredentials);
+ String userName = deploymentInfo.getUserName();
+ if (userName != null) {
+ userNameText.setText(userName);
+ }
+ userNameText.setEnabled(useCredentials);
+ String password = deploymentInfo.getPassword();
+ if (password != null) {
+ passwordText.setText(password);
+ }
+ passwordText.setEnabled(useCredentials);
+ }
+
+ private void updateServerInfoControls() {
+ String serverName = deploymentInfo.getServerName();
+ if (serverName != null) {
+ serverNameText.setText(serverName);
+ }
+ String serverPort = deploymentInfo.getServerPort();
+ if (serverPort != null) {
+ serverPortText.setText(serverPort);
+ }
+ String serverDeployer = deploymentInfo.getServerDeployer();
+ if (serverDeployer != null) {
+ serverDeployerText.setText(serverDeployer);
}
}
- private void createSaveButton(Composite localSaveFormClient) {
- saveButton = toolkit.createButton(localSaveFormClient, "Save Without Deploying...", SWT.PUSH);
- GridData gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = SWT.BEGINNING;
- saveButton.setLayoutData(gridData);
- saveButton.setEnabled(false);
- saveButton.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- if (cancelOrSaveAndContinue()) {
- createProcessDeployer().saveWithoutDeploying();
- }
- }
- });
+ private void hookListeners() {
+ includeGraphicalInfoFileButton.addSelectionListener(includeGraphicalInfoFileButtonSelectionListener);
+ browseGraphicalInfoFileButton.addSelectionListener(browseGraphicalInfoFileButtonSelectionListener);
+ includeImageFileButton.addSelectionListener(includeImageFileButtonSelectionListener);
+ browseImageFileButton.addSelectionListener(browseImageFileButtonSelectionListener);
+ additionalFilesList.addSelectionListener(additionalFilesListSelectionListener);
+ additionalFilesAddButton.addSelectionListener(additionaFilesAddButtonSelectionListener);
+ additionalFilesRemoveButton.addSelectionListener(additionaFilesRemoveButtonSelectionListener);
+ classesAndResourcesList.addSelectionListener(classesAndResourcesListSelectionListener);
+ classesAndResourcesAddButton.addSelectionListener(classesAndResourcesAddButtonSelectionListener);
+ classesAndResourcesRemoveButton.addSelectionListener(classesAndResourcesRemoveButtonSelectionListener);
+ serverNameText.addModifyListener(serverNameTextListener);
+ serverPortText.addModifyListener(serverPortTextListener);
+ serverDeployerText.addModifyListener(serverDeployerTextListener);
+ useCredentialsButton.addSelectionListener(useCredentialsButtonSelectionListener);
}
-// public void refresh(final ArrayList objectsToRefresh) {
-// form.getDisplay().asyncExec(new Runnable() {
-// public void run() {
-// refreshIncludeClassesTreeViewer(objectsToRefresh);
-// refreshIncludeFilesTreeViewer(objectsToRefresh);
-// }
-// });
-// }
+ private SelectionListener useCredentialsButtonSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ userNameText.setEnabled(useCredentialsButton.getSelection());
+ passwordText.setEnabled(useCredentialsButton.getSelection());
+ }
+ };
+
+ private ModifyListener serverNameTextListener = new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ deploymentInfo.setServerName(serverNameText.getText());
+ editor.setDirty(true);
+ }
+ };
-// private void refreshIncludeFilesTreeViewer(ArrayList objectsToRefresh) {
-// Object[] elements = includeFilesTreeViewer.getCheckedElements();
-// includeFilesTreeViewer.refresh();
-// includeFilesTreeViewer.setCheckedElements(elements);
-// IWorkspaceRoot root = processFolder.getWorkspace().getRoot();
-// for (int i = 0; i < objectsToRefresh.size(); i++) {
-// IPath path = (IPath)objectsToRefresh.get(i);
-// if (root.getFile(path).exists()) {
-// includeFilesTreeViewer.setChecked(root.getFile(path), true);
-// } else if (root.getFolder(path).exists()) {
-// includeFilesTreeViewer.setChecked(root.getFolder(path), true);
-// }
-// }
-// }
+ private ModifyListener serverPortTextListener = new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ deploymentInfo.setServerPort(serverPortText.getText());
+ editor.setDirty(true);
+ }
+ };
-// private void refreshIncludeClassesTreeViewer(ArrayList objectsToRefresh) {
-// Set referencedJavaClassNames = null;
-// Object[] elements = includeClassesTreeViewer.getCheckedElements();
-// includeClassesTreeViewer.refresh();
-// includeClassesTreeViewer.setCheckedElements(elements);
-// IWorkspaceRoot root = processFolder.getWorkspace().getRoot();
-// for (int i = 0; i < objectsToRefresh.size(); i++) {
-// IPath path = (IPath)objectsToRefresh.get(i);
-// IJavaElement javaElement = JavaCore.create(root.getFile(path));
-// if (javaElement != null && javaElement instanceof ICompilationUnit) {
-// if (referencedJavaClassNames == null) {
-// referencedJavaClassNames = JavaClassNameCollector.getJavaClassNames(editor.getProcessDefinition());
-// }
-// String name = getTypeName((ICompilationUnit)javaElement);
-// boolean checkNeeded = referencedJavaClassNames.contains(name);
-// includeClassesTreeViewer.setChecked(javaElement, checkNeeded);
-// }
-// }
-// }
+ private ModifyListener serverDeployerTextListener = new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ deploymentInfo.setServerDeployer(serverDeployerText.getText());
+ editor.setDirty(true);
+ }
+ };
- private String getTypeName(ICompilationUnit unit) {
- try {
- IType[] types = unit.getTypes();
- if (types.length > 0) {
- return types[0].getFullyQualifiedName();
- }
- } catch (JavaModelException e) {
- Logger.logError(e);
+ private SelectionListener includeGraphicalInfoFileButtonSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ boolean include = includeGraphicalInfoFileButton.getSelection();
+ browseGraphicalInfoFileButton.setEnabled(include);
+ if (include && graphicalInfoFileText.getData() != null) {
+ deploymentInfo.setGraphicalInfoFile((IFile)graphicalInfoFileText.getData());
+ } else {
+ deploymentInfo.setGraphicalInfoFile(null);
}
- return null;
- }
+ editor.setDirty(true);
+ }
+ };
- private boolean cancelOrSaveAndContinue() {
- IEditorPart editor = getEditorPart();
- boolean result = true;
- if (editor.isDirty()) {
- int saveProceedCancel = openSaveProceedCancelDialog();
- if (saveProceedCancel == 2) {
- result = false;
- } else if (saveProceedCancel == 0) {
- editor.doSave(null);
+ private SelectionListener includeImageFileButtonSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ boolean include = includeImageFileButton.getSelection();
+ browseImageFileButton.setEnabled(include);
+ if (include && imageFileText.getData() != null) {
+ deploymentInfo.setImageFile((IFile)imageFileText.getData());
+ } else {
+ deploymentInfo.setImageFile(null);
}
+ editor.setDirty(true);
}
- return result;
- }
-
- private int openSaveProceedCancelDialog() {
- MessageDialog dialog = new MessageDialog(
- getWorkBenchWindow().getShell(),
- "Save Resource",
- null,
- "'" + processFolder.getName() + "' has been modified. Save changes before deploying?",
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL},
- 0);
- return dialog.open();
-
- }
+ };
- private IWorkbenchWindow getWorkBenchWindow() {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- }
+ private SelectionListener browseGraphicalInfoFileButtonSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(null, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle("Graphical Info File Selection");
+ dialog.setMessage("Select the graphical info file.");
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setValidator(fileSelectionStatusValidator);
+ dialog.open();
+ if (dialog.getFirstResult() != null && dialog.getFirstResult() instanceof IFile) {
+ IFile file = (IFile)dialog.getFirstResult();
+ graphicalInfoFileText.setText(file.getFullPath().toString());
+ graphicalInfoFileText.setData(file);
+ deploymentInfo.setGraphicalInfoFile(file);
+ editor.setDirty(true);
+ }
+ }
+ };
- private IEditorPart getEditorPart() {
- return getWorkBenchWindow().getActivePage().getActiveEditor();
- }
+ private SelectionListener browseImageFileButtonSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(null, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle("Image File Selection");
+ dialog.setMessage("Select the image file.");
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setValidator(fileSelectionStatusValidator);
+ dialog.open();
+ if (dialog.getFirstResult() != null && dialog.getFirstResult() instanceof IFile) {
+ IFile file = (IFile)dialog.getFirstResult();
+ imageFileText.setText(file.getFullPath().toString());
+ imageFileText.setData(file);
+ deploymentInfo.setImageFile(file);
+ editor.setDirty(true);
+ }
+ }
+ };
- public void refresh() {
- if (composite.isDisposed()) return;
- nameText.setText(getDeploymentInfo().getServerName());
- portText.setText(getDeploymentInfo().getServerPort());
- deployerText.setText(getDeploymentInfo().getServerDeployer());
- composite.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!includeClassesTreeViewer.getTree().isDisposed()) {
- includeClassesTreeViewer.refresh();
- includeClassesTreeViewer.setCheckedElements(getDeploymentInfo().getClassesAndResources());
+ private SelectionListener additionalFilesListSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ additionalFilesRemoveButton.setEnabled(additionalFilesList.getSelectionCount() > 0);
+ }
+ };
+
+ private SelectionListener additionaFilesAddButtonSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(null, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle("Additional File Selection");
+ dialog.setMessage("Select the additional file.");
+ dialog.setAllowMultiple(false);
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setValidator(fileSelectionStatusValidator);
+ dialog.open();
+ if (dialog.getFirstResult() != null && dialog.getFirstResult() instanceof IFile) {
+ IFile file = (IFile)dialog.getFirstResult();
+ TableItem tableItem = new TableItem(additionalFilesList, SWT.NULL);
+ tableItem.setText(LABELPROVIDER.getText(file) + " (" + file.getFullPath() + ")");
+ tableItem.setImage(LABELPROVIDER.getImage(file));
+ deploymentInfo.addToAdditionalFiles(file);
+ editor.setDirty(true);
+ }
+ }
+ };
+
+ private ISelectionStatusValidator fileSelectionStatusValidator =
+ new ISelectionStatusValidator() {
+ public IStatus validate(Object[] arg0) {
+ if (arg0.length == 1 && arg0[0] instanceof IFile) {
+ return new Status(IStatus.OK, Plugin.getDefault().getBundle().getSymbolicName(), "Press OK to confirm.");
+ } else {
+ return new Status(IStatus.ERROR, Plugin.getDefault().getBundle().getSymbolicName(), "Select a single file.");
}
- }
- });
- composite.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!includeFilesTreeViewer.getTree().isDisposed()) {
- includeFilesTreeViewer.refresh();
- includeFilesTreeViewer.setCheckedElements(getDeploymentInfo().getFilesAndFolders());
+ }
+ };
+
+ private SelectionListener additionaFilesRemoveButtonSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ int[] indices = additionalFilesList.getSelectionIndices();
+ if (indices.length > 0) {
+ TableItem tableItem = additionalFilesList.getItem(indices[0]);
+ Object object = tableItem.getData();
+ deploymentInfo.removeFromAdditionalFiles(object);
+ additionalFilesList.remove(indices[0]);
+ editor.setDirty(true);
+ }
+ }
+ };
+
+ private SelectionListener classesAndResourcesListSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ classesAndResourcesRemoveButton.setEnabled(classesAndResourcesList.getSelectionCount() > 0);
+ }
+ };
+
+ private SelectionListener classesAndResourcesAddButtonSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(null, new JavaElementLabelProvider(), new ClassesAndResourcesContentProvider());
+ dialog.setTitle("Classes and Resources Selection");
+ dialog.setAllowMultiple(false);
+ dialog.setMessage("Select a class or resouce.");
+ dialog.setInput(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
+ dialog.setValidator(classesAndResourcesSelectionStatusValidator);
+ dialog.open();
+ if (dialog.getFirstResult() != null) { //&& dialog.getFirstResult() instanceof IFile) {
+ IPath path = null;
+ if (dialog.getFirstResult() instanceof IFile) {
+ path = ((IFile)dialog.getFirstResult()).getFullPath();
+ } else if (dialog.getFirstResult() instanceof ICompilationUnit) {
+ path = ((ICompilationUnit)dialog.getFirstResult()).getPath();
+ } else if (dialog.getFirstResult() instanceof IClassFile) {
+ path = ((IClassFile)dialog.getFirstResult()).getPath();
}
- }
- });
- }
+ if (path != null) {
+ TableItem tableItem = new TableItem(classesAndResourcesList, SWT.NULL);
+ tableItem.setData(dialog.getFirstResult());
+ tableItem.setText(LABELPROVIDER.getText(dialog.getFirstResult()) + " (" + path + ")");
+ tableItem.setImage(LABELPROVIDER.getImage(dialog.getFirstResult()));
+ deploymentInfo.addToClassesAndResources(dialog.getFirstResult());
+ editor.setDirty(true);
+ }
+ }
+ }
+ };
+ private ISelectionStatusValidator classesAndResourcesSelectionStatusValidator =
+ new ISelectionStatusValidator() {
+ public IStatus validate(Object[] arg0) {
+ if (arg0.length == 1 && (arg0[0] instanceof IFile || arg0[0] instanceof ICompilationUnit || arg0[0] instanceof IClassFile)) {
+ return new Status(IStatus.OK, Plugin.getDefault().getBundle().getSymbolicName(), "Press OK to confirm.");
+ } else {
+ return new Status(IStatus.ERROR, Plugin.getDefault().getBundle().getSymbolicName(), "Select a single file.");
+ }
+ }
+ };
+
+ private SelectionListener classesAndResourcesRemoveButtonSelectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ int[] indices = classesAndResourcesList.getSelectionIndices();
+ if (indices.length > 0) {
+ TableItem tableItem = classesAndResourcesList.getItem(indices[0]);
+ Object object = tableItem.getData();
+ deploymentInfo.removeFromClassesAndResources(object);
+ classesAndResourcesList.remove(indices[0]);
+ }
+ }
+ };
+
}
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -2,17 +2,49 @@
import java.util.ArrayList;
-import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.jbpm.gd.jpdl.Plugin;
+import org.jbpm.gd.jpdl.prefs.PreferencesConstants;
-public class DeploymentInfo {
+public class DeploymentInfo implements PreferencesConstants {
+ private IFile processInfoFile = null;
+ private IFile graphicalInfoFile = null;
+ private IFile imageFile = null;
private String serverName = null;
private String serverPort = null;
private String serverDeployer = null;
- private IFolder processFolder = null;
- private Object[] classesAndResources = null;
- private Object[] filesAndFolders = null;
+ private ArrayList<Object> classesAndResources = new ArrayList<Object>();
+ private ArrayList<Object> additionalFiles = new ArrayList<Object>();
+ private Boolean useCredentials = null;
+ private String userName = null;
+ private String password = null;
+ public void setProcessInfoFile(IFile processInfoFile) {
+ this.processInfoFile = processInfoFile;
+ }
+
+ public IFile getProcessInfoFile() {
+ return processInfoFile;
+ }
+
+ public void setGraphicalInfoFile(IFile graphicalInfoFile) {
+ this.graphicalInfoFile = graphicalInfoFile;
+ }
+
+ public IFile getGraphicalInfoFile() {
+ return graphicalInfoFile;
+ }
+
+ public void setImageFile(IFile imageFile) {
+ this.imageFile = imageFile;
+ }
+
+ public IFile getImageFile() {
+ return imageFile;
+ }
+
public void setServerName(String serverName) {
this.serverName = serverName;
}
@@ -37,28 +69,91 @@
return serverDeployer;
}
- public void setProcessFolder(IFolder processFolder) {
- this.processFolder = processFolder;
+ public void addToClassesAndResources(Object element) {
+ classesAndResources.add(element);
}
- public IFolder getProcessFolder() {
- return processFolder;
+ public void removeFromClassesAndResources(Object element) {
+ classesAndResources.remove(element);
}
-
- public void setClassesAndResources(Object[] classesAndResources) {
- this.classesAndResources = classesAndResources;
- }
public Object[] getClassesAndResources() {
- return classesAndResources;
+ return classesAndResources.toArray(new Object[classesAndResources.size()]);
}
- public void setFilesAndFolders(Object[] filesAndFolders) {
- this.filesAndFolders = filesAndFolders;
+ public void addToAdditionalFiles(Object element) {
+ additionalFiles.add(element);
}
- public Object[] getFilesAndFolders() {
- return filesAndFolders;
+ public void removeFromAdditionalFiles(Object element) {
+ additionalFiles.remove(element);
}
+
+ public Object[] getAdditionalFiles() {
+ return additionalFiles.toArray(new Object[additionalFiles.size()]);
+ }
+
+ public boolean getUseCredentials() {
+ if (useCredentials == null) {
+ useCredentials = getPrefs().getBoolean(USE_CREDENTIALS);
+ if (useCredentials == null) {
+ useCredentials = false;
+ }
+ }
+ return useCredentials;
+ }
+
+ public void setUseCredentials(boolean useCredentials) {
+ this.useCredentials = useCredentials;
+ }
+
+ public String getUserName() {
+ if (userName == null) {
+ userName = getPrefs().getString(USER_NAME);
+ }
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getPassword() {
+ if (password == null) {
+ password = getPrefs().getString(PASSWORD);
+ }
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public boolean isEmpty() {
+ return
+ graphicalInfoFile == null &&
+ imageFile == null &&
+ isServerNameDefault() &&
+ isServerPortDefault() &&
+ isServerDeployerDefault() &&
+ classesAndResources.isEmpty() &&
+ additionalFiles.isEmpty();
+ }
+
+ private boolean isServerNameDefault() {
+ return serverName == null || serverName.equals(getPrefs().getString(SERVER_NAME));
+ }
+
+ private boolean isServerPortDefault() {
+ return serverPort == null || serverPort.equals(getPrefs().getString(SERVER_PORT));
+ }
+
+ private boolean isServerDeployerDefault() {
+ return serverDeployer == null || serverDeployer.equals(getPrefs().getString(SERVER_DEPLOYER));
+ }
+
+ private IPreferenceStore getPrefs() {
+ return Plugin.getDefault().getPreferenceStore();
+ }
}
Deleted: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeClassesTreeContentProvider.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeClassesTreeContentProvider.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeClassesTreeContentProvider.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -1,137 +0,0 @@
-package org.jbpm.gd.jpdl.deployment;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Control;
-import org.jbpm.gd.jpdl.Logger;
-
-public class IncludeClassesTreeContentProvider implements ITreeContentProvider {
-
- public Object[] getElements(Object parent) {
- if (parent instanceof IJavaProject) {
- return getPackageFragmentRoots((IJavaProject)parent);
- }
- return new Object[0];
- }
-
- private IPackageFragmentRoot[] getPackageFragmentRoots(IJavaProject project) {
- try {
- ArrayList list = new ArrayList();
- IClasspathEntry[] entries = project.getRawClasspath();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getEntryKind() != IClasspathEntry.CPE_CONTAINER) {
- IPackageFragmentRoot[] roots = project.findPackageFragmentRoots(entries[i]);
- for (int j = 0; j < roots.length; j++) {
- list.add(roots[j]);
- }
- }
- }
- return (IPackageFragmentRoot[])list.toArray(new IPackageFragmentRoot[list.size()]);
- }
- catch (JavaModelException e) {
- Logger.logError(e);
- }
- return new IPackageFragmentRoot[0];
- }
-
- public Object[] getChildren(Object parent) {
- ArrayList list = new ArrayList();
- try {
- if (parent instanceof IPackageFragmentRoot) {
- list.addAll(toArrayList(((IPackageFragmentRoot)parent).getNonJavaResources()));
- list.addAll(getNonEmptyPackageFragments((IPackageFragmentRoot) parent));
- } else if (parent instanceof IPackageFragment) {
- list.addAll(toArrayList(((IPackageFragment)parent).getNonJavaResources()));
- list.addAll(toArrayList(((IPackageFragment)parent).getChildren()));
- }
- } catch (JavaModelException e) {
- Logger.logError(e);
- }
- return list.toArray();
- }
-
- private ArrayList toArrayList(Object[] resources){
- ArrayList list = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- list.add(resources[i]);
- }
- return list;
- }
-
- private ArrayList getNonEmptyPackageFragments(IPackageFragmentRoot parent) {
- ArrayList list = new ArrayList();
- try {
- Object[] children = parent.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof IPackageFragment && hasChildren(children, i)) {
- list.add(children[i]);
- }
- }
- } catch (JavaModelException e) {
- Logger.logError(e);
- }
- return list;
- }
-
- private boolean hasChildren(Object[] children, int i) throws JavaModelException {
- return (((IPackageFragment)children[i]).getChildren().length != 0)
- || (((IPackageFragment)children[i]).getNonJavaResources().length != 0);
- }
-
- public Object getParent(Object element) {
- if (element == null) {
- return null;
- } else if (element instanceof IJavaElement) {
- return ((IJavaElement)element).getParent();
- } else if (element instanceof IResource) {
- IJavaElement javaElement = JavaCore.create(((IResource) element).getParent());
- if (javaElement != null) {
- return javaElement;
- } else {
- return ((IResource)element).getParent();
- }
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof IPackageFragmentRoot) {
- return getChildren(element).length > 0;
- } else if (element instanceof IPackageFragment) {
- return getChildren(element).length > 0;
- }
- return false;
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- asyncRefresh(viewer);
- }
-
- private void asyncRefresh(final Viewer viewer) {
- Control control = viewer.getControl();
- if (!control.isDisposed()) {
- control.getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- if (!viewer.getControl().isDisposed()) {
- viewer.refresh();
- }
- }
- });
- }
- }
-
-}
Deleted: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeFilesTreeContentProvider.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeFilesTreeContentProvider.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeFilesTreeContentProvider.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -1,67 +0,0 @@
-package org.jbpm.gd.jpdl.deployment;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Control;
-import org.jbpm.gd.jpdl.Logger;
-
-public class IncludeFilesTreeContentProvider implements ITreeContentProvider {
-
- public Object[] getElements(Object parent) {
- if (parent instanceof IFolder) {
- try {
- return ((IFolder) parent).members();
- } catch (CoreException e) {
- Logger.logError(e);
- }
- }
- return new Object[0];
- }
-
- public Object[] getChildren(Object parent) {
- try {
- if (parent instanceof IFolder)
- return ((IFolder) parent).members();
- } catch (CoreException e) {
- Logger.logError(e);
- }
- return new Object[0];
- }
-
- public Object getParent(Object element) {
- if (element != null && element instanceof IResource) {
- return ((IResource) element).getParent();
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof IFolder)
- return getChildren(element).length > 0;
- return false;
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- asyncRefresh(viewer);
- }
-
- private void asyncRefresh(final Viewer viewer) {
- Control control = viewer.getControl();
- if (!control.isDisposed()) {
- control.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!viewer.getControl().isDisposed()) {
- viewer.refresh();
- }
- }
- });
- }
- }
-
-}
Deleted: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeInDeploymentTreeViewer.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeInDeploymentTreeViewer.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeInDeploymentTreeViewer.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -1,159 +0,0 @@
-package org.jbpm.gd.jpdl.deployment;
-
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.swt.widgets.Tree;
-
-public class IncludeInDeploymentTreeViewer extends CheckboxTreeViewer {
-
- public IncludeInDeploymentTreeViewer(Tree tree) {
- super(tree);
- addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- handleCheckStateChanged(event);
- }
- });
- }
-
- private void handleCheckStateChanged(CheckStateChangedEvent event) {
- updateChecks(event.getElement(), event.getChecked());
- }
-
-// private void handleCheckStateChangedForChildren(Object object, boolean checked) {
-// expandToLevel(object, ALL_LEVELS);
-// setGrayed(object, false);
-// ITreeContentProvider provider = (ITreeContentProvider)getContentProvider();
-// Object[] children = provider.getChildren(object);
-// for (int i = 0; i < children.length; i++) {
-// setChecked(children[i], checked);
-// handleCheckStateChangedForChildren(children[i], checked);
-// }
-// }
-
-// private void handleCheckStateChangedForParent(Object object) {
-// ITreeContentProvider provider = (ITreeContentProvider)getContentProvider();
-// Object parent = provider.getParent(object);
-// if (parent != null) {
-// Object[] children = provider.getChildren(parent);
-// int numberChecked = 0;
-// boolean grayedChildren = false;
-// for (int i = 0; i < children.length; i++) {
-// if (getChecked(children[i])) numberChecked++;
-// if (getGrayed(children[i])) grayedChildren = true;
-// }
-// setChecked(parent, numberChecked > 0);
-// setGrayed(parent, (numberChecked > 0 && numberChecked < children.length) || grayedChildren);
-// handleCheckStateChangedForParent(parent);
-// }
-// }
-
- public boolean setChecked(final Object element, final boolean state) {
- boolean result = super.setChecked(element, state);
- if (result) {
- updateChecks(element, state);
- }
- return result;
- }
-
- public void setCheckedElements(final Object[] elements) {
- super.setCheckedElements(elements);
- for (int i = 0; i < elements.length; i++) {
- updateChecks(elements[i], true);
- }
- }
-
- private void updateChecks(Object object, boolean state) {
- updateChecksForChildren(object, state);
- updateChecksForParents(object, state);
- }
-
- private void updateChecksForChildren(Object object, boolean state) {
- setGrayed(object, false);
- Object[] children = ((ITreeContentProvider)getContentProvider()).getChildren(object);
- for (int i = 0; i < children.length; i++) {
- if (getChecked(children[i]) != state) {
- super.setChecked(children[i], state);
- updateChecksForChildren(children[i], state);
- }
- }
- }
-
- private void updateChecksForParents(Object object, boolean state) {
- ITreeContentProvider provider = (ITreeContentProvider)getContentProvider();
- Object child = object;
- Object parent = provider.getParent(child);
- boolean change = true;
- while (parent != null && change) {
- Object[] siblings = provider.getChildren(parent);
- int numberChecked = 0;
- boolean grayed = false;
- change = false;
- for (int i = 0; i < siblings.length; i++) {
- if (getChecked(siblings[i])) numberChecked++;
- if (getGrayed(siblings[i])) grayed = true;
- }
- if (numberChecked == 0) {
- if (getChecked(parent) || getGrayed(parent)) change = true;
- setGrayChecked(parent, false);
- }
- else if (numberChecked == siblings.length) {
- if (!getChecked(parent) || getGrayed(parent) != grayed) change = true;
- setGrayed(parent, false);
- setChecked(parent, true);
- }
- else {
- if (!getChecked(parent) || !getGrayed(parent)) change = true;
- setGrayChecked(parent, true);
- }
- child = parent;
- parent = provider.getParent(child);
- }
-
- }
-
-// public void updateChecks() {
-// getControl().getDisplay().asyncExec(new Runnable() {
-// public void run() {
-// ITreeContentProvider provider = (ITreeContentProvider)getContentProvider();
-// Object[] elements = provider.getElements(getInput());
-// for (int i = 0; i < elements.length; i++) {
-// updateChecks(provider, elements[i]);
-// }
-// }
-// });
-// }
-
-
-
-// private int[] updateChecks(ITreeContentProvider provider, Object object) {
-// int[] result = new int[2]; // result[0] contains the number of checked, result[1] the number of grayed elements
-// int[] updates = new int[2];
-// Object[] children = provider.getChildren(object);
-// if ((children == null || children.length == 0)) {
-// if (getChecked(object)) result[0]++;
-// } else {
-// for (int i = 0; i < children.length; i++) {
-// int[] runner = updateChecks(provider, children[i]);
-// updates[0] += runner[0];
-// updates[1] += runner[1];
-// }
-// if (updates[0] == children.length && updates[1] == 0) {
-// setChecked(object, true);
-// result[0]++;
-// setGrayed(object, false);
-// } else if (updates[0] > 0 || updates[1] > 0) {
-// setChecked(object, true);
-// result[0]++;
-// setGrayed(object, true);
-// result[1]++;
-// } else {
-// setChecked(object, false);
-// setGrayed(object, false);
-// }
-// }
-// return result;
-// }
-
-}
\ No newline at end of file
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,241 @@
+package org.jbpm.gd.jpdl.deployment;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.jbpm.gd.jpdl.Logger;
+import org.jbpm.gd.jpdl.editor.JpdlEditor;
+
+public class ProcessArchiveBuilder {
+
+ private JpdlEditor jpdlEditor;
+
+ public ProcessArchiveBuilder(JpdlEditor jpdlEditor) {
+ this.jpdlEditor = jpdlEditor;
+ }
+
+ public byte[] build() {
+ try {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ ZipOutputStream zipOutputStream = new ZipOutputStream(byteArrayOutputStream);
+ if (jpdlEditor.getDeploymentInfo() != null) {
+ addProcessInfoFile(zipOutputStream);
+ addGraphicalInfoFile(zipOutputStream);
+ addProcessImageFile(zipOutputStream);
+ addAdditionalFiles(zipOutputStream);
+ addClassesAndResources(zipOutputStream);
+ }
+ zipOutputStream.close();
+ return byteArrayOutputStream.toByteArray();
+ } catch (Exception e) {
+ showBuildProcessArchiveException();
+ return null;
+ }
+ }
+
+ private void showBuildProcessArchiveException() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Build Process Archive Failed",
+ null,
+ "There was a problem creating the process archive to deploy.",
+ SWT.ICON_ERROR,
+ new String[] { "OK" },
+ 0);
+ dialog.open();
+ }
+
+ private void addFile(ZipOutputStream zipOutputStream, IFile file, String entryName) throws Exception {
+ byte[] buffer = new byte[256];
+ InputStream inputStream;
+ try {
+ inputStream = file.getContents();
+ } catch (CoreException e) {
+ Logger.logError("CoreException getting contents of file " + file.getName(), e);
+ throw e;
+ }
+ try {
+ zipOutputStream.putNextEntry(new ZipEntry(entryName));
+ } catch (IOException e) {
+ Logger.logError("IOException creating entry '" + entryName + "'.", e);
+ }
+ int read;
+ try {
+ while ((read = inputStream.read(buffer)) != -1) {
+ zipOutputStream.write(buffer, 0, read);
+ }
+ } catch(IOException e) {
+ Logger.logError("IOException writing file '"+ entryName +"'.", e);
+ }
+ }
+
+ private void addProcessInfoFile(ZipOutputStream zipOutputStream) throws Exception {
+ IFile processInfoFile = jpdlEditor.getDeploymentInfo().getProcessInfoFile();
+ if (processInfoFile != null) {
+ addFile(zipOutputStream, processInfoFile, "processdefinition.xml");
+ }
+ }
+
+ private void addGraphicalInfoFile(ZipOutputStream zipOutputStream) throws Exception {
+ IFile graphicalInfoFile = jpdlEditor.getDeploymentInfo().getGraphicalInfoFile();
+ if (graphicalInfoFile != null) {
+ addFile(zipOutputStream, graphicalInfoFile, "gpd.xml");
+ }
+ }
+
+ private void addProcessImageFile(ZipOutputStream zipOutputStream) throws Exception {
+ IFile processImageFile = jpdlEditor.getDeploymentInfo().getImageFile();
+ if (processImageFile != null) {
+ addFile(zipOutputStream, processImageFile, "processimage.jpg");
+ }
+ }
+
+ private void addAdditionalFiles(ZipOutputStream zipOutputStream) throws Exception {
+ Object[] additionalFiles = jpdlEditor.getDeploymentInfo().getAdditionalFiles();
+ if (additionalFiles == null) return;
+ for (int i = 0; i < additionalFiles.length; i++) {
+ if (!(additionalFiles[i] instanceof IFile)) continue;
+ IFile file = (IFile)additionalFiles[i];
+ addFile(zipOutputStream, file, file.getName());
+ }
+ }
+
+ private void addClassesAndResources(ZipOutputStream zipOutputStream) throws Exception {
+ Object[] classesAndResources = jpdlEditor.getDeploymentInfo().getClassesAndResources();
+ if (classesAndResources == null) return;
+ for (int i = 0; i < classesAndResources.length; i++) {
+ if (classesAndResources[i] instanceof IFile) {
+ addFile(zipOutputStream, (IFile)classesAndResources[i]);
+ } else if (classesAndResources[i] instanceof ICompilationUnit) {
+ addCompilationUnit(zipOutputStream, (ICompilationUnit)classesAndResources[i]);
+ } else if (classesAndResources[i] instanceof IClassFile) {
+ addClassFile(zipOutputStream, (IClassFile)classesAndResources[i]);
+ }
+ }
+ }
+
+ private void addFile(ZipOutputStream zipOutputStream, String name, ClassLoader classLoader) throws Exception {
+ byte[] buff = new byte[256];
+ zipOutputStream.putNextEntry(new ZipEntry("classes/" + name));
+ InputStream is = classLoader.getResourceAsStream(name);
+ int read;
+ while ((read = is.read(buff)) != -1) {
+ zipOutputStream.write(buff, 0, read);
+ }
+ is.close();
+ }
+
+ private void addFile(ZipOutputStream zipOutputStream, IFile file) throws Exception {
+ addFile(zipOutputStream, getResourceName(file), getClassLoader());
+ }
+
+ private void addCompilationUnit(ZipOutputStream zipOutputStream, ICompilationUnit compilationUnit) throws Exception {
+ String name = getResourceName(compilationUnit.getResource());
+ name = name.substring(0, name.lastIndexOf(".java")) + ".class";
+ ClassLoader classLoader = getClassLoader();
+ addFile(zipOutputStream, name, classLoader);
+ addInnerClasses(zipOutputStream, name, classLoader);
+ }
+
+ private String[] getNestedClassNames(String name, ClassLoader classLoader) {
+ final String className =
+ name.substring(name.lastIndexOf('/') + 1, name.length() - 6) + '$';
+ URL url = classLoader.getResource(name);
+ File file = new File(url.getFile());
+ File folder = new File(file.getParent());
+ return folder.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.startsWith(className);
+ }
+ });
+ }
+
+ private void addInnerClasses(ZipOutputStream zipOutputStream, String name, ClassLoader classLoader) throws Exception {
+ String[] nestedClassNames = getNestedClassNames(name, classLoader);
+ if (nestedClassNames == null) return;
+ for (int i = 0; i < nestedClassNames.length; i++) {
+ String fileName = name.substring(0, name.lastIndexOf("/") + 1) + nestedClassNames[i];
+ addFile(zipOutputStream, fileName, classLoader);
+ }
+
+ }
+
+ private void addClassFile(ZipOutputStream zipOutputStream, IClassFile classFile) throws Exception {
+ String name = classFile.getParent().getElementName().replace('.', '/') + "/" + classFile.getElementName();
+ zipOutputStream.putNextEntry(new ZipEntry("classes/" + name));
+ zipOutputStream.write(classFile.getBytes());
+ }
+
+ private ClassLoader getClassLoader() throws Exception {
+ return new URLClassLoader(getProjectClasspathUrls(), getClass().getClassLoader());
+ }
+
+ private URL[] getProjectClasspathUrls() throws Exception {
+ URL[] urls = new URL[0];
+ IProject project = getProject();
+ IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject == null) {
+ return urls;
+ }
+ String[] pathArray = JavaRuntime.computeDefaultRuntimeClassPath(javaProject);
+ urls = new URL[pathArray.length];
+ for (int i = 0; i < pathArray.length; i++) {
+ urls[i] = new File(pathArray[i]).toURI().toURL();
+ }
+ return urls;
+ }
+
+ private IProject getProject() {
+ IEditorInput editorInput = jpdlEditor.getEditorInput();
+ if (!(editorInput instanceof IFileEditorInput)) return null;
+ IFile file = ((IFileEditorInput)editorInput).getFile();
+ return file.getProject();
+ }
+
+ private IPackageFragmentRoot getPackageFragmentRoot(IResource resource) {
+ IPackageFragmentRoot root = null;
+ IResource r = resource;
+ while (r != null) {
+ IJavaElement javaElement = JavaCore.create(r);
+ if (javaElement != null && javaElement instanceof IPackageFragmentRoot) {
+ root = (IPackageFragmentRoot)javaElement;
+ break;
+ }
+ r = r.getParent();
+ }
+ return root;
+ }
+
+ private String getResourceName(IResource resource) {
+ IPackageFragmentRoot root = getPackageFragmentRoot(resource);
+ if (root == null) {
+ return null;
+ } else {
+ int index = root.getResource().getProjectRelativePath().toString().length() + 1;
+ return resource.getProjectRelativePath().toString().substring(index);
+ }
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,219 @@
+package org.jbpm.gd.jpdl.deployment;
+
+import java.io.DataOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.ConnectException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.jbpm.gd.common.util.Base64Converter;
+import org.jbpm.gd.jpdl.editor.JpdlEditor;
+
+public class ProcessArchiveDeployer {
+
+ private static final String BOUNDARY = "AaB03x";
+
+ private JpdlEditor jpdlEditor;
+
+ public ProcessArchiveDeployer(JpdlEditor jpdlEditor) {
+ this.jpdlEditor = jpdlEditor;
+ }
+
+ public boolean deploy(byte[] processArchive) {
+ URL url = createConnectionUrl();
+ if (url == null) return false;
+ URLConnection connection = openConnection(url);
+ if (connection == null) return false;
+ prepareConnection(connection);
+ if (!sendData(connection, processArchive)) return false;
+ String response = receiveData(connection);
+ if (response == null) {
+ return false;
+ }
+ System.out.println(response);
+ return true;
+ }
+
+ public boolean pingServer() {
+ URL url = createConnectionUrl();
+ if (url == null) return false;
+ URLConnection connection = openConnection(url);
+ if (connection == null) return false;
+ connection.setDoOutput(true);
+ String response = receiveData(connection);
+ if (response == null) {
+ return false;
+ }
+ System.out.println(response);
+ return true;
+ }
+
+ private String constructUrlString() {
+ String result = "http://";
+ String serverName = jpdlEditor.getDeploymentInfo().getServerName();
+ if (serverName != null) {
+ result += serverName;
+ }
+ result += ":";
+ String serverPort = jpdlEditor.getDeploymentInfo().getServerPort();
+ if (serverPort != null) {
+ result += serverPort;
+ }
+ String serverDeployer = jpdlEditor.getDeploymentInfo().getServerDeployer();
+ if (serverDeployer != null) {
+ if (!serverDeployer.startsWith("/")) {
+ result += "/";
+ }
+ result += serverDeployer;
+ }
+ return result;
+ }
+
+ private URLConnection openConnection(URL url) {
+ try {
+ return url.openConnection();
+ } catch (IOException e) {
+ showConnectException();
+ return null;
+ }
+ }
+
+ private URL createConnectionUrl() {
+ try {
+ return new URL(constructUrlString());
+ } catch (MalformedURLException e) {
+ showConstructUrlException();
+ return null;
+ }
+ }
+
+ private void prepareConnection(URLConnection connection) {
+ if (jpdlEditor.getDeploymentInfo().getUseCredentials()) {
+ addCredentials(connection);
+ }
+ connection.setDoInput(true);
+ connection.setDoOutput(true);
+ connection.setUseCaches(false);
+ connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
+ }
+
+ private void addCredentials(URLConnection connection) {
+ String userPassword = jpdlEditor.getDeploymentInfo().getUserName();
+ userPassword += ":";
+ userPassword += jpdlEditor.getDeploymentInfo().getPassword();
+ String encoding = Base64Converter.encode(userPassword);
+ connection.setRequestProperty("Authorization", "Basic " + encoding);
+ }
+
+ private boolean sendData(URLConnection connection, byte[] processArchive) {
+ try {
+ OutputStream outputStream = connection.getOutputStream();
+ DataOutputStream dataOutputStream = new DataOutputStream(outputStream);
+ dataOutputStream.writeBytes("--" + BOUNDARY + "\r\n");
+ dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"definition\"; filename=\"dummy.par\"\r\n");
+ dataOutputStream.writeBytes("Content-Type: application/x-zip-compressed\r\n\r\n");
+ dataOutputStream.write(processArchive);
+ dataOutputStream.writeBytes("\r\n--" + BOUNDARY + "--\r\n");
+ dataOutputStream.flush();
+ dataOutputStream.close();
+ return true;
+ } catch (ConnectException e) {
+ showConnectException();
+ return false;
+ } catch (IOException e) {
+ showSendDataException();
+ return false;
+ }
+ }
+
+ private String receiveData(URLConnection connection) {
+ try {
+ InputStream inputStream = connection.getInputStream();
+ StringBuffer result = new StringBuffer();
+ int read;
+ while ((read = inputStream.read()) != -1) {
+ result.append((char)read);
+ }
+ return result.toString();
+ } catch (ConnectException e) {
+ showConnectException();
+ return null;
+ } catch (FileNotFoundException e) {
+ showFileNotFoundException();
+ return null;
+ } catch (IOException e) {
+ showReceiveDataException();
+ return null;
+ }
+
+ }
+
+ private void showConstructUrlException() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Invalid Connection URL",
+ null,
+ "The constructed URL is invalid. Check your connection parameters.",
+ SWT.ICON_ERROR,
+ new String[] { "OK" },
+ 0);
+ dialog.open();
+ }
+
+ private void showConnectException() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Connection Failed",
+ null,
+ "A connection to the server could not be established. " +
+ "Check your connection parameters and verify that the server is running.",
+ SWT.ICON_ERROR,
+ new String[] { "OK" },
+ 0);
+ dialog.open();
+ }
+
+ private void showFileNotFoundException() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Connection Failed",
+ null,
+ "The server deployer application could not be reached. " +
+ "Check your connection parameters and verify that the server is running.",
+ SWT.ICON_ERROR,
+ new String[] { "OK" },
+ 0);
+ dialog.open();
+ }
+
+ private void showSendDataException() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Deployment Failed",
+ null,
+ "Unexpected exception while sending the deployment archive to the server.",
+ SWT.ICON_ERROR,
+ new String[] { "OK" },
+ 0);
+ dialog.open();
+ }
+
+ private void showReceiveDataException() {
+ MessageDialog dialog = new MessageDialog(
+ jpdlEditor.getSite().getShell(),
+ "Deployment Failed",
+ null,
+ "Unexpected exception while receiving the response from the server.",
+ SWT.ICON_ERROR,
+ new String[] { "OK" },
+ 0);
+ dialog.open();
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlContentProvider.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlContentProvider.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlContentProvider.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -22,7 +22,6 @@
package org.jbpm.gd.jpdl.editor;
import java.io.InputStreamReader;
-import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
@@ -32,14 +31,15 @@
import org.dom4j.io.SAXReader;
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.core.runtime.Path;
+import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.IFileEditorInput;
import org.jbpm.gd.common.editor.AbstractContentProvider;
import org.jbpm.gd.common.model.SemanticElement;
import org.jbpm.gd.common.notation.Edge;
@@ -47,12 +47,14 @@
import org.jbpm.gd.common.notation.NodeContainer;
import org.jbpm.gd.common.notation.NotationElement;
import org.jbpm.gd.common.notation.RootContainer;
+import org.jbpm.gd.jpdl.Plugin;
import org.jbpm.gd.jpdl.deployment.DeploymentInfo;
import org.jbpm.gd.jpdl.model.NodeElement;
import org.jbpm.gd.jpdl.model.NodeElementContainer;
import org.jbpm.gd.jpdl.model.Transition;
+import org.jbpm.gd.jpdl.prefs.PreferencesConstants;
-public class JpdlContentProvider extends AbstractContentProvider{
+public class JpdlContentProvider extends AbstractContentProvider implements PreferencesConstants {
JpdlEditor jpdlEditor;
@@ -63,6 +65,9 @@
public String getNotationInfoFileName(String semanticInfoFileName) {
if ("processdefinition.xml".equals(semanticInfoFileName)) {
return "gpd.xml";
+ } else if (semanticInfoFileName.endsWith("jpdl.xml")) {
+ int index = semanticInfoFileName.indexOf("jpdl.xml");
+ return "." + semanticInfoFileName.substring(0, index) + "gpd.xml";
} else {
return super.getNotationInfoFileName(semanticInfoFileName);
}
@@ -71,6 +76,9 @@
public String getDiagramImageFileName(String semanticInfoFileName) {
if ("processdefinition.xml".equals(semanticInfoFileName)) {
return "processimage.jpg";
+ } else if (semanticInfoFileName.endsWith("jpdl.xml")) {
+ int index = semanticInfoFileName.indexOf("jpdl.xml");
+ return semanticInfoFileName.substring(0, index) + "jpg";
} else {
return super.getDiagramImageFileName(semanticInfoFileName);
}
@@ -121,43 +129,66 @@
}
private void writeDeploymentInfo(DeploymentInfo deploymentInfo, Element element) {
+ if (deploymentInfo.isEmpty()) return;
Element deploymentElement = addElement(element, "deployment");
- addAttribute(deploymentElement, "serverName", deploymentInfo.getServerName());
- addAttribute(deploymentElement, "serverPort", deploymentInfo.getServerPort());
- addAttribute(deploymentElement, "serverDeployer", deploymentInfo.getServerDeployer());
- Element classesAndResourcesElement = addElement(deploymentElement, "classesAndResources");
+ if (deploymentInfo.getGraphicalInfoFile() != null) {
+ addAttribute(deploymentElement, "graphicalInfoFile", deploymentInfo.getGraphicalInfoFile().getFullPath().toString());
+ }
+ if (deploymentInfo.getImageFile() != null) {
+ addAttribute(deploymentElement, "imageFile", deploymentInfo.getImageFile().getFullPath().toString());
+ }
+ if (deploymentInfo.getServerName() != null) {
+ addAttribute(deploymentElement, "serverName", deploymentInfo.getServerName());
+ }
+ if (deploymentInfo.getServerPort() != null) {
+ addAttribute(deploymentElement, "serverPort", deploymentInfo.getServerPort());
+ }
+ if (deploymentInfo.getServerDeployer() != null) {
+ addAttribute(deploymentElement, "serverDeployer", deploymentInfo.getServerDeployer());
+ }
Object[] classesAndResources = deploymentInfo.getClassesAndResources();
- for (int i = 0; i < classesAndResources.length; i++) {
- Object object = classesAndResources[i];
- String value = null;
- if (object instanceof ICompilationUnit) {
- value = ((ICompilationUnit)object).getResource().getFullPath().toString();
- } else if (object instanceof IResource) {
- value = ((IResource)object).getFullPath().toString();
+ if (classesAndResources.length > 0) {
+ Element classesAndResourcesElement = addElement(deploymentElement, "classesAndResources");
+ for (int i = 0; i < classesAndResources.length; i++) {
+ String value = null;
+ String type = null;
+ if (classesAndResources[i] instanceof ICompilationUnit) {
+ value = ((ICompilationUnit)classesAndResources[i]).getPath().toString();
+ type = "java";
+ } else if (classesAndResources[i] instanceof IClassFile) {
+ value = ((IClassFile)classesAndResources[i]).getHandleIdentifier();
+ type = "class";
+ } else if (classesAndResources[i] instanceof IFile) {
+ value = ((IFile)classesAndResources[i]).getFullPath().toString();
+ type = "file";
+ }
+ if (value != null) {
+ Element el = addElement(classesAndResourcesElement, "element");
+ addAttribute(el, "type", type);
+ addAttribute(el, "value", value);
+ }
}
- if (value != null) {
- Element el = addElement(classesAndResourcesElement, "element");
- addAttribute(el, "value", value);
- }
}
- Element filesAndFoldersElement = addElement(deploymentElement, "filesAndFolders");
- Object[] filesAndFolders = deploymentInfo.getFilesAndFolders();
- for (int i = 0; i < filesAndFolders.length; i++) {
- Object object = filesAndFolders[i];
- if (object instanceof IFile) {
- Element el = addElement(filesAndFoldersElement, "element");
- addAttribute(el, "value", ((IFile)object).getFullPath().toString());
+ Object[] additionalFiles = deploymentInfo.getAdditionalFiles();
+ if (additionalFiles.length > 0) {
+ Element filesAndFoldersElement = addElement(deploymentElement, "additionalFiles");
+ for (int i = 0; i < additionalFiles.length; i++) {
+ if (additionalFiles[i] instanceof IFile) {
+ IFile file = (IFile)additionalFiles[i];
+ Element el = addElement(filesAndFoldersElement, "element");
+ addAttribute(el, "value", file.getFullPath().toString());
+ }
}
}
}
- protected void addDeploymentInfo(DeploymentInfo deploymentInfo, IEditorInput editorInput) {
+ protected void initializeDeploymentInfo(DeploymentInfo deploymentInfo, IEditorInput editorInput) {
try {
- IFile file = getNotationInfoFile(((FileEditorInput)editorInput).getFile());
+ IFile file = getNotationInfoFile(((IFileEditorInput)editorInput).getFile());
// the file should exist as this is performed by the addNotationInfo previously
InputStreamReader reader = new InputStreamReader(file.getContents());
Element rootElement = new SAXReader().read(reader).getRootElement();
- processDeploymentInfo(deploymentInfo, rootElement);
+ processDeploymentInfo(deploymentInfo, rootElement, (IFileEditorInput)editorInput);
} catch (DocumentException e) {
e.printStackTrace();
throw new RuntimeException(e);
@@ -167,66 +198,130 @@
}
}
- protected void processDeploymentInfo(DeploymentInfo deploymentInfo, Element element) {
+ protected void processDeploymentInfo(DeploymentInfo deploymentInfo, Element element, IFileEditorInput editorInput) {
Element deploymentElement = element.element("deployment");
+ processProcessInfoFile(deploymentInfo, deploymentElement, editorInput);
+ processGraphicalInfoFile(deploymentInfo, deploymentElement, editorInput);
+ processImageFile(deploymentInfo, deploymentElement, editorInput);
+ processClassesAndResources(deploymentInfo, deploymentElement, editorInput);
+ processAdditionalFiles(deploymentInfo, deploymentElement, editorInput);
+ processServerInfo(deploymentInfo, deploymentElement, editorInput);
+ }
+
+ protected void processServerInfo(DeploymentInfo deploymentInfo, Element deploymentElement, IFileEditorInput editorInput) {
if (deploymentElement == null) return;
- processServerName(deploymentInfo, deploymentElement.attribute("serverName"));
- processServerPort(deploymentInfo, deploymentElement.attribute("serverPort"));
- processServerDeployer(deploymentInfo, deploymentElement.attribute("serverDeployer"));
- processClassesAndResources(deploymentInfo, deploymentElement.element("classesAndResources"));
- processFilesAndFolders(deploymentInfo, deploymentElement.element("filesAndFolders"));
+ IPreferenceStore prefs = Plugin.getDefault().getPreferenceStore();
+ processServerName(deploymentInfo, deploymentElement.attribute("serverName"), prefs);
+ processServerPort(deploymentInfo, deploymentElement.attribute("serverPort"), prefs);
+ processServerDeployer(deploymentInfo, deploymentElement.attribute("serverDeployer"), prefs);
+
}
- protected void processServerName(DeploymentInfo deploymentInfo, Attribute attribute) {
- if (attribute == null) return;
- String value = attribute.getValue();
- if (value == null) return;
- deploymentInfo.setServerName(value);
+ private void processServerName(DeploymentInfo deploymentInfo, Attribute attribute, IPreferenceStore prefs) {
+ if (attribute == null) {
+ deploymentInfo.setServerName(prefs.getString(SERVER_NAME));
+ } else {
+ deploymentInfo.setServerName(attribute.getValue());
+ }
}
- protected void processServerPort(DeploymentInfo deploymentInfo, Attribute attribute) {
- if (attribute == null) return;
- String value = attribute.getValue();
- if (value == null) return;
- deploymentInfo.setServerPort(value);
+ private void processServerPort(DeploymentInfo deploymentInfo, Attribute attribute, IPreferenceStore prefs) {
+ if (attribute == null) {
+ deploymentInfo.setServerPort(prefs.getString(SERVER_PORT));
+ } else {
+ deploymentInfo.setServerPort(attribute.getValue());
+ }
}
- protected void processServerDeployer(DeploymentInfo deploymentInfo, Attribute attribute) {
- if (attribute == null) return;
- String value = attribute.getValue();
- if (value == null) return;
- deploymentInfo.setServerDeployer(value);
+ private void processServerDeployer(DeploymentInfo deploymentInfo, Attribute attribute, IPreferenceStore prefs) {
+ if (attribute == null) {
+ deploymentInfo.setServerDeployer(prefs.getString(SERVER_DEPLOYER));
+ } else {
+ deploymentInfo.setServerDeployer(attribute.getValue());
+ }
}
- protected void processClassesAndResources(DeploymentInfo deploymentInfo, Element element) {
- if (element == null) return;
- ArrayList classesAndResources = new ArrayList();
- List elements = element.elements("element");
+ protected void processProcessInfoFile(DeploymentInfo deploymentInfo, Element deploymentElement, IFileEditorInput editorInput) {
+ deploymentInfo.setProcessInfoFile(editorInput.getFile());
+ }
+
+ protected void processGraphicalInfoFile(DeploymentInfo deploymentInfo, Element deploymentElement, IFileEditorInput editorInput) {
+ if (deploymentElement == null) return;
+ Attribute attribute = deploymentElement.attribute("graphicalInfoFile");
+ if (attribute == null) {
+ attribute = deploymentElement.attribute("gpdFile");
+ }
+ IFile graphicalInfoFile = null;
+ if (attribute != null && attribute.getValue() != null) {
+ IResource resource = editorInput.getFile().getWorkspace().getRoot().findMember(new Path(attribute.getValue()));
+ if (resource instanceof IFile) {
+ graphicalInfoFile = (IFile)resource;
+ }
+ }
+ deploymentInfo.setGraphicalInfoFile(graphicalInfoFile);
+ }
+
+ protected void processImageFile(DeploymentInfo deploymentInfo, Element deploymentElement, IFileEditorInput editorInput) {
+ if (deploymentElement == null) return;
+ Attribute attribute = deploymentElement.attribute("imageFile");
+ IFile imageFile = null;
+ if (attribute != null && attribute.getValue() != null) {
+ IResource resource = editorInput.getFile().getWorkspace().getRoot().findMember(new Path(attribute.getValue()));
+ if (resource instanceof IFile) {
+ imageFile = (IFile)resource;
+ }
+ }
+ deploymentInfo.setImageFile(imageFile);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void processClassesAndResources(DeploymentInfo deploymentInfo, Element deploymentElement, IFileEditorInput editorInput) {
+ if (deploymentElement == null) return;
+ Element classesAndResourcesElement = deploymentElement.element("classesAndResources");
+ if (classesAndResourcesElement == null) return;
+ List elements = classesAndResourcesElement.elements("element");
for (int i = 0; i < elements.size(); i++) {
- String value = ((Element)elements.get(i)).attributeValue("value");
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(value));
- if (!file.exists()) continue;
- IJavaElement javaElement = JavaCore.create(file);
- if (javaElement != null) {
- classesAndResources.add(javaElement);
- } else {
- classesAndResources.add(file);
+ Element element = (Element)elements.get(i);
+ String type = element.attributeValue("type");
+ String value = element.attributeValue("value");
+ if ("java".equals(type)) {
+ IResource resource = editorInput.getFile().getWorkspace().getRoot().findMember(new Path(value));
+ if (resource instanceof IFile) {
+ IJavaElement javaElement = JavaCore.create((IFile)resource);
+ if (javaElement instanceof ICompilationUnit) {
+ deploymentInfo.addToClassesAndResources(javaElement);
+ }
+ }
+ } else if ("class".equals(type)) {
+ IJavaElement javaElement = JavaCore.create(value);
+ if (javaElement instanceof IClassFile) {
+ deploymentInfo.addToClassesAndResources(javaElement);
+ }
+ } else if ("file".equals(type)) {
+ IResource resource = editorInput.getFile().getWorkspace().getRoot().findMember(new Path(value));
+ if (resource instanceof IFile) {
+ deploymentInfo.addToClassesAndResources(resource);
+ }
}
}
- deploymentInfo.setClassesAndResources(classesAndResources.toArray());
}
- protected void processFilesAndFolders(DeploymentInfo deploymentInfo, Element element) {
- if (element == null) return;
- ArrayList filesAndFolders = new ArrayList();
- List elements = element.elements("element");
+ @SuppressWarnings("unchecked")
+ protected void processAdditionalFiles(DeploymentInfo deploymentInfo, Element deploymentElement, IFileEditorInput editorInput) {
+ if (deploymentElement == null) return;
+ Element additionalFilesElement = deploymentElement.element("additionalFiles");
+ if (additionalFilesElement == null) {
+ additionalFilesElement = deploymentElement.element("filesAndFolders");
+ }
+ if (additionalFilesElement == null) return;
+ List elements = additionalFilesElement.elements("element");
for (int i = 0; i < elements.size(); i++) {
String value = ((Element)elements.get(i)).attributeValue("value");
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(value));
- if (!file.exists()) continue;
- filesAndFolders.add(file);
+ IResource resource = editorInput.getFile().getWorkspace().getRoot().findMember(new Path(value));
+ if (resource instanceof IFile) {
+ deploymentInfo.addToAdditionalFiles(resource);
+ }
}
- deploymentInfo.setFilesAndFolders(filesAndFolders.toArray());
}
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,86 @@
+/*
+ * 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.jbpm.gd.jpdl.editor;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.part.EditorPart;
+import org.jbpm.gd.jpdl.deployment.DeploymentForm;
+
+public class JpdlDeploymenEditorPage extends EditorPart {
+
+ JpdlEditor editor;
+ DeploymentForm deploymentInfoForm;
+
+ public JpdlDeploymenEditorPage(JpdlEditor editor) {
+ this.editor = editor;
+ }
+
+ public void createPartControl(Composite parent) {
+ FormToolkit toolkit = new FormToolkit(parent.getDisplay());
+ ScrolledForm form = toolkit.createScrolledForm(parent);
+ form.setText("Deployment");
+ setPartLayout(form);
+ createForm(toolkit, form.getBody());
+ }
+
+ private void setPartLayout(ScrolledForm form) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ form.getBody().setLayout(layout);
+ }
+
+ private void createForm(FormToolkit toolkit, Composite form) {
+ deploymentInfoForm = new DeploymentForm(toolkit, form, editor);
+ deploymentInfoForm.create();
+ deploymentInfoForm.refresh();
+ }
+
+ public void setFocus() {
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ }
+
+ public void doSaveAs() {
+ }
+
+ public boolean isDirty() {
+ return false;
+ }
+
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ setSite(site);
+ setInput(input);
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymentEditorPage.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymentEditorPage.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymentEditorPage.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -1,113 +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.jbpm.gd.jpdl.editor;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.part.EditorPart;
-import org.jbpm.gd.jpdl.deployment.DeploymentForm;
-import org.jbpm.gd.jpdl.deployment.DeploymentInfo;
-
-public class JpdlDeploymentEditorPage extends EditorPart {
-
- JpdlEditor editor;
- DeploymentForm deploymentForm;
-
- public JpdlDeploymentEditorPage(JpdlEditor editor) {
- this.editor = editor;
- }
-
- public void createPartControl(Composite parent) {
- FormToolkit toolkit = new FormToolkit(parent.getDisplay());
- ScrolledForm form = toolkit.createScrolledForm(parent);
- form.setText("Deployment");
- setPartLayout(form);
- createForm(toolkit, form.getBody());
- }
-
- private void setPartLayout(ScrolledForm form) {
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- form.getBody().setLayout(layout);
- }
-
- private void createForm(FormToolkit toolkit, Composite form) {
- IFolder folder = getProcessFolder();
- deploymentForm = new DeploymentForm(toolkit, form, folder, editor);
- deploymentForm.create();
-// folder.getWorkspace().addResourceChangeListener(new IResourceChangeListener() {
-// public void resourceChanged(IResourceChangeEvent event) {
-// deploymentForm.refresh();
-// }
-// });
- }
-
- private IFolder getProcessFolder() {
- IFile file = ((IFileEditorInput)editor.getEditorInput()).getFile();
- if (file.getParent() instanceof IFolder) {
- return (IFolder)file.getParent();
- }
- return null;
- }
-
- public void setFocus() {
- }
-
- public void doSave(IProgressMonitor monitor) {
- }
-
- public DeploymentInfo getDeploymentInfo() {
- return deploymentForm.getDeploymentInfo();
- }
-
- public void setDeploymentInfo(DeploymentInfo deploymentInfo) {
- deploymentForm.setDeploymentInfo(deploymentInfo);
- }
-
- public void doSaveAs() {
- }
-
- public boolean isDirty() {
- return false;
- }
-
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- setSite(site);
- setInput(input);
- }
-
-}
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlEditor.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlEditor.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlEditor.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -21,20 +21,9 @@
*/
package org.jbpm.gd.jpdl.editor;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.FileEditorInput;
import org.jbpm.gd.common.editor.ContentProvider;
@@ -50,58 +39,28 @@
public class JpdlEditor extends Editor {
- private IResourceChangeListener resourceChangeListener;
- private JpdlDeploymentEditorPage deploymentEditorPage;
+ private JpdlDeploymenEditorPage deploymentInfoEditorPage;
+ private DeploymentInfo deploymentInfo;
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
super.init(site, input);
- initResourceChangeListener();
initPartName();
}
- private void initResourceChangeListener() {
- resourceChangeListener = new IResourceChangeListener() {
- public void resourceChanged(IResourceChangeEvent event) {
- handleResourceChange(event);
- }
- };
- getWorkspace().addResourceChangeListener(resourceChangeListener);
- }
-
-
- private void handleResourceChange(IResourceChangeEvent event) {
- if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
- IFile file = ((IFileEditorInput)getEditorInput()).getFile();
- if (!file.exists()) {
- deleteProcessFolder(file);
- }
- }
- }
-
- private void deleteProcessFolder(IFile file) {
- final IContainer processFolder = getWorkspace().getRoot().getFolder(file.getFullPath().removeLastSegments(1));
- if (processFolder != null && processFolder.exists()) {
- WorkspaceJob job = new WorkspaceJob("delete") {
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- processFolder.delete(true, null);
- return Status.OK_STATUS;
- }
- };
- job.setRule(getWorkspace().getRuleFactory().deleteRule(processFolder));
- job.schedule();
- }
- }
-
- private IWorkspace getWorkspace() {
- return ((IFileEditorInput)getEditorInput()).getFile().getWorkspace();
- }
-
private void initPartName() {
FileEditorInput fileInput = (FileEditorInput) getEditorInput();
- IPath path = fileInput.getPath().removeLastSegments(1);
- path = path.removeFirstSegments(path.segmentCount() - 1);
- setPartName(path.lastSegment());
+ String fileName = fileInput.getFile().getName();
+ String processName = fileName;
+ if ("processdefinition.xml".equals(fileName)) {
+ IPath path = fileInput.getPath().removeLastSegments(1);
+ path = path.removeFirstSegments(path.segmentCount() - 1);
+ processName = path.lastSegment();
+ } else if (fileName.endsWith(".jpdl.xml")){
+ int index = fileName.indexOf(".jpdl.xml");
+ processName = fileName.substring(0, index);
+ }
+ setPartName(processName);
}
protected SelectionSynchronizer createSelectionSynchronizer() {
@@ -130,15 +89,13 @@
protected void createPages() {
super.createPages();
- initDeploymentPage();
+ initDeploymentInfoPage();
}
- protected void initDeploymentPage() {
- deploymentEditorPage = new JpdlDeploymentEditorPage(this);
- addPage(1, deploymentEditorPage, "Deployment");
- DeploymentInfo deploymentInfo = getDeploymentInfo();
- ((JpdlContentProvider)getContentProvider()).addDeploymentInfo(deploymentInfo, getEditorInput());
- deploymentEditorPage.setDeploymentInfo(deploymentInfo);
+ protected void initDeploymentInfoPage() {
+ ((JpdlContentProvider)getContentProvider()).initializeDeploymentInfo(getDeploymentInfo(), getEditorInput());
+ deploymentInfoEditorPage = new JpdlDeploymenEditorPage(this);
+ addPage(1, deploymentInfoEditorPage, "DeploymentInfo");
}
protected SemanticElement createMainElement() {
@@ -150,12 +107,15 @@
}
public DeploymentInfo getDeploymentInfo() {
- return deploymentEditorPage.getDeploymentInfo();
+ if (deploymentInfo == null) {
+ deploymentInfo = new DeploymentInfo();
+ }
+ return deploymentInfo;
}
-
- public void dispose() {
- getWorkspace().removeResourceChangeListener(resourceChangeListener);
- super.dispose();
+
+ @SuppressWarnings("restriction")
+ public boolean isSaveOnCloseNeeded() {
+ return isDirty() || super.isSaveOnCloseNeeded();
}
}
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -30,7 +30,7 @@
public class Jbpm3PreferencesManager extends PreferencesManager {
public static final Jbpm3PreferencesManager INSTANCE = new Jbpm3PreferencesManager();
-
+
protected Jbpm3PreferencesManager() {
super();
initialize();
@@ -52,6 +52,7 @@
installationsFile.delete();
}
+ @SuppressWarnings("deprecation")
private void initializePreferredJbpmName() {
String preferredJbpmName = Plugin.getDefault().getPluginPreferences().getString(Constants.JBPM_NAME);
if (preferredJbpmName != null) {
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -0,0 +1,12 @@
+package org.jbpm.gd.jpdl.prefs;
+
+public interface PreferencesConstants {
+
+ public final String SERVER_NAME = "server name";
+ public final String SERVER_PORT = "server port";
+ public final String SERVER_DEPLOYER = "server deployer";
+ public final String USE_CREDENTIALS = "use credentials";
+ public final String USER_NAME = "user name";
+ public final String PASSWORD = "password";
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -35,10 +35,9 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.jbpm.gd.jpdl.Constants;
import org.jbpm.gd.jpdl.Plugin;
-public class ServerDeploymentPage extends PreferencePage implements IWorkbenchPreferencePage, Constants {
+public class ServerDeploymentPage extends PreferencePage implements IWorkbenchPreferencePage, PreferencesConstants {
private Text nameText, portText, deployerText, usernameText, passwordText;
private Button useCredentialsCheckbox;
@@ -142,12 +141,12 @@
}
public boolean performOk() {
- getPreferenceStore().setValue("server name", nameText.getText());
- getPreferenceStore().setValue("server port", portText.getText());
- getPreferenceStore().setValue("server deployer", deployerText.getText());
- getPreferenceStore().setValue("use credentials", useCredentialsCheckbox.getSelection());
- getPreferenceStore().setValue("user name", useCredentialsCheckbox.getSelection() ? usernameText.getText() : "");
- getPreferenceStore().setValue("password", useCredentialsCheckbox.getSelection() ? passwordText.getText() : "");
+ getPreferenceStore().setValue(SERVER_NAME, nameText.getText());
+ getPreferenceStore().setValue(SERVER_PORT, portText.getText());
+ getPreferenceStore().setValue(SERVER_DEPLOYER, deployerText.getText());
+ getPreferenceStore().setValue(USE_CREDENTIALS, useCredentialsCheckbox.getSelection());
+ getPreferenceStore().setValue(USER_NAME, useCredentialsCheckbox.getSelection() ? usernameText.getText() : "");
+ getPreferenceStore().setValue(PASSWORD, useCredentialsCheckbox.getSelection() ? passwordText.getText() : "");
return true;
}
@@ -158,12 +157,12 @@
useCredentialsCheckbox.setSelection(false);
usernameText.setText(null);
passwordText.setText(null);
- getPreferenceStore().setValue("server name", "localhost");
- getPreferenceStore().setValue("server port", "8080");
- getPreferenceStore().setValue("server deployer", "/jbpm-console/upload");
- getPreferenceStore().setValue("use credentials", false);
- getPreferenceStore().setValue("user name", "");
- getPreferenceStore().setValue("password", "");
+ getPreferenceStore().setValue(SERVER_NAME, "localhost");
+ getPreferenceStore().setValue(SERVER_PORT, "8080");
+ getPreferenceStore().setValue(SERVER_DEPLOYER, "/jbpm-console/upload");
+ getPreferenceStore().setValue(USE_CREDENTIALS, false);
+ getPreferenceStore().setValue(USER_NAME, "");
+ getPreferenceStore().setValue(PASSWORD, "");
}
}
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -44,6 +44,7 @@
Shell shell;
IFolder processFolder;
+ IFile processFile;
String serverName;
String serverPort;
String serverDeployer;
@@ -62,6 +63,10 @@
this.processFolder = processFolder;
}
+ public void setProcessFile(IFile file) {
+ this.processFile = file;
+ }
+
public void setServerName(String serverName) {
this.serverName = serverName;
}
@@ -362,11 +367,15 @@
}
private URL[] getProjectClasspathUrls() throws CoreException, MalformedURLException {
+ URL[] urls = new URL[0];
IProject project = processFolder.getProject();
IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject == null) {
+ return urls;
+ }
String[] pathArray = JavaRuntime
.computeDefaultRuntimeClassPath(javaProject);
- URL[] urls = new URL[pathArray.length];
+ urls = new URL[pathArray.length];
for (int i = 0; i < pathArray.length; i++) {
urls[i] = new File(pathArray[i]).toURI().toURL();
}
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -32,13 +32,11 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Text;
public class ConfigureRuntimePage extends WizardPage {
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -74,10 +74,9 @@
public boolean performFinish() {
try {
IFolder folder = page.getProcessFolder();
- folder.create(true, true, null);
- IFile processDefinitionFile = folder.getFile("processdefinition.xml");
+ IFile processDefinitionFile = folder.getFile(page.getProcessName() + ".jpdl.xml");
processDefinitionFile.create(createInitialProcessDefinition(), true, null);
- IFile gpdFile = folder.getFile("gpd.xml");
+ IFile gpdFile = folder.getFile("." + page.getProcessName() + ".gpd.xml");
gpdFile.create(createInitialGpdInfo(), true, null);
IDE.openEditor(getActivePage(), processDefinitionFile);
openPropertiesView();
@@ -108,13 +107,11 @@
}
private ByteArrayInputStream createInitialProcessDefinition() throws JavaModelException {
- String parName = page.getProcessFolder().getName();
- String processName = parName; //.substring(0, parName.indexOf(".par"));
StringBuffer buffer = new StringBuffer();
buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
buffer.append("\n");
buffer.append("\n");
- buffer.append("<process-definition" + getSchemaText() + " name=\"" + processName + "\"></process-definition>");
+ buffer.append("<process-definition" + getSchemaText() + " name=\"" + page.getProcessName() + "\"></process-definition>");
return new ByteArrayInputStream(buffer.toString().getBytes());
}
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizardPage.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizardPage.java 2010-06-23 15:46:42 UTC (rev 22959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizardPage.java 2010-06-23 16:42:50 UTC (rev 22960)
@@ -24,13 +24,12 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -55,11 +54,11 @@
public class NewProcessDefinitionWizardPage extends WizardPage {
private Text containerText;
- private Text processText;
+ private Text processNameText;
private Button browseButton;
-
+
private IWorkspaceRoot workspaceRoot;
- private String containerName;
+ private String containerName;
public NewProcessDefinitionWizardPage() {
super("Process Definition");
@@ -77,6 +76,12 @@
} else if (IContainer.class.isInstance(object)) {
container = (IContainer)object;
}
+ } else {
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IProject[] projects = workspaceRoot.getProjects();
+ if (projects != null && projects.length != 0) {
+ container = projects[0];
+ }
}
initContainerName(container);
}
@@ -84,23 +89,13 @@
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = createClientArea(parent);
-// createLabel(composite);
+ createProcessNameField(composite);
createContainerField(composite);
- createProcessField(composite);
setControl(composite);
Dialog.applyDialogFont(composite);
- setPageComplete(false);
+ checkPage();
}
-// private void createLabel(Composite composite) {
-// Label label= new Label(composite, SWT.WRAP);
-// label.setText("Choose a source folder and a process definition name.");
-// GridData gd= new GridData();
-// gd.widthHint= convertWidthInCharsToPixels(80);
-// gd.horizontalSpan= 3;
-// label.setLayoutData(gd);
-// }
-
private Composite createClientArea(Composite parent) {
Composite composite= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout();
@@ -113,12 +108,12 @@
private void createContainerField(Composite parent) {
Label label = new Label(parent, SWT.NONE);
- label.setText("Source folder : ");
+ label.setText("Source Folder: ");
containerText = new Text(parent, SWT.BORDER);
containerText.setText(containerName);
containerText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- verifyContentsValid();
+ checkPage();
}
});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -132,22 +127,41 @@
});
gd = new GridData();
gd.widthHint = convertWidthInCharsToPixels(15);
+ gd.heightHint = 18;
browseButton.setLayoutData(gd);
}
- private void createProcessField(Composite parent) {
+ private void createProcessNameField(Composite parent) {
Label label = new Label(parent, SWT.NONE);
- label.setText("Process name : ");
- processText = new Text(parent, SWT.BORDER);
- processText.addModifyListener(new ModifyListener() {
+ label.setText("Process Name: ");
+ processNameText = new Text(parent, SWT.BORDER);
+ processNameText.setText(findInitialProcessName());
+ processNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- verifyContentsValid();
+ checkPage();
}
});
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- processText.setLayoutData(gd);
+ processNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ new Label(parent, SWT.NONE);
}
+ private String findInitialProcessName() {
+ String baseName = "process";
+ String result = baseName;
+ if (processExists(result)) {
+ int runner = 1;
+ do {
+ result = baseName + "-" + runner;
+ } while (processExists(result));
+ }
+ return result;
+ }
+
+ private boolean processExists(String name) {
+ IResource resource = workspaceRoot.findMember(new Path(containerName).append(name + ".jpdl.xml"));
+ return resource != null && resource.exists();
+ }
+
private void chooseContainer() {
WorkbenchContentProvider provider= new WorkbenchContentProvider();
ILabelProvider labelProvider= new WorkbenchLabelProvider();
@@ -164,16 +178,7 @@
private ViewerFilter createViewerFilter() {
ViewerFilter filter= new ViewerFilter() {
public boolean select(Viewer viewer, Object parent, Object element) {
- if (!(element instanceof IContainer)) {
- return false;
- }
- boolean isJavaProjectMember = false;
- try {
- isJavaProjectMember = ((IContainer)element).getProject().hasNature(JavaCore.NATURE_ID);
- } catch (CoreException ce) {
- // Ignore
- }
- return isJavaProjectMember;
+ return element instanceof IContainer;
}
};
return filter;
@@ -184,54 +189,51 @@
containerName = (elem == null) ? "" : elem.getFullPath().makeRelative().toString();
}
- private void verifyContentsValid() {
- if (!checkContainerPathValid()) {
- setErrorMessage("Source folder is not valid.");
+ private void checkPage() {
+ if (!checkProcessNameText()) return;
+ if (!checkContainerText()) return;
+ }
+
+ private boolean checkContainerText() {
+ if ("".equals(containerText.getText())) {
+ setMessage("Select the source folder or enter its name.");
setPageComplete(false);
- } else if (isProcessNameEmpty()) {
- setErrorMessage("Enter a name for the process.");
- setPageComplete(false);
- } else if (processExists()){
- setErrorMessage("A process with this name already exists.");
- setPageComplete(false);
+ return false;
+ } else if (!containerExists()) {
+ setMessage("The source folder does not exist and will be created.");
+ setPageComplete(true);
+ return true;
} else {
- setErrorMessage(null);
+ setMessage(null);
setPageComplete(true);
+ return true;
}
}
- private boolean processExists() {
- IPath path = new Path(containerText.getText()).append(getProcessName());
- return workspaceRoot.getFolder(path).exists();
+ private boolean containerExists() {
+ IPath path = new Path(containerText.getText());
+ IResource resource = workspaceRoot.findMember(path);
+ return resource != null && resource.exists();
}
- private boolean isProcessNameEmpty() {
- String str = processText.getText();
- return str == null || "".equals(str);
- }
-
- private boolean checkContainerPathValid() {
- if ("".equals(containerText.getText())) {
+ private boolean checkProcessNameText() {
+ if ("".equals(processNameText.getText())) {
+ setMessage("Enter a name for the process.");
+ setPageComplete(false);
return false;
+ } else {
+ setMessage(null);
+ setPageComplete(true);
+ return true;
}
- IPath path = new Path(containerText.getText());
- IResource resource = workspaceRoot.findMember(path);
- boolean isJavaProject = false;
- try {
- isJavaProject = resource.getProject().hasNature(JavaCore.NATURE_ID);
- } catch (CoreException ce) {
- // Ignore
- }
- return resource.exists() && isJavaProject;
}
- private String getProcessName() {
- return processText.getText(); // + ".par";
+ public IFolder getProcessFolder() {
+ return workspaceRoot.getFolder(new Path(containerText.getText()));
}
- public IFolder getProcessFolder() {
- IPath path = new Path(containerText.getText()).append(getProcessName());
- return workspaceRoot.getFolder(path);
+ public String getProcessName() {
+ return processNameText.getText();
}
}
15 years, 10 months
JBoss Tools SVN: r22959 - trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-06-23 11:46:42 -0400 (Wed, 23 Jun 2010)
New Revision: 22959
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
Log:
https://jira.jboss.org/browse/JBIDE-6519
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2010-06-23 15:44:45 UTC (rev 22958)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2010-06-23 15:46:42 UTC (rev 22959)
@@ -34,12 +34,12 @@
TestSuite suite = new TestSuite();
suite.setName("All tests for " + PLUGIN_ID);
-// suite.addTest(new ProjectImportTestSetup(new TestSuite(ScannerTest.class),"org.jboss.tools.seam.core.test","projects/TestScanner","TestScanner"));
-// suite.addTestSuite(SerializationTest.class);
-// suite.addTestSuite(SeamBigProjectTest.class);
-// suite.addTestSuite(SeamEARTest.class);
-// suite.addTestSuite(SeamRuntimeListConverterTest.class);
-// suite.addTestSuite(SeamRuntimeManagerTest.class);
+ suite.addTest(new ProjectImportTestSetup(new TestSuite(ScannerTest.class),"org.jboss.tools.seam.core.test","projects/TestScanner","TestScanner"));
+ suite.addTestSuite(SerializationTest.class);
+ suite.addTestSuite(SeamBigProjectTest.class);
+ suite.addTestSuite(SeamEARTest.class);
+ suite.addTestSuite(SeamRuntimeListConverterTest.class);
+ suite.addTestSuite(SeamRuntimeManagerTest.class);
suite.addTestSuite(CyclicDependingProjectsTest.class);
return suite;
}
15 years, 10 months
JBoss Tools SVN: r22958 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-06-23 11:44:45 -0400 (Wed, 23 Jun 2010)
New Revision: 22958
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotated.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointParameter.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added new validation rules:
1. Decorator has more than one delegate injection point
2. Decorator does not have a delegate injection point
3. Injection point that is not an injected field, initializer method parameter or bean constructor method parameter is annotated @Delegate
4. Bean class that is not a decorator has an injection point annotated @Delegate
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.cdi.core;
public interface CDIConstants {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotated.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotated.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotated.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -13,6 +13,7 @@
import java.util.List;
import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
+import org.jboss.tools.common.text.ITextSourceReference;
/**
* Represents a CDI element that can be annotated.
@@ -40,6 +41,18 @@
IAnnotationDeclaration getAnnotation(String annotationTypeName);
/**
+ * This method is similar to getAnnotation(String annotationTypeName). But
+ * JDT doesn't have API for getting IAnnotation from method parameters so
+ * this method is preferable for method parameters.
+ *
+ * @param annotationTypeName
+ * the name of the annotation type
+ * @return the text source reference of the annotation of the given annotation type, or a null
+ * value
+ */
+ ITextSourceReference getAnnotationPosition(String annotationTypeName);
+
+ /**
* Determine if the element has an annotation of a certain annotation type.
*
* @param annotationTypeName
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -24,7 +24,7 @@
public interface IAnnotationDeclaration extends ITextSourceReference {
/**
- * Return the annotation declaration.
+ * Return the annotation declaration. May be null.
*
* @return the annotation declaration.
*/
@@ -38,7 +38,7 @@
IMember getParentMember();
/**
- * Returns the corresponding IType of the annotation.
+ * Returns the corresponding IType of the annotation. May be null.
*
* @return the corresponding IType of the annotation
*/
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -12,6 +12,8 @@
import java.util.Set;
+import org.jboss.tools.common.text.ITextSourceReference;
+
/**
* Represents an injection point.
*
@@ -57,7 +59,7 @@
* @return the @Delegate annotation of this injection point field or
* parameter of injection point method. May be null.
*/
- IAnnotationDeclaration getDelegateAnnotation();
+ ITextSourceReference getDelegateAnnotation();
/**
* Returns the @Inject annotation declaration
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -42,6 +42,7 @@
import org.jboss.tools.cdi.internal.core.impl.definition.AbstractMemberDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.AbstractTypeDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
+import org.jboss.tools.common.text.ITextSourceReference;
/**
*
@@ -75,6 +76,14 @@
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotationPosition(java.lang.String)
+ */
+ public ITextSourceReference getAnnotationPosition(String annotationTypeName) {
+ return getAnnotation(annotationTypeName);
+ }
+
public boolean isAnnotationPresent(String annotationTypeName) {
return definition!=null && definition.isAnnotationPresent(annotationTypeName);
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointParameter.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointParameter.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointParameter.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -19,6 +19,7 @@
import org.jboss.tools.cdi.core.IInjectionPointParameter;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
+import org.jboss.tools.common.text.ITextSourceReference;
/**
*
@@ -28,10 +29,18 @@
public class InjectionPointParameter extends Parameter implements
IInjectionPointParameter {
- public IAnnotationDeclaration getDelegateAnnotation() {
- return null;
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IInjectionPoint#getDelegateAnnotation()
+ */
+ public ITextSourceReference getDelegateAnnotation() {
+ return getAnnotationPosition(CDIConstants.DELEGATE_STEREOTYPE_TYPE_NAME);
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IInjectionPoint#getQualifierDeclarations()
+ */
public Set<IQualifierDeclaration> getQualifierDeclarations() {
Set<IQualifierDeclaration> result = new HashSet<IQualifierDeclaration>();
//cannot implement
@@ -48,6 +57,10 @@
return result;
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IInjectionPoint#isDelegate()
+ */
public boolean isDelegate() {
return isAnnotationPresent(CDIConstants.DELEGATE_STEREOTYPE_TYPE_NAME);
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -28,6 +28,7 @@
import org.jboss.tools.cdi.internal.core.impl.QualifierDeclaration;
import org.jboss.tools.cdi.internal.core.impl.ScopeDeclaration;
import org.jboss.tools.cdi.internal.core.impl.StereotypeDeclaration;
+import org.jboss.tools.common.text.ITextSourceReference;
/**
*
@@ -101,6 +102,14 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotationPosition(java.lang.String)
+ */
+ public ITextSourceReference getAnnotationPosition(String annotationTypeName) {
+ return getAnnotation(annotationTypeName);
+ }
+
+ /*
+ * (non-Javadoc)
* @see org.jboss.tools.cdi.core.IAnnotated#isAnnotationPresent(java.lang.String)
*/
public boolean isAnnotationPresent(String annotationTypeName) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -1,10 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.cdi.internal.core.impl.definition;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IAnnotated;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
@@ -35,18 +48,46 @@
return methodDefinition;
}
+ /**
+ * JDT doesn't have API for annotations for method params. So this method will return a wrapper for ITextSourceReference.
+ * Use getAnnotationPosition() instead.
+ *
+ * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotation(java.lang.String)
+ */
public IAnnotationDeclaration getAnnotation(String annotationTypeName) {
- return null;
+ ITextSourceReference reference = getAnnotationPosition(annotationTypeName);
+ if(reference==null) {
+ return null;
+ }
+ // JDT doesn't have API for annotations for method params. So let's wrap ITextSourceReference into IAnnotationDeclaration.
+ AnnotationDeclaration ad = new AnnotationDeclaration();
+ ad.setDeclaration(null, methodDefinition.getMethod().getDeclaringType());
+ CDICoreNature nature = CDICorePlugin.getCDI(methodDefinition.getResource().getProject(), false);
+ ad.setProject(nature);
+ return ad;
}
+ /**
+ * Returns an empty list because JDT doesn't have API for annotations for method params. Use getAnnotationTypes() instead.
+ *
+ * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotations()
+ */
public List<AnnotationDeclaration> getAnnotations() {
- return null;
+ return Collections.emptyList();
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IAnnotated#isAnnotationPresent(java.lang.String)
+ */
public boolean isAnnotationPresent(String annotationTypeName) {
return annotationsByTypeName.containsKey(annotationTypeName);
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotationPosition(java.lang.String)
+ */
public ITextSourceReference getAnnotationPosition(String annotationTypeName) {
return annotationsByTypeName.get(annotationTypeName);
}
@@ -69,4 +110,4 @@
String text = methodDefinition.getTypeDefinition().getContent().substring(pos.getStartPosition(), pos.getStartPosition() + pos.getLength());
return text;
}
-}
+}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -48,6 +48,7 @@
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IDecorator;
import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IInjectionPointMethod;
import org.jboss.tools.cdi.core.IInjectionPointParameter;
import org.jboss.tools.cdi.core.IInterceptor;
@@ -1004,6 +1005,14 @@
}
}
}
+ /*
+ * 8.1.2. Decorator delegate injection points
+ * - bean class that is not a decorator has an injection point annotated @Delegate
+ */
+ if(!(injection.getClassBean() instanceof IDecorator) && injection.isDelegate()) {
+ ITextSourceReference reference = injection.getDelegateAnnotation();
+ addError(CDIValidationMessages.ILLEGAL_BEAN_DECLARING_DELEGATE, CDIPreferences.ILLEGAL_BEAN_DECLARING_DELEGATE, reference, injection.getResource());
+ }
}
/**
@@ -1264,6 +1273,44 @@
for (IProducer producer : producers) {
addError(CDIValidationMessages.PRODUCER_IN_DECORATOR, CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, producer.getProducesAnnotation(), decorator.getResource());
}
+
+ Set<IInjectionPoint> injections = decorator.getInjectionPoints();
+ Set<ITextSourceReference> delegates = new HashSet<ITextSourceReference>();
+ for (IInjectionPoint injection : injections) {
+ ITextSourceReference delegateAnnotation = injection.getDelegateAnnotation();
+ if(delegateAnnotation!=null) {
+ if(injection instanceof IInjectionPointField) {
+ delegates.add(delegateAnnotation);
+ }
+ if(injection instanceof IInjectionPointParameter) {
+ if(((IInjectionPointParameter) injection).getBeanMethod().getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME)==null) {
+ delegates.add(delegateAnnotation);
+ } else {
+ /*
+ * 8.1.2. Decorator delegate injection points
+ * - injection point that is not an injected field, initializer method parameter or bean constructor method parameter is annotated @Delegate
+ */
+ addError(CDIValidationMessages.ILLEGAL_INJECTION_POINT_DELEGATE, CDIPreferences.ILLEGAL_INJECTION_POINT_DELEGATE, delegateAnnotation, decorator.getResource());
+ }
+ }
+ }
+ }
+ if(delegates.size()>1) {
+ /*
+ * 8.1.2. Decorator delegate injection points
+ * - decorator has more than one delegate injection point
+ */
+ for (ITextSourceReference declaration : delegates) {
+ addError(CDIValidationMessages.MULTIPLE_DELEGATE, CDIPreferences.MULTIPLE_DELEGATE, declaration, decorator.getResource());
+ }
+ } else if(delegates.isEmpty()) {
+ /*
+ * 8.1.2. Decorator delegate injection points
+ * - decorator does not have a delegate injection point
+ */
+ IAnnotationDeclaration declaration = decorator.getDecoratorAnnotation();
+ addError(CDIValidationMessages.MISSING_DELEGATE, CDIPreferences.MISSING_DELEGATE, declaration, decorator.getResource());
+ }
}
/*
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-06-23 15:44:45 UTC (rev 22958)
@@ -147,10 +147,6 @@
- Java EE component class supporting injection that is not a bean has an injection
point of type InjectionPoint and qualifier @Default (JBT: let's ignore this rule so far since we don't have any good tool to recognize such components)
-
-
-
-
8.1.2. Decorator delegate injection points
- decorator has more than one delegate injection point, or
does not have a delegate injection point
@@ -158,6 +154,11 @@
or bean constructor method parameter is annotated @Delegate
- bean class that is not a decorator has an injection point annotated @Delegate
+
+
+
+
+
8.1.3. Decorated types of a decorator
- delegate type does not implement or extend a decorated type of the decorator,
or specifies different type parameters
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-06-23 15:44:45 UTC (rev 22958)
@@ -64,10 +64,10 @@
PRODUCER_IN_DECORATOR=Producer cannot be declared in a decorator
DISPOSER_IN_INTERCEPTOR=Interceptor has a method annotated @Disposes
DISPOSER_IN_DECORATOR=Decorator has a method annotated @Disposes
-MULTIPLE_DELEGATE=Decorator has more than one delegate injection point
-MISSING_DELEGATE=Decorator does not have a delegate injection point
-ILLEGAL_INJECTION_POINT_DELEGATE=Injection point that is not an injected field, initializer method parameter or bean constructor method parameter is annotated @Delegate
-ILLEGAL_BEAN_DECLARING_DELEGATE=Bean class that is not a decorator has an injection point annotated @Delegate
+MULTIPLE_DELEGATE=Decorator cannot have more than one delegate injection point [JSR-299 �8.1.2]
+MISSING_DELEGATE=Decorator must have a delegate injection point [JSR-299 �8.1.2]
+ILLEGAL_INJECTION_POINT_DELEGATE=Injection point that is a producer method parameter cannot be annotated @Delegate [JSR-299 �8.1.2]
+ILLEGAL_BEAN_DECLARING_DELEGATE=Bean class that is not a decorator cannot have an injection point annotated @Delegate [JSR-299 �8.1.2]
DELEGATE_HAS_ILLEGAL_TYPE=Delegate type does not implement or extend a decorated type of the decorator, or specifies different type parameters
ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING=Interceptor for lifecycle callbacks declares an interceptor binding type that is defined @Target({TYPE, METHOD})
ILLEGAL_INTERCEPTOR_BINDING_METHOD=Non-static, non-private, final method of a managed bean has a interceptor binding (either method level, or declaring class level)
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -107,10 +107,10 @@
{CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_sessionBeanAnnotatedInterceptorOrDecorator_label},
{CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerInInterceptorOrDecorator_label},
{CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerInInterceptorOrDecorator_label},
-// {CDIPreferences.MULTIPLE_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDelegate_label},
-// {CDIPreferences.MISSING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingDelegate_label},
-// {CDIPreferences.ILLEGAL_INJECTION_POINT_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInjectionPointDelegate_label},
-// {CDIPreferences.ILLEGAL_BEAN_DECLARING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalBeanDeclaringDelegate_label},
+ {CDIPreferences.MULTIPLE_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDelegate_label},
+ {CDIPreferences.MISSING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingDelegate_label},
+ {CDIPreferences.ILLEGAL_INJECTION_POINT_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInjectionPointDelegate_label},
+ {CDIPreferences.ILLEGAL_BEAN_DECLARING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalBeanDeclaringDelegate_label},
// {CDIPreferences.DELEGATE_HAS_ILLEGAL_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_delegateHasIllegalType_label},
// {CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalLifecycleCallbackInterceptorBinding_label},
// {CDIPreferences.ILLEGAL_INTERCEPTOR_BINDING_METHOD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInterceptorBindingMethod_label},
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-06-23 15:27:12 UTC (rev 22957)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-06-23 15:44:45 UTC (rev 22958)
@@ -14,6 +14,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
@@ -32,7 +33,7 @@
*/
public void testLegalTypesInTyped() throws Exception {
IFile petShopFile = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(petShopFile, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION, 25);
+ assertMarkerIsCreated(petShopFile, CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION, 25);
int markerNumbers = getMarkersNumber(petShopFile);
assertEquals("PetShop.java should has the only error marker.", markerNumbers, 1);
}
@@ -45,7 +46,7 @@
*/
public void testInterceptorWithWrongScope() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/InterceptorWithWrongScopeBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_INTERCEPTOR, 8);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_INTERCEPTOR, 8);
}
/**
@@ -56,7 +57,7 @@
*/
public void testDecoratorWithWrongScope() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/decorators/DecoratorWithWrongScopeBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_DECORATOR, 7);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_DECORATOR, 7);
}
/**
@@ -67,7 +68,7 @@
*/
public void testMultipleBeanScope() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/scope/broken/tooManyScopes/BeanWithTooManyScopeTypes_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MULTIPLE_SCOPE_TYPE_ANNOTATIONS, 22, 23);
+ assertMarkerIsCreated(file, CDIValidationMessages.MULTIPLE_SCOPE_TYPE_ANNOTATIONS, 22, 23);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithTyped_Broken.java should has two error markers.", markerNumbers, 2);
}
@@ -81,7 +82,7 @@
*/
public void testBeanWithMultipleScopedStereotypes() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/scopeConflict/Scallop_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, 24, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, 24, 25);
int markerNumbers = getMarkersNumber(file);
assertEquals("Scallop_Broken.java should has two error markers.", markerNumbers, 2);
}
@@ -94,9 +95,9 @@
*/
public void testNamedInterceptor() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/NamedInterceptorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INTERCEPTOR_HAS_NAME, 9);
+ assertMarkerIsCreated(file, CDIValidationMessages.INTERCEPTOR_HAS_NAME, 9);
file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/NamedStereotypedInterceptorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INTERCEPTOR_HAS_NAME, 7);
+ assertMarkerIsCreated(file, CDIValidationMessages.INTERCEPTOR_HAS_NAME, 7);
}
/**
@@ -107,9 +108,9 @@
*/
public void testNamedDecorator() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/decorators/NamedDecoratorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DECORATOR_HAS_NAME, 10);
+ assertMarkerIsCreated(file, CDIValidationMessages.DECORATOR_HAS_NAME, 10);
file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/decorators/NamedStereotypedDecoratorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DECORATOR_HAS_NAME, 8);
+ assertMarkerIsCreated(file, CDIValidationMessages.DECORATOR_HAS_NAME, 8);
}
/**
@@ -120,7 +121,7 @@
*/
public void testAlternativeInterceptor() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INTERCEPTOR_IS_ALTERNATIVE, 7);
+ assertMarkerIsCreated(file, CDIValidationMessages.INTERCEPTOR_IS_ALTERNATIVE, 7);
}
/**
@@ -131,7 +132,7 @@
*/
public void testAlternativeDecorator() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/decorators/AlternativeDecoratorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DECORATOR_IS_ALTERNATIVE, 7);
+ assertMarkerIsCreated(file, CDIValidationMessages.DECORATOR_IS_ALTERNATIVE, 7);
}
/**
@@ -142,7 +143,7 @@
*/
public void testStereotypeScope() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/tooManyScopes/StereotypeWithTooManyScopeTypes_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, 32, 33);
+ assertMarkerIsCreated(file, CDIValidationMessages.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, 32, 33);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithTooManyScopeTypes_Broken.java should has two error markers.", markerNumbers, 2);
}
@@ -155,7 +156,7 @@
*/
public void testNonEmptyNamedForStereotype() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/nonEmptyNamed/StereotypeWithNonEmptyNamed_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.STEREOTYPE_DECLARES_NON_EMPTY_NAME, 31);
+ assertMarkerIsCreated(file, CDIValidationMessages.STEREOTYPE_DECLARES_NON_EMPTY_NAME, 31);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithNonEmptyNamed_Broken.java should has the only error marker.", markerNumbers, 1);
}
@@ -168,7 +169,7 @@
*/
public void testAnnotatedStereotype() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/withBindingType/StereotypeWithBindingTypes_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_QUALIFIER_IN_STEREOTYPE, 30);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_QUALIFIER_IN_STEREOTYPE, 30);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithBindingTypes_Broken.java should has the only error marker.", markerNumbers, 1);
}
@@ -181,7 +182,7 @@
*/
public void testTypedStereotype() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/withBindingType/StereotypeWithTyped_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.STEREOTYPE_IS_ANNOTATED_TYPED, 15);
+ assertMarkerIsCreated(file, CDIValidationMessages.STEREOTYPE_IS_ANNOTATED_TYPED, 15);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithTyped_Broken.java should has the only error marker.", markerNumbers, 1);
}
@@ -194,7 +195,7 @@
*/
public void testInterceptorCanNotAlsoBeDecorator() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorCanNotBeDecorator/InterceptingDecorator.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.BOTH_INTERCEPTOR_AND_DECORATOR, 24, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.BOTH_INTERCEPTOR_AND_DECORATOR, 24, 25);
}
/**
@@ -205,7 +206,7 @@
*/
public void testNonDependentScopedBeanCanNotHavePublicField() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/simple/definition/dependentWithPublicField/Leopard_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD, 21);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD, 21);
}
/**
@@ -216,7 +217,7 @@
*/
public void testNonDependentGenericManagedBeanNotOk() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/bean/genericbroken/FooBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE, 21);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE, 21);
}
/**
@@ -228,7 +229,7 @@
*/
public void testSpecializingClassExtendsNonSimpleBean() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/noextend3/Cow_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
}
/**
@@ -240,7 +241,7 @@
*/
public void testSpecializingClassDirectlyExtendsNothing() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/noextend2/Cow_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
}
/**
@@ -252,7 +253,7 @@
*/
public void testSpecializingClassDirectlyExtendsEnterpriseBean() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/extendejb/Tractor_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
}
/**
@@ -264,7 +265,7 @@
*/
public void testSpecializingClassImplementsInterfaceAndExtendsNothing() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/noextend1/Donkey_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
}
/**
@@ -276,7 +277,7 @@
*/
public void testStatelessWithRequestScopeFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/statelessWithRequestScope/Beagle_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
}
/**
@@ -288,7 +289,7 @@
*/
public void testStatelessWithApplicationScopeFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/statelessWithApplicationScope/Dachshund_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
}
/**
@@ -300,7 +301,7 @@
*/
public void testStatelessWithConversationScopeFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/statelessWithConversationScope/Boxer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
}
/**
@@ -312,7 +313,7 @@
*/
public void testStatelessWithSessionScopeFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/statelessWithSessionScope/Bullmastiff_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
}
@@ -325,7 +326,7 @@
*/
public void testSingletonWithConversationScopeFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/Husky_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, 24);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, 24);
}
/**
@@ -337,7 +338,7 @@
*/
public void testSingletonWithSessionScopeFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithSessionScope/IrishTerrier_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, 25);
}
/**
@@ -349,7 +350,7 @@
*/
public void testSingletonWithRequestScopeFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithRequestScope/Greyhound_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, 23);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, 23);
}
/**
@@ -360,7 +361,7 @@
*/
public void testSessionBeanAnnotatedInterceptor() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/sessionbeans/SessionBeanAnnotatedInterceptorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.SESSION_BEAN_ANNOTATED_INTERCEPTOR, 8, 9);
+ assertMarkerIsCreated(file, CDIValidationMessages.SESSION_BEAN_ANNOTATED_INTERCEPTOR, 8, 9);
}
/**
@@ -371,7 +372,7 @@
*/
public void testSessionBeanAnnotatedDecorator() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/sessionbeans/SessionBeanAnnotatedDecoratorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.SESSION_BEAN_ANNOTATED_DECORATOR, 6, 7);
+ assertMarkerIsCreated(file, CDIValidationMessages.SESSION_BEAN_ANNOTATED_DECORATOR, 6, 7);
}
/**
@@ -382,7 +383,7 @@
*/
public void testNonDependentGenericSessionBeanNotOk() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/sessionbeans/FooBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SESSION_BEAN_WITH_GENERIC_TYPE, 6);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SESSION_BEAN_WITH_GENERIC_TYPE, 6);
}
/**
@@ -393,7 +394,7 @@
*/
public void testSpecializingClassDirectlyExtendsSimpleBean() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/broken/directlyExtendsSimpleBean/Tractor_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, 22);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, 22);
}
/**
@@ -404,7 +405,7 @@
*/
public void testSpecializingEnterpriseClassImplementsInterfaceAndExtendsNothing() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/broken/implementInterfaceAndExtendsNothing/Donkey_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, 22);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, 22);
}
/**
@@ -415,7 +416,7 @@
*/
public void testSpecializingEnterpriseClassDirectlyExtendsNothing() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/broken/directlyExtendsNothing/Cow_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, 22);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, 22);
}
/**
@@ -429,7 +430,7 @@
*/
public void testParameterizedReturnTypeWithWildcard() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithWildcard/SpiderProducer.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD, 24);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD, 24);
}
/**
@@ -443,9 +444,9 @@
*/
public void testParameterizedType() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter2/TProducer.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, 25);
file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/SpiderProducerVariableType_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, 13);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, 13);
}
/**
@@ -456,10 +457,10 @@
*/
public void testParameterizedReturnTypeWithWrongScope() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/ParameterizedTypeWithWrongScope_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 25, 39);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 21);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 35);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 31);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 25, 39);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 21);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 35);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 31);
}
/**
@@ -470,7 +471,7 @@
*/
public void testInitializerMethodAnnotatedProduces() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/initializer/broken/methodAnnotatedProduces/Pheasant_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_ANNOTATED_INJECT, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_ANNOTATED_INJECT, 25);
}
/**
@@ -481,7 +482,7 @@
*/
public void testProducerMethodWithParameterAnnotatedDisposes() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterAnnotatedDisposes/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES, 25, 26);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES, 25, 26);
}
/**
@@ -492,7 +493,7 @@
*/
public void testProducerMethodWithParameterAnnotatedObserves() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterAnnotatedObserves/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES, 25, 26);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES, 25, 26);
}
/**
@@ -503,7 +504,7 @@
*/
public void testProducerMethodOnSessionBeanMustBeBusinessMethod() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/enterprise/nonbusiness/FooProducer.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, 25);
}
/**
@@ -514,7 +515,7 @@
*/
public void testDecoratorMustNotHaveProducerMethod() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/DecoratorHasProducerMethodBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_IN_DECORATOR, 10);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_IN_DECORATOR, 10);
}
/**
@@ -525,7 +526,7 @@
*/
public void testInterceptorMustNotHaveProducerMethod() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/InterceptorHasProducerMethodBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_IN_INTERCEPTOR, 17);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_IN_INTERCEPTOR, 17);
}
/**
@@ -536,7 +537,7 @@
*/
public void testSpecializedStaticMethod() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/broken/specializesStaticMethod/FurnitureShop_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_PRODUCER_STATIC, 24);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SPECIALIZING_PRODUCER_STATIC, 24);
}
/**
@@ -547,7 +548,7 @@
*/
public void testSpecializedMethodIndirectlyOverridesAnotherProducerMethod() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/broken/indirectOverride/ShoeShop_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_PRODUCER_OVERRIDE, 24);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SPECIALIZING_PRODUCER_OVERRIDE, 24);
}
/**
@@ -558,7 +559,7 @@
*/
public void testMultipleDisposeParameters() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/multiParams/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MULTIPLE_DISPOSING_PARAMETERS, 30, 30);
+ assertMarkerIsCreated(file, CDIValidationMessages.MULTIPLE_DISPOSING_PARAMETERS, 30, 30);
}
/**
@@ -569,7 +570,7 @@
*/
public void testProducesUnallowed() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/producesUnallowed/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES, 30, 31);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES, 30, 31);
}
/**
@@ -580,7 +581,7 @@
*/
public void testObserverParameterUnallowed() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/observesUnallowed/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, 32, 32);
+ assertMarkerIsCreated(file, CDIValidationMessages.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, 32, 32);
}
/**
@@ -591,7 +592,7 @@
*/
public void testInitializerUnallowed() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/initializerUnallowed/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 32, 33);
+ assertMarkerIsCreated(file, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 32, 33);
}
/**
@@ -602,9 +603,9 @@
*/
public void testDisposalMethodNotBusinessOrStatic() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/methodOnSessionBean/AppleTree.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, 31);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, 31);
file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/Fox.java");
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, 73);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, 73);
}
/**
@@ -615,7 +616,7 @@
*/
public void testDecoratorDeclaresDisposer() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/disposers/TimestampLogger.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_IN_DECORATOR, 6, 9);
+ assertMarkerIsCreated(file, CDIValidationMessages.DISPOSER_IN_DECORATOR, 6, 9);
}
/**
@@ -626,7 +627,7 @@
*/
public void testInterceptorDeclaresDisposer() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/FordInterceptor.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_IN_INTERCEPTOR, 8, 16);
+ assertMarkerIsCreated(file, CDIValidationMessages.DISPOSER_IN_INTERCEPTOR, 8, 16);
}
/**
@@ -637,8 +638,8 @@
*/
public void testUnresolvedDisposalMethod() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/unresolvedMethod/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.NO_PRODUCER_MATCHING_DISPOSER, 35);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.NO_PRODUCER_MATCHING_DISPOSER, 31);
+ assertMarkerIsCreated(file, CDIValidationMessages.NO_PRODUCER_MATCHING_DISPOSER, 35);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.NO_PRODUCER_MATCHING_DISPOSER, 31);
}
/**
@@ -649,7 +650,7 @@
*/
public void testMultipleDisposersForProducer() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/disposers/TimestampLogger_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MULTIPLE_DISPOSERS_FOR_PRODUCER, 13, 16);
+ assertMarkerIsCreated(file, CDIValidationMessages.MULTIPLE_DISPOSERS_FOR_PRODUCER, 13, 16);
}
/**
@@ -660,8 +661,8 @@
*/
public void testParameterizedTypeWithWildcard() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/broken/parameterizedReturnTypeWithWildcard/SpiderProducerWildCardType_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreatedForGivenPosition(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_FIELD_TYPE_HAS_WILDCARD, 23, 1011, 1026);
- AbstractResourceMarkerTest.assertMarkerIsCreatedForGivenPosition(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_FIELD_TYPE_HAS_WILDCARD, 24, 1100, 1125);
+ assertMarkerIsCreatedForGivenPosition(file, CDIValidationMessages.PRODUCER_FIELD_TYPE_HAS_WILDCARD, 23, 1011, 1026);
+ assertMarkerIsCreatedForGivenPosition(file, CDIValidationMessages.PRODUCER_FIELD_TYPE_HAS_WILDCARD, 24, 1100, 1125);
}
/**
@@ -672,7 +673,7 @@
*/
public void testTypeVariable() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/SpiderProducerVariableType_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_FIELD_TYPE_IS_VARIABLE, 10);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_FIELD_TYPE_IS_VARIABLE, 10);
}
/**
@@ -683,10 +684,10 @@
*/
public void testParameterizedTypeWithWrongScope() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/ParameterizedTypeWithWrongScope_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 11, 18);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 9);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 14);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 16);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 11, 18);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 9);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 14);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 16);
}
/**
@@ -700,7 +701,7 @@
*/
public void testProducerAnnotatedInject() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/ProducerAnnotatedInjectBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_ANNOTATED_INJECT, 8);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_ANNOTATED_INJECT, 8);
}
/**
@@ -711,7 +712,7 @@
*/
public void testNonStaticProducerOfSessionBean() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/NonStaticProducerOfSessionBeanBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN, 9);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN, 9);
}
/**
@@ -722,7 +723,7 @@
*/
public void testDecoratorMustNotHaveProducerField() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/DecoratorHasProducerFieldBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_IN_DECORATOR, 9);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_IN_DECORATOR, 9);
}
/**
@@ -733,7 +734,7 @@
*/
public void testInterceptorMustNotHaveProducerField() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/InterceptorHasProducerFieldBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_IN_INTERCEPTOR, 16);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_IN_INTERCEPTOR, 16);
}
/**
@@ -744,7 +745,7 @@
*/
public void testResourceWithELName() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/resources/ProducerFieldsBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME, 15, 19, 24, 27, 31);
+ assertMarkerIsCreated(file, CDIValidationMessages.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME, 15, 19, 24, 27, 31);
}
/*
@@ -769,7 +770,7 @@
*/
public void testTooManyInitializerAnnotatedConstructor() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/simple/definition/tooManyInitializerAnnotatedConstructors/Goose_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MULTIPLE_INJECTION_CONSTRUCTORS, 24, 29);
+ assertMarkerIsCreated(file, CDIValidationMessages.MULTIPLE_INJECTION_CONSTRUCTORS, 24, 29);
}
/**
@@ -780,7 +781,7 @@
*/
public void testConstructorHasDisposesParameter() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/simple/definition/constructorHasDisposesParameter/DisposingConstructor.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.CONSTRUCTOR_PARAMETER_ANNOTATED_DISPOSES, 24, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.CONSTRUCTOR_PARAMETER_ANNOTATED_DISPOSES, 24, 25);
}
/**
@@ -791,7 +792,7 @@
*/
public void testConstructorHasObservesParameter() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/simple/definition/constructorHasObservesParameter/ObservingConstructor.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.CONSTRUCTOR_PARAMETER_ANNOTATED_OBSERVES, 25, 26);
+ assertMarkerIsCreated(file, CDIValidationMessages.CONSTRUCTOR_PARAMETER_ANNOTATED_OBSERVES, 25, 26);
}
/**
@@ -802,7 +803,7 @@
*/
public void testStaticInitializerMethod() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/GenericInitializerMethodBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.STATIC_METHOD_ANNOTATED_INJECT, 11);
+ assertMarkerIsCreated(file, CDIValidationMessages.STATIC_METHOD_ANNOTATED_INJECT, 11);
}
/**
@@ -813,8 +814,8 @@
*/
public void testInitializerMethodHasParameterAnnotatedDisposes() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/initializer/broken/parameterAnnotatedDisposes/Capercaillie_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreatedForGivenPosition(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 25, 1003, 1010);
- AbstractResourceMarkerTest.assertMarkerIsCreatedForGivenPosition(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 26, 1048, 1057);
+ assertMarkerIsCreatedForGivenPosition(file, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 25, 1003, 1010);
+ assertMarkerIsCreatedForGivenPosition(file, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 26, 1048, 1057);
}
/**
@@ -825,7 +826,7 @@
*/
public void testGenericInitializerMethod() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/GenericInitializerMethodBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.GENERIC_METHOD_ANNOTATED_INJECT, 7);
+ assertMarkerIsCreated(file, CDIValidationMessages.GENERIC_METHOD_ANNOTATED_INJECT, 7);
}
/**
@@ -836,7 +837,7 @@
*/
public void testNamedInjectPoint() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/NamedInjectionBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, 10, 16);
+ assertMarkerIsCreated(file, CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, 10, 16);
}
/**
@@ -847,8 +848,8 @@
*/
public void testBeanDoesNotHaveSomeTypeOfSpecializedBean() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/specialization/MissingTypeBeanBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, MessageFormat.format(CDIValidationMessages.MISSING_TYPE_IN_SPECIALIZING_BEAN, "MissingTypeBeanBroken", "Farmer", "Farmer"), 6);
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, MessageFormat.format(CDIValidationMessages.MISSING_TYPE_IN_SPECIALIZING_BEAN, "MissingTypeBeanBroken", "Farmer", "Simple"), 6);
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.MISSING_TYPE_IN_SPECIALIZING_BEAN, "MissingTypeBeanBroken", "Farmer", "Farmer"), 6);
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.MISSING_TYPE_IN_SPECIALIZING_BEAN, "MissingTypeBeanBroken", "Farmer", "Simple"), 6);
}
/**
@@ -859,7 +860,7 @@
*/
public void testSpecializingAndSpecializedBeanHasName() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/broken/specializingAndSpecializedBeanHaveName/HighSchool_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, MessageFormat.format(CDIValidationMessages.CONFLICTING_NAME_IN_SPECIALIZING_BEAN, "HighSchool_Broken.getStarPupil()", "School.getStarPupil()"), 25);
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.CONFLICTING_NAME_IN_SPECIALIZING_BEAN, "HighSchool_Broken.getStarPupil()", "School.getStarPupil()"), 25);
}
/**
@@ -870,7 +871,7 @@
*/
public void testSpecializingInterceptor() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/specialization/SpecializingInterceptorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INTERCEPTOR_ANNOTATED_SPECIALIZES, 9);
+ assertMarkerIsCreated(file, CDIValidationMessages.INTERCEPTOR_ANNOTATED_SPECIALIZES, 9);
}
/**
@@ -881,7 +882,7 @@
*/
public void testSpecializingDecorator() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/specialization/SpecializingDecoratorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DECORATOR_ANNOTATED_SPECIALIZES, 10);
+ assertMarkerIsCreated(file, CDIValidationMessages.DECORATOR_ANNOTATED_SPECIALIZES, 10);
}
/**
@@ -892,7 +893,7 @@
*/
public void testDecoratorNotResolved() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/House.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECTED_DECORATOR, 23);
+ assertMarkerIsCreated(file, CDIValidationMessages.INJECTED_DECORATOR, 23);
}
/**
@@ -903,7 +904,7 @@
*/
public void testInterceptorNotResolved() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/InjectInterceptorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECTED_INTERCEPTOR, 7);
+ assertMarkerIsCreated(file, CDIValidationMessages.INJECTED_INTERCEPTOR, 7);
}
/**
@@ -914,9 +915,9 @@
*/
public void testAmbiguousDependency() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/broken/ambiguous/Farm_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 25);
file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateField/TimestampLogger.java");
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 34);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 34);
}
/**
@@ -927,9 +928,9 @@
*/
public void testUnsatisfiedDependency() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/broken/unsatisfied/Bean_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 25);
file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateField/TimestampLogger.java");
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 34);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 34);
}
/**
@@ -940,7 +941,7 @@
*/
public void testTypeVariableInjectionPoint() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/FarmBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECTION_TYPE_IS_VARIABLE, 11, 15);
+ assertMarkerIsCreated(file, CDIValidationMessages.INJECTION_TYPE_IS_VARIABLE, 11, 15);
}
/**
@@ -951,13 +952,13 @@
*/
public void testPrimitiveInjectionPointResolvedToNonPrimitiveProducerMethod() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/GameBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 7, 19);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 9);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 10);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 11);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 20);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 21);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 22);
+ assertMarkerIsCreated(file, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 7, 19);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 9);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 10);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 11);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 20);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 21);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN, 22);
}
/**
@@ -968,7 +969,7 @@
*/
public void testAnnotationMemberWithoutNonBinding() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/binding/members/annotation/Expensive_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_QUALIFIER_TYPE_MEMBER, 35);
+ assertMarkerIsCreated(file, CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_QUALIFIER_TYPE_MEMBER, 35);
}
/**
@@ -979,7 +980,7 @@
*/
public void testArrayMemberWithoutNonBinding() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/binding/members/array/Expensive_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER, 34);
+ assertMarkerIsCreated(file, CDIValidationMessages.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER, 34);
}
/**
@@ -990,10 +991,68 @@
*/
public void testSessionScopedBeanWithInjectionPoint() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/normal/scope/Cat_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_WHEN_TYPE_INJECTIONPOINT_IS_INJECTED, 27);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_SCOPE_WHEN_TYPE_INJECTIONPOINT_IS_INJECTED, 27);
}
/**
+ * 8.1.2. Decorator delegate injection points
+ * - decorator has more than one delegate injection point
+ *
+ * @throws Exception
+ */
+ public void testMultipleDelegateInjectionPoints() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/broken/multipleDelegateInjectionPoints/TimestampLogger.java");
+ assertMarkerIsCreated(file, CDIValidationMessages.MULTIPLE_DELEGATE, 31, 32);
+ }
+
+ /**
+ * 8.1.2. Decorator delegate injection points
+ * - decorator does not have a delegate injection point
+ *
+ * @throws Exception
+ */
+ public void testNoDelegateInjectionPoints() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/broken/noDelegateInjectionPoints/TimestampLogger.java");
+ assertMarkerIsCreated(file, CDIValidationMessages.MISSING_DELEGATE, 25);
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateInitializerMethod/TimestampLogger.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.MISSING_DELEGATE);
+ }
+
+ /**
+ * 8.1.2. Decorator delegate injection points
+ * - decorator does not have a delegate injection point
+ *
+ * @throws Exception
+ */
+ public void testDecoratorDelegateInjectionPoints() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateField/TimestampLogger.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_INJECTION_POINT_DELEGATE);
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateInitializerMethod/TimestampLogger.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_INJECTION_POINT_DELEGATE);
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateConstructor/TimestampLogger.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_INJECTION_POINT_DELEGATE);
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/broken/delegateProducerMethod/TimestampLogger.java");
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_INJECTION_POINT_DELEGATE, 33);
+ }
+
+ /**
+ * 8.1.2. Decorator delegate injection points
+ * - bean class that is not a decorator has an injection point annotated @Delegate
+ *
+ * @throws Exception
+ */
+ public void testNonDecoratorWithDecoratesAnnotationNotOK() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/broken/nonDecoratorWithDecorates/Elf.java");
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_BEAN_DECLARING_DELEGATE);
+ tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateField/TimestampLogger.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_BEAN_DECLARING_DELEGATE);
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateInitializerMethod/TimestampLogger.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_BEAN_DECLARING_DELEGATE);
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateConstructor/TimestampLogger.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_BEAN_DECLARING_DELEGATE);
+ }
+
+ /**
* 10.4.2. Declaring an observer method
* - method has more than one parameter annotated @Observes
*
@@ -1001,7 +1060,7 @@
*/
public void testObserverMethodMustHaveOnlyOneEventParameter() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/broken/observer/tooManyParameters/YorkshireTerrier_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MULTIPLE_OBSERVING_PARAMETERS, 24, 24);
+ assertMarkerIsCreated(file, CDIValidationMessages.MULTIPLE_OBSERVING_PARAMETERS, 24, 24);
}
/**
@@ -1012,7 +1071,7 @@
*/
public void testObserverMethodAnnotatedProducesFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/broken/observer/isProducer/BorderTerrier_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES, 25, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES, 25, 25);
}
/**
@@ -1023,7 +1082,7 @@
*/
public void testObserverMethodAnnotatedInitializerFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/broken/observer/isInitializer/AustralianTerrier_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.OBSERVER_ANNOTATED_INJECT, 25, 26);
+ assertMarkerIsCreated(file, CDIValidationMessages.OBSERVER_ANNOTATED_INJECT, 25, 26);
}
/**
@@ -1034,7 +1093,7 @@
*/
public void testObserverMethodWithDisposesParamFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/broken/observer/isDisposer/FoxTerrier_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, 28, 28);
+ assertMarkerIsCreated(file, CDIValidationMessages.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, 28, 28);
}
/**
@@ -1045,10 +1104,30 @@
*/
public void testObserverMethodOnEnterpriseBeanNotBusinessMethodOrStaticFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/broken/observer/notBusinessMethod/TibetanTerrier_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_OBSERVER_IN_SESSION_BEAN, 25);
+ assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_OBSERVER_IN_SESSION_BEAN, 25);
}
public static int getMarkersNumber(IResource resource) {
return AbstractResourceMarkerTest.getMarkersNumberByGroupName(resource, null);
}
+
+ private static void assertMarkerIsCreated(IResource resource, String message, int... expectedLines) throws CoreException {
+ AbstractResourceMarkerTest.assertMarkerIsCreated(resource, AbstractResourceMarkerTest.MARKER_TYPE, convertMessageToPatern(message), expectedLines);
+ }
+
+ private static void assertMarkerIsNotCreated(IResource resource, String message) throws CoreException {
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(resource, AbstractResourceMarkerTest.MARKER_TYPE, convertMessageToPatern(message));
+ }
+
+ private static void assertMarkerIsNotCreated(IResource resource, String message, int expectedLine) throws CoreException {
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(resource, AbstractResourceMarkerTest.MARKER_TYPE, convertMessageToPatern(message), expectedLine);
+ }
+
+ private static void assertMarkerIsCreatedForGivenPosition(IResource resource, String message, int lineNumber, int startPosition, int endPosition) throws CoreException {
+ AbstractResourceMarkerTest.assertMarkerIsCreatedForGivenPosition(resource, AbstractResourceMarkerTest.MARKER_TYPE, convertMessageToPatern(message), lineNumber, startPosition, endPosition);
+ }
+
+ private static String convertMessageToPatern(String message) {
+ return message.replace("[", "\\[").replace("]", "\\]");
+ }
}
\ No newline at end of file
15 years, 10 months
JBoss Tools SVN: r22957 - trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-06-23 11:27:12 -0400 (Wed, 23 Jun 2010)
New Revision: 22957
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
Log:
https://jira.jboss.org/browse/JBIDE-6519
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java 2010-06-23 15:21:25 UTC (rev 22956)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java 2010-06-23 15:27:12 UTC (rev 22957)
@@ -15,12 +15,11 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.jboss.tools.common.test.util.TestProjectProvider;
-import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.TestProjectProvider;
/**
* Test that Seam builder works for projects that set cyclic dependency in build paths.
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2010-06-23 15:21:25 UTC (rev 22956)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2010-06-23 15:27:12 UTC (rev 22957)
@@ -34,12 +34,13 @@
TestSuite suite = new TestSuite();
suite.setName("All tests for " + PLUGIN_ID);
- suite.addTest(new ProjectImportTestSetup(new TestSuite(ScannerTest.class),"org.jboss.tools.seam.core.test","projects/TestScanner","TestScanner"));
- suite.addTestSuite(SerializationTest.class);
- suite.addTestSuite(SeamBigProjectTest.class);
- suite.addTestSuite(SeamEARTest.class);
- suite.addTestSuite(SeamRuntimeListConverterTest.class);
- suite.addTestSuite(SeamRuntimeManagerTest.class);
+// suite.addTest(new ProjectImportTestSetup(new TestSuite(ScannerTest.class),"org.jboss.tools.seam.core.test","projects/TestScanner","TestScanner"));
+// suite.addTestSuite(SerializationTest.class);
+// suite.addTestSuite(SeamBigProjectTest.class);
+// suite.addTestSuite(SeamEARTest.class);
+// suite.addTestSuite(SeamRuntimeListConverterTest.class);
+// suite.addTestSuite(SeamRuntimeManagerTest.class);
+ suite.addTestSuite(CyclicDependingProjectsTest.class);
return suite;
}
}
\ No newline at end of file
15 years, 10 months
JBoss Tools SVN: r22956 - trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-06-23 11:21:25 -0400 (Wed, 23 Jun 2010)
New Revision: 22956
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java
Log:
https://jira.jboss.org/browse/JBIDE-6446
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java 2010-06-23 15:20:34 UTC (rev 22955)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java 2010-06-23 15:21:25 UTC (rev 22956)
@@ -64,12 +64,14 @@
@Override
public String getHyperlinkText() {
String text = CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_BEAN+" ";
- if(bean != null)
+ if(bean != null){
text += bean.getBeanClass().getElementName();
- if(bean instanceof IProducerField){
- text += "."+((IProducerField)bean).getField().getElementName();
- }else if(bean instanceof IProducerMethod){
- text += "."+((IProducerMethod)bean).getMethod().getElementName();
+
+ if(bean instanceof IProducerField){
+ text += "."+((IProducerField)bean).getField().getElementName();
+ }else if(bean instanceof IProducerMethod){
+ text += "."+((IProducerMethod)bean).getMethod().getElementName();
+ }
}
return text;
}
15 years, 10 months
JBoss Tools SVN: r22955 - trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-06-23 11:20:34 -0400 (Wed, 23 Jun 2010)
New Revision: 22955
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java
Log:
https://jira.jboss.org/browse/JBIDE-6446
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java 2010-06-23 14:43:27 UTC (rev 22954)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java 2010-06-23 15:20:34 UTC (rev 22955)
@@ -66,6 +66,11 @@
String text = CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_BEAN+" ";
if(bean != null)
text += bean.getBeanClass().getElementName();
+ if(bean instanceof IProducerField){
+ text += "."+((IProducerField)bean).getField().getElementName();
+ }else if(bean instanceof IProducerMethod){
+ text += "."+((IProducerMethod)bean).getMethod().getElementName();
+ }
return text;
}
15 years, 10 months
JBoss Tools SVN: r22954 - in trunk/seam/tests/org.jboss.tools.seam.core.test: projects/CycleTest1 and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-06-23 10:43:27 -0400 (Wed, 23 Jun 2010)
New Revision: 22954
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.classpath
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.project
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.eclipse.jdt.core.prefs
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.jboss.tools.seam.core.prefs
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/bin/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/lib/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/lib/jboss-seam.jar
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/src/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/src/test/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/src/test/MyBean1.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.classpath
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.project
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.settings/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.settings/org.eclipse.jdt.core.prefs
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/bin/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/lib/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/lib/jboss-seam.jar
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/src/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/src/test/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/src/test/MyBean2.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6519
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.classpath
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.classpath (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.classpath 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="lib" path="lib/jboss-seam.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/CycleTest2"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.project
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.project (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.project 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>CycleTest1</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.seam.core.seambuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.jboss.tools.jst.web.kb.kbnature</nature>
+ <nature>org.jboss.tools.seam.core.seamnature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.eclipse.jdt.core.prefs 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,12 @@
+#Wed Jun 23 18:23:09 MSD 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.jboss.tools.seam.core.prefs
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.jboss.tools.seam.core.prefs (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.jboss.tools.seam.core.prefs 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,16 @@
+#Wed Jun 23 18:47:03 MSD 2010
+action.package=org.domain.test1.session
+action.sources=/CycleTest1/src
+eclipse.preferences.version=1
+model.package=org.domain.test1.entity
+model.sources=/CycleTest1/src
+seam.ejb.project=CycleTest1
+seam.project.deployment.type=war
+seam.project.settings.version=1.1
+seam.project.web.root.folder=/Test1
+seam.runtime.name=jboss-seam-2.0.0.CR2
+seam.settings.changed.by.user=true
+seam.test.creating=false
+seam.test.project=CycleTest1
+test.package=org.domain.test1.test
+test.sources=/CycleTest1/src
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/.settings/org.jboss.tools.seam.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/lib/jboss-seam.jar
===================================================================
(Binary files differ)
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/lib/jboss-seam.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/src/test/MyBean1.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/src/test/MyBean1.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/src/test/MyBean1.java 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,8 @@
+package test;
+
+import org.jboss.seam.annotations.Name;
+
+@Name("test.bean1")
+public class MyBean1 {
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest1/src/test/MyBean1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.classpath
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.classpath (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.classpath 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="lib" path="lib/jboss-seam.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/CycleTest1"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.project
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.project (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.project 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>CycleTest2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.seam.core.seambuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.jboss.tools.jst.web.kb.kbnature</nature>
+ <nature>org.jboss.tools.seam.core.seamnature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.settings/org.eclipse.jdt.core.prefs 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,12 @@
+#Wed Jun 23 18:23:25 MSD 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/lib/jboss-seam.jar
===================================================================
(Binary files differ)
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/lib/jboss-seam.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/src/test/MyBean2.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/src/test/MyBean2.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/src/test/MyBean2.java 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,8 @@
+package test;
+
+import org.jboss.seam.annotations.Name;
+
+@Name("test.bean2")
+public class MyBean2 {
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/CycleTest2/src/test/MyBean2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java 2010-06-23 14:43:27 UTC (rev 22954)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.seam.core.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.internal.core.SeamProject;
+import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
+
+/**
+ * Test that Seam builder works for projects that set cyclic dependency in build paths.
+
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class CyclicDependingProjectsTest extends TestCase {
+ static String BUNDLE = "org.jboss.tools.seam.core.test";
+ IProject project1;
+ TestProjectProvider provider1;
+ IProject project2;
+ TestProjectProvider provider2;
+
+ protected void setUp() throws Exception {
+ provider1 = new TestProjectProvider(BUNDLE,"/projects/CycleTest1" , "CycleTest1", true);
+ project1 = provider1.getProject();
+ provider2 = new TestProjectProvider(BUNDLE,"/projects/CycleTest2" , "CycleTest2", true);
+ project2 = provider1.getProject();
+
+ JobUtils.waitForIdle();
+ //To ensure that the project is built.
+ project1.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
+ project2.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ }
+
+ public void testCyclicDependingProjects() {
+ ISeamProject sp1 = getSeamProject1();
+
+ assertNotNull(sp1.getComponent("test.bean1"));
+ assertNotNull(sp1.getComponent("test.bean1"));
+
+ ISeamProject sp2 = getSeamProject2();
+
+ assertNotNull(sp2.getComponent("test.bean1"));
+ assertNotNull(sp2.getComponent("test.bean1"));
+ }
+
+
+ private ISeamProject getSeamProject1() {
+ ISeamProject seamProject = null;
+ try {
+ seamProject = (ISeamProject)project1.getNature(SeamProject.NATURE_ID);
+ } catch (Exception e) {
+ JUnitUtils.fail("Cannot get seam nature.",e);
+ }
+ assertNotNull("Seam project is null", seamProject);
+ return seamProject;
+ }
+
+ private ISeamProject getSeamProject2() {
+ ISeamProject seamProject = null;
+ try {
+ seamProject = (ISeamProject)project2.getNature(SeamProject.NATURE_ID);
+ } catch (Exception e) {
+ JUnitUtils.fail("Cannot get seam nature.",e);
+ }
+ assertNotNull("Seam project is null", seamProject);
+ return seamProject;
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ ISeamProject sp1 = getSeamProject1();
+ SeamProject impl1 = (SeamProject)sp1;
+ if(impl1 != null) impl1.clearStorage();
+
+ ISeamProject sp2 = getSeamProject2();
+ SeamProject impl2 = (SeamProject)sp2;
+ if(impl2 != null) impl2.clearStorage();
+
+ JobUtils.waitForIdle();
+ provider1.dispose();
+ provider2.dispose();
+ }
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 10 months
JBoss Tools SVN: r22953 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets.
by jbosstools-commits@lists.jboss.org
Author: jlukas(a)redhat.com
Date: 2010-06-23 10:38:53 -0400 (Wed, 23 Jun 2010)
New Revision: 22953
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/SelectWSDLDialog.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/WsTesterView.java
Log:
adding missing license
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/SelectWSDLDialog.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/SelectWSDLDialog.java 2010-06-23 14:38:03 UTC (rev 22952)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/SelectWSDLDialog.java 2010-06-23 14:38:53 UTC (rev 22953)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.ws.ui.bot.test.widgets;
import java.util.Arrays;
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/WsTesterView.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/WsTesterView.java 2010-06-23 14:38:03 UTC (rev 22952)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/WsTesterView.java 2010-06-23 14:38:53 UTC (rev 22953)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.ws.ui.bot.test.widgets;
import java.util.Collections;
15 years, 10 months
JBoss Tools SVN: r22952 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test: widgets and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jlukas(a)redhat.com
Date: 2010-06-23 10:38:03 -0400 (Wed, 23 Jun 2010)
New Revision: 22952
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/SelectWSDLDialog.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/WsTesterView.java
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java
Log:
refactoring - moving helper stuff to separate package
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java 2010-06-23 14:25:07 UTC (rev 22951)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java 2010-06-23 14:38:03 UTC (rev 22952)
@@ -15,42 +15,23 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotList;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTabItem;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.gen.IView;
-import org.jboss.tools.ui.bot.ext.view.ViewBase;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.jboss.tools.ws.ui.bot.test.widgets.SelectWSDLDialog;
+import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView;
import org.junit.Assert;
import org.junit.Test;
-import org.osgi.framework.Bundle;
/**
* Tests for Web Service Tester
*
* @author jlukas
*/
-@SuppressWarnings("restriction")
public class WsTesterTest extends SWTTestExt {
private static final Logger L = Logger.getLogger(WsTesterTest.class.getName());
@@ -223,6 +204,7 @@
// checkResponse(rsp, "Colorado Springs");
// viewBot.close();
// }
+
@Test
public void testOpenMonitor() {
WsTesterView wstv = new WsTesterView();
@@ -312,272 +294,4 @@
}
}
}
-
- private static class WsTesterView extends ViewBase {
-
- private static final Bundle WSUI_BUNDLE = Platform.getBundle("org.jboss.tools.ws.ui");
-
- enum Ws_Type {
-
- JAX_WS, JAX_RS;
-
- String getLabel() {
- switch (this) {
- case JAX_WS:
- return "JAX-WS";
- case JAX_RS:
- return "JAX-RS";
- }
- throw new AssertionError("Invalid Web Service Type");
- }
- }
-
- enum Http_Method {
-
- GET, POST, PUT, DELETE;
- }
-
- enum Request_Arg_Type {
-
- HEADER(JBossWSUIMessages.JAXRSWSTestView_Request_Header_Label),
- PARAMETER(JBossWSUIMessages.JAXRSWSTestView_Request_Parameters_Label);
- private String type;
-
- private Request_Arg_Type(String s) {
- type = s;
- }
-
- private String getType() {
- return type;
- }
- }
-
- public WsTesterView() {
- super();
- viewObject = new IView() {
-
- public String getName() {
- // Web Service Tester
- return getStringFromBundle("%test.view.name");
- }
-
- public List<String> getGroupPath() {
- // JBoss Tools Web Services
- return Collections.singletonList(getStringFromBundle("%test.view.category.name"));
- }
- };
- }
-
- @Override
- public SWTBotView show() {
- SWTBotView b = super.show();
- // maximize tester view
- menu(IDEWorkbenchMessages.Workbench_window).menu(WorkbenchMessages.MaximizePartAction_text).click();
- return b;
- }
-
- public void setWebServiceType(Ws_Type type) {
- //Web Service Type:
- comboBoxWithLabel(JBossWSUIMessages.JAXRSWSTestView_Web_Service_Type_Label).setSelection(type.getLabel());
- }
-
-// public void setSampleContent() {
-// button(JBossWSUIMessages.JAXRSWSTestView_Set_Sample_Data_Label).click();
-// }
-
- public void setHttpMethod(Http_Method m) {
- getHTTPTypeCombo().setSelection(m.toString());
- }
-
- public Http_Method getHttpMethod() {
- return Enum.valueOf(Http_Method.class, getHTTPTypeCombo().getText());
- }
-
- public boolean isHttpMethodSelectionEnabled() {
- return getHTTPTypeCombo().isEnabled();
- }
-
- public void setServiceURL(String url) {
- getServiceURLCombo().typeText(url);
- }
-
- public String getServiceURL() {
- return getServiceURLCombo().getText();
- }
-
- public void setActionURL(String s) {
- getActionURLText().typeText(s);
- }
-
- public String getActionURL() {
- return getActionURLText().getText();
- }
-
- public void setRequestBody(String s) {
- SWTBotTabItem ti = tabItem(JBossWSUIMessages.JAXRSWSTestView_Request_Body_Label);
- ti.activate();
- text(1).setText(s);
- }
-
- public void addRequestArg(Request_Arg_Type type, String name, String value) {
- SWTBotTabItem ti = bot.tabItem(type.getType());
- ti.activate();
- text(1).typeText(name + "=" + value);
- bot.button("Add").click();
- text(1).setText("");
- }
-
- public Map<String, String> getRequestArgs(Request_Arg_Type type) {
- SWTBotTabItem ti = bot.tabItem(type.getType());
- ti.activate();
- String[] args = list(0).getItems();
- Map<String, String> result = new HashMap<String, String>();
- for (String s : args) {
- int i = s.indexOf('=');
- result.put(s.substring(0, i), s.substring(i + 1));
- }
- return result;
- }
-
- public void editRequestArg(Request_Arg_Type type, String oldName,
- String oldValue, String newName, String newValue) {
- SWTBotTabItem ti = bot.tabItem(type.getType());
- ti.activate();
- bot.list(0).select(oldName + "=" + oldValue);
- bot.button("Edit").click();
- SWTBot sh = bot.activeShell().bot();
- sh.text(0).typeText(newName + "=" + newValue);
- sh.button(IDialogConstants.OK_LABEL).click();
- }
-
- public void upRequestArg(Request_Arg_Type type, String name, String value) {
- SWTBotTabItem ti = bot.tabItem(type.getType());
- ti.activate();
- list(0).select(name + "=" + value);
- bot.button("Up").click();
- }
-
- public void downRequestArg(Request_Arg_Type type, String name, String value) {
- SWTBotTabItem ti = bot.tabItem(type.getType());
- ti.activate();
- list(0).select(name + "=" + value);
- bot.button("Down").click();
- }
-
- public void removeRequestArg(Request_Arg_Type type, String name, String value) {
- SWTBotTabItem ti = bot.tabItem(type.getType());
- ti.activate();
- list(0).select(name + "=" + value);
- bot.button("Remove").click();
- }
-
- public void clearRequestArgs(Request_Arg_Type type) {
- SWTBotTabItem ti = bot.tabItem(type.getType());
- ti.activate();
- SWTBotButton b = bot.button("Clear All");
- if (b.isEnabled()) {
- b.click();
- }
- }
-
- public String getResponseBody() {
- SWTBotTabItem ti = tabItem(JBossWSUIMessages.JAXRSWSTestView_Results_Body_Label);
- ti.activate();
- return bot.text(2).getText();
- }
-
- public String[] getResponseHeaders() {
- SWTBotTabItem ti = tabItem(JBossWSUIMessages.JAXRSWSTestView_Results_Header_Label);
- ti.activate();
- return list(1).getItems();
- }
-
- public void invoke() {
- String dlgTitle = JBossWSUIMessages.JAXRSWSTestView_Invoke_Label;
- button(dlgTitle).click();
- waitWhile(Conditions.shellIsActive(dlgTitle), 120000);
- sleep(500);
- }
-
- public SelectWSDLDialog getFromWSDL() {
- button(JBossWSUIMessages.JAXRSWSTestView_Button_Get_From_WSDL).click();
- return new SelectWSDLDialog(activeShell().widget);
- }
-
- public void openMonitor() {
- button(JBossWSUIMessages.JAXRSWSTestView_Open_Monitor_Button).click();
- }
-
- public void configureMonitor() {
- button(JBossWSUIMessages.JAXRSWSTestView_Configure_Monitor_Button).click();
- }
-
- private String getStringFromBundle(String key) {
- return Platform.getResourceString(WSUI_BUNDLE, key);
- }
-
- private SWTBotCombo getHTTPTypeCombo() {
- //HTTP Method:
- return comboBoxWithLabel(JBossWSUIMessages.JAXRSWSTestView_HTTP_Method_Label);
- }
-
- private SWTBotCombo getServiceURLCombo() {
- //Service URL:
- return comboBoxWithLabel(JBossWSUIMessages.JAXRSWSTestView_Service_URL_Label);
- }
-
- private SWTBotText getActionURLText() {
- //Action URL:
- return textWithLabel(JBossWSUIMessages.JAXRSWSTestView_Action_URL_Label);
- }
- }
-
- private static class SelectWSDLDialog extends SWTBotShell {
-
- public SelectWSDLDialog(Shell shell) throws WidgetNotFoundException {
- super(shell);
- assert JBossWSUIMessages.WSDLBrowseDialog_Dialog_Title.equals(getText());
- }
-
- public void openURL() {
- bot().button(JBossWSUIMessages.WSDLBrowseDialog_URL_Browse).click();
- }
-
-// public void setURI(String s) {
-// bot().comboBoxWithLabel(JBossWSUIMessages.WSDLBrowseDialog_WSDL_URI_Field).setText(s);
-// }
-
- public String getURI() {
- return bot().comboBoxWithLabel(JBossWSUIMessages.WSDLBrowseDialog_WSDL_URI_Field).getText();
- }
-
- public List<String> getServices() {
- return getItems(JBossWSUIMessages.WSDLBrowseDialog_Service_Field);
- }
-
- public List<String> getPorts() {
- return getItems(JBossWSUIMessages.WSDLBrowseDialog_Port_Field);
- }
-
- public List<String> getOperations() {
- return Arrays.asList(getOperationsList().getItems());
- }
-
- public void selectOperation(String op) {
- getOperationsList().select(op);
- }
-
- public void ok() {
- bot().button(IDialogConstants.OK_LABEL).click();
- }
-
- private List<String> getItems(String label) {
- String[] items = bot().comboBoxWithLabel(label).items();
- return Arrays.asList(items);
- }
-
- private SWTBotList getOperationsList() {
- return bot().listWithLabel(JBossWSUIMessages.WSDLBrowseDialog_Operation_Field);
- }
- }
}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/SelectWSDLDialog.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/SelectWSDLDialog.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/SelectWSDLDialog.java 2010-06-23 14:38:03 UTC (rev 22952)
@@ -0,0 +1,60 @@
+package org.jboss.tools.ws.ui.bot.test.widgets;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotList;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+
+public class SelectWSDLDialog extends SWTBotShell {
+
+ public SelectWSDLDialog(Shell shell) throws WidgetNotFoundException {
+ super(shell);
+ assert JBossWSUIMessages.WSDLBrowseDialog_Dialog_Title.equals(getText());
+ }
+
+ public void openURL() {
+ bot().button(JBossWSUIMessages.WSDLBrowseDialog_URL_Browse).click();
+ }
+
+ // public void setURI(String s) {
+ // bot().comboBoxWithLabel(JBossWSUIMessages.WSDLBrowseDialog_WSDL_URI_Field).setText(s);
+ // }
+
+ public String getURI() {
+ return bot().comboBoxWithLabel(JBossWSUIMessages.WSDLBrowseDialog_WSDL_URI_Field).getText();
+ }
+
+ public List<String> getServices() {
+ return getItems(JBossWSUIMessages.WSDLBrowseDialog_Service_Field);
+ }
+
+ public List<String> getPorts() {
+ return getItems(JBossWSUIMessages.WSDLBrowseDialog_Port_Field);
+ }
+
+ public List<String> getOperations() {
+ return Arrays.asList(getOperationsList().getItems());
+ }
+
+ public void selectOperation(String op) {
+ getOperationsList().select(op);
+ }
+
+ public void ok() {
+ bot().button(IDialogConstants.OK_LABEL).click();
+ }
+
+ private List<String> getItems(String label) {
+ String[] items = bot().comboBoxWithLabel(label).items();
+ return Arrays.asList(items);
+ }
+
+ private SWTBotList getOperationsList() {
+ return bot().listWithLabel(JBossWSUIMessages.WSDLBrowseDialog_Operation_Field);
+ }
+}
\ No newline at end of file
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/WsTesterView.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/WsTesterView.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/widgets/WsTesterView.java 2010-06-23 14:38:03 UTC (rev 22952)
@@ -0,0 +1,250 @@
+package org.jboss.tools.ws.ui.bot.test.widgets;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTabItem;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.eclipse.ui.internal.WorkbenchMessages;
+import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
+import org.jboss.tools.ui.bot.ext.gen.IView;
+import org.jboss.tools.ui.bot.ext.view.ViewBase;
+import org.jboss.tools.ws.ui.bot.test.WsTesterTest;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.osgi.framework.Bundle;
+
+@SuppressWarnings("restriction")
+public class WsTesterView extends ViewBase {
+
+ private static final Bundle WSUI_BUNDLE = Platform.getBundle("org.jboss.tools.ws.ui");
+
+ public enum Ws_Type {
+
+ JAX_WS, JAX_RS;
+
+ String getLabel() {
+ switch (this) {
+ case JAX_WS:
+ return "JAX-WS";
+ case JAX_RS:
+ return "JAX-RS";
+ }
+ throw new AssertionError("Invalid Web Service Type");
+ }
+ }
+
+ public enum Http_Method {
+
+ GET, POST, PUT, DELETE;
+ }
+
+ public enum Request_Arg_Type {
+
+ HEADER(JBossWSUIMessages.JAXRSWSTestView_Request_Header_Label),
+ PARAMETER(JBossWSUIMessages.JAXRSWSTestView_Request_Parameters_Label);
+
+ private String type;
+
+ private Request_Arg_Type(String s) {
+ type = s;
+ }
+
+ private String getType() {
+ return type;
+ }
+ }
+
+ public WsTesterView() {
+ super();
+ viewObject = new IView() {
+
+ public String getName() {
+ // Web Service Tester
+ return getStringFromBundle("%test.view.name");
+ }
+
+ public List<String> getGroupPath() {
+ // JBoss Tools Web Services
+ return Collections.singletonList(getStringFromBundle("%test.view.category.name"));
+ }
+ };
+ }
+
+ @Override
+ public SWTBotView show() {
+ SWTBotView b = super.show();
+ // maximize tester view
+ menu(IDEWorkbenchMessages.Workbench_window).menu(
+ WorkbenchMessages.MaximizePartAction_text).click();
+ return b;
+ }
+
+ public void setWebServiceType(WsTesterView.Ws_Type type) {
+ // Web Service Type:
+ comboBoxWithLabel(JBossWSUIMessages.JAXRSWSTestView_Web_Service_Type_Label)
+ .setSelection(type.getLabel());
+ }
+
+ // public void setSampleContent() {
+ // button(JBossWSUIMessages.JAXRSWSTestView_Set_Sample_Data_Label).click();
+ // }
+
+ public void setHttpMethod(WsTesterView.Http_Method m) {
+ getHTTPTypeCombo().setSelection(m.toString());
+ }
+
+ public WsTesterView.Http_Method getHttpMethod() {
+ return Enum.valueOf(WsTesterView.Http_Method.class, getHTTPTypeCombo().getText());
+ }
+
+ public boolean isHttpMethodSelectionEnabled() {
+ return getHTTPTypeCombo().isEnabled();
+ }
+
+ public void setServiceURL(String url) {
+ getServiceURLCombo().typeText(url);
+ }
+
+ public String getServiceURL() {
+ return getServiceURLCombo().getText();
+ }
+
+ public void setActionURL(String s) {
+ getActionURLText().typeText(s);
+ }
+
+ public String getActionURL() {
+ return getActionURLText().getText();
+ }
+
+ public void setRequestBody(String s) {
+ SWTBotTabItem ti = tabItem(JBossWSUIMessages.JAXRSWSTestView_Request_Body_Label);
+ ti.activate();
+ text(1).setText(s);
+ }
+
+ public void addRequestArg(WsTesterView.Request_Arg_Type type, String name,
+ String value) {
+ SWTBotTabItem ti = WsTesterTest.bot.tabItem(type.getType());
+ ti.activate();
+ text(1).typeText(name + "=" + value);
+ WsTesterTest.bot.button("Add").click();
+ text(1).setText("");
+ }
+
+ public Map<String, String> getRequestArgs(WsTesterView.Request_Arg_Type type) {
+ SWTBotTabItem ti = WsTesterTest.bot.tabItem(type.getType());
+ ti.activate();
+ String[] args = list(0).getItems();
+ Map<String, String> result = new HashMap<String, String>();
+ for (String s : args) {
+ int i = s.indexOf('=');
+ result.put(s.substring(0, i), s.substring(i + 1));
+ }
+ return result;
+ }
+
+ public void editRequestArg(WsTesterView.Request_Arg_Type type,
+ String oldName, String oldValue, String newName, String newValue) {
+ SWTBotTabItem ti = WsTesterTest.bot.tabItem(type.getType());
+ ti.activate();
+ WsTesterTest.bot.list(0).select(oldName + "=" + oldValue);
+ WsTesterTest.bot.button("Edit").click();
+ SWTBot sh = WsTesterTest.bot.activeShell().bot();
+ sh.text(0).typeText(newName + "=" + newValue);
+ sh.button(IDialogConstants.OK_LABEL).click();
+ }
+
+ public void upRequestArg(WsTesterView.Request_Arg_Type type, String name,
+ String value) {
+ SWTBotTabItem ti = WsTesterTest.bot.tabItem(type.getType());
+ ti.activate();
+ list(0).select(name + "=" + value);
+ WsTesterTest.bot.button("Up").click();
+ }
+
+ public void downRequestArg(WsTesterView.Request_Arg_Type type, String name,
+ String value) {
+ SWTBotTabItem ti = WsTesterTest.bot.tabItem(type.getType());
+ ti.activate();
+ list(0).select(name + "=" + value);
+ WsTesterTest.bot.button("Down").click();
+ }
+
+ public void removeRequestArg(WsTesterView.Request_Arg_Type type,
+ String name, String value) {
+ SWTBotTabItem ti = WsTesterTest.bot.tabItem(type.getType());
+ ti.activate();
+ list(0).select(name + "=" + value);
+ WsTesterTest.bot.button("Remove").click();
+ }
+
+ public void clearRequestArgs(WsTesterView.Request_Arg_Type type) {
+ SWTBotTabItem ti = WsTesterTest.bot.tabItem(type.getType());
+ ti.activate();
+ SWTBotButton b = WsTesterTest.bot.button("Clear All");
+ if (b.isEnabled()) {
+ b.click();
+ }
+ }
+
+ public String getResponseBody() {
+ SWTBotTabItem ti = tabItem(JBossWSUIMessages.JAXRSWSTestView_Results_Body_Label);
+ ti.activate();
+ return WsTesterTest.bot.text(2).getText();
+ }
+
+ public String[] getResponseHeaders() {
+ SWTBotTabItem ti = tabItem(JBossWSUIMessages.JAXRSWSTestView_Results_Header_Label);
+ ti.activate();
+ return list(1).getItems();
+ }
+
+ public void invoke() {
+ String dlgTitle = JBossWSUIMessages.JAXRSWSTestView_Invoke_Label;
+ button(dlgTitle).click();
+ waitWhile(Conditions.shellIsActive(dlgTitle), 120000);
+ sleep(500);
+ }
+
+ public SelectWSDLDialog getFromWSDL() {
+ button(JBossWSUIMessages.JAXRSWSTestView_Button_Get_From_WSDL).click();
+ return new SelectWSDLDialog(activeShell().widget);
+ }
+
+ public void openMonitor() {
+ button(JBossWSUIMessages.JAXRSWSTestView_Open_Monitor_Button).click();
+ }
+
+ public void configureMonitor() {
+ button(JBossWSUIMessages.JAXRSWSTestView_Configure_Monitor_Button).click();
+ }
+
+ private String getStringFromBundle(String key) {
+ return Platform.getResourceString(WSUI_BUNDLE, key);
+ }
+
+ private SWTBotCombo getHTTPTypeCombo() {
+ // HTTP Method:
+ return comboBoxWithLabel(JBossWSUIMessages.JAXRSWSTestView_HTTP_Method_Label);
+ }
+
+ private SWTBotCombo getServiceURLCombo() {
+ // Service URL:
+ return comboBoxWithLabel(JBossWSUIMessages.JAXRSWSTestView_Service_URL_Label);
+ }
+
+ private SWTBotText getActionURLText() {
+ // Action URL:
+ return textWithLabel(JBossWSUIMessages.JAXRSWSTestView_Action_URL_Label);
+ }
+}
\ No newline at end of file
15 years, 10 months
JBoss Tools SVN: r22951 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: jlukas(a)redhat.com
Date: 2010-06-23 10:25:07 -0400 (Wed, 23 Jun 2010)
New Revision: 22951
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java
Log:
Use strings from bundles where possible
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java 2010-06-23 14:07:55 UTC (rev 22950)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java 2010-06-23 14:25:07 UTC (rev 22951)
@@ -23,15 +23,18 @@
import java.util.logging.Logger;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotList;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTabItem;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
@@ -374,38 +377,40 @@
}
public void setWebServiceType(Ws_Type type) {
- comboBox(0).setSelection(type.getLabel());
+ //Web Service Type:
+ comboBoxWithLabel(JBossWSUIMessages.JAXRSWSTestView_Web_Service_Type_Label).setSelection(type.getLabel());
}
// public void setSampleContent() {
// button(JBossWSUIMessages.JAXRSWSTestView_Set_Sample_Data_Label).click();
// }
+
public void setHttpMethod(Http_Method m) {
- comboBox(1).setSelection(m.toString());
+ getHTTPTypeCombo().setSelection(m.toString());
}
public Http_Method getHttpMethod() {
- return Enum.valueOf(Http_Method.class, comboBox(1).getText());
+ return Enum.valueOf(Http_Method.class, getHTTPTypeCombo().getText());
}
public boolean isHttpMethodSelectionEnabled() {
- return comboBox(1).isEnabled();
+ return getHTTPTypeCombo().isEnabled();
}
public void setServiceURL(String url) {
- comboBox(2).typeText(url);
+ getServiceURLCombo().typeText(url);
}
public String getServiceURL() {
- return comboBox(2).getText();
+ return getServiceURLCombo().getText();
}
public void setActionURL(String s) {
- text(0).typeText(s);
+ getActionURLText().typeText(s);
}
public String getActionURL() {
- return text(0).getText();
+ return getActionURLText().getText();
}
public void setRequestBody(String s) {
@@ -442,7 +447,7 @@
bot.button("Edit").click();
SWTBot sh = bot.activeShell().bot();
sh.text(0).typeText(newName + "=" + newValue);
- sh.button("OK").click();
+ sh.button(IDialogConstants.OK_LABEL).click();
}
public void upRequestArg(Request_Arg_Type type, String name, String value) {
@@ -510,6 +515,21 @@
private String getStringFromBundle(String key) {
return Platform.getResourceString(WSUI_BUNDLE, key);
}
+
+ private SWTBotCombo getHTTPTypeCombo() {
+ //HTTP Method:
+ return comboBoxWithLabel(JBossWSUIMessages.JAXRSWSTestView_HTTP_Method_Label);
+ }
+
+ private SWTBotCombo getServiceURLCombo() {
+ //Service URL:
+ return comboBoxWithLabel(JBossWSUIMessages.JAXRSWSTestView_Service_URL_Label);
+ }
+
+ private SWTBotText getActionURLText() {
+ //Action URL:
+ return textWithLabel(JBossWSUIMessages.JAXRSWSTestView_Action_URL_Label);
+ }
}
private static class SelectWSDLDialog extends SWTBotShell {
@@ -548,7 +568,7 @@
}
public void ok() {
- bot().button("OK").click();
+ bot().button(IDialogConstants.OK_LABEL).click();
}
private List<String> getItems(String label) {
15 years, 10 months