Author: rob.stryker(a)jboss.com
Date: 2009-04-10 06:04:46 -0400 (Fri, 10 Apr 2009)
New Revision: 14649
Added:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/schema/nodeProvider.exsd
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/INodeProvider.java
Removed:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/IArchiveLibFileSet.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/ArchiveLibFileSetImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/LibFilesetWizard.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/LibFilesetInfoWizardPage.java
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceNodeFactory.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveDeltaPreNodeFactory.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ExtensionManager.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTest.java
Log:
JBIDE-122 - separating out JDT dependency into its own plugin
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2009-04-10
10:04:46 UTC (rev 14649)
@@ -11,8 +11,7 @@
org.eclipse.core.filesystem,
org.eclipse.core.resources,
org.eclipse.core.runtime,
- org.eclipse.core.variables,
- org.eclipse.jdt.core
+ org.eclipse.core.variables
Eclipse-LazyStart: true
Bundle-ClassPath: archivescore.jar,
archivescore-eclipse.jar,
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml 2009-04-10
09:56:23 UTC (rev 14648)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml 2009-04-10
10:04:46 UTC (rev 14649)
@@ -3,6 +3,7 @@
<plugin>
<extension-point id="archiveTypes" name="JBoss Tools Package
Type" schema="schema/archiveTypes.exsd"/>
<extension-point id="actionTypes" name="JBoss Tools Build Action
Type" schema="schema/actionTypes.exsd"/>
+ <extension-point id="nodeProvider" name="JBoss Tools Archives Node
Providers" schema="schema/nodeProvider.exsd"/>
<extension
id="archivesNature"
name="Project Archives Nature"
Added:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/schema/nodeProvider.exsd
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/schema/nodeProvider.exsd
(rev 0)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/schema/nodeProvider.exsd 2009-04-10
10:04:46 UTC (rev 14649)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.ide.eclipse.archives.core"
xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.ide.eclipse.archives.core"
id="nodeProvider" name="JBoss Tools Archives Node Providers"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="provider" minOccurs="1"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="provider">
+ <complexType>
+ <attribute name="class" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"
basedOn=":org.jboss.ide.eclipse.archives.core.model.other.internal.INodeProvider"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Deleted:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/IArchiveLibFileSet.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/IArchiveLibFileSet.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/IArchiveLibFileSet.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -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.archives.core.model;
-
-public interface IArchiveLibFileSet extends IArchiveFileSet {
- public static final String ATTRIBUTE_PREFIX =
"org.jboss.ide.eclipse.archives.core.model.IArchiveLibFileSet."; //$NON-NLS-1$
- public static final String ID_ATTRIBUTE = ATTRIBUTE_PREFIX + "id";
//$NON-NLS-1$
- public void setId(String id);
- public String getId();
-}
Deleted:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/ArchiveLibFileSetImpl.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/ArchiveLibFileSetImpl.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/ArchiveLibFileSetImpl.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -1,158 +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.archives.core.model.other.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.internal.core.JavaModelManager;
-import org.eclipse.jdt.internal.core.UserLibrary;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveLibFileSet;
-import
org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
-import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbLibFileSet;
-
-/**
- * An implementation for filesets
- * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
- *
- */
-public class ArchiveLibFileSetImpl extends ArchiveNodeImpl implements
- IArchiveLibFileSet {
-
- private IClasspathEntry[] entries = null;
- private FileWrapper[] wrappers = null;
- public ArchiveLibFileSetImpl() {
- this(new XbLibFileSet());
- }
-
- public ArchiveLibFileSetImpl (XbLibFileSet delegate) {
- super(delegate);
- }
-
- public String getId() {
- return getFileSetDelegate().getId();
- }
-
- public void setId(String id) {
- getFileSetDelegate().setId(id);
- resetScanner();
- }
-
- /*
- * @see IArchiveFileSet#matchesPath(IPath)
- */
- public boolean matchesPath(IPath globalPath) {
- return matchesPath(globalPath, false);
- }
-
- /*
- * @see
org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet#matchesPath(org.eclipse.core.runtime.IPath,
boolean)
- */
- public boolean matchesPath(IPath path, boolean inWorkspace) {
- //prime();
- return false;
- }
-
- /*
- * @see
org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet#getMatches(org.eclipse.core.runtime.IPath)
- */
- public FileWrapper[] getMatches(IPath path) {
- prime();
- ArrayList<FileWrapper> temp = new ArrayList<FileWrapper>();
- for( int i = 0; i < wrappers.length; i++ )
- if( wrappers[i].getWrapperPath().equals(path))
- temp.add(wrappers[i]);
- return (FileWrapper[]) temp.toArray(new FileWrapper[temp.size()]);
- }
-
- /*
- * @see IArchiveFileSet#findMatchingPaths()
- */
- public synchronized FileWrapper[] findMatchingPaths () {
- prime();
- return wrappers == null ? new FileWrapper[]{} : wrappers;
- }
-
- private synchronized void prime() {
- if( entries == null ) {
- UserLibrary lib =
JavaModelManager.getUserLibraryManager().getUserLibrary(getFileSetDelegate().getId());
- if( lib != null ) {
- entries = lib.getEntries();
- ArrayList<FileWrapper> list = new ArrayList<FileWrapper>();
- FileWrapper fw;
- for( int i = 0; i < entries.length; i++ ) {
- fw = new FileWrapper(entries[i].getPath().toFile(),
- entries[i].getPath(), getRootArchiveRelativePath(),
- entries[i].getPath().lastSegment());
- list.add(fw);
- }
- wrappers = (FileWrapper[]) list.toArray(new FileWrapper[list.size()]);
- } else {
- entries = new IClasspathEntry[]{};
- wrappers = new FileWrapper[]{};
- }
- }
- }
-
- /*
- * @see IArchiveNode#getNodeType()
- */
- public int getNodeType() {
- return TYPE_ARCHIVE_FILESET;
- }
-
- /*
- * filesets have no path of their own
- * and should not be the parents of any other node
- * so the parent is their base location
- * @see IArchiveNode#getRootArchiveRelativePath()
- */
- public IPath getRootArchiveRelativePath() {
- return getParent().getRootArchiveRelativePath();
- }
-
- /*
- * @see IArchiveFileSet#resetScanner()
- */
- public void resetScanner() {
- entries = null;
- wrappers = null;
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl#validateChild(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
- */
- public boolean validateModel() {
- return getAllChildren().length == 0 ? true : false;
- }
-
- /*
- * @see org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl#canBuild()
- */
- public boolean canBuild() {
- return super.canBuild();
- }
-
- protected XbLibFileSet getFileSetDelegate () {
- return (XbLibFileSet)nodeDelegate;
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("{id="); //$NON-NLS-1$
- sb.append(getFileSetDelegate().getId());
- return sb.toString();
- }
-
-}
Added:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/INodeProvider.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/INodeProvider.java
(rev 0)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/INodeProvider.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.archives.core.model.other.internal;
+
+import java.util.HashMap;
+
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
+
+public interface INodeProvider {
+ public boolean canCreateNode(XbPackageNode node);
+ public IArchiveNode createNode(XbPackageNode node);
+ public boolean canCreateDelta(IArchiveNode node);
+ public IArchiveNode createDelta(IArchiveNodeDelta parentDelta, IArchiveNode postChange,
+ HashMap attributeChanges, HashMap propertyChanges);
+}
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.core.model.other.internal;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
@@ -36,7 +37,9 @@
public static final String ARCHIVE_TYPES_EXTENSION_ID =
"org.jboss.ide.eclipse.archives.core.archiveTypes"; //$NON-NLS-1$
public static final String ACTION_TYPES_EXTENSION_ID =
"org.jboss.ide.eclipse.archives.core.actionTypes"; //$NON-NLS-1$
public static final String VARIABLE_PROVIDER_EXTENSION_ID =
"org.jboss.ide.eclipse.archives.core.variableProviders"; //$NON-NLS-1$
+ public static final String NODE_PROVIDER_EXTENSION_ID =
"org.jboss.ide.eclipse.archives.core.nodeProvider"; //$NON-NLS-1$
+
private IExtension[] findExtension (String extensionId) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(extensionId);
@@ -113,4 +116,33 @@
}
}
}
+
+
+
+ private static ArrayList<INodeProvider> nodeProviders = null;
+ public INodeProvider[] getNodeProviders() {
+ if (nodeProviders == null)
+ loadNodeProviders();
+ return (INodeProvider[]) nodeProviders.toArray(new
INodeProvider[nodeProviders.size()]);
+ }
+
+ private void loadNodeProviders() {
+ nodeProviders = new ArrayList<INodeProvider>();
+ IExtension[] extensions = findExtension(NODE_PROVIDER_EXTENSION_ID);
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement elements[] = extensions[i].getConfigurationElements();
+ for (int j = 0; j < elements.length; j++) {
+ try {
+ Object executable = elements[j].createExecutableExtension("class");
//$NON-NLS-1$
+ INodeProvider type = (INodeProvider)executable;
+ nodeProviders.add(type);
+ } catch (InvalidRegistryObjectException e) {
+ ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, e.getMessage(), e);
+ } catch( CoreException e ) {
+ ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, e.getMessage(), e);
+ }
+ }
+ }
+ }
+
}
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceNodeFactory.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceNodeFactory.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceNodeFactory.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -12,74 +12,44 @@
import java.util.HashMap;
-import org.eclipse.core.runtime.IPath;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveLibFileSet;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveDeltaPreNodeFactory;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeFactory;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbLibFileSet;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
public class WorkspaceNodeFactory extends ArchiveNodeFactory {
- public ArchiveLibFileSetImpl createLibFileset() {
- return new ArchiveLibFileSetImpl();
- }
public IArchiveNode createNode(XbPackageNode node) {
IArchiveNode sNode = super.createNode(node);
if( sNode == null ) {
- if (node instanceof XbLibFileSet) {
- return new ArchiveLibFileSetImpl((XbLibFileSet)node);
- }
+ return createNodeInternal(node);
}
return sNode;
}
- public IArchiveNode createDeltaNode(IArchiveNodeDelta parentDelta, IArchiveNode
postChange,
- HashMap attributeChanges, HashMap propertyChanges) {
- return new WorkspaceArchiveDeltaPreNodeFactory().createNode(parentDelta, postChange,
attributeChanges, propertyChanges);
- }
- public static class WorkspaceArchiveDeltaPreNodeFactory extends
ArchiveDeltaPreNodeFactory {
-
- public IArchiveNode createNode(IArchiveNodeDelta parentDelta, IArchiveNode postChange,
- HashMap attributeChanges, HashMap propertyChanges) {
- IArchiveNode superImpl = super.createNode(parentDelta, postChange, attributeChanges,
propertyChanges);
- if( superImpl == null ) {
- if( postChange instanceof ArchiveLibFileSetImpl ) {
- XbLibFileSet fs = createLibFileset((ArchiveLibFileSetImpl)postChange,
attributeChanges, propertyChanges);
- return new DeltaLibFileset(fs, parentDelta, postChange);
- }
- }
- return superImpl;
- }
-
- protected static XbLibFileSet createLibFileset(ArchiveLibFileSetImpl postChange,HashMap
attributeChanges, HashMap propertyChanges ) {
- XbLibFileSet fs = new XbLibFileSet((XbLibFileSet)postChange.getNodeDelegate());
- if( attributeChanges.containsKey(IArchiveLibFileSet.ID_ATTRIBUTE))
- fs.setId(getBeforeString(attributeChanges, IArchiveLibFileSet.ID_ATTRIBUTE));
- undoPropertyChanges(fs, propertyChanges);
- return fs;
- }
+ protected IArchiveNode createNodeInternal(XbPackageNode node) {
+ WorkspaceExtensionManager manager =
+ (WorkspaceExtensionManager)ArchivesCore.getInstance().getExtensionManager();
+ INodeProvider[] providers = manager.getNodeProviders();
+ for( int i = 0; i < providers.length; i++ )
+ if( providers[i].canCreateNode(node))
+ return providers[i].createNode(node);
+ return null;
}
- public static class DeltaLibFileset extends ArchiveLibFileSetImpl {
- // everything goes through the delegate or the parent. Simple
- private IArchiveNodeDelta parentDelta;
- private IArchiveNode impl;
- public DeltaLibFileset(XbLibFileSet fileset, IArchiveNodeDelta parentDelta,
IArchiveNode impl){
- super(fileset);
- this.parentDelta = parentDelta;
- this.impl = impl;
+ public IArchiveNode createDeltaNode(IArchiveNodeDelta parentDelta, IArchiveNode
postChange,
+ HashMap attributeChanges, HashMap propertyChanges) {
+ IArchiveNode node = new ArchiveDeltaPreNodeFactory().
+ createNode(parentDelta, postChange, attributeChanges, propertyChanges);
+ if( node == null ) {
+ WorkspaceExtensionManager manager =
+ (WorkspaceExtensionManager)ArchivesCore.getInstance().getExtensionManager();
+ INodeProvider[] providers = manager.getNodeProviders();
+ for( int i = 0; i < providers.length; i++ )
+ if( providers[i].canCreateDelta(postChange))
+ return providers[i].createDelta(parentDelta, postChange, attributeChanges,
propertyChanges);
}
- public IArchiveNode getParent() {
- return parentDelta == null ? null : parentDelta.getPreNode();
- }
- public IPath getProjectPath() {
- return impl.getProjectPath();
- }
- public IArchiveModelRootNode getModelRootNode() {
- return impl.getModelRootNode();
- }
+ return node;
}
}
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveDeltaPreNodeFactory.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveDeltaPreNodeFactory.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveDeltaPreNodeFactory.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -109,14 +109,14 @@
return pack;
}
- protected static boolean getBeforeBoolean(HashMap map, String key) {
+ public static boolean getBeforeBoolean(HashMap map, String key) {
NodeDelta delta = (NodeDelta)map.get(key);
if( delta != null ) {
return ((Boolean)delta.getBefore()).booleanValue();
}
return true;
}
- protected static String getBeforeString(HashMap map, String key) {
+ public static String getBeforeString(HashMap map, String key) {
NodeDelta delta = (NodeDelta)map.get(key);
if( delta != null ) {
return (String)delta.getBefore();
@@ -125,7 +125,7 @@
}
// set the properties here to what they were before the delta
- protected static void undoPropertyChanges(XbPackageNodeWithProperties node, HashMap
changes) {
+ public static void undoPropertyChanges(XbPackageNodeWithProperties node, HashMap
changes) {
String key;
NodeDelta val;
for( Iterator i = changes.keySet().iterator(); i.hasNext(); ) {
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF 2009-04-10
10:04:46 UTC (rev 14649)
@@ -10,11 +10,9 @@
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.jboss.ide.eclipse.archives.core,
- org.eclipse.jdt.ui;bundle-version="3.4.0",
org.eclipse.debug.ui;bundle-version="3.4.0",
org.eclipse.core.variables;bundle-version="3.2.100",
- org.eclipse.ui.navigator;bundle-version="3.3.100",
- org.eclipse.jdt.core;bundle-version="3.4.4"
+ org.eclipse.ui.navigator;bundle-version="3.3.100"
Eclipse-LazyStart: true
Export-Package: org.jboss.ide.eclipse.archives.ui,
org.jboss.ide.eclipse.archives.ui.actions,
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2009-04-10
09:56:23 UTC (rev 14648)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2009-04-10
10:04:46 UTC (rev 14649)
@@ -86,6 +86,16 @@
point="org.eclipse.ui.navigator.viewer">
<viewer
viewerId="org.jboss.ide.eclipse.archives.ui.ProjectArchivesView">
+ <popupMenu>
+ <insertionPoint
+
name="org.jboss.ide.eclipse.archives.ui.providers.initialSeparator"
+ separator="false">
+ </insertionPoint>
+ <insertionPoint
+
name="org.jboss.ide.eclipse.archives.ui.providers.endAddChildSeparator"
+ separator="false">
+ </insertionPoint>
+ </popupMenu>
</viewer>
<viewerContentBinding
viewerId="org.jboss.ide.eclipse.archives.ui.ProjectArchivesView">
@@ -128,7 +138,7 @@
id="org.jboss.ide.eclipse.archives.ui.archivesContent"
labelProvider="org.jboss.ide.eclipse.archives.ui.providers.ArchivesLabelProvider"
name="%NavigatorContent_ArchivesContent"
- priority="normal"
+ priority="higher"
providesSaveables="true">
<triggerPoints>
<or>
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ExtensionManager.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ExtensionManager.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ExtensionManager.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -11,12 +11,14 @@
package org.jboss.ide.eclipse.archives.ui;
import java.util.ArrayList;
+import java.util.Iterator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ILabelProvider;
import org.jboss.ide.eclipse.archives.ui.actions.NewArchiveAction;
/**
@@ -78,4 +80,25 @@
return contributions.toArray(new NewArchiveAction[contributions.size()]);
}
+
+
+ // Probably doesn't belong here but good enough
+ private static ArrayList<ILabelProvider> labelProviders = new
ArrayList<ILabelProvider>();
+ public static void addLabelProvider(ILabelProvider p) {
+ if( !labelProviders.contains(p))
+ labelProviders.add(p);
+ }
+ public static void removeLabelProvider(ILabelProvider p) {
+ labelProviders.remove(p);
+ }
+ public static ILabelProvider findLabelProvider(Object element) {
+ Iterator<ILabelProvider> i = labelProviders.iterator();
+ ILabelProvider l;
+ while(i.hasNext()) {
+ l = i.next();
+ if( l.getText(element) != null)
+ return l;
+ }
+ return null;
+ }
}
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -13,7 +13,6 @@
import java.util.Arrays;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
@@ -35,9 +34,12 @@
import org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveLibFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
+import org.jboss.ide.eclipse.archives.core.model.INamedContainerArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFileSetImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFolderImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
import org.jboss.ide.eclipse.archives.ui.ExtensionManager;
@@ -47,18 +49,20 @@
import
org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.WrappedProject;
import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesCommonView;
import org.jboss.ide.eclipse.archives.ui.wizards.FilesetWizard;
-import org.jboss.ide.eclipse.archives.ui.wizards.LibFilesetWizard;
import org.jboss.ide.eclipse.archives.ui.wizards.NewJARWizard;
public class ArchivesActionProvider extends CommonActionProvider {
public static final String NEW_PACKAGE_MENU_ID =
"org.jboss.ide.eclipse.archives.ui.newPackageMenu"; //$NON-NLS-1$
public static final String NODE_CONTEXT_MENU_ID =
"org.jboss.ide.eclipse.archives.ui.nodeContextMenu"; //$NON-NLS-1$
public static final String NEW_PACKAGE_ADDITIONS = "newPackageAdditions";
//$NON-NLS-1$
-
+ public static final String INITIAL_SEPARATOR_ID =
"org.jboss.ide.eclipse.archives.ui.providers.initialSeparator"; //$NON-NLS-1$
+ public static final String END_ADD_CHILD_SEPARATOR_ID =
"org.jboss.ide.eclipse.archives.ui.providers.endAddChildSeparator";
//$NON-NLS-1$
+
+
private MenuManager newPackageManager;
private NodeContribution[] nodePopupMenuContributions;
private NewArchiveAction[] newPackageActions;
- private Action editAction, deleteAction, newFolderAction, newFilesetAction,
newLibFilesetAction;
+ private Action editAction, deleteAction, newFolderAction, newFilesetAction;
private Action buildAction;
private ICommonViewerSite site;
@@ -88,7 +92,7 @@
}
addNewPackageActions(newPackageManager);
- IStructuredSelection selection = getSelection();
+ IStructuredSelection selection = getSelection(site);
if (selection != null && !selection.isEmpty()) {
Object element = selection.getFirstElement();
@@ -99,38 +103,36 @@
} else if( element instanceof IArchiveNode ){
IArchiveNode node = (IArchiveNode)element;
- if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE
- || node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER) {
- manager.add(newPackageManager);
- manager.add(newFolderAction);
- manager.add(newFilesetAction);
- manager.add(newLibFilesetAction);
- manager.add(new Separator());
+ if (node instanceof INamedContainerArchiveNode ) {
+ manager.insertAfter(INITIAL_SEPARATOR_ID, newFilesetAction);
+ manager.insertAfter(INITIAL_SEPARATOR_ID, newFolderAction);
+ manager.insertAfter(INITIAL_SEPARATOR_ID, newPackageManager);
+ manager.insertBefore(END_ADD_CHILD_SEPARATOR_ID, new
Separator(END_ADD_CHILD_SEPARATOR_ID));
}
- if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
+
+ if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE && node instanceof
ArchiveImpl) {
editAction.setText(ArchivesUIMessages.ProjectPackagesView_editPackageAction_label);
deleteAction.setText(ArchivesUIMessages.ProjectPackagesView_deletePackageAction_label);
editAction.setImageDescriptor(ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_PACKAGE_EDIT));
buildAction.setText(ArchivesUIMessages.ProjectPackagesView_buildArchiveAction_label);
- manager.add(buildAction);
- } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER) {
+ manager.insertAfter(END_ADD_CHILD_SEPARATOR_ID, buildAction);
+ manager.add(editAction);
+ manager.add(deleteAction);
+ } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER && node
instanceof ArchiveFolderImpl) {
editAction.setText(ArchivesUIMessages.ProjectPackagesView_editFolderAction_label);
deleteAction.setText(ArchivesUIMessages.ProjectPackagesView_deleteFolderAction_label);
editAction.setImageDescriptor(platformDescriptor(ISharedImages.IMG_OBJ_FOLDER));
- } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET) {
+ manager.add(editAction);
+ manager.add(deleteAction);
+ } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET && node
instanceof ArchiveFileSetImpl) {
editAction.setText(ArchivesUIMessages.ProjectPackagesView_editFilesetAction_label);
deleteAction.setText(ArchivesUIMessages.ProjectPackagesView_deleteFilesetAction_label);
- ImageDescriptor id = null;
- if( node instanceof IArchiveStandardFileSet)
- id =
ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_MULTIPLE_FILES);
- if( node instanceof IArchiveLibFileSet)
- id =
JavaUI.getSharedImages().getImageDescriptor(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_LIBRARY);
- if( id != null )
- editAction.setImageDescriptor(id);
+ ImageDescriptor id =
ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_MULTIPLE_FILES);
+ editAction.setImageDescriptor(id);
+ manager.add(editAction);
+ manager.add(deleteAction);
}
- manager.add(editAction);
- manager.add(deleteAction);
addContextMenuContributions(node, manager);
}
} else if( ProjectArchivesCommonView.getInstance().getCurrentProject() != null ){
@@ -150,11 +152,6 @@
createFileset();
}
};
- newLibFilesetAction = new
Action(ArchivesUIMessages.ProjectPackagesView_newLibFilesetAction_label,
ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_MULTIPLE_FILES)) {
- public void run () {
- createLibFileset();
- }
- };
deleteAction = new Action
(ArchivesUIMessages.ProjectPackagesView_deletePackageAction_label,
platformDescriptor(ISharedImages.IMG_TOOL_DELETE)) {
public void run () {
@@ -170,7 +167,7 @@
buildAction = new Action(ArchivesUIMessages.BuildArchivesNode,
ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_BUILD_PACKAGES)) {
public void run() {
- new BuildAction().run(getSelectedObject());
+ new BuildAction().run(getSelectedObject(site));
}
};
}
@@ -218,7 +215,7 @@
for( int i = 0; i < newPackageActions.length; i++ ) {
NewArchiveAction action = newPackageActions[i];
ActionWrapper wrapped = new ActionWrapper(action);
- wrapped.selectionChanged(getSelection());
+ wrapped.selectionChanged(getSelection(site));
manager.add(wrapped);
}
}
@@ -258,7 +255,7 @@
private void createFolder () {
IInputValidator validator = new IInputValidator () {
public String isValid(String newText) {
- IArchiveNode selected = getSelectedNode();
+ IArchiveNode selected = getSelectedNode(site);
boolean folderExists = false;
IArchiveNode[] folders = selected.getChildren(IArchiveNode.TYPE_ARCHIVE_FOLDER);
@@ -285,7 +282,7 @@
int response = dialog.open();
if (response == Dialog.OK) {
String[] folderPaths = dialog.getValue().split("[\\\\/]"); //$NON-NLS-1$
- IArchiveNode selected = getSelectedNode();
+ IArchiveNode selected = getSelectedNode(site);
IArchiveFolder current = null;
IArchiveFolder temp = null;
@@ -306,38 +303,23 @@
}
private void createFileset () {
- IArchiveNode selected = getSelectedNode();
+ IArchiveNode selected = getSelectedNode(site);
WizardDialog dialog = new WizardDialog(getShell(), new FilesetWizard(null, selected));
dialog.open();
}
-
- private void createLibFileset () {
- IArchiveNode selected = getSelectedNode();
- WizardDialog dialog = new WizardDialog(getShell(), new LibFilesetWizard(null,
selected));
- dialog.open();
- }
-
-
-
private void editSelectedNode () {
- IArchiveNode node = getSelectedNode();
+ IArchiveNode node = getSelectedNode(site);
if (node != null) {
- if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET) {
- if( node instanceof IArchiveStandardFileSet ) {
- IArchiveStandardFileSet fileset = (IArchiveStandardFileSet) node;
- WizardDialog dialog = new WizardDialog(getShell(), new FilesetWizard(fileset,
node.getParent()));
- dialog.open();
- } else {
- IArchiveLibFileSet fileset = (IArchiveLibFileSet) node;
- WizardDialog dialog = new WizardDialog(getShell(), new LibFilesetWizard(fileset,
node.getParent()));
- dialog.open();
- }
- } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
+ if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET && node instanceof
IArchiveStandardFileSet ) {
+ IArchiveStandardFileSet fileset = (IArchiveStandardFileSet) node;
+ WizardDialog dialog = new WizardDialog(getShell(), new FilesetWizard(fileset,
node.getParent()));
+ dialog.open();
+ } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE && node instanceof
IArchive) {
IArchive pkg = (IArchive) node;
WizardDialog dialog = new WizardDialog(getShell(), new NewJARWizard(pkg));
dialog.open();
- } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER) {
+ } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER && node
instanceof IArchiveFolder) {
// folder can do the model save here.
IArchiveFolder folder = (IArchiveFolder) node;
InputDialog dialog = new InputDialog(getShell(),
@@ -354,7 +336,7 @@
}
private void deleteSelectedNode () {
- IArchiveNode node = getSelectedNode();
+ IArchiveNode node = getSelectedNode(site);
if (node != null) {
final IArchiveNode parent = (IArchiveNode) node.getParent();
parent.removeChild(node);
@@ -364,23 +346,23 @@
}
- private IArchiveNode getSelectedNode () {
- Object selected = getSelectedObject();
+ public static IArchiveNode getSelectedNode (ICommonViewerSite site) {
+ Object selected = getSelectedObject(site);
if( selected instanceof IArchiveNode )
return ((IArchiveNode)selected);
return null;
}
- private Object getSelectedObject() {
- IStructuredSelection selection = getSelection();
+ public static Object getSelectedObject(ICommonViewerSite site) {
+ IStructuredSelection selection = getSelection(site);
if (selection != null && !selection.isEmpty())
return selection.getFirstElement();
return null;
}
- private IStructuredSelection getSelection() {
+ public static IStructuredSelection getSelection(ICommonViewerSite site) {
return (IStructuredSelection) site.getSelectionProvider().getSelection();
}
- private ImageDescriptor platformDescriptor(String desc) {
+ public static ImageDescriptor platformDescriptor(String desc) {
return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(desc);
}
private Shell getShell() {
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -11,22 +11,26 @@
package org.jboss.ide.eclipse.archives.ui.providers;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveAction;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveLibFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFileSetImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFolderImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
import org.jboss.ide.eclipse.archives.core.util.PathUtils;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.ExtensionManager;
import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
import
org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.DelayProxy;
import
org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.WrappedProject;
@@ -88,21 +92,29 @@
if( element instanceof IArchiveNode ) {
IArchiveNode node = (IArchiveNode) element;
if (node != null) {
- switch (node.getNodeType()) {
- case IArchiveNode.TYPE_ARCHIVE: {
- IArchive pkg = (IArchive) node;
- if (!pkg.isExploded())
- return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE);
- else
- return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE_EXPLODED);
- }
- case IArchiveNode.TYPE_ARCHIVE_FOLDER: return
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
- case IArchiveNode.TYPE_ARCHIVE_FILESET: {
- if( node instanceof IArchiveStandardFileSet )
- return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_MULTIPLE_FILES);
- else if( node instanceof IArchiveLibFileSet)
- return
JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_LIBRARY);
- }
+ if( isInternal(node)) {
+ switch (node.getNodeType()) {
+ case IArchiveNode.TYPE_ARCHIVE: {
+ if( node instanceof ArchiveImpl ) {
+ IArchive pkg = (IArchive) node;
+ if (!pkg.isExploded())
+ return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE);
+ else
+ return
ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE_EXPLODED);
+ }
+ }
+ case IArchiveNode.TYPE_ARCHIVE_FOLDER:
+ if( node instanceof ArchiveFolderImpl)
+ return
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+ case IArchiveNode.TYPE_ARCHIVE_FILESET: {
+ if( node instanceof ArchiveFileSetImpl )
+ return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_MULTIPLE_FILES);
+ }
+ } // end switch
+ } else {
+ ILabelProvider delegate = ExtensionManager.findLabelProvider(element);
+ if( delegate != null )
+ return delegate.getImage(element);
}
}
@@ -124,22 +136,30 @@
if( element instanceof DelayProxy )
return ArchivesUIMessages.Loading;
if( element instanceof IArchiveNode ) {
- switch (((IArchiveNode)element).getNodeType()) {
- case IArchiveNode.TYPE_ARCHIVE: return getPackageText((IArchive)element);
- case IArchiveNode.TYPE_ARCHIVE_FOLDER: return
getPackageFolderText((IArchiveFolder)element);
- case IArchiveNode.TYPE_ARCHIVE_ACTION: return
getArchiveActionText((IArchiveAction)element);
- case IArchiveNode.TYPE_ARCHIVE_FILESET: {
- if( element instanceof IArchiveStandardFileSet)
- return getPackageFileSetText((IArchiveFileSet)element);
- else if( element instanceof IArchiveLibFileSet)
- return ((IArchiveLibFileSet)element).getId();
+ if( isInternal((IArchiveNode)element)) {
+ switch (((IArchiveNode)element).getNodeType()) {
+ case IArchiveNode.TYPE_ARCHIVE: return getPackageText((IArchive)element);
+ case IArchiveNode.TYPE_ARCHIVE_FOLDER: return
getPackageFolderText((IArchiveFolder)element);
+ case IArchiveNode.TYPE_ARCHIVE_ACTION: return
getArchiveActionText((IArchiveAction)element);
+ case IArchiveNode.TYPE_ARCHIVE_FILESET: return
getPackageFileSetText((IArchiveFileSet)element);
}
+ } else {
+ ILabelProvider delegate = ExtensionManager.findLabelProvider(element);
+ if( delegate != null )
+ return delegate.getText(element);
}
-
}
return element.toString();
}
+ private boolean isInternal(IArchiveNode node) {
+ if( node instanceof ArchiveImpl ||
+ node instanceof ArchiveFolderImpl ||
+ node instanceof ArchiveFileSetImpl)
+ return true;
+ return false;
+ }
+
private String getPackageFolderText (IArchiveFolder folder) {
return folder.getName();
Deleted:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/LibFilesetWizard.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/LibFilesetWizard.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/LibFilesetWizard.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -1,81 +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.archives.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.Wizard;
-import org.jboss.ide.eclipse.archives.core.ArchivesCore;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveLibFileSet;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceNodeFactory;
-import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
-import org.jboss.ide.eclipse.archives.ui.PackagesUIPlugin;
-import org.jboss.ide.eclipse.archives.ui.wizards.pages.LibFilesetInfoWizardPage;
-
-/**
- *
- * @author "Rob Stryker" <rob.stryker(a)redhat.com>
- *
- */
-public class LibFilesetWizard extends Wizard {
-
- private LibFilesetInfoWizardPage page1;
- private IArchiveLibFileSet fileset;
- private IArchiveNode parentNode;
-
- public LibFilesetWizard(IArchiveLibFileSet fileset, IArchiveNode parentNode) {
- this.fileset = fileset;
- this.parentNode = parentNode;
- setWindowTitle(ArchivesUIMessages.LibFilesetWizard);
- }
-
- public boolean performFinish() {
- final boolean createFileset = this.fileset == null;
-
- if (createFileset)
- this.fileset = ((WorkspaceNodeFactory)
- ArchivesCore.getInstance().getNodeFactory()).createLibFileset();
- fillFilesetFromPage(fileset);
- try {
- getContainer().run(true, false, new IRunnableWithProgress () {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
- if (createFileset)
- parentNode.addChild(fileset);
- try {
- ArchivesModel.instance().save(fileset.getProjectPath(), monitor);
- } catch( ArchivesModelException ame ) {
- IStatus status = new Status(IStatus.ERROR, PackagesUIPlugin.PLUGIN_ID,
ArchivesUIMessages.ErrorCompletingWizard, ame);
- PackagesUIPlugin.getDefault().getLog().log(status);
- }
- }
- });
- } catch (InvocationTargetException e) {
- } catch (InterruptedException e) {
- } catch(Exception e) {}
- return true;
- }
-
- private void fillFilesetFromPage (IArchiveLibFileSet fileset) {
- fileset.setId(page1.getId());
- }
-
- public void addPages() {
- page1 = new LibFilesetInfoWizardPage(getShell(), fileset, parentNode);
- addPage(page1);
- }
-}
Deleted:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/LibFilesetInfoWizardPage.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/LibFilesetInfoWizardPage.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/LibFilesetInfoWizardPage.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -1,219 +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.archives.ui.wizards.pages;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement;
-import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElementAttribute;
-import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListLabelProvider;
-import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPUserLibraryElement;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveLibFileSet;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
-
-/**
- *
- * @author "Rob Stryker" <rob.stryker(a)redhat.com>
- *
- */
-public class LibFilesetInfoWizardPage extends WizardPage {
-
- private IArchiveNode parentNode;
- private IArchiveLibFileSet fileset;
- private String projectName, id;
- private Composite mainComposite;
- private TreeViewer viewer;
- private ArrayList elements;
- public LibFilesetInfoWizardPage (Shell parent, IArchiveLibFileSet fileset, IArchiveNode
parentNode) {
- super(ArchivesUIMessages.LibFilesetInfoWizardPage_new_title,
ArchivesUIMessages.LibFilesetInfoWizardPage_new_title, null);
-
- if (fileset == null) {
- setTitle(ArchivesUIMessages.LibFilesetInfoWizardPage_new_title);
- setMessage(ArchivesUIMessages.LibFilesetInfoWizardPage_new_message);
- } else {
- setTitle(ArchivesUIMessages.LibFilesetInfoWizardPage_edit_title);
- setMessage(ArchivesUIMessages.LibFilesetInfoWizardPage_edit_message);
- }
-
- this.fileset = fileset;
- this.parentNode = parentNode;
- projectName = parentNode.getProjectName();
- }
-
- public void createControl (Composite parent) {
- mainComposite = new Composite(parent, SWT.NONE);
- mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- mainComposite.setLayout(new FillLayout());
- viewer = new TreeViewer(mainComposite, SWT.BORDER | SWT.SINGLE);
- viewer.setContentProvider(getContentProvider());
- viewer.setLabelProvider(new CPListLabelProvider());
- elements= getElementList(createPlaceholderProject());
- viewer.setInput(new Object());
- addListener();
- setControl(mainComposite);
- }
-
- protected void addListener() {
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if( getFirstElement() instanceof CPUserLibraryElement ) {
- id = ((CPUserLibraryElement)getFirstElement()).getName();
- }
- validate();
- }
- });
- }
-
- protected Object getFirstElement() {
- IStructuredSelection sel = (IStructuredSelection)viewer.getSelection();
- return sel.getFirstElement();
- }
-
- protected ITreeContentProvider getContentProvider() {
- return new ITreeContentProvider() {
- public Object[] getChildren(Object element) {
- if (element instanceof CPUserLibraryElement) {
- CPUserLibraryElement elem= (CPUserLibraryElement) element;
- return elem.getChildren();
- }
- return new Object[]{};
- }
-
- public Object getParent(Object element) {
- if (element instanceof CPListElementAttribute) {
- return ((CPListElementAttribute) element).getParent();
- } else if (element instanceof CPListElement) {
- return ((CPListElement) element).getParentContainer();
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
- public Object[] getElements(Object inputElement) {
- return (Object[]) elements.toArray(new Object[elements.size()]);
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- }
- };
- }
-
-
- protected ArrayList getElementList(IJavaProject fDummyProject) {
- String[] names= JavaCore.getUserLibraryNames();
- ArrayList elements = new ArrayList();
- for (int i= 0; i < names.length; i++) {
- IPath path= new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append(names[i]);
- try {
- IClasspathContainer container= JavaCore.getClasspathContainer(path, fDummyProject);
- elements.add(new CPUserLibraryElement(names[i], container, fDummyProject));
- } catch (JavaModelException e) {
- }
- }
- return elements;
- }
- private static IJavaProject createPlaceholderProject() {
- String name= "####internal"; //$NON-NLS-1$
- IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- while (true) {
- IProject project= root.getProject(name);
- if (!project.exists()) {
- return JavaCore.create(project);
- }
- name += '1';
- }
- }
-
- private FormData createFormData(Object topStart, int topOffset, Object bottomStart, int
bottomOffset,
- Object leftStart, int leftOffset, Object rightStart, int rightOffset) {
- FormData data = new FormData();
-
- if( topStart != null ) {
- data.top = topStart instanceof Control ? new FormAttachment((Control)topStart,
topOffset) :
- new FormAttachment(((Integer)topStart).intValue(), topOffset);
- }
-
- if( bottomStart != null ) {
- data.bottom = bottomStart instanceof Control ? new
FormAttachment((Control)bottomStart, bottomOffset) :
- new FormAttachment(((Integer)bottomStart).intValue(), bottomOffset);
- }
-
- if( leftStart != null ) {
- data.left = leftStart instanceof Control ? new FormAttachment((Control)leftStart,
leftOffset) :
- new FormAttachment(((Integer)leftStart).intValue(), leftOffset);
- }
-
- if( rightStart != null ) {
- data.right = rightStart instanceof Control ? new FormAttachment((Control)rightStart,
rightOffset) :
- new FormAttachment(((Integer)rightStart).intValue(), rightOffset);
- }
-
- return data;
- }
-
-
-
-
- private boolean validate () {
- if( !( getFirstElement() instanceof CPUserLibraryElement )) {
- setPageComplete(false);
- return false;
- }
- setPageComplete(true);
- return true;
- }
-
- public String getId() {
- return id;
- }
-
- private void fillDefaults () {
- if (fileset != null) {
- id = fileset.getId();
- } else {
- id = null;
- }
-
- }
-
- protected double getDescriptorVersion() {
- return parentNode.getModelRootNode().getDescriptorVersion();
- }
-}
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF
===================================================================
---
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF 2009-04-10
10:04:46 UTC (rev 14649)
@@ -17,7 +17,8 @@
org.eclipse.jdt.launching;bundle-version="3.4.0",
org.jboss.ide.eclipse.archives.ui;bundle-version="1.0.0",
org.eclipse.jface;bundle-version="3.4.0",
- org.eclipse.jdt.core;bundle-version="3.4.4"
+ org.eclipse.jdt.core;bundle-version="3.4.4",
+ org.jboss.ide.eclipse.archives.jdt.integration;bundle-version="1.0.0"
Eclipse-LazyStart: true
Bundle-ClassPath: archivestest.jar
Export-Package: org.jboss.ide.eclipse.archives.test,
Modified:
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTest.java
===================================================================
---
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTest.java 2009-04-10
09:56:23 UTC (rev 14648)
+++
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTest.java 2009-04-10
10:04:46 UTC (rev 14649)
@@ -16,12 +16,11 @@
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeFactory;
-import org.jboss.ide.eclipse.archives.core.model.IArchivesLogger;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.ArchiveLibFileSetImpl;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceNodeFactory;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
+import org.jboss.ide.eclipse.archives.jdt.integration.model.ArchiveLibFileSetImpl;
+import org.jboss.ide.eclipse.archives.jdt.integration.model.LibFileSetNodeProvider;
/**
* @author rob.stryker <rob.stryker(a)redhat.com>
@@ -48,7 +47,7 @@
}
protected IArchiveFileSet createLibFileSet(String name) {
- ArchiveLibFileSetImpl lfsi = ((WorkspaceNodeFactory)getFactory()).createLibFileset();
+ ArchiveLibFileSetImpl lfsi = LibFileSetNodeProvider.createLibFileset();
lfsi.setId(name);
return lfsi;
}