Java Doc for SourcesHelper.java in  » IDE-Netbeans » project.ant » org » netbeans » spi » project » support » ant » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » project.ant » org.netbeans.spi.project.support.ant 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.spi.project.support.ant.SourcesHelper

SourcesHelper
final public class SourcesHelper (Code)
Helper class to work with source roots and typed folders of a project.
author:
   Jesse Glick



Constructor Summary
public  SourcesHelper(AntProjectHelper project, PropertyEvaluator evaluator)
     Create the helper object, initially configured to recognize only sources contained inside the project directory.

Method Summary
public  voidaddNonSourceRoot(String location)
     Similar to SourcesHelper.addPrincipalSourceRoot but affects only SourcesHelper.registerExternalRoots and not SourcesHelper.createSources .

Useful for project type providers which have external paths holding build products.

public  voidaddOwnedFile(String location)
     Add any file that is supposed to be owned by a given project via FileOwnerQuery, affects only SourcesHelper.registerExternalRoots and not SourcesHelper.createSources .

Useful for project type providers which have external paths holding build products.

public  voidaddPrincipalSourceRoot(String location, String displayName, Icon icon, Icon openedIcon)
     Add a possible principal source root, or top-level folder which may contain sources that should be considered part of the project.
public  voidaddPrincipalSourceRoot(String location, String includes, String excludes, String displayName, Icon icon, Icon openedIcon)
     Add a possible principal source root, or top-level folder which may contain sources that should be considered part of the project, with optional include and exclude lists.

If an include or exclude string is given as null, then it is skipped.

public  voidaddTypedSourceRoot(String location, String type, String displayName, Icon icon, Icon openedIcon)
     Add a typed source root which will be considered only in certain contexts.
public  voidaddTypedSourceRoot(String location, String includes, String excludes, String type, String displayName, Icon icon, Icon openedIcon)
     Add a typed source root with optional include and exclude lists.
public  SourcescreateSources()
     Create a source list object.

All principal source roots are listed as Sources.TYPE_GENERIC unless they are inside the project directory.

public  voidregisterExternalRoots(int algorithm)
     Register all external source or non-source roots using FileOwnerQuery.markExternalOwner .

Only roots added by SourcesHelper.addPrincipalSourceRoot and SourcesHelper.addNonSourceRoot are considered.



Constructor Detail
SourcesHelper
public SourcesHelper(AntProjectHelper project, PropertyEvaluator evaluator)(Code)
Create the helper object, initially configured to recognize only sources contained inside the project directory.
Parameters:
  project - an Ant project helper
Parameters:
  evaluator - a way to evaluate Ant properties used to define source locations




Method Detail
addNonSourceRoot
public void addNonSourceRoot(String location) throws IllegalStateException(Code)
Similar to SourcesHelper.addPrincipalSourceRoot but affects only SourcesHelper.registerExternalRoots and not SourcesHelper.createSources .

Useful for project type providers which have external paths holding build products. These should not appear in Sources , yet it may be useful for FileOwnerQuery to know the owning project (for example, in order for a project-specific SourceForBinaryQueryImplementation to work).


Parameters:
  location - a project-relative or absolute path giving the locationof a non-source tree; may contain Ant property substitutions
throws:
  IllegalStateException - if this method is called afterSourcesHelper.registerExternalRoots was called



addOwnedFile
public void addOwnedFile(String location) throws IllegalStateException(Code)
Add any file that is supposed to be owned by a given project via FileOwnerQuery, affects only SourcesHelper.registerExternalRoots and not SourcesHelper.createSources .

Useful for project type providers which have external paths holding build products. These should not appear in Sources , yet it may be useful for FileOwnerQuery to know the owning project (for example, in order for a project-specific SourceForBinaryQueryImplementation to work).


Parameters:
  location - a project-relative or absolute path giving the locationof a file; may contain Ant property substitutions
throws:
  IllegalStateException - if this method is called afterSourcesHelper.registerExternalRoots was called
since:
   org.netbeans.modules.project.ant/1 1.17



addPrincipalSourceRoot
public void addPrincipalSourceRoot(String location, String displayName, Icon icon, Icon openedIcon) throws IllegalStateException(Code)
Add a possible principal source root, or top-level folder which may contain sources that should be considered part of the project.

If the actual value of the location is inside the project directory, this is simply ignored; so it safe to configure principal source roots for any source directory which might be set to use an external path, even if the common location is internal.


Parameters:
  location - a project-relative or absolute path giving the locationof a source tree; may contain Ant property substitutions
Parameters:
  displayName - a display name (for SourceGroup.getDisplayName)
Parameters:
  icon - a regular icon for the source root, or null
Parameters:
  openedIcon - an opened variant icon for the source root, or null
throws:
  IllegalStateException - if this method is called after eitherSourcesHelper.createSources or SourcesHelper.registerExternalRootswas called
See Also:   SourcesHelper.registerExternalRoots
See Also:   Sources.TYPE_GENERIC



addPrincipalSourceRoot
public void addPrincipalSourceRoot(String location, String includes, String excludes, String displayName, Icon icon, Icon openedIcon) throws IllegalStateException(Code)
Add a possible principal source root, or top-level folder which may contain sources that should be considered part of the project, with optional include and exclude lists.

If an include or exclude string is given as null, then it is skipped. A non-null value is evaluated and then treated as a comma- or space-separated pattern list, as detailed in the Javadoc for PathMatcher . (As a special convenience, a value consisting solely of an Ant property reference which cannot be evaluated, e.g. ${undefined}, is treated like null.) SourceGroup.contains will then reflect the includes and excludes for files, but note that the semantics of that method requires that a folder be "contained" in case any folder or file beneath it is contained, and in particular the root folder is always contained.


Parameters:
  location - a project-relative or absolute path giving the locationof a source tree; may contain Ant property substitutions
Parameters:
  includes - Ant-style includes; may contain Ant property substitutions;if not null, only files and foldersmatching the pattern (or patterns), and not specified in the excludes list,will be SourceGroup.contains included
Parameters:
  excludes - Ant-style excludes; may contain Ant property substitutions;if not null, files and foldersmatching the pattern (or patterns) will not be SourceGroup.contains included,even if specified in the includes list
Parameters:
  displayName - a display name (for SourceGroup.getDisplayName)
Parameters:
  icon - a regular icon for the source root, or null
Parameters:
  openedIcon - an opened variant icon for the source root, or null
throws:
  IllegalStateException - if this method is called after eitherSourcesHelper.createSources or SourcesHelper.registerExternalRootswas called
See Also:   SourcesHelper.registerExternalRoots
See Also:   Sources.TYPE_GENERIC
since:
   org.netbeans.modules.project.ant/1 1.15



addTypedSourceRoot
public void addTypedSourceRoot(String location, String type, String displayName, Icon icon, Icon openedIcon) throws IllegalStateException(Code)
Add a typed source root which will be considered only in certain contexts.
Parameters:
  location - a project-relative or absolute path giving the locationof a source tree; may contain Ant property substitutions
Parameters:
  type - a source root type such as JavaProjectConstants.SOURCES_TYPE_JAVA
Parameters:
  displayName - a display name (for SourceGroup.getDisplayName)
Parameters:
  icon - a regular icon for the source root, or null
Parameters:
  openedIcon - an opened variant icon for the source root, or null
throws:
  IllegalStateException - if this method is called after eitherSourcesHelper.createSources or SourcesHelper.registerExternalRootswas called



addTypedSourceRoot
public void addTypedSourceRoot(String location, String includes, String excludes, String type, String displayName, Icon icon, Icon openedIcon) throws IllegalStateException(Code)
Add a typed source root with optional include and exclude lists. See SourcesHelper.addPrincipalSourceRoot(String,String,String,String,Icon,Icon) for details on semantics of includes and excludes.
Parameters:
  location - a project-relative or absolute path giving the locationof a source tree; may contain Ant property substitutions
Parameters:
  includes - an optional list of Ant-style includes
Parameters:
  excludes - an optional list of Ant-style excludes
Parameters:
  type - a source root type such as JavaProjectConstants.SOURCES_TYPE_JAVA
Parameters:
  displayName - a display name (for SourceGroup.getDisplayName)
Parameters:
  icon - a regular icon for the source root, or null
Parameters:
  openedIcon - an opened variant icon for the source root, or null
throws:
  IllegalStateException - if this method is called after eitherSourcesHelper.createSources or SourcesHelper.registerExternalRootswas called
since:
   org.netbeans.modules.project.ant/1 1.15



createSources
public Sources createSources()(Code)
Create a source list object.

All principal source roots are listed as Sources.TYPE_GENERIC unless they are inside the project directory. The project directory itself is also listed (with a display name according to ProjectUtils.getInformation ), unless it is contained by an explicit principal source root (i.e. ancestor directory). Principal source roots should never overlap; if two configured principal source roots are determined to have the same root folder, the first configured root takes precedence (which only matters in regard to the display name); if one root folder is contained within another, the broader root folder subsumes the narrower one so only the broader root is listed.

Other source groups are listed according to the named typed source roots. There is no check performed that these do not overlap (though a project type provider should for UI reasons avoid this situation).

Any source roots which do not exist on disk are ignored, as if they had not been configured at all. Currently it is not defined when this existence check is performed (e.g. when this method is called, when the source root is first accessed, periodically, etc.), so project type providers are generally encouraged to make sure all desired source folders exist before calling this method, if creating a new project.

Source groups are created according to the semantics described in org.netbeans.spi.project.support.GenericSources.group . They are listed in the order they were configured (for those roots that are actually used as groups).

You may call this method inside the project's constructor, but Sources.getSourceGroups may not be called within the constructor, as it requires the actual project object to exist and be registered in ProjectManager .

a source list object suitable for Project.getLookup



registerExternalRoots
public void registerExternalRoots(int algorithm) throws IllegalArgumentException, IllegalStateException(Code)
Register all external source or non-source roots using FileOwnerQuery.markExternalOwner .

Only roots added by SourcesHelper.addPrincipalSourceRoot and SourcesHelper.addNonSourceRoot are considered. They are registered if (and only if) they in fact fall outside of the project directory, and of course only if the folders really exist on disk. Currently it is not defined when this file existence check is done (e.g. when this method is first called, or periodically) or whether folders which are created subsequently will be registered, so project type providers are encouraged to create all desired external roots before calling this method.

If the actual value of the location changes (due to changes being fired from the property evaluator), roots which were previously internal and are now external will be registered, and roots which were previously external and are now internal will be unregistered. The (un-)registration will be done using the same algorithm as was used initially.

If an explicit include list is configured for a principal source root, only those subfolders which are included (or folders directly containing included files) will be registered. Note that the source root, or an included subfolder, will be registered even if it contains excluded files or folders beneath it.

Calling this method causes the helper object to hold strong references to the current external roots, which helps a project satisfy the requirements of FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT .

You may not call this method inside the project's constructor, as it requires the actual project to exist and be registered in ProjectManager . Typically you would use org.openide.util.Mutex.postWriteRequest to run it later, if you were creating the helper in your constructor, since the project construction normally occurs in read access.


Parameters:
  algorithm - an external root registration algorithm as perFileOwnerQuery.markExternalOwner
throws:
  IllegalArgumentException - if the algorithm is unrecognized
throws:
  IllegalStateException - if this method is called more than once on agiven SourcesHelper object



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.