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);