Author: koen.aers(a)jboss.com
Date: 2010-01-25 16:24:27 -0500 (Mon, 25 Jan 2010)
New Revision: 19918
Removed:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/AddJbpmInstallationDialog.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallation.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallationLabelProvider.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallationTableContentProvider.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmLocationsPage.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/LocationElementLabelProvider.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/LocationTableContentProvider.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesManager.java
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainer.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainerInitializer.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/VariableTableItemWrapper.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectDetailsWizardPage.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectWizard.java
Log:
JBIDE-4904, GPD-373 : Unification of jBPM Preference Pages
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-01-25 21:23:54 UTC (rev 19917)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-01-25 21:24:27 UTC (rev 19918)
@@ -350,11 +350,6 @@
name="jBPM 3"
category="org.jboss.tools.jbpm"/>
<page
- class="org.jbpm.gd.jpdl.prefs.JbpmLocationsPage"
- id="org.jbpm.gd.jpdl.prefs.jbpmLocations"
- name="Runtime Locations"
- category="org.jbpm.gd.jpdl.prefs.jbpm3"/>
- <page
class="org.jbpm.gd.jpdl.prefs.AssignmentTypesPage"
id="org.jbpm.gd.jpdl.prefs.assignmentTypes"
name="Assignment Types"
Deleted:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/AddJbpmInstallationDialog.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/AddJbpmInstallationDialog.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/AddJbpmInstallationDialog.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -1,250 +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.prefs;
-
-
-import java.io.File;
-import java.net.MalformedURLException;
-
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.io.SAXReader;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.StatusDialog;
-import org.eclipse.swt.SWT;
-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.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.jbpm.gd.jpdl.Plugin;
-
-public class AddJbpmInstallationDialog extends StatusDialog {
-
- private static final String pluginId =
Plugin.getDefault().getBundle().getSymbolicName();
-
- private static final IStatus enterNameStatus = new Status(
- Status.INFO, pluginId, 0, "Enter the name of the jBPM installation.",
null);
- private static final IStatus enterLocationStatus = new Status(
- Status.INFO, pluginId, 0, "Enter the location of the jBPM installation.",
null);
- private static final IStatus unExistingLocationStatus = new Status(
- Status.ERROR, pluginId, 0, "The location does not exist.", null);
- private static final IStatus nameAlreadyUsedStatus = new Status(
- Status.ERROR, pluginId, 0, "The name is already used.", null);
- private static final IStatus inValidJbpmInstallationStatus = new Status(
- Status.ERROR, pluginId, 0, "This is not a valid jBPM installation.", null);
-
- String title;
- Text nameText, locationText;
- Button locationButton;
-
- IStatus currentStatus = enterNameStatus;
-
- String name, location;
- IStatus status;
-
- public AddJbpmInstallationDialog(Shell parentShell) {
- super(parentShell);
- }
-
- public void initialize(String t, String n, String l) {
- this.title = t;
- this.name = n;
- this.location = l;
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite area = (Composite)super.createDialogArea(parent);
- getShell().setText(title);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- area.setLayout(gridLayout);
- createNameLabel(area);
- createNameText(area);
- createFillLabel(area);
- createLocationLabel(area);
- createLocationText(area);
- createLocationButton(area);
- getShell().setText(title);
- return area;
- }
-
- protected Control createContents(Composite parent) {
- Control result = super.createContents(parent);
- updateStatus(currentStatus);
- return result;
- }
-
- private void createLocationText(Composite area) {
- locationText = new Text(area, SWT.BORDER);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = convertWidthInCharsToPixels(40);
- locationText.setLayoutData(gridData);
- locationText.setText(location == null ? "" : location);
- locationText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- handleLocationChanged();
- }
- });
- }
-
- private void handleLocationChanged() {
- location = locationText.getText();
- updateCurrentStatus();
- updateStatus(currentStatus);
- }
-
- private void createLocationButton(Composite area) {
- locationButton = new Button(area, SWT.PUSH);
- locationButton.setText("Search...");
- locationButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchLocation();
- }
- });
- }
-
- private void searchLocation() {
- DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN);
- String result = dialog.open();
- if (result != null) {
- locationText.setText(result);
- }
- }
-
- private void createLocationLabel(Composite area) {
- Label label = new Label(area, SWT.NONE);
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- label.setLayoutData(gridData);
- label.setText("Location :");
- }
-
- private void createFillLabel(Composite area) {
- new Label(area, SWT.NONE);
- }
-
- private void createNameText(Composite area) {
- nameText = new Text(area, SWT.BORDER);
- GridData gridData = new GridData();
- gridData.verticalIndent = 10;
- gridData.widthHint = convertWidthInCharsToPixels(40);
- nameText.setLayoutData(gridData);
- nameText.setText(name == null ? "" : name);
- nameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- handleNameChanged();
- }
- });
- }
-
- private void handleNameChanged() {
- name = nameText.getText();
- updateCurrentStatus();
- updateStatus(currentStatus);
- }
-
- private void updateCurrentStatus() {
- if (isNameEmpty() && isLocationEmpty()) {
- currentStatus = enterNameStatus;
- } else if (isNameAlreadyUsed() && !"Edit Location".equals(title)) {
- currentStatus = nameAlreadyUsedStatus;
- } else if (isLocationEmpty()) {
- currentStatus = enterLocationStatus;
- } else if (!isLocationExisting()) {
- currentStatus = unExistingLocationStatus;
- } else if (!isValidJbpmInstallation()) {
- currentStatus = inValidJbpmInstallationStatus;
- } else if (isNameEmpty()) {
- currentStatus = enterNameStatus;
- } else {
- currentStatus = Status.OK_STATUS;
- }
- }
-
- private boolean isNameAlreadyUsed() {
- return PreferencesManager.INSTANCE.getJbpmInstallation(nameText.getText()) != null;
- }
-
- private boolean isLocationExisting() {
- return new Path(location).toFile().exists();
- }
-
- private boolean isNameEmpty() {
- return name == null || "".equals(name);
- }
-
- private boolean isLocationEmpty() {
- return location == null || "".equals(location);
- }
-
- private boolean isValidJbpmInstallation() {
- return getJbpmVersionInfoFile().exists();
- }
-
- private File getJbpmVersionInfoFile() {
- return new
Path(location).append("/src/resources/gpd/version.info.xml").toFile();
- }
-
- protected void updateButtonsEnableState(IStatus status) {
- Button ok = getButton(IDialogConstants.OK_ID);
- if (ok != null && !ok.isDisposed())
- ok.setEnabled(status.getSeverity() == IStatus.OK);
- }
-
- private void createNameLabel(Composite area) {
- Label label = new Label(area, SWT.NONE);
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- label.setLayoutData(gridData);
- label.setText("Name :");
- }
-
- public String getName() {
- return name;
- }
-
- public String getLocation() {
- return location;
- }
-
- public String getVersion() {
- String result = "3.1";
- try {
- Document document = new SAXReader().read(getJbpmVersionInfoFile());
- result = document.getRootElement().attribute("name").getValue();
- }
- catch (DocumentException e) {}
- catch (MalformedURLException e) {}
- return result;
- }
-
-}
Deleted:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallation.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallation.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallation.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -1,30 +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.prefs;
-
-public class JbpmInstallation {
-
- public String location;
- public String version;
- public String name;
-
-}
Deleted:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallationLabelProvider.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallationLabelProvider.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallationLabelProvider.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -1,45 +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.prefs;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-public class JbpmInstallationLabelProvider extends LabelProvider implements
- ITableLabelProvider {
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- JbpmInstallation installation = (JbpmInstallation)element;
- switch (columnIndex) {
- case 0: return installation.name;
- case 1: return installation.version;
- case 2: return installation.location;
- default: return null;
- }
- }
-
-}
Deleted:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallationTableContentProvider.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallationTableContentProvider.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmInstallationTableContentProvider.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -1,42 +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.prefs;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class JbpmInstallationTableContentProvider implements IStructuredContentProvider
{
-
- PreferencesManager inputManager;
-
- public Object[] getElements(Object inputElement) {
- return inputManager.getJbpmInstallationMap().values().toArray();
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- inputManager = (PreferencesManager)newInput;
- }
-
-}
Deleted:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmLocationsPage.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmLocationsPage.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/JbpmLocationsPage.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -1,327 +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.prefs;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.jboss.tools.jbpm.util.AutoResizeTableLayout;
-import org.jbpm.gd.jpdl.Constants;
-import org.jbpm.gd.jpdl.Plugin;
-
-public class JbpmLocationsPage extends PreferencePage implements
IWorkbenchPreferencePage, Constants {
-
- private TableViewer tableViewer;
- private Button addButton, editButton, removeButton;
-
- public JbpmLocationsPage() {
- super();
- setPreferenceStore(Plugin.getDefault().getPreferenceStore());
- }
-
- protected Control createContents(Composite parent) {
- Composite clientArea = createClientArea(parent);
- createLabels(clientArea);
- createJbpmHomeListTable(clientArea);
- createButtons(clientArea);
- return null;
- }
-
- private void createButtons(Composite parent) {
- GridData gridData = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
- gridData.widthHint = 80;
- addButton = new Button(parent, SWT.PUSH);
- addButton.setText("Add...");
- addButton.setLayoutData(gridData);
- addButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- addNewLocation();
- }
- });
- editButton = new Button(parent, SWT.PUSH);
- editButton.setText("Edit...");
- editButton.setLayoutData(gridData);
- editButton.setEnabled(false);
- editButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- editLocation();
- }
- });
- removeButton = new Button(parent, SWT.PUSH);
- removeButton.setText("Remove");
- removeButton.setLayoutData(gridData);
- removeButton.setEnabled(false);
- removeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- removeLocation();
- }
- });
- }
-
- private void removeLocation() {
- TableItem item = tableViewer.getTable().getSelection()[0];
- String name = item.getText(0);
- PreferencesManager inputManager =
- (PreferencesManager)tableViewer.getInput();
- JbpmInstallation installation = inputManager.getJbpmInstallation(name);
- inputManager.getJbpmInstallationMap().remove(name);
- tableViewer.remove(installation);
- updateButtons();
- updateStatus();
- }
-
- private void editLocation() {
- TableItem item = tableViewer.getTable().getSelection()[0];
- String name = item.getText(0);
- PreferencesManager inputManager =
- (PreferencesManager)tableViewer.getInput();
- JbpmInstallation jbpmInstallation = inputManager.getJbpmInstallation(name);
- AddJbpmInstallationDialog dialog = new AddJbpmInstallationDialog(getShell());
- dialog.initialize("Edit Location", jbpmInstallation.name,
jbpmInstallation.location);
- if (dialog.open() == IDialogConstants.OK_ID) {
- jbpmInstallation.name = dialog.getName();
- jbpmInstallation.version = dialog.getVersion();
- jbpmInstallation.location = dialog.getLocation();
- tableViewer.update(jbpmInstallation, null);
- if (name != dialog.getName()) {
- inputManager.getJbpmInstallationMap().remove(name);
- inputManager.getJbpmInstallationMap().put(dialog.getName(), jbpmInstallation);
- }
- }
- updateButtons();
- }
-
- private void addNewLocation() {
- AddJbpmInstallationDialog dialog = new AddJbpmInstallationDialog(getShell());
- dialog.initialize("Add Location", "", "");
- if (dialog.open() == IDialogConstants.OK_ID) {
- PreferencesManager inputManager =
- (PreferencesManager)tableViewer.getInput();
- JbpmInstallation jbpmInstallation = getJbpmInstallation(dialog);
- inputManager.getJbpmInstallationMap().put(jbpmInstallation.name, jbpmInstallation);
- tableViewer.add(jbpmInstallation);
- }
- updateButtons();
- }
-
- private JbpmInstallation getJbpmInstallation(AddJbpmInstallationDialog dialog) {
- JbpmInstallation jbpmInstallation = new JbpmInstallation();
- jbpmInstallation.name = dialog.getName();
- jbpmInstallation.location = dialog.getLocation();
- jbpmInstallation.version = dialog.getVersion();
- return jbpmInstallation;
- }
-
- private Composite createClientArea(Composite parent) {
- Composite clientArea = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- clientArea.setLayout(layout);
- GridData gridData = new GridData(GridData.FILL_BOTH);
- clientArea.setLayoutData(gridData);
- return clientArea;
- }
-
- public void init(IWorkbench workbench) {
- }
-
- private void createJbpmHomeListTable(Composite parent) {
- tableViewer = new TableViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION |
SWT.CHECK);
- tableViewer.setContentProvider(new JbpmInstallationTableContentProvider());
- tableViewer.setLabelProvider(new JbpmInstallationLabelProvider());
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.verticalSpan = 3;
- gridData.heightHint = 200;
- tableViewer.getControl().setLayoutData(gridData);
- initializeTable(tableViewer);
- createTableColumns(tableViewer);
- initializeInput(tableViewer);
- }
-
- private void initializeInput(TableViewer viewer) {
- viewer.setInput(PreferencesManager.INSTANCE);
- checkItemToCheck(viewer);
- }
-
- private void checkItemToCheck(TableViewer viewer) {
- String name = getPreferences().getString(JBPM_NAME);
- if (name != null) {
- TableItem tableItem = getItemToCheck(viewer, name);
- if (tableItem != null) {
- tableItem.setChecked(true);
- }
- }
- }
-
- private TableItem getItemToCheck(TableViewer viewer, String name) {
- TableItem[] items = viewer.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- if (name.equals(items[i].getText(0))) return items[i];
- }
- return null;
- }
-
- private void createTableColumns(TableViewer viewer) {
- Table table = viewer.getTable();
- TableColumn nameColumn = new TableColumn(table, SWT.LEFT);
- nameColumn.setText("Name");
- ColumnWeightData nameColumnData = new ColumnWeightData(30);
- AutoResizeTableLayout layout = (AutoResizeTableLayout)table.getLayout();
- layout.addColumnData(nameColumnData);
- TableColumn versionColumn = new TableColumn(table, SWT.LEFT);
- versionColumn.setText("Version");
- ColumnWeightData versionColumnData = new ColumnWeightData(30);
- layout.addColumnData(versionColumnData);
- TableColumn locationColumn = new TableColumn(table, SWT.LEFT);
- locationColumn.setText("Location");
- ColumnWeightData locationColumnData = new ColumnWeightData(40);
- layout.addColumnData(locationColumnData);
- }
-
- private void initializeTable(TableViewer viewer) {
- Table table = viewer.getTable();
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- table.setLayout(new AutoResizeTableLayout(table));
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateSelection(e);
- }
- });
- }
-
- private void updateSelection(SelectionEvent e) {
- if (e.detail == SWT.CHECK) {
- updateChecks(e);
- } else {
- updateButtons();
- }
- updateStatus();
- }
-
- private void updateChecks(SelectionEvent e) {
- Table table = tableViewer.getTable();
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i++) {
- if (e.item != items[i]) {
- items[i].setChecked(false);
- }
- }
- }
-
- private void updateStatus() {
- TableItem item = getCheckedItem();
- if (item != null) {
- setErrorMessage(null);
- setValid(true);
- } else {
- setErrorMessage("Select a default jBPM installation.");
- setValid(false);
- }
- }
-
- private TableItem getCheckedItem() {
- TableItem[] items = tableViewer.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- if (items[i].getChecked()) {
- return items[i];
- }
- }
- return null;
- }
-
- private void updateButtons() {
- Table table = tableViewer.getTable();
- TableItem[] selection = table.getSelection();
- editButton.setEnabled(selection.length == 1);
- removeButton.setEnabled(selection.length == 1 && table.getItemCount() > 1);
- }
-
- private void createLabels(Composite parent) {
- GridData infoLabelGridData = new GridData(GridData.FILL_HORIZONTAL);
- infoLabelGridData.horizontalSpan = 2;
- Label infoLabel = new Label(parent, SWT.NONE);
- infoLabel.setText(
- "Add, remove or edit JBoss jBPM installation locations.\n" +
- "The checked location will be used by the jBPM creation wizards.");
- infoLabel.setLayoutData(infoLabelGridData);
- GridData tableLabelGridData = new GridData(SWT.BEGINNING, SWT.END, false, false);
- tableLabelGridData.horizontalSpan = 2;
- Label tableLabel = new Label(parent, SWT.NONE);
- tableLabel.setText("jBPM Installation Locations:");
- tableLabel.setLayoutData(tableLabelGridData);
- }
-
- public boolean performOk() {
- String name = "";
- PreferencesManager inputManager =
- (PreferencesManager)tableViewer.getInput();
- inputManager.saveInstallations();
- TableItem item = getCheckedItem(tableViewer);
- if (item != null) {
- name = item.getText(0);
- }
- getPreferences().setValue(JBPM_NAME, name);
- return true;
- }
-
- private TableItem getCheckedItem(TableViewer viewer) {
- TableItem[] items = viewer.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- if (items[i].getChecked()) return items[i];
- }
- return null;
- }
-
- public void performDefaults() {
- getPreferences().setToDefault(JBPM_NAME);
- PreferencesManager inputManager =
- (PreferencesManager)tableViewer.getInput();
- inputManager.getJbpmInstallationMap().clear();
- tableViewer.setInput(inputManager);
- checkItemToCheck(tableViewer);
- setMessage("");
- updateButtons();
- setValid(true);
- }
-
- private Preferences getPreferences() {
- return Plugin.getDefault().getPluginPreferences();
- }
-
-}
Deleted:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/LocationElementLabelProvider.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/LocationElementLabelProvider.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/LocationElementLabelProvider.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -1,47 +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.prefs;
-
-import java.util.Map;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-public class LocationElementLabelProvider extends LabelProvider implements
- ITableLabelProvider {
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- JbpmInstallation installation = (JbpmInstallation)((Map.Entry)element).getValue();
- switch (columnIndex) {
- case 0: return installation.name;
- case 1: return installation.version;
- case 2: return installation.location;
- default: return null;
- }
- }
-
-}
Deleted:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/LocationTableContentProvider.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/LocationTableContentProvider.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/LocationTableContentProvider.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -1,42 +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.prefs;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class LocationTableContentProvider implements IStructuredContentProvider {
-
- PreferencesManager inputManager;
-
- public Object[] getElements(Object inputElement) {
- return inputManager.getJbpmInstallationMap().values().toArray();
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- inputManager = (PreferencesManager)newInput;
- }
-
-}
Deleted:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesManager.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesManager.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/PreferencesManager.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -1,176 +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.prefs;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.XMLMemento;
-import org.jbpm.gd.jpdl.Constants;
-import org.jbpm.gd.jpdl.Plugin;
-
-public class PreferencesManager implements Constants {
-
- public static final PreferencesManager INSTANCE = new PreferencesManager();
-
- private Map jbpmInstallations = null;
- private File installationsFile = null;
-
- private PreferencesManager() {
- initializeInstallations();
- }
-
- private File getInstallationFile() {
- if (installationsFile == null) {
- initializeInstallations();
- }
- return installationsFile;
- }
-
- private Map getJbpmInstallations() {
- if (jbpmInstallations == null) {
- jbpmInstallations = new HashMap();
- }
- return jbpmInstallations;
- }
-
- private static Preferences getPreferences() {
- return Plugin.getDefault().getPluginPreferences();
- }
-
- private void initializeInstallations() {
- installationsFile =
- Plugin.getDefault().getStateLocation().append("jbpm-installations.xml").toFile();
- if (!installationsFile.exists()) {
- createInstallationsFile();
- } else {
- loadInstallations();
- }
- }
-
- private void createInstallationsFile() {
- try {
- installationsFile.createNewFile();
- saveInstallations();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- private void loadInstallations() {
- Reader reader = null;
- try {
- reader = new FileReader(getInstallationFile());
- XMLMemento memento = XMLMemento.createReadRoot(reader);
- IMemento[] children = memento.getChildren("installation");
- for (int i = 0; i < children.length; i++) {
- JbpmInstallation installation = new JbpmInstallation();
- installation.name = children[i].getString("name");
- installation.location = children[i].getString("location");
- installation.version = children[i].getString("version");
- getJbpmInstallations().put(installation.name, installation);
- }
- } catch (WorkbenchException e) {
- e.printStackTrace();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } finally {
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- public void saveInstallations() {
- XMLMemento memento = XMLMemento.createWriteRoot("installations");
- Iterator iterator = getJbpmInstallations().keySet().iterator();
- while (iterator.hasNext()) {
- String name = (String)iterator.next();
- JbpmInstallation installation = (JbpmInstallation)getJbpmInstallations().get(name);
- IMemento child = memento.createChild("installation");
- child.putString("name", installation.name);
- child.putString("location", installation.location);
- child.putString("version", installation.version);
- }
- FileWriter writer = null;
- try {
- writer = new FileWriter(getInstallationFile());
- memento.save(writer);
- } catch (IOException e) {
- e.printStackTrace();
- }
- finally {
- try {
- if (writer != null) {
- writer.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- public Map getJbpmInstallationMap() {
- return getJbpmInstallations();
- }
-
- public JbpmInstallation getJbpmInstallation(String name) {
- return (JbpmInstallation)getJbpmInstallations().get(name);
- }
-
- public String getPreferredJbpmName() {
- return getPreferences().getString(JBPM_NAME);
- }
-
- public void setPreferredJbpmName(String name) {
- getPreferences().setDefault(JBPM_NAME, name);
- }
-
- public void addJbpmInstallation(String name, String location, String version) {
- JbpmInstallation installation = new JbpmInstallation();
- installation.name = name;
- installation.location = location;
- installation.version = version;
- getJbpmInstallationMap().put(name, installation);
- }
-
- public void initializeDefaultJbpmInstallation(String name, String location, String
version) {
- setPreferredJbpmName(name);
- addJbpmInstallation(name, location, version);
- saveInstallations();
- }
-
-}
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -161,7 +161,7 @@
passwordText.setText(null);
getPreferenceStore().setValue("server name", "localhost");
getPreferenceStore().setValue("server port", "8080");
- getPreferenceStore().setValue("server deployer",
"jbpm-console/upload");
+ getPreferenceStore().setValue("server deployer",
"/jbpm-console/upload");
getPreferenceStore().setValue("use credentials", false);
getPreferenceStore().setValue("user name", "");
getPreferenceStore().setValue("password", "");
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainer.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainer.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainer.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -41,9 +41,9 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.jbpm.preferences.JbpmInstallation;
import org.jbpm.gd.jpdl.Constants;
import org.jbpm.gd.jpdl.Logger;
-import org.jbpm.gd.jpdl.prefs.JbpmInstallation;
public class JbpmClasspathContainer implements IClasspathContainer, Constants {
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainerInitializer.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainerInitializer.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainerInitializer.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -27,9 +27,9 @@
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.jbpm.preferences.JbpmInstallation;
+import org.jboss.tools.jbpm.preferences.PreferencesManager;
import org.jbpm.gd.jpdl.Logger;
-import org.jbpm.gd.jpdl.prefs.JbpmInstallation;
-import org.jbpm.gd.jpdl.prefs.PreferencesManager;
public class JbpmClasspathContainerInitializer extends
ClasspathContainerInitializer {
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/VariableTableItemWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/VariableTableItemWrapper.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/VariableTableItemWrapper.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -153,6 +153,7 @@
private void applyMappedName() {
mappedNameText.setVisible(false);
+ variable.setMappedName(mappedNameText.getText());
tableItem.setText(2, getMappedName());
}
@@ -162,6 +163,7 @@
private void applyName() {
nameText.setVisible(false);
+ variable.setName(nameText.getText());
tableItem.setText(1, getName());
}
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/ConfigureRuntimePage.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -22,11 +22,7 @@
package org.jbpm.gd.jpdl.wizard;
import java.io.File;
-import java.net.MalformedURLException;
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.io.SAXReader;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -47,13 +43,13 @@
public class ConfigureRuntimePage extends WizardPage {
- private static final String ENTER_NAME_MSG = "Choose a name for the JBoss jBPM
Runtime, e.g. 'jBPM jPDL 3.2.2'";
- private static final String ENTER_LOCATION_MSG = "Enter or search a location for
the JBoss jBPM Runtime";
+ private static final String ENTER_NAME_MSG = "Choose a name for the jBPM 3 Runtime,
e.g. 'jBPM jPDL 3.2.2'";
+ private static final String ENTER_LOCATION_MSG = "Enter or search a location for
the jBPM 3 Runtime";
private static final String CONTINUE_MSG = "Press next to continue the project
creation";
private static final String UNEXISTING_LOCATION_MSG = "This location does not
exist";
- private static final String INVALID_LOCATION_MSG = "This location does not contain
a valid JBoss jBPM runtime, please retry";
+ private static final String INVALID_LOCATION_MSG = "This location does not contain
a valid jBPM 3 runtime, please retry";
- Text nameText, locationText, versionText;
+ Text nameText, locationText;
public ConfigureRuntimePage() {
super("Configure JBoss jBPM Runtime");
@@ -71,12 +67,11 @@
private void update() {
updateMessage();
- updateVersion();
updatePages();
}
private void updatePages() {
- setPageComplete(!isNameEmpty() && !isLocationEmpty() &&
!isVersionEmpty());
+ setPageComplete(!isNameEmpty() && !isLocationEmpty());
if (!isNameEmpty()) {
NewProcessProjectDetailsWizardPage page =
(NewProcessProjectDetailsWizardPage)getNextPage();
page.combo.removeAll();
@@ -113,17 +108,8 @@
group.setLayoutData(gridData);
createJbpmRuntimeNameField(group);
createJbpmRuntimeLocationField(group);
- createJbpmRuntimeVersionField(group);
}
- private void createJbpmRuntimeVersionField(Composite composite) {
- Label versionLabel = new Label(composite, SWT.NONE);
- versionLabel.setText("Version :");
- versionText = new Text(composite, SWT.BORDER);
- versionText.setEditable(false);
- versionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
private void createJbpmRuntimeNameField(Composite composite) {
Label nameLabel = new Label(composite, SWT.NONE);
nameLabel.setText("Name :");
@@ -182,7 +168,7 @@
setMessage(ENTER_LOCATION_MSG);
} else if (!isLocationExisting()) {
setErrorMessage(UNEXISTING_LOCATION_MSG);
- } else if (!isValidJbpmInstallation()) {
+ } else if (!isValidJbpm3Installation()) {
setErrorMessage(INVALID_LOCATION_MSG);
} else if (isNameEmpty()) {
setMessage(ENTER_NAME_MSG);
@@ -191,29 +177,6 @@
}
}
- private void updateVersion() {
- String version = getVersion();
- if (version != null) {
- versionText.setText(version);
- }
- }
-
- private String getVersion() {
- String result = null;
- File versionInfoFile;
- if (!isLocationEmpty() && isLocationExisting() &&
isValidJbpmInstallation()) {
- versionInfoFile = getJbpmVersionInfoFile();
- if (versionInfoFile == null) return result;
- try {
- Document document = new SAXReader().read(versionInfoFile);
- result = document.getRootElement().attribute("name").getValue();
- }
- catch (DocumentException e) {}
- catch (MalformedURLException e) {}
- }
- return result;
- }
-
private boolean isNameEmpty() {
String text = nameText.getText();
return text == null || "".equals(text);
@@ -224,16 +187,11 @@
return text == null || "".equals(text);
}
- private boolean isVersionEmpty() {
- String text = versionText.getText();
- return text == null || "".equals(text);
- }
-
private boolean isLocationExisting() {
return new Path(locationText.getText()).toFile().exists();
}
- private boolean isValidJbpmInstallation() {
+ private boolean isValidJbpm3Installation() {
return getJbpmVersionInfoFile().exists();
}
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -47,10 +47,10 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+import org.jboss.tools.jbpm.preferences.JbpmInstallation;
+import org.jboss.tools.jbpm.preferences.PreferencesManager;
import org.jbpm.gd.jpdl.Logger;
import org.jbpm.gd.jpdl.Plugin;
-import org.jbpm.gd.jpdl.prefs.JbpmInstallation;
-import org.jbpm.gd.jpdl.prefs.PreferencesManager;
public class NewProcessDefinitionWizard extends Wizard implements INewWizard {
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectDetailsWizardPage.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectDetailsWizardPage.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectDetailsWizardPage.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -22,6 +22,7 @@
package org.jbpm.gd.jpdl.wizard;
import java.util.Iterator;
+import java.util.Map;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -33,7 +34,8 @@
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
-import org.jbpm.gd.jpdl.prefs.PreferencesManager;
+import org.jboss.tools.jbpm.preferences.JbpmInstallation;
+import org.jboss.tools.jbpm.preferences.PreferencesManager;
public class NewProcessProjectDetailsWizardPage extends WizardPage {
@@ -89,14 +91,18 @@
}
private void fillComboWithPreferenceRuntimes() {
- Iterator iterator =
PreferencesManager.INSTANCE.getJbpmInstallationMap().keySet().iterator();
+ Map<String, JbpmInstallation> installations =
PreferencesManager.INSTANCE.getJbpmInstallationMap();
+ Iterator<String> iterator = installations.keySet().iterator();
int counter = 0;
while (iterator.hasNext()) {
- counter++;
- String next = (String)iterator.next();
- combo.add(next);
- if (PreferencesManager.INSTANCE.getPreferredJbpmName().equals(next)) {
- combo.select(counter - 1);
+ String next = iterator.next();
+ JbpmInstallation installation = installations.get(next);
+ if ("jBPM3".equals(installation.version)) {
+ counter++;
+ combo.add(next);
+ if (PreferencesManager.INSTANCE.getPreferredJbpmName().equals(next)) {
+ combo.select(counter - 1);
+ }
}
}
}
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectWizard.java
===================================================================
---
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectWizard.java 2010-01-25
21:23:54 UTC (rev 19917)
+++
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectWizard.java 2010-01-25
21:24:27 UTC (rev 19918)
@@ -32,6 +32,7 @@
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@@ -82,9 +83,9 @@
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import org.eclipse.ui.part.ISetSelectionTarget;
+import org.jboss.tools.jbpm.preferences.JbpmInstallation;
+import org.jboss.tools.jbpm.preferences.PreferencesManager;
import org.jbpm.gd.jpdl.Logger;
-import org.jbpm.gd.jpdl.prefs.JbpmInstallation;
-import org.jbpm.gd.jpdl.prefs.PreferencesManager;
import org.jbpm.gd.jpdl.util.JbpmClasspathContainer;
public class NewProcessProjectWizard extends Wizard implements INewWizard {
@@ -107,14 +108,22 @@
public void addPages() {
addMainPage();
- if (!isRuntimeAvailable()) {
+ if (!isJbpm3RuntimeAvailable()) {
addConfigureRuntimePage();
}
addChooseRuntimePage();
}
- private boolean isRuntimeAvailable() {
- return !PreferencesManager.INSTANCE.getJbpmInstallationMap().isEmpty();
+ private boolean isJbpm3RuntimeAvailable() {
+ Map<String, JbpmInstallation> installations =
PreferencesManager.INSTANCE.getJbpmInstallationMap();
+ Iterator<String> iterator = installations.keySet().iterator();
+ while (iterator.hasNext()) {
+ JbpmInstallation installation = installations.get(iterator.next());
+ if ("jBPM3".equals(installation.version)) {
+ return true;
+ }
+ }
+ return false;
}
private void addConfigureRuntimePage() {
@@ -427,10 +436,10 @@
}
public boolean performFinish() {
- if (!isRuntimeAvailable()) {
+ if (!isJbpm3RuntimeAvailable()) {
String name = configureRuntimePage.nameText.getText();
String location = configureRuntimePage.locationText.getText();
- String version = configureRuntimePage.versionText.getText();
+ String version = "jBPM3";
PreferencesManager.INSTANCE.initializeDefaultJbpmInstallation(name, location,
version);
}
getContainer().updateButtons();