[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 6 12:02:56 EST 2006


  User: mculpepper
  Date: 06/12/06 12:02:56

  Modified:    core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model        
                        IPackageNodeWorkingCopy.java
                        IPackageFolderWorkingCopy.java
                        IPackageWorkingCopy.java IPackageNode.java
                        PackagesCore.java IPackageFileSetWorkingCopy.java
                        IPackageFileSet.java
  Added:       core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model        
                        IPackageNodeBase.java
  Log:
  changed the model hierarchy so node working copy's have no reference to add/remove child, and removed addFolder etc from the working copy classes (they should've been removed a long time ago). also made wrote lots of javadoc where there was none before
  
  Revision  Changes    Path
  1.2       +17 -1     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageNodeWorkingCopy.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IPackageNodeWorkingCopy.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageNodeWorkingCopy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- IPackageNodeWorkingCopy.java	6 Nov 2006 21:35:27 -0000	1.1
  +++ IPackageNodeWorkingCopy.java	6 Dec 2006 17:02:56 -0000	1.2
  @@ -1,10 +1,26 @@
   package org.jboss.ide.eclipse.packages.core.model;
   
  -public interface IPackageNodeWorkingCopy extends IPackageNode {
  +/**
  + * A working copy of a package node. Working copies are used to set attributes on a package node.
  + * @author Marshall
  + */
  +public interface IPackageNodeWorkingCopy extends IPackageNodeBase {
   	
  +	/**
  +	 * Set a property on this working copy
  +	 * @param property The property to set
  +	 * @param value The value of the property
  +	 */
   	public void setProperty(String property, String value);
   	
  +	/**
  +	 * Save this working copy (will overwrite the values in the original node)
  +	 * @return The original node
  +	 */
   	public IPackageNode save();
   	
  +	/**
  +	 * @return The original node this working copy is derived from
  +	 */
   	public IPackageNode getOriginal();
   }
  
  
  
  1.2       +17 -4     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFolderWorkingCopy.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IPackageFolderWorkingCopy.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFolderWorkingCopy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- IPackageFolderWorkingCopy.java	6 Nov 2006 21:35:27 -0000	1.1
  +++ IPackageFolderWorkingCopy.java	6 Dec 2006 17:02:56 -0000	1.2
  @@ -1,12 +1,25 @@
   package org.jboss.ide.eclipse.packages.core.model;
   
  +/**
  + * A working copy of an IPackageFolder, used to set the folder's attributes
  + * @author Marshall
  + */
   public interface IPackageFolderWorkingCopy extends IPackageFolder, IPackageNodeWorkingCopy {
  -	public void setName(String name);
   	
  -	public void addPackage(IPackage pkg);
  -	public void addFolder(IPackageFolder folder);
  -	public void addFileSet(IPackageFileSet fileset);
  +	/**
  +	 * Set the name of this folder
  +	 * @param name The name of this folder
  +	 */
  +	public void setName(String name);
   	
  +	/**
  +	 * @return The original folder this working copy is derived from
  +	 */
   	public IPackageFolder getOriginalFolder();
  +	
  +	/**
  +	 * Save this working copy's data into the original folder
  +	 * @return A reference to the original folder
  +	 */
   	public IPackageFolder saveFolder();
   }
  
  
  
  1.3       +35 -4     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageWorkingCopy.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IPackageWorkingCopy.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageWorkingCopy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- IPackageWorkingCopy.java	20 Nov 2006 21:06:04 -0000	1.2
  +++ IPackageWorkingCopy.java	6 Dec 2006 17:02:56 -0000	1.3
  @@ -5,24 +5,55 @@
   import org.eclipse.core.runtime.IPath;
   import org.jboss.ide.eclipse.packages.core.model.types.IPackageType;
   
  +/**
  + * A working copy of an IPackage, used to set the package's attributes
  + * @author Marshall
  + */
   public interface IPackageWorkingCopy extends IPackage, IPackageNodeWorkingCopy {
  +	/**
  +	 * 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);
   	
  -	public void addPackage(IPackage pkb);
  -	public void addFolder(IPackageFolder folder);
  -	public void addFileSet(IPackageFileSet fileset);
  -	
  +	/**
  +	 * @return The package that this working copy was derived from
  +	 */
   	public IPackage getOriginalPackage();
   	
  +	/**
  +	 * Save this working copy's data into the original package
  +	 * @return A reference to the original package
  +	 */
   	public IPackage savePackage();
   }
  
  
  
  1.3       +10 -27    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.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- IPackageNode.java	8 Nov 2006 19:54:41 -0000	1.2
  +++ IPackageNode.java	6 Dec 2006 17:02:56 -0000	1.3
  @@ -21,43 +21,26 @@
    */
   package org.jboss.ide.eclipse.packages.core.model;
   
  -import org.eclipse.core.resources.IProject;
  -import org.eclipse.core.runtime.IAdaptable;
  -
   /**
    * 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.2 $
  + * @version $Revision: 1.3 $
    */
  -public interface IPackageNode extends IAdaptable {
  -
  -	public static final int TYPE_PACKAGE = 0;
  -	public static final int TYPE_PACKAGE_FILESET = 1;
  -	public static final int TYPE_PACKAGE_FOLDER = 2;
  -	
  -	public IPackageNode getParent();
  -	public IPackageNode[] getChildren(int type);
  -	public IPackageNode[] getAllChildren();
  -	public boolean hasChildren();
  -	public boolean hasChild(IPackageNode child);
  -	
  -	public int getNodeType();
  -	
  -	public String getProperty(String property);
  -	
  -	public IProject getProject();
  -	
  -	public boolean accept(IPackageNodeVisitor visitor);
  -	public boolean accept(IPackageNodeVisitor visitor, boolean depthFirst);
  -	
  -	public IPackageNodeWorkingCopy createWorkingCopy();
  +public interface IPackageNode extends IPackageNodeBase {
   	
  +	/**
  +	 * Add a child node to this node
  +	 * @param child The child to add
  +	 */
   	public void addChild(IPackageNode child);
   	
  +	/**
  +	 * Remove a child node from this node
  +	 * @param child The child to remove
  +	 */
   	public void removeChild(IPackageNode child);
   	
  -	public boolean hasWorkingCopy();
   }
  
  
  
  1.10      +1 -1      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.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- PackagesCore.java	4 Dec 2006 22:23:08 -0000	1.9
  +++ PackagesCore.java	6 Dec 2006 17:02:56 -0000	1.10
  @@ -190,7 +190,7 @@
   	
   	public static IPackage getTopLevelPackage (IPackageNode node)
   	{
  -		IPackageNode tmp = node.getParent(), top = tmp;
  +		IPackageNodeBase tmp = node.getParent(), top = tmp;
   		while (tmp != null)
   		{
   			top = tmp;
  
  
  
  1.2       +53 -1     jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFileSetWorkingCopy.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IPackageFileSetWorkingCopy.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFileSetWorkingCopy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- IPackageFileSetWorkingCopy.java	6 Nov 2006 21:35:27 -0000	1.1
  +++ IPackageFileSetWorkingCopy.java	6 Dec 2006 17:02:56 -0000	1.2
  @@ -5,10 +5,14 @@
   import org.eclipse.core.resources.IProject;
   import org.eclipse.core.runtime.IPath;
   
  +/**
  + * A working copy of an IPackageFileSet, used to set the fileset's attributes
  + * @author Marshall
  + */
   public interface IPackageFileSetWorkingCopy extends IPackageFileSet, IPackageNodeWorkingCopy {
   	
   	/**
  -	 * Set this fileset to be a single file
  +	 * Set this fileset to be a single file in the workspace
   	 * Equivalent to:
   	 * <code>setSingleFile(file, null);</code>
   	 * 
  @@ -16,25 +20,73 @@
   	 */
   	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);
   	
  +	/**
  +	 * @return The original fileset this working copy is derived from
  +	 */
   	public IPackageFileSet getOriginalFileSet();
   	
  +	/**
  +	 * Save this working copy's data into the original fileset
  +	 * @return A reference to the original fileset
  +	 */
   	public IPackageFileSet saveFileSet();
   }
  
  
  
  1.2       +51 -0     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.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- IPackageFileSet.java	6 Nov 2006 21:35:27 -0000	1.1
  +++ IPackageFileSet.java	6 Dec 2006 17:02:56 -0000	1.2
  @@ -32,37 +32,88 @@
    * </p>
    * 
    * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public interface IPackageFileSet extends IPackageNode {
   
  +	/**
  +	 * @return Whether or not this fileset represents a single file
  +	 */
   	public boolean isSingleFile();
   	
  +	/**
  +	 * @return Whether or not this fileset's basedir is inside the workspace
  +	 */
   	public boolean isInWorkspace();
   	
  +	/**
  +	 * If this fileset represents a single file, and that file is in the workspace, this will return a reference to that file.
  +	 * Otherwise this will return null.
  +	 */
   	public IFile getFile();
   	
  +	/**
  +	 * If this fileset represents a single file, and that file is not in the workspace, this will return a filesystem path to that file.
  +	 * Otherwise this will return null.
  +	 */
   	public IPath getFilePath();
   	
  +	/**
  +	 * If this fileset represents a single file, this will return the destination filename of the file within this package
  +	 */
   	public String getDestinationFilename();
   	
  +	/**
  +	 * This is a convenience method that will cast getSourceContainer() to an IProject if the source/basedir for this fileset represents a project
  +	 */
   	public IProject getSourceProject();
   	
  +	/**
  +	 * If this fileset is based inside the workspace, this will return the workspace container at the root / base of this fileset.
  +	 * @return The source container ("basedir" in ant terminology) for this fileset
  +	 */
   	public IContainer getSourceContainer();
   	
  +	/**
  +	 * If this fileset is based in the external filesystem, this will return the absolute path of the root / base of this fileset.
  +	 * @return The path to the source folder ("basedir" in ant terminology) for this fileset
  +	 */
   	public IPath getSourceFolder();
   	
  +	/**
  +	 * @return The includes pattern for this fileset
  +	 */
   	public String getIncludesPattern();
   	
  +	/**
  +	 * @return The excludes pattern for this fileset
  +	 */
   	public String getExcludesPattern();
   	
  +	/**
  +	 * @return An array of matching IFile's in the workspace (for workspace-rooted filesets)
  +	 */
   	public IFile[] findMatchingFiles();
   	
  +	/**
  +	 * @return An array of matching IPath's in the filesystem (for external filesystem filesets)
  +	 */
   	public IPath[] findMatchingPaths();
   	
  +	/**
  +	 * @param file The file to check
  +	 * @return Whether or not this fileset matches the passed-in file
  +	 */
   	public boolean matchesFile(IFile file);
   	
  +	/**
  +	 * @param path The absolute path on the filesystem to check
  +	 * @return Whether or not this fileset matches the passed-in path
  +	 */
   	public boolean matchesPath(IPath path);
   	
  +	/**
  +	 * @return A working copy of this fileset
  +	 */
   	public IPackageFileSetWorkingCopy createFileSetWorkingCopy();
   }
  
  
  
  1.1      date: 2006/12/06 17:02:56;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageNodeBase.java
  
  Index: IPackageNodeBase.java
  ===================================================================
  package org.jboss.ide.eclipse.packages.core.model;
  
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.runtime.IAdaptable;
  
  /**
   * The base the entire package node class hierarchy.
   * 
   * 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.1 $
   */
  public interface IPackageNodeBase extends IAdaptable {
  
  	/**
  	 * 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 IPackageNodeBase getParent();
  	
  	/**
  	 * @param type TYPE_PACKAGE, TYPE_PACKAGE_FILESET, or TYPE_PACKAGE_FOLDER
  	 * @return An array of child nodes of the passed in type
  	 */
  	public IPackageNodeBase[] getChildren(int type);
  	
  	/**
  	 * @return An array of all children nodes
  	 */
  	public IPackageNodeBase[] 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(IPackageNodeBase 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 boolean accept(IPackageNodeVisitor visitor, boolean depthFirst);
  	
  	/**
  	 * @return A working copy of this package node
  	 */
  	public IPackageNodeWorkingCopy createWorkingCopy();
  
  	/**
  	 * @return Whether or not this node has an outstanding working copy
  	 */
  	public boolean hasWorkingCopy();
  }
  
  
  



More information about the jboss-cvs-commits mailing list