本文整理汇总了Java中org.netbeans.api.project.ProjectManager.getDefault方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectManager.getDefault方法的具体用法?Java ProjectManager.getDefault怎么用?Java ProjectManager.getDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.project.ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.getDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
scratch = TestUtil.makeScratchDir(this);
goodproject = scratch.createFolder("good");
goodproject.createFolder("testproject");
goodproject2 = scratch.createFolder("good2");
goodproject2.createFolder("testproject");
// badproject = scratch.createFolder("bad");
// badproject.createFolder("testproject").createData("broken");
// mysteryproject = scratch.createFolder("mystery");
MockLookup.setLookup(Lookups.fixed(
new NbProjectManager(),
new NbProjectInformationProvider(),
new NbMutexEventProvider(),
TestUtil.testProjectFactory()));
pm = ProjectManager.getDefault();
OpenProjectList.waitProjectsFullyOpen();
}
示例2: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
FileObject fo = FileUtil.getConfigFile("Services");
if (fo != null) {
fo.delete();
}
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
TestUtil.createFileFromContent(GeneratedFilesHelperTest.class.getResource("data/project.xml"), projdir, "nbproject/project.xml");
extension1 = TestUtil.createFileFromContent(GeneratedFilesHelperTest.class.getResource("data/extension1.xml"), projdir, "nbproject/extension1.xml");
extenderImpl = new ExtImpl();
MockLookup.setInstances(AntBasedTestUtil.testAntBasedProjectType(extenderImpl));
pm = ProjectManager.getDefault();
p = pm.findProject(projdir);
extenderImpl.project = p;
gfh = p.getLookup().lookup(GeneratedFilesHelper.class);
assertNotNull(gfh);
}
示例3: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
FileObject fo = FileUtil.getConfigFile("Services");
if (fo != null) {
fo.delete();
}
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
TestUtil.createFileFromContent(GeneratedFilesHelperTest.class.getResource("data/project.xml"), projdir, "nbproject/project.xml");
TestUtil.createFileFromContent(GeneratedFilesHelperTest.class.getResource("data/extension1.xml"), projdir, "nbproject/extension1.xml");
extenderImpl = new ExtImpl();
MockLookup.setInstances(AntBasedTestUtil.testAntBasedProjectType(extenderImpl));
pm = ProjectManager.getDefault();
p = pm.findProject(projdir);
extenderImpl.project = p;
h = p.getLookup().lookup(AntProjectHelper.class);
gfh = p.getLookup().lookup(GeneratedFilesHelper.class);
assertNotNull(gfh);
}
示例4: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
FileObject fo = FileUtil.getConfigFile("Services");
if (fo != null) {
fo.delete();
}
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
TestUtil.createFileFromContent(AntProjectHelperTest.class.getResource("data/project.xml"), projdir, "nbproject/project.xml");
TestUtil.createFileFromContent(AntProjectHelperTest.class.getResource("data/private.xml"), projdir, "nbproject/private/private.xml");
TestUtil.createFileFromContent(AntProjectHelperTest.class.getResource("data/project.properties"), projdir, "nbproject/project.properties");
TestUtil.createFileFromContent(AntProjectHelperTest.class.getResource("data/private.properties"), projdir, "nbproject/private/private.properties");
TestUtil.createFileFromContent(AntProjectHelperTest.class.getResource("data/global.properties"), scratch, "userdir/build.properties");
ProjectProperties.antJar = new File(getWorkDir(), "ant/lib/ant.jar");
MockLookup.setInstances(AntBasedTestUtil.testAntBasedProjectType());
pm = ProjectManager.getDefault();
p = pm.findProject(projdir);
h = p.getLookup().lookup(AntProjectHelper.class);
l = new AntBasedTestUtil.TestListener();
}
示例5: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
super.setUp();
MockLookup.init();
assertEquals("No factory has been used yet", 0, AnnotatedProject.factoryCalls);
Collection<? extends AntBasedProjectType> all = Lookups.forPath("Services/AntBasedProjectTypes").lookupAll(AntBasedProjectType.class);
assertEquals("Two found", 2, all.size());
Iterator<? extends AntBasedProjectType> it = all.iterator();
if ("testFactory".equals(getName())) {
it.next();
}
AntBasedProjectType t = it.next();
MockLookup.setInstances(t);
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
ProjectGenerator.createProject(projdir, t.getType());
pm = ProjectManager.getDefault();
}
示例6: prepareProject
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
private void prepareProject () throws IOException {
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
MockLookup.setLayersAndInstances();
J2SEProjectGenerator.setDefaultSourceLevel(new SpecificationVersion ("1.6")); //NOI18N
helper = J2SEProjectGenerator.createProject(FileUtil.toFile(projdir),"proj",null,null,null, false);
J2SEProjectGenerator.setDefaultSourceLevel(null); //NOI18N
pm = ProjectManager.getDefault();
pp = Optional.ofNullable(pm.findProject(projdir))
.map((p) -> p.getLookup().lookup(J2SEProject.class))
.orElseThrow(()-> new AssertionError("No J2SEProject in " + FileUtil.getFileDisplayName(projdir)));
sources = projdir.getFileObject("src");
tests = FileUtil.createFolder(projdir, "test");
FileObject fo = projdir.createFolder("build");
buildClasses = fo.createFolder("classes");
buildTestClasses = FileUtil.createFolder(fo, "test/classes");
distJarURL = FileUtil.urlForArchiveOrDir(FileUtil.normalizeFile(
helper.resolveFile(pp.evaluator().getProperty(ProjectProperties.DIST_JAR))));
}
示例7: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
MockLookup.setLayersAndInstances(
new org.netbeans.modules.java.project.UnitTestForSourceQueryImpl(),
new org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation()
);
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
J2SEProjectGenerator.setDefaultSourceLevel(new SpecificationVersion ("1.6")); //NOI18N
helper = J2SEProjectGenerator.createProject(FileUtil.toFile(projdir),"proj",null,null,null, false);
J2SEProjectGenerator.setDefaultSourceLevel(null);
sources = projdir.getFileObject("src");
tests = projdir.getFileObject("test");
pm = ProjectManager.getDefault();
pp = pm.findProject(projdir);
}
示例8: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
MockLookup.setLayersAndInstances(
new org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation()
);
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
J2SEProjectGenerator.setDefaultSourceLevel(new SpecificationVersion ("1.6")); //NOI18N
helper = J2SEProjectGenerator.createProject(FileUtil.toFile(projdir),"proj",null,null,null, false); //NOI18N
J2SEProjectGenerator.setDefaultSourceLevel(null);
sources = projdir.getFileObject("src");
tests = projdir.getFileObject("test");
dist = FileUtil.createFolder(projdir,"dist");
build = FileUtil.createFolder(projdir,"build");
pm = ProjectManager.getDefault();
Project p = pm.findProject(projdir);
assertTrue("Invalid project type",p instanceof J2SEProject);
pp = (J2SEProject) p;
}
示例9: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
MockLookup.setLayersAndInstances(
new org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation()
);
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
J2SEProjectGenerator.setDefaultSourceLevel(new SpecificationVersion ("1.6")); //NOI18N
helper = J2SEProjectGenerator.createProject(FileUtil.toFile(projdir),"proj",null,null,null, false); //NOI18N
J2SEProjectGenerator.setDefaultSourceLevel(null); //NOI18N
sources = projdir.getFileObject("src");
tests = projdir.getFileObject("test");
pm = ProjectManager.getDefault();
Project p = pm.findProject(projdir);
assertTrue("Invalid project type",p instanceof J2SEProject);
pp = (J2SEProject) p;
}
示例10: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
super.setUp();
MockLookup.setLayersAndInstances(
new org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation()
);
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
J2SEProjectGenerator.setDefaultSourceLevel(new SpecificationVersion ("1.6")); //NOI18N
helper = J2SEProjectGenerator.createProject(FileUtil.toFile(projdir),"proj",null,null,null, false); //NOI18N
J2SEProjectGenerator.setDefaultSourceLevel(null);
sources = getFileObject(projdir, "src");
build = getFileObject (scratch, "build");
classes = getFileObject(build,"classes");
File f = FileUtil.normalizeFile (FileUtil.toFile(build));
String path = f.getAbsolutePath ();
//#47657: SourcesHelper.remarkExternalRoots () does not work on deleted folders
// To reproduce it uncomment following line
// build.delete();
EditableProperties props = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
props.setProperty(ProjectProperties.BUILD_DIR, path);
helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props);
pm = ProjectManager.getDefault();
project = pm.findProject(projdir);
assertTrue("Invalid project type", project instanceof J2SEProject);
}
示例11: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
FileObject fo = FileUtil.getConfigFile("Services");
if (fo != null) {
fo.delete();
}
MockLookup.setInstances(AntBasedTestUtil.testAntBasedProjectType(), TestUtil.testProjectFactory());
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
ProjectGenerator.createProject(projdir, "test");
pm = ProjectManager.getDefault();
sisterprojdir = FileUtil.createFolder(scratch, "proj2");
AntProjectHelper sisterh = ProjectGenerator.createProject(sisterprojdir, "test");
EditableProperties props = sisterh.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
props.setProperty("build.jar", "dist/proj2.jar");
props.setProperty("build.javadoc", "build/javadoc");
sisterh.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props);
dummyprojdir = scratch.createFolder("dummy");
dummyprojdir.createFolder("testproject");
}
示例12: getProjectName
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
public static String getProjectName( final File root ) {
if(root == null || !root.isDirectory()) return null;
final ProjectManager projectManager = ProjectManager.getDefault();
FileObject rootFileObj = FileUtil.toFileObject(FileUtil.normalizeFile(root));
// This can happen if the root is "ssh://<something>"
if (rootFileObj == null || projectManager == null) {
return null;
}
String res = null;
if (projectManager.isProject(rootFileObj)){
try {
Project prj = projectManager.findProject(rootFileObj);
res = getProjectName(prj);
} catch (Exception ex) {
Mercurial.LOG.log(Level.FINE, "getProjectName() file: {0} {1}", new Object[] {rootFileObj.getPath(), ex.toString()}); // NOI18N
}finally{
return res;
}
}else{
return res;
}
}
示例13: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
scratch = TestUtil.makeScratchDir(this);
MockLookup.setInstances(AntBasedTestUtil.testAntBasedProjectType());
pm = ProjectManager.getDefault();
sisterprojdir = FileUtil.createFolder(scratch, "proj2");
sisterh = ProjectGenerator.createProject(sisterprojdir, "test");
EditableProperties props = sisterh.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
props.setProperty("build.jar", "build/proj2.jar");
props.setProperty("build.jar.absolute", getWorkDir().getAbsolutePath()+"/build/proj3.jar");
sisterh.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props);
}
示例14: prepareProject
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
private void prepareProject () throws IOException {
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
J2SEProjectGenerator.setDefaultSourceLevel(new SpecificationVersion ("1.6")); //NOI18N
helper = J2SEProjectGenerator.createProject(FileUtil.toFile(projdir),"proj",null,null,null, false);
J2SEProjectGenerator.setDefaultSourceLevel(null); //NOI18N
pm = ProjectManager.getDefault();
pp = pm.findProject(projdir);
sources = projdir.getFileObject("src");
FileObject fo = projdir.createFolder("build");
buildClasses = fo.createFolder("classes");
}
示例15: setUp
import org.netbeans.api.project.ProjectManager; //导入方法依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
J2SEProjectGenerator.setDefaultSourceLevel(new SpecificationVersion ("1.6")); //NOI18N
MockLookup.setLayersAndInstances();
helper = J2SEProjectGenerator.createProject(FileUtil.toFile(projdir),"proj",null,null,null, false); //NOI18N
J2SEProjectGenerator.setDefaultSourceLevel(null);
pm = ProjectManager.getDefault();
pp = pm.findProject(projdir).getLookup().lookup(J2SEProject.class);
sources = projdir.getFileObject("src");
}