[jboss-cvs] jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model ...

Marshall Culpepper mculpepper at jboss.com
Wed Dec 20 14:56:40 EST 2006


  User: mculpepper
  Date: 06/12/20 14:56:40

  Modified:    core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model           
                        PackagesCore.java IPackageFileSet.java
                        IPackageFolder.java IPackagesModelListener.java
                        IPackageNode.java IPackage.java
  Removed:     core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model           
                        IPackageNodeWorkingCopy.java
                        IPackageFileSetWorkingCopy.java
                        IPackageFolderWorkingCopy.java
                        IPackageWorkingCopy.java IPackageNodeBase.java
  Log:
  got rid of the working copies idea, and eliminated the model bridge as it was making things too complicated. package nodes now keep references to their parents and children, (just like delegates). there shouldn't be any need for synch as addChild/removeChild take care of all the details there. the way to create a package node that isn't attached to the model yet is:
  
  pkg = PackagesCore.createDetachedPackage(project, true);
  pkg.setXXX..
  PackagesCore.attach(pkg, monitor);
  
  Revision  Changes    Path
  1.11      +24 -2     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/PackagesCore.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PackagesCore.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/PackagesCore.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- PackagesCore.java	6 Dec 2006 17:02:56 -0000	1.10
  +++ PackagesCore.java	20 Dec 2006 19:56:40 -0000	1.11
  @@ -34,7 +34,6 @@
   import org.eclipse.core.runtime.IProgressMonitor;
   import org.eclipse.core.runtime.NullProgressMonitor;
   import org.eclipse.core.runtime.Path;
  -import org.eclipse.core.runtime.Platform;
   import org.eclipse.core.runtime.QualifiedName;
   import org.jboss.ide.eclipse.packages.core.Trace;
   import org.jboss.ide.eclipse.packages.core.model.internal.PackageBuildDelegate;
  @@ -190,7 +189,7 @@
   	
   	public static IPackage getTopLevelPackage (IPackageNode node)
   	{
  -		IPackageNodeBase tmp = node.getParent(), top = tmp;
  +		IPackageNode tmp = node.getParent(), top = tmp;
   		while (tmp != null)
   		{
   			top = tmp;
  @@ -294,16 +293,31 @@
   		return PackagesModel.instance().createPackage(project, isTopLevel);
   	}
   	
  +	public static IPackage createDetachedPackage (IProject project, boolean isTopLevel)
  +	{
  +		return PackagesModel.instance().createDetachedPackage(project, isTopLevel);
  +	}
  +	
   	public static IPackageFolder createPackageFolder (IProject project)
   	{
   		return PackagesModel.instance().createPackageFolder(project);
   	}
   	
  +	public static IPackageFolder createDetachedFolder (IProject project)
  +	{
  +		return PackagesModel.instance().createDetachedFolder(project);
  +	}
  +	
   	public static IPackageFileSet createPackageFileSet (IProject project)
   	{
   		return PackagesModel.instance().createPackageFileSet(project);
   	}
   	
  +	public static IPackageFileSet createDetachedPackageFileSet (IProject project)
  +	{
  +		return PackagesModel.instance().createDetachedFileSet(project);
  +	}
  +	
   	public static void addPackagesModelListener (IPackagesModelListener listener)
   	{
   		PackagesModel.instance().addPackagesModelListener(listener);
  @@ -324,4 +338,12 @@
   		PackagesModel.instance().removePackagesBuildListener(listener);
   	}
   	
  +	/**
  +	 * Attach a detached node to the model. This node will be saved and added to the next build.
  +	 * @param nodeToAttach
  +	 */
  +	public static void attach (IPackageNode nodeToAttach, IProgressMonitor monitor)
  +	{
  +		PackagesModel.instance().attach(nodeToAttach, monitor);
  +	}
   }
  
  
  
  1.3       +66 -3     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFileSet.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IPackageFileSet.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFileSet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- IPackageFileSet.java	6 Dec 2006 17:02:56 -0000	1.2
  +++ IPackageFileSet.java	20 Dec 2006 19:56:40 -0000	1.3
  @@ -32,7 +32,7 @@
    * </p>
    * 
    * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public interface IPackageFileSet extends IPackageNode {
   
  @@ -113,7 +113,70 @@
   	public boolean matchesPath(IPath path);
   	
   	/**
  -	 * @return A working copy of this fileset
  +	 * Set this fileset to be a single file in the workspace
  +	 * Equivalent to:
  +	 * <code>setSingleFile(file, null);</code>
  +	 * 
  +	 * @param file the single file for this fileset
   	 */
  -	public IPackageFileSetWorkingCopy createFileSetWorkingCopy();
  +	public void setSingleFile(IFile file);
  +	
  +	/**
  +	 * Set this fileset to be a single file in the workspace, using the specified destination filename
  +	 * @param file The single file to be included in this fileset
  +	 * @param destinationFilename The filename that the file will be called in the package
  +	 */
  +	public void setSingleFile(IFile file, String destinationFilename);
  +	
  +	/**
  +	 * Set this fileset to be a single file in the filesystem
  +	 * Equivalent to:
  +	 * <code>setSingleFile(path, null);</code>
  +	 * @param path An absolute path to a file on the filesystem 
  +	 */
  +	public void setSingleFile(IPath path);
  +	
  +	/**
  +	 * Set this fileset to be a single file in the filesystem, using the specified destination filename
  +	 * @param path An absolute path to a file on the filesystem
  +	 * @param destinationFilename The filename that the file will be called in the package
  +	 */
  +	public void setSingleFile(IPath path, String destinationFilename);
  +	
  +	/**
  +	 * Sets the "root" or "source" of this fileset to be the passed-in project
  +	 * @param project The project that is the source of this fileset
  +	 */
  +	public void setSourceProject(IProject project);
  +	
  +	/**
  +	 * Sets the "root" or "source" of this fileset to the be the passed-in container
  +	 * @param container The container that is the source of this fileset
  +	 */
  +	public void setSourceContainer(IContainer container);
  +	
  +	/**
  +	 * Sets the "root" or "source" of this fileset to be an absolute path on the filesystem
  +	 * @param path The absolute path that is the source of this fileset
  +	 */
  +	public void setSourceFolder(IPath path);
  +	
  +	/**
  +	 * 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);
   }
  
  
  
  1.2       +21 -2     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFolder.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IPackageFolder.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFolder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- IPackageFolder.java	6 Nov 2006 21:35:27 -0000	1.1
  +++ IPackageFolder.java	20 Dec 2006 19:56:40 -0000	1.2
  @@ -30,19 +30,38 @@
    * </p>
    * 
    * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public interface IPackageFolder extends IPackageNode {
   
  +	/**
  +	 * @return The name of this folder
  +	 */
   	public String getName();
   	
  +	/**
  +	 * Set the name of this folder
  +	 * @param name The name of this folder
  +	 */
  +	public void setName(String name);
  +	
  +	/**
  +	 * @return An array of sub-packages of this folder
  +	 */
   	public IPackage[] getPackages();
   	
  +	/**
  +	 * @return An array of sub-folders of this folder
  +	 */
   	public IPackageFolder[] getFolders();
   	
  +	/**
  +	 * @return An array of filesets whose destination is this folder
  +	 */
   	public IPackageFileSet[] getFileSets();
   	
  -	public IPackageFolderWorkingCopy createFolderWorkingCopy();
  -	
  +	/**
  +	 * @return The path within the package to this folder
  +	 */
   	public IPath getPackageRelativePath();
   }
  
  
  
  1.2       +28 -0     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackagesModelListener.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IPackagesModelListener.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackagesModelListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- IPackagesModelListener.java	6 Nov 2006 21:35:27 -0000	1.1
  +++ IPackagesModelListener.java	20 Dec 2006 19:56:40 -0000	1.2
  @@ -1,10 +1,38 @@
   package org.jboss.ide.eclipse.packages.core.model;
   
  +/**
  + * Implementations of this interface should register themselves to listen with:
  + * <code>
  + * 	PackagesCore.registerPackagesModelListener(listener)
  + * </code>
  + * 
  + * @author Marshall
  + */
   public interface IPackagesModelListener {
   
  +	/**
  +	 * A node was added to the model
  +	 * @param added The added node
  +	 */
   	public void packageNodeAdded (IPackageNode added);
   	
  +	/**
  +	 * A node was removed from the model
  +	 * @param removed The removed node
  +	 */
   	public void packageNodeRemoved (IPackageNode removed);
   	
  +	/**
  +	 * A node's data/attirbutes were changed
  +	 * @param changed The changed node
  +	 */
   	public void packageNodeChanged (IPackageNode changed);
  +	
  +	/**
  +	 * A node has been attached to the model. This will only be called once
  +	 * for the top level attached node, any processing of sub-nodes will need to happen using IPackageNode.accept.
  +	 * 
  +	 * @param attached The node that was attached
  +	 */
  +	public void packageNodeAttached (IPackageNode attached);
   }
  
  
  
  1.4       +82 -2     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageNode.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IPackageNode.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageNode.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- IPackageNode.java	6 Dec 2006 17:02:56 -0000	1.3
  +++ IPackageNode.java	20 Dec 2006 19:56:40 -0000	1.4
  @@ -21,15 +21,95 @@
    */
   package org.jboss.ide.eclipse.packages.core.model;
   
  +import org.eclipse.core.resources.IProject;
  +
   /**
    * The super type of all package nodes (IPackage, IPackageFileSet, IPackageFolder)
    * 
    * Each node in a package may have arbitrary properties that can be reflected upon by other plug-ins
    * 
    * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
  + */
  +public interface IPackageNode {
  +	
  +	/**
  +	 * The node type that represents an IPackage
  +	 */
  +	public static final int TYPE_PACKAGE = 0;
  +	
  +	/**
  +	 * The node type that represents an IPackageFileSet
  +	 */
  +	public static final int TYPE_PACKAGE_FILESET = 1;
  +	
  +	/**
  +	 * The node type that represents an IPackageFolder
  +	 */
  +	public static final int TYPE_PACKAGE_FOLDER = 2;
  +	
  +	/**
  +	 * @return The parent of this package node, or null if this node is top level
  +	 */
  +	public IPackageNode getParent();
  +	
  +	/**
  +	 * Set the parent of this package node 
  +	 * @param parent The new parent of this node
  +	 */
  +	public void setParent(IPackageNode parent);
  +	
  +	/**
  +	 * @param type TYPE_PACKAGE, TYPE_PACKAGE_FILESET, or TYPE_PACKAGE_FOLDER
  +	 * @return An array of child nodes of the passed in type
  +	 */
  +	public IPackageNode[] getChildren(int type);
  +	
  +	/**
  +	 * @return An array of all children nodes
  +	 */
  +	public IPackageNode[] getAllChildren();
  +	
  +	/**
  +	 * @return Whether or not this node has children
  +	 */
  +	public boolean hasChildren();
  +	
  +	/**
  +	 * @param child A possible child node
  +	 * @return Whether or not the passed-in node is a child of this node
  +	 */
  +	public boolean hasChild(IPackageNode child);
  +	
  +	/**
  +	 * @return The type of this package node
  +	 */
  +	public int getNodeType();
  +	
  +	/**
  +	 * @param property The name of the property to fetch
  +	 * @return The value of the specified property
  +	 */
  +	public String getProperty(String property);
  +	
  +	/**
  +	 * @return The project that this node is defined in (not necessarily the project where this is based if this is a fileset)
  +	 */
  +	public IProject getProject();
  +	
  +	/**
  +	 * Recursively visit the package node tree below this node with the passed-in package node visitor.
  +	 * @param visitor A package node visitor
  +	 * @return Whether or not the entire sub-tree was visited
  +	 */
  +	public boolean accept(IPackageNodeVisitor visitor);
  +	
  +	/**
  +	 * Recursively visit the package node tree below this node with the passed-in package node visitor, using depth-first ordering
  +	 * @param visitor A package node visitor
  +	 * @return Whether or not the entire sub-tree was visited
    */
  -public interface IPackageNode extends IPackageNodeBase {
  +	public boolean accept(IPackageNodeVisitor visitor, boolean depthFirst);
   	
   	/**
   	 * Add a child node to this node
  
  
  
  1.5       +37 -8     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackage.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IPackage.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackage.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- IPackage.java	6 Dec 2006 20:17:55 -0000	1.4
  +++ IPackage.java	20 Dec 2006 19:56:40 -0000	1.5
  @@ -35,7 +35,7 @@
    * </p>
    * 
    * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public interface IPackage extends IPackageNode {
   
  @@ -115,13 +115,6 @@
   	public IPackageFileSet[] getFileSets();
   	
   	/**
  -	 * Create a working copy of this IPackage. This will allow you to work on a disconnected model object until
  -	 * you are ready to make the changes live, at which point you can use workingCopy.save()
  -	 * @return A working copy of this package
  -	 */
  -	public IPackageWorkingCopy createPackageWorkingCopy();
  -
  -	/**
   	 * Get the IFile that corresponds with this package. Note that this method only works for in-workspace packages (null will be returned otherwise)
   	 * @return The corresponding IFile in the workspace (note that this file may not exist)
   	 */
  @@ -139,4 +132,40 @@
   	 * @return a relative IPath to this package's top level parent
   	 */
   	public IPath getPackageRelativePath();
  +	
  +	/**
  +	 * Set the package type of this package
  +	 * @param type The package type
  +	 */
  +	public void setPackageType(IPackageType type);
  +
  +	/**
  +	 * Set the name of this package
  +	 * @param name This package's name
  +	 */
  +	public void setName(String name);
  +	
  +	/**
  +	 * Set whether or not this package is generated as a folder
  +	 * @param exploded
  +	 */
  +	public void setExploded(boolean exploded);
  +	
  +	/**
  +	 * Set a path to a custom manifest for this package. This is usefulf or runnable JARs etc.
  +	 * @param manifestFile The manifest file in the workspace
  +	 */
  +	public void setManifest(IFile manifestFile);
  +	
  +	/**
  +	 * Sets the destination folder in the filesystem for this package
  +	 * @param path The absolute path where this package will be built
  +	 */
  +	public void setDestinationFolder (IPath path);
  +	
  +	/**
  +	 * Sets the destination container in the workspace for this package
  +	 * @param container The container where this package will be built
  +	 */
  +	public void setDestinationContainer(IContainer container);
   }
  
  
  



More information about the jboss-cvs-commits mailing list