[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
Mon Nov 6 16:35:27 EST 2006


  User: mculpepper
  Date: 06/11/06 16:35:27

  Added:       core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model            
                        IPackageNodeVisitor.java IPackage.java
                        PackagesCore.java IPackageFolder.java
                        IPackageWorkingCopy.java
                        IPackagesModelListener.java
                        IPackageNodeWorkingCopy.java
                        IPackagesBuildListener.java
                        IPackageFileSetWorkingCopy.java
                        IPackageFileSet.java IPackageFolderWorkingCopy.java
                        IPackageNode.java
  Log:
  initial commit of the new "packages" tooling core plugin
  
  Revision  Changes    Path
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageNodeVisitor.java
  
  Index: IPackageNodeVisitor.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.packages.core.model;
  
  public interface IPackageNodeVisitor {
  
  	public boolean visit (IPackageNode node);
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackage.java
  
  Index: IPackage.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.packages.core.model;
  
  import java.util.jar.Manifest;
  
  import org.eclipse.core.resources.IContainer;
  import org.eclipse.core.resources.IFile;
  import org.eclipse.core.runtime.IPath;
  
  /** 
   * <p>
   * This interface represents a package definition.
   * A package definition consists of a list of folders, filesets, and sub-packages
   * </p>
   * 
   * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
   * @version $Revision: 1.1 $
   */
  public interface IPackage extends IPackageNode {
  
  	/**
  	 * @return The package type of this package.
  	 */
  	public String getPackageType();
  
  	public String getName();
  	
  	public boolean isReference();
  	
  	public boolean isExploded();
  	
  	public boolean isTopLevel();
  	
  	public boolean hasManifest();
  	
  	public Manifest getManifest();
  	
  	public boolean isDestinationInWorkspace();
  	
  	public IPath getDestinationFolder();
  	
  	public IContainer getDestinationContainer();
  	
  	public IPackage[] getPackages();
  	
  	public IPackageFolder[] getFolders();
  	
  	public IPackageFileSet[] getFileSets();
  	
  	public IPackageWorkingCopy createPackageWorkingCopy();
  
  	/**
  	 * Get the IFile that corresponds with this package.
  	 * @return The corresponding IFile in the workspace (note that this file may not exist)
  	 */
  	public IFile getPackageFile();
  
  	public IPath getPackageRelativePath();
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/PackagesCore.java
  
  Index: PackagesCore.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.packages.core.model;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import org.apache.tools.ant.DirectoryScanner;
  import org.eclipse.core.resources.IContainer;
  import org.eclipse.core.resources.IFile;
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.runtime.CoreException;
  import org.eclipse.core.runtime.IPath;
  import org.eclipse.core.runtime.IProgressMonitor;
  import org.eclipse.core.runtime.NullProgressMonitor;
  import org.eclipse.core.runtime.Path;
  import org.eclipse.core.runtime.QualifiedName;
  import org.jboss.ide.eclipse.packages.core.model.internal.PackageBuildDelegate;
  import org.jboss.ide.eclipse.packages.core.model.internal.PackagesModel;
  
  public class PackagesCore {
  
  	public static final QualifiedName PROPERTY_ANT_SCRIPT_PATH =
  		new QualifiedName("org.jboss.ide.eclipse.packages.core", "antScriptPath");
  
  	public static final IPath DEFAULT_ANT_SCRIPT_PATH = new Path("buildPackages.xml");
  	
  	public static IPackage[] getProjectPackages (IProject project, IProgressMonitor monitor)
  	{
  		if (monitor == null) monitor = new NullProgressMonitor();
  		
  		monitor.beginTask("Fetching packages for \"" + project.getName() + "\"...", 2);
  		List packages = PackagesModel.instance().getProjectPackages(project);
  		monitor.worked(1);
  		
  		if (packages == null) {
  			if (project.getFile(PackagesModel.PROJECT_PACKAGES_FILE).exists())
  			{
  				// lazy init
  				PackagesModel.instance().registerProject(project, monitor);
  				packages = PackagesModel.instance().getProjectPackages(project);
  			}
  			
  			if (packages == null) return null;
  		}
  
  		monitor.worked(1);
  		monitor.done();
  		
  		return (IPackage[]) packages.toArray(new IPackage[packages.size()]);
  	}
  	
  	public static boolean projectHasPackages (IProject project)
  	{
  		return project.getFile(PackagesModel.PROJECT_PACKAGES_FILE).exists();
  	}
  	
  	/**
  	 * Find files that match the given inclusion and exclusion pattern under the file system absolute path "root"
  	 * @param root An IPath that represents an absolute file system path (the root to search)
  	 * @param includesPattern A pattern of ant-style inclusions
  	 * @param excludesPattern A pattern of ant-style exclusions
  	 * @return An array of absolute IPath's pointing to matching files in the filesystem
  	 */
  	public static IPath[] findMatchingPaths (IPath root, String includesPattern, String excludesPattern)
  	{
  		DirectoryScanner scanner = PackagesModel.createDirectoryScanner(
  				root, includesPattern, excludesPattern);
  		
  		return findMatchingPaths(scanner, root, includesPattern, excludesPattern);
  	}
  	
  	public static IPath[] findMatchingPaths (DirectoryScanner scanner, IPath root, String includesPattern, String excludesPattern)
  	{
  		ArrayList paths = new ArrayList();
  		
  		String matched[] = scanner.getIncludedFiles();
  		for (int i = 0; i < matched.length; i++)
  		{
  			IPath path = root.append(new Path(matched[i]));
  			paths.add(path);
  		}
  		
  		return (IPath[])paths.toArray(new IPath[paths.size()]);
  	}
  	
  	/**
  	 * Find files that match the given inclusion and exclusion pattern under the workspace container "root"
  	 * @param root An IContainer in the current workspace to search
  	 * @param includesPattern A pattern of ant-style inclusions
  	 * @param excludesPattern A pattern of ant-style exclusions
  	 * @return
  	 */
  	public static IFile[] findMatchingFiles (IContainer root, String includesPattern, String excludesPattern)
  	{
  		DirectoryScanner scanner = PackagesModel.createDirectoryScanner(
  				root, includesPattern, excludesPattern);
  		
  		return findMatchingFiles(scanner, root, includesPattern, excludesPattern);
  	}
  	
  	public static IFile[] findMatchingFiles (DirectoryScanner scanner, IContainer root, String includesPattern, String excludesPattern)
  	{
  		ArrayList files = new ArrayList();
  		
  		String matched[] = scanner.getIncludedFiles();
  		for (int i = 0; i < matched.length; i++)
  		{
  			IFile file = root.getFile(new Path(matched[i]));
  			if (file.exists())
  			{
  				files.add(file);
  			}
  		}
  		
  		return (IFile[])files.toArray(new IFile[files.size()]);
  	}
  	
  	public static IPath getPathToPackagesScript (IProject project)
  	{
  		try {
  			String scriptPath = project.getPersistentProperty(PROPERTY_ANT_SCRIPT_PATH);
  			if (scriptPath == null) {
  				project.setPersistentProperty(PROPERTY_ANT_SCRIPT_PATH, DEFAULT_ANT_SCRIPT_PATH.toString());
  				return DEFAULT_ANT_SCRIPT_PATH;
  			}
  			else
  				return new Path(scriptPath);
  		} catch (CoreException e) {
  			e.printStackTrace();
  		}
  		
  		return DEFAULT_ANT_SCRIPT_PATH;
  	}
  	
  	public static IPath getRawPathToPackagesScript (IProject project)
  	{
  		IPath scriptPath = getPathToPackagesScript(project);
  		IFile script = project.getFile(scriptPath);
  		if (script != null)
  		{
  			if (script.getLocation() == null)
  				return script.getRawLocation();
  			return script.getLocation();
  		}
  		
  		return scriptPath;
  	}
  	
  	/**
  	 * Visit all of the top-level packages in the passed in project with the passed in node visitor
  	 * @param project The project whose packages to visit
  	 * @param visitor The visitor
  	 */
  	public static void visitProjectPackages (IProject project, IPackageNodeVisitor visitor)
  	{
  		if (projectHasPackages(project))
  		{
  			IPackage packages[] = getProjectPackages(project, null);
  			for (int i = 0; i < packages.length; i++)
  			{
  				boolean keepGoing = packages[i].accept(visitor);
  				if (!keepGoing) break;
  			}
  		}
  	}
  	
  	public static IPackage getTopLevelPackage (IPackageNode node)
  	{
  		IPackageNode tmp = node.getParent(), top = tmp;
  		while (tmp != null)
  		{
  			top = tmp;
  			tmp = tmp.getParent();
  		}
  		
  		if (top instanceof IPackage)
  			return (IPackage)top;
  		else return null;
  	}
  	
  	/**
  	 * @see getPackage(IFile);
  	 * 
  	 * @param project The project
  	 * @param path The project relative path of the IPackage
  	 * @return an IPackage or null
  	 */
  	public static IPackage getPackage (IProject project, IPath path)
  	{
  		return getPackage(project.getFile(path));
  	}
  	
  	/**
  	 * Returns the IPackage represented by the passed-in file.
  	 * This will return null if the passed-in file does not represent an IPackage. Note that this will
  	 * return an IPackage that's destination matches, but it may not actually exist yet.
  	 * 
  	 * @param project The project
  	 * @param path The project relative path of the IPackage
  	 * @return an IPackage or null
  	 */
  	public static IPackage getPackage (IFile file)
  	{
  		IPackage[] packages = getProjectPackages(file.getProject(), null);
  		for (int i = 0; i < packages.length; i++)
  		{
  			if (packages[i].getPackageFile().equals(file))
  			{
  				return packages[i];
  			}
  		}
  		
  		return null;
  	}
  	
  	/**
  	 * Build the passed-in package.
  	 * @param pkg The package to build
  	 */
  	public static void buildPackage (IPackage pkg, IProgressMonitor monitor)
  	{
  		if (monitor == null) monitor = new NullProgressMonitor();
  
  		PackageBuildDelegate delegate = new PackageBuildDelegate(pkg.getProject());
  		
  		delegate.buildSinglePackage(pkg, monitor);
  	}
  	
  	public static IPackageWorkingCopy createPackage (IProject project)
  	{
  		return PackagesModel.instance().createPackage(project);
  	}
  	
  	public static IPackageFolderWorkingCopy createPackageFolder (IProject project)
  	{
  		return PackagesModel.instance().createPackageFolder(project);
  	}
  	
  	public static IPackageFileSetWorkingCopy createPackageFileSet (IProject project)
  	{
  		return PackagesModel.instance().createPackageFileSet(project);
  	}
  	
  	public static void addPackagesModelListener (IPackagesModelListener listener)
  	{
  		PackagesModel.instance().addPackagesModelListener(listener);
  	}
  	
  	public static void removePackagesModelListener (IPackagesModelListener listener)
  	{
  		PackagesModel.instance().removePackagesModelListener(listener);
  	}
  	
  	public static void addPackagesBuildListener (IPackagesBuildListener listener)
  	{
  		PackagesModel.instance().addPackagesBuildListener(listener);
  	}
  	
  	public static void removePackagesBuildListener (IPackagesBuildListener listener)
  	{
  		PackagesModel.instance().removePackagesBuildListener(listener);
  	}
  	
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFolder.java
  
  Index: IPackageFolder.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.packages.core.model;
  
  import org.eclipse.core.runtime.IPath;
  
  /**
   * <p>
   * This interface represents a folder inside a package definition.
   * A folder can contain packages, filesets, and sub-folders.
   * </p>
   * 
   * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
   * @version $Revision: 1.1 $
   */
  public interface IPackageFolder extends IPackageNode {
  
  	public String getName();
  	
  	public IPackage[] getPackages();
  	
  	public IPackageFolder[] getFolders();
  	
  	public IPackageFileSet[] getFileSets();
  	
  	public IPackageFolderWorkingCopy createFolderWorkingCopy();
  	
  	public IPath getPackageRelativePath();
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageWorkingCopy.java
  
  Index: IPackageWorkingCopy.java
  ===================================================================
  package org.jboss.ide.eclipse.packages.core.model;
  
  import org.eclipse.core.resources.IContainer;
  import org.eclipse.core.resources.IFile;
  import org.eclipse.core.runtime.IPath;
  
  public interface IPackageWorkingCopy extends IPackage, IPackageNodeWorkingCopy {
  	public void setPackageType(String type);
  
  	public void setName(String name);
  	
  	public void setExploded(boolean exploded);
  	
  	public void setManifest(IFile manifestFile);
  	
  	public void setDestinationFolder (IPath path);
  	
  	public void setDestinationContainer(IContainer container);
  	
  	public void addPackage(IPackage pkb);
  	public void addFolder(IPackageFolder folder);
  	public void addFileSet(IPackageFileSet fileset);
  	
  	public IPackage getOriginalPackage();
  	
  	public IPackage savePackage();
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackagesModelListener.java
  
  Index: IPackagesModelListener.java
  ===================================================================
  package org.jboss.ide.eclipse.packages.core.model;
  
  public interface IPackagesModelListener {
  
  	public void packageNodeAdded (IPackageNode added);
  	
  	public void packageNodeRemoved (IPackageNode removed);
  	
  	public void packageNodeChanged (IPackageNode changed);
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageNodeWorkingCopy.java
  
  Index: IPackageNodeWorkingCopy.java
  ===================================================================
  package org.jboss.ide.eclipse.packages.core.model;
  
  public interface IPackageNodeWorkingCopy extends IPackageNode {
  	
  	public void setProperty(String property, String value);
  	
  	public IPackageNode save();
  	
  	public IPackageNode getOriginal();
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackagesBuildListener.java
  
  Index: IPackagesBuildListener.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.packages.core.model;
  
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.runtime.IStatus;
  
  /**
   * This interface is inteded to be implemented by classes who are interested in receiving callbacks for various IPackage build events
   * 
   * @author Marshall
   */
  public interface IPackagesBuildListener {
  
  	/**
  	 * A project has started being built by the packages builder
  	 * @param project the project being built
  	 */
  	public void startedBuild (IProject project);
  	
  	/**
  	 * A package has started being built by the packages builder
  	 * @param pkg the package being built
  	 */
  	public void startedBuildingPackage (IPackage pkg);
  	
  	/**
  	 * A fileset has started being collected for copying into a package
  	 * @param fileset the fileset being collected
  	 */
  	public void startedCollectingFileSet (IPackageFileSet fileset);
  	
  	/**
  	 * The build for the given project has failed
  	 * @param project The project who's packages build failed
  	 * @param status The status/exception that occurred
  	 */
  	public void buildFailed (IProject project, IStatus status);
  	
  	/**
  	 * A fileset has finished being collected for copying into a package
  	 * @param fileset the fileset being collected
  	 */
  	public void finishedCollectingFileSet (IPackageFileSet fileset);
  	
  	/**
  	 * A project is finished being built by the packages builder
  	 * @param project the project being built
  	 */
  	public void finishedBuild (IProject project);
  	
  	/**
  	 * A package is finished being built by the packages builder
  	 * @param pkg the package being built
  	 */
  	public void finishedBuildingPackage (IPackage pkg);
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFileSetWorkingCopy.java
  
  Index: IPackageFileSetWorkingCopy.java
  ===================================================================
  package org.jboss.ide.eclipse.packages.core.model;
  
  import org.eclipse.core.resources.IContainer;
  import org.eclipse.core.resources.IFile;
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.runtime.IPath;
  
  public interface IPackageFileSetWorkingCopy extends IPackageFileSet, IPackageNodeWorkingCopy {
  	
  	/**
  	 * Set this fileset to be a single file
  	 * Equivalent to:
  	 * <code>setSingleFile(file, null);</code>
  	 * 
  	 * @param file the single file for this fileset
  	 */
  	public void setSingleFile(IFile file);
  	
  	public void setSingleFile(IFile file, String destinationFilename);
  	
  	public void setSingleFile(IPath path);
  	
  	public void setSingleFile(IPath path, String destinationFilename);
  	
  	public void setSourceProject(IProject project);
  	
  	public void setSourceContainer(IContainer container);
  	
  	public void setSourceFolder(IPath path);
  	
  	public void setIncludesPattern(String includes);
  	
  	public void setExcludesPattern(String excludes);
  	
  	public void setInWorkspace(boolean isInWorkspace);
  	
  	public IPackageFileSet getOriginalFileSet();
  	
  	public IPackageFileSet saveFileSet();
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFileSet.java
  
  Index: IPackageFileSet.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.packages.core.model;
  
  import org.eclipse.core.resources.IContainer;
  import org.eclipse.core.resources.IFile;
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.runtime.IPath;
  
  /**
   * <p>
   * This interface represents a file set inside of a package definition or folder.
   * </p>
   * 
   * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
   * @version $Revision: 1.1 $
   */
  public interface IPackageFileSet extends IPackageNode {
  
  	public boolean isSingleFile();
  	
  	public boolean isInWorkspace();
  	
  	public IFile getFile();
  	
  	public IPath getFilePath();
  	
  	public String getDestinationFilename();
  	
  	public IProject getSourceProject();
  	
  	public IContainer getSourceContainer();
  	
  	public IPath getSourceFolder();
  	
  	public String getIncludesPattern();
  	
  	public String getExcludesPattern();
  	
  	public IFile[] findMatchingFiles();
  	
  	public IPath[] findMatchingPaths();
  	
  	public boolean matchesFile(IFile file);
  	
  	public boolean matchesPath(IPath path);
  	
  	public IPackageFileSetWorkingCopy createFileSetWorkingCopy();
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageFolderWorkingCopy.java
  
  Index: IPackageFolderWorkingCopy.java
  ===================================================================
  package org.jboss.ide.eclipse.packages.core.model;
  
  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);
  	
  	public IPackageFolder getOriginalFolder();
  	public IPackageFolder saveFolder();
  }
  
  
  
  1.1      date: 2006/11/06 21:35:27;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/model/IPackageNode.java
  
  Index: IPackageNode.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  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.1 $
   */
  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 void addChild(IPackageNode child);
  	
  	public void removeChild(IPackageNode child);
  }
  
  
  



More information about the jboss-cvs-commits mailing list