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


Java FileOwnerQuery.markExternalOwner方法代码示例

本文整理汇总了Java中org.netbeans.api.project.FileOwnerQuery.markExternalOwner方法的典型用法代码示例。如果您正苦于以下问题:Java FileOwnerQuery.markExternalOwner方法的具体用法?Java FileOwnerQuery.markExternalOwner怎么用?Java FileOwnerQuery.markExternalOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.project.FileOwnerQuery的用法示例。


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

示例1: propertyChange

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent pce) {
    if (NbMavenProject.PROP_PROJECT.equals(pce.getPropertyName())) {
        NbMavenProjectImpl project = proj.getLookup().lookup(NbMavenProjectImpl.class);
        Set<URI> newuris = getProjectExternalSourceRoots(project);
        synchronized (uriReferences) {
            Set<URI> olduris = new HashSet<URI>(uriReferences);
            olduris.removeAll(newuris);
            newuris.removeAll(uriReferences);
            for (URI old : olduris) {
                FileOwnerQuery.markExternalOwner(old, null, FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT);
            }
            for (URI nw : newuris) {
                FileOwnerQuery.markExternalOwner(nw, proj, FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT);
            }
            uriReferences.removeAll(olduris);
            uriReferences.addAll(newuris);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ProjectOpenedHookImpl.java

示例2: testIncludesFiredJustOnce

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
public void testIncludesFiredJustOnce() throws Exception {
    File src1 = new File(getWorkDir(), "src1");
    src1.mkdir();
    File src2 = new File(getWorkDir(), "src2");
    src2.mkdir();
    AntProjectHelper h = J2SEProjectGenerator.createProject(new File(getWorkDir(), "prj"), "test", new File[] {src1, src2}, new File[0], null, null, null);
    Project p = ProjectManager.getDefault().findProject(h.getProjectDirectory());
    FileOwnerQuery.markExternalOwner(Utilities.toURI(src1), p, FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT);
    ClassPath cp = ClassPath.getClassPath(FileUtil.toFileObject(src1), ClassPath.SOURCE);
    assertNotNull(cp);        
    assertEquals(2, cp.getRoots().length);
    ClassPath.Entry cpe2 = cp.entries().get(1);
    assertEquals(Utilities.toURI(src2).toURL(), cpe2.getURL());
    assertTrue(cpe2.includes("stuff/"));
    assertTrue(cpe2.includes("whatever/"));
    class L implements PropertyChangeListener {
        int cnt;
        public void propertyChange(PropertyChangeEvent e) {
            if (ClassPath.PROP_INCLUDES.equals(e.getPropertyName())) {
                cnt++;
            }
        }
    }
    L l = new L();
    cp.addPropertyChangeListener(l);
    EditableProperties ep = h.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
    ep.setProperty(ProjectProperties.INCLUDES, "whatever/");
    h.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
    ProjectManager.getDefault().saveProject(p);
    assertEquals(1, l.cnt);
    assertFalse(cpe2.includes("stuff/"));
    assertTrue(cpe2.includes("whatever/"));
    ep.setProperty(ProjectProperties.INCLUDES, "whateverelse/");
    h.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
    ProjectManager.getDefault().saveProject(p);
    assertEquals(2, l.cnt);
    assertFalse(cpe2.includes("stuff/"));
    assertFalse(cpe2.includes("whatever/"));
    ep.remove(ProjectProperties.INCLUDES);
    h.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
    ProjectManager.getDefault().saveProject(p);
    assertEquals(3, l.cnt);
    assertTrue(cpe2.includes("stuff/"));
    assertTrue(cpe2.includes("whatever/"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:SourcePathImplementationTest.java


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