本文整理匯總了Java中org.netbeans.api.project.Project.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Project.equals方法的具體用法?Java Project.equals怎麽用?Java Project.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.netbeans.api.project.Project
的用法示例。
在下文中一共展示了Project.equals方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isInScope
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
@Override
public boolean isInScope( FileObject resource ) {
Project p = null;
synchronized( this ) {
p = currentProject;
}
if( null == resource || null == p )
return false;
Project owner = FileOwnerQuery.getOwner( resource );
if( null == owner )
return false;
if( owner.equals( p ) )
return true;
return false;
}
示例2: isOnSourceClasspath
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
public static boolean isOnSourceClasspath(FileObject fo) {
Project p = FileOwnerQuery.getOwner(fo);
if (p==null) return false;
Project[] opened = OpenProjects.getDefault().getOpenProjects();
for (int i = 0; i<opened.length; i++) {
if (p.equals(opened[i]) || opened[i].equals(p)) {
SourceGroup[] gr = ProjectUtils.getSources(p).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
for (int j = 0; j < gr.length; j++) {
if (fo==gr[j].getRootFolder()) return true;
if (FileUtil.isParentOf(gr[j].getRootFolder(), fo))
return true;
}
return false;
}
}
return false;
}
示例3: getFilesFromLookup
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
/** In given lookup will find all FileObjects owned by given project
* with given command supported.
*/
public static FileObject[] getFilesFromLookup( Lookup lookup, Project project ) {
HashSet<FileObject> result = new HashSet<FileObject>();
for (DataObject dObj : lookup.lookupAll(DataObject.class)) {
FileObject fObj = dObj.getPrimaryFile();
Project p = FileOwnerQuery.getOwner(fObj);
if ( p != null && p.equals( project ) ) {
result.add( fObj );
}
}
FileObject[] fos = new FileObject[ result.size() ];
result.toArray( fos );
return fos;
}
示例4: checkCurrentProject
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
/**
* use MFOQI to determine what is the current project owning our coordinates in local repository.
*/
private void checkCurrentProject() {
Project owner = null;
if (groupId != null && artifactId != null && version != null) {
owner = MavenFileOwnerQueryImpl.getInstance().getOwner(groupId, artifactId, version);
}
if (owner != null && owner.getLookup().lookup(NbMavenProject.class) == null) {
owner = null;
}
if (currentProject != null && !currentProject.equals(owner)) {
currentProject.getLookup().lookup(NbMavenProject.class).removePropertyChangeListener(projectListener);
}
if (owner != null && !owner.equals(currentProject)) {
owner.getLookup().lookup(NbMavenProject.class).addPropertyChangeListener(projectListener);
}
currentProject = owner;
}
示例5: getOwningMavenProject
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
private Project getOwningMavenProject(FileObject file) {
Project prj = FileOwnerQuery.getOwner(file);
if (prj == null || !prj.equals(project)) {
return null;
}
//#180447
if (!prj.getProjectDirectory().isValid()) {
return null;
}
NbMavenProject mvn = prj.getLookup().lookup(NbMavenProject.class);
if (mvn == null) {
return null;
}
if (RunUtils.isCompileOnSaveEnabled(prj)) {
return prj;
}
return null;
}
示例6: isOtherProjectSource
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
private static boolean isOtherProjectSource(
@NonNull final FileObject fo,
@NonNull final Project me) {
final Project owner = FileOwnerQuery.getOwner(fo);
if (owner == null) {
return false;
}
if (me.equals(owner)) {
return false;
}
for (SourceGroup sg : ProjectUtils.getSources(owner).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA)) {
if (FileUtil.isParentOf(sg.getRootFolder(), fo)) {
return true;
}
}
return false;
}
示例7: isSubProjectOf
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
private static boolean isSubProjectOf(Project p, Project op,
Map<Project, Set<? extends Project>> subProjects, // cache of sub-projects
Set<Project> allSubProjects) { // all inspected sub-projects
Set<? extends Project> sps = subProjects.get(op);
if (sps == null) {
//mkleint: see subprojectprovider for official contract, see #210465
SubprojectProvider spp = op.getLookup().lookup(SubprojectProvider.class);
if (spp == null) {
return false;
}
sps = spp.getSubprojects();
subProjects.put(op, sps);
}
for (Project sp : sps) {
if (allSubProjects.contains(sp)) {
continue;
}
allSubProjects.add(sp);
if (p.equals(sp) || isSubProjectOf(p, sp, subProjects, allSubProjects)) {
return true;
}
}
return false;
}
示例8: checkChanges
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
private void checkChanges(boolean fireChanges) {
// use MFOQI to determine what is the current project owning our coordinates in local repository.
Project owner = null;
if (groupId != null && artifactId != null && version != null) {
owner = MavenFileOwnerQueryImpl.getInstance().getOwner(groupId, artifactId, version);
if (owner != null && owner.getLookup().lookup(NbMavenProject.class) == null) {
owner = null;
}
}
synchronized (this) {
if (currentProject != null && !currentProject.equals(owner)) {
currentProject.getLookup().lookup(NbMavenProject.class).removePropertyChangeListener(projectListener);
}
if (owner != null && !owner.equals(currentProject)) {
owner.getLookup().lookup(NbMavenProject.class).addPropertyChangeListener(projectListener);
}
currentProject = owner;
if (fireChanges && !needsFiring.get()) { //only do check if interested in changes and when no known change occured
avoidScheduling = true;
try {
getRoots();
preferSources();
} finally {
avoidScheduling = false;
}
}
}
if (fireChanges && needsFiring.get()) {
support.fireChange();
}
}
示例9: getBootClassPath
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
@CheckForNull
private ClassPath getBootClassPath(@NonNull final FileObject artefact) {
int type = getType(artefact);
switch (type) {
case -1:
//Some old code rely on the existence of BootCP on any project file, mainly project folder.
//For compatibily reasons simulate this behavior even it's not correct.
//Cannot be done for multi module project, but there are no compatibility reasons as it's new.
final Project prj = getProject();
if (prj != null && prj.equals(FileOwnerQuery.getOwner(artefact))) {
type = 0;
break;
} else {
return null;
}
case 0:
case 2:
case 4:
type = 0;
break;
case 1:
case 3:
type = 1;
break;
default:
throw new IllegalArgumentException(Integer.toString(type));
}
return this.getBootClassPath(type);
}
示例10: isProjectOpen
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
/** Finds out if the project is opened.
* @param p the project to verify. Can be <code>null</code> in such case
* the method return <code>false</code>
* @return true if this project is among open ones, false otherwise
* @since 1.34
*/
public boolean isProjectOpen(Project p) {
if (p == null) {
return false;
}
for (Project real : getOpenProjects()) {
if (p.equals(real) || real.equals(p)) {
LOG.log(Level.FINE, "isProjectOpen => true for {0} @{1} ~ real @{2}", new Object[] {p, p.hashCode(), real.hashCode()});
return true;
}
LOG.log(Level.FINER, "distinct from {0} @{1}", new Object[] {real, real.hashCode()});
}
LOG.log(Level.FINE, "isProjectOpen => false for {0} @{1}", new Object[] {p, p.hashCode()});
return false;
}
示例11: findAndroidLocalProperties
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
private FileObject findAndroidLocalProperties(FileObject root, Project current) {
FileObject fo = root.getFileObject("local.properties");
if (fo != null) {
return fo;
} else {
Project owner = FileOwnerQuery.getOwner(root.getParent());
if ((owner instanceof NbGradleProject) && !owner.equals(current)) {
return findAndroidLocalProperties(root.getParent(), current);
} else {
return null;
}
}
}
示例12: findRootProject
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
private Project findRootProject(FileObject root, Project current) {
Project owner = FileOwnerQuery.getOwner(root.getParent());
if ((owner instanceof NbGradleProject) && !owner.equals(current)) {
return findRootProject(root.getParent(), owner);
} else {
return current;
}
}
示例13: logicalViewForProject
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
@NonNull
final Node logicalViewForProject(
@NonNull final Project project,
final Union2<LogicalViewProvider,org.openide.util.Pair<Sources,SourceGroup[]>> data,
final boolean[] projectInLookup) {
Node node;
if (!data.hasFirst()) {
LOG.log(
Level.WARNING,
"Warning - project of {0} in {1} failed to supply a LogicalViewProvider in its lookup", // NOI18N
new Object[]{
project.getClass(),
FileUtil.getFileDisplayName(project.getProjectDirectory())
});
final Sources sources = data.second().first();
final SourceGroup[] groups = data.second().second();
sources.removeChangeListener(this);
sources.addChangeListener(this);
if (groups.length > 0) {
node = PhysicalView.createNodeForSourceGroup(groups[0], project);
} else {
node = Node.EMPTY;
}
} else {
final LogicalViewProvider lvp = data.first();
node = lvp.createLogicalView();
if (!project.equals(node.getLookup().lookup(Project.class))) {
// Various actions, badging, etc. are not going to work.
LOG.log(
Level.WARNING,
"Warning - project {0} failed to supply itself in the lookup of the root node of its own logical view", // NOI18N
ProjectUtils.getInformation(project).getName());
//#114664
if (projectInLookup != null) {
projectInLookup[0] = false;
}
}
}
node.addNodeListener(WeakListeners.create(NodeListener.class, this, node));
return node;
}
示例14: customizerChanged
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
@Override
public void customizerChanged(Project project, CssPreprocessor cssPreprocessor) {
if (project.equals(project)) {
problemsProviderSupport.fireProblemsChange();
}
}
示例15: processingErrorOccured
import org.netbeans.api.project.Project; //導入方法依賴的package包/類
@Override
public void processingErrorOccured(Project project, CssPreprocessor cssPreprocessor, String error) {
if (project.equals(project)) {
problemsProviderSupport.fireProblemsChange();
}
}