当前位置: 首页>>代码示例>>Java>>正文


Java ProjectManager.getDefault方法代码示例

本文整理汇总了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();
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:OpenProjectsTrampolineImplTest.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AntBuildExtenderTest.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:GeneratedFilesHelperTest.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:AntProjectHelperTest.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:AntBasedProjectRegistrationTest.java

示例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))));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:BinaryForSourceQueryImplTest.java

示例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);        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:UnitTestForSourceQueryImplTest.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:J2SESharabilityQueryTest.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SourceRootsTest.java

示例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);
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:J2SESourcesTest.java

示例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");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:AntArtifactQueryTest.java

示例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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:HgProjectUtils.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:SimpleAntArtifactTest.java

示例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");        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:CompiledSourceForBinaryQueryTest.java

示例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");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:SourcePathImplementationTest.java


注:本文中的org.netbeans.api.project.ProjectManager.getDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。