[jbosstools-commits] JBoss Tools SVN: r22961 - in branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd: jpdl and 6 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jun 23 12:55:55 EDT 2010


Author: koen.aers at jboss.com
Date: 2010-06-23 12:55:53 -0400 (Wed, 23 Jun 2010)
New Revision: 22961

Added:
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java
Removed:
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeClassesTreeContentProvider.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeFilesTreeContentProvider.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeInDeploymentTreeViewer.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymentEditorPage.java
Modified:
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/editor/ActionBarContributor.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlContentProvider.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlEditor.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java
   branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java
   branches/jbosstools-3.1.x/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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/editor/ActionBarContributor.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/editor/ActionBarContributor.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/editor/ActionBarContributor.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessAction.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/DeployProcessActionDelegate.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerAction.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/PingServerActionDelegate.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveAction.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/SaveProcessArchiveActionDelegate.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/action/ToggleGridActionDelegate.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ClassesAndResourcesContentProvider.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeClassesTreeContentProvider.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeClassesTreeContentProvider.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeClassesTreeContentProvider.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeFilesTreeContentProvider.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeFilesTreeContentProvider.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeFilesTreeContentProvider.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeInDeploymentTreeViewer.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeInDeploymentTreeViewer.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/IncludeInDeploymentTreeViewer.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveBuilder.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlContentProvider.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlContentProvider.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlContentProvider.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymenEditorPage.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymentEditorPage.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymentEditorPage.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlDeploymentEditorPage.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlEditor.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlEditor.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/editor/JpdlEditor.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java	                        (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesConstants.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizardPage.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizardPage.java	2010-06-23 16:42:50 UTC (rev 22960)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizardPage.java	2010-06-23 16:55:53 UTC (rev 22961)
@@ -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();
 	}
 	
 }



More information about the jbosstools-commits mailing list