JBoss Tools SVN: r40537 - in trunk/forge/plugins/org.jboss.tools.forge.core: .settings and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-04-27 03:24:22 -0400 (Fri, 27 Apr 2012)
New Revision: 40537
Added:
trunk/forge/plugins/org.jboss.tools.forge.core/.settings/org.eclipse.m2e.core.prefs
Modified:
trunk/forge/plugins/org.jboss.tools.forge.core/.classpath
trunk/forge/plugins/org.jboss.tools.forge.core/.project
trunk/forge/plugins/org.jboss.tools.forge.core/.settings/org.eclipse.jdt.core.prefs
trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeEmbeddedRuntime.java
trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java
Log:
JBIDE-11685: Forge doesn't start on windows
Modified: trunk/forge/plugins/org.jboss.tools.forge.core/.classpath
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/.classpath 2012-04-27 00:29:16 UTC (rev 40536)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/.classpath 2012-04-27 07:24:22 UTC (rev 40537)
@@ -2,6 +2,6 @@
<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"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: trunk/forge/plugins/org.jboss.tools.forge.core/.project
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/.project 2012-04-27 00:29:16 UTC (rev 40536)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/.project 2012-04-27 07:24:22 UTC (rev 40537)
@@ -20,8 +20,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Modified: trunk/forge/plugins/org.jboss.tools.forge.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/.settings/org.eclipse.jdt.core.prefs 2012-04-27 00:29:16 UTC (rev 40536)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/.settings/org.eclipse.jdt.core.prefs 2012-04-27 07:24:22 UTC (rev 40537)
@@ -1,4 +1,3 @@
-#Tue May 31 15:58:07 CEST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
Added: trunk/forge/plugins/org.jboss.tools.forge.core/.settings/org.eclipse.m2e.core.prefs
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/.settings/org.eclipse.m2e.core.prefs (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/.settings/org.eclipse.m2e.core.prefs 2012-04-27 07:24:22 UTC (rev 40537)
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Property changes on: trunk/forge/plugins/org.jboss.tools.forge.core/.settings/org.eclipse.m2e.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeEmbeddedRuntime.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeEmbeddedRuntime.java 2012-04-27 00:29:16 UTC (rev 40536)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeEmbeddedRuntime.java 2012-04-27 07:24:22 UTC (rev 40537)
@@ -1,5 +1,6 @@
package org.jboss.tools.forge.core.process;
+import java.io.File;
import java.io.IOException;
import org.eclipse.core.runtime.FileLocator;
@@ -11,21 +12,33 @@
public static final ForgeRuntime INSTANCE = new ForgeEmbeddedRuntime();
private ForgeEmbeddedRuntime() {}
+
+ private String location = null;
@Override
public final String getName() {
return "embedded";
}
-
+
@Override
public String getLocation() {
- String result = null;
+ if (location == null) {
+ initLocation();
+ }
+ return location;
+ }
+
+ private void initLocation() {
try {
- result = FileLocator.getBundleFile(Platform.getBundle("org.jboss.tools.forge.runtime")).getAbsolutePath();
+ File file = FileLocator.getBundleFile(Platform.getBundle("org.jboss.tools.forge.runtime"));
+ for (String str : file.list()) {
+ if (str.startsWith("forge-distribution-")) {
+ location = file.getAbsolutePath() + File.separator + str;
+ }
+ }
} catch (IOException e) {
ForgeCorePlugin.log(e);
}
- return result;
}
@Override
Modified: trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java 2012-04-27 00:29:16 UTC (rev 40536)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java 2012-04-27 07:24:22 UTC (rev 40537)
@@ -144,7 +144,7 @@
}
private static String getClassPathArgument(String location) {
- return "-cp " + encloseWithDoubleQuotesIfNeeded(location + "/jboss-modules.jar");
+ return "-cp " + encloseWithDoubleQuotesIfNeeded(location + File.separator + "jboss-modules.jar");
}
}
12 years, 8 months
JBoss Tools SVN: r40536 - trunk/build/aggregate/site.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-26 20:29:16 -0400 (Thu, 26 Apr 2012)
New Revision: 40536
Modified:
trunk/build/aggregate/site/site.xml
Log:
JBIDE-9309 - Easily adding full JBoss AS source
Modified: trunk/build/aggregate/site/site.xml
===================================================================
--- trunk/build/aggregate/site/site.xml 2012-04-27 00:23:31 UTC (rev 40535)
+++ trunk/build/aggregate/site/site.xml 2012-04-27 00:29:16 UTC (rev 40536)
@@ -186,7 +186,11 @@
<feature url="features/org.jboss.tools.maven.profiles.feature_0.0.0.jar" id="org.jboss.tools.maven.profiles.feature" version="0.0.0">
<category name="AbridgedTools" />
<category name="MavenTools" />
- </feature>
+ </feature>
+ <feature url="features/org.jboss.tools.maven.sourcelookup.feature_0.0.0.jar" id="org.jboss.tools.maven.sourcelokup.feature" version="0.0.0">
+ <category name="AbridgedTools" />
+ <category name="MavenTools" />
+ </feature>
<!-- only in JBT and JBDS Extras -->
<feature url="features/org.jboss.tools.maven.jbosspackaging.feature_0.0.0.jar" id="org.jboss.tools.maven.jbosspackaging.feature" version="0.0.0">
<category name="MavenTools" />
@@ -345,6 +349,9 @@
<feature url="features/org.jboss.tools.maven.profiles.feature.source_0.0.0.jar" id="org.jboss.tools.maven.profiles.feature.source" version="0.0.0">
<category name="AllSources" />
</feature>
+ <feature url="features/org.jboss.tools.maven.sourcelookup.feature.source_0.0.0.jar" id="org.jboss.tools.maven.sourcelookup.feature.source" version="0.0.0">
+ <category name="AllSources" />
+ </feature>
<feature url="features/org.jboss.tools.runtime.core.featur.source_0.0.0.jar" id="org.jboss.tools.runtime.core.feature.source" version="0.0.0">
<category name="AllSources" />
</feature>
12 years, 8 months
JBoss Tools SVN: r40535 - in trunk/maven: plugins and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-26 20:23:31 -0400 (Thu, 26 Apr 2012)
New Revision: 40535
Modified:
trunk/maven/features/pom.xml
trunk/maven/plugins/pom.xml
trunk/maven/site/category.xml
Log:
JBIDE-9309 - Easily adding full JBoss AS source
Modified: trunk/maven/features/pom.xml
===================================================================
--- trunk/maven/features/pom.xml 2012-04-27 00:22:17 UTC (rev 40534)
+++ trunk/maven/features/pom.xml 2012-04-27 00:23:31 UTC (rev 40535)
@@ -26,6 +26,7 @@
<module>org.jboss.tools.maven.jpa.feature</module>
<module>org.jboss.tools.maven.profiles.feature</module>
<module>org.jboss.tools.maven.gwt.feature</module>
+ <module>org.jboss.tools.maven.sourcelookup.feature</module>
</modules>
<repositories>
Modified: trunk/maven/plugins/pom.xml
===================================================================
--- trunk/maven/plugins/pom.xml 2012-04-27 00:22:17 UTC (rev 40534)
+++ trunk/maven/plugins/pom.xml 2012-04-27 00:23:31 UTC (rev 40535)
@@ -27,6 +27,8 @@
<module>org.jboss.tools.maven.profiles.core</module>
<module>org.jboss.tools.maven.profiles.ui</module>
<module>org.jboss.tools.maven.gwt</module>
+ <module>org.jboss.tools.maven.sourcelookup.core</module>
+ <module>org.jboss.tools.maven.sourcelookup.ui</module>
</modules>
</project>
Modified: trunk/maven/site/category.xml
===================================================================
--- trunk/maven/site/category.xml 2012-04-27 00:22:17 UTC (rev 40534)
+++ trunk/maven/site/category.xml 2012-04-27 00:23:31 UTC (rev 40535)
@@ -44,6 +44,9 @@
<feature url="features/org.jboss.tools.maven.gwt.feature_0.0.0.jar" id="org.jboss.tools.maven.gwt.feature" version="0.0.0">
<category name="JBoss Tools maven Nightly Build Update Site"/>
</feature>
+ <feature url="features/org.jboss.tools.maven.sourcelookup.feature_0.0.0.jar" id="org.jboss.tools.maven.sourcelookup.feature" version="0.0.0">
+ <category name="JBoss Tools maven Nightly Build Update Site"/>
+ </feature>
<!-- Sources -->
<feature url="features/org.jboss.tools.maven.feature.source_0.0.0.jar" id="org.jboss.tools.maven.feature.source" version="0.0.0">
<category name="JBoss Tools maven Nightly Build Update Site"/>
@@ -84,4 +87,7 @@
<feature url="features/org.jboss.tools.maven.gwt.feature.source_0.0.0.jar" id="org.jboss.tools.maven.gwt.feature.source" version="0.0.0">
<category name="JBoss Tools maven Nightly Build Update Site"/>
</feature>
+ <feature url="features/org.jboss.tools.maven.sourcelookup.feature.source_0.0.0.jar" id="org.jboss.tools.maven.sourcelookup.feature.source" version="0.0.0">
+ <category name="JBoss Tools maven Nightly Build Update Site"/>
+ </feature>
</site>
12 years, 8 months
JBoss Tools SVN: r40534 - in trunk/maven: features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature and 26 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-26 20:22:17 -0400 (Thu, 26 Apr 2012)
New Revision: 40534
Added:
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/.project
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/build.properties
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/feature.properties
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/feature.xml
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/license.html
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/pom.xml
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/.gitkeep
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/build.properties
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/feature.properties
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/license.html
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.ini
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.mappings
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.properties
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/build.properties
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/jboss_about.png
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.classpath
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.gitignore
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.project
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.settings/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.settings/org.jboss.ide.eclipse.as.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/META-INF/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.html
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.ini
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.mappings
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.properties
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/bin/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/build.properties
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/jboss_about.png
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/lib/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/lib/nexus-indexer-lucene-rest-api-client.jar
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/pom.xml
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/NexusRepository.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourceLookupActivator.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourcelookupLaunchConfigurationListener.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossASSourcePathComputer.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainer.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainerType.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.classpath
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.gitignore
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.project
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.settings/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.settings/org.jboss.ide.eclipse.as.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/META-INF/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/bin/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/build.properties
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/icons/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/icons/jboss.gif
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/pom.xml
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/SourceLookupUIActivator.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/Startup.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/actions/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/actions/AttachSourcesActionDelegate.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/EditNexusRepositoryDialog.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/JBossSourceContainerBrowser.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/JBossSourceContainerDialog.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/AutoResizeTableLayout.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/SourceLookupPreferencePage.java
Log:
JBIDE-9309 - Easily adding full JBoss AS source
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/.project
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/.project (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/.project 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.sourcelookup.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/maven/features/org.jboss.tools.maven.sourcelookup.feature/build.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/build.properties (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/build.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ license.html,\
+ feature.properties
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/feature.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/feature.properties (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/feature.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,54 @@
+###############################################################################
+# Copyright (c) 2008-2011 Red Hat, Inc. 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 Tools Source Lookup
+
+# "providerName" property - name of the company that provides the feature
+providerName=JBoss by Red Hat
+
+# "updateSiteName" property - label for the update site
+updateSiteName=JBossTools Update Site
+
+# "description" property - description of the feature
+description=JBoss Tools Source Lookup
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=Copyright (c) 2008-2012 Red Hat, Inc. 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/maven/features/org.jboss.tools.maven.sourcelookup.feature/feature.xml
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/feature.xml (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/feature.xml 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.jboss.tools.maven.sourcelookup.feature"
+ label="%featureName"
+ version="1.3.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.jboss.tools.maven.sourcelookup.core">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.jboss.tools.maven.sourcelookup.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.maven.sourcelookup.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/license.html
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/license.html (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/license.html 2012-04-27 00:22:17 UTC (rev 40534)
@@ -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/maven/features/org.jboss.tools.maven.sourcelookup.feature/pom.xml
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/pom.xml (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/pom.xml 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.maven</groupId>
+ <artifactId>features</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.features</groupId>
+ <artifactId>org.jboss.tools.maven.sourcelookup.feature</artifactId>
+
+ <packaging>eclipse-feature</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <version>${tychoExtrasVersion}</version>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tychoVersion}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/.gitkeep
===================================================================
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/build.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/build.properties (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/build.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2010 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:
+# Red Hat - initial API and implementation
+###############################################################################
+
+bin.includes = feature.*,\
+ license.html
+
+
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/feature.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/feature.properties (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/feature.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,36 @@
+featureName=JBoss Maven Integration Source
+featureProvider=JBoss by Red Hat
+
+# "updateSiteName" property - label for the update site
+updateSiteName=JBossTools Update Site
+
+# "description" property - description of the feature
+description=JBoss Maven Integration Source
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "copyright" property - text of the "Feature Update Copyright"
+
+copyright=Copyright (c) 2010-2011 Red Hat, Inc. and others.\n\
+All 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\nContributors\:\n\
+JBoss by Red Hat - Initial implementation.\n
+ ############### end of copyright property ####################################
+
+# 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 ##########################################
+
\ No newline at end of file
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/license.html
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/license.html (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplateFeature/license.html 2012-04-27 00:22:17 UTC (rev 40534)
@@ -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/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.ini
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.ini (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.ini 2012-04-27 00:22:17 UTC (rev 40534)
@@ -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/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.mappings
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.mappings (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.mappings 2012-04-27 00:22:17 UTC (rev 40534)
@@ -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/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.properties (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/about.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,2 @@
+blurb=JBoss Tools Source lookup SDK\n\nVersion\: {featureVersion}\n\n(c) Copyright JBoss by Red Hat, contributors and others 2004 - 2012. All rights reserved.\nVisit http\://jboss.org/tools
+
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/build.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/build.properties (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/build.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,6 @@
+bin.includes = plugin.*,\
+ about.*,\
+ src/,\
+ META-INF/,\
+ jboss_about.png
+sourcePlugin = true
\ No newline at end of file
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/jboss_about.png
===================================================================
(Binary files differ)
Property changes on: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/jboss_about.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/plugin.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/plugin.properties (rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/sourceTemplatePlugin/plugin.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,3 @@
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Maven Source Lookup SDK
+
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.classpath (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.classpath 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="lib/nexus-indexer-lucene-rest-api-client.jar"/>
+ <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/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.gitignore
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.gitignore (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.gitignore 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,2 @@
+/target
+/bin
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.project (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.project 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.sourcelookup.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/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.settings/org.eclipse.jdt.core.prefs 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,8 @@
+#Tue Jul 26 22:41:00 CEST 2011
+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/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.settings/org.jboss.ide.eclipse.as.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.settings/org.jboss.ide.eclipse.as.core.prefs (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.settings/org.jboss.ide.eclipse.as.core.prefs 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.jboss.ide.eclipse.as.core.singledeployable.deployableList=
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/META-INF/MANIFEST.MF 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.maven.sourcelookup.core;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Activator: org.jboss.tools.maven.sourcelookup.SourceLookupActivator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.debug.core;bundle-version="3.7.0";visibility:=reexport,
+ org.eclipse.jdt.core;bundle-version="3.7.0";visibility:=reexport,
+ org.jboss.ide.eclipse.as.core;visibility:=reexport,
+ org.eclipse.wst.server.core;bundle-version="1.1.302";visibility:=reexport,
+ org.eclipse.jdt.launching;bundle-version="3.6.0",
+ org.eclipse.m2e.jdt;bundle-version="[1.0.0,1.1.0)";visibility:=reexport,
+ org.eclipse.m2e.core;bundle-version="[1.0.0,1.1.0)";visibility:=reexport,
+ org.eclipse.m2e.maven.runtime;bundle-version="[1.0.0,1.1.0)";visibility:=reexport,
+ org.apache.commons.codec;bundle-version="1.3.0",
+ org.eclipse.ui;bundle-version="3.7.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %BundleVendor
+Bundle-Localization: plugin
+Export-Package: org.jboss.tools.maven.sourcelookup,
+ org.jboss.tools.maven.sourcelookup.containers
+Bundle-ClassPath: .,
+ lib/nexus-indexer-lucene-rest-api-client.jar
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.html
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.html (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.html 2012-04-27 00:22:17 UTC (rev 40534)
@@ -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 Tools Source Lookup</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>JBoss Tools Source Lookup</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/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.ini
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.ini (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.ini 2012-04-27 00:22:17 UTC (rev 40534)
@@ -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/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.mappings
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.mappings (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.mappings 2012-04-27 00:22:17 UTC (rev 40534)
@@ -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/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.properties (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/about.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,2 @@
+blurb=JBoss Tools Source lookup\n\nVersion\: {featureVersion}\n\n(c) Copyright JBoss by Red Hat, contributors and others 2004 - 2012. All rights reserved.\nVisit http\://jboss.org/tools
+
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/build.properties (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/build.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,12 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.properties,\
+ about.mappings,\
+ about.ini,\
+ about.html,\
+ jboss_about.png,\
+ lib/
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/jboss_about.png
===================================================================
(Binary files differ)
Property changes on: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/jboss_about.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/lib/nexus-indexer-lucene-rest-api-client.jar
===================================================================
(Binary files differ)
Property changes on: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/lib/nexus-indexer-lucene-rest-api-client.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/plugin.properties (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/plugin.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,4 @@
+#Properties file for org.jboss.tools.remote.debug
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Maven Source Lookup
+
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/plugin.xml (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/plugin.xml 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension point="org.eclipse.debug.core.sourcePathComputers">
+ <sourcePathComputer
+ id="org.jboss.tools.maven.sourcelookup.SourcePathComputer"
+ class="org.jboss.tools.maven.sourcelookup.containers.JBossASSourcePathComputer">
+ </sourcePathComputer>
+ </extension>
+
+ <extension
+ point="org.eclipse.debug.core.sourceContainerTypes">
+ <sourceContainerType
+ name="JBoss Maven Source Container"
+ class="org.jboss.tools.maven.sourcelookup.containers.JBossSourceContainerType"
+ id="org.jboss.tools.maven.sourcelookup.containerType"
+ description="JBoss Maven Source Container">
+ </sourceContainerType>
+ </extension>
+
+</plugin>
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/pom.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/pom.xml (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/pom.xml 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.maven</groupId>
+ <artifactId>plugins</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.plugins</groupId>
+ <artifactId>org.jboss.tools.maven.sourcelookup.core</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/NexusRepository.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/NexusRepository.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/NexusRepository.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,64 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class NexusRepository {
+ private String name;
+ private String url;
+ private boolean enabled;
+
+
+ public NexusRepository() {
+ super();
+ }
+
+ public NexusRepository(String name, String url, boolean enabled) {
+ super();
+ this.name = name;
+ this.url = url;
+ this.enabled = enabled;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean checked) {
+ this.enabled = checked;
+ }
+
+ @Override
+ public String toString() {
+ return "NexusRepository [name=" + name + ", url=" + url + ", enabled="
+ + enabled + "]";
+ }
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourceLookupActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourceLookupActivator.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourceLookupActivator.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,237 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.eclipse.core.internal.runtime.InternalPlatform;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.XMLMemento;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SourceLookupActivator implements BundleActivator {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.maven.sourcelookup.core"; //$NON-NLS-1$
+ public static final String AS7_LAUNCH_CONFIGURATION_ID = "org.jboss.ide.eclipse.as.core.server.JBoss7StartupConfiguration"; //$NON-NLS-1$
+ public static final String AS_LAUNCH_CONFIGURATION_ID = "org.jboss.ide.eclipse.as.core.server.startupConfiguration"; //$NON-NLS-1$
+
+ private static final String MAVEN_PLUGIN_ID = "org.eclipse.m2e.core"; //$NON-NLS-1$
+ public static final String JBOSS_LAUNCH_SOURCE_PATH_COMPUTER_ID = "org.jboss.tools.maven.sourcelookup.SourcePathComputer"; //$NON-NLS-1$
+ public static final String AUTO_ADD_JBOSS_SOURCE_CONTAINER = "autoAddJBossSourceContainer";
+ public static final boolean AUTO_ADD_JBOSS_SOURCE_CONTAINER_DEFAULT = false;
+ private static final String NEXUS_REPOSITORIES = "nexusRepositories";
+ private static final String NEXUS_REPOSITORY = "nexusRepository";
+ private static final String NAME = "name";
+ private static final String URL = "url";
+ private static final String ENABLED = "enabled";
+
+ private static Set<NexusRepository> nexusRepositories;
+
+ // The shared instance
+ private static SourceLookupActivator plugin;
+
+ private SourcelookupLaunchConfigurationListener listener;
+ private BundleContext context;
+
+ /**
+ * The constructor
+ */
+ public SourceLookupActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ this.context = context;
+ plugin = this;
+ listener = new SourcelookupLaunchConfigurationListener();
+ DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ this.context = null;
+ if (listener != null) {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(listener);
+ }
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static SourceLookupActivator getDefault() {
+ return plugin;
+ }
+
+ public static void log(Exception e, String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ plugin.getLog().log(status);
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e
+ .getLocalizedMessage(), e);
+ plugin.getLog().log(status);
+ }
+
+ public ILog getLog() {
+ Bundle bundle = context.getBundle();
+ return InternalPlatform.getDefault().getLog(bundle);
+ }
+
+ public static boolean m2eExists() {
+ Bundle bundle = Platform.getBundle(MAVEN_PLUGIN_ID);
+ return bundle != null;
+ }
+
+ public static IEclipsePreferences getPreferences() {
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(PLUGIN_ID);
+ return prefs;
+ }
+
+ public void savePreferences() {
+ IEclipsePreferences prefs = getPreferences();
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ log(e);
+ }
+ }
+
+ public boolean isAutoAddSourceContainer() {
+ return getPreferences().getBoolean(AUTO_ADD_JBOSS_SOURCE_CONTAINER, AUTO_ADD_JBOSS_SOURCE_CONTAINER_DEFAULT);
+ }
+
+ public static boolean isJBossAsLaunchConfiguration(ILaunchConfiguration configuration) throws CoreException {
+ return AS7_LAUNCH_CONFIGURATION_ID
+ .equals(configuration.getType().getIdentifier()) ||
+ AS_LAUNCH_CONFIGURATION_ID
+ .equals(configuration.getType().getIdentifier());
+ }
+
+ public static Set<NexusRepository> getNexusRepositories() {
+ if (nexusRepositories == null) {
+ try {
+ nexusRepositories = loadNexusRepositoriesFromPreferences();
+ } catch (WorkbenchException e) {
+ log(e);
+ }
+ if (nexusRepositories == null) {
+ getDefaultRepositories();
+ }
+ }
+ return nexusRepositories;
+ }
+
+ public static Set<NexusRepository> loadNexusRepositoriesFromPreferences() throws WorkbenchException {
+ String repositories = getPreferences().get(NEXUS_REPOSITORIES, null);
+ if (repositories == null || repositories.isEmpty()) {
+ return null;
+ }
+ Reader reader = new StringReader(repositories);
+ XMLMemento memento = XMLMemento.createReadRoot(reader);
+ IMemento[] nodes = memento.getChildren(NEXUS_REPOSITORY);
+ for (IMemento node:nodes) {
+ if (nexusRepositories == null) {
+ nexusRepositories = new LinkedHashSet<NexusRepository>();
+ }
+ String name = node.getString(NAME);
+ String url = node.getString(URL);
+ boolean enabled = node.getBoolean(ENABLED);
+ NexusRepository repository = new NexusRepository(name, url, enabled);
+ nexusRepositories.add(repository);
+ }
+ return nexusRepositories;
+ }
+
+ public static Set<NexusRepository> getDefaultRepositories() {
+ nexusRepositories = new LinkedHashSet<NexusRepository>();
+ addRepository("JBoss Nexus Repository", "https://repository.jboss.org/nexus", true);
+ addRepository("Sonatype Nexus Repository", "http://repository.sonatype.org", false);
+ addRepository("Apache Nexus Repository", "https://repository.apache.org", false);
+ addRepository("Sonatype OSS Repository", "http://oss.sonatype.org", false);
+ addRepository("Codehaus Repository", "https://nexus.codehaus.org", false);
+ addRepository("Java.net Repository", "https://maven.java.net", false);
+ return nexusRepositories;
+ }
+
+ private static void addRepository(String name, String url, boolean enabled) {
+ NexusRepository repository = new NexusRepository(name, url, enabled);
+ nexusRepositories.add(repository);
+ }
+
+ public static void setNexusRepositories(Set<NexusRepository> nexusRepositories) {
+ SourceLookupActivator.nexusRepositories = nexusRepositories;
+ }
+
+ public static void saveNexusRepositories() {
+ if (nexusRepositories == null || nexusRepositories.size() == 0) {
+ return;
+ }
+ XMLMemento memento = XMLMemento.createWriteRoot(NEXUS_REPOSITORIES);
+ Writer writer = null;
+ try {
+ for (NexusRepository repository:nexusRepositories) {
+ IMemento repositoryNode = memento.createChild(NEXUS_REPOSITORY);
+ repositoryNode.putString(NAME, repository.getName());
+ repositoryNode.putString(URL, repository.getUrl());
+ repositoryNode.putBoolean(ENABLED, repository.isEnabled());
+ }
+ writer = new StringWriter();
+ memento.save(writer);
+ writer.flush();
+ String repositories = writer.toString();
+ getPreferences().put(NEXUS_REPOSITORIES, repositories);
+ getPreferences().flush();
+ } catch (Exception e) {
+ log(e);
+ } finally {
+ if (writer != null) {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourcelookupLaunchConfigurationListener.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourcelookupLaunchConfigurationListener.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourcelookupLaunchConfigurationListener.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,62 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class SourcelookupLaunchConfigurationListener implements
+ ILaunchConfigurationListener {
+
+ public void launchConfigurationAdded(ILaunchConfiguration configuration) {
+ updateLaunchConfiguration(configuration);
+ }
+
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+ updateLaunchConfiguration(configuration);
+ }
+
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
+ // do nothing
+ }
+
+ private void updateLaunchConfiguration(ILaunchConfiguration configuration) {
+ try {
+ if (!SourceLookupActivator.getDefault().isAutoAddSourceContainer()) {
+ return;
+ }
+ if (!SourceLookupActivator.isJBossAsLaunchConfiguration(configuration)) {
+ return;
+ }
+ if (!SourceLookupActivator.m2eExists()) {
+ return;
+ }
+
+ String sourcePathComputer = configuration.getAttribute(ISourcePathComputer.ATTR_SOURCE_PATH_COMPUTER_ID, (String) null);
+ ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
+ if (sourcePathComputer == null) {
+ wc.setAttribute(ISourcePathComputer.ATTR_SOURCE_PATH_COMPUTER_ID, SourceLookupActivator.JBOSS_LAUNCH_SOURCE_PATH_COMPUTER_ID);
+ wc.doSave();
+ }
+ } catch (CoreException e) {
+ SourceLookupActivator.log(e);
+ }
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossASSourcePathComputer.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossASSourcePathComputer.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossASSourcePathComputer.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,132 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup.containers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
+import org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class JBossASSourcePathComputer implements ISourcePathComputer {
+
+ @Override
+ public ISourceContainer[] computeSourceContainers(
+ ILaunchConfiguration configuration, IProgressMonitor monitor)
+ throws CoreException {
+ IRuntimeClasspathEntry[] unresolvedEntries = JavaRuntime
+ .computeUnresolvedSourceLookupPath(configuration);
+ List<ISourceContainer> sourcefolderList = new ArrayList<ISourceContainer>();
+
+ IServer server = ServerUtil.getServer(configuration);
+ IModule[] modules = server.getModules();
+
+ List<IJavaProject> javaProjectList = new ArrayList<IJavaProject>();
+
+ processModules(sourcefolderList, modules, javaProjectList, server,
+ monitor);
+
+ IRuntimeClasspathEntry[] projectEntries = new IRuntimeClasspathEntry[javaProjectList
+ .size()];
+ for (int i = 0; i < javaProjectList.size(); i++) {
+ projectEntries[i] = JavaRuntime
+ .newDefaultProjectClasspathEntry(javaProjectList.get(i));
+ }
+ IRuntimeClasspathEntry[] entries = new IRuntimeClasspathEntry[projectEntries.length
+ + unresolvedEntries.length];
+ System.arraycopy(unresolvedEntries, 0, entries, 0,
+ unresolvedEntries.length);
+ System.arraycopy(projectEntries, 0, entries, unresolvedEntries.length,
+ projectEntries.length);
+
+ IRuntimeClasspathEntry[] resolved = JavaRuntime
+ .resolveSourceLookupPath(entries, configuration);
+ ISourceContainer[] javaSourceContainers = JavaRuntime
+ .getSourceContainers(resolved);
+
+ if (!sourcefolderList.isEmpty()) {
+ ISourceContainer[] combinedSourceContainers = new ISourceContainer[javaSourceContainers.length
+ + sourcefolderList.size()];
+ sourcefolderList.toArray(combinedSourceContainers);
+ System.arraycopy(javaSourceContainers, 0, combinedSourceContainers,
+ sourcefolderList.size(), javaSourceContainers.length);
+ javaSourceContainers = combinedSourceContainers;
+ }
+
+ ISourceContainer jbossContainer = new JBossSourceContainer(
+ configuration);
+ ISourceContainer[] sourceContainers = new ISourceContainer[javaSourceContainers.length + 1];
+ System.arraycopy(javaSourceContainers, 0, sourceContainers, 0,
+ javaSourceContainers.length);
+ sourceContainers[javaSourceContainers.length] = jbossContainer;
+ return sourceContainers;
+
+ }
+
+ private void processModules(List<ISourceContainer> sourcefolderList,
+ IModule[] modules, List<IJavaProject> javaProjectList,
+ IServer server, IProgressMonitor monitor) {
+ for (int i = 0; i < modules.length; i++) {
+ IProject project = modules[i].getProject();
+ IModule[] pModule = new IModule[1];
+ pModule[0] = modules[i];
+ IModule[] cModule = server.getChildModules(pModule, monitor);
+ if (cModule != null && cModule.length > 0) {
+ processModules(sourcefolderList, cModule, javaProjectList,
+ server, monitor);
+ }
+ if (project != null) {
+ IFolder moduleFolder = project.getFolder(modules[i].getName());
+ if (moduleFolder.exists()) {
+ sourcefolderList.add(new FolderSourceContainer(
+ moduleFolder, true));
+ } else {
+ try {
+ if (project.hasNature(JavaCore.NATURE_ID)) {
+ IJavaProject javaProject = (IJavaProject) project
+ .getNature(JavaCore.NATURE_ID);
+ if (!javaProjectList.contains(javaProject)) {
+ javaProjectList.add(javaProject);
+ }
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public String getId() {
+ return SourceLookupActivator.JBOSS_LAUNCH_SOURCE_PATH_COMPUTER_ID;
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainer.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainer.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainer.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,639 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup.containers;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
+import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer;
+import org.eclipse.debug.core.sourcelookup.containers.ExternalArchiveSourceContainer;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.eclipse.m2e.core.embedder.IMaven;
+import org.eclipse.m2e.core.internal.index.IIndex;
+import org.eclipse.m2e.core.internal.index.IndexManager;
+import org.eclipse.m2e.core.internal.index.IndexedArtifactFile;
+import org.eclipse.m2e.core.internal.index.nexus.NexusIndex;
+import org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager;
+import org.eclipse.m2e.core.repository.IRepository;
+import org.eclipse.m2e.core.repository.IRepositoryRegistry;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+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.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.tools.maven.sourcelookup.NexusRepository;
+import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
+import org.sonatype.nexus.rest.model.NexusArtifact;
+import org.sonatype.nexus.rest.model.SearchResponse;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class JBossSourceContainer extends AbstractSourceContainer {
+
+ private static final String PATH_SEPARATOR = "/";
+ private static final String CLASSIFIER_SOURCES = "sources"; //$NON-NLS-1$
+ private static final String CLASSIFIER_TESTS = "tests"; //$NON-NLS-1$
+ private static final String CLASSIFIER_TESTSOURCES = "test-sources"; //$NON-NLS-1$
+ public static final String TYPE_ID = "org.jboss.tools.maven.sourcelookup.containerType"; //$NON-NLS-1$
+
+ public static final String EAP = "EAP"; //$NON-NLS-1$
+ public static final String EAP_STD = "EAP_STD"; //$NON-NLS-1$
+ public static final String SOA_P = "SOA-P"; //$NON-NLS-1$
+ public static final String SOA_P_STD = "SOA-P-STD"; //$NON-NLS-1$
+ public static final String EPP = "EPP"; //$NON-NLS-1$
+ public static final String EWP = "EWP"; //$NON-NLS-1$
+
+ private List<File> jars;
+ private List<ISourceContainer> sourceContainers = new ArrayList<ISourceContainer>();
+ protected static File resolvedFile;
+ private String homePath;
+ private static List<IRepository> globalRepositories;
+
+ public JBossSourceContainer(ILaunchConfiguration configuration)
+ throws CoreException {
+ IServer server = ServerUtil.getServer(configuration);
+ if (server != null) {
+ JBossServer jbossServer = ServerConverter
+ .checkedGetJBossServer(server);
+ if (jbossServer != null) {
+ IJBossServerRuntime runtime = jbossServer.getRuntime();
+ if (runtime != null) {
+ IPath location = runtime.getRuntime().getLocation();
+ this.homePath = location.toOSString();
+ }
+ }
+ }
+ if (this.homePath == null) {
+ IStatus status = new Status(IStatus.ERROR,
+ SourceLookupActivator.PLUGIN_ID, "Invalid configuration");
+ throw new CoreException(status);
+ }
+ initialize();
+ }
+
+ private static void initialize() throws CoreException {
+ IRepositoryRegistry repositoryRegistry = MavenPlugin
+ .getRepositoryRegistry();
+ globalRepositories = repositoryRegistry
+ .getRepositories(IRepositoryRegistry.SCOPE_SETTINGS);
+ MavenPlugin.getMaven().reloadSettings();
+ }
+
+ public JBossSourceContainer(String homePath) {
+ this.homePath = homePath;
+ try {
+ initialize();
+ } catch (CoreException e) {
+ SourceLookupActivator.log(e);
+ }
+ }
+
+ private List<File> getJars() throws CoreException {
+ if (jars != null) {
+ return jars;
+ }
+ jars = new ArrayList<File>();
+ if (homePath == null) {
+ return jars;
+ }
+ File location = new File(homePath);
+ ServerBeanLoader loader = new ServerBeanLoader(location);
+ ServerBean serverBean = loader.getServerBean();
+ JBossServerType type = serverBean.getType();
+ String version = serverBean.getVersion();
+ if (JBossServerType.AS7.equals(type)) {
+ getAS7xJars();
+ }
+ if (JBossServerType.AS.equals(type)) {
+ if (IJBossToolingConstants.V6_0.equals(version)
+ || IJBossToolingConstants.V6_1.equals(version)) {
+ getAS6xJars();
+ }
+ if (IJBossToolingConstants.V5_0.equals(version)
+ || IJBossToolingConstants.V5_1.equals(version)) {
+ getAS5xJars();
+ }
+ }
+ if (JBossServerType.EAP6.equals(type)) {
+ getAS7xJars();
+ }
+ if (JBossServerType.SOAP.equals(type) || JBossServerType.EAP.equals(type) || EPP.equals(type)
+ || JBossServerType.SOAP_STD.equals(type) || JBossServerType.EWP.equals(type)
+ || JBossServerType.EAP_STD.equals(type)) {
+
+ getAS5xJars();
+ }
+ if (jars.size() == 0 && homePath != null) {
+ IPath jarPath = new Path(homePath);
+ addJars(jarPath, jars);
+ }
+ return jars;
+ }
+
+ private void getAS6xJars() {
+ getAS5xJars();
+ }
+
+ private void getAS5xJars() {
+ IPath common = new Path(homePath)
+ .append(IJBossRuntimeResourceConstants.COMMON);
+ addJars(common, jars);
+ IPath lib = new Path(homePath)
+ .append(IJBossRuntimeResourceConstants.LIB);
+ addJars(lib, jars);
+ IPath serverPath = new Path(homePath)
+ .append(IJBossRuntimeResourceConstants.SERVER);
+ IPath defaultConfiguration = serverPath
+ .append(IJBossRuntimeResourceConstants.DEFAULT_CONFIGURATION);
+ IPath configurationLib = defaultConfiguration
+ .append(IJBossRuntimeResourceConstants.LIB);
+ addJars(configurationLib, jars);
+ IPath deployPath = defaultConfiguration
+ .append(IJBossRuntimeResourceConstants.DEPLOY);
+ IPath deployLib = deployPath.append(IJBossRuntimeResourceConstants.LIB);
+ addJars(deployLib, jars);
+ IPath jbossweb = deployPath
+ .append(IJBossRuntimeResourceConstants.JBOSSWEB_SAR);
+ addJars(jbossweb, jars);
+ IPath deployers = defaultConfiguration
+ .append(IJBossRuntimeResourceConstants.DEPLOYERS);
+ addJars(deployers, jars);
+ }
+
+ private void getAS7xJars() {
+ IPath modules = new Path(homePath)
+ .append(IJBossRuntimeResourceConstants.AS7_MODULES);
+ addJars(modules, jars);
+ IPath bundles = new Path(homePath).append("bundles");
+ addJars(bundles, jars);
+ File modulesFile = new File(homePath,
+ IJBossRuntimeResourceConstants.JBOSS7_MODULES_JAR);
+ if (modulesFile.exists()) {
+ jars.add(modulesFile);
+ }
+ }
+
+ private void addJars(IPath path, List<File> jars) {
+ File folder = path.toFile();
+ if (folder == null || !folder.isDirectory()) {
+ return;
+ }
+ File[] files = folder.listFiles();
+ for (File file : files) {
+ if (file.isDirectory()) {
+ addJars(path.append(file.getName()), jars);
+ }
+ if (file.isFile()
+ && file.getName().endsWith(".jar") && !jars.contains(file)) { //$NON-NLS-1$
+ jars.add(file);
+ }
+ }
+ }
+
+ public String getName() {
+ String name;
+ if (homePath != null) {
+ name = "JBoss Source Container (" + homePath + ")";
+ } else {
+ name = "JBoss Source Container";
+ }
+ return name; //$NON-NLS-1$
+ }
+
+ @Override
+ public Object[] findSourceElements(String name) throws CoreException {
+ for (ISourceContainer container : sourceContainers) {
+ Object[] objects = container.findSourceElements(name);
+ if (objects != null && objects.length > 0) {
+ return objects;
+ }
+ }
+ Object[] objects = new Object[0];
+ List<File> removeJars = new ArrayList<File>();
+ List<File> list = getJars();
+ Iterator<File> iterator = list.iterator();
+ ZipFile jar = null;
+ try {
+ while (iterator.hasNext()) {
+ File file = iterator.next();
+ if (file == null || !file.exists()) {
+ continue;
+ }
+ jar = new ZipFile(file);
+ String className = name.replace(".java", ".class");
+ className = className.replace("\\", PATH_SEPARATOR);
+ ZipEntry entry = jar.getEntry(className);//$NON-NLS-1$
+ if (entry != null) {
+ ArtifactKey artifact = getArtifact(file, jar);
+ if (artifact != null) {
+ IPath sourcePath = getSourcePath(artifact);
+ if (sourcePath == null) {
+ Job job = downloadArtifact(file, artifact);
+ try {
+ job.join();
+ } catch (InterruptedException e) {
+ continue;
+ }
+ if (resolvedFile != null) {
+ ISourceContainer container = new ExternalArchiveSourceContainer(
+ resolvedFile.getAbsolutePath(), true);
+ objects = container.findSourceElements(name);
+ if (objects != null && objects.length > 0) {
+ sourceContainers.add(container);
+ removeJars.add(file);
+ }
+ }
+ } else {
+ ISourceContainer container = new ExternalArchiveSourceContainer(
+ sourcePath.toOSString(), true);
+ objects = container.findSourceElements(name);
+ if (objects != null && objects.length > 0) {
+ sourceContainers.add(container);
+ removeJars.add(file);
+ }
+ }
+ break;
+ } else {
+ // TODO
+ }
+ }
+ }
+ } catch (ZipException e) {
+ SourceLookupActivator.log(e);
+ } catch (IOException e) {
+ SourceLookupActivator.log(e);
+ } finally {
+ if (jar != null) {
+ try {
+ jar.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ jar = null;
+ }
+ for (File remove : removeJars) {
+ jars.remove(remove);
+ }
+ }
+ return objects;
+ }
+
+ public static ArtifactKey getArtifact(File file, ZipFile jar)
+ throws CoreException, IOException {
+ ArtifactKey artifact = getArtifactFromM2eIndex(file);
+ if (artifact == null) {
+ artifact = getArtifactFromMetaInf(jar);
+ }
+ if (artifact == null) {
+ artifact = getArtifactFromJBossNexusRepository(file);
+ }
+ return artifact;
+ }
+
+ private static ArtifactKey getArtifactFromJBossNexusRepository(String sha1,
+ NexusRepository nexusRepository) {
+ if (sha1 == null || nexusRepository == null
+ || nexusRepository.getUrl() == null) {
+ return null;
+ }
+ HttpURLConnection connection = null;
+ try {
+ String base = nexusRepository.getUrl();
+ if (!base.endsWith(PATH_SEPARATOR)) {
+ base = base + PATH_SEPARATOR;
+ }
+ // String url =
+ // "https://repository.jboss.org/nexus/service/local/data_index?sha1=";
+ String url = base + "service/local/data_index?sha1=";
+ url = url + URLEncoder.encode(sha1, "UTF-8");
+ JAXBContext context = JAXBContext.newInstance(SearchResponse.class);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ connection = (HttpURLConnection) new URL(url).openConnection();
+ connection.connect();
+ Object object = unmarshaller.unmarshal(connection.getInputStream());
+ if (object instanceof SearchResponse) {
+ SearchResponse searchResponse = (SearchResponse) object;
+ for (NexusArtifact nexusArtifact : searchResponse.getData()) {
+ String groupId = nexusArtifact.getGroupId();
+ String artifactId = nexusArtifact.getArtifactId();
+ String version = nexusArtifact.getVersion();
+ String classifier = nexusArtifact.getClassifier();
+ ArtifactKey artifact = new ArtifactKey(groupId, artifactId,
+ version, classifier);
+ return artifact;
+ }
+ }
+ } catch (Exception e) {
+ return null;
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ return null;
+ }
+
+ private static ArtifactKey getArtifactFromJBossNexusRepository(File file) {
+ String sha1;
+ try {
+ sha1 = getSHA1(file);
+ } catch (Exception e) {
+ return null;
+ }
+ Set<NexusRepository> nexusRepositories = SourceLookupActivator
+ .getNexusRepositories();
+ for (NexusRepository repository : nexusRepositories) {
+ if (!repository.isEnabled()) {
+ continue;
+ }
+ ArtifactKey key = getArtifactFromJBossNexusRepository(sha1,
+ repository);
+ if (key != null) {
+ ArtifactKey sourcesArtifact = new ArtifactKey(
+ key.getGroupId(), key.getArtifactId(),
+ key.getVersion(),
+ getSourcesClassifier(key.getClassifier()));
+ ArtifactKey resolvedKey = getSourcesArtifactFromJBossNexusRepository(sourcesArtifact, repository);
+ if (resolvedKey != null) {
+ return key;
+ }
+ }
+ }
+ return null;
+ }
+
+ private static ArtifactKey getSourcesArtifactFromJBossNexusRepository(ArtifactKey key,
+ NexusRepository nexusRepository) {
+ if (key == null || nexusRepository == null
+ || nexusRepository.getUrl() == null) {
+ return null;
+ }
+ HttpURLConnection connection = null;
+ try {
+ String base = nexusRepository.getUrl();
+ if (!base.endsWith(PATH_SEPARATOR)) {
+ base = base + PATH_SEPARATOR;
+ }
+ // String url =
+ // "https://repository.jboss.org/nexus/service/local/data_index?g=groupId&a=a...";
+ String url = base + "service/local/data_index?";
+ url= url + "g=" + URLEncoder.encode(key.getGroupId(), "UTF-8") + "&";
+ url= url + "a=" + URLEncoder.encode(key.getArtifactId(), "UTF-8") + "&";
+ url= url + "v=" + URLEncoder.encode(key.getVersion(), "UTF-8") + "&";
+ url= url + "c=" + URLEncoder.encode(key.getClassifier(), "UTF-8");
+ JAXBContext context = JAXBContext.newInstance(SearchResponse.class);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ connection = (HttpURLConnection) new URL(url).openConnection();
+ connection.connect();
+ Object object = unmarshaller.unmarshal(connection.getInputStream());
+ if (object instanceof SearchResponse) {
+ SearchResponse searchResponse = (SearchResponse) object;
+ for (NexusArtifact nexusArtifact : searchResponse.getData()) {
+ String groupId = nexusArtifact.getGroupId();
+ String artifactId = nexusArtifact.getArtifactId();
+ String version = nexusArtifact.getVersion();
+ String classifier = nexusArtifact.getClassifier();
+ ArtifactKey artifact = new ArtifactKey(groupId, artifactId,
+ version, classifier);
+ return artifact;
+ }
+ }
+ } catch (Exception e) {
+ return null;
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ return null;
+ }
+ private static String getSHA1(File file) throws IOException,
+ NoSuchAlgorithmException {
+ MessageDigest md = MessageDigest.getInstance("SHA1");
+ InputStream inputStream = new FileInputStream(file);
+ byte[] bytes = new byte[16 * 1024];
+ int count = 0;
+ while ((count = inputStream.read(bytes)) != -1) {
+ md.update(bytes, 0, count);
+ }
+ byte[] digestBytes = md.digest();
+ StringBuffer sb = new StringBuffer("");
+ for (int i = 0; i < digestBytes.length; i++) {
+ sb.append(Integer.toString((digestBytes[i] & 0xff) + 0x100, 16)
+ .substring(1));
+ }
+ return sb.toString();
+ }
+
+ protected static ArtifactKey getArtifactFromMetaInf(ZipFile jar)
+ throws IOException {
+ ZipEntry mavenEntry = jar.getEntry("META-INF/maven");//$NON-NLS-1$
+ if (mavenEntry == null) {
+ return null;
+ }
+ String entryName = mavenEntry.getName();
+ Enumeration<? extends ZipEntry> zipEntries = jar.entries();
+ ArtifactKey artifact = null;
+ while (zipEntries.hasMoreElements()) {
+ ZipEntry zipEntry = zipEntries.nextElement();
+ if (zipEntry.getName().endsWith("pom.properties")
+ && zipEntry.getName().startsWith(entryName)) {
+ Properties props = new Properties();
+ props.load(jar.getInputStream(zipEntry));
+ String groupId = props.getProperty("groupId");
+ String artifactId = props.getProperty("artifactId");
+ String version = props.getProperty("version");
+ String classifier = props.getProperty("classifier");
+ if (groupId != null && artifactId != null && version != null) {
+ artifact = new ArtifactKey(groupId, artifactId, version,
+ classifier);
+ return artifact;
+ }
+ }
+ }
+ return artifact;
+ }
+
+ protected static ArtifactKey getArtifactFromM2eIndex(File file)
+ throws CoreException {
+ IndexManager indexManager = MavenPlugin.getIndexManager();
+ IIndex index = indexManager.getAllIndexes();
+ IndexedArtifactFile info = null;
+ try {
+ info = index.identify(file);
+ } catch (Throwable e) {
+ // ignore
+ }
+ ArtifactKey artifact = null;
+ if (info != null) {
+ artifact = info.getArtifactKey();
+ if (artifact != null) {
+ return artifact;
+ }
+ }
+ if (indexManager instanceof NexusIndexManager) {
+ NexusIndexManager nexusIndexManager = (NexusIndexManager) indexManager;
+ if (globalRepositories == null) {
+ initialize();
+ }
+ for (IRepository repository : globalRepositories) {
+ NexusIndex nexusIndex = nexusIndexManager.getIndex(repository);
+ if (nexusIndex != null) {
+ try {
+ info = nexusIndex.identify(file);
+ } catch (Throwable t) {
+ // ignore
+ }
+ if (info != null) {
+ artifact = info.getArtifactKey();
+ if (artifact != null) {
+ return artifact;
+ }
+ }
+ }
+ }
+ }
+ return artifact;
+ }
+
+ public static Job downloadArtifact(File file, ArtifactKey artifact) {
+ final ArtifactKey sourcesArtifact = new ArtifactKey(
+ artifact.getGroupId(), artifact.getArtifactId(),
+ artifact.getVersion(),
+ getSourcesClassifier(artifact.getClassifier()));
+ resolvedFile = null;
+ Job job = new Job("Downloading sources for " + file.getName()) {
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ try {
+ resolvedFile = download(sourcesArtifact, monitor);
+ } catch (CoreException e) {
+ SourceLookupActivator.log(e);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setUser(true);
+ job.schedule();
+ return job;
+ }
+
+ private static File download(ArtifactKey artifact, IProgressMonitor monitor)
+ throws CoreException {
+ if (monitor.isCanceled()) {
+ return null;
+ }
+ monitor.beginTask("Downloading sources...", 2);
+ monitor.worked(1);
+ Artifact resolved = resolveArtifact(artifact, monitor);
+ return resolved.getFile();
+ }
+
+ protected static Artifact resolveArtifact(ArtifactKey artifact,
+ IProgressMonitor monitor) throws CoreException {
+ IMaven maven = MavenPlugin.getMaven();
+ Artifact resolved = maven.resolve(artifact.getGroupId(), //
+ artifact.getArtifactId(), //
+ artifact.getVersion(), //
+ "jar" /* type */, // //$NON-NLS-1$
+ artifact.getClassifier(), //
+ maven.getArtifactRepositories(), //
+ monitor);
+ monitor.done();
+ return resolved;
+ }
+
+ static String getSourcesClassifier(String baseClassifier) {
+ return CLASSIFIER_TESTS.equals(baseClassifier) ? CLASSIFIER_TESTSOURCES
+ : CLASSIFIER_SOURCES;
+ }
+
+ public static IPath getSourcePath(ArtifactKey a) {
+ File file = getAttachedArtifactFile(a,
+ getSourcesClassifier(a.getClassifier()));
+
+ if (file != null) {
+ return Path.fromOSString(file.getAbsolutePath());
+ }
+
+ return null;
+ }
+
+ private static File getAttachedArtifactFile(ArtifactKey a, String classifier) {
+ try {
+ IMaven maven = MavenPlugin.getMaven();
+ ArtifactRepository localRepository = maven.getLocalRepository();
+ String relPath = maven.getArtifactPath(localRepository,
+ a.getGroupId(), a.getArtifactId(), a.getVersion(),
+ "jar", classifier); //$NON-NLS-1$
+ File file = new File(localRepository.getBasedir(), relPath)
+ .getCanonicalFile();
+ if (file.canRead()) {
+ return file;
+ }
+ } catch (CoreException ex) {
+ // fall through
+ } catch (IOException ex) {
+ // fall through
+ }
+ return null;
+ }
+
+ @Override
+ public ISourceContainerType getType() {
+ return getSourceContainerType(TYPE_ID);
+ }
+
+ public String getHomePath() {
+ return homePath;
+ }
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainerType.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainerType.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainerType.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,58 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup.containers;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class JBossSourceContainerType extends AbstractSourceContainerTypeDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getMemento(org.eclipse.debug.internal.core.sourcelookup.ISourceContainer)
+ */
+ public String getMemento(ISourceContainer container) throws CoreException {
+ JBossSourceContainer jbossSourceContainer = (JBossSourceContainer)container;
+ Document document = newDocument();
+ Element element = document.createElement("jbossas"); //$NON-NLS-1$
+ element.setAttribute("homepath", jbossSourceContainer.getHomePath()); //$NON-NLS-1$
+ document.appendChild(element);
+ return serializeDocument(document);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#createSourceContainer(java.lang.String)
+ */
+ public ISourceContainer createSourceContainer(String memento) throws CoreException {
+ Node node = parseDocument(memento);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element)node;
+ if ("jbossas".equals(element.getNodeName())) { //$NON-NLS-1$
+ String homePath = element.getAttribute("homepath"); //$NON-NLS-1$
+ if (homePath == null || homePath.length() == 0) {
+ abort("Exception occurred during source lookup", null);
+ }
+ return new JBossSourceContainer(homePath);
+ }
+ abort("Unable to restore source lookup path - expecting typeId attribute.", null);
+ }
+ abort("Unable to restore source lookup path - unknown type source container type specified: {0}", null);
+ return null;
+ }
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.classpath (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.classpath 2012-04-27 00:22:17 UTC (rev 40534)
@@ -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/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.gitignore
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.gitignore (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.gitignore 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,2 @@
+/target
+/bin
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.project (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.project 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.sourcelookup.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/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.settings/org.eclipse.jdt.core.prefs 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,8 @@
+#Wed Jul 27 21:55:49 CEST 2011
+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/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.settings/org.jboss.ide.eclipse.as.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.settings/org.jboss.ide.eclipse.as.core.prefs (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/.settings/org.jboss.ide.eclipse.as.core.prefs 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.jboss.ide.eclipse.as.core.singledeployable.deployableList=
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/META-INF/MANIFEST.MF 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.maven.sourcelookup.ui;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Activator: org.jboss.tools.maven.sourcelookup.ui.SourceLookupUIActivator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.maven.sourcelookup.core;bundle-version="1.0.0",
+ org.eclipse.debug.ui;bundle-version="3.7.0",
+ org.eclipse.jdt.ui;bundle-version="3.7.1"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %BundleVendor
+Bundle-Localization: plugin
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/build.properties (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/build.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ plugin.properties
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/icons/jboss.gif
===================================================================
(Binary files differ)
Property changes on: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/icons/jboss.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/plugin.properties (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/plugin.properties 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,3 @@
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Maven Source Lookup UI
+
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/plugin.xml (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/plugin.xml 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.debug.ui.sourceContainerPresentations">
+ <sourceContainerPresentation
+ browserClass="org.jboss.tools.maven.sourcelookup.ui.browsers.JBossSourceContainerBrowser"
+ containerTypeID="org.jboss.tools.maven.sourcelookup.containerType"
+ icon="$nl$/icons/jboss.gif"
+ id="org.jboss.tools.maven.sourcelookup.containerPresentation">
+ </sourceContainerPresentation>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.jboss.tools.common.model.ui.MainPreferencePage"
+ class="org.jboss.tools.maven.sourcelookup.ui.preferences.SourceLookupPreferencePage"
+ id="org.jboss.tools.maven.sourcelookup.ui.preferences.SourceLookupPreferencePage"
+ name="Source Lookup"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.editorActions">
+ <editorContribution id="org.jboss.tools.maven.sourcelookup.ui.attachSourcesContribution"
+ targetID="org.eclipse.jdt.ui.ClassFileEditor">
+ <action id="org.jboss.tools.maven.sourcelookup.ui.attachSourcesAction"
+ class="org.jboss.tools.maven.sourcelookup.ui.actions.AttachSourcesActionDelegate"
+ label="Attach Sources" style="push"/>
+ </editorContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.jboss.tools.maven.sourcelookup.ui.Startup"></startup>
+ </extension>
+
+</plugin>
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/pom.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/pom.xml (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/pom.xml 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.maven</groupId>
+ <artifactId>plugins</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.plugins</groupId>
+ <artifactId>org.jboss.tools.maven.sourcelookup.ui</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/SourceLookupUIActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/SourceLookupUIActivator.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/SourceLookupUIActivator.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,78 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup.ui;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SourceLookupUIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.maven.sourcelookup.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static SourceLookupUIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public SourceLookupUIActivator() {
+ }
+
+ /*
+ * (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 SourceLookupUIActivator getDefault() {
+ return plugin;
+ }
+
+ public static void log(Exception e, String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ plugin.getLog().log(status);
+ }
+
+ public static void logWarning(String message) {
+ IStatus status = new Status(IStatus.WARNING, PLUGIN_ID, message);
+ plugin.getLog().log(status);
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e
+ .getLocalizedMessage(), e);
+ plugin.getLog().log(status);
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/Startup.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/Startup.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/Startup.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,28 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup.ui;
+
+import org.eclipse.ui.IStartup;
+import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class Startup implements IStartup {
+
+ @Override
+ public void earlyStartup() {
+ SourceLookupActivator.getDefault();
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/actions/AttachSourcesActionDelegate.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/actions/AttachSourcesActionDelegate.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/actions/AttachSourcesActionDelegate.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,178 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup.ui.actions;
+
+import java.io.File;
+import java.util.zip.ZipFile;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
+import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput;
+import org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathSupport;
+import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
+import org.jboss.tools.maven.sourcelookup.containers.JBossSourceContainer;
+import org.jboss.tools.maven.sourcelookup.ui.SourceLookupUIActivator;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class AttachSourcesActionDelegate implements IEditorActionDelegate {
+
+ @Override
+ public void run(IAction action) {
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ @Override
+ public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+ if (targetEditor != null) {
+ try {
+ boolean isAuto = SourceLookupActivator.getDefault().isAutoAddSourceContainer();
+ if (!isAuto) {
+ return;
+ }
+ IClassFileEditorInput input = (IClassFileEditorInput) targetEditor.getEditorInput();
+ IJavaElement element = input.getClassFile();
+ while (element.getParent() != null) {
+ element = element.getParent();
+ if (element instanceof IPackageFragmentRoot) {
+ final IPackageFragmentRoot fragment = (IPackageFragmentRoot) element;
+ IPath attachmentPath = fragment.getSourceAttachmentPath();
+ if (attachmentPath != null && !attachmentPath.isEmpty() && attachmentPath.toFile().exists()) {
+ break;
+ }
+ if (fragment.isArchive()) {
+ IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(fragment.getPath());
+ File file = iFile == null || iFile.getLocation() == null ? fragment.getPath().toFile() : iFile.getLocation().toFile();
+ ZipFile jar = new ZipFile(file);
+ final ArtifactKey artifact = JBossSourceContainer.getArtifact(file, jar);
+ if (artifact != null) {
+ IPath sourcePath = JBossSourceContainer.getSourcePath(artifact);
+ if (sourcePath == null || !sourcePath.toFile().exists()) {
+ Job job = JBossSourceContainer.downloadArtifact(file, artifact);
+ job.addJobChangeListener(new IJobChangeListener() {
+
+ @Override
+ public void sleeping(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void scheduled(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void running(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ IPath sourcePath = JBossSourceContainer.getSourcePath(artifact);
+ if (sourcePath != null && sourcePath.toFile().exists()) {
+ attachSource(fragment, sourcePath);
+ }
+ }
+
+ @Override
+ public void awake(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void aboutToRun(IJobChangeEvent event) {
+ }
+ });
+ job.schedule();
+ } else {
+ attachSource(fragment, sourcePath);
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ SourceLookupUIActivator.log(e);
+ }
+ }
+ }
+
+ private void attachSource(IPackageFragmentRoot fragment, IPath newSourcePath) {
+ try {
+ if (fragment == null || fragment.getKind() != IPackageFragmentRoot.K_BINARY) {
+ return;
+ }
+ IPath containerPath = null;
+ IJavaProject jproject = fragment.getJavaProject();
+ IClasspathEntry entry = fragment.getRawClasspathEntry();
+ if (entry == null) {
+ entry = JavaCore.newLibraryEntry(fragment.getPath(), null, null);
+ } else {
+ if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
+ containerPath = entry.getPath();
+ ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
+ IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, jproject);
+ if (initializer == null || container == null) {
+ return;
+ }
+ IStatus status = initializer.getSourceAttachmentStatus(containerPath, jproject);
+ if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED) {
+ return;
+ }
+ if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) {
+ return;
+ }
+ entry = JavaModelUtil.findEntryInContainer(container, fragment.getPath());
+ if (entry == null) {
+ return;
+ }
+ }
+ }
+ IClasspathEntry entry1;
+ CPListElement elem = CPListElement.createFromExisting(entry, null);
+ elem.setAttribute(CPListElement.SOURCEATTACHMENT, newSourcePath);
+ entry1 = elem.getClasspathEntry();
+ if (entry1.equals(entry)) {
+ return;
+ }
+ IClasspathEntry newEntry = entry1;
+ String[] changedAttributes = { CPListElement.SOURCEATTACHMENT };
+ BuildPathSupport.modifyClasspathEntry(null, newEntry, changedAttributes, jproject, containerPath,
+ newEntry.getReferencingEntry() != null, new NullProgressMonitor());
+ } catch (CoreException e) {
+ // ignore
+ }
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/EditNexusRepositoryDialog.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/EditNexusRepositoryDialog.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/EditNexusRepositoryDialog.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,122 @@
+/*************************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc. 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.maven.sourcelookup.ui.browsers;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.maven.sourcelookup.NexusRepository;
+
+/**
+ * @author snjeza
+ *
+ */
+public class EditNexusRepositoryDialog extends Dialog {
+
+ private NexusRepository nexusRepository;
+ private String title;
+
+ public EditNexusRepositoryDialog(Shell parentShell, NexusRepository repository) {
+ super(parentShell);
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
+ | SWT.RESIZE | getDefaultOrientation());
+ this.nexusRepository = repository;
+ if (this.nexusRepository == null) {
+ this.nexusRepository = new NexusRepository("", "", true);
+ this.title = "New Repository";
+ } else {
+ this.title = "Edit Repository";
+ }
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText(title);
+ Composite area = (Composite) super.createDialogArea(parent);
+ Composite contents = new Composite(area, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 100;
+ gd.widthHint = 400;
+ contents.setLayoutData(gd);
+ contents.setLayout(new GridLayout(2, false));
+ applyDialogFont(contents);
+ initializeDialogUnits(area);
+
+ Label nameLabel = new Label(contents, SWT.NONE);
+ nameLabel.setText("Name:");
+
+ final Text nameText = new Text(contents, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ nameText.setLayoutData(gd);
+ nameText.setText(nexusRepository.getName());
+
+ nameText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ nexusRepository.setName(nameText.getText());
+ }
+ });
+
+ Label urlLabel = new Label(contents, SWT.NONE);
+ urlLabel.setText("URL:");
+
+ final Text urlText = new Text(contents, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ urlText.setLayoutData(gd);
+ urlText.setText(nexusRepository.getUrl());
+
+ urlText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ nexusRepository.setUrl(urlText.getText());
+ }
+ });
+
+ final Button enabledButton = new Button(contents, SWT.CHECK);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.horizontalSpan = 2;
+ enabledButton.setLayoutData(gd);
+ enabledButton.setText("Enabled");
+ enabledButton.setSelection(nexusRepository.isEnabled());
+ enabledButton.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ nexusRepository.setEnabled(enabledButton.getSelection());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ return area;
+ }
+
+ public NexusRepository getNexusRepository() {
+ return nexusRepository;
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/JBossSourceContainerBrowser.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/JBossSourceContainerBrowser.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/JBossSourceContainerBrowser.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,96 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup.ui.browsers;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
+import org.jboss.tools.maven.sourcelookup.containers.JBossSourceContainer;
+import org.jboss.tools.maven.sourcelookup.ui.SourceLookupUIActivator;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class JBossSourceContainerBrowser extends AbstractSourceContainerBrowser {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.sourcelookup.ISourceContainerBrowser#createSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) {
+ ISourceContainer[] containers = new ISourceContainer[1];
+ if (director != null) {
+ ILaunchConfiguration configuration = director.getLaunchConfiguration();
+ if (configuration != null) {
+ try {
+ if (SourceLookupActivator.isJBossAsLaunchConfiguration(configuration)) {
+ containers[0] = new JBossSourceContainer(configuration);
+ return containers;
+ }
+ } catch (CoreException e) {
+ SourceLookupUIActivator.log(e);
+ }
+ }
+ }
+
+ JBossSourceContainerDialog dialog = new JBossSourceContainerDialog(shell);
+ if (dialog.open() == Window.OK && dialog.getHomePath() != null) {
+ containers[0] = new JBossSourceContainer(dialog.getHomePath());
+ return containers;
+ }
+ return new ISourceContainer[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#canEditSourceContainers(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector, org.eclipse.debug.core.sourcelookup.ISourceContainer[])
+ */
+ public boolean canEditSourceContainers(ISourceLookupDirector director, ISourceContainer[] containers) {
+ if (containers.length == 1 && JBossSourceContainer.TYPE_ID.equals(containers[0].getType().getId())) {
+ if (director != null) {
+ ILaunchConfiguration configuration = director
+ .getLaunchConfiguration();
+ if (configuration != null) {
+ try {
+ if (SourceLookupActivator.isJBossAsLaunchConfiguration(configuration)) {
+ return false;
+ }
+ } catch (CoreException e) {
+ // ignore
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#editSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.sourcelookup.ISourceLookupDirector, org.eclipse.debug.core.sourcelookup.ISourceContainer[])
+ */
+ public ISourceContainer[] editSourceContainers(Shell shell, ISourceLookupDirector director, ISourceContainer[] containers) {
+ if (containers.length == 1 && JBossSourceContainer.TYPE_ID.equals(containers[0].getType().getId()) ) {
+ JBossSourceContainerDialog dialog = new JBossSourceContainerDialog(shell);
+ if (dialog.open() == Window.OK && dialog.getHomePath() != null) {
+ containers[0].dispose();
+ containers[0] = new JBossSourceContainer(dialog.getHomePath());
+ return containers;
+ }
+ }
+ return containers;
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/JBossSourceContainerDialog.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/JBossSourceContainerDialog.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/JBossSourceContainerDialog.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,209 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup.ui.browsers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.tools.maven.sourcelookup.ui.SourceLookupUIActivator;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class JBossSourceContainerDialog extends TitleAreaDialog {
+
+ private TableViewer viewer;
+ private final static int SIZING_SELECTION_WIDGET_HEIGHT = 250;
+ private final static int SIZING_SELECTION_WIDGET_WIDTH = 300;
+ private String homePath;
+ private Image image;
+
+ public JBossSourceContainerDialog(Shell parentShell) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ image = SourceLookupUIActivator.imageDescriptorFromPlugin(SourceLookupUIActivator.PLUGIN_ID, "icons/jboss.gif").createImage();
+ }
+
+ public List<IJBossServerRuntime> getRuntimes() {
+ IServer[] servers = ServerCore.getServers();
+ List<IJBossServerRuntime> runtimes = new ArrayList<IJBossServerRuntime>();
+ if (servers != null) {
+ for (IServer server : servers) {
+ JBossServer jbossServer = null;
+ try {
+ jbossServer = ServerConverter.checkedGetJBossServer(server);
+ } catch (CoreException e) {
+ SourceLookupUIActivator.log(e);
+ }
+ if (jbossServer != null) {
+ IJBossServerRuntime runtime = jbossServer.getRuntime();
+ if (runtime != null) {
+ runtimes.add(runtime);
+ }
+ }
+ }
+ }
+ return runtimes;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ newShell.setText("Runtime Selection");
+ super.configureShell(newShell);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ setMessage("Select Server Runtime");
+ setTitle("Add a container to the source lookup path");
+ setTitleImage(DebugPluginImages
+ .getImage(IInternalDebugUIConstants.IMG_ADD_SRC_LOC_WIZ));
+ initializeDialogUnits(composite);
+
+ viewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE);
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
+ data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
+ viewer.getTable().setLayoutData(data);
+
+ viewer.setLabelProvider(new RuntimeLabelProvider());
+ viewer.setContentProvider(ArrayContentProvider.getInstance());
+
+ List<IJBossServerRuntime> runtimes = getRuntimes();
+ viewer.setInput(runtimes);
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ Object selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ Object object = structuredSelection.getFirstElement();
+ if (object instanceof IJBossServerRuntime) {
+ IJBossServerRuntime runtime = (IJBossServerRuntime) object;
+ setHomePath(runtime);
+ }
+ }
+ }
+ });
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ okPressed();
+ }
+ });
+
+ if (runtimes.size() > 0) {
+ viewer.getTable().select(0);
+ setHomePath(runtimes.get(0));
+ }
+
+ Dialog.applyDialogFont(composite);
+
+ return composite;
+
+ }
+
+ protected void setHomePath(IJBossServerRuntime runtime) {
+ if (runtime != null) {
+ IPath location = runtime.getRuntime().getLocation();
+ this.homePath = location.toOSString();
+ }
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ Button chooseHomeButton = createButton(parent, 2, "Choose Home...",
+ false);
+ chooseHomeButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage("Choose JBoss AS Home:");
+ String path = dialog.open();
+ if (path != null) {
+ setHomePath(path);
+ okPressed();
+ }
+ }
+
+ });
+ super.createButtonsForButtonBar(parent);
+ }
+
+ private class RuntimeLabelProvider extends LabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IJBossServerRuntime) {
+ IJBossServerRuntime runtime = (IJBossServerRuntime) element;
+ if (runtime.getRuntime() != null) {
+ return runtime.getRuntime().getName();
+ }
+ }
+ return super.getText(element);
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return image;
+ }
+
+ }
+
+ public String getHomePath() {
+ return homePath;
+ }
+
+ public void setHomePath(String homePath) {
+ this.homePath = homePath;
+ }
+
+ @Override
+ public boolean close() {
+ image.dispose();
+ return super.close();
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/AutoResizeTableLayout.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/AutoResizeTableLayout.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/AutoResizeTableLayout.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,129 @@
+/*************************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc. 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.maven.sourcelookup.ui.preferences;
+
+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/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/SourceLookupPreferencePage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/SourceLookupPreferencePage.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/SourceLookupPreferencePage.java 2012-04-27 00:22:17 UTC (rev 40534)
@@ -0,0 +1,461 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. 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.maven.sourcelookup.ui.preferences;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+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.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+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.Group;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.maven.sourcelookup.NexusRepository;
+import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
+import org.jboss.tools.maven.sourcelookup.ui.browsers.EditNexusRepositoryDialog;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class SourceLookupPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private Button autoAddButton;
+ private CheckboxTableViewer tableViewer;
+ private Set<NexusRepository> nexusRepositories;
+
+ @Override
+ public void init(IWorkbench workbench) {
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayout(layout);
+
+ autoAddButton = new Button(composite, SWT.CHECK);
+ autoAddButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
+ false));
+ autoAddButton.setSelection(SourceLookupActivator.getDefault()
+ .isAutoAddSourceContainer());
+ autoAddButton
+ .setText("Automatically add the JBoss Maven source container to all JBoss AS launch configurations");
+
+ // Nexus Repositories
+ Group group = new Group(composite, SWT.NONE);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ group.setLayoutData(gd);
+ layout = new GridLayout(2, false);
+ group.setLayout(layout);
+ group.setText("Nexus Index Repositories");
+ tableViewer = CheckboxTableViewer
+ .newCheckList(group, SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE);
+ Table table = tableViewer.getTable();
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 300;
+ table.setLayoutData(gd);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ String[] columnNames = new String[] { "Name", "URL" };
+ int[] columnWidths = new int[] { 200, 200 };
+
+ for (int i = 0; i < columnNames.length; i++) {
+ TableColumn tc = new TableColumn(table, SWT.LEFT);
+ tc.setText(columnNames[i]);
+ tc.setWidth(columnWidths[i]);
+ }
+
+ ColumnLayoutData[] layouts = {
+ new ColumnWeightData(200,200),
+ new ColumnWeightData(200,200)
+ };
+
+ TableLayout tableLayout = new AutoResizeTableLayout(table);
+ for (int i = 0; i < layouts.length; i++) {
+ tableLayout.addColumnData(layouts[i]);
+ }
+
+ nexusRepositories = SourceLookupActivator
+ .getNexusRepositories();
+ tableViewer.setLabelProvider(new NexusRepositoryLabelProvider());
+ tableViewer.setContentProvider(new NexusRepositoryContentProvider(
+ nexusRepositories));
+
+ tableViewer.setInput(nexusRepositories);
+ for (NexusRepository nexusRepository : nexusRepositories) {
+ tableViewer.setChecked(nexusRepository,
+ nexusRepository.isEnabled());
+ }
+ tableViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ NexusRepository repository = (NexusRepository) event
+ .getElement();
+ repository.setEnabled(!repository.isEnabled());
+ }
+ });
+
+ createButtons(group, tableViewer);
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ private void createButtons(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) {
+ EditNexusRepositoryDialog dialog = new EditNexusRepositoryDialog(getShell(), null);
+ int ok = dialog.open();
+ if (ok == Window.OK) {
+ NexusRepository repository = dialog.getNexusRepository();
+ nexusRepositories.add(repository);
+ viewer.refresh();
+ tableViewer.setChecked(repository,
+ repository.isEnabled());
+ }
+ 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 NexusRepository) {
+ NexusRepository repository = (NexusRepository) object;
+ NexusRepository edit = new NexusRepository(repository.getName(), repository.getUrl(), repository.isEnabled());
+ EditNexusRepositoryDialog dialog = new EditNexusRepositoryDialog(getShell(), edit);
+ int ok = dialog.open();
+ if (ok == Window.OK) {
+ repository.setName(edit.getName());
+ repository.setUrl(edit.getUrl());
+ repository.setEnabled(edit.isEnabled());
+ viewer.refresh();
+ tableViewer.setChecked(repository,
+ repository.isEnabled());
+ }
+ }
+ }
+ }
+
+ 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 NexusRepository) {
+ nexusRepositories.remove(object);
+ viewer.refresh();
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ final Button upButton = new Button(buttonComposite, SWT.PUSH);
+ upButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ upButton.setText("Up");
+ upButton.setEnabled(false);
+
+ final Button downButton = new Button(buttonComposite, SWT.PUSH);
+ downButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ downButton.setText("Down");
+ downButton.setEnabled(false);
+
+ upButton.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 NexusRepository) {
+ NexusRepository selected = (NexusRepository) object;
+ NexusRepository[] reps = nexusRepositories.toArray(new NexusRepository[0]);
+ int selectedIndex = -1;
+ for (int i = 0; i < reps.length; i++) {
+ NexusRepository rep = reps[i];
+ if (selected.equals(rep)) {
+ selectedIndex = i;
+ break;
+ }
+ }
+ if (selectedIndex > 0) {
+ NexusRepository temp = reps[selectedIndex-1];
+ reps[selectedIndex - 1] = selected;
+ reps[selectedIndex] = temp;
+ nexusRepositories.clear();
+ for (NexusRepository repository:reps) {
+ nexusRepositories.add(repository);
+ }
+ viewer.refresh();
+ int newIndex = selectedIndex - 1;
+ downButton.setEnabled( newIndex < (reps.length - 1));
+ upButton.setEnabled(newIndex > 0);
+
+ }
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ downButton.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 NexusRepository) {
+ NexusRepository selected = (NexusRepository) object;
+ NexusRepository[] reps = nexusRepositories.toArray(new NexusRepository[0]);
+ int selectedIndex = -1;
+ for (int i = 0; i < reps.length; i++) {
+ NexusRepository rep = reps[i];
+ if (selected.equals(rep)) {
+ selectedIndex = i;
+ break;
+ }
+ }
+ if (selectedIndex >= 0 && selectedIndex < reps.length) {
+ NexusRepository temp = reps[selectedIndex + 1];
+ reps[selectedIndex + 1] = selected;
+ reps[selectedIndex] = temp;
+ nexusRepositories.clear();
+ for (NexusRepository repository:reps) {
+ nexusRepositories.add(repository);
+ }
+ viewer.refresh();
+ int newIndex = selectedIndex + 1;
+ downButton.setEnabled( newIndex < (reps.length - 1));
+ upButton.setEnabled(newIndex > 0);
+ }
+ }
+ }
+ }
+
+ 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 NexusRepository);
+ removeButton.setEnabled(object instanceof NexusRepository);
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ if (object instanceof NexusRepository && nexusRepositories.size() > 1) {
+ NexusRepository repository = (NexusRepository) object;
+ Iterator<NexusRepository> iterator = nexusRepositories.iterator();
+ NexusRepository first = null;
+ if (iterator.hasNext()) {
+ first = iterator.next();
+ }
+ NexusRepository last = null;
+ while (iterator.hasNext()) {
+ last = iterator.next();
+ }
+ if (repository.equals(last)) {
+ upButton.setEnabled(true);
+ } else if (repository.equals(first)) {
+ downButton.setEnabled(true);
+ } else {
+ upButton.setEnabled(true);
+ downButton.setEnabled(true);
+ }
+
+ }
+ } else {
+ editButton.setEnabled(false);
+ removeButton.setEnabled(false);
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void performApply() {
+ IEclipsePreferences preferences = SourceLookupActivator.getDefault()
+ .getPreferences();
+ preferences.putBoolean(
+ SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER,
+ autoAddButton.getSelection());
+ SourceLookupActivator.setNexusRepositories(nexusRepositories);
+ SourceLookupActivator.saveNexusRepositories();
+ SourceLookupActivator.getDefault().savePreferences();
+ tableViewer.setInput(nexusRepositories);
+ for (NexusRepository nexusRepository : nexusRepositories) {
+ tableViewer.setChecked(nexusRepository,
+ nexusRepository.isEnabled());
+ }
+ }
+
+ @Override
+ protected void performDefaults() {
+ IEclipsePreferences preferences = SourceLookupActivator.getPreferences();
+
+ autoAddButton
+ .setSelection(SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER_DEFAULT);
+ preferences.putBoolean(
+ SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER,
+ SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER_DEFAULT);
+ SourceLookupActivator.setNexusRepositories(null);
+ nexusRepositories = SourceLookupActivator.getDefaultRepositories();
+ SourceLookupActivator.saveNexusRepositories();
+ SourceLookupActivator.getDefault().savePreferences();
+ tableViewer.setInput(nexusRepositories);
+ for (NexusRepository nexusRepository : nexusRepositories) {
+ tableViewer.setChecked(nexusRepository,
+ nexusRepository.isEnabled());
+ }
+ super.performDefaults();
+ }
+
+ @Override
+ public boolean performOk() {
+ performApply();
+ return super.performOk();
+ }
+
+ private class NexusRepositoryLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof NexusRepository) {
+ NexusRepository nr = (NexusRepository) element;
+ if (columnIndex == 0) {
+ return nr.getName();
+ }
+ if (columnIndex == 1) {
+ return nr.getUrl();
+ }
+ }
+ return null;
+ }
+ }
+
+ private class NexusRepositoryContentProvider implements
+ IStructuredContentProvider {
+
+ private Set<NexusRepository> repositories;
+
+ public NexusRepositoryContentProvider(Set<NexusRepository> repositories) {
+ this.repositories = repositories;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return repositories.toArray();
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ repositories = (Set<NexusRepository>) newInput;
+ }
+ }
+
+ @Override
+ public boolean performCancel() {
+ SourceLookupActivator.setNexusRepositories(null);
+ return super.performCancel();
+ }
+}
12 years, 8 months
JBoss Tools SVN: r40533 - trunk/maven/features.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-26 20:20:05 -0400 (Thu, 26 Apr 2012)
New Revision: 40533
Added:
trunk/maven/features/org.jboss.tools.maven.sourcelookup.feature/
Log:
Initial import.
12 years, 8 months
JBoss Tools SVN: r40532 - trunk/maven/plugins.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-26 20:18:20 -0400 (Thu, 26 Apr 2012)
New Revision: 40532
Added:
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/
Log:
JBIDE-9309 - Easily adding full JBoss AS source
12 years, 8 months
JBoss Tools SVN: r40531 - trunk/maven/plugins.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-26 20:16:13 -0400 (Thu, 26 Apr 2012)
New Revision: 40531
Removed:
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/
Log:
JBIDE-9309 - Easily adding full JBoss AS source
12 years, 8 months
JBoss Tools SVN: r40530 - trunk/maven/plugins.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-26 20:02:15 -0400 (Thu, 26 Apr 2012)
New Revision: 40530
Added:
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/
Log:
JBIDE-9309 - Easily adding full JBoss AS source
12 years, 8 months
JBoss Tools SVN: r40529 - trunk/maven/plugins.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-26 19:59:58 -0400 (Thu, 26 Apr 2012)
New Revision: 40529
Added:
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/
Log:
JBIDE-9309 - Easily adding full JBoss AS source
12 years, 8 months
JBoss Tools SVN: r40528 - trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-04-26 16:02:51 -0400 (Thu, 26 Apr 2012)
New Revision: 40528
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7LaunchConfigurator.java
Log:
https://issues.jboss.org/browse/JBIDE-11283
Remote Server Launch Configuration, wrong filepath separators in path to jboss-modules.jar in Automatically Calculated start command
fixed path but unfortunately found several other issues
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7LaunchConfigurator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7LaunchConfigurator.java 2012-04-26 19:20:35 UTC (rev 40527)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7LaunchConfigurator.java 2012-04-26 20:02:51 UTC (rev 40528)
@@ -112,7 +112,7 @@
protected String getJar(JBossServer server, IJBossServerRuntime runtime) {
String rseHome = RSEUtils.getRSEHomeDir(server.getServer());
- return new Path(rseHome).append(IJBossRuntimeResourceConstants.JBOSS7_MODULES_JAR).toOSString();
+ return new Path(rseHome).append(IJBossRuntimeResourceConstants.JBOSS7_MODULES_JAR).toString();
}
protected String getMainType() {
12 years, 8 months