org.openide.filesystems.FileRenameEvent Java Examples

The following examples show how to use org.openide.filesystems.FileRenameEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProfilingPointsManager.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void fileRenamed(final FileRenameEvent fe) {
    Runnable worker = new Runnable() {
        public void run() { 
            FileObject renamedFileO = fe.getFile();
            File renamedFile = FileUtil.toFile(renamedFileO);
            if (renamedFile != null && renamedFile.exists() && renamedFile.isFile()) {
                updateProfilingPointsFile(file, renamedFile);
            } else {
                deleteProfilingPointsForFile(file);
            }
        }
    };
    
    if (SwingUtilities.isEventDispatchThread()) {
        processor().post(worker);
    } else {
        worker.run();
    }
}
 
Example #2
Source File: EditorContextDispatcher.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    FileObject fo = (FileObject) fe.getSource();
    boolean doFire;
    synchronized (EditorContextDispatcher.this) {
        FileObject currentFO = currentFile.get();
        FileObject lastFO = mostRecentFileRef.get();
        doFire = fo.equals(currentFO) || fo.equals(lastFO);
        if (doFire) {
            currentURL = null;
        }
    }
    if (doFire) {
        // Fire null as the old value so that the event is not ignored.
        refreshProcessor.post(new EventFirer(PROP_FILE, null, fo, fo.getMIMEType()));
    }
}
 
Example #3
Source File: CopyResourcesOnSave.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void fileRenamedImpl(final FileRenameEvent fe) {
    try {
        FileObject fo = fe.getFile();
        Project owning = getOwningMavenProject(fo);
        if (owning == null) {
            return;
        }
        Tuple base = findAppropriateResourceRoots(fo, owning);
        if (base != null) {
            handleCopyFileToDestDir(base, fo, owning);
            FileObject parent = fo.getParent();
            String path;
            if (FileUtil.isParentOf(base.root, parent)) {
                path = FileUtil.getRelativePath(base.root, fo.getParent()) +
                        "/" + fe.getName() + "." + fe.getExt(); //NOI18N
            } else {
                path = fe.getName() + "." + fe.getExt(); //NOI18N
            }
            handleDeleteFileInDestDir(fo, path, base, owning);
        }
    } catch (IOException e) {
        LOG.log(Level.INFO, null, e);
    }
}
 
Example #4
Source File: ClientSideProject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    // XXX: notify BrowserReload about filename change
    checkPreprocessors(fe.getFile(), fe.getName(), fe.getExt());

    if (fe.getFile().equals(siteRootFolder)) {
        final ClientSideProjectProperties projectProperties = new ClientSideProjectProperties(p);
        projectProperties.setSiteRootFolder(siteRootFolder.getNameExt());
        projectProperties.save();
    }

}
 
Example #5
Source File: FileObjectKeeper.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    Collection<FileChangeListener> arr = listeners;
    if (arr == null) {
        return;
    }
    final FileObject f = fe.getFile();
    if (f.isFolder() && fe.getSource() == f && f != root) {
        // there will be another event for parent folder
        return;
    }
    for (FileChangeListener l : arr) {
        l.fileRenamed(fe);
    }
}
 
Example #6
Source File: FileStateManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void fileRenamed (FileRenameEvent fe) {
    // rename can be caused either by renaming fo or by deleting mfo,
    // thus the safe way is to discard this FileInfo from the map and
    // notify listeners about the change 
    FileObject mfo = file.get ();
    if (mfo != null && mfo.isValid ()) {
        discard (mfo);
        fireFileStatusChanged (mfo);
    }
    else
        detachAllNotifiers ();
}
 
Example #7
Source File: BowerProblemsProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    String oldName = fe.getName() + (StringUtils.hasText(fe.getExt()) ? "." + fe.getExt() : ""); // NOI18N
    processFileChange(fe.getFile().getNameExt());
    processFileChange(oldName);
    processFolderChange(fe.getFile().getNameExt());
    processFolderChange(oldName);
}
 
Example #8
Source File: EjbJarMultiViewDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void fileRenamed(FileRenameEvent fileRenameEvent) {
    FileObject fo = fileRenameEvent.getFile();
    String resourceName = getPackageName(fo);
    if (resourceName != null) {
        int index = resourceName.lastIndexOf("."); //NOI18N
        String oldName = fileRenameEvent.getName();
        String oldResourceName = (index >= 0 ? resourceName.substring(0, index + 1) : "") + oldName;
        EjbJar ejbJar = getEjbJar();
        if (ejbJar.getStatus() == EjbJar.STATE_VALID) {
            fireEvent(oldResourceName, resourceName, DDChangeEvent.EJB_CHANGED);
        }
    }
}
 
Example #9
Source File: ModuleList.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void fileRenamed(FileRenameEvent ev) {
    if (isOurs(ev)) {
        throw new IllegalStateException("I don't rename anything! " + ev); // NOI18N
    }
    FileObject fo = ev.getFile();
    fileDeleted0(ev.getName(), ev.getExt()/*, ev.getTime()*/);
    fileCreated0(fo.getName(), fo.getExt()/*, ev.getTime()*/);
}
 
Example #10
Source File: PhpProject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    FileObject file = fe.getFile();
    if (!isVisible(file)) {
        return;
    }
    frameworksReset(file);
    processChange(file, fe.getName(), fe.getExt());
}
 
Example #11
Source File: JSLineBreakpoint.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    FileObject renamedFo = fe.getFile();
    int oldLineNumber = line.getLineNumber();
    EditorLineHandler newLine = EditorLineHandlerFactory.getHandler(renamedFo, oldLineNumber);
    int newLineNumber = newLine.getLineNumber();
    JSLineBreakpoint.this.line = newLine;
    firePropertyChange(PROP_LINE_NUMBER, oldLineNumber, newLineNumber);
    firePropertyChange(PROP_FILE, fe.getName(), renamedFo.getName());
}
 
Example #12
Source File: NbProjectManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    synchronized (dir2Proj) {
        LOG.log(Level.FINE, "renamed: {0}", fe.getFile());
        final Union2<Reference<Project>, LoadStatus> prjOrLs = dir2Proj.remove(fe.getFile());
        callBack.notifyDeleted((prjOrLs != null && prjOrLs.hasFirst()) ?
            prjOrLs.first().get() :
            null);
    }
}
 
Example #13
Source File: FileChangeSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void fileRenamed(final FileRenameEvent fe) {
    final String oldExt = fe.getExt();
    final String newExt = fe.getFile().getExt();
    sourceControl.sourceChanged(!Objects.equals(oldExt, newExt));
    sourceControl.revalidate(SourceEnvironment.getReparseDelay(false));
}
 
Example #14
Source File: CopySupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    FileObject source = getValidProjectSource(fe);
    if (source == null) {
        return;
    }
    LOGGER.log(Level.FINE, "Processing event FILE RENAMED for project {0}", project.getName());
    String originalName = fe.getName();
    String ext = fe.getExt();
    if (StringUtils.hasText(ext)) {
        originalName += "." + ext; // NOI18N
    }
    prepareOperation(proxyOperationFactory.createRenameHandler(source, originalName, fe));
}
 
Example #15
Source File: StorageImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void fileRenamed(FileRenameEvent fe) {
    if (!filterEvents(fe)) {
        boolean processed = processKids(fe.getFile().getParent());
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("fileRenamed (" + (processed ? "processed" : "ignored" ) + "): " //NOI18N
                + fe.getFile().getPath());
        }
    }
}
 
Example #16
Source File: RulesManager.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void fileRenamed(FileRenameEvent fe) {
    hintsChanged();
}
 
Example #17
Source File: XMLDataObjectInfoParser.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void fileRenamed(FileRenameEvent fe) {
}
 
Example #18
Source File: Deadlock59522Test.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void fileRenamed (FileRenameEvent fe) {
    lockMdr ();
}
 
Example #19
Source File: FolderListener.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void fileRenamed(FileRenameEvent fe) {
}
 
Example #20
Source File: FolderChildren.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    refreshChildren(RefreshMode.SHALLOW);
}
 
Example #21
Source File: MobileConfigurationsProvider.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    update(fe);
}
 
Example #22
Source File: InstallOrActivateTask.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void fileRenamed(FileRenameEvent fe) {
}
 
Example #23
Source File: MMDNavigator.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
}
 
Example #24
Source File: SystemFileSystem.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void fileRenamed(FileRenameEvent fe) {
    log("fileDeleted", fe); // NOI18N
}
 
Example #25
Source File: FreemarkerEngine.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void fileRenamed(FileRenameEvent fe) {
    clear();
}
 
Example #26
Source File: SourcesImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    recompute();
}
 
Example #27
Source File: LayerUtils.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void fileRenamed(FileRenameEvent fe) {
    changed(fe);
}
 
Example #28
Source File: WLSharedState.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    // realistically this would not happen
    changeSupport.fireChange();
}
 
Example #29
Source File: MimeTypesTracker.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    notifyRebuild(fe.getFile());
}
 
Example #30
Source File: CdnjsLibraries.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void fileRenamed(FileRenameEvent fe) {
    fireChange();
}