本文整理汇总了Java中org.netbeans.spi.project.ui.LogicalViewProvider类的典型用法代码示例。如果您正苦于以下问题:Java LogicalViewProvider类的具体用法?Java LogicalViewProvider怎么用?Java LogicalViewProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LogicalViewProvider类属于org.netbeans.spi.project.ui包,在下文中一共展示了LogicalViewProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNameAndDisplayName
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
public void testNameAndDisplayName() throws Exception {
SuiteProject p = generateSuite("Sweet Stuff");
Node n = p.getLookup().lookup(LogicalViewProvider.class).createLogicalView();
assertEquals("Sweet Stuff", n.getName());
assertEquals("Sweet Stuff", n.getDisplayName());
NL nl = new NL();
n.addNodeListener(nl);
EditableProperties ep = p.getHelper().getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
ep.setProperty("app.name", "sweetness");
ep.setProperty("app.title", "Sweetness is Now!");
p.getHelper().putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
TestBase.waitForNodesUpdate();
assertEquals(new HashSet<String>(Arrays.asList(Node.PROP_NAME, Node.PROP_DISPLAY_NAME)), nl.changed);
assertEquals("Sweetness is Now!", n.getName());
assertEquals("Sweetness is Now!", n.getDisplayName());
}
示例2: testFindPath
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
@RandomlyFails // NB-Core-Build #7306: same result for DataObject as for FileObject expected:<null> but was:<FilterNode[Name=FreeformProjectTest...]>
public void testFindPath() throws Exception {
Project freeform = ProjectManager.getDefault().findProject(FileUtil.toFileObject(file("ant.freeform")));
assertNotNull("have project in ant.freeform", freeform);
LogicalViewProvider lvp = freeform.getLookup().lookup(LogicalViewProvider.class);
assertNotNull("have a LogicalViewProvider", lvp);
assertNotNull("found arch.xml", find(lvp, "ant.freeform/arch.xml"));
assertNotNull("found FreeformProject.java", find(lvp, "ant.freeform/src/org/netbeans/modules/ant/freeform/FreeformProject.java"));
assertNotNull("found freeform-project-general.xsd", find(lvp, "ant.freeform/src/org/netbeans/modules/ant/freeform/resources/freeform-project-general.xsd"));
assertNotNull("found FreeformProjectTest.java", find(lvp, "ant.freeform/test/unit/src/org/netbeans/modules/ant/freeform/FreeformProjectTest.java"));
Node layer = find(lvp, "ant.freeform/src/org/netbeans/modules/ant/freeform/resources/layer.xml");
assertNotNull("Found layer", layer);
assertEquals("Sources is parent parent of the layer", "${src.dir}", layer.getParentNode().getParentNode().getName());
assertFalse("Has children: " + layer, layer.isLeaf());
DataObject obj = layer.getLookup().lookup(DataObject.class);
assertNotNull("There is a data object", obj);
Node origLayer = obj.getNodeDelegate();
assertFalse("Also has children", origLayer.isLeaf());
}
示例3: find
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
private Node find(LogicalViewProvider lvp, String path) throws Exception {
FileObject f = FileUtil.toFileObject(file(path));
assertNotNull("found " + path, f);
Node root = new FilterNode(lvp.createLogicalView());
lvp.findPath(root, f); // ping
waitForNodesUpdate();
DataObject d = DataObject.find(f);
Node n = lvp.findPath(root, f);
assertEquals("same result for DataObject as for FileObject", n, lvp.findPath(root, d));
if (n != null) {
assertEquals("right DataObject", d, n.getLookup().lookup(DataObject.class));
}
return n;
}
示例4: GroupNode
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
public GroupNode(Project project, SourceGroup group, boolean isProjectDir, DataFolder dataFolder ) {
super( dataFolder.getNodeDelegate(),
dataFolder.createNodeChildren( VISIBILITY_QUERY_FILTER ),
createLookup(project, group, dataFolder, isProjectDir));
this.pi = ProjectUtils.getInformation( project );
this.group = group;
this.isProjectDir = isProjectDir;
if(isProjectDir) {
LogicalViewProvider lvp = project.getLookup().lookup(LogicalViewProvider.class);
// used to retrieve e.g. actions in case of a folder representing a project,
// so that a projects context menu is the same is in a logical view
this.projectDelegateNode = lvp != null ? lvp.createLogicalView() : null;
} else {
this.projectDelegateNode = null;
}
pi.addPropertyChangeListener(WeakListeners.propertyChange(this, pi));
group.addPropertyChangeListener( WeakListeners.propertyChange( this, group ) );
}
示例5: createData
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
private static Union2<LogicalViewProvider,org.openide.util.Pair<Sources,SourceGroup[]>> createData(
final Project p,
final int type) {
switch (type) {
case LOGICAL_VIEW:
final LogicalViewProvider lvp = p.getLookup().lookup(LogicalViewProvider.class);
if (lvp != null) {
return Union2.createFirst(lvp);
}
case PHYSICAL_VIEW:
final Sources s = ProjectUtils.getSources(p);
final SourceGroup[] groups = s.getSourceGroups(Sources.TYPE_GENERIC);
return Union2.createSecond(org.openide.util.Pair.of(s, groups));
default:
throw new IllegalArgumentException(Integer.toString(type));
}
}
示例6: setUp
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
System.setProperty("sync.project.execution", "true");
targetsRun.clear();
buildXml = simple.getProjectDirectory().getFileObject("build.xml");
assertNotNull("found build.xml", buildXml);
ap = simple.getLookup().lookup(ActionProvider.class);
assertNotNull("have an action provider", ap);
FileObject myAppJava = simple.getProjectDirectory().getFileObject("src/org/foo/myapp/MyApp.java");
assertNotNull("have MyApp.java", myAppJava);
myAppJavaDO = DataObject.find(myAppJava);
FileObject someFileJava = simple.getProjectDirectory().getFileObject("src/org/foo/myapp/SomeFile.java");
assertNotNull("have SomeFile.java", someFileJava);
someFileJavaDO = DataObject.find(someFileJava);
FileObject someResourceTxt = simple.getProjectDirectory().getFileObject("src/org/foo/myapp/some-resource.txt");
assertNotNull("have some-resource.txt", someResourceTxt);
someResourceTxtDO = DataObject.find(someResourceTxt);
FileObject specialTaskJava = simple.getProjectDirectory().getFileObject("antsrc/org/foo/ant/SpecialTask.java");
assertNotNull("have SpecialTask.java", specialTaskJava);
specialTaskJavaDO = DataObject.find(specialTaskJava);
lvp = simple.getLookup().lookup(LogicalViewProvider.class);
assertNotNull("have a LogicalViewProvider", lvp);
}
示例7: testImportantFiles
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
public void testImportantFiles() throws Exception {
// so getDisplayName is taken from english bundle
Locale.setDefault(Locale.US);
SuiteProject suite = generateSuite("sweet");
FileObject master = suite.getProjectDirectory().createData("master.jnlp");
LogicalViewProvider viewProv = suite.getLookup().lookup(LogicalViewProvider.class);
Node n = viewProv.createLogicalView();
Node[] nodes = n.getChildren().getNodes(true);
assertEquals("Now there are two", 2, nodes.length);
assertEquals("Named modules", "modules", nodes[0].getName());
assertEquals("Named imp files", "important.files", nodes[1].getName());
/* XXX enable once ImportantFilesNodeFactory is rewritten to behave synchronously:
FileObject projProps = suite.getProjectDirectory().getFileObject("nbproject/project.properties");
assertNotNull(projProps);
viewProv.findPath(n, projProps); // ping
flushRequestProcessor();
Node nodeForFO = viewProv.findPath(n, projProps);
assertNotNull("found project.properties node", nodeForFO);
assertEquals("Name of node is localized", "Project Properties", nodeForFO.getDisplayName());
nodeForFO = viewProv.findPath(n, master);
assertNotNull("found master.jnlp node", nodeForFO);
assertEquals("same by DataObject", nodeForFO, viewProv.findPath(n, DataObject.find(master)));
assertEquals("Name of node is localized", "JNLP Descriptor", nodeForFO.getDisplayName());
master.delete();
nodeForFO = viewProv.findPath(n, master);
assertNull("For file object null", nodeForFO);
*/
}
示例8: testImportantFilesListening
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
public void testImportantFilesListening() throws Exception {
Project p = generateStandaloneModule("module");
LogicalViewProvider lvp = p.getLookup().lookup(LogicalViewProvider.class);
assertNotNull("have a LogicalViewProvider", lvp);
Node root = lvp.createLogicalView();
Node iFiles = root.getChildren().findChild(ImportantFilesNodeFactory.IMPORTANT_FILES_NAME);
assertNotNull("have the Important Files node", iFiles);
/* XXX inherently unreliable:
FileObject propsFO = p.getProjectDirectory().getFileObject("nbproject/project.properties");
propsFO = FileUtil.moveFile(propsFO, p.getProjectDirectory().getFileObject("nbproject"), "project-bck");
TestBase.assertAsynchronouslyUpdatedChildrenNodes(iFiles, 5);
FileUtil.moveFile(propsFO, p.getProjectDirectory().getFileObject("nbproject"), "project");
TestBase.assertAsynchronouslyUpdatedChildrenNodes(iFiles, 6);
*/
}
示例9: testLibrariesNodeListening
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
public void testLibrariesNodeListening() throws Exception {
NbModuleProject p = generateStandaloneModule("module");
LogicalViewProvider lvp = p.getLookup().lookup(LogicalViewProvider.class);
assertNotNull("have a LogicalViewProvider", lvp);
Node root = lvp.createLogicalView();
Node libraries = root.getChildren().findChild(LibrariesNode.LIBRARIES_NAME);
assertNotNull(libraries);
/* XXX inherently unreliable:
TestBase.assertAsynchronouslyUpdatedChildrenNodes(libraries, 1);
Util.addDependency(p, "org.netbeans.modules.java.project");
ProjectManager.getDefault().saveProject(p);
TestBase.assertAsynchronouslyUpdatedChildrenNodes(libraries, 2);
*/
}
示例10: testDependencyNodeActions
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
public void testDependencyNodeActions() throws Exception {
NbModuleProject p = generateStandaloneModule("module");
LogicalViewProvider lvp = p.getLookup().lookup(LogicalViewProvider.class);
Node root = lvp.createLogicalView();
Node libraries = root.getChildren().findChild(LibrariesNode.LIBRARIES_NAME);
assertNotNull(libraries);
/* XXX inherently unreliable:
Util.addDependency(p, "org.netbeans.modules.java.project");
ProjectManager.getDefault().saveProject(p);
TestBase.assertAsynchronouslyUpdatedChildrenNodes(libraries, 2);
Node[] nodes = libraries.getChildren().getNodes(true);
assertEquals("four actions", 4, nodes[1].getActions(false).length);
*/
}
示例11: LogicalView
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
@SuppressWarnings("LeakingThisInConstructor")
LogicalView(@NonNull final Project project, @NonNull final ProjectConvertor.Result result) {
Parameters.notNull("project", project); //NOI18N
Parameters.notNull("result", result); //NOI18N
this.project = project;
this.result = result;
this.support = new ChangeSupport(this);
this.eventSource = project.getLookup().lookupResult(LogicalViewProvider.class);
this.eventSource.addLookupListener(WeakListeners.create(LookupListener.class, this, this.eventSource));
}
示例12: findPath
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
@Override
public Node findPath(Node root, Object target) {
final LogicalViewProvider lvp = delegate;
if (lvp != null) {
return lvp.findPath(root, target);
} else {
//Todo: Probably not needed
return null;
}
}
示例13: resultChanged
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
@Override
public void resultChanged(LookupEvent ev) {
for (LogicalViewProvider lvp : eventSource.allInstances()) {
if (lvp != this) {
delegate = lvp;
support.fireChange();
break;
}
}
}
示例14: constructSemiLogicalView
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
private static Node constructSemiLogicalView(final Project p, LogicalViewCache lvc, final Map<FileObject, Map<AnalyzerFactory, List<ErrorDescription>>> errors) {
Node view = lvc.project2LogicalViewRootNode.get(p);
final LogicalViewProvider lvp = p.getLookup().lookup(LogicalViewProvider.class);
if (view == null) {
if (lvp != null) {
view = lvp.createLogicalView();
} else {
try {
view = DataObject.find(p.getProjectDirectory()).getNodeDelegate();
} catch (DataObjectNotFoundException ex) {
Exceptions.printStackTrace(ex);
return new AbstractNode(Children.LEAF);
}
}
lvc.project2LogicalViewRootNode.put(p, view);
}
int warnings = 0;
for (Map<AnalyzerFactory, List<ErrorDescription>> v1 : errors.values()) {
for (List<ErrorDescription> v2 : v1.values()) {
warnings += v2.size();
}
}
Map<Node, Map<AnalyzerFactory, List<ErrorDescription>>> foundNodes = resolveFileNodes(lvp, lvc, view, errors);
return new Wrapper(view, warnings, foundNodes, true);
}
示例15: resolveFileNodes
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入依赖的package包/类
private static Map<Node, Map<AnalyzerFactory, List<ErrorDescription>>> resolveFileNodes(LogicalViewProvider lvp, LogicalViewCache lvc, final Node view, Map<FileObject, Map<AnalyzerFactory, List<ErrorDescription>>> errors) {
Map<Node, Map<AnalyzerFactory, List<ErrorDescription>>> fileNodes = new HashMap<Node, Map<AnalyzerFactory, List<ErrorDescription>>>();
for (FileObject file : errors.keySet()) {
Map<AnalyzerFactory, List<ErrorDescription>> eds = errors.get(file);
Node foundChild = lvc.file2FileNode.get(file);
if (foundChild == null) {
foundChild = locateChild(view, lvp, file);
if (foundChild == null) {
try {
foundChild = DataObject.find(file).getNodeDelegate();
} catch (DataObjectNotFoundException ex) {
LOG.log(Level.FINE, null, ex);
continue;
}
}
lvc.file2FileNode.put(file, foundChild);
}
if (foundChild == null) {
return null;
}
fileNodes.put(foundChild, eds);
}
return fileNodes;
}