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


Java ProjectFactory类代码示例

本文整理汇总了Java中org.netbeans.spi.project.ProjectFactory的典型用法代码示例。如果您正苦于以下问题:Java ProjectFactory类的具体用法?Java ProjectFactory怎么用?Java ProjectFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProjectFactory类属于org.netbeans.spi.project包,在下文中一共展示了ProjectFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveAllProjects

import org.netbeans.spi.project.ProjectFactory; //导入依赖的package包/类
/**
 * Save all modified projects.
 * <p>Acquires write access.
 * @throws IOException if any of them cannot be saved
 * @see ProjectFactory#saveProject
 */
public void saveAllProjects() throws IOException {
    try {
        getMutex().writeAccess(new Mutex.ExceptionAction<Void>() {
            @Override
            public Void run() throws IOException {
                Iterator<Project> it = modifiedProjects.iterator();
                while (it.hasNext()) {
                    Project p = it.next();
                    ProjectFactory f = proj2Factory.get(p);
                    if (f != null) {
                        f.saveProject(p);
                        LOG.log(Level.FINE, "saveProject({0})", p.getProjectDirectory());
                    } else {
                        LOG.log(Level.WARNING, "Project {0} was already deleted", p);
                    }
                    it.remove();
                }
                return null;
            }
        });
    } catch (MutexException e) {
        throw (IOException)e.getException();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:NbProjectManager.java

示例2: saveProject

import org.netbeans.spi.project.ProjectFactory; //导入依赖的package包/类
/**
 * Save one project (if it was in fact modified).
 * <p>Acquires write access.</p>
 * <p class="nonnormative">
 * Although the project infrastructure permits a modified project to be saved
 * at any time, current UI principles dictate that the "save project" concept
 * should be internal only - i.e. a project customizer should automatically
 * save the project when it is closed e.g. with an "OK" button. Currently there
 * is no UI display of modified projects; this module does not ensure that modified projects
 * are saved at system exit time the way modified files are, though the Project UI
 * implementation module currently does this check.
 * </p>
 * @param p the project to save
 * @throws IOException if it cannot be saved
 * @see ProjectFactory#saveProject
 */
public void saveProject(final Project p) throws IOException {
    try {
        getMutex().writeAccess(new Mutex.ExceptionAction<Void>() {
            @Override
            public Void run() throws IOException {
                //removed projects are the ones that cannot be mapped to an existing project type anymore.
                if (removedProjects.contains(p)) {
                    return null;
                }
                if (modifiedProjects.contains(p)) {
                    ProjectFactory f = proj2Factory.get(p);
                    if (f != null) {
                        f.saveProject(p);
                        LOG.log(Level.FINE, "saveProject({0})", p.getProjectDirectory());
                    } else {
                        LOG.log(Level.WARNING, "Project {0} was already deleted", p);
                    }
                    modifiedProjects.remove(p);
                }
                return null;
            }
        });
    } catch (MutexException e) {
        //##91398 have a more descriptive error message, in case of RO folders.
        // the correct reporting still up to the specific project type.
        if (!p.getProjectDirectory().canWrite()) {
            throw new IOException("Project folder is not writeable.");
        }
        throw (IOException)e.getException();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:48,代码来源:NbProjectManager.java

示例3: testProjectFactory

import org.netbeans.spi.project.ProjectFactory; //导入依赖的package包/类
/**
 * Create a testing project factory which recognizes directories containing
 * a subdirectory called "testproject".
 * If that subdirectory contains a file named "broken" then loading the project
 * will fail with an IOException.
 */
public static ProjectFactory testProjectFactory() {
    return new TestProjectFactory();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:TestUtil.java


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