JBoss Tools SVN: r25062 - in trunk/usage: plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-09-21 11:24:25 -0400 (Tue, 21 Sep 2010)
New Revision: 25062
Added:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferences.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencesUtils.java
Removed:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/AbstractEclipseEnvironment.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferenceInitializer.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GlobalUsageSettingsTest.java
Log:
usage reporting: renamed and moved preferences classes
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/AbstractEclipseEnvironment.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/AbstractEclipseEnvironment.java 2010-09-21 15:22:34 UTC (rev 25061)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/AbstractEclipseEnvironment.java 2010-09-21 15:24:25 UTC (rev 25062)
@@ -21,7 +21,7 @@
import org.jboss.tools.usage.googleanalytics.IUserAgent;
import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
-import org.jboss.tools.usage.util.PreferencesUtils;
+import org.jboss.tools.usage.preferences.UsageReportPreferencesUtils;
/**
* @author Andre Dietisheim
@@ -117,7 +117,7 @@
if (userId == null) {
userId = createIdentifier();
preferences.put(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID, userId);
- PreferencesUtils.checkedSavePreferences(preferences, JBossToolsUsageActivator.getDefault(),
+ UsageReportPreferencesUtils.checkedSavePreferences(preferences, JBossToolsUsageActivator.getDefault(),
GoogleAnalyticsEclipseMessages.EclipseEnvironment_Error_SavePreferences);
}
return userId;
@@ -159,7 +159,7 @@
currentVisit = String.valueOf(System.currentTimeMillis());
visitCount++;
preferences.putLong(IUsageReportPreferenceConstants.VISIT_COUNT, visitCount);
- PreferencesUtils.checkedSavePreferences(preferences, JBossToolsUsageActivator.getDefault(),
+ UsageReportPreferencesUtils.checkedSavePreferences(preferences, JBossToolsUsageActivator.getDefault(),
GoogleAnalyticsEclipseMessages.EclipseEnvironment_Error_SavePreferences);
}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferenceInitializer.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferenceInitializer.java 2010-09-21 15:22:34 UTC (rev 25061)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferenceInitializer.java 2010-09-21 15:24:25 UTC (rev 25062)
@@ -11,7 +11,6 @@
package org.jboss.tools.usage.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.jboss.tools.usage.util.PreferencesUtils;
/**
* @author Andre Dietisheim
@@ -20,11 +19,11 @@
AbstractPreferenceInitializer {
public void initializeDefaultPreferences() {
- PreferencesUtils.getStore().setDefault(
+ UsageReportPreferencesUtils.getStore().setDefault(
IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID,
IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_DEFAULTVALUE);
- PreferencesUtils.getStore().setDefault(
+ UsageReportPreferencesUtils.getStore().setDefault(
IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID,
IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_DEFAULTVALUE);
}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java 2010-09-21 15:22:34 UTC (rev 25061)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java 2010-09-21 15:24:25 UTC (rev 25062)
@@ -16,7 +16,6 @@
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
-import org.jboss.tools.usage.reporting.UsageReportPreferences;
import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.service.prefs.BackingStoreException;
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferences.java (from rev 25055, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferences.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferences.java 2010-09-21 15:24:25 UTC (rev 25062)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.preferences;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
+import org.jboss.tools.usage.reporting.ReportingMessages;
+import org.jboss.tools.usage.util.StatusUtils;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class UsageReportPreferences {
+
+ public static void setEnabled(boolean enabled) {
+ UsageReportPreferencesUtils.getStore().putValue(
+ IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID, String.valueOf(enabled));
+ }
+
+ public static boolean isEnabled() {
+ return UsageReportPreferencesUtils.getPreferences().getBoolean(
+ IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID,
+ IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_DEFAULTVALUE);
+ }
+
+ public static boolean isAskUser() {
+ return UsageReportPreferencesUtils.getPreferences().getBoolean(
+ IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID,
+ IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_DEFAULTVALUE);
+ }
+
+ public static void setAskUser(boolean askUser) {
+ try {
+ IEclipsePreferences preferences = UsageReportPreferencesUtils.getPreferences();
+ preferences.putBoolean(IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID, askUser);
+ preferences.flush();
+ } catch (BackingStoreException e) {
+ JBossToolsUsageActivator.getDefault().getLog().log(
+ StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID,
+ ReportingMessages.UsageReport_Error_SavePreferences, e,
+ IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID));
+ }
+ }
+
+ public static void flush() throws BackingStoreException {
+ UsageReportPreferencesUtils.getPreferences().flush();
+ }
+
+ public static IPreferenceStore createPreferenceStore() {
+ return UsageReportPreferencesUtils.getStore();
+ }
+}
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencesUtils.java (from rev 25055, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencesUtils.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencesUtils.java 2010-09-21 15:24:25 UTC (rev 25062)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.preferences;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
+import org.jboss.tools.usage.util.StatusUtils;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class UsageReportPreferencesUtils {
+
+ private UsageReportPreferencesUtils() {
+ // inhibit instantiation
+ }
+
+ public static IEclipsePreferences getPreferences() {
+ return new ConfigurationScope().getNode(JBossToolsUsageActivator.PLUGIN_ID);
+ }
+
+ public static IPersistentPreferenceStore getStore() {
+ return new ScopedPreferenceStore(new ConfigurationScope(), JBossToolsUsageActivator.PLUGIN_ID);
+ }
+
+ public static void checkedSavePreferences(IEclipsePreferences preferences, Plugin plugin, String message) {
+ try {
+ preferences.flush();
+ } catch (BackingStoreException e) {
+ IStatus status = StatusUtils.getErrorStatus(plugin.getBundle().getSymbolicName(),
+ message,
+ e, preferences.absolutePath());
+ plugin.getLog().log(status);
+ }
+
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencesUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java 2010-09-21 15:22:34 UTC (rev 25061)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java 2010-09-21 15:24:25 UTC (rev 25062)
@@ -32,7 +32,8 @@
import org.jboss.tools.usage.http.IHttpGetRequest;
import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
import org.jboss.tools.usage.preferences.GlobalUsageSettings;
-import org.jboss.tools.usage.util.PreferencesUtils;
+import org.jboss.tools.usage.preferences.UsageReportPreferences;
+import org.jboss.tools.usage.preferences.UsageReportPreferencesUtils;
import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.service.prefs.BackingStoreException;
@@ -88,7 +89,7 @@
IGoogleAnalyticsParameters eclipseEnvironment = new ReportingEclipseEnvironment(
GANALYTICS_ACCOUNTNAME
, HOST_NAME
- , PreferencesUtils.getPreferences());
+ , UsageReportPreferencesUtils.getPreferences());
ILoggingAdapter loggingAdapter = new PluginLogger(JBossToolsUsageActivator.getDefault());
IURLBuildingStrategy urlStrategy = new GoogleAnalyticsUrlStrategy(eclipseEnvironment);
IHttpGetRequest httpGetRequest = new HttpGetRequest(eclipseEnvironment.getUserAgent(), loggingAdapter);
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java 2010-09-21 15:22:34 UTC (rev 25061)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java 2010-09-21 15:24:25 UTC (rev 25062)
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.reporting;
-
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
-import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
-import org.jboss.tools.usage.util.PreferencesUtils;
-import org.jboss.tools.usage.util.StatusUtils;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * @author Andre Dietisheim
- */
-public class UsageReportPreferences {
-
- public static void setEnabled(boolean enabled) {
- PreferencesUtils.getStore().putValue(
- IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID, String.valueOf(enabled));
- }
-
- public static boolean isEnabled() {
- return PreferencesUtils.getPreferences().getBoolean(
- IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID,
- IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_DEFAULTVALUE);
- }
-
- public static boolean isAskUser() {
- return PreferencesUtils.getPreferences().getBoolean(
- IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID,
- IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_DEFAULTVALUE);
- }
-
- public static void setAskUser(boolean askUser) {
- try {
- IEclipsePreferences preferences = PreferencesUtils.getPreferences();
- preferences.putBoolean(IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID, askUser);
- preferences.flush();
- } catch (BackingStoreException e) {
- JBossToolsUsageActivator.getDefault().getLog().log(
- StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID,
- ReportingMessages.UsageReport_Error_SavePreferences, e,
- IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID));
- }
- }
-
- public static void flush() throws BackingStoreException {
- PreferencesUtils.getPreferences().flush();
- }
-
- public static IPreferenceStore createPreferenceStore() {
- return PreferencesUtils.getStore();
- }
-}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties 2010-09-21 15:22:34 UTC (rev 25061)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties 2010-09-21 15:24:25 UTC (rev 25062)
@@ -5,5 +5,6 @@
UsageReport_DialogMessage=Please allow the JBoss Tools team to receive anonymous usage statistics for this Eclipse installation with JBoss tools (<a>info</a>).
UsageReport_DialogTitle=JBoss Tools Usage
UsageReport_Error_SavePreferences=Could not save preferences {0}
+# this shall be refactored when we switch away from IStartup
UsageReport_GoogleAnalyticsAccount=UA-17645367-1
UsageReport_HostName=jboss.org
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java 2010-09-21 15:22:34 UTC (rev 25061)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java 2010-09-21 15:24:25 UTC (rev 25062)
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.util;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.preferences.ConfigurationScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.jface.preference.IPersistentPreferenceStore;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * @author Andre Dietisheim
- */
-public class PreferencesUtils {
-
- private PreferencesUtils() {
- // inhibit instantiation
- }
-
- public static IEclipsePreferences getPreferences() {
- return new ConfigurationScope().getNode(JBossToolsUsageActivator.PLUGIN_ID);
- }
-
- public static IPersistentPreferenceStore getStore() {
- return new ScopedPreferenceStore(new ConfigurationScope(), JBossToolsUsageActivator.PLUGIN_ID);
- }
-
- public static void checkedSavePreferences(IEclipsePreferences preferences, Plugin plugin, String message) {
- try {
- preferences.flush();
- } catch (BackingStoreException e) {
- IStatus status = StatusUtils.getErrorStatus(plugin.getBundle().getSymbolicName(),
- message,
- e, preferences.absolutePath());
- plugin.getLog().log(status);
- }
-
- }
-}
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GlobalUsageSettingsTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GlobalUsageSettingsTest.java 2010-09-21 15:22:34 UTC (rev 25061)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GlobalUsageSettingsTest.java 2010-09-21 15:24:25 UTC (rev 25062)
@@ -11,7 +11,6 @@
package org.jboss.tools.usage.test;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.IOException;
15 years, 7 months
JBoss Tools SVN: r25061 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-09-21 11:22:34 -0400 (Tue, 21 Sep 2010)
New Revision: 25061
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/GlobalUsageSettings.java
Log:
usage remoting plugin now disables reporting if the remote prop is NOT FOUND / UNREACHABLE / KEY MISSPELLED / VALUE MISSPELLED. It only reports if the remote property is found and is enabled!
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/GlobalUsageSettings.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/GlobalUsageSettings.java 2010-09-21 15:22:15 UTC (rev 25060)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/GlobalUsageSettings.java 2010-09-21 15:22:34 UTC (rev 25061)
@@ -34,8 +34,12 @@
public static final String REMOTEPROPS_USAGE_REPORTING_ENABLED_KEY = USAGE_REPORTING_ENABLED_KEY + "="; //$NON-NLS-1$
- private static final boolean USAGE_REPORTING_ENABLED_DEFAULT = true;
+ /** the enablement default for the local instance */
+ private static final boolean INSTANCE_USAGE_REPORTING_ENABLED_DEFAULT = true;
+ /** the enablement default for all instances */
+ private static final boolean ALLINSTANCES_USAGE_REPORTING_ENABLED_DEFAULT = false;
+
/** the delimiter that delimits the key/value-pairs */
private static final char VALUE_DELIMITER = '\n';
@@ -72,12 +76,12 @@
Map<String, String> valueMap = remoteMap.getValueMap();
String isEnabled = valueMap.get(REMOTEPROPS_USAGE_REPORTING_ENABLED_KEY);
if (isEnabled == null) {
- return USAGE_REPORTING_ENABLED_DEFAULT;
+ return ALLINSTANCES_USAGE_REPORTING_ENABLED_DEFAULT;
}
return Boolean.valueOf(isEnabled);
} catch (Exception e) {
- return USAGE_REPORTING_ENABLED_DEFAULT;
+ return ALLINSTANCES_USAGE_REPORTING_ENABLED_DEFAULT;
}
}
@@ -92,7 +96,7 @@
private boolean isInstanceReportingEnabled() {
return Boolean.valueOf(
System.getProperty(USAGE_REPORTING_ENABLED_KEY,
- String.valueOf(USAGE_REPORTING_ENABLED_DEFAULT)));
+ String.valueOf(INSTANCE_USAGE_REPORTING_ENABLED_DEFAULT)));
}
protected HttpRemotePropertiesProvider createRemoteMap(String url, char valueDelimiter, Plugin plugin,
15 years, 7 months
JBoss Tools SVN: r25060 - trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-09-21 11:22:15 -0400 (Tue, 21 Sep 2010)
New Revision: 25060
Modified:
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GlobalUsageSettingsTest.java
Log:
usage remoting plugin now disables reporting if the remote prop is NOT FOUND / UNREACHABLE / KEY MISSPELLED / VALUE MISSPELLED. It only reports if the remote property is found and is enabled!
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GlobalUsageSettingsTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GlobalUsageSettingsTest.java 2010-09-21 15:20:36 UTC (rev 25059)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GlobalUsageSettingsTest.java 2010-09-21 15:22:15 UTC (rev 25060)
@@ -37,13 +37,13 @@
* </ul>
*
* <p>
- * <code>enabled</code>
+ * <code>disabled</code>
* <p>
*/
@Test
public void reportingIsENABLEDIfSysPropIsNOTSETAndRemotePropIsNOTSET() throws IOException {
GlobalUsageSettingsFake reportEnablement = new GlobalUsageSettingsFake("");
- assertTrue(reportEnablement.isReportingEnabled());
+ assertFalse(reportEnablement.isReportingEnabled());
}
/**
15 years, 7 months
JBoss Tools SVN: r25059 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors: actions and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-09-21 11:20:36 -0400 (Tue, 21 Sep 2010)
New Revision: 25059
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/LexicalSortingAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
Log:
https://jira.jboss.org/browse/JBIDE-7070 - fixed
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java 2010-09-21 15:17:10 UTC (rev 25058)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java 2010-09-21 15:20:36 UTC (rev 25059)
@@ -376,4 +376,8 @@
protected ActionRegistry getActionRegistry() {
return actionRegistry;
}
+
+ public void cleanupSelection() {
+ getViewer().deselectAll();
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/LexicalSortingAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/LexicalSortingAction.java 2010-09-21 15:17:10 UTC (rev 25058)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/LexicalSortingAction.java 2010-09-21 15:20:36 UTC (rev 25059)
@@ -56,6 +56,9 @@
private void valueChanged(final boolean on) {
BusyIndicator.showWhile(getDisplay(), new Runnable() {
public void run() {
+ if (outlinePage != null) {
+ outlinePage.cleanupSelection();
+ }
final OrmDiagram od = getOrmDiagram();
od.setDeepIntoSort(on);
od.refresh();
@@ -66,7 +69,7 @@
});
}
- protected Display getDisplay () {
+ protected Display getDisplay() {
if (diagramViewer != null && diagramViewer.getEditPartViewer() != null &&
diagramViewer.getEditPartViewer().getControl() != null) {
return diagramViewer.getEditPartViewer().getControl().getDisplay();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java 2010-09-21 15:17:10 UTC (rev 25058)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java 2010-09-21 15:20:36 UTC (rev 25059)
@@ -150,6 +150,15 @@
}
}
+ public void cleanupSelection() {
+ Iterator<Shape> it = getChildrenIterator();
+ while (it.hasNext()) {
+ Shape me = it.next();
+ me.setSelected(false);
+ }
+ setSelected(false);
+ }
+
public int compareTo(BaseElement be) {
return toString().compareToIgnoreCase(be.toString());
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2010-09-21 15:17:10 UTC (rev 25058)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2010-09-21 15:20:36 UTC (rev 25059)
@@ -265,6 +265,17 @@
}
}
+ public void cleanupSelection() {
+ Iterator<OrmShape> it = elements.values().iterator();
+ while (it.hasNext()) {
+ OrmShape ormShape = it.next();
+ ormShape.cleanupSelection();
+ }
+ for (int i = 0; i < connections.size(); i++) {
+ connections.get(i).cleanupSelection();
+ }
+ }
+
protected void createRulers() {
leftRuler = new DiagramRuler(false);
topRuler = new DiagramRuler(true);
15 years, 7 months
JBoss Tools SVN: r25058 - trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-09-21 11:17:10 -0400 (Tue, 21 Sep 2010)
New Revision: 25058
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/CommonContentAssistantTestCase.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java
Log:
junit tests code has been adjuster, added copyright information, string has been externalized, removed unused import's and variables
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/CommonContentAssistantTestCase.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/CommonContentAssistantTestCase.java 2010-09-21 15:13:42 UTC (rev 25057)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/CommonContentAssistantTestCase.java 2010-09-21 15:17:10 UTC (rev 25058)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Copyright (c) 2007-2010 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -33,7 +33,7 @@
@Override
public void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", null, getSetUpProjectName(), makeCopy);
+ provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", null, getSetUpProjectName(), makeCopy); //$NON-NLS-1$
project = provider.getProject();
}
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java 2010-09-21 15:13:42 UTC (rev 25057)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java 2010-09-21 15:17:10 UTC (rev 25058)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.jst.jsp.test.ca;
import java.util.List;
@@ -6,16 +17,13 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.eclipse.wst.sse.ui.internal.contentassist.StructuredContentAssistant;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
@@ -32,7 +40,7 @@
protected IDocument document = null;
public void openEditor(String fileName) {
- IEditorPart editorPart = WorkbenchUtils.openEditor(project.getName()+"/"+ fileName);
+ IEditorPart editorPart = WorkbenchUtils.openEditor(project.getName()+"/"+ fileName); //$NON-NLS-1$
// System.out.println("openEditor: " + project.getName()+"/"+ fileName);
if (editorPart instanceof JSPMultiPageEditor)
jspEditor = (JSPMultiPageEditor) editorPart;
@@ -46,11 +54,11 @@
.getContentAssistant(viewer));
assertTrue(
- "Cannot get the Content Assistant instance for the editor for page \""
- + fileName + "\"", (contentAssistant != null));
+ "Cannot get the Content Assistant instance for the editor for page \"" //$NON-NLS-1$
+ + fileName + "\"", (contentAssistant != null)); //$NON-NLS-1$
- assertTrue("The IDocument is not instance of IStructuredDocument for page \""
- + fileName + "\"",
+ assertTrue("The IDocument is not instance of IStructuredDocument for page \"" //$NON-NLS-1$
+ + fileName + "\"", //$NON-NLS-1$
(document instanceof IStructuredDocument));
}
@@ -76,7 +84,7 @@
List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, position+offset);
- assertTrue("Content Assistant returned no proposals", (res != null && res.size() > 0));
+ assertTrue("Content Assistant returned no proposals", (res != null && res.size() > 0)); //$NON-NLS-1$
// for (int i = 0; i < result.length; i++) {
// System.out.println("proposal - "+result[i].getDisplayString());
@@ -88,14 +96,14 @@
boolean found = compareProposal(proposals[i], result);
if (found)
foundCounter++;
- assertTrue("Proposal " + proposals[i] + " not found!", found );
+ assertTrue("Proposal " + proposals[i] + " not found!", found ); //$NON-NLS-1$ //$NON-NLS-2$
}
if (exactly) {
if (excludeELProposalsFromExactTest) {
- assertTrue("Some other proposals were found!", foundCounter == proposals.length);
+ assertTrue("Some other proposals were found!", foundCounter == proposals.length); //$NON-NLS-1$
} else {
- assertTrue("Some other proposals were found!", result.length == proposals.length);
+ assertTrue("Some other proposals were found!", result.length == proposals.length); //$NON-NLS-1$
}
}
@@ -111,20 +119,20 @@
if (replacementString.equalsIgnoreCase(proposalName)) return true;
// For a tag proposal there will be not only the the tag name but all others characters like default attributes, tag ending characters and so on
- String[] replacementStringParts = replacementString.split(" ");
+ String[] replacementStringParts = replacementString.split(" "); //$NON-NLS-1$
if (replacementStringParts != null && replacementStringParts.length > 0) {
if (replacementStringParts[0].equalsIgnoreCase(proposalName)) return true;
}
// for an attribute proposal there will be a pare of attribute-value (i.e. attrName="attrValue")
- replacementStringParts = replacementString.split("=");
+ replacementStringParts = replacementString.split("="); //$NON-NLS-1$
if (replacementStringParts != null && replacementStringParts.length > 0) {
if (replacementStringParts[0].equalsIgnoreCase(proposalName)) return true;
}
// for an Unclosed EL the closing character is appended to the proposal string (i.e. person} )
// perform case sensitive compare operation
- replacementStringParts = replacementString.split("}");
+ replacementStringParts = replacementString.split("}"); //$NON-NLS-1$
if (replacementStringParts != null && replacementStringParts.length > 0) {
if (replacementStringParts[0].equals(proposalName)) return true;
}
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java 2010-09-21 15:13:42 UTC (rev 25057)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java 2010-09-21 15:17:10 UTC (rev 25058)
@@ -26,8 +26,8 @@
*
*/
public class Jbide1791Test extends ContentAssistantTestCase {
- private static final String PROJECT_NAME = "JsfJbide1791Test";
- private static final String PAGE_NAME = "/WebContent/pages/jbide1791.xhtml";
+ private static final String PROJECT_NAME = "JsfJbide1791Test"; //$NON-NLS-1$
+ private static final String PAGE_NAME = "/WebContent/pages/jbide1791.xhtml"; //$NON-NLS-1$
private TestProjectProvider provider = null;
public static Test suite() {
@@ -35,9 +35,8 @@
}
public void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test", null, PROJECT_NAME,false);
+ provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test", null, PROJECT_NAME,false); //$NON-NLS-1$
project = provider.getProject();
- Throwable exception = null;
}
protected void tearDown() throws Exception {
@@ -48,18 +47,18 @@
public void testJbide1791(){
final String[] proposals = new String[]{
- "h1",
- "h2",
- "h3",
- "h4",
- "h5",
- "h6",
- "hr"
+ "h1", //$NON-NLS-1$
+ "h2", //$NON-NLS-1$
+ "h3", //$NON-NLS-1$
+ "h4", //$NON-NLS-1$
+ "h5", //$NON-NLS-1$
+ "h6", //$NON-NLS-1$
+ "hr" //$NON-NLS-1$
};
openEditor(PAGE_NAME);
IRegion reg=null;
try {
- reg = new FindReplaceDocumentAdapter(this.document).find(0, "</style>", true, false, false, false);
+ reg = new FindReplaceDocumentAdapter(this.document).find(0, "</style>", true, false, false, false); //$NON-NLS-1$
} catch (BadLocationException e) {
fail(e.getMessage());
}
@@ -74,7 +73,7 @@
*/
private void checkResult(ICompletionProposal[] rst, String[] proposals) {
for ( int i = 0 ; i < proposals.length ; i ++ ){
- assertTrue("Should be in proposals list",isInResultList(rst,proposals[i]));
+ assertTrue("Should be in proposals list",isInResultList(rst,proposals[i])); //$NON-NLS-1$
}
}
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java 2010-09-21 15:13:42 UTC (rev 25057)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java 2010-09-21 15:17:10 UTC (rev 25058)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.jst.jsp.test.ca;
import java.util.List;
@@ -5,9 +16,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
import org.jboss.tools.jst.jsp.test.TestUtil;
import org.jboss.tools.test.util.TestProjectProvider;
@@ -15,10 +24,10 @@
public class JstJspJbide1585Test extends ContentAssistantTestCase {
TestProjectProvider provider = null;
boolean makeCopy = false;
- private static final String PROJECT_NAME = "JsfJbide1585Test";
- private static final String PAGE_NAME = "/WebContent/pages/inputname.xhtml";
- private static final String TAG_OPEN_STRING = "<";
- private static final String PREFIX_STRING = "ui:in";
+ private static final String PROJECT_NAME = "JsfJbide1585Test"; //$NON-NLS-1$
+ private static final String PAGE_NAME = "/WebContent/pages/inputname.xhtml"; //$NON-NLS-1$
+ private static final String TAG_OPEN_STRING = "<"; //$NON-NLS-1$
+ private static final String PREFIX_STRING = "ui:in"; //$NON-NLS-1$
private static final String INSERTION_STRING = TAG_OPEN_STRING + PREFIX_STRING;
public static Test suite() {
@@ -26,11 +35,11 @@
}
public void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test", null, PROJECT_NAME, makeCopy);
+ provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test", null, PROJECT_NAME, makeCopy); //$NON-NLS-1$
project = provider.getProject();
Throwable exception = null;
- assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
+ assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception); //$NON-NLS-1$//$NON-NLS-2$
}
protected void tearDown() throws Exception {
@@ -44,10 +53,10 @@
// Find start of <ui:define> tag
String documentContent = document.get();
- int start = (documentContent == null ? -1 : documentContent.indexOf("<ui:define"));
+ int start = (documentContent == null ? -1 : documentContent.indexOf("<ui:define")); //$NON-NLS-1$
int offsetToTest = start + INSERTION_STRING.length();
- assertTrue("Cannot find the starting point in the test file \"" + PAGE_NAME + "\"", (start != -1));
+ assertTrue("Cannot find the starting point in the test file \"" + PAGE_NAME + "\"", (start != -1)); //$NON-NLS-1$ //$NON-NLS-2$
String documentContentModified = documentContent.substring(0, start) +
INSERTION_STRING + documentContent.substring(start);
@@ -57,19 +66,19 @@
try {
List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, offsetToTest);
- assertTrue("Content Assistant returned no proposals", (res != null && res.size() > 0));
+ assertTrue("Content Assistant returned no proposals", (res != null && res.size() > 0)); //$NON-NLS-1$
for (ICompletionProposal p : res) {
- assertTrue("Content Assistant returned proposals which type (" + p.getClass().getName() + ") differs from AutoContentAssistantProposal", (p instanceof AutoContentAssistantProposal));
+ assertTrue("Content Assistant returned proposals which type (" + p.getClass().getName() + ") differs from AutoContentAssistantProposal", (p instanceof AutoContentAssistantProposal)); //$NON-NLS-1$//$NON-NLS-2$
AutoContentAssistantProposal proposal = (AutoContentAssistantProposal)p;
String proposalString = proposal.getReplacementString();
int proposalReplacementOffset = proposal.getReplacementOffset();
int proposalReplacementLength = proposal.getReplacementLength();
- assertTrue("The proposal replacement Offset is not correct.", proposalReplacementOffset == start + TAG_OPEN_STRING.length());
- assertTrue("The proposal replacement Length is not correct.", proposalReplacementLength == PREFIX_STRING.length());
- assertTrue("The proposal isn\'t filtered properly in the Content Assistant.", proposalString.startsWith(PREFIX_STRING));
+ assertTrue("The proposal replacement Offset is not correct.", proposalReplacementOffset == start + TAG_OPEN_STRING.length()); //$NON-NLS-1$
+ assertTrue("The proposal replacement Length is not correct.", proposalReplacementLength == PREFIX_STRING.length()); //$NON-NLS-1$
+ assertTrue("The proposal isn\'t filtered properly in the Content Assistant.", proposalString.startsWith(PREFIX_STRING)); //$NON-NLS-1$
}
} finally {
closeEditor();
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java 2010-09-21 15:13:42 UTC (rev 25057)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java 2010-09-21 15:17:10 UTC (rev 25058)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.jst.jsp.test.ca;
import java.util.List;
15 years, 7 months
JBoss Tools SVN: r25057 - trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-21 11:13:42 -0400 (Tue, 21 Sep 2010)
New Revision: 25057
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF
Log:
JBIDE-6535
https://jira.jboss.org/browse/JBIDE-6535
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF 2010-09-21 14:43:32 UTC (rev 25056)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF 2010-09-21 15:13:42 UTC (rev 25057)
@@ -33,6 +33,8 @@
org.eclipse.jst.common.project.facet.core;bundle-version="1.4.1",
org.jboss.tools.vpe;bundle-version="3.1.0",
org.jboss.tools.jst.jsp;bundle-version="3.1.0",
- org.jboss.tools.jsf.text.ext.richfaces;bundle-version="3.1.0"
+ org.jboss.tools.jsf.text.ext.richfaces;bundle-version="3.1.0",
+ org.jboss.tools.seam.pages.xml,
+ org.jboss.tools.seam.xml
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
15 years, 7 months
JBoss Tools SVN: r25056 - in trunk/bpmn/plugins: org.jboss.tools.jbpm and 22 other directories.
by jbosstools-commits@lists.jboss.org
Author: KrisVerlaenen
Date: 2010-09-21 10:43:32 -0400 (Tue, 21 Sep 2010)
New Revision: 25056
Added:
trunk/bpmn/plugins/org.jboss.tools.jbpm/
trunk/bpmn/plugins/org.jboss.tools.jbpm/.classpath
trunk/bpmn/plugins/org.jboss.tools.jbpm/.project
trunk/bpmn/plugins/org.jboss.tools.jbpm/META-INF/
trunk/bpmn/plugins/org.jboss.tools.jbpm/META-INF/MANIFEST.MF
trunk/bpmn/plugins/org.jboss.tools.jbpm/about.html
trunk/bpmn/plugins/org.jboss.tools.jbpm/build.properties
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/antlr-runtime.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/drools-api.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/drools-compiler.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/drools-core.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-bam.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-bpmn2.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-flow-builder.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-flow.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/mvel2.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/xstream.jar
trunk/bpmn/plugins/org.jboss.tools.jbpm/plugin.xml
trunk/bpmn/plugins/org.jboss.tools.jbpm/schema/
trunk/bpmn/plugins/org.jboss.tools.jbpm/schema/runtimeRecognizer.exsd
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/JBPMEclipsePlugin.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/action/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/action/ConvertToJBPMProjectAction.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMConstants.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMPreferencePage.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMProjectPreferencePage.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimeDialog.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimesBlock.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimesPreferencePage.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/DefaultJBPMRuntimeRecognizer.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMClasspathContainer.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMClasspathContainerInitializer.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntime.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntimeManager.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntimeRecognizer.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/ProjectClassLoader.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectRuntimeWizardPage.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectWizard.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectWizardPage.java
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/project/
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/project/ProcessLauncherSample.java.template
trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/project/sample.bpmn.template
Log:
- adding jBPM5 runtime support + wizard
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/.classpath
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/.classpath (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/.classpath 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/drools-api.jar"/>
+ <classpathentry kind="lib" path="lib/drools-compiler.jar"/>
+ <classpathentry kind="lib" path="lib/drools-core.jar"/>
+ <classpathentry kind="lib" path="lib/jbpm-bam.jar"/>
+ <classpathentry kind="lib" path="lib/jbpm-bpmn2.jar"/>
+ <classpathentry kind="lib" path="lib/jbpm-flow-builder.jar"/>
+ <classpathentry kind="lib" path="lib/jbpm-flow.jar"/>
+ <classpathentry kind="lib" path="lib/mvel2.jar"/>
+ <classpathentry kind="lib" path="lib/xstream.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/.project
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/.project (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/.project 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.jbpm</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/META-INF/MANIFEST.MF (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/META-INF/MANIFEST.MF 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,40 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: jBPM Eclipse Plug-in
+Bundle-SymbolicName: org.jboss.tools.jbpm;singleton:=true
+Bundle-Version: 5.0.0.SNAPSHOT
+Bundle-Activator: org.jboss.tools.jbpm.JBPMEclipsePlugin
+Bundle-Vendor: JBoss, a division of Red Hat
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.debug.core,
+ org.eclipse.debug.ui,
+ org.eclipse.jface.text,
+ org.eclipse.ui,
+ org.eclipse.ui.console,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.forms,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views,
+ org.eclipse.ui.views.properties.tabbed,
+ org.eclipse.ui.workbench.texteditor,
+ com.ibm.icu,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.ui
+Eclipse-LazyStart: true
+Eclipse-BuddyPolicy: registered
+Bundle-ClassPath: .,
+ lib/drools-api.jar,
+ lib/drools-core.jar,
+ lib/drools-compiler.jar,
+ lib/jbpm-flow.jar,
+ lib/jbpm-flow-builder.jar,
+ lib/jbpm-bpmn2.jar,
+ lib/jbpm-bam.jar,
+ lib/junit.jar,
+ lib/mvel2.jar,
+ lib/antlr-runtime.jar,
+ lib/xstream.jar
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.jboss.tools.jbpm
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/about.html
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/about.html (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/about.html 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>(c) 2010 JBoss, a division of Red Hat</P>
+
+<H3>License</H3>
+
+<P>Licensed under the Apache License, Version 2.0 (the "License");<BR/>
+you may not use this file except in compliance with the License.<BR/>
+You may obtain a copy of the License at<BR/>
+<BR/>
+ http://www.apache.org/licenses/LICENSE-2.0<BR/>
+<BR/>
+Unless required by applicable law or agreed to in writing, software<BR/>
+distributed under the License is distributed on an "AS IS" BASIS,<BR/>
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<BR/>
+See the License for the specific language governing permissions<BR/>
+and limitations under the License.
+</P>
+
+</BODY>
+</HTML>
\ No newline at end of file
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/build.properties
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/build.properties (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/build.properties 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,24 @@
+bin.includes = .,\
+ META-INF/,\
+ icons/,\
+ plugin.xml,\
+ help/,\
+ lib/,\
+ about.html,\
+ schema/
+bin.excludes = lib/drools-documentation.jar
+src.includes = META-INF/,\
+ icons/,\
+ plugin.xml,\
+ help/,\
+ lib/,\
+ .project,\
+ .classpath,\
+ about.html,\
+ schema/,\
+ src/,\
+ build.properties
+src.excludes = lib/drools-documentation.jar
+jars.compile.order = .
+source.. = src/main/java/,\
+ src/main/resources/
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/antlr-runtime.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/antlr-runtime.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/drools-api.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/drools-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/drools-compiler.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/drools-compiler.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/drools-core.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/drools-core.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-bam.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-bam.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-bpmn2.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-bpmn2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-flow-builder.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-flow-builder.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-flow.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/jbpm-flow.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/mvel2.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/mvel2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/xstream.jar
===================================================================
(Binary files differ)
Property changes on: trunk/bpmn/plugins/org.jboss.tools.jbpm/lib/xstream.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/plugin.xml
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/plugin.xml (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/plugin.xml 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.jboss.tools.jbpm.new"
+ name="jBPM"/>
+ <wizard
+ category="org.jboss.tools.jbpm.new"
+ class="org.jboss.tools.jbpm.wizard.project.NewJBPMProjectWizard"
+ id="org.jboss.tools.jbpm.new.project"
+ name="jBPM project"
+ project= "true">
+ <description>This wizard creates a new jBPM project.</description>
+ </wizard>
+ </extension>
+ <extension point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer class="org.jboss.tools.jbpm.util.JBPMClasspathContainerInitializer" id="JBPM" />
+ </extension>
+ <extension point = "org.eclipse.ui.preferencePages">
+ <page id="org.jboss.tools.jbpm.preferences.JBPMPreferencePage"
+ class="org.jboss.tools.jbpm.preferences.JBPMPreferencePage"
+ name="jBPM">
+ </page>
+ <page name="Installed jBPM Runtimes"
+ category="org.jboss.tools.jbpm.preferences.JBPMPreferencePage"
+ class="org.jboss.tools.jbpm.preferences.JBPMRuntimesPreferencePage"
+ id="org.jboss.tools.jbpm.preferences.JBPMRuntimesPreferencePage">
+ </page>
+ </extension>
+ <extension point="org.eclipse.ui.propertyPages">
+ <page name="jBPM"
+ class="org.jboss.tools.jbpm.preferences.JBPMProjectPreferencePage"
+ id="org.jboss.tools.jbpm.preferences.JBPMProjectPreferencePage">
+ <enabledWhen>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.jdt.core.javanature"/>
+ </adapt>
+ </enabledWhen>
+ </page>
+ </extension>
+ <extension point = "org.eclipse.ui.popupMenus">
+ <objectContribution
+ objectClass="org.eclipse.jdt.core.IJavaProject"
+ id="org.jboss.tools.jbpm.action.ConvertToJBPMProject">
+ <action id="org.jboss.tools.jbpm.action.ConvertToJBPMProjectAction"
+ label="Convert to jBPM Project"
+ menubarPath="org.eclipse.ui.projectConfigure/additions"
+ class="org.jboss.tools.jbpm.action.ConvertToJBPMProjectAction"
+ definitionId="org.jboss.tools.jbpm.action.ConvertToJBPMProjectAction"
+ enablesFor="1">
+ </action>
+ </objectContribution>
+ </extension>
+ <extension-point id="runtimeRecognizer" name="jBPM Runtime Recognizer" schema="schema/runtimeRecognizer.exsd"/>
+</plugin>
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/schema/runtimeRecognizer.exsd
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/schema/runtimeRecognizer.exsd (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/schema/runtimeRecognizer.exsd 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.drools.eclipse" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.drools.eclipse" id="runtimeRecognizer" name="Drools Runtime Recognizer"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice>
+ <element ref="recognizer"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="recognizer">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.drools.eclipse.util.DroolsRuntimeRecognizer"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/JBPMEclipsePlugin.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/JBPMEclipsePlugin.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/JBPMEclipsePlugin.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,141 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">kris verlaenen </a>
+ */
+public class JBPMEclipsePlugin extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.jbpm";
+
+ // The shared instance.
+ private static JBPMEclipsePlugin plugin;
+
+ /**
+ * The constructor.
+ */
+ public JBPMEclipsePlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start( context );
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop( context );
+ plugin = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static JBPMEclipsePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = JBPMEclipsePlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString( key ) : key;
+ } catch ( MissingResourceException e ) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return null;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ * Uses the plug ins image registry to "cache" it.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ JBPMEclipsePlugin plugin = getDefault();
+ ImageRegistry reg = plugin.getImageRegistry();
+ ImageDescriptor des = reg.getDescriptor(path);
+ if (des == null) {
+ des = AbstractUIPlugin.imageDescriptorFromPlugin("org.jboss.tools.jbpm", path);
+ reg.put(path, des);
+ }
+ return des;
+ }
+
+ public static String getUniqueIdentifier() {
+ if (getDefault() == null) {
+ return PLUGIN_ID;
+ }
+ return getDefault().getBundle().getSymbolicName();
+ }
+
+ protected void initializeDefaultPreferences(IPreferenceStore store) {
+ }
+
+ public static void log(Throwable t) {
+ Throwable top = t;
+ if (t instanceof DebugException) {
+ DebugException de = (DebugException) t;
+ IStatus status = de.getStatus();
+ if (status.getException() != null) {
+ top = status.getException();
+ }
+ }
+ log(new Status(IStatus.ERROR,
+ getUniqueIdentifier(),
+ 1033,
+ "Internal error in jBPM Plugin: ",
+ top ) );
+ }
+
+ public static void log(IStatus status) {
+ getDefault().getLog().log( status );
+ }
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/action/ConvertToJBPMProjectAction.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/action/ConvertToJBPMProjectAction.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/action/ConvertToJBPMProjectAction.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.action;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.jboss.tools.jbpm.JBPMEclipsePlugin;
+import org.jboss.tools.jbpm.wizard.project.NewJBPMProjectWizard;
+
+public class ConvertToJBPMProjectAction implements IObjectActionDelegate {
+
+ private IJavaProject project;
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ public void run(IAction action) {
+ if (project != null && project.exists()) {
+ try {
+ addJBPMLibraries(project, null);
+ } catch (Throwable t) {
+ JBPMEclipsePlugin.log(t);
+ }
+ }
+
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structured = (IStructuredSelection) selection;
+ if (structured.size() == 1) {
+ Object element = structured.getFirstElement();
+ if (element instanceof IJavaProject) {
+ project = (IJavaProject) element;
+ } else if (element instanceof IProject) {
+ IJavaProject javaProject = JavaCore.create((IProject) element);
+ if (javaProject != null && javaProject.exists()) {
+ project = javaProject;
+ }
+ }
+ }
+ }
+ }
+
+ public static void addJBPMLibraries(IJavaProject project, IProgressMonitor monitor) throws JavaModelException {
+ IClasspathEntry[] classpathEntries = project.getRawClasspath();
+ for (int i = 0; i < classpathEntries.length; i++) {
+ if (NewJBPMProjectWizard.JBPM_CLASSPATH_CONTAINER_PATH.equals(classpathEntries[i].getPath().toString())) {
+ return;
+ }
+ }
+ NewJBPMProjectWizard.addJBPMLibraries(project, null);
+ }
+
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMConstants.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMConstants.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMConstants.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.preferences;
+
+public interface JBPMConstants {
+
+ String JBPM_RUNTIMES = "jBPM.Runtimes";
+ String JBPM_PREFERENCES = "jBPM.Preferences";
+
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMPreferencePage.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMPreferencePage.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMPreferencePage.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,67 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.jbpm.JBPMEclipsePlugin;
+
+public class JBPMPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ protected Control createContents(Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ composite.setLayout(gridLayout);
+ initializeValues();
+ return composite;
+ }
+
+ protected IPreferenceStore doGetPreferenceStore() {
+ return JBPMEclipsePlugin.getDefault().getPreferenceStore();
+ }
+
+ private void initializeDefaults() {
+ }
+
+ private void initializeValues() {
+ }
+
+ protected void performDefaults() {
+ super.performDefaults();
+ initializeDefaults();
+ }
+
+ public boolean performOk() {
+ storeValues();
+ JBPMEclipsePlugin.getDefault().savePluginPreferences();
+ return true;
+ }
+
+ private void storeValues() {
+ }
+
+ public void init(IWorkbench workbench) {
+ // do nothing
+ }
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMProjectPreferencePage.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMProjectPreferencePage.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMProjectPreferencePage.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,119 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.preferences;
+
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.jboss.tools.jbpm.JBPMEclipsePlugin;
+import org.jboss.tools.jbpm.util.JBPMRuntime;
+import org.jboss.tools.jbpm.util.JBPMRuntimeManager;
+
+public class JBPMProjectPreferencePage extends PropertyAndPreferencePage {
+
+ public static final String PREF_ID= "org.jboss.tools.jbpm.preferences.JBPMRuntimesPreferencePage";
+ public static final String PROP_ID= "org.jboss.tools.jbpm.preferences.JBPMProjectPreferencePage";
+
+ private Combo jBPMRuntimeCombo;
+
+ public JBPMProjectPreferencePage() {
+ setTitle("jBPM Project Preferences");
+ }
+
+ protected Control createPreferenceContent(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ composite.setLayout(gridLayout);
+
+ Label nameLabel = new Label(composite, SWT.NONE);
+ nameLabel.setText("jBPM Runtime: ");
+ jBPMRuntimeCombo = new Combo(composite, SWT.LEFT);
+ JBPMRuntime[] runtimes = JBPMRuntimeManager.getJBPMRuntimes();
+ int selection = -1;
+ String currentRuntime = JBPMRuntimeManager.getJBPMRuntime(getProject());
+ for (int i = 0; i < runtimes.length; i++) {
+ jBPMRuntimeCombo.add(runtimes[i].getName());
+ if (runtimes[i].getName().equals(currentRuntime)) {
+ selection = i;
+ }
+ }
+ if (selection != -1) {
+ jBPMRuntimeCombo.select(selection);
+ } else if (runtimes.length > 0) {
+ jBPMRuntimeCombo.select(0);
+ }
+ GridData gridData = new GridData();
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ jBPMRuntimeCombo.setLayoutData(gridData);
+ return composite;
+ }
+
+ protected String getPreferencePageID() {
+ return PREF_ID;
+ }
+
+ protected String getPropertyPageID() {
+ return PROP_ID;
+ }
+
+ protected boolean hasProjectSpecificOptions(IProject project) {
+ return project.getFile(".settings/.jbpm.runtime").exists();
+ }
+
+ public boolean performOk() {
+ try {
+ IFile file = getProject().getFile(".settings/.jbpm.runtime");
+ if (useProjectSettings()) {
+ String runtime = "<runtime>"
+ + jBPMRuntimeCombo.getItem(jBPMRuntimeCombo.getSelectionIndex())
+ + "</runtime>";
+ if (!file.exists()) {
+ IFolder folder = getProject().getFolder(".settings");
+ if (!folder.exists()) {
+ folder.create(true, true, null);
+ }
+ file.create(new ByteArrayInputStream(runtime.getBytes()), true, null);
+ } else {
+ file.setContents(new ByteArrayInputStream(runtime.getBytes()), true, false, null);
+ }
+ } else {
+ if (file.exists()) {
+ file.delete(true, null);
+ }
+ }
+ getProject().close(null);
+ getProject().open(null);
+ } catch (Throwable t) {
+ JBPMEclipsePlugin.log(t);
+ return false;
+ }
+ return super.performOk();
+ }
+
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimeDialog.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimeDialog.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimeDialog.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,201 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.preferences;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+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.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.jbpm.util.JBPMRuntime;
+import org.jboss.tools.jbpm.util.JBPMRuntimeManager;
+
+public class JBPMRuntimeDialog extends Dialog {
+
+ private JBPMRuntime runtime;
+ private Text nameText;
+ private Text pathText;
+ private List<JBPMRuntime> runtimes;
+
+ private Listener textModifyListener = new Listener() {
+ public void handleEvent(Event e) {
+ boolean valid = validate();
+ getButton(IDialogConstants.OK_ID).setEnabled(valid);
+ }
+ };
+
+ public JBPMRuntimeDialog(Shell parent, List<JBPMRuntime> runtimes) {
+ super(parent);
+ setBlockOnOpen(true);
+ this.runtimes = runtimes;
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 3;
+ composite.setLayout(gridLayout);
+
+ Label label = new Label(composite, SWT.WRAP);
+ label.setFont(composite.getFont());
+ label.setText("Either select an existing jBPM Runtime on your file system or create a new one.");
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 3;
+ gridData.widthHint = 450;
+ label.setLayoutData(gridData);
+
+ Label nameLabel = new Label(composite, SWT.NONE);
+ nameLabel.setText("Name: ");
+ nameText = new Text(composite, SWT.NONE);
+ nameText.setText(runtime == null || runtime.getName() == null ? "" : runtime.getName());
+ nameText.addListener(SWT.Modify, textModifyListener);
+ gridData = new GridData();
+ gridData.horizontalSpan = 2;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ nameText.setLayoutData(gridData);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText("Path: ");
+ pathText = new Text(composite, SWT.NONE);
+ pathText.setText(runtime == null || runtime.getPath() == null ? "" : runtime.getPath());
+ pathText.addListener(SWT.Modify, textModifyListener);
+ gridData = new GridData();
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ pathText.setLayoutData(gridData);
+ Button selectButton = new Button(composite, SWT.PUSH | SWT.LEFT);
+ selectButton.setText("Browse ...");
+ gridData = new GridData();
+ selectButton.setLayoutData(gridData);
+ selectButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ browse();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ Button createButton = new Button(composite, SWT.PUSH | SWT.LEFT);
+ createButton.setText("Create a new jBPM Runtime ...");
+ gridData = new GridData();
+ gridData.horizontalSpan = 2;
+ createButton.setLayoutData(gridData);
+ createButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ createRuntime();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ return composite;
+ }
+
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ }
+
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText("jBPM Runtime");
+ }
+
+ protected Point getInitialSize() {
+ return new Point(500, 250);
+ }
+
+ public void setJBPMRuntime(JBPMRuntime runtime) {
+ this.runtime = runtime;
+ }
+
+ private boolean validate() {
+ String name = nameText.getText();
+ if (name == null || "".equals(name.trim())) {
+ return false;
+ }
+ if (runtime == null || !name.equals(runtime.getName())) {
+ for (JBPMRuntime runtime: runtimes) {
+ if (name.equals(runtime.getName())) {
+ return false;
+ }
+ }
+ }
+ String location = pathText.getText();
+ if (location != null) {
+ File file = new File(location);
+ if (file.exists() && file.isDirectory()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void browse() {
+ String selectedDirectory = null;
+ String dirName = pathText.getText();
+
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage("Select the jBPM runtime directory.");
+ dialog.setFilterPath(dirName);
+ selectedDirectory = dialog.open();
+
+ if (selectedDirectory != null) {
+ pathText.setText(selectedDirectory);
+ }
+ }
+
+ private void createRuntime() {
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage("Select the new jBPM runtime directory.");
+ String selectedDirectory = dialog.open();
+
+ if (selectedDirectory != null) {
+ JBPMRuntimeManager.createDefaultRuntime(selectedDirectory);
+ nameText.setText("jBPM runtime");
+ pathText.setText(selectedDirectory);
+ }
+ }
+
+ public JBPMRuntime getResult() {
+ return runtime;
+ }
+
+ protected void okPressed() {
+ runtime = new JBPMRuntime();
+ runtime.setName(nameText.getText());
+ runtime.setPath(pathText.getText());
+ super.okPressed();
+ }
+
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimesBlock.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimesBlock.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimesBlock.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,338 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.preferences;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.debug.internal.ui.SWTFactory;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.jboss.tools.jbpm.util.JBPMRuntime;
+import org.jboss.tools.jbpm.util.JBPMRuntimeManager;
+
+public class JBPMRuntimesBlock implements ISelectionProvider {
+
+ private Composite fControl;
+ private List<JBPMRuntime> jbpmRuntimes = new ArrayList<JBPMRuntime>();
+ private CheckboxTableViewer jbpmRuntimesList;
+ private Button fAddButton;
+ private Button fRemoveButton;
+ private Button fEditButton;
+ private ListenerList fSelectionListeners = new ListenerList();
+ private ISelection fPrevSelection = new StructuredSelection();
+ private Table fTable;
+
+ class JBPMRuntimesContentProvider implements IStructuredContentProvider {
+ public Object[] getElements(Object input) {
+ return jbpmRuntimes.toArray();
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ public void dispose() {
+ }
+ }
+
+ class JBPMRuntimesLabelProvider extends LabelProvider implements ITableLabelProvider {
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof JBPMRuntime) {
+ JBPMRuntime runtime = (JBPMRuntime) element;
+ switch(columnIndex) {
+ case 0:
+ return runtime.getName();
+ case 1:
+ return runtime.getPath();
+ }
+ }
+ return element.toString();
+ }
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ fSelectionListeners.add(listener);
+ }
+
+ public ISelection getSelection() {
+ return new StructuredSelection(jbpmRuntimesList.getCheckedElements());
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ fSelectionListeners.remove(listener);
+ }
+
+ public void setSelection(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ if (!selection.equals(fPrevSelection)) {
+ fPrevSelection = selection;
+ Object runtime = ((IStructuredSelection)selection).getFirstElement();
+ if (runtime == null) {
+ jbpmRuntimesList.setCheckedElements(new Object[0]);
+ } else {
+ jbpmRuntimesList.setCheckedElements(new Object[]{runtime});
+ jbpmRuntimesList.reveal(runtime);
+ }
+ fireSelectionChanged();
+ }
+ }
+ }
+
+ private void fireSelectionChanged() {
+ SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
+ Object[] listeners = fSelectionListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ISelectionChangedListener listener = (ISelectionChangedListener)listeners[i];
+ listener.selectionChanged(event);
+ }
+ }
+
+ public void createControl(Composite ancestor) {
+ Font font = ancestor.getFont();
+ Composite parent= SWTFactory.createComposite(ancestor, font, 2, 1, GridData.FILL_BOTH);
+ fControl = parent;
+
+ SWTFactory.createLabel(parent, "Installed jBPM Runtimes", 2);
+
+ fTable = new Table(parent, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 250;
+ gd.widthHint = 350;
+ fTable.setLayoutData(gd);
+ fTable.setFont(font);
+ fTable.setHeaderVisible(true);
+ fTable.setLinesVisible(true);
+
+ TableColumn column = new TableColumn(fTable, SWT.NULL);
+ column.setText("Name");
+ int defaultwidth = 350/2 +1;
+ column.setWidth(defaultwidth);
+
+ column = new TableColumn(fTable, SWT.NULL);
+ column.setText("Location");
+ column.setWidth(defaultwidth);
+
+ jbpmRuntimesList = new CheckboxTableViewer(fTable);
+ jbpmRuntimesList.setLabelProvider(new JBPMRuntimesLabelProvider());
+ jbpmRuntimesList.setContentProvider(new JBPMRuntimesContentProvider());
+
+ jbpmRuntimesList.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent evt) {
+ enableButtons();
+ }
+ });
+
+ jbpmRuntimesList.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (event.getChecked()) {
+ setDefaultJBPMRuntime((JBPMRuntime) event.getElement());
+ } else {
+ setDefaultJBPMRuntime(null);
+ }
+ }
+ });
+
+ jbpmRuntimesList.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent e) {
+ if (!jbpmRuntimesList.getSelection().isEmpty()) {
+ editJBPMRuntime();
+ }
+ }
+ });
+ fTable.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0) {
+ if (fRemoveButton.isEnabled()){
+ removeJBPMRuntimes();
+ }
+ }
+ }
+ });
+
+ Composite buttons = SWTFactory.createComposite(parent, font, 1, 1, GridData.VERTICAL_ALIGN_BEGINNING, 0, 0);
+
+ fAddButton = SWTFactory.createPushButton(buttons, "Add...", null);
+ fAddButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ addJBPMRuntime();
+ }
+ });
+
+ fEditButton= SWTFactory.createPushButton(buttons, "Edit...", null);
+ fEditButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ editJBPMRuntime();
+ }
+ });
+
+ fRemoveButton= SWTFactory.createPushButton(buttons, "Remove", null);
+ fRemoveButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ removeJBPMRuntimes();
+ }
+ });
+
+ SWTFactory.createVerticalSpacer(parent, 1);
+
+ enableButtons();
+ fAddButton.setEnabled(true);
+ }
+
+ private void enableButtons() {
+ IStructuredSelection selection = (IStructuredSelection) jbpmRuntimesList.getSelection();
+ int selectionCount= selection.size();
+ fEditButton.setEnabled(selectionCount == 1);
+ fRemoveButton.setEnabled(selectionCount > 0);
+ }
+
+ public Control getControl() {
+ return fControl;
+ }
+
+ public void setJBPMRuntimes(JBPMRuntime[] runtimes) {
+ jbpmRuntimes.clear();
+ for (int i = 0; i < runtimes.length; i++) {
+ jbpmRuntimes.add(runtimes[i]);
+ }
+ jbpmRuntimesList.setInput(jbpmRuntimes);
+ jbpmRuntimesList.refresh();
+ }
+
+ public JBPMRuntime[] getJBPMRuntimes() {
+ JBPMRuntime selected = getDefaultJBPMRuntime();
+ for (JBPMRuntime runtime: jbpmRuntimes) {
+ runtime.setDefault(runtime.equals(selected));
+ }
+ return jbpmRuntimes.toArray(new JBPMRuntime[jbpmRuntimes.size()]);
+ }
+
+ private void addJBPMRuntime() {
+ JBPMRuntimeDialog dialog = new JBPMRuntimeDialog(getShell(), jbpmRuntimes);
+ if (dialog.open() == Window.OK) {
+ JBPMRuntime result = dialog.getResult();
+ if (result != null) {
+ JBPMRuntimeManager.recognizeJars(result);
+ jbpmRuntimes.add(result);
+ jbpmRuntimesList.refresh();
+ jbpmRuntimesList.setSelection(new StructuredSelection(result));
+ }
+ }
+ }
+
+ private void editJBPMRuntime() {
+ IStructuredSelection selection= (IStructuredSelection) jbpmRuntimesList.getSelection();
+ JBPMRuntime runtime = (JBPMRuntime) selection.getFirstElement();
+ if (runtime == null) {
+ return;
+ }
+ JBPMRuntimeDialog dialog = new JBPMRuntimeDialog(getShell(), jbpmRuntimes);
+ dialog.setJBPMRuntime(runtime);
+ if (dialog.open() == Window.OK) {
+ JBPMRuntime result = dialog.getResult();
+ if (result != null) {
+ JBPMRuntimeManager.recognizeJars(result);
+ // replace with the edited VM
+ int index = jbpmRuntimes.indexOf(runtime);
+ jbpmRuntimes.remove(index);
+ jbpmRuntimes.add(index, result);
+ jbpmRuntimesList.refresh();
+ jbpmRuntimesList.setSelection(new StructuredSelection(result));
+ }
+ }
+ }
+
+ private void removeJBPMRuntimes() {
+ IStructuredSelection selection= (IStructuredSelection) jbpmRuntimesList.getSelection();
+ JBPMRuntime[] runtimes = new JBPMRuntime[selection.size()];
+ Iterator<?> iter = selection.iterator();
+ int i = 0;
+ while (iter.hasNext()) {
+ runtimes[i] = (JBPMRuntime) iter.next();
+ i++;
+ }
+ removeJBPMRuntimes(runtimes);
+ }
+
+ public void removeJBPMRuntimes(JBPMRuntime[] runtimes) {
+ IStructuredSelection prev = (IStructuredSelection) getSelection();
+ for (int i = 0; i < runtimes.length; i++) {
+ jbpmRuntimes.remove(runtimes[i]);
+ }
+ jbpmRuntimesList.refresh();
+ IStructuredSelection curr = (IStructuredSelection) getSelection();
+ if (!curr.equals(prev)) {
+ runtimes = getJBPMRuntimes();
+ if (curr.size() == 0 && runtimes.length == 1) {
+ setSelection(new StructuredSelection(runtimes[0]));
+ } else {
+ fireSelectionChanged();
+ }
+ }
+ }
+
+ protected Shell getShell() {
+ return getControl().getShell();
+ }
+
+ public void setDefaultJBPMRuntime(JBPMRuntime runtime) {
+ if (runtime == null) {
+ setSelection(new StructuredSelection());
+ } else {
+ setSelection(new StructuredSelection(runtime));
+ }
+ }
+
+ public JBPMRuntime getDefaultJBPMRuntime() {
+ Object[] objects = jbpmRuntimesList.getCheckedElements();
+ if (objects.length == 0) {
+ return null;
+ }
+ return (JBPMRuntime) objects[0];
+ }
+
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimesPreferencePage.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimesPreferencePage.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/preferences/JBPMRuntimesPreferencePage.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,109 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.preferences;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.jbpm.util.JBPMRuntime;
+import org.jboss.tools.jbpm.util.JBPMRuntimeManager;
+
+public class JBPMRuntimesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private JBPMRuntimesBlock jBPMRuntimesBlock;
+
+ public JBPMRuntimesPreferencePage() {
+ super("Installed jBPM Runtimes");
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+ protected Control createContents(Composite ancestor) {
+ initializeDialogUnits(ancestor);
+ noDefaultAndApplyButton();
+ GridLayout layout= new GridLayout();
+ layout.numColumns= 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ ancestor.setLayout(layout);
+ Label l = new Label(ancestor, SWT.WRAP);
+ l.setFont(ancestor.getFont());
+ l.setText(
+ "Add, remove or edit jBPM Runtime definitions. " +
+ "By default, the checked jBPM Runtime is added to the build " +
+ "path of newly created jBPM projects.");
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 1;
+ gd.widthHint = 300;
+ l.setLayoutData(gd);
+ l = new Label(ancestor, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 1;
+ l.setLayoutData(gd);
+ jBPMRuntimesBlock = new JBPMRuntimesBlock();
+ jBPMRuntimesBlock.createControl(ancestor);
+ JBPMRuntime[] runtimes = JBPMRuntimeManager.getJBPMRuntimes();
+ jBPMRuntimesBlock.setJBPMRuntimes(runtimes);
+ for (JBPMRuntime runtime: runtimes) {
+ if (runtime.isDefault()) {
+ jBPMRuntimesBlock.setDefaultJBPMRuntime(runtime);
+ break;
+ }
+ }
+ if (jBPMRuntimesBlock.getDefaultJBPMRuntime() == null) {
+ setErrorMessage("Select a default jBPM Runtime");
+ }
+ Control control = jBPMRuntimesBlock.getControl();
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 1;
+ data.widthHint = 450;
+ control.setLayoutData(data);
+
+ jBPMRuntimesBlock.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ JBPMRuntime runtime = jBPMRuntimesBlock.getDefaultJBPMRuntime();
+ if (runtime == null) {
+ setErrorMessage("Select a default jBPM Runtime");
+ } else {
+ setErrorMessage(null);
+ }
+ }
+ });
+ applyDialogFont(ancestor);
+ return ancestor;
+ }
+
+ public boolean performOk() {
+ if (JBPMRuntimeManager.getDefaultJBPMRuntime() != null) {
+ MessageDialog.openInformation(getShell(), "Warning",
+ "You need to restart Eclipse to update the jBPM Runtime of existing projects.");
+ }
+ JBPMRuntimeManager.setJBPMRuntimes(jBPMRuntimesBlock.getJBPMRuntimes());
+ return super.performOk();
+ }
+
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/DefaultJBPMRuntimeRecognizer.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/DefaultJBPMRuntimeRecognizer.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/DefaultJBPMRuntimeRecognizer.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.util;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Path;
+
+public class DefaultJBPMRuntimeRecognizer implements JBPMRuntimeRecognizer {
+
+ public String[] recognizeJars(String path) {
+ List<String> list = new ArrayList<String>();
+ if (path != null) {
+ File file = (new Path(path)).toFile();
+ addJarNames(file, list);
+ }
+ return list.toArray(new String[list.size()]);
+ }
+
+ private void addJarNames(File file, List<String> list) {
+ File[] files = file.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory() && "lib".equals(files[i].getName())) {
+ addJarNames(files[i], list);
+ } else if (files[i].getPath().endsWith(".jar")) {
+ list.add(files[i].getAbsolutePath());
+ }
+ }
+ }
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMClasspathContainer.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMClasspathContainer.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMClasspathContainer.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,80 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IAccessRule;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.ClasspathAccessRule;
+import org.eclipse.jdt.internal.core.ClasspathEntry;
+import org.jboss.tools.jbpm.JBPMEclipsePlugin;
+
+public class JBPMClasspathContainer implements IClasspathContainer {
+
+ IClasspathEntry jbpmLibraryEntries[];
+ IPath path;
+ IJavaProject javaProject;
+
+ public JBPMClasspathContainer(IJavaProject project, IPath path) {
+ javaProject = null;
+ javaProject = project;
+ this.path = path;
+ }
+
+ public IClasspathEntry[] getClasspathEntries() {
+ if (jbpmLibraryEntries == null) {
+ jbpmLibraryEntries = createJBPMLibraryEntries(javaProject);
+ }
+ return jbpmLibraryEntries;
+ }
+
+ public String getDescription() {
+ return "jBPM Library";
+ }
+
+ public int getKind() {
+ return 1;
+ }
+
+ public IPath getPath() {
+ return path;
+ }
+
+ private IClasspathEntry[] createJBPMLibraryEntries(IJavaProject project) {
+ String[] jarNames = getJarNames(project);
+ List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+ if (jarNames != null) {
+ for (int i = 0; i < jarNames.length; i++) {
+ Path path = new Path(jarNames[i]);
+ list.add(JavaCore.newLibraryEntry(path, path, null));
+ }
+ }
+ return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+ private String[] getJarNames(IJavaProject project) {
+ return JBPMRuntimeManager.getJBPMRuntimeJars(project.getProject());
+ }
+
+}
\ No newline at end of file
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMClasspathContainerInitializer.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMClasspathContainerInitializer.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMClasspathContainerInitializer.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.util;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+
+public class JBPMClasspathContainerInitializer extends ClasspathContainerInitializer {
+
+ public void initialize(IPath ipath, IJavaProject project) throws CoreException {
+ JBPMClasspathContainer container =
+ new JBPMClasspathContainer(project, ipath);
+ JavaCore.setClasspathContainer(ipath, new IJavaProject[] { project },
+ new IClasspathContainer[] { container }, null);
+ }
+
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntime.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntime.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntime.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,57 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.util;
+
+public class JBPMRuntime {
+
+ private String name;
+ private String path;
+ private boolean isDefault;
+ private String[] jars;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public boolean isDefault() {
+ return isDefault;
+ }
+
+ public void setDefault(boolean isDefault) {
+ this.isDefault = isDefault;
+ }
+
+ public String[] getJars() {
+ return jars;
+ }
+
+ public void setJars(String[] jars) {
+ this.jars = jars;
+ }
+}
\ No newline at end of file
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntimeManager.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntimeManager.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntimeManager.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,257 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.util;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.jbpm.JBPMEclipsePlugin;
+import org.jboss.tools.jbpm.preferences.JBPMConstants;
+
+public class JBPMRuntimeManager {
+
+ private static final String JBPM_RUNTIME_RECOGNIZER = "org.jboss.tools.jbpm.runtimeRecognizer";
+
+ public static void createDefaultRuntime(String location) {
+ List<String> jars = new ArrayList<String>();
+ // get all jbpm jars from jbpm eclipse plugin
+ String s = getJBPMLocation();
+ File file = (new Path(s)).toFile();
+ File[] files = file.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory() && files[i].getName().equals("lib")) {
+ File[] jarFiles = files[i].listFiles();
+ for (int j = 0; j < jarFiles.length; j++) {
+ if (jarFiles[j].getPath().endsWith(".jar")) {
+ jars.add(jarFiles[j].getAbsolutePath());
+ }
+ }
+ }
+ }
+ // get eclipse jdt jar
+ String pluginRootString = Platform.getInstallLocation().getURL().getPath() + "plugins/";
+ File pluginRoot = new Path(pluginRootString).toFile();
+ files = pluginRoot.listFiles();
+ boolean found = false;
+ // search for eclipse jdt 3.6.x jar
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].getAbsolutePath().indexOf("org.eclipse.jdt.core_3.6") > -1) {
+ jars.add(files[i].getAbsolutePath());
+ found = true;
+ break;
+ }
+ }
+ // if not found, search for eclipse jdt 3.5.x jar
+ if (!found) {
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].getAbsolutePath().indexOf("org.eclipse.jdt.core_3.5") > -1) {
+ jars.add(files[i].getAbsolutePath());
+ found = true;
+ break;
+ }
+ }
+ }
+ // if not found, search for eclipse jdt 3.4.x jar
+ if (!found) {
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].getAbsolutePath().indexOf("org.eclipse.jdt.core_3.4") > -1) {
+ jars.add(files[i].getAbsolutePath());
+ break;
+ }
+ }
+ }
+ // copy jars to specified location
+ if (!location.endsWith(File.separator)) {
+ location = location + File.separator;
+ }
+ for (String jar: jars) {
+ try {
+ File jarFile = new File(jar);
+ FileChannel inChannel = new FileInputStream(jarFile).getChannel();
+ FileChannel outChannel = new FileOutputStream(new File(
+ location + jarFile.getName())).getChannel();
+ try {
+ inChannel.transferTo(0, inChannel.size(), outChannel);
+ }
+ catch (IOException e) {
+ throw e;
+ }
+ finally {
+ if (inChannel != null) inChannel.close();
+ if (outChannel != null) outChannel.close();
+ }
+ } catch (Throwable t) {
+ JBPMEclipsePlugin.log(t);
+ }
+ }
+ }
+
+ private static String getJBPMLocation() {
+ try {
+ return FileLocator.toFileURL(Platform.getBundle("org.jboss.tools.jbpm").getEntry("/")).getFile().toString();
+ } catch (IOException e) {
+ JBPMEclipsePlugin.log(e);
+ }
+ return null;
+ }
+
+ private static String generateString(JBPMRuntime[] jBPMRuntimes) {
+ String result = "";
+ for (JBPMRuntime runtime: jBPMRuntimes) {
+ result += runtime.getName() + "#" + runtime.getPath() + "#" + runtime.isDefault() + "# ";
+ if (runtime.getJars() != null) {
+ for (String jar: runtime.getJars()) {
+ result += jar + ";";
+ }
+ }
+ result += "###";
+ }
+ return result;
+ }
+
+ private static JBPMRuntime[] generateRuntimes(String s) {
+ List<JBPMRuntime> result = new ArrayList<JBPMRuntime>();
+ if (s != null && !"".equals(s)) {
+ String[] runtimeStrings = s.split("###");
+ for (String runtimeString: runtimeStrings) {
+ String[] properties = runtimeString.split("#");
+ JBPMRuntime runtime = new JBPMRuntime();
+ runtime.setName(properties[0]);
+ runtime.setPath(properties[1]);
+ runtime.setDefault("true".equals(properties[2]));
+ if (properties.length > 3) {
+ List<String> list = new ArrayList<String>();
+ String[] jars = properties[3].split(";");
+ for (String jar: jars) {
+ jar = jar.trim();
+ if (jar.length() > 0) {
+ list.add(jar);
+ }
+ }
+ runtime.setJars(list.toArray(new String[list.size()]));
+ }
+ result.add(runtime);
+ }
+ }
+ return result.toArray(new JBPMRuntime[result.size()]);
+ }
+
+ public static JBPMRuntime[] getJBPMRuntimes() {
+ String runtimesString = JBPMEclipsePlugin.getDefault().getPreferenceStore()
+ .getString(JBPMConstants.JBPM_RUNTIMES);
+ if (runtimesString != null) {
+ return generateRuntimes(runtimesString);
+ }
+ return new JBPMRuntime[0];
+ }
+
+ public static void setJBPMRuntimes(JBPMRuntime[] runtimes) {
+ JBPMEclipsePlugin.getDefault().getPreferenceStore().setValue(JBPMConstants.JBPM_RUNTIMES,
+ JBPMRuntimeManager.generateString(runtimes));
+ }
+
+ public static JBPMRuntime getJBPMRuntime(String name) {
+ JBPMRuntime[] runtimes = getJBPMRuntimes();
+ for (JBPMRuntime runtime: runtimes) {
+ if (runtime.getName().equals(name)) {
+ return runtime;
+ }
+ }
+ return null;
+ }
+
+ public static JBPMRuntime getDefaultJBPMRuntime() {
+ JBPMRuntime[] runtimes = getJBPMRuntimes();
+ for (JBPMRuntime runtime: runtimes) {
+ if (runtime.isDefault()) {
+ return runtime;
+ }
+ }
+ return null;
+ }
+
+ public static String getJBPMRuntime(IProject project) {
+ try {
+ IFile file = project.getFile(".settings/.jbpm.runtime");
+ if (file.exists()) {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()));
+ String location = reader.readLine();
+ if (location.startsWith("<runtime>") && location.endsWith("</runtime>")) {
+ return location.substring(9, location.length() - 10);
+ }
+ }
+ } catch (Exception e) {
+ JBPMEclipsePlugin.log(e);
+ }
+ return null;
+ }
+
+ public static String[] getJBPMRuntimeJars(IProject project) {
+ String runtimeName = getJBPMRuntime(project);
+ JBPMRuntime runtime = null;
+ if (runtimeName == null) {
+ runtime = getDefaultJBPMRuntime();
+ } else {
+ runtime = getJBPMRuntime(runtimeName);
+ }
+ if (runtime == null) {
+ return null;
+ }
+ if (runtime.getJars() == null || runtime.getJars().length == 0) {
+ recognizeJars(runtime);
+ }
+ return runtime.getJars();
+ }
+
+ public static void recognizeJars(JBPMRuntime runtime) {
+ String path = runtime.getPath();
+ if (path != null) {
+ try {
+ IConfigurationElement[] config = Platform.getExtensionRegistry()
+ .getConfigurationElementsFor(JBPM_RUNTIME_RECOGNIZER);
+ for (IConfigurationElement e : config) {
+ Object o = e.createExecutableExtension("class");
+ if (o instanceof JBPMRuntimeRecognizer) {
+ String[] jars = ((JBPMRuntimeRecognizer) o).recognizeJars(path);
+ if (jars != null && jars.length > 0) {
+ runtime.setJars(jars);
+ return;
+ }
+ }
+ }
+ } catch (Exception ex) {
+ System.out.println(ex.getMessage());
+ }
+
+ runtime.setJars(new DefaultJBPMRuntimeRecognizer().recognizeJars(path));
+ }
+ }
+
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntimeRecognizer.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntimeRecognizer.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/JBPMRuntimeRecognizer.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.util;
+
+public interface JBPMRuntimeRecognizer {
+
+ String[] recognizeJars(String path);
+
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/ProjectClassLoader.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/ProjectClassLoader.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/util/ProjectClassLoader.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,138 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.util;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.jboss.tools.jbpm.JBPMEclipsePlugin;
+
+public class ProjectClassLoader {
+
+ public static URLClassLoader getProjectClassLoader(IEditorPart editor) {
+ IEditorInput input = editor.getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ return getProjectClassLoader(((IFileEditorInput) input).getFile());
+ }
+ return null;
+ }
+
+ public static URLClassLoader getProjectClassLoader(IFile file) {
+ IProject project = file.getProject();
+ IJavaProject javaProject = JavaCore.create(project);
+ return getProjectClassLoader(javaProject);
+ }
+
+ public static URLClassLoader getProjectClassLoader(IJavaProject project) {
+ List<URL> pathElements = getProjectClassPathURLs(project, new ArrayList<String>());
+ URL urlPaths[] = pathElements.toArray(new URL[pathElements.size()]);
+ return new URLClassLoader(urlPaths, Thread.currentThread().getContextClassLoader());
+ }
+
+ private static URL getRawLocationURL(IPath simplePath)
+ throws MalformedURLException {
+ File file = getRawLocationFile(simplePath);
+ return file.toURI().toURL();
+ }
+
+ private static File getRawLocationFile(IPath simplePath) {
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(simplePath);
+ File file = null;
+ if (resource != null) {
+ file = ResourcesPlugin.getWorkspace().getRoot().findMember(
+ simplePath).getRawLocation().toFile();
+ } else {
+ file = simplePath.toFile();
+ }
+ return file;
+ }
+
+ public static List<URL> getProjectClassPathURLs(IJavaProject project, List<String> alreadyLoadedProjects) {
+ List<URL> pathElements = new ArrayList<URL>();
+ try {
+ IClasspathEntry[] paths = project.getResolvedClasspath(true);
+ Set<IPath> outputPaths = new HashSet<IPath>();
+ if (paths != null) {
+ for ( int i = 0; i < paths.length; i++ ) {
+ IClasspathEntry path = paths[i];
+ if (path.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+ URL url = getRawLocationURL(path.getPath());
+ pathElements.add(url);
+ } else if (path.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ IPath output = path.getOutputLocation();
+ if (path.getOutputLocation() != null) {
+ outputPaths.add(output);
+ }
+ }
+ }
+ }
+ IPath location = getProjectLocation(project.getProject());
+ IPath outputPath = location.append(project.getOutputLocation().removeFirstSegments(1));
+ pathElements.add(0, outputPath.toFile().toURI().toURL());
+ for (IPath path: outputPaths) {
+ outputPath = location.append(path.removeFirstSegments(1));
+ pathElements.add(0, outputPath.toFile().toURI().toURL());
+ }
+
+ // also add classpath of required projects
+ for (String projectName: project.getRequiredProjectNames()) {
+ if (!alreadyLoadedProjects.contains(projectName)) {
+ alreadyLoadedProjects.add(projectName);
+ IProject reqProject = project.getProject().getWorkspace()
+ .getRoot().getProject(projectName);
+ if (reqProject != null) {
+ IJavaProject reqJavaProject = JavaCore.create(reqProject);
+ pathElements.addAll(getProjectClassPathURLs(reqJavaProject, alreadyLoadedProjects));
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ JBPMEclipsePlugin.log(e);
+ } catch (MalformedURLException e) {
+ JBPMEclipsePlugin.log(e);
+ } catch (Throwable t) {
+ JBPMEclipsePlugin.log(t);
+ }
+ return pathElements;
+ }
+
+ public static IPath getProjectLocation(IProject project) {
+ if (project.getRawLocation() == null) {
+ return project.getLocation();
+ } else {
+ return project.getRawLocation();
+ }
+ }
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectRuntimeWizardPage.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectRuntimeWizardPage.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectRuntimeWizardPage.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,173 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.wizard.project;
+
+import java.util.HashMap;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.jboss.tools.jbpm.preferences.JBPMProjectPreferencePage;
+import org.jboss.tools.jbpm.util.JBPMRuntime;
+import org.jboss.tools.jbpm.util.JBPMRuntimeManager;
+
+public class NewJBPMProjectRuntimeWizardPage extends WizardPage {
+
+ private boolean isDefaultRuntime = true;
+ private String selectedRuntime;
+ private Button projectSpecificRuntime;
+ private Combo jBPMRuntimeCombo;
+
+ public NewJBPMProjectRuntimeWizardPage() {
+ super("extendedNewProjectRuntimePage");
+ setTitle("jBPM Runtime");
+ setDescription("Select a jBPM Runtime");
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ composite.setLayout(gridLayout);
+
+ JBPMRuntime defaultRuntime = JBPMRuntimeManager.getDefaultJBPMRuntime();
+ projectSpecificRuntime = createCheckBox(composite,
+ "Use default jBPM Runtime (currently "
+ + (defaultRuntime == null ? "undefined)" : defaultRuntime.getName() + ")"));
+ projectSpecificRuntime.setSelection(true);
+ projectSpecificRuntime.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ isDefaultRuntime = ((Button) e.widget).getSelection();
+ jBPMRuntimeCombo.setEnabled(!isDefaultRuntime);
+ }
+ });
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 2;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ projectSpecificRuntime.setLayoutData(gridData);
+
+ Label nameLabel = new Label(composite, SWT.NONE);
+ nameLabel.setText("jBPM Runtime: ");
+ jBPMRuntimeCombo = new Combo(composite, SWT.READ_ONLY);
+ jBPMRuntimeCombo.setEnabled(false);
+ jBPMRuntimeCombo.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ selectedRuntime = jBPMRuntimeCombo.getText();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ selectedRuntime = jBPMRuntimeCombo.getText();
+ }
+ });
+ JBPMRuntime[] runtimes = JBPMRuntimeManager.getJBPMRuntimes();
+ if (runtimes.length == 0) {
+ setErrorMessage("No jBPM Runtimes have been defined, configure workspace settings first");
+ } else {
+ setErrorMessage(null);
+ for (int i = 0; i < runtimes.length; i++) {
+ jBPMRuntimeCombo.add(runtimes[i].getName());
+ }
+ jBPMRuntimeCombo.select(0);
+ selectedRuntime = jBPMRuntimeCombo.getText();
+ }
+ gridData = new GridData();
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ jBPMRuntimeCombo.setLayoutData(gridData);
+ Link changeWorkspaceSettingsLink = createLink(composite, "Configure Workspace Settings...");
+ changeWorkspaceSettingsLink.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+
+ Composite subPanel = new Composite(composite, SWT.NONE);
+ gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ subPanel.setLayout(gridLayout);
+ gridData = new GridData();
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.horizontalSpan = 2;
+ subPanel.setLayoutData(gridData);
+
+ setMessage(null);
+ setPageComplete(runtimes.length > 0);
+ setControl(composite);
+ }
+
+ private Button createCheckBox(Composite group, String label) {
+ Button button = new Button(group, SWT.CHECK | SWT.LEFT);
+ button.setText(label);
+ GridData data = new GridData();
+ button.setLayoutData(data);
+ return button;
+ }
+
+ private Link createLink(Composite composite, String text) {
+ Link link= new Link(composite, SWT.NONE);
+ link.setFont(composite.getFont());
+ link.setText("<A>" + text + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
+ link.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ openLink();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ openLink();
+ }
+ });
+ return link;
+ }
+
+ private void openLink() {
+ PreferencesUtil.createPreferenceDialogOn(getShell(),
+ JBPMProjectPreferencePage.PREF_ID,
+ new String[] { JBPMProjectPreferencePage.PROP_ID }, new HashMap()).open();
+ jBPMRuntimeCombo.removeAll();
+ JBPMRuntime[] runtimes = JBPMRuntimeManager.getJBPMRuntimes();
+ if (runtimes.length == 0) {
+ setPageComplete(false);
+ setErrorMessage("No jBPM Runtimes have been defined, please do this first");
+ } else {
+ setPageComplete(true);
+ setErrorMessage(null);
+ for (int i = 0; i < runtimes.length; i++) {
+ jBPMRuntimeCombo.add(runtimes[i].getName());
+ }
+ jBPMRuntimeCombo.select(0);
+ selectedRuntime = jBPMRuntimeCombo.getText();
+ }
+ JBPMRuntime defaultRuntime = JBPMRuntimeManager.getDefaultJBPMRuntime();
+ projectSpecificRuntime.setText("Use default jBPM Runtime (currently "
+ + (defaultRuntime == null ? "undefined)" : defaultRuntime.getName() + ")"));
+ }
+
+ public JBPMRuntime getJBPMRuntime() {
+ if (isDefaultRuntime) {
+ return null;
+ }
+ return JBPMRuntimeManager.getJBPMRuntime(selectedRuntime);
+ }
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectWizard.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectWizard.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectWizard.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,366 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.wizard.project;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.ICommand;
+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.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+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.jdt.ui.PreferenceConstants;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+import org.jboss.tools.jbpm.JBPMEclipsePlugin;
+import org.jboss.tools.jbpm.util.JBPMClasspathContainer;
+import org.jboss.tools.jbpm.util.JBPMRuntime;
+
+/**
+ * A wizard to create a new jBPM project.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">kris verlaenen </a>
+ */
+public class NewJBPMProjectWizard extends BasicNewResourceWizard {
+
+ public static final String JBPM_CLASSPATH_CONTAINER_PATH = "JBPM/jbpm";
+
+ private IProject newProject;
+ private WizardNewProjectCreationPage mainPage;
+ private NewJBPMProjectWizardPage extraPage;
+ private NewJBPMProjectRuntimeWizardPage runtimePage;
+
+ public void addPages() {
+ super.addPages();
+ mainPage = new WizardNewProjectCreationPage("basicNewProjectPage");
+ mainPage.setTitle("New jBPM Project");
+ mainPage.setDescription("Create a new jBPM Project");
+ this.addPage(mainPage);
+ extraPage = new NewJBPMProjectWizardPage();
+ addPage(extraPage);
+ runtimePage = new NewJBPMProjectRuntimeWizardPage();
+ addPage(runtimePage);
+ setNeedsProgressMonitor(true);
+ }
+
+ public boolean performFinish() {
+ createJBPMProject();
+ if (newProject == null) {
+ return false;
+ }
+ selectAndReveal(newProject);
+ return true;
+ }
+
+ private void createJBPMProject() {
+ newProject = createNewProject();
+ WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ IJavaProject project = JavaCore.create(newProject);
+ createJBPMRuntime(project, monitor);
+ createOutputLocation(project, monitor);
+ addJavaBuilder(project, monitor);
+ setClasspath(project, monitor);
+ createInitialContent(project, monitor);
+ newProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
+ } catch (IOException _ex) {
+ ErrorDialog.openError(getShell(), "Problem creating jBPM project",
+ null, null);
+ }
+ }
+ };
+ try {
+ getContainer().run(true, true, op);
+ } catch (Throwable t) {
+ JBPMEclipsePlugin.log(t);
+ }
+ }
+
+ private IProject createNewProject() {
+ if (newProject != null) {
+ return newProject;
+ }
+ final IProject newProjectHandle = mainPage.getProjectHandle();
+
+ // get a project descriptor
+ IPath newPath = null;
+ if (!mainPage.useDefaults())
+ newPath = mainPage.getLocationPath();
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final IProjectDescription description = workspace
+ .newProjectDescription(newProjectHandle.getName());
+ description.setLocation(newPath);
+ addNatures(description);
+
+ // create the new project operation
+ WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException {
+ createProject(description, newProjectHandle, monitor);
+ }
+ };
+
+ // run the new project creation operation
+ try {
+ getContainer().run(true, true, op);
+ } catch (InterruptedException e) {
+ return null;
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ if (t instanceof CoreException) {
+ if (((CoreException) t).getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) {
+ MessageDialog.openError(getShell(),
+ "NewProject.errorMessage",
+ "NewProject.caseVariantExistsError"
+ + newProjectHandle.getName());
+ } else {
+ ErrorDialog.openError(getShell(),
+ "NewProject.errorMessage", null, // no special message
+ ((CoreException) t).getStatus());
+ }
+ } else {
+ JBPMEclipsePlugin.log(e);
+ }
+ return null;
+ }
+
+ return newProjectHandle;
+ }
+
+ private void addNatures(IProjectDescription projectDescription) {
+ List list = new ArrayList();
+ list.addAll(Arrays.asList(projectDescription.getNatureIds()));
+ list.add("org.eclipse.jdt.core.javanature");
+ projectDescription.setNatureIds((String[]) list
+ .toArray(new String[list.size()]));
+ }
+
+ private void createProject(IProjectDescription description,
+ IProject projectHandle, IProgressMonitor monitor)
+ throws CoreException, OperationCanceledException {
+ try {
+ monitor.beginTask("", 2000);
+ projectHandle.create(description, new SubProgressMonitor(monitor,
+ 1000));
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ projectHandle.open(IResource.BACKGROUND_REFRESH,
+ new SubProgressMonitor(monitor, 1000));
+ } finally {
+ monitor.done();
+ }
+ }
+
+ private void createJBPMRuntime(IJavaProject project, IProgressMonitor monitor) throws CoreException {
+ JBPMRuntime runtime = runtimePage.getJBPMRuntime();
+ if (runtime != null) {
+ IFile file = project.getProject().getFile(".settings/.jbpm.runtime");
+ String runtimeString = "<runtime>" + runtime.getName() + "</runtime>";
+ if (!file.exists()) {
+ IFolder folder = project.getProject().getFolder(".settings");
+ if (!folder.exists()) {
+ folder.create(true, true, null);
+ }
+ file.create(new ByteArrayInputStream(runtimeString.getBytes()), true, null);
+ } else {
+ file.setContents(new ByteArrayInputStream(runtimeString.getBytes()), true, false, null);
+ }
+ }
+ }
+
+ private void createOutputLocation(IJavaProject project, IProgressMonitor monitor)
+ throws JavaModelException, CoreException {
+ IFolder folder = project.getProject().getFolder("bin");
+ createFolder(folder, monitor);
+ IPath path = folder.getFullPath();
+ project.setOutputLocation(path, null);
+ }
+
+ private void addJavaBuilder(IJavaProject project, IProgressMonitor monitor) throws CoreException {
+ IProjectDescription description = project.getProject().getDescription();
+ ICommand[] commands = description.getBuildSpec();
+ ICommand[] newCommands = new ICommand[commands.length + 1];
+ System.arraycopy(commands, 0, newCommands, 0, commands.length);
+
+ ICommand javaCommand = description.newCommand();
+ javaCommand.setBuilderName("org.eclipse.jdt.core.javabuilder");
+ newCommands[commands.length] = javaCommand;
+
+ description.setBuildSpec(newCommands);
+ project.getProject().setDescription(description, monitor);
+ }
+
+ private void setClasspath(IJavaProject project, IProgressMonitor monitor)
+ throws JavaModelException, CoreException {
+ project.setRawClasspath(new IClasspathEntry[0], monitor);
+ addSourceFolders(project, monitor);
+ addJRELibraries(project, monitor);
+ addJBPMLibraries(project, monitor);
+ }
+
+ private void addSourceFolders(IJavaProject project, IProgressMonitor monitor) throws JavaModelException, CoreException {
+ List list = new ArrayList();
+ list.addAll(Arrays.asList(project.getRawClasspath()));
+ addSourceFolder(project, list, "src/main/java", monitor);
+ addSourceFolder(project, list, "src/main/resources", monitor);
+ project.setRawClasspath((IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]), null);
+ }
+
+ private void addJRELibraries(IJavaProject project, IProgressMonitor monitor) throws JavaModelException {
+ List list = new ArrayList();
+ list.addAll(Arrays.asList(project.getRawClasspath()));
+ list.addAll(Arrays.asList(PreferenceConstants.getDefaultJRELibrary()));
+ project.setRawClasspath((IClasspathEntry[]) list
+ .toArray(new IClasspathEntry[list.size()]), monitor);
+ }
+
+ private static IPath getClassPathContainerPath() {
+ return new Path(JBPM_CLASSPATH_CONTAINER_PATH);
+ }
+
+ private static void createJBPMLibraryContainer(IJavaProject project, IProgressMonitor monitor)
+ throws JavaModelException {
+ JavaCore.setClasspathContainer(getClassPathContainerPath(),
+ new IJavaProject[] { project },
+ new IClasspathContainer[] { new JBPMClasspathContainer(
+ project, getClassPathContainerPath()) }, monitor);
+ }
+
+ public static void addJBPMLibraries(IJavaProject project, IProgressMonitor monitor)
+ throws JavaModelException {
+ createJBPMLibraryContainer(project, monitor);
+ List list = new ArrayList();
+ list.addAll(Arrays.asList(project.getRawClasspath()));
+ list.add(JavaCore.newContainerEntry(getClassPathContainerPath()));
+ project.setRawClasspath((IClasspathEntry[]) list
+ .toArray(new IClasspathEntry[list.size()]), monitor);
+ }
+
+ private void createInitialContent(IJavaProject project, IProgressMonitor monitor)
+ throws CoreException, JavaModelException, IOException {
+ try {
+ if (extraPage.createProcessFile()) {
+ createRuleFlow(project, monitor);
+ }
+ if (extraPage.createJavaProcessFile()) {
+ createProcessSampleLauncher(project);
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the sample process file.
+ */
+ private void createRuleFlow(IJavaProject project, IProgressMonitor monitor) throws CoreException {
+
+ String fileName = "org/jboss/tools/jbpm/wizard/project/sample.bpmn.template";
+ IFolder folder = project.getProject().getFolder("src/main/resources");
+ IFile file = folder.getFile("sample.bpmn");
+ InputStream inputstream = getClass().getClassLoader().getResourceAsStream(fileName);
+ if (!file.exists()) {
+ file.create(inputstream, true, monitor);
+ } else {
+ file.setContents(inputstream, true, false, monitor);
+ }
+ }
+
+ /**
+ * Create the sample RuleFlow launcher file.
+ */
+ private void createProcessSampleLauncher(IJavaProject project)
+ throws JavaModelException, IOException {
+
+ String s = "org/jboss/tools/jbpm/wizard/project/ProcessLauncherSample.java.template";
+ IFolder folder = project.getProject().getFolder("src/main/java");
+ IPackageFragmentRoot packageFragmentRoot = project
+ .getPackageFragmentRoot(folder);
+ IPackageFragment packageFragment = packageFragmentRoot
+ .createPackageFragment("com.sample", true, null);
+ InputStream inputstream = getClass().getClassLoader()
+ .getResourceAsStream(s);
+ packageFragment.createCompilationUnit("ProcessTest.java", new String(
+ readStream(inputstream)), true, null);
+ }
+
+ private byte[] readStream(InputStream inputstream) throws IOException {
+ byte bytes[] = (byte[]) null;
+ int i = 0;
+ byte tempBytes[] = new byte[1024];
+ for (int j = inputstream.read(tempBytes); j != -1; j = inputstream.read(tempBytes)) {
+ byte tempBytes2[] = new byte[i + j];
+ if (i > 0) {
+ System.arraycopy(bytes, 0, tempBytes2, 0, i);
+ }
+ System.arraycopy(tempBytes, 0, tempBytes2, i, j);
+ bytes = tempBytes2;
+ i += j;
+ }
+
+ return bytes;
+ }
+
+ private void addSourceFolder(IJavaProject project, List list, String s, IProgressMonitor monitor) throws CoreException {
+ IFolder folder = project.getProject().getFolder(s);
+ createFolder(folder, monitor);
+ IPackageFragmentRoot ipackagefragmentroot = project.getPackageFragmentRoot(folder);
+ list.add(JavaCore.newSourceEntry(ipackagefragmentroot.getPath()));
+ }
+
+ private void createFolder(IFolder folder, IProgressMonitor monitor) throws CoreException {
+ IContainer container = folder.getParent();
+ if (container != null && !container.exists()
+ && (container instanceof IFolder))
+ createFolder((IFolder) container, monitor);
+ if (!folder.exists()) {
+ folder.create(true, true, monitor);
+ }
+ }
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectWizardPage.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectWizardPage.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/java/org/jboss/tools/jbpm/wizard/project/NewJBPMProjectWizardPage.java 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.tools.jbpm.wizard.project;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+public class NewJBPMProjectWizardPage extends WizardPage {
+
+ private Button addSampleProcessButton;
+ private Button addSampleJavaProcessCodeButton;
+ private boolean addSampleJavaProcessCode = true;
+ private boolean addSampleProcess = true;
+
+ public NewJBPMProjectWizardPage() {
+ super("extendedNewProjectPage");
+ setTitle("New jBPM Project");
+ setDescription("Create a new jBPM Project");
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setFont(parent.getFont());
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createControls(composite);
+ setPageComplete(true);
+ // Show description on opening
+ setErrorMessage(null);
+ setMessage(null);
+ setControl(composite);
+ }
+
+ private void createControls(Composite parent) {
+ addSampleProcessButton = createCheckBox(parent,
+ "Add a sample HelloWorld process file to this project.");
+ addSampleProcessButton.setSelection(addSampleProcess);
+ addSampleProcessButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ addSampleProcess = ((Button) e.widget).getSelection();
+ }
+ });
+ addSampleJavaProcessCodeButton = createCheckBox(parent,
+ "Add a sample Java class for loading and executing the HelloWorld process.");
+ addSampleJavaProcessCodeButton.setSelection(addSampleJavaProcessCode);
+ addSampleJavaProcessCodeButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ addSampleJavaProcessCode = ((Button) e.widget).getSelection();
+ }
+ });
+
+ }
+
+ private Button createCheckBox(Composite group, String label) {
+ Button button = new Button(group, SWT.CHECK | SWT.LEFT);
+ button.setText(label);
+ GridData data = new GridData();
+ button.setLayoutData(data);
+ return button;
+ }
+
+ public boolean createProcessFile() {
+ return addSampleProcess;
+ }
+
+ public boolean createJavaProcessFile() {
+ return addSampleJavaProcessCode;
+ }
+}
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/project/ProcessLauncherSample.java.template
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/project/ProcessLauncherSample.java.template (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/project/ProcessLauncherSample.java.template 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,61 @@
+package com.sample;
+
+import java.util.Properties;
+
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.ResourceType;
+import org.drools.compiler.BPMN2ProcessFactory;
+import org.drools.compiler.ProcessBuilderFactory;
+import org.drools.impl.EnvironmentFactory;
+import org.drools.io.ResourceFactory;
+import org.drools.logger.KnowledgeRuntimeLogger;
+import org.drools.logger.KnowledgeRuntimeLoggerFactory;
+import org.drools.marshalling.impl.ProcessMarshallerFactory;
+import org.drools.runtime.KnowledgeSessionConfiguration;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.runtime.process.ProcessRuntimeFactory;
+import org.jbpm.bpmn2.BPMN2ProcessProviderImpl;
+import org.jbpm.marshalling.impl.ProcessMarshallerFactoryServiceImpl;
+import org.jbpm.process.builder.ProcessBuilderFactoryServiceImpl;
+import org.jbpm.process.instance.ProcessRuntimeFactoryServiceImpl;
+
+/**
+ * This is a sample file to launch a process.
+ */
+public class ProcessTest {
+
+ public static final void main(String[] args) {
+ try {
+ // load up the knowledge base
+ KnowledgeBase kbase = readKnowledgeBase();
+ StatefulKnowledgeSession ksession = createSession(kbase);
+ KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
+ // start a new process instance
+ ksession.startProcess("com.sample.bpmn.hello");
+ logger.close();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ private static KnowledgeBase readKnowledgeBase() throws Exception {
+ ProcessBuilderFactory.setProcessBuilderFactoryService(new ProcessBuilderFactoryServiceImpl());
+ ProcessMarshallerFactory.setProcessMarshallerFactoryService(new ProcessMarshallerFactoryServiceImpl());
+ ProcessRuntimeFactory.setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);
+ return kbuilder.newKnowledgeBase();
+ }
+
+ private static StatefulKnowledgeSession createSession(KnowledgeBase kbase) {
+ Properties properties = new Properties();
+ properties.put("drools.processInstanceManagerFactory", "org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory");
+ properties.put("drools.processSignalManagerFactory", "org.jbpm.process.instance.event.DefaultSignalManagerFactory");
+ KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
+ return kbase.newStatefulKnowledgeSession(config, EnvironmentFactory.newEnvironment());
+ }
+}
\ No newline at end of file
Added: trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/project/sample.bpmn.template
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/project/sample.bpmn.template (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.jbpm/src/main/resources/org/jboss/tools/jbpm/wizard/project/sample.bpmn.template 2010-09-21 14:43:32 UTC (rev 25056)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions id="Definition"
+ targetNamespace="http://www.jboss.org/drools"
+ typeLanguage="http://www.java.com/javaTypes"
+ expressionLanguage="http://www.mvel.org/2.0"
+ xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+ xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
+ xmlns:g="http://www.jboss.org/drools/flow/gpd"
+ xmlns:tns="http://www.jboss.org/drools">
+
+ <process processType="Private" isExecutable="true" id="com.sample.bpmn.hello" name="Hello World" >
+
+ <!-- nodes -->
+ <startEvent id="_1" name="StartProcess" g:x="16" g:y="16" g:width="48" g:height="48" />
+ <scriptTask id="_2" name="Hello" g:x="96" g:y="16" g:width="80" g:height="48" >
+ <script>System.out.println("Hello World");</script>
+ </scriptTask>
+ <endEvent id="_3" name="EndProcess" g:x="208" g:y="16" g:width="48" g:height="48" />
+
+ <!-- connections -->
+ <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
+ <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
+
+ </process>
+
+</definitions>
\ No newline at end of file
15 years, 7 months
JBoss Tools SVN: r25055 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-09-21 10:32:44 -0400 (Tue, 21 Sep 2010)
New Revision: 25055
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
Log:
https://jira.jboss.org/browse/JBIDE-7083
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2010-09-21 14:16:56 UTC (rev 25054)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2010-09-21 14:32:44 UTC (rev 25055)
@@ -688,12 +688,22 @@
private void setCodeGenerationProperties() {
String p = (String) model
.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME);
- sessionBeanPkgNameditor.setValue(getSessionPkgName(p));
- entityBeanPkgNameditor.setValue(getEntityPkgName(p));
- testsPkgNameditor.setValue(getTestPkgName(p));
- ejbProjectNameditor.setValue(getEJBProjectName(p));
- earProjectNameditor.setValue(getEARProjectName(p));
- testProjectNameditor.setValue(getTestProjectName(p));
+
+ if(p == null)
+ return;
+
+ if(sessionBeanPkgNameditor.getValueAsString() == null || "".equals(sessionBeanPkgNameditor.getValueAsString().trim()))
+ sessionBeanPkgNameditor.setValue(getSessionPkgName(p));
+ if(entityBeanPkgNameditor.getValueAsString() == null || "".equals(entityBeanPkgNameditor.getValueAsString().trim()))
+ entityBeanPkgNameditor.setValue(getEntityPkgName(p));
+ if(testsPkgNameditor.getValueAsString() == null || "".equals(testsPkgNameditor.getValueAsString().trim()))
+ testsPkgNameditor.setValue(getTestPkgName(p));
+ if(ejbProjectNameditor.getValueAsString() == null || "".equals(ejbProjectNameditor.getValueAsString().trim()))
+ ejbProjectNameditor.setValue(getEJBProjectName(p));
+ if(earProjectNameditor.getValueAsString() == null || "".equals(earProjectNameditor.getValueAsString().trim()))
+ earProjectNameditor.setValue(getEARProjectName(p));
+ if(testProjectNameditor.getValueAsString() == null || "".equals(testProjectNameditor.getValueAsString().trim()))
+ testProjectNameditor.setValue(getTestProjectName(p));
}
private String getSessionPkgName(String projectName) {
15 years, 7 months
JBoss Tools SVN: r25054 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp: selection/bar and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-09-21 10:16:56 -0400 (Tue, 21 Sep 2010)
New Revision: 25054
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java
Log:
JBIDE-7059, show selection bar behaviour has been adjusted
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2010-09-21 14:03:39 UTC (rev 25053)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2010-09-21 14:16:56 UTC (rev 25054)
@@ -611,6 +611,12 @@
palettePage.dispose();
palettePage = null;
}
+ IContextService contextService = (IContextService) getSite()
+ .getService(IContextService.class);
+ if(selBarContextActivation!=null){
+ contextService.deactivateContext(selBarContextActivation);
+ selBarContextActivation=null;
+ }
super.dispose();
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java 2010-09-21 14:03:39 UTC (rev 25053)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java 2010-09-21 14:16:56 UTC (rev 25054)
@@ -174,7 +174,7 @@
createArrowButton();
cmpToolBar.layout();
splitter.getParent().layout(true, true);
- setVisible((Boolean)toggleSelBarState.getValue());
+ setVisible(toggleSelBarCommand.isEnabled()&&(Boolean)toggleSelBarState.getValue());
return splitter;
}
@@ -649,11 +649,11 @@
}
public void handleStateChange(State state, Object oldValue) {
- setVisible((Boolean)state.getValue());
+ setVisible(toggleSelBarCommand.isEnabled()&&(Boolean)state.getValue());
}
public void commandChanged(CommandEvent commandEvent) {
- setVisible(commandEvent.getCommand().isEnabled()&&(Boolean)commandEvent.getCommand().getState("org.eclipse.ui.commands.toggleState").getValue()); //$NON-NLS-1$
+ setVisible(toggleSelBarCommand.isEnabled()&&(Boolean)commandEvent.getCommand().getState("org.eclipse.ui.commands.toggleState").getValue()); //$NON-NLS-1$
}
}
15 years, 7 months
JBoss Tools SVN: r25053 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-09-21 10:03:39 -0400 (Tue, 21 Sep 2010)
New Revision: 25053
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java
Log:
JBIDE-7059,layout problem has been corrected
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java 2010-09-21 13:31:55 UTC (rev 25052)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java 2010-09-21 14:03:39 UTC (rev 25053)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.jspeditor;
+import java.awt.Color;
import java.util.ArrayList;
import java.util.Iterator;
@@ -89,9 +90,18 @@
editor.init(site, input);
parent2 = new Composite(getContainer(), SWT.NONE);
ppp = parent2;
- editor.createPartControl(parent2);
+ if(editor==sourcePart){
+ //case when only source part available
+ Composite editorComp = new Composite(parent2, SWT.NONE);
+ editorComp.setLayout(new FillLayout());
+ GridData editorGD=new GridData(GridData.FILL_BOTH);
+ editorGD.horizontalSpan=2;
+ editorComp.setLayoutData(editorGD);
+ editor.createPartControl(editorComp);
+ }else {
+ editor.createPartControl(parent2);
+ }
parent2.setLayout(new GridLayout(2, false));
-
selectionBar = new SelectionBar(sourcePart);
selectionBar.createToolBarComposite(parent2);
editor.addPropertyListener(new IPropertyListener() {
15 years, 7 months