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


Java FileObject.addFileChangeListener方法代码示例

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


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

示例1: AnnotationTypesFolder

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/** Creates new AnnotationTypesFolder */
private AnnotationTypesFolder(FileObject fo, DataFolder fld) {
    super(fld);
    recreate();
    instanceFinished();
    
    // add listener on changes in annotation types folder
    fo.addFileChangeListener(new FileChangeAdapter() {
        public void fileDeleted(FileEvent fe) {
            AnnotationType type;
            for (Iterator it = AnnotationTypes.getTypes().getAnnotationTypeNames(); it.hasNext(); ) {
                type = AnnotationTypes.getTypes().getType((String)it.next());
                if ( type != null && ((FileObject)type.getProp(AnnotationType.PROP_FILE)).equals(fe.getFile()) ) {
                    AnnotationTypes.getTypes().removeType(type.getName());
                    break;
                }
            }
        }
    });
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:AnnotationTypesFolder.java

示例2: installModulesInstallationListener

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/** See issue #57773 for details. Toolbar should be updated with possible changes after
   module install/uninstall */
private void installModulesInstallationListener(){
    moduleRegListener = new FileChangeAdapter() {
        public @Override void fileChanged(FileEvent fe) {
            //some module installed/uninstalled. Refresh toolbar content
            Runnable r = new Runnable() {
                public void run() {
                    if (isToolbarVisible()) {
                        checkPresentersRemoved();
                        checkPresentersAdded();                                
                    }
                }
             };
            Utilities.runInEventDispatchThread(r);
        }
    };

    FileObject moduleRegistry = FileUtil.getConfigFile("Modules"); //NOI18N

    if (moduleRegistry !=null){
        moduleRegistry.addFileChangeListener(
            FileUtil.weakFileChangeListener(moduleRegListener, moduleRegistry));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:NbEditorToolBar.java

示例3: testGarbageCollectListener

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public void testGarbageCollectListener() throws Exception {
    FileObject root = FileUtil.toFileObject(getWorkDir());
    FileObject folder = root.createFolder("dir");
    
    notify.assertRegistered("No registered paths yet");
    
    root.addFileChangeListener(listener);
    
    notify.assertRegistered("One path is being listened to", root.getPath());
    
    Reference<FileObject> ref = new WeakReference<FileObject>(root);
    root = null;
    folder = null;
    assertGC("Root can be GCed", ref);

    watcher.clearQueue();
    notify.assertRegistered("Path has been cleared", (String)null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:WatcherTest.java

示例4: acceptTemplate

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private boolean acceptTemplate (FileObject fo) {
    if (fo.isFolder() &&
        (TEMPLATES_FOLDER+"/Properties").equals(fo.getPath())) {
        
        return false;
    }
    boolean attachListener;
    synchronized (filesWeListenOn) {
        attachListener = filesWeListenOn.add(fo);
    }
    if (attachListener) {
        FileChangeListener fileChangeListener = FileUtil.weakFileChangeListener(this, fo);
        fo.addFileChangeListener(fileChangeListener);
    }
    if (isTemplate (fo) || fo.isFolder()) {
        Object o = fo.getAttribute ("simple"); // NOI18N
        return o == null || Boolean.TRUE.equals (o);
    } else {
        return false;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TemplatesPanel.java

示例5: RerunAction

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public RerunAction(TargetExecutor prototype, boolean withModifications) {
    this.withModifications = withModifications;
    reinit(prototype);
    setEnabledEQ(this, false); // initially, until ready
    FileObject script = pcookie.getFileObject();
    if (script != null) {
        script.addFileChangeListener(FileUtil.weakFileChangeListener(this, script));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:TargetExecutor.java

示例6: addFileWatch

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void addFileWatch(File file) {
    FileObject fileo = null;
    if (file.isFile())
        fileo = FileUtil.toFileObject(FileUtil.normalizeFile(file));
    if (fileo != null) {
        FileWatch fileWatch = profilingPointsFiles.get(file);
        if (fileWatch == null) {
            LocationFileListener listener = new LocationFileListener(file);
            fileWatch = new FileWatch(listener);
            fileo.addFileChangeListener(listener);
            profilingPointsFiles.put(file, fileWatch);
        }
        fileWatch.increaseReferences();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ProfilingPointsManager.java

示例7: createNodes

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
protected Node[] createNodes(String key) {
    if (LAYER.equals(key)) {
        Node nd = NodeFactoryUtils.createLayersNode(project);
        if (nd != null) {
            DataObject dobj = nd.getLookup().lookup(DataObject.class);
            if (dobj != null) {
                FileObject fo = dobj.getPrimaryFile();
                fo.addFileChangeListener(FileUtil.weakFileChangeListener(layerfcl, fo));
            }
            return new Node[] {nd };
        }
        return new Node[0];
    }
    else {
        FileObject file = project.getProjectDirectory().getFileObject(key);
        if (file != null) {
            try {
                Node orig = DataObject.find(file).getNodeDelegate();
                return new Node[] {NodeFactoryUtils.createSpecialFileNode(orig, FILES.get(key))};
            } catch (DataObjectNotFoundException e) {
                throw new AssertionError(e);
            }
        }
        return new Node[0];
    } 
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ImportantFilesNodeFactory.java

示例8: fileFolderCreated

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public synchronized void fileFolderCreated(FileEvent fe) {
    FileObject f = fe.getFile();
    if (keymapFolder == null && KEYMAPS_FOLDER.equals(f.getNameExt()) && f.getParent() == FileUtil.getConfigRoot()) {
        // keymap folder is created -> start listening on it
        keymapFolder = f;
        f.addFileChangeListener(this);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:EditorSettingsImpl.java

示例9: attach

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public synchronized void attach(BuildTask buildTask) {
    FileObject fo = buildTask.getDockerfile();

    this.buildTask = buildTask;
    this.listener = new ActionStateListener(this, buildTask.getInstance(), fo);

    fo.addFileChangeListener(listener);
    DockerSupport.getDefault().addChangeListener(listener);

    listener.refresh();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:BuildImageWizard.java

示例10: checkFileObject

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void checkFileObject(String path) {
    FileObject fo = project.getProjectDirectory().getFileObject(path);
    if (fo != null) {
        fo.removeFileChangeListener(fcl);
        fo.addFileChangeListener(fcl);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:OtherRootNodeFactory.java

示例11: putLine

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
void putLine(String url, String className, String fieldName, FileObject fo,
             int lineNumber) {
    if (!knownFiles.contains(fo)) {
        fo.addFileChangeListener(new FileChangeListenerImpl(url));
        knownFileRefs.add(new FileKey(fo, url));
    }
    synchronized (fieldLines) {
        fieldLines.put(new FieldKey(url, className, fieldName), lineNumber);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:FieldLNCache.java

示例12: KeymapProfileTracker

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public KeymapProfileTracker(FileObject keymapFolder) {
    this.keymapFolder = keymapFolder;
    if (keymapFolder != null) {
        keymapFolder.addFileChangeListener(this);
    } else {
        FileUtil.getConfigRoot().addFileChangeListener(this);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:EditorSettingsImpl.java

示例13: JSLineBreakpoint

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public JSLineBreakpoint(EditorLineHandler line) {
    this.line = line;
    lineChangesWeak = WeakListeners.propertyChange(lineChangeslistener, line);
    line.addPropertyChangeListener(lineChangesWeak);
    FileObject fileObject = line.getFileObject();
    if( fileObject != null ){
        myWeakListener = WeakListeners.create( 
                FileChangeListener.class, myListener, fileObject);
        fileObject.addFileChangeListener( myWeakListener );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:JSLineBreakpoint.java

示例14: cache

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private Charset cache (final Charset encoding) {

            if (!listeningOnContentChange.getAndSet(true)) {
                final FileObject primaryFile = getPrimaryFile();
                primaryFile.addFileChangeListener(FileUtil.weakFileChangeListener(new FileChangeAdapter(){
                    @Override
                    public void fileChanged(FileEvent fe) {
                        cachedEncoding = null;
                    }
                },primaryFile));
            }
            cachedEncoding = encoding;
            LOG.log(Level.FINEST, "HtmlDataObject.getFileEncoding noncached {0}", new Object[] {encoding});   //NOI18N
            return encoding;
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:HtmlDataObject.java

示例15: setLineHandler

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public void setLineHandler(EditorLineHandler line) {
    dispose();
    EditorLineHandler oldLine = this.line;
    this.line = line;
    lineChangesWeak = WeakListeners.propertyChange(lineChangeslistener, line);
    line.addPropertyChangeListener(lineChangesWeak);
    FileObject fileObject = line.getFileObject();
    if (fileObject != null) {
        myWeakListener = WeakListeners.create(
                FileChangeListener.class, myListener, fileObject);
        fileObject.addFileChangeListener(myWeakListener);
    }
    firePropertyChange(PROP_FILE, oldLine.getFileObject(), line.getFileObject());
    firePropertyChange(PROP_LINE_NUMBER, oldLine.getLineNumber(), line.getLineNumber());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:JSLineBreakpoint.java


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