本文整理汇总了Java中org.netbeans.spi.project.ui.LogicalViewProvider.createLogicalView方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalViewProvider.createLogicalView方法的具体用法?Java LogicalViewProvider.createLogicalView怎么用?Java LogicalViewProvider.createLogicalView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.spi.project.ui.LogicalViewProvider
的用法示例。
在下文中一共展示了LogicalViewProvider.createLogicalView方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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 ) );
}
示例3: 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);
*/
}
示例4: 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);
*/
}
示例5: 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);
*/
}
示例6: 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);
*/
}
示例7: 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);
}
示例8: testFindPath
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入方法依赖的package包/类
@RandomlyFails
public void testFindPath() throws Exception {
LogicalViewProvider lvp2 = simple.getLookup().lookup(LogicalViewProvider.class);
assertNotNull(lvp2);
Node root = lvp2.createLogicalView();
org.netbeans.modules.ant.freeform.ui.ViewTest.doTestFindPathPositive(lvp2, root, simple, "src/org/foo/myapp/MyApp.java");
org.netbeans.modules.ant.freeform.ui.ViewTest.doTestFindPathPositive(lvp2, root, simple, "src/org/foo/myapp");
org.netbeans.modules.ant.freeform.ui.ViewTest.doTestFindPathNegative(lvp2, root, simple, "src/org/foo");
org.netbeans.modules.ant.freeform.ui.ViewTest.doTestFindPathNegative(lvp2, root, simple, "src/org");
org.netbeans.modules.ant.freeform.ui.ViewTest.doTestFindPathPositive(lvp2, root, simple, "src");
org.netbeans.modules.ant.freeform.ui.ViewTest.doTestFindPathPositive(lvp2, root, simple, "antsrc/org/foo/ant/SpecialTask.java");
}
示例9: testFindPath
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入方法依赖的package包/类
public void testFindPath() throws Exception {
// Do not test packages style - provided only by java/freeform.
LogicalViewProvider lvp2 = simple.getLookup().lookup(LogicalViewProvider.class);
assertNotNull(lvp2);
Node root = lvp2.createLogicalView();
doTestFindPathPositive(lvp2, root, simple, "xdocs/foo.xml");
doTestFindPathPositive(lvp2, root, simple, "xdocs");
doTestFindPathPositive(lvp2, root, simple, "build.properties");
doTestFindPathPositive(lvp2, root, simple, "build.xml");
doTestFindPathNegative(lvp2, root, simple, "nbproject/project.xml");
doTestFindPathNegative(lvp2, root, simple, "nbproject");
}
示例10: logicalViewForProject
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入方法依赖的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;
}
示例11: MainTraversalChooser
import org.netbeans.spi.project.ui.LogicalViewProvider; //导入方法依赖的package包/类
/**
* Creates new form MainTraversalChooser
*/
public MainTraversalChooser(Project project, FileObject apk) {
this.project = project;
this.apk = apk;
this.apkFilename = apk.getNameExt();
initComponents();
//instructionJLabel.setText("Select Main Traversal");
setLayout(new BorderLayout());
LogicalViewProvider logicalView = (LogicalViewProvider) project.getLookup().lookup(LogicalViewProvider.class);
Node projectNode = logicalView.createLogicalView();
mgr.setRootContext(new FilterNode(projectNode, new ProjectFilterChildren(projectNode)));
BeanTreeView btv = new BeanTreeView();
traversalNodeJScrollPane.setViewportView(btv);
btv.setPopupAllowed(false);
//btv.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
add(btv, BorderLayout.CENTER);
}