JBoss Tools SVN: r14653 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/scanner.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-10 06:07:25 -0400 (Fri, 10 Apr 2009)
New Revision: 14653
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/scanner/JavaAnnotationScanner.java
Log:
JBIDE-4144
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/scanner/JavaAnnotationScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/scanner/JavaAnnotationScanner.java 2009-04-10 10:06:23 UTC (rev 14652)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/scanner/JavaAnnotationScanner.java 2009-04-10 10:07:25 UTC (rev 14653)
@@ -24,6 +24,7 @@
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.ASTRequestor;
import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.CompilationUnit;
@@ -192,7 +193,7 @@
}
IType type = null;
- AnnotatedASTNode<TypeDeclaration> annotatedType = null;
+ AnnotatedASTNode<AbstractTypeDeclaration> annotatedType = null;
Set<AnnotatedASTNode<FieldDeclaration>> annotatedFields = null;
Set<AnnotatedASTNode<MethodDeclaration>> annotatedMethods = null;
15 years, 8 months
JBoss Tools SVN: r14651 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core: scanner/java and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-10 06:06:23 -0400 (Fri, 10 Apr 2009)
New Revision: 14651
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLHelper.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java
Log:
JBIDE-4144
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLHelper.java 2009-04-10 10:05:09 UTC (rev 14650)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLHelper.java 2009-04-10 10:06:23 UTC (rev 14651)
@@ -5,6 +5,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
@@ -142,7 +143,14 @@
IJavaProject jp = JavaCore.create(project);
if(jp != null) {
try {
- return jp.findType(name);
+ IType type = jp.findType(name.replace('$', '.'));
+ if(type == null && name.indexOf('$') >= 0) {
+ int ii = name.lastIndexOf('.');
+ String pack = (ii < 0) ? "" : name.substring(0, ii);
+ String cls = name.substring(ii + 1);
+ type = jp.findType(pack, cls.replace('$', '.'), new NullProgressMonitor());
+ }
+ return type;
} catch (JavaModelException e) {
//ignore
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java 2009-04-10 10:05:09 UTC (rev 14650)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java 2009-04-10 10:06:23 UTC (rev 14651)
@@ -19,8 +19,11 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.EnumDeclaration;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.MarkerAnnotation;
import org.eclipse.jdt.core.dom.MethodDeclaration;
@@ -47,7 +50,7 @@
public IType type;
int innerLock = 0;
- public AnnotatedASTNode<TypeDeclaration> annotatedType = null;
+ public AnnotatedASTNode<AbstractTypeDeclaration> annotatedType = null;
public Set<AnnotatedASTNode<FieldDeclaration>> annotatedFields = new HashSet<AnnotatedASTNode<FieldDeclaration>>();
public Set<AnnotatedASTNode<MethodDeclaration>> annotatedMethods = new HashSet<AnnotatedASTNode<MethodDeclaration>>();
@@ -85,7 +88,7 @@
public boolean hasSeamComponent() {
return root.hasSeamComponent();
}
-
+
public boolean visit(SingleMemberAnnotation node) {
if(current.innerLock > 0) return false;
String type = resolveType(node);
@@ -142,6 +145,18 @@
}
public boolean visit(TypeDeclaration node) {
+ return _visit(node);
+ }
+
+ public boolean visit(EnumDeclaration node) {
+ return _visit(node);
+ }
+
+ public boolean visit(AnnotationTypeDeclaration node) {
+ return _visit(node);
+ }
+
+ private boolean _visit(AbstractTypeDeclaration node) {
if(current == null) {
String n = node.getName().getFullyQualifiedName();
if(n != null && n.indexOf('.') < 0) n = EclipseJavaUtil.resolveType(root.type, n);
@@ -150,7 +165,7 @@
current = root;
}
if(current.annotatedType == null) {
- current.annotatedType = new AnnotatedASTNode<TypeDeclaration>(node);
+ current.annotatedType = new AnnotatedASTNode<AbstractTypeDeclaration>(node);
current.currentAnnotatedNode = current.annotatedType;
} else {
String n = node.getName().getFullyQualifiedName();
@@ -182,14 +197,23 @@
d.parent = current;
current.children.add(d);
current = d;
- current.annotatedType = new AnnotatedASTNode<TypeDeclaration>(node);
+ current.annotatedType = new AnnotatedASTNode<AbstractTypeDeclaration>(node);
current.currentAnnotatedNode = current.annotatedType;
}
}
return true;
}
-
+
public void endVisit(TypeDeclaration node) {
+ _endVisit(node);
+ }
+ public void endVisit(AnnotationTypeDeclaration node) {
+ _endVisit(node);
+ }
+ public void endVisit(EnumDeclaration node) {
+ _endVisit(node);
+ }
+ public void _endVisit(AbstractTypeDeclaration node) {
if(current == null) return;
if(current.currentAnnotatedNode != null && current.currentAnnotatedNode.node == node) {
current.currentAnnotatedNode = null;
15 years, 8 months
JBoss Tools SVN: r14652 - in trunk/archives/plugins: org.jboss.ide.eclipse.archives.jdt.integration and 12 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-04-10 06:06:23 -0400 (Fri, 10 Apr 2009)
New Revision: 14652
Added:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.classpath
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.project
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.settings/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.settings/org.eclipse.jdt.core.prefs
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/META-INF/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/META-INF/MANIFEST.MF
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/build.properties
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/plugin.xml
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ArchiveJDTIntegrationPlugin.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/ArchiveLibFileSetImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/DeltaLibFileset.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/IArchiveLibFileSet.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/LibFileSetNodeProvider.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/WorkspaceJARArchiveType.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/JDTArchivesActionProvider.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/LibFilesetInfoWizardPage.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/LibFilesetWizard.java
Log:
JBIDE-122 - separating out JDT dependency into its own plugin
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.classpath
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.classpath (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.classpath 2009-04-10 10:06:23 UTC (rev 14652)
@@ -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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.project
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.project (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.project 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.archives.jdt.integration</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/.settings/org.eclipse.jdt.core.prefs 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,7 @@
+#Fri Apr 10 13:28:04 CST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/META-INF/MANIFEST.MF
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/META-INF/MANIFEST.MF (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/META-INF/MANIFEST.MF 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Archives JDT Integration Plug-in
+Bundle-SymbolicName: org.jboss.ide.eclipse.archives.jdt.integration;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.ide.eclipse.archives.jdt.integration.ArchiveJDTIntegrationPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.core;bundle-version="3.4.4",
+ org.eclipse.jdt.ui;bundle-version="3.4.2",
+ org.eclipse.core.resources;bundle-version="3.4.2",
+ org.jboss.ide.eclipse.archives.core;bundle-version="2.0.0",
+ org.jboss.ide.eclipse.archives.ui;bundle-version="1.0.0",
+ org.eclipse.ui.navigator;bundle-version="3.3.102"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.jboss.ide.eclipse.archives.jdt.integration.model,
+ org.jboss.ide.eclipse.archives.jdt.integration.ui
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/build.properties
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/build.properties (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/build.properties 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/plugin.xml
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/plugin.xml (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/plugin.xml 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.jboss.ide.eclipse.archives.core.nodeProvider">
+ <provider
+ class="org.jboss.ide.eclipse.archives.jdt.integration.model.LibFileSetNodeProvider">
+ </provider>
+ </extension>
+ <extension
+ point="org.jboss.ide.eclipse.archives.core.archiveTypes">
+ <packageType
+ class="org.jboss.ide.eclipse.archives.jdt.integration.model.WorkspaceJARArchiveType"
+ id="jar"
+ label="JAR"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+ <actionProvider
+ class="org.jboss.ide.eclipse.archives.jdt.integration.ui.JDTArchivesActionProvider"
+ id="org.jboss.ide.eclipse.archives.jdt.integration.ui.ArchivesActionProvider"
+ priority="highest">
+ <enablement>
+ <instanceof
+ value="java.lang.Object">
+ </instanceof>
+ </enablement>
+ </actionProvider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.navigator.viewer">
+ <viewerActionBinding
+ viewerId="org.jboss.ide.eclipse.archives.ui.ProjectArchivesView">
+ <includes>
+ <actionExtension
+ pattern="org.jboss.ide.eclipse.archives.jdt.integration.ui.ArchivesActionProvider">
+ </actionExtension>
+ </includes>
+ </viewerActionBinding>
+ </extension>
+</plugin>
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ArchiveJDTIntegrationPlugin.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ArchiveJDTIntegrationPlugin.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ArchiveJDTIntegrationPlugin.java 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,76 @@
+package org.jboss.ide.eclipse.archives.jdt.integration;
+
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.ide.eclipse.archives.jdt.integration.model.IArchiveLibFileSet;
+import org.jboss.ide.eclipse.archives.ui.ExtensionManager;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ArchiveJDTIntegrationPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.archives.jdt.integration";
+
+ // The shared instance
+ private static ArchiveJDTIntegrationPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public ArchiveJDTIntegrationPlugin() {
+ }
+
+ /*
+ * (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;
+ addProvider();
+ }
+
+ private ILabelProvider labelProvider;
+ protected void addProvider() {
+ labelProvider =
+ new LabelProvider() {
+ public Image getImage(Object element) {
+ if( element instanceof IArchiveLibFileSet)
+ return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_LIBRARY);
+ return null;
+ }
+ public String getText(Object element) {
+ if( element instanceof IArchiveLibFileSet)
+ return ((IArchiveLibFileSet)element).getId();
+ return null;
+ }
+ };
+ ExtensionManager.addLabelProvider(labelProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ ExtensionManager.removeLabelProvider(labelProvider);
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ArchiveJDTIntegrationPlugin getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/ArchiveLibFileSetImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/ArchiveLibFileSetImpl.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/ArchiveLibFileSetImpl.java 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * 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.jdt.integration.model;
+
+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.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.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/DeltaLibFileset.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/DeltaLibFileset.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/DeltaLibFileset.java 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,27 @@
+package org.jboss.ide.eclipse.archives.jdt.integration.model;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
+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.XbLibFileSet;
+
+public 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 getParent() {
+ return parentDelta == null ? null : parentDelta.getPreNode();
+ }
+ public IPath getProjectPath() {
+ return impl.getProjectPath();
+ }
+ public IArchiveModelRootNode getModelRootNode() {
+ return impl.getModelRootNode();
+ }
+}
\ No newline at end of file
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/IArchiveLibFileSet.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/IArchiveLibFileSet.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/IArchiveLibFileSet.java 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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.jdt.integration.model;
+
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+
+
+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();
+}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/LibFileSetNodeProvider.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/LibFileSetNodeProvider.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/LibFileSetNodeProvider.java 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,51 @@
+package org.jboss.ide.eclipse.archives.jdt.integration.model;
+
+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.ArchiveDeltaPreNodeFactory;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbLibFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.INodeProvider;
+
+public class LibFileSetNodeProvider implements INodeProvider {
+
+ public boolean canCreateNode(XbPackageNode node) {
+ return (node instanceof XbLibFileSet);
+ }
+
+ public IArchiveNode createNode(XbPackageNode node) {
+ if (node instanceof XbLibFileSet) {
+ return new ArchiveLibFileSetImpl((XbLibFileSet)node);
+ }
+ return null;
+ }
+
+ public boolean canCreateDelta(IArchiveNode node) {
+ return (node instanceof ArchiveLibFileSetImpl);
+ }
+
+ public IArchiveNode createDelta(IArchiveNodeDelta parentDelta,
+ IArchiveNode postChange, HashMap attributeChanges,
+ HashMap propertyChanges) {
+ if( postChange instanceof ArchiveLibFileSetImpl ) {
+ XbLibFileSet fs = createLibFileset((ArchiveLibFileSetImpl)postChange, attributeChanges, propertyChanges);
+ return new DeltaLibFileset(fs, parentDelta, postChange);
+ }
+ return null;
+ }
+
+ 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(ArchiveDeltaPreNodeFactory.getBeforeString(attributeChanges, IArchiveLibFileSet.ID_ATTRIBUTE));
+ ArchiveDeltaPreNodeFactory.undoPropertyChanges(fs, propertyChanges);
+ return fs;
+ }
+
+ public static ArchiveLibFileSetImpl createLibFileset() {
+ return new ArchiveLibFileSetImpl();
+ }
+
+}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/WorkspaceJARArchiveType.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/WorkspaceJARArchiveType.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/model/WorkspaceJARArchiveType.java 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.jdt.integration.model;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+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.ArchiveImpl;
+import org.jboss.ide.eclipse.archives.core.model.types.AbstractArchiveType;
+
+/**
+ * The default JAR package type will simply jar-up all the classes in a java project's output directory, and place it in the top-level of the project.
+ * The name of the resulting JAR will be the project's name followed by a ".jar" extension.
+ * @author Marshall
+ */
+public class WorkspaceJARArchiveType extends AbstractArchiveType {
+
+ public static final String TYPE_ID = "jar"; //$NON-NLS-1$
+
+ public IArchive createDefaultConfiguration(String projectName, IProgressMonitor monitor) {
+ //IPackageType t = this;
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ Assert.isNotNull(project);
+
+ IJavaProject javaProject = JavaCore.create(project);
+ Assert.isNotNull(javaProject);
+
+ if (monitor == null) monitor = new NullProgressMonitor();
+
+ monitor.beginTask(ArchivesCore.bind(ArchivesCoreMessages.CreatingDefaultJarConfig, project.getName()), 2);
+
+ IPath outputPath;
+ try {
+ outputPath = javaProject.getOutputLocation();
+ } catch (JavaModelException e) {
+ ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, e.getMessage(), e);
+ return null;
+ }
+
+ outputPath = outputPath.removeFirstSegments(1);
+ IContainer outputContainer = project.getFolder(outputPath);
+
+ IArchive jar = new ArchiveImpl();
+
+ jar.setDestinationPath(project.getLocation());
+ jar.setInWorkspace(true);
+ jar.setExploded(false);
+ jar.setName(project.getName() + ".jar"); //$NON-NLS-1$
+ jar.setArchiveType(this);
+
+ IArchiveStandardFileSet classes = new ArchiveFileSetImpl();
+ classes.setIncludesPattern("**/*"); //$NON-NLS-1$
+ classes.setRawSourcePath(outputContainer.getFullPath().toString());
+ classes.setInWorkspace(true);
+
+ try {
+ jar.addChild(classes);
+ } catch( ArchivesModelException ame ) {
+ }
+
+ monitor.worked(1);
+ monitor.done();
+
+ return jar;
+ }
+
+ // do nothing
+ public IArchive fillDefaultConfiguration(String projectName, IArchive topLevel, IProgressMonitor monitor) {
+ return null;
+ }
+}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/JDTArchivesActionProvider.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/JDTArchivesActionProvider.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/JDTArchivesActionProvider.java 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,120 @@
+package org.jboss.ide.eclipse.archives.jdt.integration.ui;
+
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.INamedContainerArchiveNode;
+import org.jboss.ide.eclipse.archives.jdt.integration.model.IArchiveLibFileSet;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.providers.ArchivesActionProvider;
+import org.jboss.ide.eclipse.archives.ui.wizards.FilesetWizard;
+
+public class JDTArchivesActionProvider extends CommonActionProvider {
+ private ICommonViewerSite site;
+ private Action newLibFilesetAction, editLibFilesetAction, deleteAction;
+
+ public JDTArchivesActionProvider() {
+ }
+
+ public void init(ICommonActionExtensionSite aSite) {
+ site = aSite.getViewSite();
+ createActions();
+ }
+
+ protected void createActions() {
+ newLibFilesetAction = new Action(
+ ArchivesUIMessages.ProjectPackagesView_newLibFilesetAction_label,
+ JavaUI.getSharedImages().getImageDescriptor(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_LIBRARY)) {
+ public void run() {
+ createLibFileset();
+ }
+ };
+
+ editLibFilesetAction = new Action(
+ ArchivesUIMessages.ProjectPackagesView_editFilesetAction_label,
+ JavaUI.getSharedImages().getImageDescriptor(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_LIBRARY)) {
+ public void run() {
+ editAction();
+ }
+ };
+
+ deleteAction = new Action (ArchivesUIMessages.ProjectPackagesView_deleteFilesetAction_label, platformDescriptor(ISharedImages.IMG_TOOL_DELETE)) {
+ public void run () {
+ deleteSelectedNode();
+ }
+ };
+
+ }
+
+ public void fillContextMenu(IMenuManager manager) {
+ IArchiveNode node = getSelectedNode();
+ if( node instanceof INamedContainerArchiveNode )
+ manager.insertBefore(ArchivesActionProvider.END_ADD_CHILD_SEPARATOR_ID, newLibFilesetAction);
+ if( node instanceof IArchiveLibFileSet) {
+ manager.insertAfter(ArchivesActionProvider.END_ADD_CHILD_SEPARATOR_ID, deleteAction);
+ manager.insertAfter(ArchivesActionProvider.END_ADD_CHILD_SEPARATOR_ID, editLibFilesetAction);
+ }
+ }
+
+
+ private void deleteSelectedNode () {
+ IArchiveNode node = getSelectedNode();
+ if (node != null) {
+ final IArchiveNode parent = (IArchiveNode) node.getParent();
+ parent.removeChild(node);
+ SaveArchivesJob job = new SaveArchivesJob(parent.getProjectPath());
+ job.schedule();
+ }
+ }
+
+
+ private void createLibFileset() {
+ IArchiveNode selected = getSelectedNode();
+ WizardDialog dialog = new WizardDialog(site.getShell(),
+ new LibFilesetWizard(null, selected));
+ dialog.open();
+ }
+
+ private void editAction() {
+ IArchiveNode node = getSelectedNode();
+ if (node != null) {
+ IArchiveLibFileSet fileset = (IArchiveLibFileSet) node;
+ WizardDialog dialog = new WizardDialog(site.getShell(), new LibFilesetWizard(fileset, node.getParent()));
+ dialog.open();
+ }
+ }
+
+ private IArchiveNode getSelectedNode() {
+ Object selected = getSelectedObject();
+ if (selected instanceof IArchiveNode)
+ return ((IArchiveNode) selected);
+ return null;
+ }
+
+ private Object getSelectedObject() {
+ IStructuredSelection selection = getSelection();
+ if (selection != null && !selection.isEmpty())
+ return selection.getFirstElement();
+ return null;
+ }
+
+ private IStructuredSelection getSelection() {
+ return (IStructuredSelection) site.getSelectionProvider()
+ .getSelection();
+ }
+
+ private ImageDescriptor platformDescriptor(String desc) {
+ return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(desc);
+ }
+
+}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/LibFilesetInfoWizardPage.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/LibFilesetInfoWizardPage.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/LibFilesetInfoWizardPage.java 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * 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.jdt.integration.ui;
+
+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.IArchiveNode;
+import org.jboss.ide.eclipse.archives.jdt.integration.model.IArchiveLibFileSet;
+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();
+ }
+}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/LibFilesetWizard.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/LibFilesetWizard.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.jdt.integration/src/org/jboss/ide/eclipse/archives/jdt/integration/ui/LibFilesetWizard.java 2009-04-10 10:06:23 UTC (rev 14652)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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.jdt.integration.ui;
+
+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.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.jdt.integration.model.IArchiveLibFileSet;
+import org.jboss.ide.eclipse.archives.jdt.integration.model.LibFileSetNodeProvider;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.PackagesUIPlugin;
+
+/**
+ *
+ * @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 = LibFileSetNodeProvider.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);
+ }
+}
15 years, 8 months
JBoss Tools SVN: r14649 - in trunk/archives: plugins/org.jboss.ide.eclipse.archives.core/META-INF and 12 other directories.
by jbosstools-commits@lists.jboss.org
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;
}
15 years, 8 months
JBoss Tools SVN: r14648 - in trunk/common/plugins/org.jboss.tools.common.projecttemplates: templates and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-04-10 05:56:23 -0400 (Fri, 10 Apr 2009)
New Revision: 14648
Removed:
trunk/common/plugins/org.jboss.tools.common.projecttemplates/lib/CommonMyFacesSet/
trunk/common/plugins/org.jboss.tools.common.projecttemplates/lib/CommonOracleADF/
trunk/common/plugins/org.jboss.tools.common.projecttemplates/lib/OracleADF/
trunk/common/plugins/org.jboss.tools.common.projecttemplates/lib/myFaces1.1.4/
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/myFaces/
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/oracleADFFaces/
Modified:
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFCapabilities.xml
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-3958 Removed ADF Faces and MyFaces project templates which are out of date.
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFCapabilities.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFCapabilities.xml 2009-04-10 05:33:40 UTC (rev 14647)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFCapabilities.xml 2009-04-10 09:56:23 UTC (rev 14648)
@@ -1,45 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<capabilities>
- <capability name="ADF">
- <library name="OracleADF" />
- <file-addition file-name="/WEB-INF/web.xml"
- label="Register the ADF Faces filter" x-path="/web-app">
- <![CDATA[ <filter>
- <filter-name>adfFaces</filter-name>
- <filter-class>
- oracle.adf.view.faces.webapp.AdfFacesFilter
- </filter-class>
- </filter>]]>
- </file-addition>
- <file-addition file-name="/WEB-INF/web.xml"
- label="Register the ADF Faces filter mapping" x-path="/web-app">
- <![CDATA[ <filter-mapping>
- <filter-name>adfFaces</filter-name>
- <!-- This assumes that the FacesServlet has been registered under the name "Faces Servlet" -->
- <servlet-name>Faces Servlet</servlet-name>
- </filter-mapping>]]>
- </file-addition>
- <file-addition file-name="/WEB-INF/web.xml"
- label="Register the ResourceServlet that would be used for serving the resources at runtime (images, javascripts and styles)" x-path="/web-app">
- <![CDATA[ <servlet>
- <servlet-name>resources</servlet-name>
- <servlet-class>
- oracle.adf.view.faces.webapp.ResourceServlet
- </servlet-class>
- </servlet>]]>
- </file-addition>
- <file-addition file-name="/WEB-INF/web.xml"
- label="Register the ResourceServlet mapping" x-path="/web-app">
- <![CDATA[ <servlet-mapping>
- <servlet-name>resources</servlet-name>
- <url-pattern>/adf/*</url-pattern>
- </servlet-mapping>]]>
- </file-addition>
- <file-addition file-name="/WEB-INF/faces-config.xml"
- label="Tell JSF to use the ADF Faces RenderKit" x-path="/faces-config/application">
- <![CDATA[ <default-render-kit-id>oracle.adf.core</default-render-kit-id>]]>
- </file-addition>
- </capability>
<capability name="Facelets">
<library name="facelets" />
<conflicting-library name="jsf-facelets.jar"/>
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml 2009-04-10 05:33:40 UTC (rev 14647)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml 2009-04-10 09:56:23 UTC (rev 14648)
@@ -17,11 +17,4 @@
<refLib type="servlet" location="../servlet" />
<projectTempl location="./jsf-1.2-facelets" />
</version>
- <version displayName="MyFaces 1.1.4">
- <lib type="core" location="../lib/myFaces1.1.4" />
- <lib type="common" location="../lib/CommonMyFacesSet" />
- <lib type="struts" location="../lib/Tiles" />
- <refLib type="servlet" location="../servlet" />
- <projectTempl location="./myFaces" />
- </version>
</versions>
\ No newline at end of file
15 years, 8 months
JBoss Tools SVN: r14647 - trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-04-10 01:33:40 -0400 (Fri, 10 Apr 2009)
New Revision: 14647
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
Log:
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-10 04:56:38 UTC (rev 14646)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-10 05:33:40 UTC (rev 14647)
@@ -3,22 +3,32 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper;
+import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.javabean.JavaMethodsSelectionDialog;
import org.jboss.tools.smooks.configuration.editors.javabean.JavaPropertiesSelectionDialog;
import org.jboss.tools.smooks.model.javabean.BindingsType;
@@ -26,18 +36,89 @@
public class SmooksUIUtils {
public static Composite createJavaTypeSearchFieldEditor(Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final EObject model) {
+ final IItemPropertyDescriptor propertyDescriptor, final EObject model) {
if (model instanceof EObject) {
final Resource resource = ((EObject) model).eResource();
URI uri = resource.getURI();
IResource workspaceResource = null;
if (uri.isPlatformResource()) {
String path = uri.toPlatformString(true);
- workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(
- new Path(path));
+ workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
JavaTypeFieldDialog dialog = new JavaTypeFieldDialog(workspaceResource);
- return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
- "Search Class", dialog, (EObject) model);
+ String displayName = propertyDescriptor.getDisplayName(model);
+ Hyperlink link = toolkit.createHyperlink(parent, displayName + " :", SWT.NONE);
+ final Composite classTextComposite = toolkit.createComposite(parent);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ classTextComposite.setLayoutData(gd);
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.marginHeight = 0;
+ fillLayout.marginWidth = 0;
+ classTextComposite.setLayout(fillLayout);
+ final SearchComposite searchComposite = new SearchComposite(classTextComposite, toolkit,
+ "Search Class", dialog, SWT.NONE);
+ Object editValue = getEditValue(propertyDescriptor, model);
+ if (editValue != null) {
+ searchComposite.getText().setText(editValue.toString());
+ }
+ searchComposite.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ Object value = propertyDescriptor.getPropertyValue(model);
+ if (value != null && value instanceof PropertyValueWrapper) {
+ Object editValue = ((PropertyValueWrapper) value).getEditableValue(model);
+ if (editValue != null) {
+ if (!editValue.equals(searchComposite.getText().getText())) {
+ propertyDescriptor.setPropertyValue(model, searchComposite.getText()
+ .getText());
+ }
+ } else {
+ propertyDescriptor.setPropertyValue(model, searchComposite.getText()
+ .getText());
+ }
+ } else {
+ propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
+ }
+ }
+ });
+ final IResource fresource = workspaceResource;
+ link.addHyperlinkListener(new IHyperlinkListener() {
+
+ public void linkActivated(HyperlinkEvent e) {
+ try {
+ if (fresource == null)
+ return;
+ if (fresource.getProject().hasNature(JavaCore.NATURE_ID)) {
+ IJavaProject javaProject = JavaCore.create(fresource.getProject());
+ String typeName = searchComposite.getText().getText();
+ IJavaElement result = javaProject.findType(typeName);
+ if (result != null)
+ JavaUI.openInEditor(result);
+ else {
+ MessageDialog.openInformation(classTextComposite.getShell(),
+ "Can't find type", "Can't find type \"" + typeName + "\" in \""
+ + javaProject.getProject().getName() + "\" project.");
+ }
+ }
+ } catch (PartInitException ex) {
+ SmooksConfigurationActivator.getDefault().log(ex);
+ } catch (JavaModelException ex) {
+ Display.getCurrent().beep(); // just for Dejan
+ } catch (CoreException ex) {
+ SmooksConfigurationActivator.getDefault().log(ex);
+ }
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+
+ }
+
+ public void linkExited(HyperlinkEvent e) {
+
+ }
+
+ });
+
+ toolkit.paintBordersFor(classTextComposite);
+ return classTextComposite;
}
}
return null;
@@ -62,10 +143,10 @@
}
return null;
}
-
- public static Composite createJavaMethodSearchFieldEditor(BindingsType container,
- Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor,
- String buttonName, final EObject model) {
+
+ public static Composite createJavaMethodSearchFieldEditor(BindingsType container, Composite parent,
+ FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor, String buttonName,
+ final EObject model) {
String classString = ((BindingsType) container).getClass_();
IJavaProject project = getJavaProject(container);
try {
@@ -73,7 +154,7 @@
Class<?> clazz = classLoader.loadClass(classString);
JavaMethodsSelectionDialog dialog = new JavaMethodsSelectionDialog(project, clazz);
return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
- "Select method", dialog, (EObject) model);
+ "Select method", dialog, (EObject) model);
} catch (JavaModelException e) {
// ignore
} catch (ClassNotFoundException e) {
@@ -82,9 +163,9 @@
return null;
}
- public static Composite createJavaPropertySearchFieldEditor(BindingsType container,
- Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor,
- String buttonName, final EObject model) {
+ public static Composite createJavaPropertySearchFieldEditor(BindingsType container, Composite parent,
+ FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor, String buttonName,
+ final EObject model) {
String classString = ((BindingsType) container).getClass_();
IJavaProject project = getJavaProject(container);
try {
@@ -92,7 +173,7 @@
Class<?> clazz = classLoader.loadClass(classString);
JavaPropertiesSelectionDialog dialog = new JavaPropertiesSelectionDialog(project, clazz);
return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
- "Select property", dialog, (EObject) model);
+ "Select property", dialog, (EObject) model);
} catch (JavaModelException e) {
// ignore
} catch (ClassNotFoundException e) {
@@ -111,8 +192,8 @@
}
public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, String buttonName, IFieldDialog dialog,
- final EObject model) {
+ final IItemPropertyDescriptor propertyDescriptor, String buttonName, IFieldDialog dialog,
+ final EObject model) {
String displayName = propertyDescriptor.getDisplayName(model);
toolkit.createLabel(parent, displayName + " :");
final Composite classTextComposite = toolkit.createComposite(parent);
@@ -122,8 +203,8 @@
fillLayout.marginHeight = 0;
fillLayout.marginWidth = 0;
classTextComposite.setLayout(fillLayout);
- final SearchComposite searchComposite = new SearchComposite(classTextComposite, toolkit,
- buttonName, dialog, SWT.NONE);
+ final SearchComposite searchComposite = new SearchComposite(classTextComposite, toolkit, buttonName,
+ dialog, SWT.NONE);
Object editValue = getEditValue(propertyDescriptor, model);
if (editValue != null) {
searchComposite.getText().setText(editValue.toString());
@@ -135,12 +216,10 @@
Object editValue = ((PropertyValueWrapper) value).getEditableValue(model);
if (editValue != null) {
if (!editValue.equals(searchComposite.getText().getText())) {
- propertyDescriptor.setPropertyValue(model, searchComposite.getText()
- .getText());
+ propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
}
} else {
- propertyDescriptor.setPropertyValue(model, searchComposite.getText()
- .getText());
+ propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
}
} else {
propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
15 years, 8 months
JBoss Tools SVN: r14646 - in trunk: archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model and 20 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-04-10 00:56:38 -0400 (Fri, 10 Apr 2009)
New Revision: 14646
Added:
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.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/IArchiveDeltaFactory.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeFactory.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveStandardFileSet.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeFactory.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbLibFileSet.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
Removed:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchiveNodeFactory.java
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.properties
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntArchivesCore.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.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.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeDeltaImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbAction.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFolder.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackage.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNode.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNodeWithProperties.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackages.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperty.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/xml/packages.xsd
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
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/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.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/ModelCreationTest.java
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/ModelTruezipBridgeTest.java
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelUtilTest.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/archivetypes/J2EEArchiveType.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/archivetypes/WarArchiveType.java
trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java
Log:
JBIDE-122 - yes that's right, 122 lol ;) Support for different fileset types
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -15,12 +15,14 @@
import org.jboss.ide.eclipse.archives.core.build.ModelChangeListenerWithRefresh;
import org.jboss.ide.eclipse.archives.core.build.PostBuildRefresher;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+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.IArchivesVFS;
import org.jboss.ide.eclipse.archives.core.model.IExtensionManager;
import org.jboss.ide.eclipse.archives.core.model.IPreferenceManager;
import org.jboss.ide.eclipse.archives.core.model.other.internal.ArchivesWorkspaceLogger;
import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceExtensionManager;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceNodeFactory;
import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspacePreferenceManager;
import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVFS;
import org.jboss.ide.eclipse.archives.core.project.ProjectUtils;
@@ -48,6 +50,10 @@
protected IArchivesVFS createVFS() {
return new WorkspaceVFS();
}
+
+ protected IArchiveNodeFactory createNodeFactory() {
+ return new WorkspaceNodeFactory();
+ }
public void preRegisterProject(IPath project) {
ProjectUtils.addProjectNature(project);
Added: 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 (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/IArchiveLibFileSet.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * 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();
+}
Added: 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 (rev 0)
+++ 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 04:56:38 UTC (rev 14646)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * 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/WorkspaceNodeFactory.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceNodeFactory.java (rev 0)
+++ 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 04:56:38 UTC (rev 14646)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.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.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 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;
+ }
+ }
+
+ 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 getParent() {
+ return parentDelta == null ? null : parentDelta.getPreNode();
+ }
+ public IPath getProjectPath() {
+ return impl.getProjectPath();
+ }
+ public IArchiveModelRootNode getModelRootNode() {
+ return impl.getModelRootNode();
+ }
+ }
+}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -25,7 +25,7 @@
import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
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.internal.ArchiveFileSetImpl;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
@@ -69,7 +69,7 @@
jar.setName(project.getName() + ".jar"); //$NON-NLS-1$
jar.setArchiveType(this);
- IArchiveFileSet classes = new ArchiveFileSetImpl();
+ IArchiveStandardFileSet classes = new ArchiveFileSetImpl();
classes.setIncludesPattern("**/*"); //$NON-NLS-1$
classes.setRawSourcePath(outputContainer.getFullPath().toString());
classes.setInWorkspace(true);
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -12,6 +12,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+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.IExtensionManager;
import org.jboss.ide.eclipse.archives.core.model.IPreferenceManager;
@@ -45,6 +46,7 @@
private IExtensionManager extensionManager;
private IPreferenceManager preferenceManager;
private IArchivesLogger logger;
+ private IArchiveNodeFactory nodeFactory;
public ArchivesCore(int runType) {
this.runType = runType;
@@ -52,13 +54,15 @@
extensionManager = createExtensionManager();
preferenceManager = createPreferenceManager();
logger = createLogger();
+ nodeFactory = createNodeFactory();
}
protected abstract IArchivesVFS createVFS();
protected abstract IExtensionManager createExtensionManager();
protected abstract IPreferenceManager createPreferenceManager();
protected abstract IArchivesLogger createLogger();
-
+ protected abstract IArchiveNodeFactory createNodeFactory();
+
public int getRunType() {
return runType;
}
@@ -74,6 +78,9 @@
public IArchivesLogger getLogger() {
return logger;
}
+ public IArchiveNodeFactory getNodeFactory() {
+ return nodeFactory;
+ }
public abstract void preRegisterProject(IPath project);
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -66,6 +66,7 @@
public static String RefreshProjectFailed;
public static String RegisterProjectFailed;
public static String RegisterProject;
+ public static String UnsupportedNodeType;
public static String ErrorPreSave;
public static String SaveArchivesJob;
public static String CreatingDefaultJarConfig;
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.properties
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.properties 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.properties 2009-04-10 04:56:38 UTC (rev 14646)
@@ -46,6 +46,7 @@
RefreshProjectFailed=Could not refresh project {0}
RegisterProjectFailed=Could not register project {0}
RegisterProject=Register Project
+UnsupportedNodeType=Unsupported Node Type: {0}
UnregisterProject=Unregister Project
SaveArchivesJob=Save archives job
ErrorPreSave=Problem executing pre-save runnable
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntArchivesCore.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntArchivesCore.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntArchivesCore.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -20,11 +20,13 @@
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.IActionType;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeFactory;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
import org.jboss.ide.eclipse.archives.core.model.IArchivesLogger;
import org.jboss.ide.eclipse.archives.core.model.IArchivesVFS;
import org.jboss.ide.eclipse.archives.core.model.IExtensionManager;
import org.jboss.ide.eclipse.archives.core.model.IPreferenceManager;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeFactory;
import org.jboss.ide.eclipse.archives.core.xpl.AntNLS;
/**
@@ -75,6 +77,10 @@
protected IArchivesVFS createVFS() {
return new AntVFS();
}
+
+ protected IArchiveNodeFactory createNodeFactory() {
+ return new ArchiveNodeFactory();
+ }
public void preRegisterProject(IPath project) {
// do nothing
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -83,16 +83,12 @@
ArchivesCore.getInstance().getVFS().getProjectName(project)), nodes.length * 1000);
for( int i = 0; i < nodes.length; i++ ) {
- errors.addAll(Arrays.asList(fullArchiveBuild(((IArchive)nodes[i]),
- new SubProgressMonitor(monitor, 1000), false)));
+ errors.addAll(Arrays.asList(
+ fullArchiveBuild(
+ ((IArchive)nodes[i]),
+ new SubProgressMonitor(monitor, 1000),
+ false)));
}
-// IStatus result;
-// for( int i = 0; i < nodes.length; i++ ) {
-// result = fullArchiveBuild(((IArchive)nodes[i]),
-// new SubProgressMonitor(monitor, 1000), false);
-// if( !result.isOK())
-// errors.addAll(Arrays.asList(result.getChildren()));
-// }
EventManager.finishedBuild(project);
EventManager.error(null, errors.toArray(new IStatus[errors.size()]));
Deleted: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchiveNodeFactory.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchiveNodeFactory.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchiveNodeFactory.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -1,39 +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;
-
-import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveActionImpl;
-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;
-
-/**
- * Just a factory for extenders to access our secret internals
- * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
- *
- */
-public class ArchiveNodeFactory {
- public static IArchive createArchive() {
- return new ArchiveImpl();
- }
-
- public static IArchiveFileSet createFileset() {
- return new ArchiveFileSetImpl();
- }
-
- public static IArchiveFolder createFolder() {
- return new ArchiveFolderImpl();
- }
-
- public static IArchiveAction createAction() {
- return new ArchiveActionImpl();
- }
-}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -35,7 +35,7 @@
public double version;
};
- public static DirectoryScannerExtension createDirectoryScanner(IArchiveFileSet fs, boolean scan) {
+ public static DirectoryScannerExtension createDirectoryScanner(IArchiveStandardFileSet fs, boolean scan) {
return createDirectoryScanner(fs.getRawSourcePath(), fs.getRootArchiveRelativePath(),
fs.getIncludesPattern(), fs.getExcludesPattern(), fs.getProjectName(),
fs.isInWorkspace(), fs.getDescriptorVersion(), scan);
@@ -92,9 +92,9 @@
IPath translatedPath = new Path(PathUtils.getAbsoluteLocation(path, fs.projectName, fs.inWorkspace, fs.version));
if( workspaceRelative ) {
IPath p = PathUtils.getGlobalLocation(path, fs.projectName, true, fs.version);
- setBasedir(new FileWrapper(p.toFile(), translatedPath));
+ setBasedir(new FileWrapper(p.toFile(), translatedPath, fs.rootArchiveRelativePath));
} else {
- setBasedir(new FileWrapper(translatedPath.toFile(), translatedPath));
+ setBasedir(new FileWrapper(translatedPath.toFile(), translatedPath, fs.rootArchiveRelativePath));
}
}
@@ -115,7 +115,7 @@
return super.getChild(file, element);
FileWrapper pWrapper = (FileWrapper)file;
File child = super.getChild(file, element);
- FileWrapper childWrapper = new FileWrapper(child, pWrapper.getWrapperPath().append(element));
+ FileWrapper childWrapper = new FileWrapper(child, pWrapper.getWrapperPath().append(element), fs.rootArchiveRelativePath);
return childWrapper;
}
@@ -129,7 +129,7 @@
IPath[] childrenAbsolute = globalize(childrenWorkspace);
File[] files = new File[childrenAbsolute.length];
for( int i = 0; i < files.length; i++ ) {
- files[i] = new FileWrapper(childrenAbsolute[i].toFile(), childrenWorkspace[i]);
+ files[i] = new FileWrapper(childrenAbsolute[i].toFile(), childrenWorkspace[i], fs.rootArchiveRelativePath);
}
return files;
}
@@ -147,7 +147,7 @@
if( children != null ) {
FileWrapper[] children2 = new FileWrapper[children.length];
for( int i = 0; i < children.length; i++ )
- children2[i] = new FileWrapper(children[i], new Path(children[i].getAbsolutePath()));
+ children2[i] = new FileWrapper(children[i], new Path(children[i].getAbsolutePath()), fs.rootArchiveRelativePath);
return children2;
}
return new FileWrapper[]{};
@@ -184,7 +184,7 @@
return matchesMap;
}
- public class FileWrapper extends File {
+ public static class FileWrapper extends File {
// The actual source file
File f;
@@ -193,12 +193,18 @@
// the path of this file relative to the fileset
String fsRelative;
-
- public FileWrapper(File delegate, IPath path2) {
+ IPath rootArchiveRelativePath;
+ public FileWrapper(File delegate, IPath path2, IPath rootArchiveRelative) {
super(delegate.getAbsolutePath());
f = delegate;
path = path2;
+ rootArchiveRelativePath = rootArchiveRelative;
}
+ public FileWrapper(File delegate, IPath path2, IPath rootArchiveRelative, String fsRelative) {
+ this(delegate, path2, rootArchiveRelative);
+ this.fsRelative = fsRelative;
+ }
+
public IPath getWrapperPath() {
return path;
}
@@ -215,8 +221,8 @@
}
public IPath getRootArchiveRelative() {
- if( fs.rootArchiveRelativePath != null )
- return fs.rootArchiveRelativePath.append(fsRelative);
+ if( rootArchiveRelativePath != null )
+ return rootArchiveRelativePath.append(fsRelative);
return null;
}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveDeltaFactory.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveDeltaFactory.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveDeltaFactory.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -0,0 +1,5 @@
+package org.jboss.ide.eclipse.archives.core.model;
+
+public interface IArchiveDeltaFactory {
+
+}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -23,75 +23,13 @@
* @version $Revision: 1930 $
*/
public interface IArchiveFileSet extends IArchiveNode {
- public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFileSet."; //$NON-NLS-1$
- public static final String INCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "includes"; //$NON-NLS-1$
- public static final String EXCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "excludes"; //$NON-NLS-1$
- public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace"; //$NON-NLS-1$
- public static final String FLATTENED_ATTRIBUTE = ATTRIBUTE_PREFIX + "flattened"; //$NON-NLS-1$
- public static final String SOURCE_PATH_ATTRIBUTE = ATTRIBUTE_PREFIX + "sourcePath"; //$NON-NLS-1$
/**
- * @return Whether or not this fileset's basedir is inside the workspace
- */
- public boolean isInWorkspace();
-
- /**
- * @return Whether or not the fileset is flattened
- */
- public boolean isFlattened();
-
- /**
- * @return the source path from the delegate with no translation at all
- */
- public String getRawSourcePath();
-
- /**
* Force the scanner to check for matched files again
*/
public void resetScanner();
-
+
/**
- * @return The includes pattern for this fileset
- */
- public String getIncludesPattern();
-
- /**
- * @return The excludes pattern for this fileset
- */
- public String getExcludesPattern();
-
- /**
- * Sets the "root" or "source" of this fileset (file-system or workspace relative)
- * @param path The absolute path that is the source of this fileset
- */
- public void setRawSourcePath (String raw);
-
- /**
- * Set the includes pattern for this fileset. This pattern uses the same syntax as Ant's include pattern.
- * @param includes The includes pattern for this fileset
- */
- public void setIncludesPattern(String includes);
-
- /**
- * Set the excludes pattern for this fileset. This pattern uses the same syntax as Ant's exclude pattern.
- * @param excludes The excludes pattern for this fileset
- */
- public void setExcludesPattern(String excludes);
-
- /**
- * Set whether or not this fileset's source is in the workspace. This will automatically be handled if you
- * use setSingleFile, setSourceProject, setSourceContainer, or setSourceFolder.
- * @param isInWorkspace Whether or not this fileset's source is in the workspace
- */
- public void setInWorkspace(boolean isInWorkspace);
-
- /**
- * Sets whether or not this fileset is flattened.
- */
- public void setFlattened(boolean flattened);
-
-
- /**
* @return An array of matching IPath's in the filesystem (for external filesystem filesets)
*/
public FileWrapper[] findMatchingPaths();
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeFactory.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeFactory.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeFactory.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -0,0 +1,16 @@
+package org.jboss.ide.eclipse.archives.core.model;
+
+import java.util.HashMap;
+
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
+
+
+public interface IArchiveNodeFactory {
+ public IArchive createArchive();
+ public IArchiveStandardFileSet createFileset();
+ public IArchiveFolder createFolder();
+ public IArchiveAction createAction();
+ public IArchiveNode createNode(XbPackageNode node);
+ public IArchiveNode createDeltaNode(IArchiveNodeDelta parentDelta, IArchiveNode postChange,
+ HashMap attributeChanges, HashMap propertyChanges);
+}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveStandardFileSet.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveStandardFileSet.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveStandardFileSet.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -0,0 +1,65 @@
+package org.jboss.ide.eclipse.archives.core.model;
+
+public interface IArchiveStandardFileSet extends IArchiveFileSet {
+ public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFileSet."; //$NON-NLS-1$
+ public static final String INCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "includes"; //$NON-NLS-1$
+ public static final String EXCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "excludes"; //$NON-NLS-1$
+ public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace"; //$NON-NLS-1$
+ public static final String FLATTENED_ATTRIBUTE = ATTRIBUTE_PREFIX + "flattened"; //$NON-NLS-1$
+ public static final String SOURCE_PATH_ATTRIBUTE = ATTRIBUTE_PREFIX + "sourcePath"; //$NON-NLS-1$
+
+ /**
+ * @return Whether or not this fileset's basedir is inside the workspace
+ */
+ public boolean isInWorkspace();
+
+ /**
+ * @return Whether or not the fileset is flattened
+ */
+ public boolean isFlattened();
+
+ /**
+ * @return the source path from the delegate with no translation at all
+ */
+ public String getRawSourcePath();
+
+ /**
+ * @return The includes pattern for this fileset
+ */
+ public String getIncludesPattern();
+
+ /**
+ * @return The excludes pattern for this fileset
+ */
+ public String getExcludesPattern();
+
+ /**
+ * Sets the "root" or "source" of this fileset (file-system or workspace relative)
+ * @param path The absolute path that is the source of this fileset
+ */
+ public void setRawSourcePath (String raw);
+
+ /**
+ * Set the includes pattern for this fileset. This pattern uses the same syntax as Ant's include pattern.
+ * @param includes The includes pattern for this fileset
+ */
+ public void setIncludesPattern(String includes);
+
+ /**
+ * Set the excludes pattern for this fileset. This pattern uses the same syntax as Ant's exclude pattern.
+ * @param excludes The excludes pattern for this fileset
+ */
+ public void setExcludesPattern(String excludes);
+
+ /**
+ * Set whether or not this fileset's source is in the workspace. This will automatically be handled if you
+ * use setSingleFile, setSourceProject, setSourceContainer, or setSourceFolder.
+ * @param isInWorkspace Whether or not this fileset's source is in the workspace
+ */
+ public void setInWorkspace(boolean isInWorkspace);
+
+ /**
+ * Sets whether or not this fileset is flattened.
+ */
+ public void setFlattened(boolean flattened);
+}
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-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveDeltaPreNodeFactory.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -14,11 +14,13 @@
import java.util.Iterator;
import org.eclipse.core.runtime.IPath;
+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.IArchiveModelRootNode;
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.ArchiveNodeDeltaImpl.NodeDelta;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
@@ -39,37 +41,45 @@
public class ArchiveDeltaPreNodeFactory {
// children get added later
- public static ArchiveNodeImpl createNode(ArchiveNodeDeltaImpl parentDelta, ArchiveNodeImpl postChange,
+ public IArchiveNode createNode(IArchiveNodeDelta parentDelta, IArchiveNode postChange,
HashMap attributeChanges, HashMap propertyChanges) {
switch(postChange.getNodeType()) {
case IArchiveNode.TYPE_ARCHIVE_FILESET:
- XbFileSet fs = createFileset((ArchiveFileSetImpl)postChange, attributeChanges, propertyChanges);
- return new DeltaFileset(fs, parentDelta, postChange);
+ if( postChange instanceof IArchiveStandardFileSet) {
+ XbFileSet fs = createFileset((ArchiveFileSetImpl)postChange, attributeChanges, propertyChanges);
+ return new DeltaFileset(fs, parentDelta, postChange);
+ }
+ break;
case IArchiveNode.TYPE_ARCHIVE_FOLDER:
- XbFolder folder = createFolder((ArchiveFolderImpl)postChange, attributeChanges, propertyChanges);
- return new DeltaFolder(folder, parentDelta, postChange);
+ if( postChange instanceof ArchiveFolderImpl) {
+ XbFolder folder = createFolder((ArchiveFolderImpl)postChange, attributeChanges, propertyChanges);
+ return new DeltaFolder(folder, parentDelta, postChange);
+ }
+ break;
case IArchiveNode.TYPE_ARCHIVE:
- XbPackage pack = createPackage((ArchiveImpl)postChange, attributeChanges, propertyChanges);
- return new DeltaArchive(pack, parentDelta, postChange);
+ if( postChange instanceof ArchiveImpl) {
+ XbPackage pack = createPackage((ArchiveImpl)postChange, attributeChanges, propertyChanges);
+ return new DeltaArchive(pack, parentDelta, postChange);
+ }
+ break;
}
-
return null;
}
protected static XbFileSet createFileset(ArchiveFileSetImpl postChange,HashMap attributeChanges, HashMap propertyChanges ) {
XbFileSet fs = new XbFileSet((XbFileSet)postChange.nodeDelegate);
- if( attributeChanges.containsKey(IArchiveFileSet.INCLUDES_ATTRIBUTE))
- fs.setIncludes(getBeforeString(attributeChanges, IArchiveFileSet.INCLUDES_ATTRIBUTE));
- if( attributeChanges.containsKey(IArchiveFileSet.EXCLUDES_ATTRIBUTE))
- fs.setExcludes(getBeforeString(attributeChanges, IArchiveFileSet.EXCLUDES_ATTRIBUTE));
- if( attributeChanges.containsKey(IArchiveFileSet.SOURCE_PATH_ATTRIBUTE))
- fs.setDir(getBeforeString(attributeChanges, IArchiveFileSet.SOURCE_PATH_ATTRIBUTE));
- if( attributeChanges.containsKey(IArchiveFileSet.IN_WORKSPACE_ATTRIBUTE))
- fs.setInWorkspace(getBeforeBoolean(attributeChanges, IArchiveFileSet.IN_WORKSPACE_ATTRIBUTE));
- if( attributeChanges.containsKey(IArchiveFileSet.FLATTENED_ATTRIBUTE))
- fs.setFlattened(getBeforeBoolean(attributeChanges, IArchiveFileSet.FLATTENED_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchiveStandardFileSet.INCLUDES_ATTRIBUTE))
+ fs.setIncludes(getBeforeString(attributeChanges, IArchiveStandardFileSet.INCLUDES_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchiveStandardFileSet.EXCLUDES_ATTRIBUTE))
+ fs.setExcludes(getBeforeString(attributeChanges, IArchiveStandardFileSet.EXCLUDES_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchiveStandardFileSet.SOURCE_PATH_ATTRIBUTE))
+ fs.setDir(getBeforeString(attributeChanges, IArchiveStandardFileSet.SOURCE_PATH_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchiveStandardFileSet.IN_WORKSPACE_ATTRIBUTE))
+ fs.setInWorkspace(getBeforeBoolean(attributeChanges, IArchiveStandardFileSet.IN_WORKSPACE_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchiveStandardFileSet.FLATTENED_ATTRIBUTE))
+ fs.setFlattened(getBeforeBoolean(attributeChanges, IArchiveStandardFileSet.FLATTENED_ATTRIBUTE));
undoPropertyChanges(fs, propertyChanges);
return fs;
@@ -142,9 +152,9 @@
*/
public static class DeltaFileset extends ArchiveFileSetImpl {
// everything goes through the delegate or the parent. Simple
- private ArchiveNodeDeltaImpl parentDelta;
- private ArchiveNodeImpl impl;
- public DeltaFileset(XbFileSet fileset, ArchiveNodeDeltaImpl parentDelta, ArchiveNodeImpl impl){
+ private IArchiveNodeDelta parentDelta;
+ private IArchiveNode impl;
+ public DeltaFileset(XbFileSet fileset, IArchiveNodeDelta parentDelta, IArchiveNode impl){
super(fileset);
this.parentDelta = parentDelta;
this.impl = impl;
@@ -164,9 +174,9 @@
* Extending class representing a delta folder
*/
public static class DeltaFolder extends ArchiveFolderImpl {
- private ArchiveNodeDeltaImpl parentDelta;
- private ArchiveNodeImpl impl;
- public DeltaFolder(XbFolder folder, ArchiveNodeDeltaImpl parentDelta, ArchiveNodeImpl impl){
+ private IArchiveNodeDelta parentDelta;
+ private IArchiveNode impl;
+ public DeltaFolder(XbFolder folder, IArchiveNodeDelta parentDelta, IArchiveNode impl){
super(folder);
this.parentDelta = parentDelta;
this.impl = impl;
@@ -186,9 +196,9 @@
* Extending class representing a delta archive
*/
public static class DeltaArchive extends ArchiveImpl {
- private ArchiveNodeDeltaImpl parentDelta;
- private ArchiveNodeImpl impl;
- public DeltaArchive(XbPackage pack, ArchiveNodeDeltaImpl parentDelta, ArchiveNodeImpl impl){
+ private IArchiveNodeDelta parentDelta;
+ private IArchiveNode impl;
+ public DeltaArchive(XbPackage pack, IArchiveNodeDelta parentDelta, IArchiveNode impl){
super(pack);
this.parentDelta = parentDelta;
this.impl = impl;
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -20,7 +20,7 @@
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
-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.DirectoryScannerFactory.DirectoryScannerExtension;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
@@ -32,7 +32,7 @@
*
*/
public class ArchiveFileSetImpl extends ArchiveNodeImpl implements
- IArchiveFileSet {
+ IArchiveStandardFileSet {
private DirectoryScannerExtension scanner;
private FileWrapper[] matchingPaths;
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeDeltaImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeDeltaImpl.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeDeltaImpl.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -15,6 +15,7 @@
import java.util.HashMap;
import java.util.Iterator;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
@@ -26,8 +27,8 @@
*/
public class ArchiveNodeDeltaImpl implements IArchiveNodeDelta {
- private ArchiveNodeDeltaImpl parentDelta;
- private ArchiveNodeImpl postNode, preNode;
+ private IArchiveNodeDelta parentDelta;
+ private IArchiveNode postNode, preNode;
private HashMap attributes, properties, children;
private int kind;
private IArchiveNodeDelta[] childrenDeltas;
@@ -40,7 +41,7 @@
* @param propertyChanges
* @param childChanges
*/
- public ArchiveNodeDeltaImpl(ArchiveNodeDeltaImpl parentDelta, ArchiveNodeImpl impl,
+ public ArchiveNodeDeltaImpl(IArchiveNodeDelta parentDelta, ArchiveNodeImpl impl,
HashMap attributeChanges, HashMap propertyChanges, HashMap childChanges) {
this.parentDelta = parentDelta;
postNode = impl;
@@ -54,8 +55,13 @@
// create *my* pre-node
// this creates an accurate "old" node but without ANY children at all.
- preNode = ArchiveDeltaPreNodeFactory.createNode(parentDelta, postNode, attributeChanges, propertyChanges);
+ preNode = ArchivesCore.getInstance().getNodeFactory()
+ .createDeltaNode(parentDelta, postNode,
+ attributeChanges, propertyChanges);
+ // TODO could log if preNode is null here?
+ // This could be null in the other constructor, but *not* here.
+ // A null here would indicate an incomplete implementation for a node type
// The children are expected to be added in the loadAllAffectedChildren
loadAllAffectedChildren();
@@ -70,7 +76,7 @@
* @param propertyChanges
* @param childChanges
*/
- public ArchiveNodeDeltaImpl(ArchiveNodeDeltaImpl parentDelta, ArchiveNodeImpl impl,
+ public ArchiveNodeDeltaImpl(IArchiveNodeDelta parentDelta, ArchiveNodeImpl impl,
int forcedKind, HashMap attributeChanges,
HashMap propertyChanges, HashMap childChanges) {
this(parentDelta, impl, attributeChanges, propertyChanges, childChanges);
@@ -86,7 +92,7 @@
}
- protected ArchiveNodeDeltaImpl getParentDelta() {
+ protected IArchiveNodeDelta getParentDelta() {
return parentDelta;
}
Copied: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeFactory.java (from rev 14588, trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchiveNodeFactory.java)
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeFactory.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeFactory.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.internal;
+
+import java.util.HashMap;
+
+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.IArchiveStandardFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+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.IArchiveNodeFactory;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbAction;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
+
+/**
+ * Just a factory for extenders to access our secret internals
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public class ArchiveNodeFactory implements IArchiveNodeFactory {
+ public IArchive createArchive() {
+ return new ArchiveImpl();
+ }
+
+ public IArchiveStandardFileSet createFileset() {
+ return new ArchiveFileSetImpl();
+ }
+
+ public IArchiveFolder createFolder() {
+ return new ArchiveFolderImpl();
+ }
+
+ public IArchiveAction createAction() {
+ return new ArchiveActionImpl();
+ }
+
+ public IArchiveNode createNode(XbPackageNode node) {
+ ArchiveNodeImpl nodeImpl = null;
+ if (node instanceof XbPackage) {
+ nodeImpl = new ArchiveImpl((XbPackage)node);
+ } else if (node instanceof XbFolder) {
+ nodeImpl = new ArchiveFolderImpl((XbFolder)node);
+ } else if (node instanceof XbFileSet) {
+ nodeImpl = new ArchiveFileSetImpl((XbFileSet)node);
+ } else if( node instanceof XbAction ) {
+ nodeImpl = new ArchiveActionImpl((XbAction)node);
+ }
+ return nodeImpl;
+ }
+
+ public IArchiveNode createDeltaNode(IArchiveNodeDelta parentDelta, IArchiveNode postChange,
+ HashMap attributeChanges, HashMap propertyChanges) {
+ return new ArchiveDeltaPreNodeFactory().createNode(parentDelta, postChange, attributeChanges, propertyChanges);
+ }
+}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbAction.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbAction.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbAction.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -14,7 +14,7 @@
private String time, type;
public XbAction() {
- super();
+ super("buildAction"); //$NON-NLS-1$
}
public XbAction(XbAction action) {
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -16,19 +16,16 @@
private boolean inWorkspace;
private boolean flattened = false;
- public XbFileSet ()
- {
- super();
+ public XbFileSet () {
+ super("fileset"); //$NON-NLS-1$
}
- public XbFileSet (XbFileSet fileset)
- {
+ public XbFileSet (XbFileSet fileset) {
super(fileset);
copyFrom(fileset);
}
- public void copyFrom (XbFileSet fileset)
- {
+ public void copyFrom (XbFileSet fileset) {
super.copyFrom(fileset);
this.dir = fileset.dir == null ? null : new String(fileset.dir);
this.includes = fileset.includes == null ? null : new String(fileset.includes);
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFolder.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFolder.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFolder.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -16,19 +16,16 @@
private String name;
- public XbFolder ()
- {
- super();
+ public XbFolder () {
+ super("folder"); //$NON-NLS-1$
}
- public XbFolder (XbFolder folder)
- {
+ public XbFolder (XbFolder folder) {
super(folder);
copyFrom(folder);
}
- public void copyFrom (XbFolder folder)
- {
+ public void copyFrom (XbFolder folder) {
super.copyFrom(folder);
this.name = folder.name == null ? null : new String(folder.name);
}
@@ -37,18 +34,15 @@
return new XbFolder(this);
}
- public List getPackages ()
- {
+ public List getPackages () {
return getChildren(XbPackage.class);
}
- public List getFolders ()
- {
+ public List getFolders () {
return getChildren(XbFolder.class);
}
- public List getFileSets()
- {
+ public List getFileSets() {
return getChildren(XbFileSet.class);
}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbLibFileSet.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbLibFileSet.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbLibFileSet.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.internal.xb;
+
+public class XbLibFileSet extends XbPackageNodeWithProperties {
+
+ private String id;
+
+ public XbLibFileSet () {
+ super("lib-fileset"); //$NON-NLS-1$
+ }
+
+ public XbLibFileSet (XbLibFileSet fileset) {
+ super(fileset);
+ copyFrom(fileset);
+ }
+
+ public void copyFrom (XbLibFileSet fileset) {
+ super.copyFrom(fileset);
+ this.id = fileset.id;
+ }
+
+ protected Object clone() throws CloneNotSupportedException {
+ return new XbLibFileSet(this);
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackage.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackage.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackage.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -18,19 +18,17 @@
private boolean exploded, inWorkspace;
public XbPackage () {
- super();
+ super("package"); //$NON-NLS-1$
exploded = false;
inWorkspace = true;
}
- public XbPackage (XbPackage pkg)
- {
+ public XbPackage (XbPackage pkg) {
super(pkg);
copyFrom (pkg);
}
- public void copyFrom (XbPackage pkg)
- {
+ public void copyFrom (XbPackage pkg) {
super.copyFrom(pkg);
this.name = pkg.name == null ? null: new String(pkg.name);
this.packageType = pkg.packageType == null ? null : new String(pkg.packageType);
@@ -47,18 +45,15 @@
return getChildren(XbAction.class);
}
- public List getPackages ()
- {
+ public List getPackages () {
return getChildren(XbPackage.class);
}
- public List getFolders ()
- {
+ public List getFolders () {
return getChildren(XbFolder.class);
}
- public List getFileSets()
- {
+ public List getFileSets() {
return getChildren(XbFileSet.class);
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNode.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNode.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNode.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -23,15 +23,15 @@
* The children are a class -> arraylist[child] map hashmap
*/
protected Hashtable children;
+ private String nodeType;
- public XbPackageNode ()
- {
+ public XbPackageNode (String nodeType) {
+ this.nodeType = nodeType;
children = new Hashtable();
}
- public XbPackageNode(XbPackageNode node)
- {
- children = new Hashtable();
+ public XbPackageNode(XbPackageNode node) {
+ this(node.getNodeType());
Object key;
for( Iterator i = node.children.keySet().iterator(); i.hasNext(); ) {
key = i.next();
@@ -39,58 +39,51 @@
}
}
- public void addChild (Object object)
- {
+ public void addChild (Object object) {
addChild((XbPackageNode)object);
}
- public void addChild (XbPackageNode child)
- {
- if (!children.containsKey(child.getClass()))
- {
+ public void addChild (XbPackageNode child) {
+ if (!children.containsKey(child.getClass())) {
children.put(child.getClass(), new ArrayList());
}
getChildren(child.getClass()).add(child);
child.setParent(this);
}
- public void removeChild (XbPackageNode child)
- {
- if (children.containsKey(child.getClass()))
- {
+ public void removeChild (XbPackageNode child) {
+ if (children.containsKey(child.getClass())) {
getChildren(child.getClass()).remove(child);
}
}
- public List getChildren(Class type)
- {
+ public List getChildren(Class type) {
return (List)children.get(type);
}
- public boolean hasChildren ()
- {
+ public boolean hasChildren () {
return children != null && children.size() > 0;
}
- public List getAllChildren()
- {
+ public List getAllChildren() {
ArrayList allChildren = new ArrayList();
- for (Iterator iter = children.keySet().iterator(); iter.hasNext();)
- {
+ for (Iterator iter = children.keySet().iterator(); iter.hasNext();) {
Class childType = (Class) iter.next();
allChildren.addAll(getChildren(childType));
}
return allChildren;
}
- public XbPackageNode getParent()
- {
+ public XbPackageNode getParent() {
return parent;
}
- public void setParent (XbPackageNode parent)
- {
+ public void setParent (XbPackageNode parent) {
this.parent = parent;
}
+
+ public String getNodeType() {
+ return nodeType;
+ }
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNodeWithProperties.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNodeWithProperties.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNodeWithProperties.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -17,8 +17,8 @@
protected XbProperties properties;
- public XbPackageNodeWithProperties () {
- super();
+ public XbPackageNodeWithProperties(String nodeType) {
+ super(nodeType);
properties = new XbProperties();
}
@@ -31,10 +31,8 @@
properties.getProperties().clear();
Properties props = node.getProperties().getProperties();
- for (Iterator iter = props.keySet().iterator(); iter.hasNext(); )
- {
+ for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
String key = (String) iter.next();
-
properties.getProperties().setProperty(key, (String) props.get(key));
}
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackages.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackages.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackages.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -15,8 +15,8 @@
public class XbPackages extends XbPackageNodeWithProperties {
private double version;
- public XbPackages () {
- super();
+ public XbPackages() {
+ super("packages-type"); //$NON-NLS-1$
}
public XbPackages (XbPackages packages) {
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -17,7 +17,7 @@
/**
* Necessary class for JBoss XB
* @author Marshall
- *
+ * @author Rob Stryker
*/
public class XbPackagesObjectProvider implements GenericObjectModelProvider {
@@ -25,8 +25,7 @@
return o;
}
- protected Object getNodeChildren(XbPackageNode node, String name)
- {
+ protected Object getNodeChildren(XbPackageNode node, String name) {
if ("package".equals(name)) { //$NON-NLS-1$
return node.getChildren(XbPackage.class);
}
@@ -36,6 +35,9 @@
else if ("fileset".equals(name)) {//$NON-NLS-1$
return node.getChildren(XbFileSet.class);
}
+ else if( "lib-fileset".equals(name)) {//$NON-NLS-1$
+ return node.getChildren(XbLibFileSet.class);
+ }
else if ("properties".equals(name) && node instanceof XbPackageNodeWithProperties) {//$NON-NLS-1$
return ((XbPackageNodeWithProperties)node).getProperties();
}
@@ -49,8 +51,8 @@
return null;
}
- public Object getChildren(Object object, MarshallingContext context, String namespaceURI, String localName)
- {
+ public Object getChildren(Object object, MarshallingContext context,
+ String namespaceURI, String localName) {
if (object instanceof XbPackageNode) {
Object ret = getNodeChildren(((XbPackageNode)object), localName);
return ret;
@@ -98,6 +100,11 @@
else if("flatten".equals(localName))//$NON-NLS-1$
return new Boolean(fileset.isFlattened()).toString();
}
+ else if( object instanceof XbLibFileSet ) {
+ XbLibFileSet fs = (XbLibFileSet)object;
+ if( "id".equals(localName)) //$NON-NLS-1$
+ return fs.getId();
+ }
else if (object instanceof XbProperty) {
XbProperty prop = (XbProperty) object;
if ("name".equals(localName))//$NON-NLS-1$
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -24,7 +24,7 @@
private PropertiesExt properties;
public XbProperties () {
- super();
+ super("properties"); //$NON-NLS-1$
this.properties = new PropertiesExt();
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperty.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperty.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperty.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -16,10 +16,11 @@
private String name, value;
public XbProperty () {
- super();
+ super("property"); //$NON-NLS-1$
}
public XbProperty(XbProperty property) {
+ super(property);
this.name = property.name == null ? null : new String(property.name);
this.value = property.value == null ? null : new String(property.value);
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -19,7 +19,10 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
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.IArchive;
@@ -29,18 +32,9 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor;
-import org.jboss.ide.eclipse.archives.core.model.IArchivesLogger;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
-import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveActionImpl;
-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.model.internal.ArchiveModelNode;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbAction;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
@@ -224,23 +218,24 @@
}
protected static IArchiveNode createPackageNodeImpl (XbPackageNode node, IArchiveNode parent) throws ArchivesModelException {
- ArchiveNodeImpl nodeImpl = null;
- if (node instanceof XbPackage) {
- nodeImpl = new ArchiveImpl((XbPackage)node);
- } else if (node instanceof XbFolder) {
- nodeImpl = new ArchiveFolderImpl((XbFolder)node);
- } else if (node instanceof XbFileSet) {
- nodeImpl = new ArchiveFileSetImpl((XbFileSet)node);
- } else if( node instanceof XbAction ) {
- nodeImpl = new ArchiveActionImpl((XbAction)node);
- }
-
- for (Iterator iter = node.getAllChildren().iterator(); iter.hasNext(); ) {
- XbPackageNode child = (XbPackageNode) iter.next();
- ArchiveNodeImpl childImpl = (ArchiveNodeImpl)createPackageNodeImpl(child, nodeImpl);
- if (nodeImpl != null && childImpl != null) {
- nodeImpl.addChild(childImpl, false);
+ IArchiveNode nodeImpl = ArchivesCore.getInstance().getNodeFactory().createNode(node);
+
+ if( nodeImpl != null ) {
+ for (Iterator iter = node.getAllChildren().iterator(); iter.hasNext(); ) {
+ XbPackageNode child = (XbPackageNode) iter.next();
+ IArchiveNode childImpl = (ArchiveNodeImpl)createPackageNodeImpl(child, nodeImpl);
+ if (childImpl != null) {
+ if( nodeImpl instanceof ArchiveNodeImpl)
+ ((ArchiveNodeImpl)nodeImpl).addChild(childImpl, false);
+ else
+ nodeImpl.addChild(childImpl);
+ }
}
+ } else {
+ // Log that this node type is unsupported
+ IStatus status = new Status(IStatus.WARNING, ArchivesCore.PLUGIN_ID,
+ NLS.bind(ArchivesCoreMessages.UnsupportedNodeType, node.getNodeType()));
+ ArchivesCore.log(status);
}
return nodeImpl;
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -15,7 +15,7 @@
import org.eclipse.core.runtime.Path;
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.IArchiveNode;
public class PathUtils {
@@ -26,8 +26,8 @@
a.getProjectName(), a.isDestinationInWorkspace(),
a.getDescriptorVersion());
}
- else if( node instanceof IArchiveFileSet ) {
- IArchiveFileSet a = (IArchiveFileSet)node;
+ else if( node instanceof IArchiveStandardFileSet ) {
+ IArchiveStandardFileSet a = (IArchiveStandardFileSet)node;
return getGlobalLocation(a.getRawSourcePath(),
a.getProjectName(), a.isInWorkspace(),
a.getDescriptorVersion());
@@ -40,8 +40,8 @@
IArchive a = (IArchive)node;
return getAbsoluteLocation(a.getRawDestinationPath(), a.getProjectName(), a.isDestinationInWorkspace(), a.getDescriptorVersion());
}
- else if( node instanceof IArchiveFileSet ) {
- IArchiveFileSet a = (IArchiveFileSet)node;
+ else if( node instanceof IArchiveStandardFileSet ) {
+ IArchiveStandardFileSet a = (IArchiveStandardFileSet)node;
return getAbsoluteLocation(a.getRawSourcePath(), a.getProjectName(), a.isInWorkspace(), a.getDescriptorVersion());
}
return null;
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -24,6 +24,7 @@
import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
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.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor;
@@ -228,7 +229,7 @@
if( inputFiles[i] == null )
continue;
- if( fs.isFlattened() )
+ if( fs instanceof IArchiveStandardFileSet && ((IArchiveStandardFileSet)fs).isFlattened() )
filesetRelative = inputFiles[i].getOutputName();
else
filesetRelative = inputFiles[i].getFilesetRelative();
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/xml/packages.xsd
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/xml/packages.xsd 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/xml/packages.xsd 2009-04-10 04:56:38 UTC (rev 14646)
@@ -55,6 +55,8 @@
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="fileset" type="fileset-type" />
<xsd:element maxOccurs="unbounded" minOccurs="0"
+ name="lib-fileset" type="lib-fileset-type" />
+ <xsd:element maxOccurs="unbounded" minOccurs="0"
name="folder" type="folder-type" />
<xsd:element maxOccurs="1" minOccurs="0" name="properties"
type="properties-type" />
@@ -162,5 +164,22 @@
<xsd:attribute name="inWorkspace" type="xsd:boolean" use="optional" default="true"/>
<xsd:attribute name="flatten" type="xsd:boolean" use="optional" default="false"/>
</xsd:complexType>
+
+ <xsd:complexType name="lib-fileset-type">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ide.eclipse.archives.core.model.internal.xb.XbLibFileSet"/>
+ <jbxb:addMethod name="addChild"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element maxOccurs="1" minOccurs="0" name="properties" type="properties-type"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="id" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+
</xsd:schema>
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-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF 2009-04-10 04:56:38 UTC (rev 14646)
@@ -13,7 +13,8 @@
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.ui.navigator;bundle-version="3.3.100",
+ org.eclipse.jdt.core;bundle-version="3.4.4"
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/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -32,6 +32,7 @@
public static String ErrorStringSubstitution;
public static String ErrorCompletingWizard;
public static String FilesetWizard;
+ public static String LibFilesetWizard;
public static String DefaultJarConfiguration;
public static String Preview;
public static String UseDefaultJARConfiguration;
@@ -61,6 +62,7 @@
public static String ProjectPackagesView_newFolderAction_label;
public static String ProjectPackagesView_newFilesetAction_label;
+ public static String ProjectPackagesView_newLibFilesetAction_label;
public static String ProjectPackagesView_deletePackageAction_label;
public static String ProjectPackagesView_editPackageAction_label;
public static String ProjectPackagesView_newPackageMenu_label;
@@ -85,6 +87,10 @@
public static String FilesetInfoWizardPage_includes_label;
public static String FilesetInfoWizardPage_excludes_label;
public static String FilesetInfoWizardPage_previewGroup_label;
+ public static String LibFilesetInfoWizardPage_new_message;
+ public static String LibFilesetInfoWizardPage_new_title;
+ public static String LibFilesetInfoWizardPage_edit_message;
+ public static String LibFilesetInfoWizardPage_edit_title;
/* Preference Page */
public static String PreferencePageTitle;
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2009-04-10 04:56:38 UTC (rev 14646)
@@ -17,6 +17,7 @@
ErrorStringSubstitution=Error during string substitution: {0}
ErrorCompletingWizard=Error Completing Wizard
FilesetWizard=Fileset Wizard
+LibFilesetWizard=User Library Fileset Wizard
DefaultJarConfiguration=Default JAR Configuration
Preview=Preview
UseDefaultJARConfiguration=Use default JAR configuration
@@ -27,6 +28,7 @@
ProjectPackagesView_newPackageMenu_label=New Archive
ProjectPackagesView_newFolderAction_label=New Folder
ProjectPackagesView_newFilesetAction_label=New Fileset
+ProjectPackagesView_newLibFilesetAction_label=New User Library Fileset
ProjectPackagesView_deletePackageAction_label=Delete Archive
ProjectPackagesView_deleteFilesetAction_label=Delete Fileset
ProjectPackagesView_deleteFolderAction_label=Delete Folder
@@ -49,7 +51,13 @@
FilesetInfoWizardPage_includes_label=Includes:
FilesetInfoWizardPage_excludes_label=Excludes:
FilesetInfoWizardPage_previewGroup_label=Preview
+LibFilesetInfoWizardPage_new_message=Create a new User Library fileset
+LibFilesetInfoWizardPage_new_title=New User Library Fileset
+LibFilesetInfoWizardPage_edit_message=Edit an existing User Library fileset
+LibFilesetInfoWizardPage_edit_title=Edit User Library Fileset
+
+
PackageInfoWizardPage_title=Create a new archive
PackageInfoWizardPage_message=Create a new archive consisting of filesets in the workspace.
PackageInfoWizardPage_infoGroup_label=Archive information
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-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -13,11 +13,8 @@
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.ActionContributionItem;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
@@ -30,17 +27,17 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.CommonActionProvider;
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob;
-import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
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.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.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
import org.jboss.ide.eclipse.archives.ui.ExtensionManager;
@@ -50,6 +47,7 @@
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 {
@@ -60,7 +58,7 @@
private MenuManager newPackageManager;
private NodeContribution[] nodePopupMenuContributions;
private NewArchiveAction[] newPackageActions;
- private Action editAction, deleteAction, newFolderAction, newFilesetAction;
+ private Action editAction, deleteAction, newFolderAction, newFilesetAction, newLibFilesetAction;
private Action buildAction;
private ICommonViewerSite site;
@@ -106,6 +104,7 @@
manager.add(newPackageManager);
manager.add(newFolderAction);
manager.add(newFilesetAction);
+ manager.add(newLibFilesetAction);
manager.add(new Separator());
}
@@ -122,7 +121,13 @@
} else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET) {
editAction.setText(ArchivesUIMessages.ProjectPackagesView_editFilesetAction_label);
deleteAction.setText(ArchivesUIMessages.ProjectPackagesView_deleteFilesetAction_label);
- editAction.setImageDescriptor(ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_MULTIPLE_FILES));
+ 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);
}
manager.add(editAction);
manager.add(deleteAction);
@@ -145,6 +150,11 @@
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 () {
@@ -280,7 +290,7 @@
IArchiveFolder temp = null;
for(int i = folderPaths.length-1; i >= 0 ; i-- ) {
- temp = ArchiveNodeFactory.createFolder();
+ temp = ArchivesCore.getInstance().getNodeFactory().createFolder();
temp.setName(folderPaths[i]);
if( current == null )
current = temp;
@@ -300,14 +310,29 @@
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();
if (node != null) {
if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET) {
- IArchiveFileSet fileset = (IArchiveFileSet) node;
- WizardDialog dialog = new WizardDialog(getShell(), new FilesetWizard(fileset, node.getParent()));
- dialog.open();
+ 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) {
IArchive pkg = (IArchive) node;
WizardDialog dialog = new WizardDialog(getShell(), new NewJARWizard(pkg));
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-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -11,6 +11,7 @@
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.ILabelProvider;
import org.eclipse.swt.graphics.Image;
@@ -20,7 +21,9 @@
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.util.PathUtils;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
@@ -95,7 +98,10 @@
}
case IArchiveNode.TYPE_ARCHIVE_FOLDER: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
case IArchiveNode.TYPE_ARCHIVE_FILESET: {
- return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_MULTIPLE_FILES);
+ 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);
}
}
}
@@ -121,8 +127,13 @@
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_FILESET: return getPackageFileSetText((IArchiveFileSet)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();
+ }
}
}
@@ -147,30 +158,34 @@
return action.toString();
}
- private String getPackageFileSetText (IArchiveFileSet fileset) {
- boolean showFullPath = showFullPaths == SHOW_FULL_PATHS ||
- (showFullPaths == FOLLOW_PREFS_FULL_PATHS &&
- PrefsInitializer.getBoolean(
- PrefsInitializer.PREF_SHOW_FULL_FILESET_ROOT_DIR));
- boolean inWorkspace = fileset.isInWorkspace();
-
- String text = ""; //$NON-NLS-1$
- // +[includes] [excludes] : /path/to/root
- text += "+[" + fileset.getIncludesPattern() + "] "; //$NON-NLS-1$ //$NON-NLS-2$
-
- if (fileset.getExcludesPattern() != null) {
- text += "-[" + fileset.getExcludesPattern() + "] : "; //$NON-NLS-1$ //$NON-NLS-2$
+ private String getPackageFileSetText (IArchiveFileSet fileset2) {
+ if( fileset2 instanceof IArchiveStandardFileSet) {
+ IArchiveStandardFileSet fileset = (IArchiveStandardFileSet)fileset2;
+ boolean showFullPath = showFullPaths == SHOW_FULL_PATHS ||
+ (showFullPaths == FOLLOW_PREFS_FULL_PATHS &&
+ PrefsInitializer.getBoolean(
+ PrefsInitializer.PREF_SHOW_FULL_FILESET_ROOT_DIR));
+ boolean inWorkspace = fileset.isInWorkspace();
+
+ String text = ""; //$NON-NLS-1$
+ // +[includes] [excludes] : /path/to/root
+ text += "+[" + fileset.getIncludesPattern() + "] "; //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (fileset.getExcludesPattern() != null) {
+ text += "-[" + fileset.getExcludesPattern() + "] : "; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ if (showFullPath) {
+ text += PathUtils.getAbsoluteLocation(fileset);
+ } else if( inWorkspace ){
+ text += fileset.getRawSourcePath();
+ } else {
+ text += new Path(PathUtils.getAbsoluteLocation(fileset)).lastSegment();
+ }
+
+ return text;
}
-
- if (showFullPath) {
- text += PathUtils.getAbsoluteLocation(fileset);
- } else if( inWorkspace ){
- text += fileset.getRawSourcePath();
- } else {
- text += new Path(PathUtils.getAbsoluteLocation(fileset)).lastSegment();
- }
-
- return text;
+ return null;
}
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -17,10 +17,10 @@
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.model.ArchiveNodeFactory;
+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.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
import org.jboss.ide.eclipse.archives.ui.PackagesUIPlugin;
@@ -34,11 +34,10 @@
public class FilesetWizard extends Wizard {
private FilesetInfoWizardPage page1;
- private IArchiveFileSet fileset;
+ private IArchiveStandardFileSet fileset;
private IArchiveNode parentNode;
- public FilesetWizard(IArchiveFileSet fileset, IArchiveNode parentNode)
- {
+ public FilesetWizard(IArchiveStandardFileSet fileset, IArchiveNode parentNode) {
this.fileset = fileset;
this.parentNode = parentNode;
setWindowTitle(ArchivesUIMessages.FilesetWizard);
@@ -48,7 +47,7 @@
final boolean createFileset = this.fileset == null;
if (createFileset)
- this.fileset = ArchiveNodeFactory.createFileset();
+ this.fileset = ArchivesCore.getInstance().getNodeFactory().createFileset();
fillFilesetFromPage(fileset);
try {
getContainer().run(true, false, new IRunnableWithProgress () {
@@ -69,7 +68,7 @@
return true;
}
- private void fillFilesetFromPage (IArchiveFileSet fileset) {
+ private void fillFilesetFromPage (IArchiveStandardFileSet fileset) {
fileset.setExcludesPattern(page1.getExcludes());
fileset.setIncludesPattern(page1.getIncludes());
fileset.setFlattened(page1.isFlattened());
Added: 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 (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/LibFilesetWizard.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * 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);
+ }
+}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -32,11 +32,12 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+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.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeFactory;
import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
import org.jboss.ide.eclipse.archives.core.util.PathUtils;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
@@ -246,7 +247,7 @@
private void createPackage () {
if (archive == null) {
- archive = ArchiveNodeFactory.createArchive();
+ archive = ArchivesCore.getInstance().getNodeFactory().createArchive();
}
archive.setName(getPackageName());
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -38,7 +38,7 @@
import org.eclipse.swt.widgets.Text;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
-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.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
@@ -57,7 +57,7 @@
public class FilesetInfoWizardPage extends WizardPage {
private IArchiveNode parentNode;
- private IArchiveFileSet fileset;
+ private IArchiveStandardFileSet fileset;
private String includes, excludes;
private String projectName;
private boolean flattened;
@@ -76,7 +76,7 @@
private Text excludesText;
private ArchiveFilesetDestinationComposite destinationComposite;
- public FilesetInfoWizardPage (Shell parent, IArchiveFileSet fileset, IArchiveNode parentNode) {
+ public FilesetInfoWizardPage (Shell parent, IArchiveStandardFileSet fileset, IArchiveNode parentNode) {
super(ArchivesUIMessages.FilesetInfoWizardPage_new_title, ArchivesUIMessages.FilesetInfoWizardPage_new_title, null);
if (fileset == null) {
Added: 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 (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/LibFilesetInfoWizardPage.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * 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-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF 2009-04-10 04:56:38 UTC (rev 14646)
@@ -16,7 +16,8 @@
org.eclipse.ant.ui;bundle-version="3.3.0",
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.jface;bundle-version="3.4.0",
+ org.eclipse.jdt.core;bundle-version="3.4.4"
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/ModelCreationTest.java
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -82,6 +82,17 @@
fail();
}
+ public void testAddLibFilesetToModel() {
+ try {
+ createEmptyModelNode().addChild(createLibFileSet("blah"));
+ } catch( ArchivesModelException ame ) {
+ return;
+ }
+ fail();
+ }
+
+
+
// public void testAddActionToModel() {
// try {
// createEmptyModelNode().addChild(createAction());;
@@ -135,6 +146,17 @@
}
}
+ public void testAddLibFilesetToArchive() {
+ try {
+ IArchive archive = createArchive("someName.war", "test");
+ IArchiveFileSet fs = createLibFileSet("blah");
+ archive.addChild(fs);
+ createEmptyModelNode().addChild(archive);
+ } catch( ArchivesModelException ame ) {
+ fail();
+ }
+ }
+
// public void testAddActionToArchive() {
// try {
// IArchive archive = createArchive("someName.war", "test");
@@ -189,6 +211,20 @@
fail();
}
}
+
+ public void testAddLibFilesetToInnerArchive() {
+ try {
+ IArchive archive = createArchive("someName.war", "test");
+ IArchive archive2 = createArchive("someName.war2", "test2");
+ IArchiveFileSet fs = createLibFileSet("blah");
+ archive.addChild(archive2);
+ archive2.addChild(fs);
+ createEmptyModelNode().addChild(archive);
+ } catch( ArchivesModelException ame ) {
+ fail();
+ }
+ }
+
//
// public void testAddActionToInnerArchive() {
// try {
@@ -241,11 +277,11 @@
public void testAddFilesetToInnerFolder() {
try {
IArchive archive = createArchive("someName.war", "test");
- IArchive archive2 = createArchive("someName2.war", "test2");
IArchiveFolder folder = createFolder("test3");
-
+ IArchiveFileSet fs = createFileSet("**", "blah");
+
archive.addChild(folder);
- folder.addChild(archive2);
+ folder.addChild(fs);
createEmptyModelNode().addChild(archive);
} catch( ArchivesModelException ame ) {
fail();
@@ -253,6 +289,21 @@
return;
}
+ public void testAddLibFilesetToInnerFolder() {
+ try {
+ IArchive archive = createArchive("someName.war", "test");
+ IArchiveFolder folder = createFolder("test3");
+ IArchiveFileSet fs = createLibFileSet("blah");
+
+ archive.addChild(folder);
+ folder.addChild(fs);
+ createEmptyModelNode().addChild(archive);
+ } catch( ArchivesModelException ame ) {
+ fail();
+ }
+ return;
+ }
+
// public void testAddActionToInnerFolder() {
// try {
@@ -369,7 +420,84 @@
}
fail();
}
+
+ public void testAddLibFilesetToFileset() {
+ try {
+ IArchive archive = createArchive("someName.war", "test");
+ IArchiveFileSet fs = createFileSet("*", "path");
+ IArchiveNode child = createLibFileSet("path");
+ archive.addChild(fs);
+ fs.addChild(child);
+ createEmptyModelNode().addChild(archive);
+ } catch( ArchivesModelException ame ) {
+ return;
+ }
+ fail();
+ }
+
+ //
+ //
+ //
+
+ // add all to fileset
+ public void testAddArchiveToLibFileset() {
+ try {
+ IArchive archive = createArchive("someName.war", "test");
+ IArchiveFileSet fs = createLibFileSet("path");
+ IArchiveNode child = createArchive("someName.war", "test");
+ archive.addChild(fs);
+ fs.addChild(child);
+ createEmptyModelNode().addChild(archive);
+ } catch( ArchivesModelException ame ) {
+ return;
+ }
+ fail();
+ }
+
+ public void testAddFolderToLibFileset() {
+ try {
+ IArchive archive = createArchive("someName.war", "test");
+ IArchiveFileSet fs = createLibFileSet("path");
+ IArchiveNode child = createFolder("test");
+ archive.addChild(fs);
+ fs.addChild(child);
+ createEmptyModelNode().addChild(archive);
+ } catch( ArchivesModelException ame ) {
+ return;
+ }
+ fail();
+ }
+
+ public void testAddFilesetToLibFileset() {
+ try {
+ IArchive archive = createArchive("someName.war", "test");
+ IArchiveFileSet fs = createLibFileSet("path");
+ IArchiveNode child = createFileSet("*", "path");
+ archive.addChild(fs);
+ fs.addChild(child);
+ createEmptyModelNode().addChild(archive);
+ } catch( ArchivesModelException ame ) {
+ return;
+ }
+ fail();
+ }
+
+ public void testAddLibFilesetToLibFileset() {
+ try {
+ IArchive archive = createArchive("someName.war", "test");
+ IArchiveFileSet fs = createLibFileSet("path1");
+ IArchiveNode child = createLibFileSet("path2");
+ archive.addChild(fs);
+ fs.addChild(child);
+ createEmptyModelNode().addChild(archive);
+ } catch( ArchivesModelException ame ) {
+ return;
+ }
+ fail();
+ }
+
+
// public void testAddActionToFileset() {
// try {
// IArchive archive = createArchive("someName.war", "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-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTest.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -13,33 +13,46 @@
import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
-import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+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.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;
/**
* @author rob.stryker <rob.stryker(a)redhat.com>
*
*/
public abstract class ModelTest extends TestCase {
+ protected static IArchiveNodeFactory getFactory() {
+ return ArchivesCore.getInstance().getNodeFactory();
+ }
/*
* Utility methods
*/
protected IArchiveFolder createFolder(String name) {
- IArchiveFolder folder = ArchiveNodeFactory.createFolder();
+ IArchiveFolder folder = getFactory().createFolder();
folder.setName(name);
return folder;
}
- protected IArchiveFileSet createFileSet(String includes, String path) {
- IArchiveFileSet fs = ArchiveNodeFactory.createFileset();
+ protected IArchiveStandardFileSet createFileSet(String includes, String path) {
+ IArchiveStandardFileSet fs = getFactory().createFileset();
fs.setIncludesPattern(includes);
fs.setRawSourcePath( path );
return fs;
}
+ protected IArchiveFileSet createLibFileSet(String name) {
+ ArchiveLibFileSetImpl lfsi = ((WorkspaceNodeFactory)getFactory()).createLibFileset();
+ lfsi.setId(name);
+ return lfsi;
+ }
+
// protected IArchiveAction createAction() {
// IArchiveAction action = ArchiveNodeFactory.createAction();
// action.setTime(IArchiveAction.POST_BUILD);
@@ -48,7 +61,7 @@
// }
protected IArchive createArchive(String name, String dest) {
- IArchive archive = ArchiveNodeFactory.createArchive();
+ IArchive archive = getFactory().createArchive();
archive.setName(name);
archive.setDestinationPath(new Path(dest));
return archive;
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTruezipBridgeTest.java
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTruezipBridgeTest.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTruezipBridgeTest.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -25,8 +25,15 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.JavaModelManager;
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.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNodeWithProperties;
import org.jboss.ide.eclipse.archives.core.util.PathUtils;
import org.jboss.ide.eclipse.archives.core.util.internal.ModelTruezipBridge;
import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
@@ -213,7 +220,7 @@
assertTrue(zippedF.exists());
assertTrue(!zippedF.isDirectory());
- IArchiveFileSet fs = createFileSet("**/*.gif", new Path(proj.getName()).makeAbsolute().toString());
+ IArchiveStandardFileSet fs = createFileSet("**/*.gif", new Path(proj.getName()).makeAbsolute().toString());
fs.setInWorkspace(true);
zipped.addChild(fs);
ModelTruezipBridge.fullFilesetBuild(fs, new NullProgressMonitor(), true);
@@ -229,7 +236,7 @@
assertTrue(zippedF.exists());
assertTrue(!zippedF.isDirectory());
- IArchiveFileSet fs = createFileSet("**/*.gif", new Path(proj.getName()).makeAbsolute().toString());
+ IArchiveStandardFileSet fs = createFileSet("**/*.gif", new Path(proj.getName()).makeAbsolute().toString());
fs.setInWorkspace(true);
fs.setFlattened(true);
zipped.addChild(fs);
@@ -239,7 +246,63 @@
assertEquals(14, countEntries(zippedF));
}
+ public void testLibFileset() {
+ File file = findSomeJar();
+ if( file != null ) {
+ IClasspathEntry e =
+ JavaCore.newLibraryEntry(new Path(file.getAbsolutePath()), null, null);
+ JavaModelManager.getUserLibraryManager().setUserLibrary(
+ "userLibTest", new IClasspathEntry[] { e }, false);
+ try {
+ IArchive zipped = createArchive("zipped.war", new Path(proj.getName()).append("outputs").makeAbsolute().toString());
+ zipped.setInWorkspace(true);
+ zipped.setExploded(false);
+ ModelTruezipBridge.createFile(zipped);
+ File zippedF = proj.getLocation().append("outputs").append("zipped.war").toFile();
+ assertTrue(zippedF.exists());
+ assertTrue(!zippedF.isDirectory());
+ IArchiveFileSet fs = createLibFileSet("userLibTest");
+ zipped.addChild(fs);
+ ModelTruezipBridge.fullFilesetBuild(fs, new NullProgressMonitor(), true);
+
+ // should be two less files and 3 less folders created
+ assertEquals(1, countEntries(zippedF));
+ } finally {
+ JavaModelManager.getUserLibraryManager().removeUserLibrary("userLibTest");
+ }
+ }
+ }
+
+ protected File findSomeJar() {
+ String loc = System.getProperty("osgi.syspath");
+ File f = new File(loc);
+ String[] children = f.list();
+ boolean found = false;
+ int i = 0;
+ File tempFile;
+ while( !found && i < children.length) {
+ tempFile = new File(f, children[i]);
+ if( tempFile.exists() && tempFile.isFile() && children[i].endsWith("jar")) {
+ return tempFile;
+ }
+ }
+ return null;
+ }
+
+ protected IArchiveNode getDummyParent() {
+ return new ArchiveNodeImpl(new XbPackageNodeWithProperties("DUMMY"){}) {
+ public IPath getRootArchiveRelativePath() {
+ return new Path("/");
+ }
+ public int getNodeType() {
+ return 0;
+ }
+ };
+ }
+
+
+
/*
* Utility
*/
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelUtilTest.java
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelUtilTest.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelUtilTest.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -18,12 +18,14 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
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.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeFactory;
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.util.ModelUtil;
@@ -31,11 +33,17 @@
import org.osgi.framework.Bundle;
public class ModelUtilTest extends TestCase {
+ protected static IArchiveNodeFactory getFactory() {
+ return ArchivesCore.getInstance().getNodeFactory();
+ }
+
private Bundle bundle;
private IPath bundlePath;
private IPath outputs;
private IPath inputs;
private IArchive rootArchive;
+
+
protected void setUp() {
if( bundlePath == null ) {
try {
@@ -62,33 +70,33 @@
protected IArchive createArchive() throws ArchivesModelException {
IPath fileTrees = inputs.append("fileTrees");
- IArchive root = ArchiveNodeFactory.createArchive();
+ IArchive root = getFactory().createArchive();
root.setArchiveType("jar");
root.setDestinationPath(outputs);
root.setName("output.jar");
root.setExploded(false);
root.setInWorkspace(false);
- IArchiveFolder topFolder = ArchiveNodeFactory.createFolder();
+ IArchiveFolder topFolder = getFactory().createFolder();
topFolder.setName("topFolder");
root.addChild(topFolder);
- IArchiveFolder inner1 = ArchiveNodeFactory.createFolder();
+ IArchiveFolder inner1 = getFactory().createFolder();
inner1.setName("inner1");
topFolder.addChild(inner1);
- IArchiveFolder images = ArchiveNodeFactory.createFolder();
+ IArchiveFolder images = getFactory().createFolder();
images.setName("images");
topFolder.addChild(images);
- IArchiveFileSet outerFileset = ArchiveNodeFactory.createFileset();
+ IArchiveStandardFileSet outerFileset = getFactory().createFileset();
outerFileset.setInWorkspace(false);
outerFileset.setRawSourcePath(fileTrees.append("misc").toString());
outerFileset.setExcludesPattern("**/*.gif,**/*.png");
outerFileset.setIncludesPattern("**/*");
topFolder.addChild(outerFileset);
- IArchiveFileSet imageFileset = ArchiveNodeFactory.createFileset();
+ IArchiveStandardFileSet imageFileset = getFactory().createFileset();
imageFileset.setInWorkspace(false);
imageFileset.setRawSourcePath(fileTrees.append("misc").toString());
imageFileset.setIncludesPattern("**/*.gif,**/*.png,**/*.xml");
@@ -103,7 +111,7 @@
assertTrue(fsets.length == 2);
assertTrue(fsets[0].getParent().getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER);
assertTrue(fsets[1].getParent().getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER);
- assertTrue(ModelUtil.findAllDescendentFilesets(ArchiveNodeFactory.createFileset()).length == 1);
+ assertTrue(ModelUtil.findAllDescendentFilesets(getFactory().createFileset()).length == 1);
}
public void testFindAllDescendentFolders() {
@@ -147,13 +155,14 @@
assertFalse(testMatches(htmlFS[0], html, rootArchive));
// add a temporary fileset that will match exactly
- IArchiveFileSet otherFS = ArchiveNodeFactory.createFileset();
- otherFS.setIncludesPattern(xmlFS[0].getIncludesPattern());
- otherFS.setInWorkspace(xmlFS[0].isInWorkspace());
- otherFS.setRawSourcePath(xmlFS[0].getRawSourcePath());
- xmlFS[0].getParent().addChild(otherFS);
+ IArchiveStandardFileSet otherFS = getFactory().createFileset();
+ IArchiveStandardFileSet fs0 = (IArchiveStandardFileSet)xmlFS[0];
+ otherFS.setIncludesPattern(fs0.getIncludesPattern());
+ otherFS.setInWorkspace(fs0.isInWorkspace());
+ otherFS.setRawSourcePath(fs0.getRawSourcePath());
+ fs0.getParent().addChild(otherFS);
- assertTrue(testMatches(xmlFS[0], xml, rootArchive));
+ assertTrue(testMatches(fs0, xml, rootArchive));
}
private boolean testMatches(IArchiveFileSet fs, IPath absoluteFile, IArchiveNode node) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/archivetypes/J2EEArchiveType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/archivetypes/J2EEArchiveType.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/archivetypes/J2EEArchiveType.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -25,11 +25,11 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IModuleArtifact;
import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
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.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
@@ -95,7 +95,7 @@
// Create a detached package with some generic settings
public static IArchive createGenericIArchive(IProject project, String deployDirectory, String packageName, IContainer sourceContainer) {
- IArchive jar = ArchiveNodeFactory.createArchive();
+ IArchive jar = ArchivesCore.getInstance().getNodeFactory().createArchive();
if( deployDirectory != null ) {
jar.setDestinationPath(new Path(deployDirectory));
@@ -113,14 +113,14 @@
public static IArchiveFolder addFolder(IProject project,
IArchiveNode parent, String name) throws ArchivesModelException {
- IArchiveFolder folder = ArchiveNodeFactory.createFolder();
+ IArchiveFolder folder = ArchivesCore.getInstance().getNodeFactory().createFolder();
folder.setName(name);
parent.addChild(folder);
return folder;
}
- public static IArchiveFileSet addFileset(IProject project, IArchiveNode parent,
+ public static IArchiveStandardFileSet addFileset(IProject project, IArchiveNode parent,
String sourcePath, String includePattern) throws ArchivesModelException {
- IArchiveFileSet fs = ArchiveNodeFactory.createFileset();
+ IArchiveStandardFileSet fs = ArchivesCore.getInstance().getNodeFactory().createFileset();
Assert.isNotNull(project);
IJavaProject javaProject = JavaCore.create(project);
Assert.isNotNull(javaProject);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/archivetypes/WarArchiveType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/archivetypes/WarArchiveType.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/archivetypes/WarArchiveType.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -34,7 +34,7 @@
import org.jboss.ide.eclipse.archives.core.asf.DirectoryScanner;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
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.IArchiveNode;
import org.jboss.ide.eclipse.archives.webtools.IntegrationPlugin;
@@ -98,7 +98,7 @@
IPath path = new Path(files[0]);
path = path.removeLastSegments(2); // remove the file name
path = new Path(project.getName()).append(path); // pre-pend project name to make workspace-relative
- IArchiveFileSet fs = addFileset(project, packageRoot, path.toOSString(), "**/*"); //$NON-NLS-1$
+ IArchiveStandardFileSet fs = addFileset(project, packageRoot, path.toOSString(), "**/*"); //$NON-NLS-1$
//If we have separate file set for libraries, we do not need to duplicate jars.
fs.setExcludesPattern("**/WEB-INF/lib/*.jar"); //$NON-NLS-1$
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java 2009-04-09 18:14:17 UTC (rev 14645)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java 2009-04-10 04:56:38 UTC (rev 14646)
@@ -37,10 +37,10 @@
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+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.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.IArchiveModelRootNode;
import org.jboss.ide.eclipse.archives.ui.actions.BuildAction;
import org.jboss.ide.eclipse.archives.webtools.modules.ArchivesModuleModelListener;
@@ -248,14 +248,14 @@
protected void addArchives() {
ArchivesModel.instance().registerProject(project.getLocation(), new NullProgressMonitor());
IArchiveModelRootNode root = ArchivesModel.instance().getRoot(project.getLocation());
- rootArchive = ArchiveNodeFactory.createArchive();
+ rootArchive = ArchivesCore.getInstance().getNodeFactory().createArchive();
rootArchive.setExploded(true);
rootArchive.setInWorkspace(true);
rootArchive.setName(OUT_JAR);
rootArchive.setDestinationPath(null);
root.addChild(rootArchive);
- IArchiveFileSet fs = ArchiveNodeFactory.createFileset();
+ IArchiveStandardFileSet fs = ArchivesCore.getInstance().getNodeFactory().createFileset();
fs.setIncludesPattern("**/*txt");
fs.setExcludesPattern("**/bin/**, **/*jar*");
fs.setInWorkspace(true);
15 years, 8 months
JBoss Tools SVN: r14645 - trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2009-04-09 14:14:17 -0400 (Thu, 09 Apr 2009)
New Revision: 14645
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
Log:
corrected code
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2009-04-09 16:54:54 UTC (rev 14644)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2009-04-09 18:14:17 UTC (rev 14645)
@@ -65,13 +65,6 @@
/**
- * @deprecated Use {@link ResourcesUtils#importProjectIntoWorkspace(ImportBean)} instead
- */
- static public void importProjectIntoWorkspace(ImportBean bean) {
- ResourcesUtils.importProjectIntoWorkspace(bean);
- }
-
- /**
* Import project into workspace.
*
* @param path the path
15 years, 8 months
JBoss Tools SVN: r14644 - in trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt: org/jboss/tools and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-04-09 12:54:54 -0400 (Thu, 09 Apr 2009)
New Revision: 14644
Modified:
trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/pdf.xsl
trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/pdf.xsl
Log:
https://jira.jboss.org/jira/browse/JBDS-642 - The bug was fixed with redefining standard template "force.page.count".
Modified: trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/pdf.xsl
===================================================================
--- trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/pdf.xsl 2009-04-09 15:36:02 UTC (rev 14643)
+++ trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/pdf.xsl 2009-04-09 16:54:54 UTC (rev 14644)
@@ -78,4 +78,11 @@
<xsl:value-of select="."/><xsl:text> </xsl:text>
</fo:inline>
</xsl:template>
+ <!--avoid page sequence to generate blank pages after even page numbers -->
+
+ <xsl:template name="force.page.count">
+ <xsl:param name="element" select="local-name(.)"/>
+ <xsl:param name="master-reference" select="''"/>
+ <xsl:text>no-force</xsl:text>
+ </xsl:template>
</xsl:stylesheet>
Modified: trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/pdf.xsl
===================================================================
--- trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/pdf.xsl 2009-04-09 15:36:02 UTC (rev 14643)
+++ trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/pdf.xsl 2009-04-09 16:54:54 UTC (rev 14644)
@@ -9,7 +9,8 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:diffmk="http://diffmk.sf.net/ns/diff">
<xsl:import href="classpath:/xslt/org/jboss/pdf.xsl"/>
-
+ <xsl:param name="force.page.count" select="no-force"/>
+
<!-- overwriting links properties -->
<xsl:attribute-set name="xref.properties">
@@ -23,7 +24,7 @@
</xsl:attribute-set>
<!-- highlighting meaningful words -->
-
+
<xsl:template match="property">
<xsl:variable name="currant" select="child::node()"/>
<fo:inline color="#0066cc">
@@ -104,4 +105,113 @@
</fo:inline>
</fo:block>
</xsl:template>
+ <xsl:template name="callout-bug">
+ <xsl:param name="conum" select='1'/>
+
+ <xsl:choose>
+ <!-- Draw callouts as images -->
+ <xsl:when test="$callout.graphics != '0'
+ and $conum <= $callout.graphics.number.limit">
+ <xsl:variable name="filename"
+ select="concat($callout.graphics.path, $conum,
+ $callout.graphics.extension)"/>
+
+ <fo:external-graphic content-width="{$callout.icon.size}"
+ width="{$callout.icon.size}" padding="0.0em" margin="0.0em">
+ <xsl:attribute name="src">
+ <xsl:choose>
+ <xsl:when test="$passivetex.extensions != 0
+ or $fop.extensions != 0
+ or $arbortext.extensions != 0">
+ <xsl:value-of select="$filename"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>url(</xsl:text>
+ <xsl:value-of select="$filename"/>
+ <xsl:text>)</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </fo:external-graphic>
+ </xsl:when>
+
+ <xsl:when test="$callout.unicode != 0
+ and $conum <= $callout.unicode.number.limit">
+ <xsl:variable name="comarkup">
+ <xsl:choose>
+ <xsl:when test="$callout.unicode.start.character = 10102">
+ <xsl:choose>
+ <xsl:when test="$conum = 1">❶</xsl:when>
+ <xsl:when test="$conum = 2">❷</xsl:when>
+ <xsl:when test="$conum = 3">❸</xsl:when>
+ <xsl:when test="$conum = 4">❹</xsl:when>
+ <xsl:when test="$conum = 5">❺</xsl:when>
+ <xsl:when test="$conum = 6">❻</xsl:when>
+ <xsl:when test="$conum = 7">❼</xsl:when>
+ <xsl:when test="$conum = 8">❽</xsl:when>
+ <xsl:when test="$conum = 9">❾</xsl:when>
+ <xsl:when test="$conum = 10">❿</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
+ <xsl:text>when $callout.unicode.start.character is </xsl:text>
+ <xsl:value-of select="$callout.unicode.start.character"/>
+ </xsl:message>
+ <fo:inline background-color="#404040"
+ force-page-count="no-force"
+ color="white"
+ padding-top="0.1em"
+ padding-bottom="0.1em"
+ padding-start="0.2em"
+ padding-end="0.2em"
+ baseline-shift="0.1em"
+ font-family="{$body.fontset}"
+ font-weight="bold"
+ font-size="75%">
+ <xsl:value-of select="$conum"/>
+ </fo:inline>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$callout.unicode.font != ''">
+ <fo:inline font-family="{$callout.unicode.font}">
+ <xsl:copy-of select="$comarkup"/>
+ </fo:inline>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$comarkup"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+
+ <!-- Most safe: draw a dark gray square with a white number inside -->
+ <xsl:otherwise>
+ <fo:inline background-color="#404040"
+ force-page-count="no-force"
+ color="white"
+ padding-top="0.1em"
+ padding-bottom="0.1em"
+ padding-start="0.2em"
+ padding-end="0.2em"
+ baseline-shift="0.1em"
+ font-family="{$body.fontset}"
+ font-weight="bold"
+ font-size="75%">
+ <xsl:value-of select="$conum"/>
+ </fo:inline>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--avoid page sequence to generate blank pages after even page numbers -->
+
+ <xsl:template name="force.page.count">
+ <xsl:param name="element" select="local-name(.)"/>
+ <xsl:param name="master-reference" select="''"/>
+ <xsl:text>no-force</xsl:text>
+ </xsl:template>
</xsl:stylesheet>
15 years, 8 months