JBoss Tools SVN: r28002 - trunk/ws/tests/org.jboss.tools.ws.creation.core.test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-01-07 16:39:15 -0500 (Fri, 07 Jan 2011)
New Revision: 28002
Modified:
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/pom.xml
Log:
https://issues.jboss.org/browse/JBIDE-6581 configure java system properties so tests will run on Hudson
system property added to test jbosstools.test.jre.6
Modified: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/pom.xml
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/pom.xml 2011-01-07 21:07:32 UTC (rev 28001)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/pom.xml 2011-01-07 21:39:15 UTC (rev 28002)
@@ -13,7 +13,7 @@
<packaging>eclipse-test-plugin</packaging>
<properties>
- <systemProperties>-Djbosstools.test.jre.5=${jbosstools.test.jre.5} -Djbosstools.test.jboss.home.4.2=${requirement.build.root}/jboss-4.2.3.GA</systemProperties>
+ <systemProperties>-Djbosstools.test.jre.6=${jbosstools.test.jre.6} -Djbosstools.test.jre.5=${jbosstools.test.jre.5} -Djbosstools.test.jboss.home.4.2=${requirement.build.root}/jboss-4.2.3.GA</systemProperties>
<emma.filter>org.jboss.tools.ws.creation.core*</emma.filter>
<emma.instrument.bundles>org.jboss.tools.ws.creation.core</emma.instrument.bundles>
</properties>
13 years, 5 months
JBoss Tools SVN: r28001 - trunk/runtime/plugins/org.jboss.tools.runtime.ui.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-01-07 16:07:32 -0500 (Fri, 07 Jan 2011)
New Revision: 28001
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.ui/
Log:
Property changes on: trunk/runtime/plugins/org.jboss.tools.runtime.ui
___________________________________________________________________
Name: svn:ignore
+ bin
13 years, 5 months
JBoss Tools SVN: r28000 - trunk/runtime/plugins/org.jboss.tools.runtime.core.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-01-07 16:06:45 -0500 (Fri, 07 Jan 2011)
New Revision: 28000
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.core/
Log:
Property changes on: trunk/runtime/plugins/org.jboss.tools.runtime.core
___________________________________________________________________
Name: svn:ignore
+ bin
13 years, 5 months
JBoss Tools SVN: r27999 - in trunk/runtime: features/org.jboss.tools.runtime.core.feature and 31 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-01-07 15:57:52 -0500 (Fri, 07 Jan 2011)
New Revision: 27999
Added:
trunk/runtime/features/org.jboss.tools.runtime.core.feature/.project
trunk/runtime/features/org.jboss.tools.runtime.core.feature/build.properties
trunk/runtime/features/org.jboss.tools.runtime.core.feature/feature.properties
trunk/runtime/features/org.jboss.tools.runtime.core.feature/feature.xml
trunk/runtime/features/org.jboss.tools.runtime.core.feature/license.html
trunk/runtime/features/org.jboss.tools.runtime.core.feature/pom.xml
trunk/runtime/plugins/org.jboss.tools.runtime.core/.classpath
trunk/runtime/plugins/org.jboss.tools.runtime.core/.project
trunk/runtime/plugins/org.jboss.tools.runtime.core/.settings/
trunk/runtime/plugins/org.jboss.tools.runtime.core/.settings/org.eclipse.jdt.core.prefs
trunk/runtime/plugins/org.jboss.tools.runtime.core/META-INF/
trunk/runtime/plugins/org.jboss.tools.runtime.core/META-INF/MANIFEST.MF
trunk/runtime/plugins/org.jboss.tools.runtime.core/about.html
trunk/runtime/plugins/org.jboss.tools.runtime.core/about.ini
trunk/runtime/plugins/org.jboss.tools.runtime.core/about.mappings
trunk/runtime/plugins/org.jboss.tools.runtime.core/about.properties
trunk/runtime/plugins/org.jboss.tools.runtime.core/build.properties
trunk/runtime/plugins/org.jboss.tools.runtime.core/jboss_about.png
trunk/runtime/plugins/org.jboss.tools.runtime.core/plugin.properties
trunk/runtime/plugins/org.jboss.tools.runtime.core/plugin.xml
trunk/runtime/plugins/org.jboss.tools.runtime.core/pom.xml
trunk/runtime/plugins/org.jboss.tools.runtime.core/schema/
trunk/runtime/plugins/org.jboss.tools.runtime.core/schema/runtimeDetectors.exsd
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/JBossRuntimeLocator.java
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeCoreActivator.java
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/AbstractRuntimeDetector.java
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IRuntimeDetector.java
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/RuntimePath.java
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/ServerDefinition.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/.classpath
trunk/runtime/plugins/org.jboss.tools.runtime.ui/.project
trunk/runtime/plugins/org.jboss.tools.runtime.ui/.settings/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/.settings/org.eclipse.jdt.core.prefs
trunk/runtime/plugins/org.jboss.tools.runtime.ui/META-INF/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/META-INF/MANIFEST.MF
trunk/runtime/plugins/org.jboss.tools.runtime.ui/build.properties
trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/jboss.gif
trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/complete_tsk.gif
trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/error_tsk.gif
trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/incomplete_tsk.gif
trunk/runtime/plugins/org.jboss.tools.runtime.ui/plugin.properties
trunk/runtime/plugins/org.jboss.tools.runtime.ui/plugin.xml
trunk/runtime/plugins/org.jboss.tools.runtime.ui/pom.xml
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeContentProvider.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeLabelProvider.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeScanner.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/AutoResizeTableLayout.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/EditRuntimePathDialog.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/RuntimePathEditingSupport.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/JBossRuntimePreferencesInitializer.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java
trunk/runtime/plugins/org.jboss.tools.runtime/about.ini
trunk/runtime/plugins/org.jboss.tools.runtime/about.mappings
trunk/runtime/plugins/org.jboss.tools.runtime/about.properties
Removed:
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimeDialog.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java
Modified:
trunk/runtime/features/pom.xml
trunk/runtime/plugins/org.jboss.tools.runtime/.classpath
trunk/runtime/plugins/org.jboss.tools.runtime/.settings/org.eclipse.jdt.core.prefs
trunk/runtime/plugins/org.jboss.tools.runtime/META-INF/MANIFEST.MF
trunk/runtime/plugins/org.jboss.tools.runtime/build.properties
trunk/runtime/plugins/org.jboss.tools.runtime/plugin.properties
trunk/runtime/plugins/org.jboss.tools.runtime/plugin.xml
trunk/runtime/plugins/org.jboss.tools.runtime/pom.xml
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JbpmHandler.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/SeamHandler.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/JBossRuntimePreferencesInitializer.java
trunk/runtime/plugins/pom.xml
Log:
JBIDE-7527 Automatic runtime detection
Added: trunk/runtime/features/org.jboss.tools.runtime.core.feature/.project
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.core.feature/.project (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.core.feature/.project 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.runtime.core.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/runtime/features/org.jboss.tools.runtime.core.feature/build.properties
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.core.feature/build.properties (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.core.feature/build.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ license.html
Added: trunk/runtime/features/org.jboss.tools.runtime.core.feature/feature.properties
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.core.feature/feature.properties (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.core.feature/feature.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,55 @@
+###############################################################################
+# Copyright (c) 2009-2010 JBoss by Red Hat and others.
+# All rights reserved. This program and the accompanying materials
+# are 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:
+# JBoss by Red Hat - Initial implementation.
+##############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=JBoss Runtime Detection Core
+
+# "providerName" property - name of the company that provides the feature
+providerName=JBoss by Red Hat
+
+# "updateSiteName" property - label for the update/discovery sites
+updateSiteName=JBoss Developer Studio Updates
+JBossToolsUpdatesSiteName=JBoss Tools Updates
+
+# "description" property - description of the feature
+description=Project Examples
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=Copyright (c) 2008-2010 JBoss by Red Hat and others.\nAll rights reserved. This program and the accompanying materials\n
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http\://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors\:\n\
+JBoss by Red Hat - Initial implementation.\n
+ ############### end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# START NON-TRANSLATABLE
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=Red Hat, Inc. licenses these features and plugins to you under \
+certain open source licenses (or aggregations of such licenses), which \
+in a particular case may include the Eclipse Public License, the GNU \
+Lesser General Public License, and/or certain other open source \
+licenses. For precise licensing details, consult the corresponding \
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive, \
+Raleigh NC 27606 USA.
+# END NON-TRANSLATABLE
+########### end of license property ##########################################
Added: trunk/runtime/features/org.jboss.tools.runtime.core.feature/feature.xml
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.core.feature/feature.xml (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.core.feature/feature.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.jboss.tools.runtime.core.feature"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.jboss.tools.runtime.core">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.jboss.tools.runtime.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.runtime.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/runtime/features/org.jboss.tools.runtime.core.feature/license.html
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.core.feature/license.html (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.core.feature/license.html 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+
+<body>
+<p>Red Hat, Inc. licenses these features and plugins to you under
+certain open source licenses (or aggregations of such licenses), which
+in a particular case may include the Eclipse Public License, the GNU
+Lesser General Public License, and/or certain other open source
+licenses. For precise licensing details, consult the corresponding
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive,
+Raleigh NC 27606 USA.
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/runtime/features/org.jboss.tools.runtime.core.feature/pom.xml
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.core.feature/pom.xml (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.core.feature/pom.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,14 @@
+<project
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.runtime.core.feature</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-feature</packaging>
+</project>
Modified: trunk/runtime/features/pom.xml
===================================================================
--- trunk/runtime/features/pom.xml 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/features/pom.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -12,6 +12,7 @@
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
+ <module>org.jboss.tools.runtime.core.feature</module>
<module>org.jboss.tools.runtime.feature</module>
</modules>
</project>
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/.classpath
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/.classpath 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/.classpath 2011-01-07 20:57:52 UTC (rev 27999)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/.settings/org.eclipse.jdt.core.prefs 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/.settings/org.eclipse.jdt.core.prefs 2011-01-07 20:57:52 UTC (rev 27999)
@@ -1,7 +1,8 @@
-#Thu Dec 04 23:27:23 CET 2008
+#Thu Dec 02 21:41:17 CET 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/META-INF/MANIFEST.MF
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/META-INF/MANIFEST.MF 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/META-INF/MANIFEST.MF 2011-01-07 20:57:52 UTC (rev 27999)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %BundleName
Bundle-SymbolicName: org.jboss.tools.runtime;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.jboss.tools.runtime.Activator
Bundle-Vendor: %BundleVendor
Require-Bundle: org.eclipse.core.runtime,
@@ -18,9 +18,13 @@
org.eclipse.datatools.connectivity;visibility:=reexport,
org.eclipse.datatools.connectivity.db.generic,
org.jboss.tools.common,
+ org.jboss.tools.runtime.core,
org.jboss.ide.eclipse.as.core,
org.jboss.tools.jbpm.common
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
+Export-Package: org.jboss.tools.runtime,
+ org.jboss.tools.runtime.handlers,
+ org.jboss.tools.runtime.preferences
Added: trunk/runtime/plugins/org.jboss.tools.runtime/about.ini
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/about.ini (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/about.ini 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=jboss_about.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which the
+# welcome page is to be opened.
+# optional
+
+
+
Added: trunk/runtime/plugins/org.jboss.tools.runtime/about.mappings
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/about.mappings (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/about.mappings 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Added: trunk/runtime/plugins/org.jboss.tools.runtime/about.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/about.properties (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/about.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,2 @@
+blurb=JBoss Runtime Initializer\n\nVersion\: {featureVersion}\n\n(c) Copyright JBoss by Red Hat, contributors and others 2004 - 2010. All rights reserved.\nVisit http\://jboss.org/tools
+
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/build.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/build.properties 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/build.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -5,4 +5,7 @@
plugin.xml,\
plugin.properties,\
about.html,\
- icons/
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ jboss_about.png
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/plugin.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/plugin.properties 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/plugin.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -1,5 +1,3 @@
#Properties file for org.jboss.tools.runtime
BundleVendor = JBoss by Red Hat
-BundleName = JBoss Runtime Initializer
-JBoss_Runtimes = JBoss Runtimes
-ImportExportJBossRuntimes = Import / Export JBoss Runtimes
\ No newline at end of file
+BundleName = JBoss Runtime Initializer
\ No newline at end of file
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/plugin.xml
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/plugin.xml 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/plugin.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -13,15 +13,6 @@
point="org.eclipse.core.runtime.preferences">
<initializer class="org.jboss.tools.runtime.preferences.JBossRuntimePreferencesInitializer"/>
</extension>
-
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.jboss.tools.common.model.ui.MainPreferencePage"
- class="org.jboss.tools.runtime.preferences.RuntimePreferencePage"
- id="org.jboss.tools.runtime.preferences.RuntimePreferencePage"
- name="%JBoss_Runtimes"/>
- </extension>
<extension
point="org.eclipse.ui.preferenceTransfer">
@@ -70,4 +61,43 @@
</extension>
-->
+ <extension
+ point="org.jboss.tools.runtime.core.runtimeDetectors">
+ <runtimeDetector
+ id="org.jboss.tools.runtime.handlers.JBossASHandler"
+ name="JBoss AS"
+ class="org.jboss.tools.runtime.handlers.JBossASHandler"
+ preferenceId="org.eclipse.wst.server.ui.runtime.preferencePage"
+ priority="100"/>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.runtime.core.runtimeDetectors">
+ <runtimeDetector
+ id="org.jboss.tools.runtime.handlers.DroolsHandler"
+ name="Drools"
+ class="org.jboss.tools.runtime.handlers.DroolsHandler"
+ preferenceId="org.drools.eclipse.preferences.DroolsRuntimesPreferencePage"
+ priority="300"/>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.runtime.core.runtimeDetectors">
+ <runtimeDetector
+ id="org.jboss.tools.runtime.handlers.JbpmHandler"
+ name="jBPM"
+ class="org.jboss.tools.runtime.handlers.JbpmHandler"
+ preferenceId="org.jboss.tools.jbpm.locations"
+ priority="400"/>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.runtime.core.runtimeDetectors">
+ <runtimeDetector
+ id="org.jboss.tools.runtime.handlers.SeamHandler"
+ name="Seam"
+ class="org.jboss.tools.runtime.handlers.SeamHandler"
+ preferenceId="org.jboss.tools.common.model.ui.seam"
+ priority="200"/>
+ </extension>
</plugin>
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/pom.xml
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/pom.xml 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/pom.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -9,6 +9,6 @@
</parent>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.runtime</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Deleted: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -1,205 +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.runtime;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.jboss.ide.eclipse.as.core.server.bean.JBossServerType;
-import org.jboss.ide.eclipse.as.core.server.bean.ServerBean;
-import org.jboss.ide.eclipse.as.core.server.bean.ServerBeanLoader;
-
-public class JBossRuntimeLocator implements IJBossRuntimePluginConstants {
-
- public static final String JBPM3 = "jBPM3";
-
- public static final String JBPM4 = "jBPM4";
- private final static String seamJarName = "jboss-seam.jar";
- private final static String seamVersionAttributeName = "Seam-Version";
-
- public JBossRuntimeLocator() {
- }
-
- public List<ServerDefinition> searchForRuntimes(String path, IProgressMonitor monitor) {
- return searchForRuntimes(new Path(path), monitor);
- }
-
- public List<ServerDefinition> searchForRuntimes(IPath path, IProgressMonitor monitor) {
- ServerBeanLoader loader = new ServerBeanLoader();
- List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
- return searchForRuntimes(serverDefinitions, path, loader, 4, monitor);
- }
-
- private List<ServerDefinition> searchForRuntimes(List<ServerDefinition> serverDefinitions, IPath path, ServerBeanLoader loader, int depth, IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- return serverDefinitions;
- }
- File[] children = null;
- if (path != null) {
- monitor.setTaskName("Searching " + path.toOSString());
- }
- if (path != null) {
- File root = path.toFile();
- ServerBean serverBean = loader.loadFromLocation(root);
-
- if (!JBossServerType.UNKNOWN.equals(serverBean.getType())) {
- serverDefinitions.add(new ServerDefinition(serverBean));
- if (monitor.isCanceled()) {
- return serverDefinitions;
- }
- } else {
- String seamVersion = getSeamVersionFromManifest(root.getAbsolutePath());
- if (seamVersion != null) {
- serverDefinitions.add(new ServerDefinition(root.getName(), seamVersion, SEAM, root.getAbsoluteFile()));
- if (monitor.isCanceled()) {
- return serverDefinitions;
- }
- } else {
- String[] files = root.list(new FilenameFilter() {
-
- public boolean accept(File dir, String name) {
- if (name.startsWith("drools-api") && name.endsWith(".jar") ) {
- return true;
- }
- return false;
- }
- });
- boolean droolsFound = false;
- if (files != null && files.length > 0) {
- String version = getImplementationVersion(root,files[0]);
- if (version != null) {
- version = version.substring(0,3);
- serverDefinitions.add(new ServerDefinition(root.getName(), version, DROOLS, root.getAbsoluteFile()));
- droolsFound = true;
- }
- }
- if (monitor.isCanceled()) {
- return serverDefinitions;
- }
- boolean jbpmFound = false;
- if (!droolsFound) {
- boolean isJBPM = isValidJbpmInstallation(root.getAbsolutePath());
- if (isJBPM) {
- String version = "unknown";
- if (isJbpm3(root.getAbsolutePath())) {
- version = JBPM3;
- } else if (isJbpm4(root.getAbsolutePath())) {
- version = JBPM4;
- }
- serverDefinitions.add(new ServerDefinition(root.getName(), version, JBPM, root.getAbsoluteFile()));
- jbpmFound = true;
- }
- }
- if (monitor.isCanceled()) {
- return serverDefinitions;
- }
- if (!droolsFound && !jbpmFound) {
- children = root.listFiles();
- }
- }
-
- }
- } else {
- children = File.listRoots();
- }
- if (monitor.isCanceled()) {
- return serverDefinitions;
- }
- if (depth == 0) {
- return serverDefinitions;
- }
- if( children != null ) {
- for( int i = 0; i < children.length; i++ ) {
- if( children[i].isDirectory()) {
- searchForRuntimes(serverDefinitions, new Path(children[i].getAbsolutePath()), loader, --depth, monitor);
- }
- }
- }
- return serverDefinitions;
- }
-
- /**
- * @param dir
- * @param string
- * @return
- */
- private String getImplementationVersion(File dir, String file) {
- File jarFile = new File(dir, file);
- if(!jarFile.isFile()) {
- return null;
- }
- try {
- JarFile jar = new JarFile(jarFile);
- Attributes attributes = jar.getManifest().getMainAttributes();
- String version = attributes.getValue("Implementation-Version");
- return version;
- } catch (IOException e) {
- return null;
- }
- }
-
- public static String getSeamVersionFromManifest(String seamHome) {
- File seamHomeFolder = new File(seamHome);
- if (seamHomeFolder == null || !seamHomeFolder.isDirectory()) {
- return null;
- }
- String[] seamFiles = seamHomeFolder.list(new FilenameFilter() {
-
- public boolean accept(File dir, String name) {
- if ("seam-gen".equals(name)) {
- return true;
- }
- if ("examples".equals(name)) {
- return true;
- }
- return false;
- }
- });
- if (seamFiles == null || seamFiles.length != 2) {
- return null;
- }
- File jarFile = new File(seamHome, "lib/" + seamJarName);
- if(!jarFile.isFile()) {
- jarFile = new File(seamHome, seamJarName);
- if(!jarFile.isFile()) {
- return null;
- }
- }
- try {
- JarFile jar = new JarFile(jarFile);
- Attributes attributes = jar.getManifest().getMainAttributes();
- String version = attributes.getValue(seamVersionAttributeName);
- return version;
- } catch (IOException e) {
- return null;
- }
- }
-
- public static boolean isJbpm3(String location) {
- return new Path(location).append("/src/resources/gpd/version.info.xml").toFile().exists();
- }
-
- public static boolean isJbpm4(String location) {
- return new Path(location).append("/jbpm.jar").toFile().exists();
- }
-
- private boolean isValidJbpmInstallation(String location) {
- return isJbpm3(location) || isJbpm4(location);
- }
-}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -20,6 +20,7 @@
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
+import java.util.Set;
import java.util.StringTokenizer;
import org.eclipse.core.resources.IWorkspaceRoot;
@@ -35,33 +36,13 @@
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.CommonNavigator;
-import org.jboss.tools.runtime.handlers.DroolsHandler;
-import org.jboss.tools.runtime.handlers.JBossASHandler;
-import org.jboss.tools.runtime.handlers.JbpmHandler;
-import org.jboss.tools.runtime.handlers.SeamHandler;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
import org.osgi.framework.Bundle;
import org.osgi.service.prefs.BackingStoreException;
public class JBossRuntimeStartup implements IStartup, IJBossRuntimePluginConstants {
-
- private static IJBossRuntimePersistanceHandler[] jBossRuntimePersistanceHandler = null;
- public static interface IJBossRuntimePersistanceHandler {
- public void initializeRuntimes(List<ServerDefinition> serverDefinitions);
- public void importRuntimes();
- public void exportRuntimes();
- }
-
- public static IJBossRuntimePersistanceHandler[] getPersistanceHandlers() {
- if (jBossRuntimePersistanceHandler == null) {
- jBossRuntimePersistanceHandler = new IJBossRuntimePersistanceHandler[] {
- new JbpmHandler(),
- new DroolsHandler(),
- new JBossASHandler(),
- new SeamHandler()
- };
- }
- return jBossRuntimePersistanceHandler;
- }
private List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
private IEclipsePreferences preferences;
@@ -75,9 +56,11 @@
}
public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
- IJBossRuntimePersistanceHandler[] handlers = getPersistanceHandlers();
- for( int i = 0; i < handlers.length; i++ ) {
- handlers[i].initializeRuntimes(serverDefinitions);
+ Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+ for( IRuntimeDetector detector:detectors) {
+ if (detector.isEnabled()) {
+ detector.initializeRuntimes(serverDefinitions);
+ }
}
refreshCommonNavigator();
}
@@ -172,9 +155,7 @@
}
});
}
-
-
private void parseServerFile() {
try {
Deleted: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -1,180 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2009 JBoss by Red Hat and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.runtime;
-
-import java.io.File;
-
-import org.jboss.ide.eclipse.as.core.server.bean.ServerBean;
-import org.jboss.tools.runtime.handlers.DroolsHandler;
-import org.jboss.tools.runtime.handlers.JbpmHandler;
-import org.jboss.tools.runtime.handlers.SeamHandler;
-
-import static org.jboss.tools.runtime.IJBossRuntimePluginConstants.*;
-
-/**
- * @author Snjeza
- *
- */
-public class ServerDefinition {
-
- private String name;
- private String version;
- private String type;
- private String description;
- private File location;
- private boolean enabled = true;
-
- public ServerDefinition(String name, String version, String type,
- File location) {
- super();
- this.name = name;
- this.version = version;
- this.type = type;
- this.location = location;
- this.description = null;
- }
-
- /**
- * @param serverBean
- */
- public ServerDefinition(ServerBean serverBean) {
- this.name = serverBean.getName();
- this.version = serverBean.getVersion();
- this.type = serverBean.getType().getId();
- this.location = new File(serverBean.getLocation());
- }
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getVersion() {
- return version;
- }
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- this.description = "";
- }
-
- public File getLocation() {
- return location;
- }
-
- public void setLocation(File location) {
- this.location = location;
- this.description = "";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((location == null) ? 0 : location.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((type == null) ? 0 : type.hashCode());
- result = prime * result + ((version == null) ? 0 : version.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ServerDefinition other = (ServerDefinition) obj;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (type == null) {
- if (other.type != null)
- return false;
- } else if (!type.equals(other.type))
- return false;
- if (version == null) {
- if (other.version != null)
- return false;
- } else if (!version.equals(other.version))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "ServerDefinition [name=" + name + ", version=" + version
- + ", type=" + type + ", location=" + location + "]";
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public String getDescription() {
- if (type == null || location == null) {
- return "";
- }
- if (description == null || description.length() == 0) {
- StringBuilder builder = new StringBuilder();
- if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || EWP.equals(type)) {
- String includeSeam = SeamHandler.includeSeam(this);
- append(builder, includeSeam);
- }
- if (SOA_P.equals(type)) {
- String includeDrools = DroolsHandler.includeDrools(this);
- append(builder, includeDrools);
- String includeJbpm = JbpmHandler.includeJbpm(this);
- append(builder, includeJbpm);
- }
- description = builder.toString();
- }
- return description;
- }
-
- private void append(StringBuilder builder, String string) {
- if (string != null && string.length() > 0) {
- if (builder.toString().length() == 0) {
- builder.append("Includes ");
- } else {
- builder.append(", ");
- }
- builder.append(string);
- }
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
-}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -11,16 +11,18 @@
package org.jboss.tools.runtime.handlers;
import java.io.File;
+import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.List;
import org.drools.eclipse.util.DroolsRuntime;
import org.drools.eclipse.util.DroolsRuntimeManager;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.jboss.tools.runtime.IJBossRuntimePluginConstants;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.ServerDefinition;
+import org.jboss.tools.runtime.core.model.AbstractRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
-public class DroolsHandler implements IJBossRuntimePersistanceHandler,IJBossRuntimePluginConstants {
+public class DroolsHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
DroolsRuntime[] existingRuntimes = DroolsRuntimeManager.getDroolsRuntimes();
@@ -32,7 +34,7 @@
}
for (ServerDefinition serverDefinition : serverDefinitions) {
String type = serverDefinition.getType();
- if (!droolsExists(serverDefinition)) {
+ if (serverDefinition.isEnabled() && !droolsExists(serverDefinition)) {
if (SOA_P.equals(type) || DROOLS.equals(type)) {
File droolsRoot = serverDefinition.getLocation(); //$NON-NLS-1$
if (droolsRoot.isDirectory()) {
@@ -72,7 +74,31 @@
return false;
}
- public static String includeDrools(ServerDefinition serverDefinition) {
+ public ServerDefinition getServerDefinition(File root,
+ IProgressMonitor monitor) {
+ if (monitor.isCanceled() || root == null) {
+ return null;
+ }
+ String[] files = root.list(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ if (name.startsWith("drools-api") && name.endsWith(".jar") ) {
+ return true;
+ }
+ return false;
+ }
+ });
+ if (files != null && files.length > 0) {
+ String version = getImplementationVersion(root,files[0]);
+ if (version != null) {
+ version = version.substring(0,3);
+ return new ServerDefinition(root.getName(), version, DROOLS, root.getAbsoluteFile());
+ }
+ }
+ return null;
+ }
+
+ public static String included(ServerDefinition serverDefinition) {
StringBuilder builder = new StringBuilder();
File droolsRoot = serverDefinition.getLocation(); //$NON-NLS-1$
if (droolsRoot.isDirectory()) {
@@ -84,14 +110,12 @@
}
return builder.toString();
}
- public void importRuntimes() {
- // TODO Auto-generated method stub
-
- }
- public void exportRuntimes() {
- // TODO Auto-generated method stub
-
+ @Override
+ public boolean exists(ServerDefinition serverDefinition) {
+ if (serverDefinition == null || serverDefinition.getLocation() == null) {
+ return false;
+ }
+ return droolsExists(serverDefinition);
}
-
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -10,15 +10,12 @@
******************************************************************************/
package org.jboss.tools.runtime.handlers;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Properties;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -49,23 +46,21 @@
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.IMemento;
import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.eclipse.wst.server.core.internal.XMLMemento;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.bean.JBossServerType;
+import org.jboss.ide.eclipse.as.core.server.bean.ServerBean;
import org.jboss.ide.eclipse.as.core.server.bean.ServerBeanLoader;
import org.jboss.tools.runtime.Activator;
import org.jboss.tools.runtime.IJBossRuntimePluginConstants;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
import org.jboss.tools.runtime.Messages;
-import org.jboss.tools.runtime.ServerDefinition;
+import org.jboss.tools.runtime.core.model.AbstractRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
-public class JBossASHandler implements IJBossRuntimePersistanceHandler, IJBossRuntimePluginConstants {
-
+public class JBossASHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
+
public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
createInitialJBossServer();
createJBossServerFromDefinitions(serverDefinitions);
@@ -91,22 +86,40 @@
Activator.log(e,Messages.JBossRuntimeStartup_Cannot_create_new_JBoss_Server);
}
}
+
+ private static File getLocation(ServerDefinition serverDefinition) {
+ String type = serverDefinition.getType();
+ if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || EWP.equals(type)) {
+ return new File(serverDefinition.getLocation(), "jboss-as");
+ }
+ if (SOA_P_STD.equals(type)) {
+ return new File(serverDefinition.getLocation(),"jboss-esb"); //$NON-NLS-1$
+ }
+ if(EWP.equals(type)) {
+ return new File(serverDefinition.getLocation(),"jboss-as-web"); //$NON-NLS-1$
+ }
+ if (AS.equals(type)) {
+ return serverDefinition.getLocation();
+ }
+ return null;
+ }
+
public static void createJBossServerFromDefinitions(List<ServerDefinition> serverDefinitions) {
for (ServerDefinition serverDefinition:serverDefinitions) {
+ if (!serverDefinition.isEnabled()) {
+ continue;
+ }
+ File asLocation = getLocation(serverDefinition);
+ if (asLocation == null || !asLocation.isDirectory()) {
+ continue;
+ }
String type = serverDefinition.getType();
- if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || SOA_P_STD.equals(type) || EWP.equals(type)) {
- File asLocation = new File(serverDefinition.getLocation(), "jboss-as");
- if(SOA_P_STD.equals(type)) {
- asLocation = new File(serverDefinition.getLocation(),"jboss-esb"); //$NON-NLS-1$
- } else if(EWP.equals(type)){
- asLocation = new File(serverDefinition.getLocation(),"jboss-as-web"); //$NON-NLS-1$
- }
- if (asLocation.isDirectory()) {
- String name = serverDefinition.getName();
- String runtimeName = name + " " + RUNTIME; //$NON-NLS-1$
- int index = getJBossASVersion(asLocation);
- createJBossServer(asLocation,index,name, runtimeName);
- }
+ if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type)
+ || SOA_P_STD.equals(type) || EWP.equals(type)) {
+ String name = serverDefinition.getName();
+ String runtimeName = name + " " + RUNTIME; //$NON-NLS-1$
+ int index = getJBossASVersion(asLocation);
+ createJBossServer(asLocation, index, name, runtimeName);
} else if (AS.equals(type)){
String version = serverDefinition.getVersion();
int index = 2;
@@ -344,64 +357,79 @@
}
- public void importRuntimes() {
- String servers = Activator.getDefault().getPreferenceStore().getString(Activator.SERVERS);
- if (servers != null && servers.trim().length() > 0) {
- loadServerInstalations(servers);
+ public ServerDefinition getServerDefinition(File root,
+ IProgressMonitor monitor) {
+ if (monitor.isCanceled() || root == null) {
+ return null;
}
- }
- /**
- * @param servers
- */
- private void loadServerInstalations(String servers) {
- InputStream in = null;
- try {
- in = new ByteArrayInputStream(servers.getBytes("UTF-8"));
- IMemento memento = XMLMemento.loadMemento(in);
-
- IMemento[] children = memento.getChildren("server");
- int size = children.length;
-
- for (int i = 0; i < size; i++) {
- ServerEx server = new ServerEx(null);
- server.loadFromMemento(children[i], null);
- IServerWorkingCopy wc = server.createWorkingCopy();
- wc.save(false, null);
- }
- } catch (Exception e) {
- Activator.log(e);
+ ServerBeanLoader loader = new ServerBeanLoader();
+ ServerBean serverBean = loader.loadFromLocation(root);
+
+ if (!JBossServerType.UNKNOWN.equals(serverBean.getType())) {
+ ServerDefinition serverDefinition = new ServerDefinition(serverBean.getName(),
+ serverBean.getVersion(), serverBean.getType().getId(), new File(serverBean.getLocation()));
+ serverDefinition.setDescription(includedRuntimes(serverDefinition));
+ return serverDefinition;
}
+ return null;
}
- private static final String SERVER_DATA_FILE = "servers.xml";
- public void exportRuntimes() {
- String filename = ServerPlugin.getInstance().getStateLocation().append(SERVER_DATA_FILE).toOSString();
- if ( !(new File(filename).exists()) ) {
- Activator.getDefault().getPreferenceStore().setValue(Activator.SERVERS, "");
- return;
+ @Override
+ public String includedRuntimes(ServerDefinition serverDefinition) {
+ if (serverDefinition == null || serverDefinition.getType() == null) {
+ return super.includedRuntimes(serverDefinition);
}
- try {
- XMLMemento memento = (XMLMemento) XMLMemento.loadMemento(filename);
- String xmlString = memento.saveToString();
- Activator.getDefault().getPreferenceStore().setValue(Activator.SERVERS, xmlString);
- Activator.getDefault().savePluginPreferences();
- } catch (Exception e) {
- Activator.log (e);
+ StringBuilder builder = new StringBuilder();
+ String type = serverDefinition.getType();
+
+ if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || EWP.equals(type)) {
+ String includeSeam = SeamHandler.included(serverDefinition);
+ append(builder, includeSeam);
}
+ if (SOA_P.equals(type)) {
+ String includeDrools = DroolsHandler.included(serverDefinition);
+ append(builder, includeDrools);
+ String includeJbpm = JbpmHandler.included(serverDefinition);
+ append(builder, includeJbpm);
+ }
+ return builder.toString();
+
}
- private static class ServerEx extends Server {
- /**
- * @param file
- */
- public ServerEx(IFile file) {
- super(file);
+ private void append(StringBuilder builder, String string) {
+ if (string != null && string.length() > 0) {
+ if (builder.toString().length() == 0) {
+ builder.append("Includes ");
+ } else {
+ builder.append(", ");
+ }
+ builder.append(string);
}
-
- @Override
- public void loadFromMemento(IMemento memento, IProgressMonitor monitor) {
- super.loadFromMemento(memento, monitor);
+ }
+
+ @Override
+ public boolean exists(ServerDefinition serverDefinition) {
+ if (serverDefinition == null || serverDefinition.getLocation() == null) {
+ return false;
}
-
+ File location = getLocation(serverDefinition);
+ if (location == null || !location.isDirectory()) {
+ return false;
+ }
+ String path = location.getAbsolutePath();
+ if (path == null) {
+ return false;
+ }
+ IServer[] servers = ServerCore.getServers();
+ for (int i = 0; i < servers.length; i++) {
+ IRuntime runtime = servers[i].getRuntime();
+ if (runtime == null || runtime.getLocation() == null) {
+ continue;
+ }
+ if(path.equals(runtime.getLocation().toOSString())) {
+ return true;
+ }
+ }
+ return false;
}
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JbpmHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JbpmHandler.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JbpmHandler.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -10,40 +10,54 @@
************************************************************************************/
package org.jboss.tools.runtime.handlers;
-import java.io.ByteArrayInputStream;
import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.eclipse.wst.server.core.internal.IMemento;
-import org.eclipse.wst.server.core.internal.XMLMemento;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.jboss.tools.jbpm.preferences.JbpmInstallation;
import org.jboss.tools.jbpm.preferences.PreferencesManager;
-import org.jboss.tools.runtime.Activator;
import org.jboss.tools.runtime.IJBossRuntimePluginConstants;
-import org.jboss.tools.runtime.JBossRuntimeLocator;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.ServerDefinition;
+import org.jboss.tools.runtime.core.model.AbstractRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
-public class JbpmHandler implements IJBossRuntimePersistanceHandler,IJBossRuntimePluginConstants {
+public class JbpmHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
+
+ private static final String JBPM3 = "jBPM3";
+
+ private static final String JBPM4 = "jBPM4";
+
+ public static File getJbpmRoot(ServerDefinition serverDefinition) {
+ String type = serverDefinition.getType();
+ if (SOA_P.equals(type)) {
+ return new File(serverDefinition.getLocation(),"jbpm-jpdl"); //$NON-NLS-1$
+ }
+ if (JBPM.equals(type)) {
+ return serverDefinition.getLocation();
+ }
+ return null;
+ }
+
public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
for (ServerDefinition serverDefinition : serverDefinitions) {
- if (!jbpmExists(serverDefinition)) {
+ if (serverDefinition.isEnabled() && !jbpmExists(serverDefinition)) {
+ File jbpmRoot = getJbpmRoot(serverDefinition);
+ if (jbpmRoot == null || !jbpmRoot.isDirectory()) {
+ continue;
+ }
String type = serverDefinition.getType();
if (SOA_P.equals(type)) {
- File jbpmRoot = new File(serverDefinition.getLocation(),"jbpm-jpdl"); //$NON-NLS-1$
if (jbpmRoot.isDirectory()) {
- String version = JBossRuntimeLocator.JBPM3;
- if (JBossRuntimeLocator.isJbpm4(serverDefinition.getLocation().getAbsolutePath())) {
- version = JBossRuntimeLocator.JBPM4;
+ String version = JBPM3;
+ if (isJbpm4(serverDefinition.getLocation().getAbsolutePath())) {
+ version = JBPM4;
}
PreferencesManager.getInstance().initializeDefaultJbpmInstallation(serverDefinition.getName(), jbpmRoot.getAbsolutePath(), version);
}
} else if (JBPM.equals(type)) {
- PreferencesManager.getInstance().addJbpmInstallation(serverDefinition.getName(), serverDefinition.getLocation().getAbsolutePath(), serverDefinition.getVersion());
+ PreferencesManager.getInstance().addJbpmInstallation(serverDefinition.getName(), jbpmRoot.getAbsolutePath(), serverDefinition.getVersion());
}
}
}
@@ -55,84 +69,69 @@
* @return
*/
public static boolean jbpmExists(ServerDefinition serverDefinition) {
+ File jbpmRoot = getJbpmRoot(serverDefinition);
+ if (jbpmRoot == null || !jbpmRoot.isDirectory()) {
+ return false;
+ }
Map<String, JbpmInstallation> jbpmMap = PreferencesManager.getInstance().getJbpmInstallationMap();
Collection<JbpmInstallation> jbpmInstalations = jbpmMap.values();
for (JbpmInstallation jbpm:jbpmInstalations) {
String location = jbpm.location;
- if (location != null && location.equals(serverDefinition.getLocation().getAbsolutePath())) {
+ if (location != null && location.equals(jbpmRoot.getAbsolutePath())) {
return true;
}
}
return false;
}
-
- /**
- * @param jbpms
- */
- public static void loadJBPMInstalations(String jbpms) {
- InputStream in = null;
- try {
- in = new ByteArrayInputStream(jbpms.getBytes("UTF-8"));
- IMemento memento = XMLMemento.loadMemento(in);
- IMemento[] children = memento.getChildren("installation");
- for (int i = 0; i < children.length; i++) {
- JbpmInstallation installation = new JbpmInstallation();
- installation.name = children[i].getString("name");
- installation.location = children[i].getString("location");
- installation.version = children[i].getString("version");
- PreferencesManager.getInstance().getJbpmInstallationMap()
- .put(installation.name, installation);
- }
- } catch (Exception e) {
- Activator.log(e);
- } finally {
- try {
- if (in != null) {
- in.close();
- }
- } catch (IOException e) {
- }
- }
- }
- public static void exportJbpms() {
- File file = org.jboss.tools.jbpm.Activator.getDefault().getStateLocation().append("jbpm-installations.xml").toFile();
- if (!file.exists()) {
- Activator.getDefault().getPreferenceStore().setValue(Activator.JBPMS, "");
- return;
+ public ServerDefinition getServerDefinition(File root,
+ IProgressMonitor monitor) {
+ if (monitor.isCanceled() || root == null) {
+ return null;
}
- try {
- XMLMemento memento = (XMLMemento) XMLMemento.loadMemento(file.getAbsolutePath());
- String xmlString = memento.saveToString();
- Activator.getDefault().getPreferenceStore().setValue(Activator.JBPMS, xmlString);
- Activator.getDefault().savePluginPreferences();
- } catch (Exception e) {
- Activator.log (e);
+ boolean isJBPM = isValidJbpmInstallation(root.getAbsolutePath());
+ if (isJBPM) {
+ String version = "unknown";
+ if (isJbpm3(root.getAbsolutePath())) {
+ version = JBPM3;
+ } else if (isJbpm4(root.getAbsolutePath())) {
+ version = JBPM4;
+ }
+ return new ServerDefinition(root.getName(), version, JBPM, root.getAbsoluteFile());
}
+ return null;
}
-
- public static String includeJbpm(ServerDefinition serverDefinition) {
+
+ public static boolean isJbpm3(String location) {
+ return new Path(location).append("/src/resources/gpd/version.info.xml").toFile().exists();
+ }
+
+ public static boolean isJbpm4(String location) {
+ return new Path(location).append("/jbpm.jar").toFile().exists();
+ }
+
+ private boolean isValidJbpmInstallation(String location) {
+ return isJbpm3(location) || isJbpm4(location);
+ }
+
+ public static String included(ServerDefinition serverDefinition) {
StringBuilder builder = new StringBuilder();
File jbpmRoot = new File(serverDefinition.getLocation(),"jbpm-jpdl"); //$NON-NLS-1$
if (jbpmRoot.isDirectory()) {
- String version = JBossRuntimeLocator.JBPM3;
- if (JBossRuntimeLocator.isJbpm4(serverDefinition.getLocation().getAbsolutePath())) {
- version = JBossRuntimeLocator.JBPM4;
+ String version = JBPM3;
+ if (isJbpm4(serverDefinition.getLocation().getAbsolutePath())) {
+ version = JBPM4;
}
builder.append(version);
}
return builder.toString();
}
-
- public void importRuntimes() {
- String jbpms = Activator.getDefault().getPreferenceStore().getString(Activator.JBPMS);
- if (jbpms != null && jbpms.trim().length() > 0) {
- JbpmHandler.loadJBPMInstalations(jbpms);
+
+ @Override
+ public boolean exists(ServerDefinition serverDefinition) {
+ if (serverDefinition == null || serverDefinition.getLocation() == null) {
+ return false;
}
+ return jbpmExists(serverDefinition);
}
-
- public void exportRuntimes() {
- JbpmHandler.exportJbpms();
- }
-
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/SeamHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/SeamHandler.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/SeamHandler.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -11,26 +11,50 @@
package org.jboss.tools.runtime.handlers;
import java.io.File;
+import java.io.FilenameFilter;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.service.datalocation.Location;
import org.jboss.tools.runtime.Activator;
import org.jboss.tools.runtime.IJBossRuntimePluginConstants;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.ServerDefinition;
+import org.jboss.tools.runtime.core.model.AbstractRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
import org.jboss.tools.seam.core.SeamUtil;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
-public class SeamHandler implements IJBossRuntimePersistanceHandler, IJBossRuntimePluginConstants {
+public class SeamHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
+
+ private final static String seamJarName = "jboss-seam.jar";
+ private final static String seamVersionAttributeName = "Seam-Version";
+
+ public static File getSeamRoot(ServerDefinition serverDefinition) {
+ String type = serverDefinition.getType();
+ if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || EWP.equals(type) ) {
+ for (String folder : SEAM_HOME_FOLDER_OPTIONS) {
+ File seamFile = new File(serverDefinition.getLocation(),folder); //$NON-NLS-1$
+ if (seamFile != null && seamFile.isDirectory()) {
+ return seamFile;
+ }
+ }
+ }
+ if (SEAM.equals(type)) {
+ return serverDefinition.getLocation();
+ }
+ return null;
+ }
+
public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
Map<String, SeamRuntime> map = new HashMap<String,SeamRuntime>();
@@ -39,6 +63,9 @@
// seam runtime initialization goes throug added servers first and
// then process seam runtimes from bundled servers
for(ServerDefinition serverDefinition:serverDefinitions) {
+ if (!serverDefinition.isEnabled()) {
+ continue;
+ }
String type = serverDefinition.getType();
if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || EWP.equals(type) ) {
for (String folder : SEAM_HOME_FOLDER_OPTIONS) {
@@ -145,34 +172,6 @@
return ""; //$NON-NLS-1$
}
- public void importRuntimes() {
- // TODO Auto-generated method stub
-
- }
-
- public void exportRuntimes() {
- // TODO Auto-generated method stub
-
- }
-
- public static String includeSeam(ServerDefinition serverDefinition) {
- StringBuilder builder = new StringBuilder();
- for (String folder : IJBossRuntimePluginConstants.SEAM_HOME_FOLDER_OPTIONS) {
- File seamFile = new File(serverDefinition.getLocation(),folder); //$NON-NLS-1$
- if (seamFile.exists() && seamFile.canRead() && seamFile.isDirectory()) {
- SeamVersion seamVersion = getSeamVersion(seamFile.getAbsolutePath());
- if (seamVersion != null) {
- if (builder.toString().length() > 0) {
- builder.append(", ");
- }
- builder.append("Seam ");
- builder.append(seamVersion);
- }
- }
- }
- return builder.toString();
- }
-
public static SeamVersion getSeamVersion(String seamGenBuildPath) {
if (seamGenBuildPath == null || seamGenBuildPath.trim().length() <= 0) {
return null;
@@ -203,4 +202,83 @@
return false;
}
+ public ServerDefinition getServerDefinition(File root,
+ IProgressMonitor monitor) {
+ if (monitor.isCanceled() || root == null) {
+ return null;
+ }
+ String seamVersion = getSeamVersionFromManifest(root.getAbsolutePath());
+ if (seamVersion != null) {
+ return new ServerDefinition(root.getName(), seamVersion, SEAM, root.getAbsoluteFile());
+ }
+ return null;
+ }
+
+ public static String getSeamVersionFromManifest(String seamHome) {
+ File seamHomeFolder = new File(seamHome);
+ if (seamHomeFolder == null || !seamHomeFolder.isDirectory()) {
+ return null;
+ }
+ String[] seamFiles = seamHomeFolder.list(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ if ("seam-gen".equals(name)) {
+ return true;
+ }
+ if ("examples".equals(name)) {
+ return true;
+ }
+ return false;
+ }
+ });
+ if (seamFiles == null || seamFiles.length != 2) {
+ return null;
+ }
+ File jarFile = new File(seamHome, "lib/" + seamJarName);
+ if(!jarFile.isFile()) {
+ jarFile = new File(seamHome, seamJarName);
+ if(!jarFile.isFile()) {
+ return null;
+ }
+ }
+ try {
+ JarFile jar = new JarFile(jarFile);
+ Attributes attributes = jar.getManifest().getMainAttributes();
+ String version = attributes.getValue(seamVersionAttributeName);
+ return version;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ public static String included(ServerDefinition serverDefinition) {
+ StringBuilder builder = new StringBuilder();
+ for (String folder : IJBossRuntimePluginConstants.SEAM_HOME_FOLDER_OPTIONS) {
+ File seamFile = new File(serverDefinition.getLocation(),folder); //$NON-NLS-1$
+ if (seamFile.exists() && seamFile.canRead() && seamFile.isDirectory()) {
+ SeamVersion seamVersion = getSeamVersion(seamFile.getAbsolutePath());
+ if (seamVersion != null) {
+ if (builder.toString().length() > 0) {
+ builder.append(", ");
+ }
+ builder.append("Seam ");
+ builder.append(seamVersion);
+ }
+ }
+ }
+ return builder.toString();
+ }
+
+ @Override
+ public boolean exists(ServerDefinition serverDefinition) {
+ if (serverDefinition == null || serverDefinition.getLocation() == null) {
+ return false;
+ }
+ File seamRoot = getSeamRoot(serverDefinition);
+ if (seamRoot == null || !seamRoot.isDirectory()) {
+ return false;
+ }
+ String path = seamRoot.getAbsolutePath();
+ return seamExists(path);
+ }
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/JBossRuntimePreferencesInitializer.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/JBossRuntimePreferencesInitializer.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/JBossRuntimePreferencesInitializer.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -1,3 +1,13 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2009 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.runtime.preferences;
import org.eclipse.core.runtime.Preferences;
Deleted: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimeDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimeDialog.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimeDialog.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -1,154 +0,0 @@
-package org.jboss.tools.runtime.preferences;
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-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.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.jboss.tools.runtime.ServerDefinition;
-
-public class RuntimeDialog extends Dialog {
-
- private List<ServerDefinition> serverDefinitions;
- private String path;
- private CheckboxTableViewer tableViewer;
-
- public RuntimeDialog(Shell parentShell, List<ServerDefinition> serverDefinitions , String path) {
- super(parentShell);
- setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
- | SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
- this.serverDefinitions = serverDefinitions;
- this.path = path;
-
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite area = (Composite) super.createDialogArea(parent);
- Composite contents = new Composite(area, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 400;
- gd.widthHint = 700;
- contents.setLayoutData(gd);
- contents.setLayout(new GridLayout());
- getShell().setText("JBoss Runtimes");
- applyDialogFont(contents);
- initializeDialogUnits(area);
-
- Label label = new Label(contents, SWT.NULL);
- String runtime = (serverDefinitions.size() == 1) ? "runtime" : "runtimes";
- label.setText("The search found " + serverDefinitions.size() + " " + runtime + " while searching " + path + ".");
- tableViewer = CheckboxTableViewer.newCheckList(contents, SWT.V_SCROLL
- | SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
- Table table = tableViewer.getTable();
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 100;
- table.setLayoutData(gd);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- String[] columnNames = new String[] { "Name", "Version", "Type", "Location", "Description"};
- int[] columnWidths = new int[] { 140, 50, 50, 245, 200};
-
- for (int i = 0; i < columnNames.length; i++) {
- TableColumn tc = new TableColumn(table, SWT.LEFT);
- tc.setText(columnNames[i]);
- tc.setWidth(columnWidths[i]);
- }
-
- tableViewer.setLabelProvider(new RuntimeLabelProvider());
- tableViewer.setContentProvider(new RuntimeContentProvider(serverDefinitions));
- tableViewer.setInput(serverDefinitions);
- for (ServerDefinition definition:serverDefinitions) {
- tableViewer.setChecked(definition, definition.isEnabled());
- }
- tableViewer.addCheckStateListener(new ICheckStateListener() {
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- ServerDefinition definition = (ServerDefinition) event.getElement();
- definition.setEnabled(!definition.isEnabled());
- boolean enableOk = false;
- for (ServerDefinition serverDefinition:serverDefinitions) {
- if (serverDefinition.isEnabled()) {
- enableOk = true;
- }
- }
- getButton(IDialogConstants.OK_ID).setEnabled(enableOk);
- }
- });
- return area;
- }
-
- private class RuntimeLabelProvider extends LabelProvider implements
- ITableLabelProvider {
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof ServerDefinition) {
- ServerDefinition definition = (ServerDefinition) element;
- if (columnIndex == 0) {
- return definition.getName();
- }
- if (columnIndex == 1) {
- return definition.getVersion();
- }
- if (columnIndex == 2) {
- return definition.getType();
- }
- if (columnIndex == 3) {
- File location = definition.getLocation();
- if (location != null) {
- return definition.getLocation().getAbsolutePath();
- }
- }
- if (columnIndex == 4) {
- return definition.getDescription();
- }
- }
- return null;
- }
- }
-
- private class RuntimeContentProvider implements IStructuredContentProvider {
-
- private List<ServerDefinition> serverDefinitions;
-
- public RuntimeContentProvider(List<ServerDefinition> serverDefinitions) {
- this.serverDefinitions = serverDefinitions;
- }
-
- public Object[] getElements(Object inputElement) {
- return serverDefinitions.toArray();
- }
-
- public void dispose() {
-
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- serverDefinitions = (List<ServerDefinition>) newInput;
- }
-
- }
-
-}
Deleted: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -1,299 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2009 JBoss by Red Hat and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.runtime.preferences;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.layout.PixelConverter;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.internal.wizards.preferences.PreferencesExportWizard;
-import org.eclipse.ui.internal.wizards.preferences.PreferencesImportWizard;
-import org.jboss.tools.runtime.Activator;
-import org.jboss.tools.runtime.JBossRuntimeLocator;
-import org.jboss.tools.runtime.JBossRuntimeStartup;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.ServerDefinition;
-
-/**
- * @author Snjeza
- *
- */
-public class RuntimePreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
-
- public static String ID = "org.jboss.tools.runtime.preferences.RuntimePreferencePage";
- private static final String LASTPATH = "lastPath";
- public static final String SEAM_PREFERENCES_ID = "org.jboss.tools.common.model.ui.seam"; //$NON-NLS-1$
- public static final String WTP_PREFERENCES_ID = "org.eclipse.wst.server.ui.runtime.preferencePage"; //$NON-NLS-1$
- private static final String DROOLS_PREFERENCES_ID = "org.drools.eclipse.preferences.DroolsRuntimesPreferencePage";
- private static final String JBPM_PREFERENCES_ID = "org.jboss.tools.jbpm.locations";
-
- protected Map<String, Object> map = new HashMap<String, Object>();
-
- private List<ServerDefinition> serverDefinitions;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
- * .swt.widgets.Composite)
- */
- @Override
- protected Control createContents(Composite parent) {
- noDefaultAndApplyButton();
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(1, false);
-
- composite.setLayout(layout);
-
- createLink(composite, "See <a>WTP Runtimes</a>", WTP_PREFERENCES_ID);
- createLink(composite, "See <a>Seam Runtimes</a>", SEAM_PREFERENCES_ID);
- createLink(composite, "See <a>Drools Runtimes</a>", DROOLS_PREFERENCES_ID);
- createLink(composite, "See <a>JBPM Runtimes</a>", JBPM_PREFERENCES_ID);
-
- new Label(composite, SWT.NONE);
-
- Label searchLabel = new Label(composite, SWT.NONE);
- searchLabel.setText("JBoss AS, Seam, JBPM and Drools Runtimes will be configured based on the entered path.");
-
- Group runtimeGroup = new Group(composite, SWT.NONE);
- layout = new GridLayout(1, false);
- runtimeGroup.setLayout(layout);
- runtimeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- runtimeGroup.setText("JBoss Runtimes");
- Button searchButton = createButton(runtimeGroup, "Search for JBoss Runtimes", "Search...");
- searchButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- search();
- }
-
- });
-
-// Button exportButton = createButton(runtimeGroup, "Export JBoss Runtimes", "Export...");
-// exportButton.addSelectionListener(new SelectionAdapter() {
-//
-// public void widgetSelected(SelectionEvent e) {
-// exportRuntimes();
-// }
-//
-// });
-//
-// Button importButton = createButton(runtimeGroup, "Import JBoss Runtimes", "Import...");
-// importButton.addSelectionListener(new SelectionAdapter() {
-//
-// public void widgetSelected(SelectionEvent e) {
-// importRuntimes();
-// }
-//
-// });
-//
- setButtonDimensionHint(searchButton);
-// setButtonDimensionHint(exportButton);
-// setButtonDimensionHint(importButton);
- Dialog.applyDialogFont(composite);
- return composite;
- }
-
- private void exportRuntimes() {
- IJBossRuntimePersistanceHandler[] exportHandlers = JBossRuntimeStartup.getPersistanceHandlers();
- for( int i = 0; i < exportHandlers.length; i++ ) {
- exportHandlers[i].exportRuntimes();
- }
- PreferencesExportWizard wizard = new PreferencesExportWizard();
- wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.open();
- }
-
- private void importRuntimes() {
- PreferencesImportWizard wizard = new PreferencesImportWizard();
- wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- int ok = dialog.open();
- if (ok == Window.OK) {
- IJBossRuntimePersistanceHandler[] importHandlers = JBossRuntimeStartup.getPersistanceHandlers();
- for( int i = 0; i < importHandlers.length; i++ ) {
- importHandlers[i].importRuntimes();
- }
- refreshPreferencePage();
- }
- }
-
- private Button createButton(Composite parent, String labelText, String buttonText) {
- GridLayout layout;
- Composite composite = new Composite(parent,SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(labelText);
- GridData data= new GridData(GridData.FILL, GridData.CENTER, true, false);
- data.widthHint= convertVerticalDLUsToPixels(50);
- label.setLayoutData(data);
-
- Button button = new Button(composite, SWT.PUSH);
- button.setText(buttonText);
- data = new GridData(GridData.FILL, GridData.BEGINNING, false, false);
- //data.widthHint= convertVerticalDLUsToPixels(60);
- button.setLayoutData(data);
- return button;
- }
-
- private void createLink(Composite composite, String text, final String preferencesId) {
- Link link = new Link(composite, SWT.NONE);
- link.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- link.setText(text);
- link.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- PreferencesUtil.createPreferenceDialogOn(getShell(),preferencesId, null, null);
- }
- });
- }
-
- public void init(IWorkbench workbench) {
- }
-
- private void search() {
- IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
- String lastUsedPath= dialogSettings.get(LASTPATH);
- if (lastUsedPath == null) {
- lastUsedPath= ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
- }
- DirectoryDialog dialog = new DirectoryDialog(getShell());
- dialog.setMessage("Search for JBoss Runtimes");
- dialog.setFilterPath(lastUsedPath);
- final String path = dialog.open();
- if (path == null) {
- return;
- }
- dialogSettings.put(LASTPATH, path);
-
- IRunnableWithProgress op = new IRunnableWithProgress() {
-
- public void run(IProgressMonitor monitor) {
- JBossRuntimeLocator locator = new JBossRuntimeLocator();
- serverDefinitions = locator.searchForRuntimes(path, monitor);
-
- }
- };
-
- try {
- serverDefinitions = null;
- new ProgressMonitorDialog(getShell()).run(true, true, op);
- } catch (InvocationTargetException e) {
- Activator.log(e);
- } catch (InterruptedException e) {
- // ignore
- }
-
- if (serverDefinitions == null || serverDefinitions.size() == 0) {
- MessageDialog.openInformation(null, "Search for JBoss Runtimes",
- "The search found 0 runtimes while searching "
- + path + ".");
- } else {
- RuntimeDialog runtimeDialog = new RuntimeDialog(getShell(),
- serverDefinitions, path);
- int ok = runtimeDialog.open();
- if (ok == Window.OK) {
- Iterator<ServerDefinition> iterator = serverDefinitions.iterator();
- while (iterator.hasNext()) {
- ServerDefinition definition = iterator.next();
- if (!definition.isEnabled()) {
- iterator.remove();
- }
- }
- JBossRuntimeStartup runtimeStartup = new JBossRuntimeStartup();
- runtimeStartup.initializeRuntimes(serverDefinitions);
- refreshPreferencePage();
- }
- }
-
- }
-
- private void refreshPreferencePage() {
- getShell().close();
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell, ID, null, null);
- preferenceDialog.open();
- }
-
- /**
- * Returns a width hint for a button control.
- * @param button the button
- * @return the width hint
- */
- public static int getButtonWidthHint(Button button) {
- button.setFont(JFaceResources.getDialogFont());
- PixelConverter converter= new PixelConverter(button);
- int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- }
-
- /**
- * Sets width and height hint for the button control.
- * <b>Note:</b> This is a NOP if the button's layout data is not
- * an instance of <code>GridData</code>.
- *
- * @param button the button for which to set the dimension hint
- */
- public static void setButtonDimensionHint(Button button) {
- Assert.isNotNull(button);
- Object gd= button.getLayoutData();
- if (gd instanceof GridData) {
- ((GridData)gd).widthHint= getButtonWidthHint(button);
- ((GridData)gd).horizontalAlignment = GridData.FILL;
- }
- }
-}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/.classpath
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/.classpath (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/.classpath 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/.project
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/.project (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/.project 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.runtime.core</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/runtime/plugins/org.jboss.tools.runtime.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/.settings/org.eclipse.jdt.core.prefs 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,8 @@
+#Thu Dec 02 17:06:56 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/META-INF/MANIFEST.MF 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.runtime.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.runtime.core.RuntimeCoreActivator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %BundleVendor
+Bundle-Localization: plugin
+Export-Package: org.jboss.tools.runtime.core,
+ org.jboss.tools.runtime.core.model
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/about.html
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/about.html (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/about.html 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>JBoss Runtime Detection</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>JBoss Runtime Detection</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a href="http://www.jboss.org/tools">JBoss Tools project page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License - Version 1.0</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/about.ini
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/about.ini (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/about.ini 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=jboss_about.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which the
+# welcome page is to be opened.
+# optional
+
+
+
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/about.mappings
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/about.mappings (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/about.mappings 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/about.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/about.properties (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/about.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,2 @@
+blurb=JBoss Runtime Detection\n\nVersion\: {featureVersion}\n\n(c) Copyright JBoss by Red Hat, contributors and others 2004 - 2010. All rights reserved.\nVisit http\://jboss.org/tools
+
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/build.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/build.properties (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/build.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,12 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml,\
+ schema/,\
+ about.html,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ jboss_about.png
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/jboss_about.png
===================================================================
(Binary files differ)
Property changes on: trunk/runtime/plugins/org.jboss.tools.runtime.core/jboss_about.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/plugin.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/plugin.properties (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/plugin.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.runtime
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Runtime Detection
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/plugin.xml
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/plugin.xml (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/plugin.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="runtimeDetectors" name="Runtime Detectors" schema="schema/runtimeDetectors.exsd"/>
+
+</plugin>
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/pom.xml
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/pom.xml (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/pom.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,14 @@
+<project
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.runtime.core</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/schema/runtimeDetectors.exsd
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/schema/runtimeDetectors.exsd (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/schema/runtimeDetectors.exsd 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,147 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.runtime.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.tools.runtime.core" id="runtimeDetectors" name="Runtime Detectors"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="runtimeDetector"/>
+ </sequence>
+ <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="runtimeDetector">
+ <complexType>
+ <attribute name="preferenceId" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.jboss.tools.runtime.core.model.AbstractRuntimeDetector:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="enabled" type="boolean">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </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>
+ <extension
+ point="org.jboss.tools.runtime.core.runtimeDetectors">
+ <runtimeDetector>
+ <name>JBoss AS Runtime</name>
+ <class>org.jboss.tools.runtime.JBossASRuntimeDetector</class>
+ <preferenceId>org.eclipse.wst.server.ui.runtime.preferencePage</preferenceId>
+ </runtimeDetector>
+</extension>
+ </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/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/JBossRuntimeLocator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/JBossRuntimeLocator.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/JBossRuntimeLocator.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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.runtime.core;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+
+/**
+ * @author snjeza
+ *
+ */
+public class JBossRuntimeLocator {
+
+ private static final int DEPTH = 4;
+
+ public JBossRuntimeLocator() {
+ }
+
+ public List<ServerDefinition> searchForRuntimes(String path, IProgressMonitor monitor) {
+ return searchForRuntimes(new Path(path), monitor);
+ }
+
+ public List<ServerDefinition> searchForRuntimes(IPath path, IProgressMonitor monitor) {
+ List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
+ Set<IRuntimeDetector> runtimeDetectors = RuntimeCoreActivator.getRuntimeDetectors();
+ return searchForRuntimes(serverDefinitions, path, DEPTH, runtimeDetectors, monitor);
+ }
+
+ private List<ServerDefinition> searchForRuntimes(List<ServerDefinition> serverDefinitions, IPath path,
+ int depth, Set<IRuntimeDetector> runtimeDetectors, IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
+ File[] children = null;
+ if (path != null) {
+ File root = path.toFile();
+ monitor.setTaskName("Searching " + path.toOSString());
+ ServerDefinition serverDefinition = null;
+ for (IRuntimeDetector detector:runtimeDetectors) {
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
+ if (!detector.isEnabled()) {
+ continue;
+ }
+ serverDefinition = detector.getServerDefinition(root, monitor);
+ if (serverDefinition != null) {
+ serverDefinitions.add(serverDefinition);
+ break;
+ }
+ }
+ if (serverDefinition == null) {
+ children = root.listFiles();
+ }
+ } else {
+ children = File.listRoots();
+ }
+
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
+ if (depth == 0) {
+ return serverDefinitions;
+ }
+ if( children != null ) {
+ for( int i = 0; i < children.length; i++ ) {
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
+ if( children[i].isDirectory()) {
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
+ searchForRuntimes(serverDefinitions, new Path(children[i].getAbsolutePath()),
+ --depth, runtimeDetectors, monitor);
+ }
+ }
+ }
+ return serverDefinitions;
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeCoreActivator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeCoreActivator.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeCoreActivator.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,206 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author snjeza
+ */
+public class RuntimeCoreActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.runtime.core"; //$NON-NLS-1$
+
+ private static final String RUNTIME_DETECTOR_EXTENSION_ID = "org.jboss.tools.runtime.core.runtimeDetectors";
+
+ private static final String NAME = "name";
+
+ private static final String PREFERENCE_ID = "preferenceId";
+
+ private static final String ID = "id";
+
+ private static final String ENABLED = "enabled";
+
+ private static final String ENABLED_DETECTORS = "enabledDetectors";
+
+ private static final String PRIORITY = "priority";
+
+ private static Set<IRuntimeDetector> runtimeDetectors;
+
+ // The shared instance
+ private static RuntimeCoreActivator plugin;
+
+ private static IEclipsePreferences prefs;
+
+ /**
+ * The constructor
+ */
+ public RuntimeCoreActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static RuntimeCoreActivator getDefault() {
+ return plugin;
+ }
+
+ public static Set<IRuntimeDetector> getDeclaredRuntimeDetectors() {
+ if (runtimeDetectors == null) {
+ runtimeDetectors = new TreeSet<IRuntimeDetector>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry
+ .getExtensionPoint(RUNTIME_DETECTOR_EXTENSION_ID);
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configurationElements = extension
+ .getConfigurationElements();
+ for (int j = 0; j < configurationElements.length; j++) {
+ IConfigurationElement configurationElement = configurationElements[j];
+ IRuntimeDetector detector;
+ try {
+ detector = (IRuntimeDetector) configurationElement.createExecutableExtension("class");
+ } catch (CoreException e) {
+ log(e);
+ continue;
+ }
+ String name = configurationElement.getAttribute(NAME);
+ String preferenceId = configurationElement.getAttribute(PREFERENCE_ID);
+ String id = configurationElement.getAttribute(ID);
+ detector.setName(name);
+ detector.setPreferenceId(preferenceId);
+ detector.setId(id);
+ String enabled = configurationElement.getAttribute(ENABLED);
+ if (enabled == null || "true".equals(enabled)) {
+ detector.setEnabled(true);
+ } else {
+ detector.setEnabled(false);
+ }
+ String priorityString = configurationElement
+ .getAttribute(PRIORITY);
+ int priority;
+ try {
+ priority = Integer.parseInt(priorityString);
+ } catch (Exception ex) {
+ priority = Integer.MAX_VALUE;
+ }
+ detector.setPriority(priority);
+ runtimeDetectors.add(detector);
+ }
+ }
+ }
+ return runtimeDetectors;
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e
+ .getLocalizedMessage(), e);
+ getDefault().getLog().log(status);
+ }
+
+ public static void log(Throwable e, String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ getDefault().getLog().log(status);
+ }
+
+ public static Set<IRuntimeDetector> getRuntimeDetectors() {
+ Set<IRuntimeDetector> detectors = getDeclaredRuntimeDetectors();
+ String enabledDetectors = getPreferences().get(ENABLED_DETECTORS, null);
+ if (enabledDetectors == null) {
+ saveEnabledDetectors(detectors);
+ } else {
+ StringTokenizer tokenizer = new StringTokenizer(enabledDetectors, ",");
+ List<String> enabled = new ArrayList<String>();
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ if (token != null && !token.isEmpty()) {
+ enabled.add(token);
+ }
+ }
+ for (IRuntimeDetector detector:detectors) {
+ detector.setEnabled(enabled.contains(detector.getId()));
+ }
+ }
+ return detectors;
+ }
+
+ public static void saveEnabledDetectors(Set<IRuntimeDetector> detectors) {
+ StringBuilder builder = new StringBuilder();
+ for (IRuntimeDetector detector:detectors) {
+ if (detector.isEnabled()) {
+ builder.append(detector.getId());
+ builder.append(",");
+ }
+ }
+ String enabled = builder.toString();
+ int index = enabled.lastIndexOf(",");
+ if (index != -1) {
+ enabled = enabled.substring(0, index);
+ }
+ getPreferences().put(ENABLED_DETECTORS, enabled);
+ try {
+ getPreferences().flush();
+ } catch (BackingStoreException e) {
+ log(e);
+ }
+ }
+
+ private static IEclipsePreferences getPreferences() {
+ if (prefs == null) {
+ prefs = new ConfigurationScope().getNode(PLUGIN_ID);
+ }
+ return prefs;
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/AbstractRuntimeDetector.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/AbstractRuntimeDetector.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/AbstractRuntimeDetector.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,127 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.core.model;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+
+/**
+ * @author snjeza
+ *
+ */
+public abstract class AbstractRuntimeDetector implements IRuntimeDetector {
+ private String id;
+ private String name;
+ private String preferenceId;
+ private boolean enabled;
+ private int priority;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getPreferenceId() {
+ return preferenceId;
+ }
+
+ @Override
+ public void setPreferenceId(String preferenceId) {
+ this.preferenceId = preferenceId;
+ }
+
+ @Override
+ public String includedRuntimes(ServerDefinition serverDefinition) {
+ return "";
+ }
+
+ public String getImplementationVersion(File dir, String file) {
+ File jarFile = new File(dir, file);
+ if(!jarFile.isFile()) {
+ return null;
+ }
+ try {
+ JarFile jar = new JarFile(jarFile);
+ Attributes attributes = jar.getManifest().getMainAttributes();
+ String version = attributes.getValue("Implementation-Version");
+ return version;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ AbstractRuntimeDetector other = (AbstractRuntimeDetector) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+ public int getPriority() {
+ return priority;
+ }
+
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+
+ @Override
+ public int compareTo(IRuntimeDetector o) {
+ if (o == null) {
+ return 1;
+ }
+ int p1 = this.getPriority();
+ int p2 = o.getPriority();
+ return p1 - p2;
+ }
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IRuntimeDetector.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IRuntimeDetector.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IRuntimeDetector.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,50 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.core.model;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @author snjeza
+ *
+ */
+public interface IRuntimeDetector extends Comparable<IRuntimeDetector> {
+ void initializeRuntimes(List<ServerDefinition> serverDefinitions);
+
+ void setName(String name);
+
+ void setPreferenceId(String preferenceId);
+
+ void setId(String id);
+
+ String getName();
+
+ String getPreferenceId();
+
+ String getId();
+
+ void setEnabled(boolean enabled);
+
+ boolean isEnabled();
+
+ ServerDefinition getServerDefinition(File root, IProgressMonitor monitor);
+
+ String includedRuntimes(ServerDefinition serverDefinition);
+
+ boolean exists(ServerDefinition serverDefinition);
+
+ int getPriority();
+
+ void setPriority(int priority);
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/RuntimePath.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/RuntimePath.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/RuntimePath.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,97 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.core.model;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+
+/**
+ * @author snjeza
+ *
+ */
+public class RuntimePath implements Cloneable {
+
+ private String path;
+ private boolean scanOnEveryStartup;
+ private List<ServerDefinition> serverDefinitions;
+ private long timestamp;
+
+ public RuntimePath(String path) {
+ this.path = path;
+ this.scanOnEveryStartup = false;
+ this.serverDefinitions = new ArrayList<ServerDefinition>();
+ this.timestamp = -1;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public boolean isScanOnEveryStartup() {
+ return scanOnEveryStartup;
+ }
+
+ public void setScanOnEveryStartup(boolean scanOnEveryStartup) {
+ this.scanOnEveryStartup = scanOnEveryStartup;
+ }
+
+ public List<ServerDefinition> getServerDefinitions() {
+ return serverDefinitions;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ RuntimePath runtimePath = new RuntimePath(path);
+ runtimePath.setScanOnEveryStartup(scanOnEveryStartup);
+ runtimePath.serverDefinitions = (List<ServerDefinition>) ((ArrayList<ServerDefinition>)serverDefinitions).clone();
+ return runtimePath;
+ }
+
+ public boolean isModified() {
+ if (path == null || path.isEmpty()) {
+ return false;
+ }
+ if (timestamp < 0) {
+ return true;
+ }
+
+ File directory = new File(path);
+ if (! directory.isDirectory()){
+ return false;
+ }
+ try {
+ return directory.lastModified() > timestamp;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "RuntimePath [path=" + path + "]";
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/ServerDefinition.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/ServerDefinition.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/ServerDefinition.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,144 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.core.model;
+
+import java.io.File;
+
+/**
+ * @author snjeza
+ *
+ */
+public class ServerDefinition {
+
+ private String name;
+ private String version;
+ private String type;
+ private File location;
+ private String description;
+ private boolean enabled = true;
+ private RuntimePath runtimePath;
+
+ public ServerDefinition(String name, String version,
+ String type, File location) {
+ super();
+ this.name = name;
+ this.version = version;
+ this.type = type;
+ this.location = location;
+ this.description = "";
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getVersion() {
+ return version;
+ }
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public File getLocation() {
+ return location;
+ }
+
+ public void setLocation(File location) {
+ this.location = location;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((location == null) ? 0 : location.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((version == null) ? 0 : version.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ServerDefinition other = (ServerDefinition) obj;
+ if (location == null) {
+ if (other.location != null)
+ return false;
+ } else if (!location.equals(other.location))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ if (version == null) {
+ if (other.version != null)
+ return false;
+ } else if (!version.equals(other.version))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ServerDefinition [name=" + name + ", version=" + version
+ + ", type=" + type + ", location=" + location + "]";
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public RuntimePath getRuntimePath() {
+ return runtimePath;
+ }
+
+ public void setRuntimePath(RuntimePath runtimePath) {
+ this.runtimePath = runtimePath;
+ }
+
+
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/.classpath
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/.classpath (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/.classpath 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/.project
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/.project (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/.project 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.runtime.ui</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/runtime/plugins/org.jboss.tools.runtime.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/.settings/org.eclipse.jdt.core.prefs 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,8 @@
+#Sat Dec 04 19:39:24 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/META-INF/MANIFEST.MF 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.runtime.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.runtime.ui.RuntimeUIActivator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.runtime.core,
+ org.eclipse.core.resources
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %BundleVendor
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/build.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/build.properties (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/build.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ icons/
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/jboss.gif
===================================================================
(Binary files differ)
Property changes on: trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/jboss.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/complete_tsk.gif
===================================================================
(Binary files differ)
Property changes on: trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/complete_tsk.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/error_tsk.gif
===================================================================
(Binary files differ)
Property changes on: trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/error_tsk.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/incomplete_tsk.gif
===================================================================
(Binary files differ)
Property changes on: trunk/runtime/plugins/org.jboss.tools.runtime.ui/icons/xpl/incomplete_tsk.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/plugin.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/plugin.properties (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/plugin.properties 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,4 @@
+#Properties file for org.jboss.tools.runtime
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Runtime UI
+JBoss_Runtimes = JBoss Tools Runtime Detection
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/plugin.xml
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/plugin.xml (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/plugin.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.jboss.tools.common.model.ui.MainPreferencePage"
+ class="org.jboss.tools.runtime.ui.preferences.RuntimePreferencePage"
+ id="org.jboss.tools.runtime.preferences.RuntimePreferencePage"
+ name="%JBoss_Runtimes"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.jboss.tools.runtime.ui.RuntimeScanner"></startup>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jboss.tools.runtime.ui.preferences.JBossRuntimePreferencesInitializer"/>
+ </extension>
+</plugin>
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/pom.xml
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/pom.xml (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/pom.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,14 @@
+<project
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.runtime.ui</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeContentProvider.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeContentProvider.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeContentProvider.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,43 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+
+/**
+ * @author snjeza
+ *
+ */
+public class RuntimeContentProvider implements IStructuredContentProvider {
+
+ private List<ServerDefinition> serverDefinitions;
+
+ public RuntimeContentProvider(List<ServerDefinition> serverDefinitions) {
+ this.serverDefinitions = serverDefinitions;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return serverDefinitions.toArray();
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ serverDefinitions = (List<ServerDefinition>) newInput;
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeLabelProvider.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeLabelProvider.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeLabelProvider.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,55 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui;
+
+import java.io.File;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+
+/**
+ * @author snjeza
+ *
+ */
+public class RuntimeLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof ServerDefinition) {
+ ServerDefinition definition = (ServerDefinition) element;
+ if (columnIndex == 0) {
+ return definition.getName();
+ }
+ if (columnIndex == 1) {
+ return definition.getVersion();
+ }
+ if (columnIndex == 2) {
+ return definition.getType();
+ }
+ if (columnIndex == 3) {
+ File location = definition.getLocation();
+ if (location != null) {
+ return definition.getLocation().getAbsolutePath();
+ }
+ }
+ if (columnIndex == 4) {
+ return definition.getDescription();
+ }
+ }
+ return null;
+ }
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeScanner.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeScanner.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeScanner.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,105 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.runtime.core.JBossRuntimeLocator;
+import org.jboss.tools.runtime.core.model.RuntimePath;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+
+/**
+ * @author snjeza
+ *
+ */
+public class RuntimeScanner implements IStartup {
+
+ @Override
+ public void earlyStartup() {
+ final boolean firstStart = RuntimeUIActivator.getDefault().
+ getPreferenceStore().getBoolean(RuntimeUIActivator.FIRST_START);
+ Job runtimeJob = new Job("Searching runtimes...") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ boolean exists = runtimeExists(firstStart, monitor);
+ if (monitor.isCanceled()) {
+ RuntimeUIActivator.getDefault().refreshRuntimePreferences();
+ return Status.CANCEL_STATUS;
+ }
+ if (exists) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ RuntimeUIActivator.refreshRuntimes(shell, RuntimeUIActivator.getDefault().getRuntimePaths(), null, false, 7);
+ }
+ });
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ runtimeJob.setUser(false);
+ runtimeJob.setSystem(false);
+ runtimeJob.setPriority(Job.LONG);
+ runtimeJob.schedule(1000);
+
+ RuntimeUIActivator.getDefault().getPreferenceStore().setValue(RuntimeUIActivator.FIRST_START, false);
+ }
+
+ private boolean runtimeExists(boolean firstStart, IProgressMonitor monitor) {
+ List<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault().getRuntimePaths();
+ for (RuntimePath runtimePath:runtimePaths) {
+ if (!firstStart && !runtimePath.isScanOnEveryStartup()) {
+ continue;
+ }
+ if (monitor.isCanceled()) {
+ return false;
+ }
+ if (runtimePath.isModified()) {
+ JBossRuntimeLocator locator = new JBossRuntimeLocator();
+ List<ServerDefinition> serverDefinitions = locator.searchForRuntimes(runtimePath.getPath(), monitor);
+ if (monitor.isCanceled()) {
+ return false;
+ }
+ runtimePath.getServerDefinitions().clear();
+ for (ServerDefinition serverDefinition:serverDefinitions) {
+ serverDefinition.setRuntimePath(runtimePath);
+ }
+ runtimePath.getServerDefinitions().addAll(serverDefinitions);
+ RuntimeUIActivator.setTimestamp(runtimePaths);
+ }
+ monitor.setTaskName("JBoss Runtime Detector: checking " + runtimePath.getPath());
+ List<ServerDefinition> serverDefinitions = runtimePath.getServerDefinitions();
+ for (ServerDefinition serverDefinition:serverDefinitions) {
+ if (monitor.isCanceled()) {
+ return false;
+ }
+ if (!serverDefinition.isEnabled()) {
+ continue;
+ }
+ monitor.setTaskName("JBoss Runtime Detector: checking " + serverDefinition.getLocation());
+ if (!RuntimeUIActivator.runtimeCreated(serverDefinition)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,430 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.XMLMemento;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.runtime.core.JBossRuntimeLocator;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.RuntimePath;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+import org.jboss.tools.runtime.ui.dialogs.SearchRuntimePathDialog;
+import org.jboss.tools.runtime.ui.preferences.RuntimePreferencePage;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author snjeza
+ *
+ */
+public class RuntimeUIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.runtime.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static RuntimeUIActivator plugin;
+
+ private static IEclipsePreferences prefs;
+
+ public static final String LASTPATH = "lastPath";
+
+ public static final String RUNTIME_PATHS = "runtimePaths";
+
+ public static final String PATH = "path";
+
+ public static final String RUNTIME_PATH = "runtimePath";
+
+ public static final String SCAN_ON_EVERY_STAERTUP = "scanOnEveryStartup";
+
+ public static final String TIMESTAMP = "timestamp";
+
+ private static final String SERVER_DEFINITIONS = "serverDefinitions";
+
+ private static final String SERVER_DEFINITION = "serverDefinition";
+
+ private static final String NAME = "name";
+
+ private static final String VERSION = "version";
+
+ private static final String TYPE = "type";
+
+ private static final String LOCATION = "location";
+
+ private static final String DESCRIPTION = "description";
+
+ private static final String ENABLED = "enabled";
+
+ public static final String FIRST_START = "firstStart"; //$NON-NLS-1$
+
+ private List<RuntimePath> runtimePaths = new ArrayList<RuntimePath>();
+
+ private Set<IRuntimeDetector> runtimeDetectors;
+
+ private List<ServerDefinition> serverDefinitions;
+
+ /**
+ * The constructor
+ */
+ public RuntimeUIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ runtimePaths = null;
+ runtimeDetectors = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ saveRuntimePreferences();
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static RuntimeUIActivator getDefault() {
+ return plugin;
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e
+ .getLocalizedMessage(), e);
+ RuntimeUIActivator.getDefault().getLog().log(status);
+ }
+
+ public static void log(Throwable e, String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ RuntimeUIActivator.getDefault().getLog().log(status);
+ }
+
+ public static CheckboxTableViewer createRuntimeViewer(final List<RuntimePath> runtimePaths2, Composite composite, int heightHint) {
+ GridData gd;
+ CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(composite, SWT.V_SCROLL
+ | SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
+ Table table = viewer.getTable();
+ gd = new GridData(GridData.FILL_BOTH);
+ GC gc = new GC( composite);
+ FontMetrics fontMetrics = gc.getFontMetrics( );
+ gc.dispose( );
+ gd.heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, heightHint);
+ table.setLayoutData(gd);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ String[] columnNames = new String[] { "Name", "Version", "Type", "Location", "Description"};
+ int[] columnWidths = new int[] {140, 50, 50, 245, 200};
+
+ for (int i = 0; i < columnNames.length; i++) {
+ TableColumn tc = new TableColumn(table, SWT.LEFT);
+ tc.setText(columnNames[i]);
+ tc.setWidth(columnWidths[i]);
+ }
+
+ viewer.setLabelProvider(new RuntimeLabelProvider());
+ List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
+ for (RuntimePath runtimePath:runtimePaths2) {
+ serverDefinitions.addAll(runtimePath.getServerDefinitions());
+ }
+ viewer.setContentProvider(new RuntimeContentProvider(serverDefinitions));
+ viewer.setInput(serverDefinitions);
+ for (ServerDefinition definition:serverDefinitions) {
+ viewer.setChecked(definition, definition.isEnabled());
+ }
+ return viewer;
+ }
+
+ public static void refreshRuntimes(Shell shell, final List<RuntimePath> runtimePaths, final CheckboxTableViewer viewer, boolean needRefresh, int heightHint) {
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ JBossRuntimeLocator locator = new JBossRuntimeLocator();
+ for (RuntimePath runtimePath : runtimePaths) {
+ List<ServerDefinition> serverDefinitions = locator
+ .searchForRuntimes(runtimePath.getPath(), monitor);
+ runtimePath.getServerDefinitions().clear();
+ for (ServerDefinition serverDefinition : serverDefinitions) {
+ serverDefinition.setRuntimePath(runtimePath);
+ }
+ runtimePath.getServerDefinitions()
+ .addAll(serverDefinitions);
+ }
+ }
+ };
+ try {
+ SearchRuntimePathDialog dialog = new SearchRuntimePathDialog(shell, runtimePaths, needRefresh, heightHint);
+ dialog.run(true, true, op);
+ if (viewer != null) {
+ dialog.getShell().addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ viewer.setInput(null);
+ List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
+ for (RuntimePath runtimePath : runtimePaths) {
+ serverDefinitions.addAll(runtimePath
+ .getServerDefinitions());
+ viewer.setInput(serverDefinitions);
+ for (ServerDefinition serverDefinition : serverDefinitions) {
+ runtimeExists(serverDefinition);
+ viewer.setChecked(serverDefinition,
+ serverDefinition.isEnabled());
+ }
+ }
+ }
+ });
+ }
+ } catch (InvocationTargetException e1) {
+ RuntimeUIActivator.log(e1);
+ } catch (InterruptedException e1) {
+ // ignore
+ }
+ }
+
+ public static boolean runtimeExists(ServerDefinition serverDefinition) {
+ Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+ for (IRuntimeDetector detector:detectors) {
+ if (detector.exists(serverDefinition)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static void refreshPreferencePage(Shell shell) {
+ if (shell != null && !shell.isDisposed()) {
+ shell.close();
+ }
+ shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell, RuntimePreferencePage.ID, null, null);
+ preferenceDialog.open();
+ }
+
+ public void saveRuntimePreferences() {
+ saveRuntimePaths();
+ if (runtimeDetectors != null) {
+ RuntimeCoreActivator.saveEnabledDetectors(runtimeDetectors);
+ }
+ }
+
+ private void initRuntimePaths() throws WorkbenchException {
+ runtimePaths = new ArrayList<RuntimePath>();
+ String runtimes = getPreferences().get(RUNTIME_PATHS, null);
+ if (runtimes == null || runtimes.isEmpty()) {
+ return;
+ }
+ Reader reader = new StringReader(runtimes);
+ XMLMemento memento = XMLMemento.createReadRoot(reader);
+ IMemento[] nodes = memento.getChildren(RUNTIME_PATH);
+ for (IMemento node:nodes) {
+ String path = node.getString(PATH);
+ boolean scanOnEveryStartup = node.getBoolean(SCAN_ON_EVERY_STAERTUP);
+ String tsString = node.getString(TIMESTAMP);
+ Long timestamp = null;
+ try {
+ timestamp = new Long(tsString);
+ } catch (NumberFormatException e) {
+ // ignore
+ }
+ RuntimePath runtimePath = new RuntimePath(path);
+ runtimePath.setScanOnEveryStartup(scanOnEveryStartup);
+ if (timestamp != null) {
+ runtimePath.setTimestamp(timestamp);
+ }
+ IMemento serverDefinitionsNode = node.getChild(SERVER_DEFINITIONS);
+ IMemento[] sdNodes = serverDefinitionsNode.getChildren(SERVER_DEFINITION);
+ for (IMemento sdNode:sdNodes) {
+ String name = sdNode.getString(NAME);
+ String version = sdNode.getString(VERSION);
+ String type = sdNode.getString(TYPE);
+ String location = sdNode.getString(LOCATION);
+ String description = sdNode.getString(DESCRIPTION);
+ boolean enabled = sdNode.getBoolean(ENABLED);
+ ServerDefinition serverDefinition =
+ new ServerDefinition(name, version, type, new File(location));
+ serverDefinition.setDescription(description);
+ serverDefinition.setEnabled(enabled);
+ serverDefinition.setRuntimePath(runtimePath);
+ runtimePath.getServerDefinitions().add(serverDefinition);
+ }
+ runtimePaths.add(runtimePath);
+
+ }
+ }
+
+ private static IEclipsePreferences getPreferences() {
+ if (prefs == null) {
+ prefs = new ConfigurationScope().getNode(PLUGIN_ID);
+ }
+ return prefs;
+ }
+
+ public void saveRuntimePaths() {
+ if (runtimePaths == null) {
+ return;
+ }
+ XMLMemento memento = XMLMemento.createWriteRoot(RUNTIME_PATHS);
+ Writer writer = null;
+ try {
+ for (RuntimePath runtimePath:runtimePaths) {
+ IMemento runtimePathNode = memento.createChild(RUNTIME_PATH);
+ runtimePathNode.putString(PATH, runtimePath.getPath());
+ runtimePathNode.putBoolean(SCAN_ON_EVERY_STAERTUP, runtimePath.isScanOnEveryStartup());
+ runtimePathNode.putString(TIMESTAMP, String.valueOf(runtimePath.getTimestamp()));
+ IMemento serverDefintionsNode = runtimePathNode.createChild(SERVER_DEFINITIONS);
+ for (ServerDefinition serverDefinition:runtimePath.getServerDefinitions()) {
+ IMemento sdNode = serverDefintionsNode.createChild(SERVER_DEFINITION);
+ sdNode.putString(NAME, serverDefinition.getName());
+ sdNode.putString(VERSION, serverDefinition.getVersion());
+ sdNode.putString(TYPE, serverDefinition.getType());
+ sdNode.putString(LOCATION, serverDefinition.getLocation().getAbsolutePath());
+ sdNode.putString(DESCRIPTION, serverDefinition.getDescription());
+ sdNode.putBoolean(ENABLED, serverDefinition.isEnabled());
+ }
+ }
+ writer = new StringWriter();
+ memento.save(writer);
+ writer.flush();
+ String runtimes = writer.toString();
+ getPreferences().put(RUNTIME_PATHS, runtimes);
+ getPreferences().flush();
+ } catch (Exception e) {
+ log(e);
+ } finally {
+ if (writer != null) {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ public List<RuntimePath> getRuntimePaths() {
+ if (runtimePaths == null) {
+ try {
+ initRuntimePaths();
+ } catch (WorkbenchException e) {
+ log(e);
+ runtimePaths = new ArrayList<RuntimePath>();
+ }
+ }
+ return runtimePaths;
+ }
+
+ public List<ServerDefinition> getServerDefinitions() {
+ if (serverDefinitions == null) {
+ serverDefinitions = new ArrayList<ServerDefinition>();
+ } else {
+ serverDefinitions.clear();
+ }
+ for (RuntimePath runtimePath:getRuntimePaths()) {
+ serverDefinitions.addAll(runtimePath.getServerDefinitions());
+ }
+ return serverDefinitions;
+ }
+
+ public Set<IRuntimeDetector> getRuntimeDetectors() {
+ if (runtimeDetectors == null) {
+ runtimeDetectors = RuntimeCoreActivator.getRuntimeDetectors();
+ }
+ return runtimeDetectors;
+ }
+
+ public void initDefaultRuntimePreferences() {
+ runtimePaths = new ArrayList<RuntimePath>();
+ runtimeDetectors = RuntimeCoreActivator.getDeclaredRuntimeDetectors();
+ }
+
+ public static void setTimestamp(List<RuntimePath> runtimePaths2) {
+ for (RuntimePath runtimePath : runtimePaths2) {
+ String path = runtimePath.getPath();
+ if (path != null && !path.isEmpty()) {
+ File directory = new File(path);
+ if (directory.isDirectory()) {
+ runtimePath.setTimestamp(directory.lastModified());
+ }
+ }
+ }
+ }
+
+ public void refreshRuntimePreferences() {
+ runtimePaths = null;
+ runtimeDetectors = null;
+ }
+
+ public static boolean runtimeCreated(ServerDefinition serverDefinition) {
+ Set<IRuntimeDetector> detectors = getDefault().getRuntimeDetectors();
+ boolean created = false;
+ for (IRuntimeDetector detector:detectors) {
+ if (!detector.isEnabled()) {
+ continue;
+ }
+ if (detector.exists(serverDefinition)) {
+ created = true;
+ break;
+ }
+ }
+ return (created);
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/AutoResizeTableLayout.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/AutoResizeTableLayout.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/AutoResizeTableLayout.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,129 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui.dialogs;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+public class AutoResizeTableLayout extends TableLayout implements
+ ControlListener {
+
+ private final Table table;
+ private List<ColumnLayoutData> columns = new ArrayList<ColumnLayoutData>();
+ private boolean autosizing = false;
+
+ public AutoResizeTableLayout(Table table) {
+ this.table = table;
+ table.addControlListener(this);
+ }
+
+ public void addColumnData(ColumnLayoutData data) {
+ columns.add(data);
+ super.addColumnData(data);
+ }
+
+ public void controlMoved(ControlEvent e) {
+ }
+
+ public void controlResized(ControlEvent e) {
+ if (autosizing) {
+ return;
+ }
+ autosizing = true;
+ try {
+ autoSizeColumns();
+ } finally {
+ autosizing = false;
+ }
+ }
+
+ private void autoSizeColumns() {
+ int width = table.getClientArea().width;
+ if (width <= 1) {
+ return;
+ }
+
+ TableColumn[] tableColumns = table.getColumns();
+ int size =
+ Math.min(columns.size(), tableColumns.length);
+ int[] widths = new int[size];
+ int fixedWidth = 0;
+ int numberOfWeightColumns = 0;
+ int totalWeight = 0;
+
+ // First calc space occupied by fixed columns.
+ for (int i = 0; i < size; i++) {
+ ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
+ if (col instanceof ColumnPixelData) {
+ int pixels = ((ColumnPixelData)col).width;
+ widths[i] = pixels;
+ fixedWidth += pixels;
+ } else if (col instanceof ColumnWeightData) {
+ ColumnWeightData cw = (ColumnWeightData)col;
+ numberOfWeightColumns++;
+ int weight = cw.weight;
+ totalWeight += weight;
+ } else {
+ throw new IllegalStateException("Unknown column layout data");
+ }
+ }
+
+ // Do we have columns that have a weight?
+ if (numberOfWeightColumns > 0) {
+ // Now, distribute the rest
+ // to the columns with weight.
+ int rest = width - fixedWidth;
+ int totalDistributed = 0;
+ for (int i = 0; i < size; i++) {
+ ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
+ if (col instanceof ColumnWeightData) {
+ ColumnWeightData cw = (ColumnWeightData)col;
+ int weight = cw.weight;
+ int pixels = totalWeight == 0 ? 0 : weight * rest / totalWeight;
+ totalDistributed += pixels;
+ widths[i] = pixels;
+ }
+ }
+
+ // Distribute any remaining pixels
+ // to columns with weight.
+ int diff = rest - totalDistributed;
+ for (int i = 0; diff > 0; i++) {
+ if (i == size) {
+ i = 0;
+ }
+ ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
+ if (col instanceof ColumnWeightData) {
+ ++widths[i];
+ --diff;
+ }
+ }
+ }
+
+ for (int i = 0; i < size; i++) {
+ if (tableColumns[i].getWidth() != widths[i]) {
+ tableColumns[i].setWidth(widths[i]);
+ }
+
+ }
+
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/EditRuntimePathDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/EditRuntimePathDialog.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/EditRuntimePathDialog.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,156 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui.dialogs;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.runtime.core.model.RuntimePath;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+import org.jboss.tools.runtime.ui.RuntimeUIActivator;
+
+/**
+ * @author snjeza
+ *
+ */
+public class EditRuntimePathDialog extends Dialog {
+
+ private RuntimePath runtimePath;
+ private List<RuntimePath> runtimePaths;
+ private CheckboxTableViewer tableViewer;
+
+ public EditRuntimePathDialog(Shell parentShell, RuntimePath runtimePath) {
+ super(parentShell);
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
+ | SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
+ this.runtimePath = runtimePath;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText("Edit runtime detection path");
+ Composite area = (Composite) super.createDialogArea(parent);
+ Composite contents = new Composite(area, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 400;
+ gd.widthHint = 700;
+ contents.setLayoutData(gd);
+ contents.setLayout(new GridLayout(1, false));
+ applyDialogFont(contents);
+ initializeDialogUnits(area);
+
+ Composite pathComposite = new Composite(contents, SWT.NONE);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ pathComposite.setLayoutData(gd);
+ pathComposite.setLayout(new GridLayout(3, false));
+ Label pathLabel = new Label(pathComposite, SWT.NONE);
+ pathLabel.setText("Path:");
+
+ final Text pathText = new Text(pathComposite, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ pathText.setLayoutData(gd);
+ pathText.setText(runtimePath.getPath());
+
+ Button browseButton = new Button(pathComposite, SWT.NONE);
+ browseButton.setText("Browse...");
+ browseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IDialogSettings dialogSettings = RuntimeUIActivator.getDefault().getDialogSettings();
+
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage("Edit path");
+ dialog.setFilterPath(pathText.getText());
+ final String path = dialog.open();
+ if (path == null) {
+ return;
+ }
+ List<RuntimePath> runtimePaths2 = new ArrayList<RuntimePath>();
+ runtimePaths2.add(runtimePath);
+ RuntimeUIActivator.refreshRuntimes(getShell(), runtimePaths2, null, true, 15);
+ dialogSettings.put(RuntimeUIActivator.LASTPATH, path);
+ pathText.setText(path);
+ }
+
+ });
+
+ Label refreshLabel = new Label(pathComposite, SWT.NONE);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.horizontalSpan = 2;
+ refreshLabel.setLayoutData(gd);
+ refreshLabel.setText("Runtimes found at this path. Remove the check mark for any runtimes you do not want identified.");
+
+ final Button refreshButton = new Button(pathComposite, SWT.NONE);
+ refreshButton.setText("Refresh...");
+ refreshButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ RuntimeUIActivator.refreshRuntimes(getShell(), getRuntimePaths(), tableViewer, false, 15);
+ }
+
+ });
+
+ pathText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ runtimePath.setPath(pathText.getText());
+ if (!pathText.getText().isEmpty()) {
+ refreshButton.setEnabled( (new File(pathText.getText()).isDirectory()) );
+ }
+ }
+ });
+ refreshButton.setEnabled( (new File(pathText.getText()).isDirectory()) );
+
+ List<RuntimePath> runtimePaths = getRuntimePaths();
+ tableViewer = RuntimeUIActivator.createRuntimeViewer(runtimePaths, contents, 100);
+ tableViewer.addCheckStateListener(new ICheckStateListener() {
+
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ ServerDefinition definition = (ServerDefinition) event.getElement();
+ definition.setEnabled(!definition.isEnabled());
+ }
+ });
+ return area;
+ }
+
+ private List<RuntimePath> getRuntimePaths() {
+ if (runtimePaths == null) {
+ runtimePaths = new ArrayList<RuntimePath>();
+ runtimePaths.add(runtimePath);
+ }
+ return runtimePaths;
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/RuntimePathEditingSupport.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/RuntimePathEditingSupport.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/RuntimePathEditingSupport.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,107 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui.dialogs;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.jboss.tools.runtime.core.model.RuntimePath;
+
+/**
+ * @author snjeza
+ *
+ */
+public class RuntimePathEditingSupport extends EditingSupport {
+
+ private CellEditor editor;
+ private int column;
+
+ public RuntimePathEditingSupport(ColumnViewer viewer, int column) {
+ super(viewer);
+ switch (column) {
+ case 0:
+ editor = new TextCellEditor(((TableViewer) viewer).getTable());
+ break;
+ case 1:
+ editor = new CheckboxCellEditor(((TableViewer) viewer).getTable());
+ break;
+ default:
+ editor = new TextCellEditor(((TableViewer) viewer).getTable());
+ }
+
+
+ this.column = column;
+ }
+
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return editor;
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ RuntimePath runtimePath = (RuntimePath) element;
+ String value = null;
+ switch (this.column) {
+ case 0:
+ value = runtimePath.getPath();
+ if (value == null) {
+ value = ""; //$NON-NLS-1$
+ }
+ return value;
+ case 1:
+ boolean scan = runtimePath.isScanOnEveryStartup();
+ return scan;
+ default:
+ break;
+ }
+ return null;
+
+ }
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ RuntimePath runtimePath = (RuntimePath) element;
+
+ switch (this.column) {
+ case 0:
+ if (value != null) {
+ runtimePath.setPath(value.toString());
+ } else {
+ runtimePath.setPath(null);
+ }
+ ISelection selection = getViewer().getSelection();
+ getViewer().setSelection(null);
+ getViewer().setSelection(selection);
+ break;
+ case 1:
+ runtimePath.setScanOnEveryStartup((Boolean)value);
+ break;
+
+ default:
+ break;
+ }
+
+ getViewer().update(element, null);
+
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,360 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui.dialogs;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.ProgressIndicator;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnViewerEditor;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.TableViewerEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableItem;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.RuntimePath;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+import org.jboss.tools.runtime.ui.RuntimeUIActivator;
+
+/**
+ * @author snjeza
+ *
+ */
+public class SearchRuntimePathDialog extends ProgressMonitorDialog {
+
+ private List<RuntimePath> runtimePaths = new ArrayList<RuntimePath>();
+ private boolean running = true;
+ private CheckboxTableViewer tableViewer;
+ private boolean canceled;
+ private boolean needRefresh;
+ private Label foundRuntimesLabel;
+ private List<ServerDefinition> serverDefinitions;
+ private Button hideCreatedRuntimes;
+ private int heightHint;
+
+ public SearchRuntimePathDialog(Shell parent, List<RuntimePath> runtimePaths, boolean needRefresh, int heightHint) {
+ super(parent);
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
+ | SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
+ this.runtimePaths = runtimePaths;
+ this.needRefresh = needRefresh;
+ this.heightHint = heightHint;
+ }
+
+ /**
+ * Set the message in the message label.
+ *
+ * @param messageString
+ * The string for the new message.
+ * @param force
+ * If force is true then always set the message text.
+ */
+ private void setMessage(String messageString, boolean force) {
+ // must not set null text in a label
+ message = messageString == null ? "" : messageString; //$NON-NLS-1$
+ if (messageLabel == null || messageLabel.isDisposed()) {
+ return;
+ }
+ if (force || messageLabel.isVisible()) {
+ messageLabel.setToolTipText(message);
+ messageLabel.setText(shortenText(message, messageLabel));
+ }
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText("Searching for runtimes...");
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalSpan = 2;
+ //gd.heightHint = convertVerticalDLUsToPixels(15);
+ composite.setLayoutData(gd);
+ composite.setLayout(new GridLayout(1, false));
+
+ foundRuntimesLabel = new Label(composite, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ foundRuntimesLabel.setLayoutData(gd);
+ foundRuntimesLabel.setFont(parent.getFont());
+ foundRuntimesLabel.setText("");
+
+ setMessage("Searching...", false);
+ createMessageArea(composite);
+ // Only set for backwards compatibility
+ taskLabel = messageLabel;
+
+ tableViewer = RuntimeUIActivator.createRuntimeViewer(runtimePaths, composite, heightHint);
+ tableViewer.addCheckStateListener(new ICheckStateListener() {
+
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ ServerDefinition definition = (ServerDefinition) event.getElement();
+ definition.setEnabled(!definition.isEnabled());
+ boolean enableOk = false;
+ List<ServerDefinition> serverDefinitions = getServerDefinitions(hideCreatedRuntimes.getSelection());
+ for (ServerDefinition serverDefinition:serverDefinitions) {
+ if (serverDefinition.isEnabled()) {
+ enableOk = true;
+ }
+ }
+ getButton(IDialogConstants.OK_ID).setEnabled(enableOk);
+ }
+ });
+
+ ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(tableViewer) {
+ protected boolean isEditorActivationEvent(
+ ColumnViewerEditorActivationEvent event) {
+ return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
+ || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
+ || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
+ }
+ };
+
+ TableViewerEditor.create(tableViewer, actSupport,
+ ColumnViewerEditor.TABBING_HORIZONTAL
+ | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
+ | ColumnViewerEditor.TABBING_VERTICAL
+ | ColumnViewerEditor.KEYBOARD_ACTIVATION);
+
+ // label showing current task
+ subTaskLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = 0;
+ subTaskLabel.setLayoutData(gd);
+ subTaskLabel.setFont(parent.getFont());
+ // progress indicator
+ progressIndicator = new ProgressIndicator(parent);
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalSpan = 2;
+ gd.heightHint = 0;
+ progressIndicator.setLayoutData(gd);
+
+ hideCreatedRuntimes = new Button(parent, SWT.CHECK);
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalSpan = 2;
+ hideCreatedRuntimes.setLayoutData(gd);
+ hideCreatedRuntimes.setText("Hide already created runtimes");
+ hideCreatedRuntimes.setSelection(true);
+
+ hideCreatedRuntimes.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ refresh(null);
+ }
+
+ });
+
+ return parent;
+
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ // OK button
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
+ true);
+ // cancel button
+ createCancelButton(parent);
+ }
+
+ @Override
+ protected void cancelPressed() {
+ getProgressMonitor().setCanceled(true);
+ if (running) {
+ canceled = true;
+ } else {
+ setReturnCode(CANCEL);
+ close();
+ }
+ }
+
+ private void refresh(String message) {
+ running = false;
+ tableViewer.setInput(null);
+ List<ServerDefinition> serverDefinitions = getServerDefinitions(hideCreatedRuntimes.getSelection());
+ tableViewer.setInput(serverDefinitions);
+ for (ServerDefinition definition:serverDefinitions) {
+ tableViewer.setChecked(definition, definition.isEnabled());
+ }
+ TableItem[] tableItems = tableViewer.getTable().getItems();
+ for (TableItem tableItem:tableItems) {
+ Object data = tableItem.getData();
+ if (data instanceof ServerDefinition) {
+ ServerDefinition serverDefinition = (ServerDefinition) data;
+ boolean exists = RuntimeUIActivator.runtimeExists(serverDefinition);
+ if (exists) {
+ tableItem.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
+ tableViewer.setChecked(serverDefinition, serverDefinition.isEnabled());
+ }
+ }
+ }
+ if (message != null) {
+ setMessage(message, false);
+ }
+ }
+
+ @Override
+ protected void okPressed() {
+ getShell().setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT));
+ Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+ for( IRuntimeDetector detector:detectors) {
+ if (detector.isEnabled()) {
+ detector.initializeRuntimes(getServerDefinitions(true));
+ }
+ }
+ getShell().setCursor(null);
+ setReturnCode(OK);
+ close();
+ if (needRefresh) {
+ RuntimeUIActivator.refreshPreferencePage(getShell());
+ }
+ }
+
+ @Override
+ protected void finishedRun() {
+ decrementNestingDepth();
+ getShell().setCursor(null);
+ int count = getServerDefinitions(true).size();
+ if (count == 0) {
+ hideCreatedRuntimes.setSelection(false);
+ }
+ if (canceled) {
+ refresh("Searching runtimes is canceled.");
+ } else {
+ refresh("Searching runtimes is finished.");
+ RuntimeUIActivator.setTimestamp(runtimePaths);
+ }
+
+ String foundRuntimes;
+ if (count == 0) {
+ foundRuntimes = "No runtime found.";
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ } else {
+ if (count == 1) {
+ foundRuntimes = count + " new runtime found. Press OK to create the runtimes with a checkmark.";
+ } else {
+ foundRuntimes = count + " new runtimes found. Press OK to create the runtimes with a checkmark.";
+ }
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
+ }
+ foundRuntimesLabel.setText(foundRuntimes);
+ }
+
+ @Override
+ protected Image getImage() {
+ return null;
+ }
+
+ @Override
+ protected Control createMessageArea(Composite composite) {
+ // create message
+ if (message != null) {
+ messageLabel = new Label(composite, getMessageLabelStyle());
+ messageLabel.setText(message);
+ GridDataFactory
+ .fillDefaults()
+ .align(SWT.FILL, SWT.BEGINNING)
+ .grab(true, false)
+ .applyTo(messageLabel);
+ }
+ return composite;
+ }
+
+ private List<ServerDefinition> getServerDefinitions(
+ boolean hideCreatedRuntimes) {
+ if (serverDefinitions == null) {
+ serverDefinitions = new ArrayList<ServerDefinition>();
+ } else {
+ serverDefinitions.clear();
+ }
+ for (RuntimePath runtimePath : runtimePaths) {
+ for (ServerDefinition serverDefinition : runtimePath
+ .getServerDefinitions()) {
+ if (!RuntimeUIActivator.runtimeCreated(serverDefinition)) {
+ List<ServerDefinition> allServerDefinitions = RuntimeUIActivator.getDefault().getServerDefinitions();
+ String name = serverDefinition.getName();
+ int i = 1;
+ while (serverDefinitionsExists(serverDefinition, allServerDefinitions)) {
+ serverDefinition.setName(name + " " + i++);
+ }
+ }
+ if (!hideCreatedRuntimes) {
+ serverDefinitions.add(serverDefinition);
+ } else if (!RuntimeUIActivator.runtimeCreated(serverDefinition)) {
+ serverDefinitions.add(serverDefinition);
+ }
+ }
+
+ }
+ return serverDefinitions;
+ }
+
+ private boolean serverDefinitionsExists(ServerDefinition serverDefinition,
+ List<ServerDefinition> allServerDefinitions) {
+ String name = serverDefinition.getName();
+ File location = serverDefinition.getLocation();
+ String type = serverDefinition.getType();
+ if (name == null || location == null || type == null) {
+ return false;
+ }
+ String path = location.getAbsolutePath();
+ if (path == null) {
+ return false;
+ }
+ for (ServerDefinition definition:allServerDefinitions) {
+ if (name.equals(definition.getName()) && type.equals(definition.getType())) {
+ File loc = definition.getLocation();
+ if (loc == null) {
+ continue;
+ }
+ String dPath = loc.getAbsolutePath();
+ if (dPath == null) {
+ continue;
+ }
+ if (!path.equals(dPath)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/JBossRuntimePreferencesInitializer.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/JBossRuntimePreferencesInitializer.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/JBossRuntimePreferencesInitializer.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,32 @@
+/*************************************************************************************
+ * Copyright (c) 2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui.preferences;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.jboss.tools.runtime.ui.RuntimeUIActivator;
+
+/**
+ * @author snjeza
+ *
+ */
+public class JBossRuntimePreferencesInitializer extends
+ AbstractPreferenceInitializer {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ Preferences preferences = RuntimeUIActivator.getDefault().getPluginPreferences();
+ preferences.setDefault(
+ RuntimeUIActivator.FIRST_START,
+ true);
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java 2011-01-07 20:57:52 UTC (rev 27999)
@@ -0,0 +1,653 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2010 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.ui.preferences;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.layout.PixelConverter;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnViewerEditor;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+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.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TableViewerEditor;
+import org.eclipse.jface.viewers.TableViewerFocusCellManager;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+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.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.RuntimePath;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+import org.jboss.tools.runtime.ui.RuntimeContentProvider;
+import org.jboss.tools.runtime.ui.RuntimeLabelProvider;
+import org.jboss.tools.runtime.ui.RuntimeUIActivator;
+import org.jboss.tools.runtime.ui.dialogs.AutoResizeTableLayout;
+import org.jboss.tools.runtime.ui.dialogs.EditRuntimePathDialog;
+import org.jboss.tools.runtime.ui.dialogs.RuntimePathEditingSupport;
+
+/**
+ * @author snjeza
+ *
+ */
+public class RuntimePreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ public static String ID = "org.jboss.tools.runtime.preferences.RuntimePreferencePage";
+ private List<RuntimePath> runtimePaths = new ArrayList<RuntimePath>();
+ private Image checkboxOn;
+ private Image checkboxOff;
+ private Image errorIcon;
+ private TableViewer runtimePathViewer;
+ private RuntimePath runtimePath;
+ private Set<IRuntimeDetector> runtimeDetectors;
+ private TableViewer detectorViewer;
+ private Button searchButton;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
+ * .swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ //noDefaultAndApplyButton();
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+
+ composite.setLayout(layout);
+
+ Group pathsGroup = createGroup(composite,1);
+
+ Label pathsDescription = new Label(pathsGroup, SWT.NONE);
+ pathsDescription.setText("Each path on this list will be automatically scanned for runtimes when\n" +
+ "a new workspace is created or if selected at every Eclipse startup.\n" +
+ "Click Edit to configure rules/filters for the search.");
+
+ Group pathsTableGroup = createGroup(composite,2);
+ runtimePathViewer = createRuntimePathViewer(pathsTableGroup);
+
+ Group detectorGroup = createGroup(composite,1);
+ detectorGroup.setText("Available runtime detectors");
+ detectorViewer = createDetectorViewer(detectorGroup);
+
+// Group runtimeDescriptionGroup = createGroup(composite,1);
+// Label runtimeDescription = new Label(runtimeDescriptionGroup, SWT.NONE);
+// runtimeDescription.setText("Runtimes found at the selected path.\n" +
+// "Remove the check mark for any runtimes you do not want identified.");
+// Group runtimeGroup = createGroup(composite,1);
+// final TableViewer runtimesViewer = createRuntimesViewer(runtimeGroup);
+// runtimePathViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+//
+// @Override
+// public void selectionChanged(SelectionChangedEvent event) {
+// runtimesViewer.setInput(getServerDefinitions());
+// }
+// });
+
+ Dialog.applyDialogFont(composite);
+ return composite;
+ }
+
+ private TableViewer createRuntimesViewer(Composite parent) {
+ CheckboxTableViewer tableViewer = CheckboxTableViewer.newCheckList(parent, SWT.V_SCROLL
+ | SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
+ Table table = tableViewer.getTable();
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 100;
+ table.setLayoutData(gd);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ String[] columnNames = new String[] { "Name", "Version", "Type", "Location", "Description"};
+ int[] columnWidths = new int[] { 120, 50, 50, 150, 150};
+
+ for (int i = 0; i < columnNames.length; i++) {
+ TableColumn tc = new TableColumn(table, SWT.LEFT);
+ tc.setText(columnNames[i]);
+ tc.setWidth(columnWidths[i]);
+ }
+
+ tableViewer.setLabelProvider(new RuntimeLabelProvider());
+ final List<ServerDefinition> serverDefinitions = getServerDefinitions();
+ tableViewer.setContentProvider(new RuntimeContentProvider(serverDefinitions));
+ tableViewer.setInput(serverDefinitions);
+ for (ServerDefinition definition:serverDefinitions) {
+ tableViewer.setChecked(definition, definition.isEnabled());
+ }
+ tableViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ ServerDefinition definition = (ServerDefinition) event.getElement();
+ definition.setEnabled(!definition.isEnabled());
+// boolean enableOk = false;
+// for (ServerDefinition serverDefinition:serverDefinitions) {
+// if (serverDefinition.isEnabled()) {
+// enableOk = true;
+// }
+// }
+ }
+ });
+ return tableViewer;
+ }
+
+ private List<ServerDefinition> getServerDefinitions() {
+ List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
+ if (runtimePathViewer == null) {
+ return serverDefinitions;
+ }
+ ISelection selection = runtimePathViewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+ if (object instanceof RuntimePath) {
+ serverDefinitions = ((RuntimePath)object).getServerDefinitions();
+ }
+ }
+ return serverDefinitions;
+ }
+
+ private Group createGroup(Composite composite, int column) {
+ GridLayout layout;
+ Group group = new Group(composite, SWT.NONE);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+ group.setLayoutData(gd);
+ layout = new GridLayout(column, false);
+ group.setLayout(layout);
+ return group;
+ }
+
+ private TableViewer createDetectorViewer(Composite parent) {
+ CheckboxTableViewer tableViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER
+ | SWT.V_SCROLL | SWT.SINGLE);
+ Table table = tableViewer.getTable();
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 150;
+ table.setLayoutData(gd);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ String[] columnNames = new String[] { "Type", "Link"};
+ int[] columnWidths = new int[] { 300, 50};
+
+ for (int i = 0; i < columnNames.length; i++) {
+ TableColumn tc = new TableColumn(table, SWT.LEFT);
+ tc.setText(columnNames[i]);
+ tc.setWidth(columnWidths[i]);
+ }
+
+ tableViewer.setLabelProvider(new RuntimeDetectorLabelProvider());
+ tableViewer.setContentProvider(new RuntimeDetectorContentProvider(runtimeDetectors));
+
+ tableViewer.setInput(runtimeDetectors);
+ for (IRuntimeDetector detector:runtimeDetectors) {
+ tableViewer.setChecked(detector, detector.isEnabled());
+ }
+ tableViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ IRuntimeDetector detector = (IRuntimeDetector) event.getElement();
+ detector.setEnabled(!detector.isEnabled());
+ }
+ });
+ for (int i=0; i<runtimeDetectors.size(); i++) {
+ TableItem item = table.getItem(i);
+ Object data = item.getData();
+ if (data instanceof IRuntimeDetector) {
+ IRuntimeDetector detector = (IRuntimeDetector) data;
+ final String preferenceId = detector.getPreferenceId();
+ if (preferenceId != null && preferenceId.trim().length() > 0) {
+ Link link = new Link(table, SWT.NONE);
+ link.setText(" <a>Link</a>");
+ TableEditor editor = new TableEditor (table);
+ editor.grabHorizontal = editor.grabVertical = true;
+ editor.setEditor (link, item, 1);
+ link.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ PreferencesUtil.createPreferenceDialogOn(getShell(),preferenceId, null, null);
+ }
+ });
+ }
+ }
+ }
+ return tableViewer;
+ }
+
+ private TableViewer createRuntimePathViewer(Composite parent) {
+ final TableViewer viewer = new TableViewer(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 150;
+ viewer.getTable().setLayoutData(gd);
+
+ Table table = viewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ table.setFont(parent.getFont());
+
+ viewer.setContentProvider(new RuntimePathContentProvider());
+
+ String[] columnHeaders = {"Path", "Every start"};
+
+ for (int i = 0; i < columnHeaders.length; i++) {
+ TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+ column.setLabelProvider(new RuntimePathLabelProvider(i));
+ column.getColumn().setText(columnHeaders[i]);
+ column.getColumn().setResizable(true);
+ column.getColumn().setMoveable(true);
+ column.setEditingSupport(new RuntimePathEditingSupport(viewer, i));
+
+ }
+
+ ColumnLayoutData[] runtimePathsLayouts= {
+ new ColumnWeightData(150,150),
+ new ColumnWeightData(60,60)
+ };
+
+ TableLayout layout = new AutoResizeTableLayout(table);
+ for (int i = 0; i < runtimePathsLayouts.length; i++) {
+ layout.addColumnData(runtimePathsLayouts[i]);
+ }
+
+ viewer.getTable().setLayout(layout);
+
+ configureViewer(viewer);
+
+
+ viewer.setInput(runtimePaths);
+
+ createRuntimePathsButtons(parent, viewer);
+ return viewer;
+ }
+
+ private void configureViewer(final TableViewer viewer) {
+ TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(viewer, new FocusCellOwnerDrawHighlighter(viewer));
+
+ ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(viewer) {
+ protected boolean isEditorActivationEvent(
+ ColumnViewerEditorActivationEvent event) {
+ ViewerCell cell = viewer.getColumnViewerEditor().getFocusCell();
+ if (cell != null && cell.getColumnIndex() == 1) {
+ return super.isEditorActivationEvent(event);
+ }
+ return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
+ || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
+ || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
+ || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
+ }
+ };
+
+ TableViewerEditor.create(viewer, focusCellManager, actSupport, ColumnViewerEditor.TABBING_HORIZONTAL
+ | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
+ | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);
+ }
+
+ private void createRuntimePathsButtons(Composite parent, final TableViewer viewer) {
+ Composite buttonComposite = new Composite(parent, SWT.NONE);
+ buttonComposite.setLayout(new GridLayout(1,false));
+ buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
+
+ Button addButton = new Button(buttonComposite, SWT.PUSH);
+ addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ addButton.setText("Add");
+ addButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ IDialogSettings dialogSettings = RuntimeUIActivator.getDefault().getDialogSettings();
+ String lastUsedPath= dialogSettings.get(RuntimeUIActivator.LASTPATH);
+ if (lastUsedPath == null) {
+ lastUsedPath= ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ }
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage("Add a new path");
+ dialog.setFilterPath(lastUsedPath);
+ final String path = dialog.open();
+ if (path == null) {
+ return;
+ }
+ dialogSettings.put(RuntimeUIActivator.LASTPATH, path);
+ RuntimePath runtimePath = new RuntimePath(path);
+ runtimePaths.add(runtimePath);
+ List<RuntimePath> runtimePaths2 = new ArrayList<RuntimePath>();
+ runtimePaths2.add(runtimePath);
+ RuntimeUIActivator.refreshRuntimes(getShell(), runtimePaths2, null, true, 15);
+ configureSearch();
+ runtimePathViewer.setInput(runtimePath.getServerDefinitions());
+ viewer.refresh();
+ }
+
+ });
+
+ final Button editButton = new Button(buttonComposite, SWT.PUSH);
+ editButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ editButton.setText("Edit...");
+ editButton.setEnabled(false);
+
+ editButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetSelected(SelectionEvent e) {
+ ISelection sel = viewer.getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Object object = selection.getFirstElement();
+ if (object instanceof RuntimePath) {
+ runtimePath = (RuntimePath) object;
+ RuntimePath runtimePathClone;
+ try {
+ runtimePathClone = (RuntimePath) runtimePath.clone();
+ } catch (CloneNotSupportedException e1) {
+ RuntimeUIActivator.log(e1);
+ runtimePathClone = runtimePath;
+ }
+ EditRuntimePathDialog dialog = new EditRuntimePathDialog(getShell(), runtimePathClone);
+ int ok = dialog.open();
+ if (ok == Window.OK) {
+ runtimePaths.remove(runtimePath);
+ runtimePath = runtimePathClone;
+ runtimePaths.add(runtimePath);
+ configureSearch();
+ viewer.refresh();
+ }
+ }
+ }
+ RuntimeUIActivator.refreshPreferencePage(getShell());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ final Button removeButton = new Button(buttonComposite, SWT.PUSH);
+ removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ removeButton.setText("Remove");
+ removeButton.setEnabled(false);
+
+ removeButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetSelected(SelectionEvent e) {
+ ISelection sel = viewer.getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Object object = selection.getFirstElement();
+ if (object instanceof RuntimePath) {
+ runtimePaths.remove(object);
+ configureSearch();
+ viewer.refresh();
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ searchButton = new Button(buttonComposite, SWT.PUSH);
+ searchButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ searchButton.setText("Search...");
+ searchButton.setEnabled(runtimePaths.size() > 0);
+
+ searchButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetSelected(SelectionEvent e) {
+ RuntimeUIActivator.refreshRuntimes(getShell(), runtimePaths, null, true, 15);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection sel = viewer.getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Object object = selection.getFirstElement();
+ editButton.setEnabled(object instanceof RuntimePath);
+ removeButton.setEnabled(object instanceof RuntimePath);
+ } else {
+ editButton.setEnabled(false);
+ removeButton.setEnabled(false);
+ //searchButton.setEnabled(false);
+ }
+ }
+ });
+ }
+
+ public void init(IWorkbench workbench) {
+ runtimePaths = RuntimeUIActivator.getDefault().getRuntimePaths();
+ runtimeDetectors = RuntimeUIActivator.getDefault().getRuntimeDetectors();
+ checkboxOn = RuntimeUIActivator.imageDescriptorFromPlugin(RuntimeUIActivator.PLUGIN_ID, "/icons/xpl/complete_tsk.gif").createImage();
+ checkboxOff = RuntimeUIActivator.imageDescriptorFromPlugin(RuntimeUIActivator.PLUGIN_ID, "/icons/xpl/incomplete_tsk.gif").createImage();
+ errorIcon = RuntimeUIActivator.imageDescriptorFromPlugin(RuntimeUIActivator.PLUGIN_ID, "/icons/xpl/error_tsk.gif").createImage();
+ }
+
+ @Override
+ public void dispose() {
+ if (checkboxOff != null) {
+ checkboxOff.dispose();
+ }
+ if (checkboxOn != null) {
+ checkboxOn.dispose();
+ }
+ if (errorIcon != null) {
+ errorIcon.dispose();
+ }
+ super.dispose();
+ }
+
+ /**
+ * Returns a width hint for a button control.
+ * @param button the button
+ * @return the width hint
+ */
+ public static int getButtonWidthHint(Button button) {
+ button.setFont(JFaceResources.getDialogFont());
+ PixelConverter converter= new PixelConverter(button);
+ int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ }
+
+ /**
+ * Sets width and height hint for the button control.
+ * <b>Note:</b> This is a NOP if the button's layout data is not
+ * an instance of <code>GridData</code>.
+ *
+ * @param button the button for which to set the dimension hint
+ */
+ public static void setButtonDimensionHint(Button button) {
+ Assert.isNotNull(button);
+ Object gd= button.getLayoutData();
+ if (gd instanceof GridData) {
+ ((GridData)gd).widthHint= getButtonWidthHint(button);
+ ((GridData)gd).horizontalAlignment = GridData.FILL;
+ }
+ }
+
+ class RuntimePathContentProvider implements IStructuredContentProvider {
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return runtimePaths.toArray();
+ }
+
+ @Override
+ public void dispose() {
+
+ }
+
+ }
+
+ class RuntimePathLabelProvider extends ColumnLabelProvider {
+
+ private int columnIndex;
+
+ public RuntimePathLabelProvider(int i) {
+ this.columnIndex = i;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof RuntimePath) {
+ RuntimePath runtimePath = (RuntimePath) element;
+ switch (columnIndex) {
+ case 0:
+ return runtimePath.getPath();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element == null) {
+ return null;
+ }
+ RuntimePath runtimePath = (RuntimePath) element;
+ if (columnIndex == 1) {
+ return runtimePath.isScanOnEveryStartup() ? checkboxOn : checkboxOff;
+ }
+ if (columnIndex == 0) {
+ String path = runtimePath.getPath();
+ if (path == null || ! (new File(path).isDirectory())) {
+ return errorIcon;
+ }
+ }
+ return null;
+ }
+ }
+
+ private class RuntimeDetectorContentProvider implements IStructuredContentProvider {
+
+ private Set<IRuntimeDetector> detectors;
+
+ public RuntimeDetectorContentProvider(Set<IRuntimeDetector> detectors) {
+ this.detectors = detectors;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return detectors.toArray();
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ detectors = (Set<IRuntimeDetector>) newInput;
+ }
+ }
+
+ private class RuntimeDetectorLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof IRuntimeDetector) {
+ IRuntimeDetector detector = (IRuntimeDetector) element;
+ if (columnIndex == 0) {
+ return detector.getName();
+ }
+ }
+ return null;
+ }
+ }
+
+ @Override
+ protected void performApply() {
+ RuntimeUIActivator.getDefault().saveRuntimePreferences();
+ }
+
+ @Override
+ protected void performDefaults() {
+ RuntimeUIActivator.getDefault().initDefaultRuntimePreferences();
+ runtimePaths = RuntimeUIActivator.getDefault().getRuntimePaths();
+ runtimeDetectors = RuntimeUIActivator.getDefault().getRuntimeDetectors();
+ runtimePathViewer.setInput(runtimePaths);
+ detectorViewer.setInput(runtimeDetectors);
+ super.performDefaults();
+ }
+
+ @Override
+ public boolean performOk() {
+ RuntimeUIActivator.getDefault().saveRuntimePreferences();
+ return super.performOk();
+ }
+
+ private void configureSearch() {
+ if (searchButton != null) {
+ searchButton.setEnabled(runtimePaths.size() > 0);
+ }
+ }
+
+}
Modified: trunk/runtime/plugins/pom.xml
===================================================================
--- trunk/runtime/plugins/pom.xml 2011-01-07 20:55:29 UTC (rev 27998)
+++ trunk/runtime/plugins/pom.xml 2011-01-07 20:57:52 UTC (rev 27999)
@@ -13,6 +13,8 @@
<packaging>pom</packaging>
<modules>
<module>org.jboss.tools.runtime</module>
+ <module>org.jboss.tools.runtime.core</module>
+ <module>org.jboss.tools.runtime.ui</module>
</modules>
</project>
\ No newline at end of file
13 years, 5 months
JBoss Tools SVN: r27998 - trunk/runtime/features/org.jboss.tools.runtime.feature.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-01-07 15:55:29 -0500 (Fri, 07 Jan 2011)
New Revision: 27998
Added:
trunk/runtime/features/org.jboss.tools.runtime.feature/license.html
Modified:
trunk/runtime/features/org.jboss.tools.runtime.feature/build.properties
trunk/runtime/features/org.jboss.tools.runtime.feature/feature.properties
trunk/runtime/features/org.jboss.tools.runtime.feature/feature.xml
trunk/runtime/features/org.jboss.tools.runtime.feature/pom.xml
Log:
JBIDE-7527 Automatic runtime detection
Modified: trunk/runtime/features/org.jboss.tools.runtime.feature/build.properties
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.feature/build.properties 2011-01-07 20:48:00 UTC (rev 27997)
+++ trunk/runtime/features/org.jboss.tools.runtime.feature/build.properties 2011-01-07 20:55:29 UTC (rev 27998)
@@ -1,2 +1,3 @@
bin.includes = feature.xml,\
- feature.properties
+ feature.properties,\
+ license.html
Modified: trunk/runtime/features/org.jboss.tools.runtime.feature/feature.properties
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.feature/feature.properties 2011-01-07 20:48:00 UTC (rev 27997)
+++ trunk/runtime/features/org.jboss.tools.runtime.feature/feature.properties 2011-01-07 20:55:29 UTC (rev 27998)
@@ -26,3 +26,31 @@
# "description" property - description of the feature
description=This feature provides runtime initialization
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=Copyright (c) 2008-2010 JBoss by Red Hat and others.\nAll rights reserved. This program and the accompanying materials\n
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http\://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors\:\n\
+JBoss by Red Hat - Initial implementation.\n
+ ############### end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# START NON-TRANSLATABLE
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=Red Hat, Inc. licenses these features and plugins to you under \
+certain open source licenses (or aggregations of such licenses), which \
+in a particular case may include the Eclipse Public License, the GNU \
+Lesser General Public License, and/or certain other open source \
+licenses. For precise licensing details, consult the corresponding \
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive, \
+Raleigh NC 27606 USA.
+# END NON-TRANSLATABLE
+########### end of license property ##########################################
+
Modified: trunk/runtime/features/org.jboss.tools.runtime.feature/feature.xml
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.feature/feature.xml 2011-01-07 20:48:00 UTC (rev 27997)
+++ trunk/runtime/features/org.jboss.tools.runtime.feature/feature.xml 2011-01-07 20:55:29 UTC (rev 27998)
@@ -2,427 +2,20 @@
<feature
id="org.jboss.tools.runtime.feature"
label="%featureName"
- version="1.1.0.qualifier"
- provider-name="%providerName">
+ version="1.2.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.jboss.tools.runtime">
<description>
%description
</description>
<copyright>
- JBoss by Red Hat
-Copyright 2009-2010, JBoss by Red Hat, and individual contributors as indicated
-by the @authors tag. See the copyright.txt in the distribution
-for a full listing of individual contributors.
+ %copyright
</copyright>
- <license url="http://osdn.dl.sourceforge.net/sourceforge/jboss/LGPL.html">
- JBossTools is under the LGPL Licence
-GNU LESSER GENERAL PUBLIC LICENSE
-Version 2.1, February 1999
-Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-[This is the first released version of the Lesser GPL. It also
-counts
-as the successor of the GNU Library Public License, version 2,
-hence
-the version number 2.1.]
-Preamble
-The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General
-Public Licenses are intended to guarantee your freedom to share
-and change free software--to make sure the software is free for
-all its users.
-This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of
-the Free Software Foundation and other authors who decide to
-use it. You can use it too, but we suggest you first think carefully
-about whether this license or the ordinary General Public License
-is the better strategy to use in any particular case, based on
-the explanations below.
-When we speak of free software, we are referring to freedom of
-use, not price. Our General Public Licenses are designed to make
-sure that you have the freedom to distribute copies of free software
-(and charge for this service if you wish); that you receive source
-code or can get it if you want it; that you can change the software
-and use pieces of it in new free programs; and that you are informed
-that you can do these things.
-To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender
-these rights. These restrictions translate to certain responsibilities
-for you if you distribute copies of the library or if you modify
-it.
-For example, if you distribute copies of the library, whether
-gratis or for a fee, you must give the recipients all the rights
-that we gave you. You must make sure that they, too, receive
-or can get the source code. If you link other code with the library,
-you must provide complete object files to the recipients, so
-that they can relink them with the library after making changes
-to the library and recompiling it. And you must show them these
-terms so they know their rights.
-We protect your rights with a two-step method: (1) we copyright
-the library, and (2) we offer you this license, which gives you
-legal permission to copy, distribute and/or modify the library.
-To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library
-is modified by someone else and passed on, the recipients should
-know that what they have is not the original version, so that
-the original author's reputation will not be affected by problems
-that might be introduced by others.
-Finally, software patents pose a constant threat to the existence
-of any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining
-a restrictive license from a patent holder. Therefore, we insist
-that any patent license obtained for a version of the library
-must be consistent with the full freedom of use specified in
-this license.
-Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries,
-and is quite different from the ordinary General Public License.
-We use this license for certain libraries in order to permit
-linking those libraries into non-free programs.
-When a program is linked with a library, whether statically or
-using a shared library, the combination of the two is legally
-speaking a combined work, a derivative of the original library.
-The ordinary General Public License therefore permits such linking
-only if the entire combination fits its criteria of freedom.
-The Lesser General Public License permits more lax criteria for
-linking other code with the
- library.
-We call this license the "Lesser" General Public License because
-it does Less to protect the user's freedom than the ordinary
-General Public License. It also provides other free software
-developers Less of an advantage over competing non-free programs.
-These disadvantages are the reason we use the ordinary General
-Public License for many libraries. However, the Lesser license
-provides advantages in certain special circumstances.
-For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that
-it becomes a de-facto standard. To achieve this, non-free programs
-must be allowed to use the library. A more frequent case is that
-a free library does the same job as widely used non-free libraries.
-In this case, there is little to gain by limiting the free library
-to free software only, so we use the Lesser General Public License.
-In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body
-of free software. For example, permission to use the GNU C Library
-in non-free programs enables many more people to use the whole
-GNU operating system, as well as its variant, the GNU/Linux operating
-system.
-Although the Lesser General Public License is Less protective
-of the users' freedom, it does ensure that the user of a program
-that is linked with the Library has the freedom and the wherewithal
-to run that program using a modified version of the Library.
-The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between
-a "work based on the library" and a "work that uses the library".
-The former contains code derived from the library, whereas the
-latter must be combined with the library in order to run.
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-0. This License Agreement applies to any software library or
-other program which contains a notice placed by the copyright
-holder or other authorized party saying it may be distributed
-under the terms of this Lesser General Public License (also called
-"this License"). Each licensee is addressed as "you".
-A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-The "Library", below, refers to any such software library or
-work which has been distributed under these terms. A "work based
-on the Library" means either the Library or any derivative work
-under copyright law: that is to say, a work containing the Library
-or a portion of it, either verbatim or with modifications and/or
-translated straightforwardly into another language. (Hereinafter,
-translation is included without limitation in the term "modification".)
-"Source code" for a work means the preferred form of the work
-for making modifications to it. For a library, complete source
-code means all the source code for all modules it contains, plus
-any associated interface definition files, plus the scripts used
-to control compilation and installation of the library.
-Activities other than copying, distribution and modification
-are not covered by this License; they are outside its scope.
-The act of running a program using the Library is not restricted,
-and output from such a program is covered only if its contents
-constitute a work based on the Library (independent of the use
-of the Library in a tool for writing it). Whether that is true
-depends on what the Library does and what the program that uses
-the Library does.
-1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided
-that you conspicuously and appropriately publish on each copy
-an appropriate copyright notice and disclaimer of warranty; keep
-intact all the notices that refer to this License and to the
-absence of any warranty; and distribute a copy of this License
-along with the Library.
-You may charge a fee for the physical act of transferring a copy,
-and
-you may at your option offer warranty protection in exchange
-for a fee.
-2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section
-1 above, provided that you also meet all of these conditions:
-a) The modified work must itself be a software library.
-b) You must cause the files modified to carry prominent notices
-stating that you changed the files and the date of any change.
-c) You must cause the whole of the work to be licensed at no
-charge to all third parties under the terms of this License.
-d) If a facility in the modified Library refers to a function
-or a table of data to be supplied by an application program that
-uses the facility, other than as an argument passed when the
-facility is invoked, then you must make a good faith effort to
-ensure that, in the event an application does not supply such
-function or table, the facility still operates, and performs
-whatever part of its purpose remains meaningful.
-(For example, a function in a library to compute square roots
-has a purpose that is entirely well-defined independent of the
-application. Therefore, Subsection 2d requires that any application-supplied
-function or table used by this function must be optional: if
-the application does not supply it, the square root function
-must still compute square roots.)
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works
-in themselves, then this License, and its terms, do not apply
-to those sections when you distribute them as separate works.
-But when you distribute the same sections as part of a whole
-which is a work based on the Library, the distribution of the
-whole must be on the terms of this License, whose permissions
-for other licensees extend to the entire whole, and thus to each
-and every part regardless of who wrote it.
-Thus, it is not the intent of this section to claim rights or
-contest your rights to work written entirely by you; rather,
-the intent is to exercise the right to control the distribution
-of derivative or collective works based on the Library.
-In addition, mere aggregation of another work not based on the
-Library with the Library (or with a work based on the Library)
-on a volume of a storage or distribution medium does not bring
-the other work under the scope of this License.
-3. You may opt to apply the terms of the ordinary GNU General
-Public License instead of this License to a given copy of the
-Library. To do this, you must alter all the notices that refer
-to this License, so that they refer to the ordinary GNU General
-Public License, version 2, instead of to this License. (If a
-newer version than version 2 of the ordinary GNU General Public
-License has appeared, then you can specify that version instead
-if you wish.) Do not make any other change in these notices.
-Once this change is made in a given copy, it is irreversible
-for that copy, so the ordinary GNU General Public License applies
-to all subsequent copies and derivative works made from that
-copy.
-This option is useful when you wish to copy part of the code
-of the Library into a program that is not a library.
-4. You may copy and distribute the Library (or a portion or derivative
-of it, under Section 2) in object code or executable form under
-the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code,
-which must be distributed under the terms of Sections 1 and 2
-above on a medium customarily used for software interchange.
-If distribution of object code is made by offering access to
-copy from a designated place, then offering equivalent access
-to copy the source code from the same place satisfies the requirement
-to distribute the source code, even though third parties are
-not compelled to copy the source along with the object code.
-5. A program that contains no derivative of any portion of the
-Library
-, but is designed to work with the Library by being compiled
-or linked with it, is called a "work that uses the Library".
-Such a work, in isolation, is not a derivative work of the Library,
-and therefore falls outside the scope of this License.
-However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because
-it contains portions of the Library), rather than a "work that
-uses the library". The executable is therefore covered by this
-License. Section 6 states terms for distribution of such executables.
-When a "work that uses the Library" uses material from a header
-file that is part of the Library, the object code for the work
-may be a derivative work of the Library even though the source
-code is not. Whether this is true is especially significant if
-the work can be linked without the Library, or if the work is
-itself a library. The threshold for this to be true is not precisely
-defined by law.
-If such an object file uses only numerical parameters, data structure
-layouts and accessors, and small macros and small inline functions
-(ten lines or less in length), then the use of the object file
-is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions
-of the Library will still fall under Section 6.)
-Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section
-6. Any executables containing that work also fall under Section
-6, whether or not they are linked directly with the Library itself.
-6. As an exception to the Sections above, you may also combine
-or link a "work that uses the Library" with the Library to produce
-a work containing portions of the Library, and distribute that
-work under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-You must give prominent notice with each copy of the work that
-the Library is used in it and that the Library and its use are
-covered by this License. You must supply a copy of this License.
-If the work during execution displays copyright notices, you
-must include the copyright notice for the Library among them,
-as well as a reference directing the user to the copy of this
-License. Also, you must do one of these things:
-a) Accompany the work with the complete corresponding machine-readable
-source code for the Library including whatever changes were used
-in the work (which must be distributed under Sections 1 and 2
-above); and, if the work is an executable linked with the Library,
-with the complete machine-readable "work that uses the Library",
-as object code and/or source code, so that the user can modify
-the Library and then relink to produce a modified executable
-containing the modified Library. (It is understood that the user
-who changes the contents of definitions files in the Library
-will not necessarily be able to recompile the application to
-use the modified definitions.)
-b) Use a suitable shared library mechanism for linking with the
-Library. A suitable mechanism is one that (1) uses at run time
-a copy of the library already present on the user's computer
-system, rather than copying library functions into the executable,
-and (2) will operate properly with a modified version of the
-library, if the user installs one, as long as the modified version
-is interface-compatible with the version that the work was made
-with.
-c) Accompany the work with a written offer, valid for at least
-three years, to give the same user the materials specified in
-Subsection 6a, above, for a charge no more than the cost of performing
-this distribution.
-d) If distribution of the work is made by offering access to
-copy from a designated place, offer equivalent access to copy
-the above specified materials from the same place.
-e) Verify that the user has already received a copy of these
-materials or that you have already sent this user a copy.
-For an executable, the required form of the "work t
-hat uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that
-is normally distributed (in either source or binary form) with
-the major components (compiler, kernel, and so on) of the operating
-system on which the executable runs, unless that component itself
-accompanies the executable.
-It may happen that this requirement contradicts the license restrictions
-of other proprietary libraries that do not normally accompany
-the operating system. Such a contradiction means you cannot use
-both them and the Library together in an executable that you
-distribute.
-7. You may place library facilities that are a work based on
-the Library side-by-side in a single library together with other
-library facilities not covered by this License, and distribute
-such a combined library, provided that the separate distribution
-of the work based on the Library and of the other library facilities
-is otherwise permitted, and provided that you do these two things:
-a) Accompany the combined library with a copy of the same work
-based on the Library, uncombined with any other library facilities.
-This must be distributed under the terms of the Sections above.
-b) Give prominent notice with the combined library of the fact
-that part of it is a work based on the Library, and explaining
-where to find the accompanying uncombined form of the same work.
-8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.
-Any attempt otherwise to copy, modify, sublicense, link with,
-or distribute the Library is void, and will automatically terminate
-your rights under this License. However, parties who have received
-copies, or rights, from you under this License will not have
-their licenses terminated so long as such parties remain in full
-compliance.
-9. You are not required to accept this License, since you have
-not signed it. However, nothing else grants you permission to
-modify or distribute the Library or its derivative works. These
-actions are prohibited by law if you do not accept this License.
-Therefore, by modifying or distributing the Library (or any work
-based on the Library), you indicate your acceptance of this License
-to do so, and all its terms and conditions for copying, distributing
-or modifying the Library or works based on it.
-10. Each time you redistribute the Library (or any work based
-on the Library), the recipient automatically receives a license
-from the original licensor to copy, distribute, link with or
-modify the Library subject to these terms and conditions. You
-may not impose any further restrictions on the recipients' exercise
-of the rights granted herein. You are not responsible for enforcing
-compliance by third parties with this License.
-11. If, as a consequence of a court judgment or allegation of
-patent infringement or for any other reason (not limited to patent
-issues), conditions are imposed on you (whether by court order,
-agreement or otherwise) that contradict the conditions of this
-License, they do not excuse you from the conditions of this License.
-If you cannot distribute so as to satisfy simultaneously your
-obligations under this License and any other pertinent obligations,
-then as a consequence you may not distribute the Library at all.
-For example, if a patent license would not permit royalty-free
-redistribution of the Library by all those who receive copies
-directly or indirectly through you, then the only way you could
-satisfy both it and this License would be to refrain entirely
-from distribution of the Library.
-If any portion of this section is held invalid or unenforceable
-under any particular circumstance, the balance of the section
-is intended to apply, and the section as a whole is intended
-to apply in other circumstances.
-It is not the purpose of this section to induce you to infringe
-any patents or other property right claims or to contest validity
-of any such claims; this section has the sole purpose of
- protecting
-the integrity of the free software distribution system which
-is implemented by public license practices. Many people have
-made generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of
-that system; it is up to the author/donor to decide if he or
-she is willing to distribute software through any other system
-and a licensee cannot impose that choice.
-This section is intended to make thoroughly clear what is believed
-to be a consequence of the rest of this License.
-12. If the distribution and/or use of the Library is restricted
-in certain countries either by patents or by copyrighted interfaces,
-the original copyright holder who places the Library under this
-License may add an explicit geographical distribution limitation
-excluding those countries, so that distribution is permitted
-only in or among countries not thus excluded. In such case, this
-License incorporates the limitation as if written in the body
-of this License.
-13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-Each version is given a distinguishing version number. If the
-Library specifies a version number of this License which applies
-to it and "any later version", you have the option of following
-the terms and conditions either of that version or of any later
-version published by the Free Software Foundation. If the Library
-does not specify a license version number, you may choose any
-version ever published by the Free Software Foundation.
-14. If you wish to incorporate parts of the Library into other
-free programs whose distribution conditions are incompatible
-with these, write to the author to ask for permission. For software
-which is copyrighted by the Free Software Foundation, write to
-the Free Software Foundation; we sometimes make exceptions for
-this. Our decision will be guided by the two goals of preserving
-the free status of all derivatives of our free software and of
-promoting the sharing and reuse of software generally.
-NO WARRANTY
-15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS
-NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE
-LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
-AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
-PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE
-DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR
-OR CORRECTION.
-16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO
-IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO
-MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE,
-BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
-INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
-INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS
-OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED
-BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE
-WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY
-HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-END OF TERMS AND CONDITIONS
+ <license url="%licenseURL">
+ %license
</license>
<plugin
Added: trunk/runtime/features/org.jboss.tools.runtime.feature/license.html
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.feature/license.html (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.feature/license.html 2011-01-07 20:55:29 UTC (rev 27998)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+
+<body>
+<p>Red Hat, Inc. licenses these features and plugins to you under
+certain open source licenses (or aggregations of such licenses), which
+in a particular case may include the Eclipse Public License, the GNU
+Lesser General Public License, and/or certain other open source
+licenses. For precise licensing details, consult the corresponding
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive,
+Raleigh NC 27606 USA.
+</p>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/runtime/features/org.jboss.tools.runtime.feature/pom.xml
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.feature/pom.xml 2011-01-07 20:48:00 UTC (rev 27997)
+++ trunk/runtime/features/org.jboss.tools.runtime.feature/pom.xml 2011-01-07 20:55:29 UTC (rev 27998)
@@ -9,6 +9,6 @@
</parent>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.runtime.feature</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
13 years, 5 months
JBoss Tools SVN: r27997 - trunk/runtime/features.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-01-07 15:48:00 -0500 (Fri, 07 Jan 2011)
New Revision: 27997
Added:
trunk/runtime/features/org.jboss.tools.runtime.core.feature/
Log:
Initial import.
13 years, 5 months
JBoss Tools SVN: r27996 - trunk/runtime/plugins.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-01-07 15:46:40 -0500 (Fri, 07 Jan 2011)
New Revision: 27996
Added:
trunk/runtime/plugins/org.jboss.tools.runtime.ui/
Log:
Initial import.
13 years, 5 months
JBoss Tools SVN: r27995 - trunk/runtime/plugins.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-01-07 15:45:05 -0500 (Fri, 07 Jan 2011)
New Revision: 27995
Added:
trunk/runtime/plugins/org.jboss.tools.runtime.core/
Log:
Initial import.
13 years, 5 months
JBoss Tools SVN: r27994 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-01-07 15:18:43 -0500 (Fri, 07 Jan 2011)
New Revision: 27994
Modified:
trunk/build/build.xml
Log:
add support for new drools plugin names in get.artifact.id method; add three new test cases; bump up to maven 3.0.1
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2011-01-07 20:17:32 UTC (rev 27993)
+++ trunk/build/build.xml 2011-01-07 20:18:43 UTC (rev 27994)
@@ -2,7 +2,7 @@
<!-- ****************************** Configuration ****************************** -->
<!-- default maven version -->
- <property name="maven.version" value="3.0" />
+ <property name="maven.version" value="3.0.1" />
<!-- set name of component(s) to build+test, IN ORDER; if no subcomponents, use "." -->
<property name="COMPONENTS"
@@ -1361,6 +1361,15 @@
replace="\1"
override="true"
/>
+ <!-- <echo level="debug">artifact.id = ${artifact.id}</echo> -->
+ <propertyregex property="artifact.id"
+ defaultvalue="${artifact.id}"
+ input="${artifact.id}"
+ regexp="([^_]+)_(\d+\.\d+\.\d+\.\d+)\.jar"
+ replace="\1"
+ override="true"
+ />
+ <echo level="verbose">artifact.id = ${artifact.id}</echo>
<var name="artifactJar" unset="true" />
</target>
@@ -1720,7 +1729,15 @@
<property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse.task_5.1.0.jar"
value="org.drools.eclipse.task"
/>
-
+ <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse.task_5.2.0.201101062302.jar"
+ value="org.drools.eclipse.task"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse_5.2.0.201101062302.jar"
+ value="org.drools.eclipse"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.guvnor.tools_5.2.0.201101062302.jar"
+ value="org.guvnor.tools"
+ />
</target>
<target name="test.all">
13 years, 5 months
JBoss Tools SVN: r27993 - trunk/drools.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-01-07 15:17:32 -0500 (Fri, 07 Jan 2011)
New Revision: 27993
Modified:
trunk/drools/build.xml
Log:
update build.xml to use latest stable-tag built version of Drools from KrisV
Modified: trunk/drools/build.xml
===================================================================
--- trunk/drools/build.xml 2011-01-07 17:04:22 UTC (rev 27992)
+++ trunk/drools/build.xml 2011-01-07 20:17:32 UTC (rev 27993)
@@ -4,7 +4,7 @@
<property name="COMPONENT" value="drools" />
<!-- https://jira.jboss.org/browse/JBIDE-7344 from JBoss Tools 3.2.0.Beta2 onward, use this: -->
- <property name="drools.zip" value="drools-5.2.0.SNAPSHOT-eclipse-all.zip" />
+ <property name="drools.zip" value="drools-5.2.0-SNAPSHOT-eclipse-all.zip" />
<property name="drools.URL" value="http://hudson.qa.jboss.com/hudson/job/drools-stable-tag/lastStableBuild/a..." />
<!-- or use Drools' latest nightly from trunk -->
@@ -45,28 +45,24 @@
</condition>
<!-- if can't calculate where build/build.xml is located, must pass in path from parent when calling this script -->
- <target name="custom.build"
- description="fetch latest drools from their Hudson build + selectively unpack it"
- depends="init"
- >
- <get src="${drools.URL}/${drools.zip}"
- dest="${WORKINGDIR}/${COMPONENT}/${drools.zip}"
- usetimestamp="true"
- />
+ <target name="custom.build" description="fetch latest drools from their Hudson build + selectively unpack it" depends="init">
+ <get src="${drools.URL}/${drools.zip}" dest="${WORKINGDIR}/${COMPONENT}/${drools.zip}" usetimestamp="true" />
<unzip src="${WORKINGDIR}/${COMPONENT}/${drools.zip}" dest="${WORKINGDIR}/${COMPONENT}" overwrite="true" />
+ <move todir="${WORKINGDIR}/${COMPONENT}/plugins">
+ <fileset dir="${WORKINGDIR}/${COMPONENT}/drools-update-site/plugins" />
+ </move>
+ <move todir="${WORKINGDIR}/${COMPONENT}/features">
+ <fileset dir="${WORKINGDIR}/${COMPONENT}/drools-update-site/features" />
+ </move>
+ <delete dir="${WORKINGDIR}/${COMPONENT}/drools-update-site" />
<!-- <delete file="${WORKINGDIR}/${COMPONENT}/${drools.zip}" quiet="true"/> -->
<ant antfile="${build.xml}" target="unjarPlugins">
<property name="COMPONENT" value="${COMPONENT}" />
</ant>
- <delete dir="${WORKINGDIR}/${COMPONENT}"
- quiet="true"
- includes="
- LICENSE-ASL-2.0.txt, README_DEPENDENCIES.txt,
- plugins/*.jar
- "
- />
+ <delete dir="${WORKINGDIR}/${COMPONENT}" quiet="true" includes="LICENSE-ASL-2.0.txt,
+ README_DEPENDENCIES.txt, ReadMeDroolsEclipse.txt, plugins/*.jar" />
<ant antfile="${build.xml}" target="renameFeatures">
<property name="COMPONENT" value="${COMPONENT}" />
13 years, 5 months