本文整理汇总了Java中org.netbeans.spi.project.ui.support.NodeList类的典型用法代码示例。如果您正苦于以下问题:Java NodeList类的具体用法?Java NodeList怎么用?Java NodeList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeList类属于org.netbeans.spi.project.ui.support包,在下文中一共展示了NodeList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testListeners
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
public void testListeners() {
final JavaSourceNodeFactory f = new JavaSourceNodeFactory();
final NodeList<?> l = f.createNodes(prj);
final ChangeListener l1 = new CL();
final ChangeListener l2 = new CL();
//Paired add and remove
l.addChangeListener(l1);
l.removeChangeListener(l1);
//Paired add and remove of 2 listeners
l.addChangeListener(l1);
l.addChangeListener(l2);
l.removeChangeListener(l1);
l.removeChangeListener(l2);
//Unpaired remove
l.removeChangeListener(l1);
}
示例2: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
public NodeList createNodes(Project project) {
this.proj = project;
DataObject assetsFolder;
try {
//return a new node for the project view if theres an assets folder:
ProjectAssetManager item = project.getLookup().lookup(ProjectAssetManager.class);
if (item != null) {
assetsFolder = DataObject.find(item.getAssetFolder());
Node node = assetsFolder.getNodeDelegate();
// return NodeFactorySupport.fixedNodeList(node);
ProjectAssetsNode nd = new ProjectAssetsNode(item, proj, node);
// return NodeFactorySupport.createCompositeChildren(project, item.getAssetFolderName());//fixedNodeList(nd);
return NodeFactorySupport.fixedNodeList(nd);
}
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
//If our item isn't in the lookup,
//then return an empty list of nodes:
return NodeFactorySupport.fixedNodeList();
}
示例3: beforeCreateNodesCheck
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
/**
* Convenience implementation, that checks that the project has a proper
* ProjectSubfolderProvider in its lookup. Extend this class, override
* {@link #createNodes(org.netbeans.api.project.Project) } and first call
* <code>super.createNodes(p)</code>. If you get a non-null result - return it
* immediately, if you get null - create a proper NodeList.
* <b>WARNING:</b><br/>
* Never return null in your implementation!!!
* @param p
* @return null, if no errors were found in Project, or a NodeList, that you
* should return, in case of errors.
*/
public NodeList<?> beforeCreateNodesCheck(Project p) {
ProjectSubfolderProvider folderProvider = p.getLookup()
.lookup(getProjectSubfolderProviderClass());
if (folderProvider == null) {
AbstractNode errorNode = new AbstractNode(Children.LEAF);
Class<T> fp = getProjectSubfolderProviderClass();
String errMsgShort = String.format("ERROR: An implementation of %s "
+ "can't be found in project's lookup.", fp.getCanonicalName());
errorNode.setDisplayName(errMsgShort);
String errMsgLong = String.format("%s You must register a %s in your"
+ "project's lookup. Use @ProjectServiceProvider annotation for that. "
+ "Or drag&drop an instance in layer.xml from an existing project type, "
+ "e.g. 'Projects/umich-ms-batmass-projects-types-proteomics-proteomicsproject/Lookup'"
+ " to your project type similar .../Lookup folder.",
errMsgShort, fp.getSimpleName());
Exceptions.printStackTrace(new IllegalStateException(errMsgLong));
// Safety net - return a NodeList to make the error state clearly visible.
// Also, we're not allowed to return null from this method.
return NodeFactorySupport.fixedNodeList(errorNode);
}
return null;
}
示例4: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
public NodeList createNodes(Project project) {
// this.proj = project;
//If our item is in the project's lookup,
//return a new node in the node list:
ImportantFilesLookupItem item = project.getLookup().lookup(ImportantFilesLookupItem.class);
if (item != null) {
try {
ImportantFilesNode nd = new ImportantFilesNode(project);
return NodeFactorySupport.fixedNodeList(nd);
} catch (DataObjectNotFoundException ex) {
Exceptions.printStackTrace(ex);
}
}
//If our item isn't in the lookup,
//then return an empty list of nodes:
return NodeFactorySupport.fixedNodeList();
}
示例5: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
@Override
public NodeList createNodes(Project p) {
if (p.getLookup().lookup(NbModuleProvider.class) != null) {
return new ImpFilesNL(p);
}
return NodeFactorySupport.fixedNodeList();
}
示例6: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
@Override public NodeList<?> createNodes(final Project p) {
return new AbstractMavenNodeList<Void>() {
@Override public List<Void> keys() {
return ProjectUtils.getSources(p).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA).length == 0 ?
Collections.<Void>emptyList() :
Collections.<Void>singletonList(null);
}
@Override public Node node(Void _) {
return new BootCPNode(p);
}
};
}
示例7: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
@Override
public NodeList createNodes(Project project) {
NbMavenProjectImpl prj = project.getLookup().lookup(NbMavenProjectImpl.class);
return NodeFactorySupport.fixedNodeList(new Node[] {
new ProjectFilesNode(prj)
});
}
示例8: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
@Override
public NodeList<?> createNodes(@NonNull final Project project) {
return new Nodes(
project,
procGenSrc,
sourceModules,
testModules,
libsSupport);
}
示例9: setExtraNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
/**
* Sets a factory to create additional nodes.
* @param extraNodes the {@link NodeList} to create additional nodes
* @return the {@link Builder}
*/
@NonNull
public Builder setExtraNodes(@NonNull final NodeList<Key> extraNodes) {
Parameters.notNull("extraNodes", extraNodes);
this.extraNodes = extraNodes;
return this;
}
示例10: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
@Override
public NodeList<?> createNodes(@NonNull final Project project) {
Parameters.notNull("project", project);
final J2SEModularProject modularProject = project.getLookup().lookup(J2SEModularProject.class);
if (modularProject == null) {
throw new IllegalStateException(
String.format("Not a J2SEModularProject: %s (%s)", //NOI18N
project,
FileUtil.getFileDisplayName(project.getProjectDirectory())));
}
return getDelegate(modularProject).createNodes(project);
}
示例11: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
@Override
public NodeList createNodes(Project project) {
try {
return NodeFactorySupport.fixedNodeList(new AssetNode(project),
new ContentNode(project),
new TemplatesNode(project),
new PropertyNode(project));
} catch (DataObjectNotFoundException ex) {
Exceptions.printStackTrace(ex);
}
return NodeFactorySupport.fixedNodeList();
}
示例12: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
public NodeList createNodes(Project project) {
// ImportantFilesLookupItem item = project.getLookup().lookup(ImportantFilesLookupItem.class);
// if (item != null) {
try {
ImportantFilesNode nd = new ImportantFilesNode(project);
return NodeFactorySupport.fixedNodeList(nd);
} catch (DataObjectNotFoundException ex) {
Exceptions.printStackTrace(ex);
}
// }
return NodeFactorySupport.fixedNodeList();
}
示例13: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
/**
* If you don't like the default behavior of created nodes, you should override
* this method.
* @param p
* @return
*/
@Override
public NodeList<?> createNodes(Project p) {
projectRef = new WeakReference<>(p);
NodeList<?> errorNode = beforeCreateNodesCheck(p);
if (errorNode != null) {
return errorNode;
}
return new SingleFolderNodeList(p, getProjectSubfolderProviderClass(),
getDisplayName(), getActionPaths());
}
示例14: testCreateNodes_ProjecttPresent
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
/**
* Test of createNodes method, of class SourceNodeFactory.
*/
@Test
public void testCreateNodes_ProjecttPresent() {
when(lookup.lookup(ElectronProject.class)).thenReturn(electronProject);
when(electronProject.getProjectDirectory()).thenReturn(fileObject);
NodeList result = classUnderTest.createNodes(project);
assertNotNull(result.keys());
}
示例15: createNodes
import org.netbeans.spi.project.ui.support.NodeList; //导入依赖的package包/类
@Override
public NodeList<?> createNodes(Project p) {
GoProject project = p.getLookup().lookup(GoProject.class);
assert project != null;
if (project.isStandardLibrary()) {
return NodeFactorySupport.fixedNodeList();
}
return new LibrariesNodeList(project);
}