Author: rob.stryker(a)jboss.com
Date: 2012-05-08 02:45:10 -0400 (Tue, 08 May 2012)
New Revision: 40843
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeClasspathCache.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeKey.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/DirectoryLibraryContainerInitializer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/DirectoryLibraryPage.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java
Log:
Removal of cruft code and creation of a model class to simplify activator
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathConstants.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathConstants.java 2012-05-08
06:43:21 UTC (rev 40842)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathConstants.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.classpath.core;
-
-import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
-
-
-public interface ClasspathConstants extends IJBossServerConstants {
-
-}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java 2012-05-08
06:43:21 UTC (rev 40842)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -10,20 +10,17 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.classpath.core;
-import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeLifecycleListener;
import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.RuntimeClasspathCache;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.RuntimeKey;
import org.osgi.framework.BundleContext;
/**
@@ -37,32 +34,6 @@
// The shared instance
private static ClasspathCorePlugin plugin;
- private static Map<RuntimeKey, IClasspathEntry[]> runtimeClasspaths;
-
- private IRuntimeLifecycleListener listener = new IRuntimeLifecycleListener() {
-
- public void runtimeRemoved(IRuntime runtime) {
- removeRuntimeClasspath(runtime);
- }
-
- public void runtimeChanged(IRuntime runtime) {
- removeRuntimeClasspath(runtime);
- }
-
- public void runtimeAdded(IRuntime runtime) {
-
- }
-
- private void removeRuntimeClasspath(IRuntime runtime) {
- if (runtime == null) {
- return;
- }
- RuntimeKey key = getRuntimeKey(runtime);
- if (key != null) {
- runtimeClasspaths.remove(key);
- }
- }
- };
/**
* The constructor
*/
@@ -76,8 +47,7 @@
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
- runtimeClasspaths = new HashMap<RuntimeKey, IClasspathEntry[]>();
- ServerCore.addRuntimeLifecycleListener(listener);
+ ServerCore.addRuntimeLifecycleListener(RuntimeClasspathCache.getInstance());
}
/*
@@ -87,8 +57,7 @@
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
- runtimeClasspaths = null;
- ServerCore.removeRuntimeLifecycleListener(listener);
+ ServerCore.removeRuntimeLifecycleListener(RuntimeClasspathCache.getInstance());
}
/**
@@ -107,17 +76,11 @@
}
public static Map<RuntimeKey, IClasspathEntry[]> getRuntimeClasspaths() {
- return runtimeClasspaths;
+ return RuntimeClasspathCache.getInstance().getRuntimeClasspaths();
}
public static RuntimeKey getRuntimeKey(IRuntime runtime) {
- if( runtime == null )
- return null;
-
- IJBossServerRuntime jbsrt =
(IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new
NullProgressMonitor());
- IPath loc = runtime.getLocation();
- String rtID = runtime.getRuntimeType().getId();
- IPath configPath = jbsrt == null ? null : jbsrt.getConfigurationFullPath();
- return new RuntimeKey(loc, configPath, rtID);
+ return RuntimeClasspathCache.getRuntimeKey(runtime);
}
+
}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/DirectoryLibraryContainerInitializer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/DirectoryLibraryContainerInitializer.java 2012-05-08
06:43:21 UTC (rev 40842)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/DirectoryLibraryContainerInitializer.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.classpath.core;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.ClasspathContainerInitializer;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-
-// Can't extend abstractclasspathcontainer since it assumes libraries are within our
plugins
-// TODO: need to implement resource change listeners like done in
FlexibleProjectContainer to be usefull.
-public class DirectoryLibraryContainerInitializer extends ClasspathContainerInitializer
{
-
- public static final String CONTAINER_ID =
"org.jboss.ide.eclipse.as.classpath.core.DirectoryLibraryContainer";
//$NON-NLS-1$
-
- @Override
- public void initialize(IPath containerPath, IJavaProject project)
- throws CoreException {
- int size = containerPath.segmentCount();
- if (size > 0)
- {
- if (containerPath.segment(0).equals(this.getClasspathContainerID()))
- {
- IClasspathContainer container = this.createClasspathContainer(project,
containerPath.removeFirstSegments(1));
- JavaCore.setClasspathContainer(containerPath, new IJavaProject[]
- {project}, new IClasspathContainer[]
- {container}, null);
- }
- }
- }
-
- private IClasspathContainer createClasspathContainer(IJavaProject project, IPath
containerPath) {
- return new DirectoryLibraryContainer(project, containerPath);
- }
-
- private String getClasspathContainerID() {
- return CONTAINER_ID;
- }
-
- static class DirectoryLibraryContainer implements IClasspathContainer {
-
- private final IResource file;
-
- final IClasspathEntry[] entries;
-
- private final IPath containerPath;
-
- private final IJavaProject project;
-
- public DirectoryLibraryContainer(IJavaProject project, IPath containerPath) {
- this.project = project;
- this.containerPath = containerPath;
-
- this.file = project.getProject().getWorkspace().getRoot().getFolder(containerPath);
-
-
- final List<IClasspathEntry> libraries = new ArrayList<IClasspathEntry>();
-
- try {
- if(file!=null && file.exists()) {
- file.accept(new IResourceProxyVisitor() {
- public boolean visit(IResourceProxy proxy) /* throws CoreException */{
- switch(proxy.getType()) {
- case IResource.FILE :
- if (proxy.getName().endsWith(".jar") ||
proxy.getName().endsWith(".zip")) { //$NON-NLS-1$ //$NON-NLS-2$
- libraries.add(JavaCore.newLibraryEntry(proxy.requestFullPath(), null,
null));
- }
- return false;
- case IResource.FOLDER :
- //TODO: recursive by default or ?
- return true;
- }
- return true;
- }
- }
- , IResource.NONE);
- }
- } catch (CoreException e) {
- // TODO: log
- e.printStackTrace();
- }
-
- entries = libraries.toArray(new IClasspathEntry[0]);
- }
-
- public IClasspathEntry[] getClasspathEntries() {
- return entries;
- }
-
- public String getDescription() {
- return file == null ?
- Messages.DirectoryLibraryContainerInitializer_libraries_found_no_dir :
- MessageFormat.format(Messages.DirectoryLibraryContainerInitializer_libraries_found_in_dir,
file.getProjectRelativePath().toString());
- }
-
- public int getKind() {
- return K_APPLICATION;
- }
-
- public IPath getPath() {
- return file.getProjectRelativePath();
- }
- }
-
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java 2012-05-08
06:43:21 UTC (rev 40842)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.classpath.core;
-
-import org.eclipse.core.runtime.IPath;
-
-public class RuntimeKey {
- private IPath location;
- private IPath configPath;
- private String id;
-
- public RuntimeKey(IPath location, IPath configPath, String id) {
- this.location = location;
- this.configPath = configPath;
- this.id = id;
- }
-
- public IPath getLocation() {
- return location;
- }
-
- public void setLocation(IPath location) {
- this.location = location;
- }
-
- public IPath getConfigPath() {
- return configPath;
- }
-
- public void setConfigPath(IPath configPath) {
- this.configPath = configPath;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((configPath == null) ? 0 : configPath.hashCode());
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result
- + ((location == null) ? 0 : location.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RuntimeKey other = (RuntimeKey) obj;
- if (configPath == null) {
- if (other.configPath != null)
- return false;
- } else if (!configPath.equals(other.configPath))
- return false;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- return true;
- }
-}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java 2012-05-08
06:43:21 UTC (rev 40842)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -15,7 +15,6 @@
import java.util.ArrayList;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
@@ -29,16 +28,16 @@
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.classpath.core.ClasspathConstants;
import org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin;
import org.jboss.ide.eclipse.as.classpath.core.Messages;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
/**
* @author Marshall
* @author Rob Stryker
*/
-public class EJB3ClasspathContainer implements IClasspathContainer, ClasspathConstants {
+public class EJB3ClasspathContainer implements IClasspathContainer, IJBossServerConstants
{
public static final String CONTAINER_ID =
"org.jboss.ide.eclipse.as.classpath.core.ejb3.classpathContainer";
//$NON-NLS-1$
public static final String DESCRIPTION =
Messages.EJB3ClasspathContainer_ejb3_description;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java 2012-05-08
06:43:21 UTC (rev 40842)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -29,11 +29,10 @@
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate;
import org.eclipse.wst.server.core.IRuntime;
-import org.jboss.ide.eclipse.as.classpath.core.ClasspathConstants;
import org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin;
import org.jboss.ide.eclipse.as.classpath.core.Messages;
-import org.jboss.ide.eclipse.as.classpath.core.RuntimeKey;
import
org.jboss.ide.eclipse.as.classpath.core.runtime.CustomRuntimeClasspathModel.IDefaultPathProvider;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
/**
* This class uses the "throw everything you can find" strategy
@@ -45,7 +44,7 @@
*/
public class ClientAllRuntimeClasspathProvider
extends RuntimeClasspathProviderDelegate
- implements ClasspathConstants {
+ implements IJBossServerConstants {
public ClientAllRuntimeClasspathProvider() {
// TODO Auto-generated constructor stub
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeClasspathCache.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeClasspathCache.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeClasspathCache.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.classpath.core.runtime;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeLifecycleListener;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+
+public class RuntimeClasspathCache implements IRuntimeLifecycleListener {
+ private static RuntimeClasspathCache instance = null;
+ public static RuntimeClasspathCache getInstance() {
+ if( instance == null )
+ instance = new RuntimeClasspathCache();
+ return instance;
+ }
+
+
+ private Map<RuntimeKey, IClasspathEntry[]> runtimeClasspaths;
+
+ RuntimeClasspathCache() {
+ runtimeClasspaths = new HashMap<RuntimeKey, IClasspathEntry[]>();
+ }
+ public void runtimeRemoved(IRuntime runtime) {
+ removeRuntimeClasspath(runtime);
+ }
+
+ public void runtimeChanged(IRuntime runtime) {
+ removeRuntimeClasspath(runtime);
+ }
+
+ public void runtimeAdded(IRuntime runtime) {
+
+ }
+
+ private void removeRuntimeClasspath(IRuntime runtime) {
+ if (runtime == null) {
+ return;
+ }
+ RuntimeKey key = getRuntimeKey(runtime);
+ if (key != null) {
+ runtimeClasspaths.remove(key);
+ }
+ }
+
+ public Map<RuntimeKey, IClasspathEntry[]> getRuntimeClasspaths() {
+ return runtimeClasspaths;
+ }
+
+ public static RuntimeKey getRuntimeKey(IRuntime runtime) {
+ if( runtime == null )
+ return null;
+
+ IJBossServerRuntime jbsrt =
(IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new
NullProgressMonitor());
+ IPath loc = runtime.getLocation();
+ String rtID = runtime.getRuntimeType().getId();
+ IPath configPath = jbsrt == null ? null : jbsrt.getConfigurationFullPath();
+ return new RuntimeKey(loc, configPath, rtID);
+ }
+
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeKey.java
(from rev 40814,
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeKey.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeKey.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.classpath.core.runtime;
+
+import org.eclipse.core.runtime.IPath;
+
+public class RuntimeKey {
+ private IPath location;
+ private IPath configPath;
+ private String id;
+
+ public RuntimeKey(IPath location, IPath configPath, String id) {
+ this.location = location;
+ this.configPath = configPath;
+ this.id = id;
+ }
+
+ public IPath getLocation() {
+ return location;
+ }
+
+ public void setLocation(IPath location) {
+ this.location = location;
+ }
+
+ public IPath getConfigPath() {
+ return configPath;
+ }
+
+ public void setConfigPath(IPath configPath) {
+ this.configPath = configPath;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((configPath == null) ? 0 : configPath.hashCode());
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result
+ + ((location == null) ? 0 : location.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ RuntimeKey other = (RuntimeKey) obj;
+ if (configPath == null) {
+ if (other.configPath != null)
+ return false;
+ } else if (!configPath.equals(other.configPath))
+ return false;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (location == null) {
+ if (other.location != null)
+ return false;
+ } else if (!location.equals(other.location))
+ return false;
+ return true;
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml 2012-05-08 06:43:21
UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml 2012-05-08 06:45:10
UTC (rev 40843)
@@ -7,13 +7,6 @@
class="org.jboss.ide.eclipse.as.classpath.ui.ejb3.JBossEJB3LibrariesPage"
id="org.jboss.ide.eclipse.as.classpath.core.ejb3.classpathContainer"
name="JBoss EJB3 Libraries"/>
- <!-- Cannot be enabled before resource change listening is implementd
(max)
- <classpathContainerPage
- class="org.jboss.ide.eclipse.as.classpath.ui.DirectoryLibraryPage"
- id="org.jboss.ide.eclipse.as.classpath.ui.libraryDirectoryPage"
- name="Directory with libraries">
- </classpathContainerPage>
- -->
</extension>
<extension
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/DirectoryLibraryPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/DirectoryLibraryPage.java 2012-05-08
06:43:21 UTC (rev 40842)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/DirectoryLibraryPage.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -1,119 +0,0 @@
-package org.jboss.ide.eclipse.as.classpath.ui;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
-import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.jboss.ide.eclipse.as.classpath.core.DirectoryLibraryContainerInitializer;
-
-public class DirectoryLibraryPage extends NewElementWizardPage implements
- IClasspathContainerPage, IClasspathContainerPageExtension {
- private IProject ownerProject;
- private String libsProjectName;
- private Combo projectsCombo;
-
- public DirectoryLibraryPage() {
- super("DirectoryLibrariesContainerPage"); //$NON-NLS-1$
-
- setTitle(Messages.DirectoryLibraryPage_Title);
- setDescription(Messages.DirectoryLibraryPage_Description);
- }
-
- public IClasspathEntry getSelection() {
- IPath path = new Path(DirectoryLibraryContainerInitializer.CONTAINER_ID);
-
- final int index = this.projectsCombo.getSelectionIndex();
- final String selectedProjectName = this.projectsCombo.getItem(index);
-
- if (this.ownerProject == null
- || !selectedProjectName.equals(this.ownerProject.getName())) {
- path = path.append(selectedProjectName);
- }
-
- return JavaCore.newContainerEntry(path);
- }
-
- public void setSelection(final IClasspathEntry cpentry) {
- final IPath path = cpentry == null ? null : cpentry.getPath();
-
- if (path == null || path.segmentCount() == 1) {
- if (this.ownerProject != null) {
- this.libsProjectName = this.ownerProject.getName();
- }
- } else {
- this.libsProjectName = path.segment(1);
- }
- }
-
- public void createControl(final Composite parent) {
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
-
- final Label label = new Label(composite, SWT.NONE);
- label.setText(Messages.DirectoryLibraryPage_LabelProject);
-
- final String[] webProjects = getWebProjects();
-
- this.projectsCombo = new Combo(composite, SWT.READ_ONLY);
- this.projectsCombo.setItems(webProjects);
-
- final int index;
-
- if (this.ownerProject != null) {
- index = indexOf(webProjects, this.libsProjectName);
- } else {
- if (this.projectsCombo.getItemCount() > 0) {
- index = 0;
- } else {
- index = -1;
- }
- }
-
- if (index != -1) {
- this.projectsCombo.select(index);
- }
-
- final GridData gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.minimumWidth = 100;
-
- this.projectsCombo.setLayoutData(gd);
-
- setControl(composite);
- }
-
- public boolean finish() {
- return true;
- }
-
- public void initialize(final IJavaProject project,
- final IClasspathEntry[] currentEntries) {
- this.ownerProject = (project == null ? null : project.getProject());
- }
-
- private static String[] getWebProjects() {
- return new String[] { Messages.DirectoryLibraryPage_WebProjects };
- }
-
- private static int indexOf(final String[] array, final String str) {
- for (int i = 0; i < array.length; i++) {
- if (array[i].equals(str)) {
- return i;
- }
- }
-
- return -1;
- }
-
-}
\ No newline at end of file
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java 2012-05-08
06:43:21 UTC (rev 40842)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java 2012-05-08
06:45:10 UTC (rev 40843)
@@ -51,8 +51,8 @@
import org.jboss.ide.eclipse.archives.webtools.filesets.FilesetDialog;
import org.jboss.ide.eclipse.archives.webtools.filesets.FilesetLabelProvider;
import org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin;
-import org.jboss.ide.eclipse.as.classpath.core.RuntimeKey;
import org.jboss.ide.eclipse.as.classpath.core.runtime.CustomRuntimeClasspathModel;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.RuntimeKey;
import
org.jboss.ide.eclipse.as.classpath.core.runtime.CustomRuntimeClasspathModel.IDefaultPathProvider;
import org.jboss.ide.eclipse.as.classpath.ui.ClasspathUIPlugin;
import org.jboss.ide.eclipse.as.classpath.ui.Messages;