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


Java FileStateInvalidException类代码示例

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


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

示例1: testVQ

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
public void testVQ() throws FileStateInvalidException, IOException, Exception {
    VQChangeListener cl = new VQChangeListener();
    VisibilityQuery.getDefault().addChangeListener(cl);
    File visible = createVersionedFile("this-file-is-visible", true);
    FileObject visibleFO = FileUtil.toFileObject(visible);
    cl.testVisibility(true, visible, visibleFO);
    assertTrue(VisibilityQuery.getDefault().isVisible(visible));
    assertTrue(VisibilityQuery.getDefault().isVisible(visibleFO));

    File invisible = createVersionedFile("this-file-is-", false);
    FileObject invisibleFO = FileUtil.toFileObject(invisible);
    cl.testVisibility(false, invisible, invisibleFO);
    assertFalse(VisibilityQuery.getDefault().isVisible(invisible));
    assertFalse(VisibilityQuery.getDefault().isVisible(invisibleFO));
    VisibilityQuery.getDefault().removeChangeListener(cl);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:VCSVisibilityQueryTest.java

示例2: cacheCurrentEditorFile

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
private void cacheCurrentEditorFile() {
    try {
        Iterator<FileObject> it = scope.iterator();
        FileObject fo;
        if (it.hasNext()) {
            fo = it.next();
        } else {
            return;
        }
        ArrayList<URL> toRefresh = new ArrayList<URL>(1);
        toRefresh.add(fo.getURL());
        Collection<FileObject> roots = QuerySupport.findRoots(fo, null, null, null);
        for (FileObject root : roots) {
            IndexingManager.getDefault().refreshIndex(root.getURL(), toRefresh);
        }
    } catch (FileStateInvalidException ex) {
        getLogger().log(Level.INFO, "Error while refreshing files.", ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TaskManagerImpl.java

示例3: testEquals

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
public void testEquals() throws FileStateInvalidException {
    String description = "task description";
    int lineNo = 123;
    FileObject resource = FileUtil.getConfigRoot();

    Task t1 = Task.create(resource, TASK_GROUP_NAME, description, lineNo );
    Task t2 = Task.create(resource, TASK_GROUP_NAME, description, lineNo );

    assertEquals( t1, t2 );
    assertEquals( t1.hashCode(), t2.hashCode() );

    URL url = FileUtil.getConfigRoot().getURL();

    t1 = Task.create(url, TASK_GROUP_NAME, description );
    t2 = Task.create(url, TASK_GROUP_NAME, description );

    assertEquals( t1, t2 );
    assertEquals( t1.hashCode(), t2.hashCode() );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TaskTest.java

示例4: isPlatformDir

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
private boolean isPlatformDir ( File f ) {
    //XXX: Workaround of hard NFS mounts on Solaris.
    final int osId = Utilities.getOperatingSystem();
    if (osId == Utilities.OS_SOLARIS || osId == Utilities.OS_SUNOS) {
        return false;
    }
    FileObject fo = (f != null) ? convertToValidDir(f) : null;
    if (fo != null) {
        //XXX: Workaround of /net folder on Unix, the folders in the root are not badged as platforms.
        // User can still select them.
        try {
            if (Utilities.isUnix() && (fo.getParent() == null || fo.getFileSystem().getRoot().equals(fo.getParent()))) {
                return false;
            }
        } catch (FileStateInvalidException e) {
            return false;
        }
        if (this.platformInstall.accept(fo)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:LocationChooser.java

示例5: loadCategories

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
private static List<String> loadCategories () {
    //Repository.getDefault ().findResource ("Spellcheckers");
    List<String> result = new ArrayList<String> ();
    FileObject root = FileUtil.getConfigFile ("Spellcheckers");
    if (root != null) {
        FileObject[] children = root.getChildren ();
        for (FileObject fileObject : children) {
            String name = null;
            try {
                name = fileObject.getFileSystem ().getDecorator ().annotateName (fileObject.getName (), Collections.singleton (fileObject));
            } catch (FileStateInvalidException ex) {
                name = fileObject.getName ();
            }
            Boolean b = (Boolean) fileObject.getAttribute ("Hidden");
            if (b != null && b) {
                result.add ("-" + name); // hidden
            } else {
                result.add ("+" + name);
            }
        }
    }
    Collections.sort (result, CategoryComparator);
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:SpellcheckerOptionsPanel.java

示例6: classToSourceURL

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
private String classToSourceURL (FileObject fo) {
    try {
        ClassPath cp = ClassPath.getClassPath (fo, ClassPath.EXECUTE);
        FileObject root = cp.findOwnerRoot (fo);
        String resourceName = cp.getResourceName (fo, '/', false);
        if (resourceName == null) {
            getProject().log("Can not find classpath resource for "+fo+", skipping...", Project.MSG_ERR);
            return null;
        }
        int i = resourceName.indexOf ('$');
        if (i > 0)
            resourceName = resourceName.substring (0, i);
        FileObject[] sRoots = SourceForBinaryQuery.findSourceRoots 
            (root.getURL ()).getRoots ();
        ClassPath sourcePath = ClassPathSupport.createClassPath (sRoots);
        FileObject rfo = sourcePath.findResource (resourceName + ".java");
        if (rfo == null) return null;
        return rfo.getURL ().toExternalForm ();
    } catch (FileStateInvalidException ex) {
        ex.printStackTrace ();
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:JPDAReload.java

示例7: computeAnnotatedHtmlDisplayName

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
/**
 * Annotates <code>htmlDisplayName</code>, if it is needed, and returns the
 * result; <code>null</code> otherwise.
 */
public static String computeAnnotatedHtmlDisplayName(
        final String htmlDisplayName, final Set<? extends FileObject> files) {

    String result = null;
    if (files != null && files.iterator().hasNext()) {
        try {
            FileObject fo = (FileObject) files.iterator().next();
            StatusDecorator stat = fo.getFileSystem().getDecorator();
            String annotated = stat.annotateNameHtml(htmlDisplayName, files);
            // Make sure the super string was really modified (XXX why?)
            if (annotated != null && !htmlDisplayName.equals(annotated)) {
                result = annotated;
            }
        } catch (FileStateInvalidException e) {
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
        }
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:NodeFactoryUtils.java

示例8: testRemoveAllRemaning

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
public void testRemoveAllRemaning() throws IOException, FileStateInvalidException {
    JavaSource src = getJavaSource(testFile);
    
    Task<WorkingCopy> task = new Task<WorkingCopy>() {

        public void run(WorkingCopy workingCopy) throws IOException {
            workingCopy.toPhase(Phase.RESOLVED);
            CompilationUnitTree cut = workingCopy.getCompilationUnit();
            TreeMaker make = workingCopy.getTreeMaker();
            CompilationUnitTree unit = make.CompilationUnit(
                    cut.getPackageName(),
                    Collections.EMPTY_LIST,
                    cut.getTypeDecls(),
                    cut.getSourceFile()
            );
            workingCopy.rewrite(cut, unit);
        }
    };
    src.runModificationTask(task).commit();
    String res = TestUtilities.copyFileToString(testFile);
    System.err.println(res);
    assertFiles("testRemoveAllRemaning_ImportFormatTest.pass");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ImportFormatTest.java

示例9: testRemoveInside

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
public void testRemoveInside() throws IOException, FileStateInvalidException {
    JavaSource src = getJavaSource(testFile);
    
    Task<WorkingCopy> task = new Task<WorkingCopy>() {

        public void run(WorkingCopy workingCopy) throws IOException {
            workingCopy.toPhase(Phase.RESOLVED);
            CompilationUnitTree cut = workingCopy.getCompilationUnit();
            TreeMaker make = workingCopy.getTreeMaker();
            List<ImportTree> imports = new ArrayList<ImportTree>(cut.getImports());
            imports.remove(4);
            CompilationUnitTree unit = make.CompilationUnit(
                    cut.getPackageName(),
                    imports,
                    cut.getTypeDecls(),
                    cut.getSourceFile()
            );
            workingCopy.rewrite(cut, unit);
        }
    };
    src.runModificationTask(task).commit();
    String res = TestUtilities.copyFileToString(testFile);
    System.err.println(res);
    assertFiles("testRemoveInside_ImportFormatTest.pass");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ImportFormatTest.java

示例10: testMoveLast

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
public void testMoveLast() throws IOException, FileStateInvalidException {
    JavaSource src = getJavaSource(testFile);
    
    Task<WorkingCopy> task = new Task<WorkingCopy>() {

        public void run(WorkingCopy workingCopy) throws IOException {
            workingCopy.toPhase(Phase.RESOLVED);
            CompilationUnitTree cut = workingCopy.getCompilationUnit();
            TreeMaker make = workingCopy.getTreeMaker();
            List<ImportTree> imports = new ArrayList<ImportTree>(cut.getImports());
            ImportTree oneImport = imports.remove(7);
            imports.add(1, oneImport);
            CompilationUnitTree unit = make.CompilationUnit(
                    cut.getPackageName(),
                    imports,
                    cut.getTypeDecls(),
                    cut.getSourceFile()
            );
            workingCopy.rewrite(cut, unit);
        }
    };
    src.runModificationTask(task).commit();
    String res = TestUtilities.copyFileToString(testFile);
    System.err.println(res);
    assertFiles("testMoveLast_ImportFormatTest.pass");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ImportFormatTest.java

示例11: testReplaceLine

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
public void testReplaceLine() throws IOException, FileStateInvalidException {
    JavaSource src = getJavaSource(testFile);
    
    Task<WorkingCopy> task = new Task<WorkingCopy>() {

        public void run(WorkingCopy workingCopy) throws IOException {
            workingCopy.toPhase(Phase.RESOLVED);
            CompilationUnitTree cut = workingCopy.getCompilationUnit();
            TreeMaker make = workingCopy.getTreeMaker();
            List<ImportTree> imports = new ArrayList<ImportTree>(cut.getImports());
            ImportTree oneImport = imports.remove(4);
            imports.add(4, make.Import(make.Identifier("java.util.Collection"), false));
            CompilationUnitTree unit = make.CompilationUnit(
                    cut.getPackageName(),
                    imports,
                    cut.getTypeDecls(),
                    cut.getSourceFile()
            );
            workingCopy.rewrite(cut, unit);
        }
    };
    src.runModificationTask(task).commit();
    String res = TestUtilities.copyFileToString(testFile);
    System.err.println(res);
    assertFiles("testReplaceLine_ImportFormatTest.pass");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ImportFormatTest.java

示例12: getLibraryVersion

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
private static String getLibraryVersion(Library library, String className) {
    List<URL> urls = library.getContent("classpath"); // NOI18N
    ClassPath cp = createClassPath(urls);
    try {
        FileObject resource = cp.findResource(className.replace('.', '/') + ".class");  //NOI18N
        if (resource==null) {
            return null;
        }
        FileObject ownerRoot = cp.findOwnerRoot(resource);

        if (ownerRoot !=null) { //NOI18N
            if (ownerRoot.getFileSystem() instanceof JarFileSystem) {
                JarFileSystem jarFileSystem = (JarFileSystem) ownerRoot.getFileSystem();
                return getImplementationVersion(jarFileSystem);
            }
        }
    } catch (FileStateInvalidException e) {
        Exceptions.printStackTrace(e);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:SpringUtilities.java

示例13: findSpringVersion

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
private String findSpringVersion(FileObject ownerRoot) {
    try {
        if (ownerRoot !=null) { //NOI18N
            if (ownerRoot.getFileSystem() instanceof JarFileSystem) {
                JarFileSystem jarFileSystem = (JarFileSystem) ownerRoot.getFileSystem();
                String implementationVersion = SpringUtilities.getImplementationVersion(jarFileSystem);
                if (implementationVersion != null) {
                    String[] splitedVersion = implementationVersion.split("[.]"); //NOI18N
                    if (splitedVersion.length < 2) {
                        LOG.log(Level.SEVERE, "Unknown syntax of implementation version={0}", implementationVersion);
                        return null;
                    }
                    return splitedVersion[0] + "." + splitedVersion[1];
                }
            }
        }
    } catch (FileStateInvalidException e) {
        Exceptions.printStackTrace(e);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:NewSpringXMLConfigWizardIterator.java

示例14: setTopComponent

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
/** This is called by the multiview elements whenever they are created
 * (and given a observer knowing their multiview TopComponent). It is
 * important during deserialization and clonig the multiview - i.e. during
 * the operations we have no control over. But anytime a multiview is
 * created, this method gets called.
 */
private void setTopComponent(TopComponent topComp) {
    multiviewTC = (CloneableTopComponent)topComp;
    updateMVTCName();

    if (topComponentsListener == null) {
        topComponentsListener = new TopComponentsListener();
        TopComponent.getRegistry().addPropertyChangeListener(topComponentsListener);
    }
    opened.add(this);
    try {
        addStatusListener(getDataObject().getPrimaryFile().getFileSystem());
    } catch (FileStateInvalidException fsiex) {
        Exceptions.printStackTrace(fsiex);
    }

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:BIEditorSupport.java

示例15: findAnnotableFiles

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
@CheckForNull
private static Pair<FileSystem,Set<? extends FileObject>> findAnnotableFiles(Collection<? extends FileObject> fos) {
    FileSystem fs = null;
    final Set<FileObject> toAnnotate = new HashSet<>();
    for (FileObject fo : fos) {
        try {
            FileSystem tmp = fo.getFileSystem();
            if (fs == null) {
                fs = tmp;
                toAnnotate.add(fo);
            } else if (fs.equals(tmp)) {
                toAnnotate.add(fo);
            }
        } catch (FileStateInvalidException e) {
        LOG.log(
            Level.WARNING,
            "Cannot determine annotations for invalid file: {0}",   //NOI18N
            FileUtil.getFileDisplayName(fo));
        }
    }
    return fs == null ?
            null :
            Pair.of(fs, toAnnotate);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:MultiModuleNodeFactory.java


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