• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FileStateInvalidException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: getLoaderDisplayName

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
/** Returns localized display name of loader for given MIME type or null if not defined. */
private static String getLoaderDisplayName(String mimeType) {
    FileSystem filesystem = null;
    try {
        filesystem = FileUtil.getConfigRoot().getFileSystem();
    } catch (FileStateInvalidException ex) {
        Exceptions.printStackTrace(ex);
    }
    FileObject factoriesFO = FileUtil.getConfigFile("Loaders/" + mimeType + "/Factories");  //NOI18N
    if(factoriesFO != null) {
        FileObject[] children = factoriesFO.getChildren();
        for (FileObject child : children) {
            String childName = child.getNameExt();
            String displayName = filesystem.getDecorator().annotateName(childName, Collections.singleton(child));
            if(!childName.equals(displayName)) {
                return displayName;
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:FileAssociationsModel.java


示例17: getFileState

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
public int getFileState (FileObject mfo, int layer) {
    // check if the FileObject is from SystemFileSystem
    FileSystem fs = null;
    FileInfo finf = null;

    try {
        fs = mfo.getFileSystem ();
    } catch (FileStateInvalidException e) {
        // ignore, will be handled later
    }

    if (fs == null || !fs.isDefault())
        throw new IllegalArgumentException ("FileObject has to be from DefaultFileSystem - " + mfo);
    
    synchronized (info) {
        if (null == (finf = info.get(mfo))) {
            finf = new FileInfo(mfo);
            info.put(mfo, finf);
        }
    }

    return finf.getState (layer);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:FileStateManager.java


示例18: getHtmlDisplayName

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
public @Override String getHtmlDisplayName() {
    String htmlName = getOriginal().getHtmlDisplayName();
    if (htmlName == null) {
        try {
            htmlName = XMLUtil.toElementContent(getOriginal().getDisplayName());
        } catch (CharConversionException ex) {
            // ignore
        }
    }
    if (htmlName == null) {
        return null;
    }
    if (files != null && files.iterator().hasNext()) {
        try {
            String annotatedMagic = files.iterator().next().getFileSystem().
                    getDecorator().annotateNameHtml(MAGIC, files);
            if (annotatedMagic != null) {
                htmlName = annotatedMagic.replace(MAGIC, htmlName);
            }
        } catch (FileStateInvalidException e) {
            LOG.log(Level.INFO, null, e);
        }
    }      
    return isMainAsync()? "<b>" + htmlName + "</b>" : htmlName;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ProjectsRootNode.java


示例19: getIcon

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
private Image getIcon(int type, boolean opened) {
    Image img = opened ? super.getOpenedIcon(type) : super.getIcon(type);

    if (logicalView) {
        if (files != null && files.iterator().hasNext()) {
            try {
                FileObject fo = files.iterator().next();
                img = FileUIUtils.getImageDecorator(fo.getFileSystem()).annotateIcon(img, type, files);
            } catch (FileStateInvalidException e) {
                LOG.log(Level.INFO, null, e);
            }
        }
        Project p = getLookup().lookup(Project.class);
        if (p != null) {
            for (ProjectIconAnnotator pa : result.allInstances()) {
                img = pa.annotateIcon(p, img, opened);
            }
        }
    }

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


示例20: getHtmlDisplayName

import org.openide.filesystems.FileStateInvalidException; //导入依赖的package包/类
@Override
public String getHtmlDisplayName() {
    if (!isTopLevelNode) {
        return getOriginal().getHtmlDisplayName();
    }
     try {
        DataObject dob = getOriginal().getLookup().lookup(DataObject.class);
        FileObject file = dob.getPrimaryFile();
         String s = LBL_Site_Pages();
         String result = file.getFileSystem().getDecorator().annotateNameHtml (
             s, Collections.singleton(file));

         //Make sure the super string was really modified
         if (result != null && !s.equals(result)) {
             return result;
         }
     } catch (FileStateInvalidException e) {
         ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
     }
     return super.getHtmlDisplayName();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:SiteDocsNode.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReactModule类代码示例发布时间:2022-05-22
下一篇:
Java JRDataset类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap