Author: koen.aers(a)jboss.com
Date: 2010-03-04 11:31:46 -0500 (Thu, 04 Mar 2010)
New Revision: 20673
Added:
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.flow.jpdl4.multipage/src/org/jboss/tools/flow/jpdl4/multipage/validator/Jpdl4Validator.java
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/Activator.java
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/Activator.java
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/AddJbpmInstallationDialog.java
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/JbpmLocationsPage.java
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/PreferencesManager.java
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/Plugin.java
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainerInitializer.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/NewProcessProjectDetailsWizardPage.java
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectWizard.java
Log:
JBIDE-5951: jBPM3 runtime from JBDS 2.1.1 workspace is missing when opened in 3.0.0 CR2
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/Activator.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/Activator.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/Activator.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -30,7 +30,7 @@
}
public PreferencesManager getPreferencesManager() {
- return PreferencesManager.INSTANCE;
+ return PreferencesManager.getInstance();
}
public void start(BundleContext context) throws Exception {
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.flow.jpdl4.multipage/src/org/jboss/tools/flow/jpdl4/multipage/validator/Jpdl4Validator.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.flow.jpdl4.multipage/src/org/jboss/tools/flow/jpdl4/multipage/validator/Jpdl4Validator.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.flow.jpdl4.multipage/src/org/jboss/tools/flow/jpdl4/multipage/validator/Jpdl4Validator.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -36,7 +36,7 @@
clearMarkers((IFile)resource);
ValidationResult validationResult = super.validate(resource, kind, state, monitor);
if (!(resource instanceof IFile) || resource == null) return validationResult;
- PreferencesManager manager = PreferencesManager.INSTANCE;
+ PreferencesManager manager = PreferencesManager.getInstance();
if (manager == null) return validationResult;
String jbpmName =
Activator.getDefault().getPluginPreferences().getString(Constants.JBPM_NAME);
if (jbpmName == null) return validationResult;
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/Activator.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/Activator.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/Activator.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -30,7 +30,7 @@
}
public PreferencesManager getPreferencesManager() {
- return PreferencesManager.INSTANCE;
+ return PreferencesManager.getInstance();
}
public void start(BundleContext context) throws Exception {
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/AddJbpmInstallationDialog.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/AddJbpmInstallationDialog.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/AddJbpmInstallationDialog.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -185,7 +185,7 @@
}
private boolean isNameAlreadyUsed() {
- return PreferencesManager.INSTANCE.getJbpmInstallation(nameText.getText()) != null;
+ return PreferencesManager.getInstance().getJbpmInstallation(nameText.getText()) !=
null;
}
private boolean isLocationExisting() {
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/JbpmLocationsPage.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/JbpmLocationsPage.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/JbpmLocationsPage.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -178,7 +178,7 @@
}
private void initializeInput(TableViewer viewer) {
- viewer.setInput(PreferencesManager.INSTANCE);
+ viewer.setInput(PreferencesManager.getInstance());
checkItemToCheck(viewer);
}
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/PreferencesManager.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/PreferencesManager.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jboss.tools.jbpm.common/src/org/jboss/tools/jbpm/preferences/PreferencesManager.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -43,9 +43,16 @@
private Map<String, JbpmInstallation> jbpmInstallations = null;
private File installationsFile = null;
- public static final PreferencesManager INSTANCE = new PreferencesManager();
+ private static PreferencesManager INSTANCE;
- private PreferencesManager() {
+ public static PreferencesManager getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new PreferencesManager();
+ }
+ return INSTANCE;
+ }
+
+ protected PreferencesManager() {
initializeInstallations();
}
@@ -63,7 +70,7 @@
return jbpmInstallations;
}
- private Preferences getPreferences() {
+ protected Preferences getPreferences() {
return Activator.getDefault().getPluginPreferences();
}
@@ -86,10 +93,10 @@
}
}
- private void loadInstallations() {
+ protected void loadInstallations(File installationsFile) {
Reader reader = null;
try {
- reader = new FileReader(getInstallationFile());
+ reader = new FileReader(installationsFile);
XMLMemento memento = XMLMemento.createReadRoot(reader);
IMemento[] children = memento.getChildren("installation");
for (int i = 0; i < children.length; i++) {
@@ -114,6 +121,10 @@
}
}
+ protected void loadInstallations() {
+ loadInstallations(getInstallationFile());
+ }
+
public void saveInstallations() {
XMLMemento memento = XMLMemento.createWriteRoot("installations");
Iterator<String> iterator = getJbpmInstallations().keySet().iterator();
Modified: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-03-04 16:22:15
UTC (rev 20672)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-03-04 16:31:46
UTC (rev 20673)
@@ -355,8 +355,9 @@
class="org.jbpm.gd.jpdl.util.JbpmClasspathContainerInitializer"
id="JBPM"/>
</extension>
-
- <extension
+
+
+ <extension
point="org.eclipse.ui.preferencePages">
<page class="org.jboss.tools.jbpm.preferences.DefaultPage"
id="org.jbpm.gd.jpdl.prefs.jbpm3"
@@ -367,9 +368,6 @@
id="org.jbpm.gd.jpdl.prefs.assignmentTypes"
name="Assignment Types"
category="org.jbpm.gd.jpdl.prefs.jbpm3">
- <enablement>
- <systemProperty name="MyTestProperty"
value="puppy"/>
- </enablement>
</page>
<page
class="org.jbpm.gd.jpdl.prefs.ServerDeploymentPage"
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/Plugin.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/Plugin.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/Plugin.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -25,6 +25,7 @@
import java.util.ResourceBundle;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jbpm.gd.jpdl.prefs.Jbpm3PreferencesManager;
import org.osgi.framework.BundleContext;
public class Plugin extends AbstractUIPlugin implements Constants {
@@ -45,6 +46,7 @@
public void start(BundleContext context) throws Exception {
super.start(context);
+ Jbpm3PreferencesManager.INSTANCE.getPreferredJbpmName();
}
public void stop(BundleContext context) throws Exception {
Added:
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
(rev 0)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -0,0 +1,62 @@
+/*
+ * 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 org.jboss.tools.jbpm.Constants;
+import org.jboss.tools.jbpm.preferences.PreferencesManager;
+import org.jbpm.gd.jpdl.Plugin;
+
+public class Jbpm3PreferencesManager extends PreferencesManager {
+
+ public static final Jbpm3PreferencesManager INSTANCE = new Jbpm3PreferencesManager();
+
+ protected Jbpm3PreferencesManager() {
+ super();
+ initialize();
+ }
+
+ void initialize() {
+ initializeInstallations();
+ initializePreferredJbpmName();
+ }
+
+ private void initializeInstallations() {
+ File installationsFile =
+ Plugin.getDefault().getStateLocation().append("jbpm-installations.xml").toFile();
+ if (installationsFile.exists()) {
+ loadInstallations(installationsFile);
+ saveInstallations();
+ loadInstallations();
+ }
+ installationsFile.delete();
+ }
+
+ private void initializePreferredJbpmName() {
+ String preferredJbpmName =
Plugin.getDefault().getPluginPreferences().getString(Constants.JBPM_NAME);
+ if (preferredJbpmName != null) {
+ setPreferredJbpmName(preferredJbpmName);
+ }
+ }
+
+}
Property changes on:
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Jbpm3PreferencesManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainerInitializer.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainerInitializer.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/JbpmClasspathContainerInitializer.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -28,15 +28,15 @@
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.Jbpm3PreferencesManager;
public class JbpmClasspathContainerInitializer extends
ClasspathContainerInitializer {
private JbpmInstallation getJbpmInstallation(IPath containerPath) {
String jbpmInstallationName = containerPath.lastSegment();
- return PreferencesManager.INSTANCE.getJbpmInstallation(jbpmInstallationName);
+ return Jbpm3PreferencesManager.INSTANCE.getJbpmInstallation(jbpmInstallationName);
}
public void initialize(IPath containerPath, IJavaProject project) throws CoreException
{
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-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessDefinitionWizard.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -48,9 +48,9 @@
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.Jbpm3PreferencesManager;
public class NewProcessDefinitionWizard extends Wizard implements INewWizard {
@@ -141,7 +141,7 @@
IProject project = page.getProcessFolder().getProject();
String jbpmName = project.getPersistentProperty(new QualifiedName("",
"jbpmName"));
if (jbpmName == null) return "";
- JbpmInstallation jbpmInstallation =
PreferencesManager.INSTANCE.getJbpmInstallation(jbpmName);
+ JbpmInstallation jbpmInstallation =
Jbpm3PreferencesManager.INSTANCE.getJbpmInstallation(jbpmName);
if (jbpmInstallation == null) return "";
String location =
VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(jbpmInstallation.location);
if (location == null) return "";
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectDetailsWizardPage.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectDetailsWizardPage.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectDetailsWizardPage.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -35,7 +35,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.jboss.tools.jbpm.preferences.JbpmInstallation;
-import org.jboss.tools.jbpm.preferences.PreferencesManager;
+import org.jbpm.gd.jpdl.prefs.Jbpm3PreferencesManager;
public class NewProcessProjectDetailsWizardPage extends WizardPage {
@@ -91,7 +91,7 @@
}
private void fillComboWithPreferenceRuntimes() {
- Map<String, JbpmInstallation> installations =
PreferencesManager.INSTANCE.getJbpmInstallationMap();
+ Map<String, JbpmInstallation> installations =
Jbpm3PreferencesManager.INSTANCE.getJbpmInstallationMap();
Iterator<String> iterator = installations.keySet().iterator();
int counter = 0;
while (iterator.hasNext()) {
@@ -100,7 +100,7 @@
if ("jBPM3".equals(installation.version)) {
counter++;
combo.add(next);
- if (PreferencesManager.INSTANCE.getPreferredJbpmName().equals(next)) {
+ if (Jbpm3PreferencesManager.INSTANCE.getPreferredJbpmName().equals(next)) {
combo.select(counter - 1);
}
}
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectWizard.java
===================================================================
---
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectWizard.java 2010-03-04
16:22:15 UTC (rev 20672)
+++
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/wizard/NewProcessProjectWizard.java 2010-03-04
16:31:46 UTC (rev 20673)
@@ -84,8 +84,8 @@
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.Jbpm3PreferencesManager;
import org.jbpm.gd.jpdl.util.JbpmClasspathContainer;
public class NewProcessProjectWizard extends Wizard implements INewWizard {
@@ -115,7 +115,7 @@
}
private boolean isJbpm3RuntimeAvailable() {
- Map<String, JbpmInstallation> installations =
PreferencesManager.INSTANCE.getJbpmInstallationMap();
+ Map<String, JbpmInstallation> installations =
Jbpm3PreferencesManager.INSTANCE.getJbpmInstallationMap();
Iterator<String> iterator = installations.keySet().iterator();
while (iterator.hasNext()) {
JbpmInstallation installation = installations.get(iterator.next());
@@ -191,7 +191,7 @@
}
private JbpmInstallation getJbpmInstallation() {
- return PreferencesManager.INSTANCE.getJbpmInstallation(getCoreJbpmName());
+ return Jbpm3PreferencesManager.INSTANCE.getJbpmInstallation(getCoreJbpmName());
}
private void createJbpmLibraryContainer(IJavaProject javaProject) throws
JavaModelException {
@@ -258,7 +258,7 @@
}
private void createSimpleProcessDefinition(IJavaProject javaProject) throws
CoreException, JavaModelException, IOException {
- JbpmInstallation jbpmInstallation =
PreferencesManager.INSTANCE.getJbpmInstallation(getCoreJbpmName());
+ JbpmInstallation jbpmInstallation =
Jbpm3PreferencesManager.INSTANCE.getJbpmInstallation(getCoreJbpmName());
if (jbpmInstallation == null) return;
// IFolder processesFolder = javaProject.getProject().getFolder("processes");
// if (!processesFolder.exists()) {
@@ -305,7 +305,7 @@
}
private void copyJbpmResources(IJavaProject javaProject) throws CoreException {
- JbpmInstallation jbpmInstallation =
PreferencesManager.INSTANCE.getJbpmInstallation(getCoreJbpmName());
+ JbpmInstallation jbpmInstallation =
Jbpm3PreferencesManager.INSTANCE.getJbpmInstallation(getCoreJbpmName());
if (jbpmInstallation == null) return;
String location =
VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(jbpmInstallation.location);
IFolder folder = javaProject.getProject().getFolder("src/main/config");
@@ -440,7 +440,7 @@
String name = configureRuntimePage.nameText.getText();
String location = configureRuntimePage.locationText.getText();
String version = "jBPM3";
- PreferencesManager.INSTANCE.initializeDefaultJbpmInstallation(name, location,
version);
+ Jbpm3PreferencesManager.INSTANCE.initializeDefaultJbpmInstallation(name, location,
version);
}
getContainer().updateButtons();
createJavaProject();