JBoss Tools SVN: r35401 - in trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test: utils and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 17:58:25 -0400 (Wed, 05 Oct 2011)
New Revision: 35401
Modified:
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationUtils.java
Log:
[JBIDE-9854] created test
Modified: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java 2011-10-05 21:56:11 UTC (rev 35400)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java 2011-10-05 21:58:25 UTC (rev 35401)
@@ -230,14 +230,21 @@
*/
@Test
public void returnsCreationTimeOn2ndApplication() throws Exception {
- String applicationName = ApplicationUtils.createRandomApplicationName();
+ String applicationName = null;
+ String applicationName2 = null;
try {
- IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ applicationName = ApplicationUtils.createRandomApplicationName();
+ IApplication application = user.createApplication(applicationName, ICartridge.JBOSSAS_7);
Date creationTime = application.getCreationTime();
assertNotNull(creationTime);
- assertTrue(creationTime.compareTo(new Date()) == -1);
+ applicationName2 = ApplicationUtils.createRandomApplicationName();
+ IApplication application2 = user.createApplication(applicationName2, ICartridge.JBOSSAS_7);
+ Date creationTime2 = application2.getCreationTime();
+ assertNotNull(creationTime2);
+ assertTrue(creationTime.compareTo(creationTime2) == -1);
} finally {
ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName2, user, service);
}
}
}
Modified: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationUtils.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationUtils.java 2011-10-05 21:56:11 UTC (rev 35400)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationUtils.java 2011-10-05 21:58:25 UTC (rev 35401)
@@ -32,6 +32,9 @@
public static void silentlyDestroyAS7Application(String name, User user, IOpenshiftService service) {
try {
+ if (name == null) {
+ return;
+ }
service.destroyApplication(name, ICartridge.JBOSSAS_7, user);
} catch (OpenshiftException e) {
e.printStackTrace();
13 years, 3 months
JBoss Tools SVN: r35400 - trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-10-05 17:56:11 -0400 (Wed, 05 Oct 2011)
New Revision: 35400
Modified:
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java
Log:
JBIDE-8972 : refresh the correct project once the jars are copied
Modified: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java 2011-10-05 21:44:57 UTC (rev 35399)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java 2011-10-05 21:56:11 UTC (rev 35400)
@@ -83,7 +83,12 @@
processor.execute(javaProject, containerToRemovePath);
}
- javaProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ //Refresh project
+ IResource resourceToRefresh = libFolder.getProject();
+ if (resourceToRefresh ==null) {
+ resourceToRefresh = ResourcesPlugin.getWorkspace().getRoot();
+ }
+ resourceToRefresh.refreshLocal(IResource.DEPTH_INFINITE, monitor);
return Status.OK_STATUS;
}
13 years, 3 months
JBoss Tools SVN: r35399 - trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 17:44:57 -0400 (Wed, 05 Oct 2011)
New Revision: 35399
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java
Log:
[JBIDE-9854] storing now application info object that was given in the constructor. that will avoid unneeded requests for user info when User#getApplications
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java 2011-10-05 21:31:58 UTC (rev 35398)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java 2011-10-05 21:44:57 UTC (rev 35399)
@@ -43,6 +43,7 @@
super(user);
this.name = name;
this.cartridge = cartridge;
+ this.applicationInfo = applicationInfo;
this.service = service;
}
13 years, 3 months
JBoss Tools SVN: r35398 - in trunk/common/plugins: org.jboss.tools.common.jdt.ui and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-10-05 17:31:58 -0400 (Wed, 05 Oct 2011)
New Revision: 35398
Modified:
trunk/common/plugins/org.jboss.tools.common.jdt.ui/
trunk/common/plugins/org.jboss.tools.common.jdt/
Log:
JBIDE-8972 : add target/ to ignore list
Property changes on: trunk/common/plugins/org.jboss.tools.common.jdt
___________________________________________________________________
Added: svn:ignore
+ target
Property changes on: trunk/common/plugins/org.jboss.tools.common.jdt.ui
___________________________________________________________________
Added: svn:ignore
+ target
13 years, 3 months
JBoss Tools SVN: r35397 - in trunk/common/plugins: org.jboss.tools.common.jdt and 25 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-10-05 17:29:14 -0400 (Wed, 05 Oct 2011)
New Revision: 35397
Added:
trunk/common/plugins/org.jboss.tools.common.jdt.ui/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/.classpath
trunk/common/plugins/org.jboss.tools.common.jdt.ui/.gitignore
trunk/common/plugins/org.jboss.tools.common.jdt.ui/.project
trunk/common/plugins/org.jboss.tools.common.jdt.ui/.settings/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/.settings/org.eclipse.jdt.core.prefs
trunk/common/plugins/org.jboss.tools.common.jdt.ui/.settings/org.eclipse.m2e.core.prefs
trunk/common/plugins/org.jboss.tools.common.jdt.ui/META-INF/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.jdt.ui/build.properties
trunk/common/plugins/org.jboss.tools.common.jdt.ui/plugin.properties
trunk/common/plugins/org.jboss.tools.common.jdt.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.jdt.ui/pom.xml
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/JDTExtUIActivator.java
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/Messages.java
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog/MaterializeLibraryDialog.java
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/handlers/
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/handlers/MaterializeLibraryHandler.java
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/messages.properties
trunk/common/plugins/org.jboss.tools.common.jdt/
trunk/common/plugins/org.jboss.tools.common.jdt/.classpath
trunk/common/plugins/org.jboss.tools.common.jdt/.gitignore
trunk/common/plugins/org.jboss.tools.common.jdt/.project
trunk/common/plugins/org.jboss.tools.common.jdt/.settings/
trunk/common/plugins/org.jboss.tools.common.jdt/.settings/org.eclipse.jdt.core.prefs
trunk/common/plugins/org.jboss.tools.common.jdt/.settings/org.eclipse.m2e.core.prefs
trunk/common/plugins/org.jboss.tools.common.jdt/META-INF/
trunk/common/plugins/org.jboss.tools.common.jdt/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.jdt/build.properties
trunk/common/plugins/org.jboss.tools.common.jdt/plugin.properties
trunk/common/plugins/org.jboss.tools.common.jdt/plugin.xml
trunk/common/plugins/org.jboss.tools.common.jdt/pom.xml
trunk/common/plugins/org.jboss.tools.common.jdt/src/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/JDTExtActivator.java
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/Messages.java
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/ILibraryMaterializationPostProcessor.java
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/ILibraryMaterializationPostProcessorFactory.java
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/buildpath/
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/buildpath/LibraryMaterializationPostProcessorFactory.java
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/buildpath/MavenLibraryMaterializationPostProcessor.java
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/messages.properties
Modified:
trunk/common/plugins/pom.xml
Log:
JBIDE-8972 : initial "Materialize Classpath container" commit
Added: trunk/common/plugins/org.jboss.tools.common.jdt/.classpath
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/.classpath (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/.classpath 2011-10-05 21:29:14 UTC (rev 35397)
@@ -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="target/classes"/>
+</classpath>
Added: trunk/common/plugins/org.jboss.tools.common.jdt/.gitignore
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/.gitignore (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/.gitignore 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,2 @@
+/target
+/bin
Added: trunk/common/plugins/org.jboss.tools.common.jdt/.project
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/.project (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/.project 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.common.jdt</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>
+ <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>
+ <linkedResources>
+ <link>
+ <name>lib-org.jboss.tools.common_3.3.0.v20111004-2137-H487-M4</name>
+ <type>2</type>
+ <location>/home/fbricon/Dev/eclipses/Indigo-SR1/plugins/org.jboss.tools.common_3.3.0.v20111004-2137-H487-M4</location>
+ </link>
+ </linkedResources>
+</projectDescription>
Added: trunk/common/plugins/org.jboss.tools.common.jdt/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/.settings/org.eclipse.jdt.core.prefs 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,8 @@
+#Sun Jul 03 19:41:52 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/common/plugins/org.jboss.tools.common.jdt/.settings/org.eclipse.m2e.core.prefs
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/.settings/org.eclipse.m2e.core.prefs (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/.settings/org.eclipse.m2e.core.prefs 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,5 @@
+#Fri Sep 16 10:56:24 CEST 2011
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Added: trunk/common/plugins/org.jboss.tools.common.jdt/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/META-INF/MANIFEST.MF 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.common.jdt;singleton:=true
+Bundle-Version: 3.3.0.qualifier
+Bundle-Activator: org.jboss.tools.common.jdt.core.JDTExtActivator
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.jdt.core;bundle-version="3.7.0",
+ org.eclipse.core.variables;bundle-version="3.2.500",
+ org.eclipse.core.resources,
+ org.apache.commons.io,
+ org.jboss.tools.common
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %BundleVendor
+Bundle-Localization: plugin
+Export-Package: org.jboss.tools.common.jdt.core,
+ org.jboss.tools.common.jdt.core.buildpath
+Bundle-ActivationPolicy: lazy
Added: trunk/common/plugins/org.jboss.tools.common.jdt/build.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/build.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/build.properties 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = target/classes/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
Added: trunk/common/plugins/org.jboss.tools.common.jdt/plugin.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/plugin.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/plugin.properties 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.common.jdt
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Tools JDT Extension
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.jdt/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/plugin.xml (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/plugin.xml 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.5"?>
+<plugin>
+
+</plugin>
Added: trunk/common/plugins/org.jboss.tools.common.jdt/pom.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/pom.xml (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/pom.xml 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,13 @@
+<?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.common</groupId>
+ <artifactId>plugins</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.common.plugins</groupId>
+ <artifactId>org.jboss.tools.common.jdt</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+</project>
Added: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/JDTExtActivator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/JDTExtActivator.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/JDTExtActivator.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,87 @@
+/*************************************************************************************
+ * 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.
+ ************************************************************************************/
+package org.jboss.tools.common.jdt.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.common.jdt.core.buildpath.ILibraryMaterializationPostProcessorFactory;
+import org.jboss.tools.common.jdt.core.internal.buildpath.LibraryMaterializationPostProcessorFactory;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class JDTExtActivator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.common.jdt"; //$NON-NLS-1$
+
+ // The shared instance
+ private static JDTExtActivator plugin;
+
+ private ILibraryMaterializationPostProcessorFactory postProcessorFactory;
+
+ /**
+ * The constructor
+ */
+ public JDTExtActivator() {
+ }
+
+ /*
+ * (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;
+ postProcessorFactory = new LibraryMaterializationPostProcessorFactory();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ postProcessorFactory = null;
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static JDTExtActivator 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);
+ }
+
+ public ILibraryMaterializationPostProcessorFactory getLibraryMaterializationPostProcessorFactory() {
+ return postProcessorFactory;
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/Messages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/Messages.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/Messages.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,36 @@
+/*************************************************************************************
+ * 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.
+ ************************************************************************************/
+package org.jboss.tools.common.jdt.core;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ * @author Fred Bricon
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.common.jdt.core.messages"; //$NON-NLS-1$
+
+ public static String Materialize_Library;
+
+ public static String MaterializeLibraryJob_error_copying_file;
+
+ public static String MaterializeLibraryJob_Error_creating_classpath_entry;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Added: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/ILibraryMaterializationPostProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/ILibraryMaterializationPostProcessor.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/ILibraryMaterializationPostProcessor.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,14 @@
+package org.jboss.tools.common.jdt.core.buildpath;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+
+public interface ILibraryMaterializationPostProcessor {
+
+ void execute(IJavaProject javaProject, IPath containerPath) throws CoreException;
+
+ boolean applies(IJavaProject javaProject, IPath containerPath) throws CoreException;
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/ILibraryMaterializationPostProcessorFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/ILibraryMaterializationPostProcessorFactory.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/ILibraryMaterializationPostProcessorFactory.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,7 @@
+package org.jboss.tools.common.jdt.core.buildpath;
+
+public interface ILibraryMaterializationPostProcessorFactory {
+
+ public abstract ILibraryMaterializationPostProcessor[] getLibraryMaterializationPostProcessors();
+
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,222 @@
+package org.jboss.tools.common.jdt.core.buildpath;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.Map;
+
+import org.apache.commons.io.FileUtils;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.WorkspaceJob;
+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.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.jdt.core.JDTExtActivator;
+import org.jboss.tools.common.jdt.core.Messages;
+
+public class MaterializeLibraryJob extends WorkspaceJob {
+
+ private final IFolder libFolder;
+ private final IJavaProject javaProject;
+ private final Map<IPath, String> jars;
+ private final IClasspathContainer containerToRemove;
+
+ public MaterializeLibraryJob(IJavaProject javaProject,
+ IClasspathContainer containerToMaterialize,
+ Map<IPath, String> jars,
+ IFolder libFolder) {
+ super(Messages.Materialize_Library);
+ if (javaProject == null || javaProject.getProject() == null) {
+ throw new IllegalArgumentException("Project must not be null");
+ }
+ if (containerToMaterialize == null) {
+ throw new IllegalArgumentException("Container to materialize must not be null");
+ }
+ if (libFolder == null) {
+ throw new IllegalArgumentException("Destination library folder must not be null");
+ }
+ this.javaProject = javaProject;
+ this.libFolder = libFolder;
+ this.containerToRemove = containerToMaterialize;
+ this.jars = jars;
+ }
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+
+ final IPath rootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+
+ IPath containerToRemovePath = containerToRemove.getPath();
+
+ LinkedHashSet<IClasspathEntry> newCpes = null;
+
+ //Create new Classpath entries
+ if (jars != null && !jars.isEmpty()) {
+ newCpes = copyClasspathEntries(monitor, rootPath);
+ }
+
+ // Remove the Classpath Library first
+ removeClasspathContainer(javaProject, containerToRemovePath);
+
+ // Then add the new Classpath entries
+ if (newCpes != null && !newCpes.isEmpty()) {
+ IClasspathEntry[] entries = new IClasspathEntry[newCpes.size()];
+ newCpes.toArray(entries);
+ addToClasspath(javaProject, entries, monitor);
+ }
+
+ //Finally execute post processors (needed to remove project nature, for ex.)
+ for (ILibraryMaterializationPostProcessor processor : getPostProcessors()) {
+ processor.execute(javaProject, containerToRemovePath);
+ }
+
+ javaProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
+
+ return Status.OK_STATUS;
+ }
+
+ private LinkedHashSet<IClasspathEntry> copyClasspathEntries(
+ IProgressMonitor monitor, final IPath rootPath)
+ throws CoreException, JavaModelException {
+
+ int jarSize = jars.size();
+
+ monitor.beginTask(Messages.Materialize_Library, jarSize);
+
+ mkdirs(libFolder, monitor);
+
+ IPath destination = libFolder.getLocation();
+
+ LinkedHashSet<IClasspathEntry> newCpes = new LinkedHashSet<IClasspathEntry>(jarSize);
+
+ IClasspathEntry[] cpEntries = containerToRemove.getClasspathEntries();
+
+ for (IClasspathEntry entry : cpEntries) {
+ if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+
+ IPath sourceFilePath = entry.getPath();
+ String fileName = jars.get(sourceFilePath);
+ if (fileName == null) {
+ // Jar was not selected
+ continue;
+ }
+
+ monitor.subTask(fileName);
+ IPath destinationFilePath = destination.append(fileName);
+ try {
+ if ((javaProject.findPackageFragmentRoot(destinationFilePath) == null)// Not already defined
+ && copy(sourceFilePath, destinationFilePath)) {
+ // TODO handle duplicate files -> rename?
+ // FIXME use absolute / relative paths depending on the
+ // location of the destination folder (in project /
+ // elsewhere in the workspace)
+ // FIXME need a more elegant way to get a relative path
+ // with a leading /
+ IPath relativePath = new Path("/").append(libFolder.getFullPath()).append(fileName); //$NON-NLS-1$
+ IClasspathEntry newEntry = getNewClasspathEntry(entry, relativePath);
+ newCpes.add(newEntry);
+ }
+ } catch (IOException e) {
+ IStatus status = new Status(IStatus.ERROR,
+ JDTExtActivator.PLUGIN_ID, NLS.bind(Messages.MaterializeLibraryJob_error_copying_file, fileName), e);
+ throw new CoreException(status);
+ }
+ } else if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
+ newCpes.add(entry);
+ }
+ }
+ return newCpes;
+ }
+
+ private ILibraryMaterializationPostProcessor[] getPostProcessors() {
+ ILibraryMaterializationPostProcessorFactory ppFactory = JDTExtActivator.getDefault()
+ .getLibraryMaterializationPostProcessorFactory();
+ ILibraryMaterializationPostProcessor[] postProcessors = ppFactory.getLibraryMaterializationPostProcessors();
+ return postProcessors;
+ }
+
+ private IClasspathEntry getNewClasspathEntry(IClasspathEntry entry,
+ IPath destinationFilePath) throws CoreException {
+ try {
+ return JavaCore.newLibraryEntry(destinationFilePath,
+ entry.getSourceAttachmentPath(),
+ entry.getSourceAttachmentRootPath(),
+ entry.getAccessRules(), entry.getExtraAttributes(),
+ entry.isExported());
+ } catch (Exception e) {
+ IStatus status = new Status(IStatus.ERROR, JDTExtActivator.PLUGIN_ID,
+ NLS.bind(Messages.MaterializeLibraryJob_Error_creating_classpath_entry, e.getMessage()), e);
+ throw new CoreException(status);
+ }
+ }
+
+ private void addToClasspath(IJavaProject javaProject,
+ IClasspathEntry[] newCpes, IProgressMonitor monitor)
+ throws JavaModelException {
+ if (newCpes.length > 0) {
+ IClasspathEntry[] originalClasspathEntries = javaProject.getRawClasspath();
+ IClasspathEntry[] newClasspath = new IClasspathEntry[originalClasspathEntries.length + newCpes.length];
+ System.arraycopy(originalClasspathEntries, 0, newClasspath, 0, originalClasspathEntries.length);
+ System.arraycopy(newCpes, 0, newClasspath, originalClasspathEntries.length, newCpes.length);
+ javaProject.setRawClasspath(newClasspath, monitor);
+ }
+ }
+
+ private boolean copy(IPath sourceFilePath, IPath destinationFilePath)
+ throws IOException {
+ File sourcefile = sourceFilePath.toFile();
+ if (sourcefile.isFile()) {
+ File destinationFile = destinationFilePath.toFile();
+ //Overwrite existing file
+ FileUtils.copyFile(sourcefile, destinationFile);
+ if (destinationFile.exists()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void removeClasspathContainer(IJavaProject javaProject,
+ IPath containerToRemovePath) throws JavaModelException {
+ if (javaProject != null) {
+ // remove classpatch container from JavaProject
+ ArrayList<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
+ for (IClasspathEntry entry : javaProject.getRawClasspath()) {
+ if (!containerToRemovePath.equals(entry.getPath())) {
+ newEntries.add(entry);
+ }
+ }
+ javaProject.setRawClasspath(newEntries.toArray(new IClasspathEntry[newEntries.size()]), null);
+ }
+ }
+
+ private void mkdirs(final IFolder folder, IProgressMonitor monitor)
+ throws CoreException {
+ if (!folder.exists()) {
+ if (folder.getParent() instanceof IFolder) {
+ mkdirs((IFolder) folder.getParent(), monitor);
+ }
+ folder.create(true /* force */, true /* local */, monitor);
+ } else {
+ IContainer x = folder;
+ while (x instanceof IFolder && x.isDerived()) {
+ x.setDerived(false, monitor);
+ x = x.getParent();
+ }
+ }
+
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/buildpath/LibraryMaterializationPostProcessorFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/buildpath/LibraryMaterializationPostProcessorFactory.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/buildpath/LibraryMaterializationPostProcessorFactory.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,16 @@
+package org.jboss.tools.common.jdt.core.internal.buildpath;
+
+import org.jboss.tools.common.jdt.core.buildpath.ILibraryMaterializationPostProcessor;
+import org.jboss.tools.common.jdt.core.buildpath.ILibraryMaterializationPostProcessorFactory;
+
+public class LibraryMaterializationPostProcessorFactory implements ILibraryMaterializationPostProcessorFactory {
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.jdt.core.buildpath.ILibraryMaterializationPostProcessorFactory#getLibraryMaterializationPostProcessors()
+ */
+ @Override
+ public ILibraryMaterializationPostProcessor[] getLibraryMaterializationPostProcessors() {
+ return new ILibraryMaterializationPostProcessor[]{new MavenLibraryMaterializationPostProcessor()};
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/buildpath/MavenLibraryMaterializationPostProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/buildpath/MavenLibraryMaterializationPostProcessor.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/internal/buildpath/MavenLibraryMaterializationPostProcessor.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,26 @@
+package org.jboss.tools.common.jdt.core.internal.buildpath;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.jdt.core.buildpath.ILibraryMaterializationPostProcessor;
+
+public class MavenLibraryMaterializationPostProcessor implements ILibraryMaterializationPostProcessor {
+
+ private static final String MAVEN_NATURE_ID = "org.eclipse.m2e.core.maven2Nature";
+
+ public boolean applies(IJavaProject javaProject, IPath containerPath) throws CoreException {
+ boolean applies = javaProject != null && javaProject.getProject().hasNature(MAVEN_NATURE_ID)
+ && ("org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER".equals(containerPath.toPortableString()));
+ return applies;
+ }
+
+ public void execute(IJavaProject javaProject, IPath containerPath) throws CoreException {
+ if (applies(javaProject, containerPath)) {
+ System.err.println("Removing "+ MAVEN_NATURE_ID + " from "+ javaProject.getProject().getName());
+ EclipseUtil.removeNatureFromProject(javaProject.getProject(), MAVEN_NATURE_ID);
+ }
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/messages.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/messages.properties 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,4 @@
+Materialize_Library=Materialize Library
+
+MaterializeLibraryJob_error_copying_file=An error occured while copying {0}
+MaterializeLibraryJob_Error_creating_classpath_entry=Error creating the classpath entry :{0}
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/.classpath
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/.classpath (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/.classpath 2011-10-05 21:29:14 UTC (rev 35397)
@@ -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="target/classes"/>
+</classpath>
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/.gitignore
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/.gitignore (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/.gitignore 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,2 @@
+/target
+/bin
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/.project
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/.project (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/.project 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.common.jdt.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>
+ <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>
+</projectDescription>
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/.settings/org.eclipse.jdt.core.prefs 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,8 @@
+#Sun Jul 03 19:41:52 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/common/plugins/org.jboss.tools.common.jdt.ui/.settings/org.eclipse.m2e.core.prefs
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/.settings/org.eclipse.m2e.core.prefs (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/.settings/org.eclipse.m2e.core.prefs 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,5 @@
+#Fri Sep 16 10:56:24 CEST 2011
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/META-INF/MANIFEST.MF 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.common.jdt.ui;singleton:=true
+Bundle-Version: 3.3.0.qualifier
+Bundle-Activator: org.jboss.tools.common.jdt.ui.JDTExtUIActivator
+Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.jdt.core;bundle-version="3.7.0",
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.eclipse.core.variables;bundle-version="3.2.500",
+ org.jboss.tools.common.jdt,
+ org.eclipse.core.resources,
+ org.apache.commons.io,
+ org.jboss.tools.common,
+ org.eclipse.jst.j2ee.ui;bundle-version="1.1.500"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %BundleVendor
+Bundle-Localization: plugin
+Export-Package: org.jboss.tools.common.jdt.ui,
+ org.jboss.tools.common.jdt.ui.buildpath.dialog,
+ org.jboss.tools.common.jdt.ui.buildpath.handlers
+Bundle-ActivationPolicy: lazy
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/build.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/build.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/build.properties 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = target/classes/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/plugin.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/plugin.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/plugin.properties 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.common.jdt.ui
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Tools JDT Extension UI
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/plugin.xml (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/plugin.xml 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.5"?>
+<plugin>
+ <extension point="org.eclipse.ui.commands">
+ <command
+ id="org.jboss.tools.common.jdt.ui.commands.materializeLibrary"
+ name="Materialize Library"
+ defaultHandler="org.jboss.tools.common.jdt.ui.buildpath.handlers.MaterializeLibraryHandler"
+ >
+ </command>
+ </extension>
+ <extension point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.ui.popup.any?after=additions">
+ <command
+ commandId="org.jboss.tools.common.jdt.ui.commands.materializeLibrary"
+ label="Materialize Library..."
+ mnemonic="M">
+ <visibleWhen checkEnabled="false">
+ <!-- org.eclipse.jdt.internal.ui.packageview.ClassPathContainer
+ <instanceof value="org.eclipse.jdt.internal.ui.packageview.ClassPathContainer"/>
+ -->
+ <with variable="selection">
+ <and>
+ <count value="1" />
+ <iterate operator="and">
+ <adapt type="org.eclipse.jdt.internal.ui.packageview.ClassPathContainer" />
+ </iterate>
+ </and>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+ <!--
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution id="materializeLibraryPopup"
+ objectClass="org.eclipse.core.runtime.IAdaptable"
+ adaptable="true">
+ <action id="materializeLibraryAction"
+ class="org.jboss.tools.common.jdt.ui.generic.GenericCommandActionDelegate:org.jboss.tools.common.jdt.ui.commands.materializeLibrary"
+ label="Materialize fucking library"
+ style="push"
+ definitionId="materializeLibrary"
+ menubarPath="org.eclipse.m2e.core.fileMenu/open"
+ enablesFor="+"/>
+ </objectContribution>
+ </extension>
+ -->
+</plugin>
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/pom.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/pom.xml (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/pom.xml 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,13 @@
+<?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.common</groupId>
+ <artifactId>plugins</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.common.plugins</groupId>
+ <artifactId>org.jboss.tools.common.jdt.ui</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+</project>
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/JDTExtUIActivator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/JDTExtUIActivator.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/JDTExtUIActivator.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,71 @@
+/*************************************************************************************
+ * 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.
+ ************************************************************************************/
+package org.jboss.tools.common.jdt.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 JDTExtUIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.common.jdt.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static JDTExtUIActivator plugin;
+
+ /*
+ * (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 JDTExtUIActivator 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);
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/Messages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/Messages.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/Messages.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,32 @@
+/*************************************************************************************
+ * 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.
+ ************************************************************************************/
+package org.jboss.tools.common.jdt.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ * @author Fred Bricon
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.common.jdt.ui.messages"; //$NON-NLS-1$
+
+ public static String Materialize_Library;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog/MaterializeLibraryDialog.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog/MaterializeLibraryDialog.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog/MaterializeLibraryDialog.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,373 @@
+/*************************************************************************************
+ * Copyright (c) 2009-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.common.jdt.ui.buildpath.dialog;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.internal.ui.JavaPluginImages;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.window.ToolTip;
+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.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+public class MaterializeLibraryDialog extends TitleAreaDialog {
+
+ private static final String TITLE = "Materialize Classpath Library";
+
+ private static final String SOURCE_PROPERTY = "SOURCE_PROPERTY";
+
+ private static final String FILENAME_PROPERTY = "FILENAME_PROPERTY";
+
+ private IFolder libFolder;
+ private Map<IClasspathEntry, String> classpathEntryPaths;
+ private Map<IPath, String> selectedClasspathEntryPaths;
+
+ private final String libName;
+ private final IProject project;
+
+ private static Image JAR_IMAGE = JavaPluginImages.DESC_OBJS_EXTJAR.createImage();
+ private static Image PRJ_IMAGE = JavaPluginImages.DESC_OBJS_JAVA_MODEL.createImage();
+
+ // private StringButtonDialogField libFolderDialogField;
+
+ private Text libfolderText;
+
+ private CheckboxTableViewer classpathEntriesViewer;
+
+ public MaterializeLibraryDialog(Shell shell, IProject project, IClasspathContainer containerToMaterialize, String defaultLib) {
+ super(shell);
+ setShellStyle(super.getShellStyle() | SWT.RESIZE | SWT.MODELESS);
+ setTitle(TITLE);
+ this.project = project;
+ IPath folderPath = project.getFullPath().append(defaultLib);
+ libFolder = ResourcesPlugin.getWorkspace().getRoot().getFolder(folderPath);
+ this.libName = containerToMaterialize.getDescription();
+ initClasspathEntryPaths(containerToMaterialize);
+ }
+
+ private void initClasspathEntryPaths(IClasspathContainer container) {
+ IClasspathEntry[] cpEntries = container.getClasspathEntries();
+ classpathEntryPaths = new LinkedHashMap<IClasspathEntry, String>(cpEntries.length);
+ for (IClasspathEntry entry : cpEntries) {
+ if ((entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && entry.getPath() != null)
+ || (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT)) {
+ IPath sourceFilePath = entry.getPath();
+ String fileName = sourceFilePath.lastSegment();
+ classpathEntryPaths.put(entry, fileName);
+ }
+ }
+ }
+
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(TITLE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite area = (Composite) super.createDialogArea(parent);
+
+ Composite container = new Composite(area, SWT.NONE);
+ container.setEnabled(true);
+
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginLeft = 12;
+ container.setLayout(layout);
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ setTitle(TITLE);
+ setMessage("Copy jars from " + libName);
+
+ // ContainerFieldAdapter adapter= new ContainerFieldAdapter();
+ // libFolderDialogField = new StringButtonDialogField(adapter);
+ // libFolderDialogField.setLabelText("Destination folder");
+ // libFolderDialogField.setButtonLabel("Browse...");
+ // libFolderDialogField.doFillIntoGrid(container,
+ // libFolderDialogField.getNumberOfControls());
+ // LayoutUtil.setWidthHint(libFolderDialogField.getTextControl(null),
+ // convertWidthInCharsToPixels(40));
+
+ Label libFolderLabel = new Label(container, SWT.NONE);
+ libFolderLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ libFolderLabel.setText("Destination folder");
+
+ libfolderText = new Text(container, SWT.BORDER);
+ libfolderText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ libfolderText.setEditable(true);
+ libfolderText.setText(libFolder.getFullPath().toPortableString());
+
+ // libFolderDialogField.setText(libFolder.getFullPath().toPortableString());
+ displayClasspathEntriesTable(container);
+
+ return area;
+ }
+
+ private void displayClasspathEntriesTable(Composite container) {
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 4);
+ gd.heightHint = 500;
+ gd.widthHint = 600;
+
+ classpathEntriesViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER | SWT.MULTI);
+ Table table = classpathEntriesViewer.getTable();
+ table.setFocus();
+ table.setLayoutData(gd);
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+
+ TableColumn emptyColumn = new TableColumn(table, SWT.NONE);
+ emptyColumn.setWidth(20);
+
+ TableViewerColumn sourceColumn = new TableViewerColumn(classpathEntriesViewer, SWT.NONE);
+ sourceColumn.getColumn().setText("Source ");
+ sourceColumn.getColumn().setWidth(300);
+
+
+ TableViewerColumn destinationColumn = new TableViewerColumn(classpathEntriesViewer, SWT.NONE);
+ destinationColumn.getColumn().setText("Copy as...");
+ destinationColumn.getColumn().setWidth(200);
+
+ classpathEntriesViewer.setContentProvider(ArrayContentProvider.getInstance());
+ classpathEntriesViewer.setLabelProvider(new ClasspathEntryLabelProvider());
+ classpathEntriesViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ refresh();
+ }
+ });
+ classpathEntriesViewer.setInput(classpathEntryPaths.entrySet());
+ classpathEntriesViewer.setAllChecked(true);
+
+
+ addSelectionButton(container, "Select All", true);
+ addSelectionButton(container, "Deselect All", false);
+
+ addTableListeners();
+
+ }
+
+ private void addTableListeners() {
+ addCellEditors();
+ }
+
+ protected void addCellEditors() {
+ classpathEntriesViewer.setColumnProperties(new String[] {
+ "EMPTY", SOURCE_PROPERTY, FILENAME_PROPERTY });
+
+ TextCellEditor ce = new TextCellEditor(classpathEntriesViewer.getTable());
+ ce.setValidator(new ICellEditorValidator() {
+ @Override
+ public String isValid(Object arg0) {
+ String name = arg0.toString();
+ return (checkValidName(name))?null:name;
+ }
+ });
+
+ CellEditor[] editors = new CellEditor[] {
+ null,
+ new TextCellEditor(classpathEntriesViewer.getTable()),
+ ce };
+
+ classpathEntriesViewer.setCellEditors(editors);
+ classpathEntriesViewer.setCellModifier(new FileNameCellModifier());
+ }
+
+ public Map<IPath, String> getSelectedClasspathEntryPaths() {
+ return selectedClasspathEntryPaths;
+ }
+
+ public IFolder getLibFolder() {
+ return libFolder;
+ }
+
+ private static IFolder getLibFolderFromText(String text) {
+ String portablePath = text.replaceAll("\\\\", "/");
+ IPath path = new Path(portablePath);
+ return ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
+ }
+
+ @Override
+ protected void okPressed() {
+ libFolder = getLibFolderFromText(libfolderText.getText());
+ Object[] selection = classpathEntriesViewer.getCheckedElements();
+ selectedClasspathEntryPaths = new LinkedHashMap<IPath, String>(selection.length);
+ for (Object o : selection) {
+ @SuppressWarnings("unchecked")
+ Map.Entry<IClasspathEntry, String> entry = (Map.Entry<IClasspathEntry, String>)o;
+ selectedClasspathEntryPaths.put(entry.getKey().getPath(),entry.getValue());
+ }
+
+ Set<String> duplicates = findDuplicates(selectedClasspathEntryPaths.values());
+ if (!duplicates.isEmpty()) {
+ setErrorMessage("Duplicate entries found : "+duplicates.toString());
+ return;
+ }
+ super.okPressed();
+ }
+
+ private Set<String> findDuplicates(Collection<String> values) {
+ Set<String> uniqueNames = new HashSet<String>(values.size());
+ Set<String> duplicateNames = new HashSet<String>();
+ for (String name : values) {
+ if (!uniqueNames.add(name)) {
+ duplicateNames.add(name);
+ }
+ }
+ return duplicateNames;
+}
+
+private class ClasspathEntryLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ private static final int SOURCE_COLUMN = 1;
+ private static final int FILENAME_COLUMN = 2;
+
+ public String getColumnText(Object element, int columnIndex) {
+ Map.Entry<IClasspathEntry, String> entry = (Map.Entry<IClasspathEntry, String>) element;
+ StringBuilder text = new StringBuilder();
+ if (entry != null) {
+ if (columnIndex == SOURCE_COLUMN) {
+ text.append(entry.getKey().getPath().lastSegment());
+ } else if (columnIndex == FILENAME_COLUMN){
+ text.append(entry.getValue());
+ }
+ }
+
+ return text.toString();
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ Image img = null;
+ if (columnIndex > 0) {
+ Map.Entry<IClasspathEntry, String> entry = (Map.Entry<IClasspathEntry, String>) element;
+ if (entry.getKey().getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+ img = JAR_IMAGE;//return lib image
+ } else {
+ img = PRJ_IMAGE;
+ }
+ }
+ return img;
+ }
+ }
+
+ private Button addSelectionButton(Composite container, String label, final boolean ischecked) {
+ Button button = new Button(container, SWT.NONE);
+ button.setLayoutData(new GridData(SWT.FILL, SWT.UP,
+ false, false, 1, 1));
+ button.setText(label);
+ button.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ classpathEntriesViewer.setAllChecked(ischecked);
+ refresh();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ return button;
+ }
+
+ protected void refresh() {
+ classpathEntriesViewer.refresh();
+ }
+
+ private class FileNameCellModifier implements ICellModifier {
+
+ public boolean canModify(Object element, String property) {
+ Map.Entry<IClasspathEntry, String> entry = (Map.Entry<IClasspathEntry, String>) element;
+ return (entry.getKey().getEntryKind() == IClasspathEntry.CPE_LIBRARY) &&
+ (FILENAME_PROPERTY.equals(property) || SOURCE_PROPERTY.equals(property)) ;
+ }
+
+ public Object getValue(Object element, String property) {
+ Map.Entry<IClasspathEntry, String> entry = (Map.Entry<IClasspathEntry, String>) element;
+ //if(entry.getKey().getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+ if (property.equals(SOURCE_PROPERTY)) {
+ return entry.getKey().getPath().toOSString();
+ } else if (property.equals(FILENAME_PROPERTY)) {
+ return entry.getValue();
+ }
+ //}
+ return ""; //$NON-NLS-1$
+ }
+
+ public void modify(Object element, String property, Object value) {
+ if (property.equals(FILENAME_PROPERTY)) {
+ TableItem item = (TableItem)element;
+ Map.Entry<IClasspathEntry, String> entry = (Map.Entry<IClasspathEntry, String>) item.getData();
+ if(entry.getKey().getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+ String name = value.toString();
+ if (checkValidName(name)) {
+ entry.setValue(name);
+ setErrorMessage(null);
+ }
+ classpathEntriesViewer.refresh();
+ }
+ }
+ }
+ }
+
+ public boolean checkValidName(String name) {
+ //TODO checks for :
+ // - duplicates
+ // - existing CPE
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IStatus result = workspace.validateName(name, IResource.FILE);
+ if (!result.isOK()) {
+ return false;
+ }
+ return (name.endsWith(".jar") || name.endsWith(".zip"));
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/handlers/MaterializeLibraryHandler.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/handlers/MaterializeLibraryHandler.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/handlers/MaterializeLibraryHandler.java 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,185 @@
+/*************************************************************************************
+ * 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.
+ ************************************************************************************/
+package org.jboss.tools.common.jdt.ui.buildpath.handlers;
+
+import java.util.Map;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceRuleFactory;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.packageview.ClassPathContainer;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.common.jdt.core.buildpath.MaterializeLibraryJob;
+import org.jboss.tools.common.jdt.ui.buildpath.dialog.MaterializeLibraryDialog;
+
+/**
+ * Materialize Library Handler.
+ *
+ * @author Fred Bricon
+ */
+
+@SuppressWarnings("restriction")
+public class MaterializeLibraryHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ ClassPathContainer libraryFromUI = getSelectedLibrary(selection);
+
+ if (libraryFromUI != null) {
+
+ IPath path = libraryFromUI.getClasspathEntry().getPath();
+
+ IJavaProject javaProject = libraryFromUI.getJavaProject();
+
+ final String libName = libraryFromUI.getLabel();
+
+ try {
+ IClasspathContainer containerToMaterialize = JavaCore.getClasspathContainer(path, javaProject);
+
+ IProject project = javaProject.getProject();
+
+ final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+
+ MaterializeLibraryDialog dialog = new MaterializeLibraryDialog(window.getShell(),
+ project,
+ containerToMaterialize,
+ getDefaultLib(libraryFromUI.getClasspathEntry())
+ );
+ if(dialog.open() == Dialog.OK) {
+ Map<IPath, String> jarsToMaterialize = dialog.getSelectedClasspathEntryPaths();
+
+ IFolder libFolder = dialog.getLibFolder();
+
+ Job job = new MaterializeLibraryJob(javaProject,
+ containerToMaterialize,
+ jarsToMaterialize,
+ libFolder);
+ job.setRule(getRule(project));
+ job.addJobChangeListener(new IJobChangeListener() {
+
+ @Override
+ public void sleeping(IJobChangeEvent arg0) {
+ }
+
+ @Override
+ public void scheduled(IJobChangeEvent arg0) {
+ }
+
+ @Override
+ public void running(IJobChangeEvent arg0) {
+ }
+
+ @Override
+ public void done(IJobChangeEvent changeEvent) {
+ final IStatus result = changeEvent.getResult();
+ if (IStatus.OK != result.getCode()) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ Shell shell = HandlerUtil.getActiveShell(event);
+ MessageDialogWithToggle.openError(shell, NLS.bind("Error Materializing {0}", libName), result.getMessage());
+ }
+ });
+ }
+ }
+
+ @Override
+ public void awake(IJobChangeEvent arg0) {
+ }
+
+ @Override
+ public void aboutToRun(IJobChangeEvent arg0) {
+ }
+ });
+ job.schedule();
+ }
+
+ } catch (JavaModelException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+ return null;
+ }
+
+ private String getDefaultLib(IClasspathEntry classpathEntry) {
+ String defaultLib = "lib";
+ //TODO look for the value of IClasspathAttribute "org.eclipse.jst.component.dependency"
+ //TODO Even if we get WEB-INF/lib from IClasspathAttribute, how do we get the first mapped source folder
+ //without depending on the component fwk? extension points (and new component adapter plugin)? reflection?
+ return defaultLib;
+ }
+
+ private ISchedulingRule getRule(IProject project) {
+ IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
+ ISchedulingRule rule = ruleFactory.buildRule();
+ return rule;
+ }
+
+ private ClassPathContainer getSelectedLibrary(ISelection selection) {
+ ClassPathContainer container = null;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ Object o = structuredSelection.getFirstElement();
+ if (o instanceof ClassPathContainer) {
+ container = (ClassPathContainer) o;
+ }
+ }
+ return container;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Added: trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/messages.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/messages.properties 2011-10-05 21:29:14 UTC (rev 35397)
@@ -0,0 +1,3 @@
+Materialize_Library=Materialize Library
+
+
Modified: trunk/common/plugins/pom.xml
===================================================================
--- trunk/common/plugins/pom.xml 2011-10-05 21:19:29 UTC (rev 35396)
+++ trunk/common/plugins/pom.xml 2011-10-05 21:29:14 UTC (rev 35397)
@@ -32,6 +32,8 @@
<module>org.jboss.tools.common.verification.ui</module>
<module>org.jboss.tools.common.jdt.debug</module>
<module>org.jboss.tools.common.jdt.debug.ui</module>
+ <module>org.jboss.tools.common.jdt</module>
+ <module>org.jboss.tools.common.jdt.ui</module>
</modules>
</project>
13 years, 3 months
JBoss Tools SVN: r35396 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 17:19:29 -0400 (Wed, 05 Oct 2011)
New Revision: 35396
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java
Log:
[JBIDE-9793] cleaned commented code
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java 2011-10-05 21:17:55 UTC (rev 35395)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java 2011-10-05 21:19:29 UTC (rev 35396)
@@ -60,14 +60,6 @@
}
public void loadCartridges() throws OpenshiftException {
-// final Collection<ICartridge> cartridges = user.getCartridges();
-// PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
-//
-// @Override
-// public void run() {
-// setCartridges(cartridges);
-// }
-// });
setCartridges(user.getCartridges());
}
13 years, 3 months
JBoss Tools SVN: r35395 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 17:17:55 -0400 (Wed, 05 Oct 2011)
New Revision: 35395
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
Log:
[JBIDE-9793] fixed typo
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-10-05 21:16:35 UTC (rev 35394)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-10-05 21:17:55 UTC (rev 35395)
@@ -274,7 +274,7 @@
private class DeleteApplicationJob extends Job {
public DeleteApplicationJob() {
- super("Deleteing application");
+ super("Deleting application");
}
@Override
13 years, 3 months
JBoss Tools SVN: r35394 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 17:16:35 -0400 (Wed, 05 Oct 2011)
New Revision: 35394
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java
Log:
[JBIDE-9793] "delete" application now refreshes the table, "new" dialog is not functional again
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-10-05 21:14:43 UTC (rev 35393)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-10-05 21:16:35 UTC (rev 35394)
@@ -122,7 +122,6 @@
GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).hint(80, 30).applyTo(detailsButton);
DataBindingUtils.bindEnablementToValidationStatus(detailsButton, IStatus.INFO, dbc , selectedApplicationBinding);
detailsButton.addSelectionListener(onDetails(dbc));
-
}
private IDoubleClickListener onApplicationDoubleClick() {
@@ -282,6 +281,13 @@
protected IStatus run(IProgressMonitor monitor) {
try {
model.destroyCurrentApplication();
+ getContainer().getShell().getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ viewer.refresh();
+ }
+ });
return Status.OK_STATUS;
} catch (OpenshiftException e) {
return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, NLS.bind(
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java 2011-10-05 21:14:43 UTC (rev 35393)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java 2011-10-05 21:16:35 UTC (rev 35394)
@@ -62,16 +62,17 @@
nameText.setTextLimit(13);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameText);
Binding nameBinding = dbc.bindValue(
- WidgetProperties.text().observe(nameText)
+ WidgetProperties.text(SWT.Modify).observe(nameText)
, BeanProperties.value(NewApplicationWizardPageModel.PROPERTY_NAME).observe(model)
, new UpdateValueStrategy().setAfterGetValidator(new ApplicationNameValidator())
, null);
ControlDecorationSupport.create(nameBinding, SWT.LEFT | SWT.TOP);
-
+
Label cartridgeLabel = new Label(parent, SWT.WRAP);
cartridgeLabel.setText("&Cartridge");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(cartridgeLabel);
Combo cartridgesCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cartridgesCombo);
dbc.bindList(
WidgetProperties.items().observe(cartridgesCombo)
, BeanProperties.list(NewApplicationWizardPageModel.PROPERTY_CARTRIDGES).observe(model)
@@ -86,9 +87,9 @@
return ((ICartridge) fromObject).getName();
}
}));
- dbc.bindValue(WidgetProperties.selection().observe(cartridgesCombo)
+ dbc.bindValue(
+ WidgetProperties.selection().observe(cartridgesCombo)
, BeanProperties.value(NewApplicationWizardPageModel.PROPERTY_SELECTED_CARTRIDGE).observe(model));
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cartridgesCombo);
}
@Override
@@ -99,6 +100,7 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
+
model.loadCartridges();
} catch (OpenshiftException e) {
return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, "Could not load cartridges", e);
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java 2011-10-05 21:14:43 UTC (rev 35393)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java 2011-10-05 21:16:35 UTC (rev 35394)
@@ -60,6 +60,14 @@
}
public void loadCartridges() throws OpenshiftException {
+// final Collection<ICartridge> cartridges = user.getCartridges();
+// PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+//
+// @Override
+// public void run() {
+// setCartridges(cartridges);
+// }
+// });
setCartridges(user.getCartridges());
}
@@ -92,6 +100,4 @@
return false;
}
}
-
-
}
13 years, 3 months
JBoss Tools SVN: r35393 - in trunk/as: tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 17:14:43 -0400 (Wed, 05 Oct 2011)
New Revision: 35393
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/InternalUser.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfoAware.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java
Log:
[JBIDE-9854] a new application will now force the user to re-request it's user info object
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java 2011-10-05 20:59:46 UTC (rev 35392)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java 2011-10-05 21:14:43 UTC (rev 35393)
@@ -67,7 +67,11 @@
@Override
public Date getCreationTime() throws OpenshiftException {
- return getApplicationInfo().getCreationTime();
+ ApplicationInfo applicationInfo = getApplicationInfo();
+ if (applicationInfo == null) {
+ throw new OpenshiftException("Could not find info for application {0}", getName());
+ }
+ return applicationInfo.getCreationTime();
}
@Override
@@ -120,7 +124,7 @@
protected IOpenshiftService getService() {
return service;
}
-
+
protected ApplicationInfo getApplicationInfo() throws OpenshiftException {
if (applicationInfo == null) {
this.applicationInfo = getUserInfo().getApplicationInfoByName(getName());
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/InternalUser.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/InternalUser.java 2011-10-05 20:59:46 UTC (rev 35392)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/InternalUser.java 2011-10-05 21:14:43 UTC (rev 35393)
@@ -195,6 +195,11 @@
this.sshKey = key;
}
+ protected UserInfo refreshUserInfo() throws OpenshiftException {
+ this.userInfo = null;
+ return getUserInfo();
+ }
+
protected UserInfo getUserInfo() throws OpenshiftException {
if (userInfo == null) {
this.userInfo = service.getUserInfo(this);
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfoAware.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfoAware.java 2011-10-05 20:59:46 UTC (rev 35392)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfoAware.java 2011-10-05 21:14:43 UTC (rev 35393)
@@ -23,7 +23,7 @@
protected UserInfo getUserInfo() throws OpenshiftException {
if (userInfo == null) {
- this.userInfo = user.getUserInfo();
+ this.userInfo = user.refreshUserInfo();
}
return userInfo;
}
Modified: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java 2011-10-05 20:59:46 UTC (rev 35392)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java 2011-10-05 21:14:43 UTC (rev 35393)
@@ -14,7 +14,10 @@
import static org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationAsserts.assertGitUri;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.util.Date;
+
import org.jboss.tools.openshift.express.client.IApplication;
import org.jboss.tools.openshift.express.client.ICartridge;
import org.jboss.tools.openshift.express.client.IOpenshiftService;
@@ -22,6 +25,8 @@
import org.jboss.tools.openshift.express.client.OpenshiftException;
import org.jboss.tools.openshift.express.client.OpenshiftService;
import org.jboss.tools.openshift.express.client.User;
+import org.jboss.tools.openshift.express.internal.client.ApplicationInfo;
+import org.jboss.tools.openshift.express.internal.client.UserInfo;
import org.jboss.tools.openshift.express.internal.client.test.fakes.TestUser;
import org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationUtils;
import org.junit.Before;
@@ -196,4 +201,43 @@
ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
+
+ @Test
+ public void returnsCreationTime() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ Date creationTime = application.getCreationTime();
+ assertNotNull(creationTime);
+ assertTrue(creationTime.compareTo(new Date()) == -1);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ /**
+ * This tests checks if the creation time is returned in the 2nd
+ * application. The creation time is only available in the
+ * {@link ApplicationInfo} which is held by the {@link UserInfo}. The
+ * UserInfo is fetched when the 1st application is created and then stored.
+ * The 2nd application has therefore to force the user to refresh the user
+ * info.
+ *
+ * @throws Exception
+ *
+ * @see UserInfo
+ * @see ApplicationInfo
+ */
+ @Test
+ public void returnsCreationTimeOn2ndApplication() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ Date creationTime = application.getCreationTime();
+ assertNotNull(creationTime);
+ assertTrue(creationTime.compareTo(new Date()) == -1);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
}
13 years, 3 months
JBoss Tools SVN: r35392 - trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 16:59:46 -0400 (Wed, 05 Oct 2011)
New Revision: 35392
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/MANIFEST.MF
Log:
[JBIDE-9841] corrected x-friend directive for hidden packages
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/MANIFEST.MF 2011-10-05 20:46:28 UTC (rev 35391)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/MANIFEST.MF 2011-10-05 20:59:46 UTC (rev 35392)
@@ -11,12 +11,12 @@
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: jboss-dmr-1.0.0.Final.jar,
.
-Export-Package: org.jboss.dmr;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+Export-Package: org.jboss.dmr;x-friends:="org.jboss.tools.openshift.express.client.test",
org.jboss.tools.openshift.express.client,
org.jboss.tools.openshift.express.client.utils,
- org.jboss.tools.openshift.express.internal.client;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
- org.jboss.tools.openshift.express.internal.client.request;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
- org.jboss.tools.openshift.express.internal.client.request.marshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
- org.jboss.tools.openshift.express.internal.client.response;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
- org.jboss.tools.openshift.express.internal.client.response.unmarshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
- org.jboss.tools.openshift.express.internal.client.utils;x-friends:="org.jboss.ide.eclipse.as.openshift.test"
+ org.jboss.tools.openshift.express.internal.client;x-friends:="org.jboss.tools.openshift.express.client.test",
+ org.jboss.tools.openshift.express.internal.client.request;x-friends:="org.jboss.tools.openshift.express.client.test",
+ org.jboss.tools.openshift.express.internal.client.request.marshalling;x-friends:="org.jboss.tools.openshift.express.client.test",
+ org.jboss.tools.openshift.express.internal.client.response;x-friends:="org.jboss.tools.openshift.express.client.test",
+ org.jboss.tools.openshift.express.internal.client.response.unmarshalling;x-friends:="org.jboss.tools.openshift.express.client.test",
+ org.jboss.tools.openshift.express.internal.client.utils;x-friends:="org.jboss.tools.openshift.express.client.test"
13 years, 3 months