Java Code Examples for com.intellij.openapi.vfs.VirtualFileAdapter

The following examples show how to use com.intellij.openapi.vfs.VirtualFileAdapter. These examples are extracted from open source projects. 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 Project: floobits-intellij   Source File:    License: Apache License 2.0 5 votes vote down vote up
public synchronized void start(final EditorEventHandler editorManager) {
    this.editorManager = editorManager;
    connection.subscribe(VirtualFileManager.VFS_CHANGES, this);
    connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, this);

    virtualFileAdapter = new VirtualFileAdapter() {
        public void beforePropertyChange(@NotNull final VirtualFilePropertyEvent event) {
            if (!event.getPropertyName().equals(VirtualFile.PROP_NAME)) {
            VirtualFile parent = event.getParent();
            if (parent == null) {
            String parentPath = parent.getPath();
            // XXX: pretty sure is this wrong.
            String newValue = parentPath + "/" + event.getNewValue().toString();
            String oldValue = parentPath + "/" + event.getOldValue().toString();
            editorManager.rename(oldValue, newValue);
Example 2
Source Project: consulo   Source File:    License: Apache License 2.0 5 votes vote down vote up
private NewFileTracker() {
  final VirtualFileManager virtualFileManager = VirtualFileManager.getInstance();
  virtualFileManager.addVirtualFileListener(new VirtualFileAdapter() {
    public void fileCreated(@Nonnull VirtualFileEvent event) {
      if (event.isFromRefresh()) return;