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


Java FileEditorManagerEvent类代码示例

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


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

示例1: selectionChanged

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent fileEditorManagerEvent) {
    final Project project = fileEditorManagerEvent.getManager().getProject();
    final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
    final FileColorManager fileColorManager = FileColorManager.getInstance(project);
    final HighlighterSettingsConfig highlighterSettingsConfig = HighlighterSettingsConfig.getInstance(project);

    final VirtualFile oldFile = fileEditorManagerEvent.getOldFile();
    final VirtualFile newFile = fileEditorManagerEvent.getNewFile();

    for (EditorWindow editorWindow : manager.getWindows()) {
        setUnfocusedTabWithColorManagerDefaultColor(fileColorManager, oldFile, editorWindow);

        setFocusedTabHighlighterColor(highlighterSettingsConfig, newFile, editorWindow);
    }
}
 
开发者ID:tobszarny,项目名称:ActiveTabHighlighterPlugin,代码行数:17,代码来源:TabHighlighterFileEditorListener.java

示例2: install

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
public void install() {
  final MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
  connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
      final FileEditor editor = event.getNewEditor();
      if (editor != null && myComponent.isShowing() && isAutoScrollEnabled()) {
        myAlarm.cancelAllRequests();
        myAlarm.addRequest(new Runnable() {
          @Override
          public void run() {
            selectElementFromEditor(editor);
          }
        }, getAlarmDelay(), getModalityState());
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AutoScrollFromSourceHandler.java

示例3: selectionChanged

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
@Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
    }
  });

  myFocusListener = new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      if ("focusOwner".equals(evt.getPropertyName())) {
        myUpdateHeadersAlarm.cancelAllRequests();
        myUpdateHeadersAlarm.addRequest(myUpdateHeadersRunnable, 50);
      }
    }
  };
  KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(myFocusListener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ToolWindowManagerImpl.java

示例4: projectOpened

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
@Override
public void projectOpened() {
  myIdeFrame = ((WindowManagerEx)myWindowManager).getFrame(myProject);
  myProject.getMessageBus().connect(myProject).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
      if (myIdeFrame == null || myIdeFrame.getFocusOwner() == null) return;
      setActiveWindow(myIdeFrame);
    }
  });

  final MyEditorFactoryListener myEditorFactoryListener = new MyEditorFactoryListener();
  myEditorFactory.addEditorFactoryListener(myEditorFactoryListener,myProject);
  Disposer.register(myProject, new Disposable() {
    @Override
    public void dispose() {
      myEditorFactoryListener.executeOnRelease(null);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:EditorTracker.java

示例5: StatusBarUpdater

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
public StatusBarUpdater(Project project) {
  myProject = project;

  project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
      updateLater();
    }
  });

  project.getMessageBus().connect(this).subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, new DaemonCodeAnalyzer.DaemonListenerAdapter() {
    @Override
    public void daemonFinished() {
      updateLater();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:StatusBarUpdater.java

示例6: CurrentFileTodosPanel

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
CurrentFileTodosPanel(Project project, TodoPanelSettings settings, Content content) {
  super(project, settings, true, content);

  VirtualFile[] files = FileEditorManager.getInstance(project).getSelectedFiles();
  setFile(files.length == 0 ? null : PsiManager.getInstance(myProject).findFile(files[0]));
  // It's important to remove this listener. It prevents invocation of setFile method after the tree builder is disposed
  project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@NotNull FileEditorManagerEvent e) {
      VirtualFile file = e.getNewFile();
      final PsiFile psiFile = file != null && file.isValid() ? PsiManager.getInstance(myProject).findFile(file) : null;
      // This invokeLater is required. The problem is setFile does a commit to PSI, but setFile is
      // invoked inside PSI change event. It causes an Exception like "Changes to PSI are not allowed inside event processing"
      DumbService.getInstance(myProject).smartInvokeLater(new Runnable() {
        @Override
        public void run() {
          setFile(psiFile);
        }
      });
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CurrentFileTodosPanel.java

示例7: updateStatusBar

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
private void updateStatusBar() {
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      IdeFrame frame = WindowManager.getInstance().getIdeFrame(myProject);
      StatusBar statusBar = frame != null ? frame.getStatusBar() : null;
      StatusBarWidget widget = statusBar != null ? statusBar.getWidget("LineSeparator") : null;

      if (widget instanceof LineSeparatorPanel) {
        FileEditorManagerEvent event = new FileEditorManagerEvent(FileEditorManager.getInstance(myProject),
                                                                  null, null, null, null);
        ((LineSeparatorPanel)widget).selectionChanged(event);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LineEndingsManager.java

示例8: projectOpened

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
@Override
public void projectOpened() {
  myIdeFrame = ((WindowManagerEx)myWindowManager).getFrame(myProject);
  myProject.getMessageBus().connect(myProject).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
      if (myIdeFrame == null || myIdeFrame.getFocusOwner() == null) return;
      setActiveWindow(myIdeFrame);
    }
  });

  final MyEditorFactoryListener myEditorFactoryListener = new MyEditorFactoryListener();
  myEditorFactory.addEditorFactoryListener(myEditorFactoryListener,myProject);
  Disposer.register(myProject, new Disposable() {
    @Override
    public void dispose() {
      myEditorFactoryListener.dispose(null);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:EditorTracker.java

示例9: StatusBarUpdater

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
public StatusBarUpdater(Project project) {
  myProject = project;

  project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
      updateLater();
    }
  });

  project.getMessageBus().connect(this).subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, new DaemonCodeAnalyzer.DaemonListener() {
    @Override
    public void daemonFinished() {
      updateLater();
    }

    @Override
    public void daemonCancelEventOccurred() {
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:StatusBarUpdater.java

示例10: updateStatusBar

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
private void updateStatusBar() {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            IdeFrame frame = WindowManager.getInstance().getIdeFrame(project);
            StatusBar statusBar = frame.getStatusBar();
            StatusBarWidget widget = statusBar != null ? statusBar.getWidget("LineSeparator") : null;

            if (widget instanceof LineSeparatorPanel) {
                FileEditorManagerEvent event = new FileEditorManagerEvent(FileEditorManager.getInstance(project),
                                                                          null, null, null, null);
                ((LineSeparatorPanel)widget).selectionChanged(event);
            }
        }
    });
}
 
开发者ID:editorconfig,项目名称:editorconfig-jetbrains,代码行数:17,代码来源:LineEndingsManager.java

示例11: install

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
public void install() {
  final MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
  connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@Nonnull FileEditorManagerEvent event) {
      final FileEditor editor = event.getNewEditor();
      if (editor != null && myComponent.isShowing() && isAutoScrollEnabled()) {
        myAlarm.cancelAllRequests();
        myAlarm.addRequest(new Runnable() {
          @Override
          public void run() {
            selectElementFromEditor(editor);
          }
        }, getAlarmDelay(), getModalityState());
      }
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:AutoScrollFromSourceHandler.java

示例12: projectOpened

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
@Override
public void projectOpened() {
  myIdeFrame = myWindowManager.getFrame(myProject);
  myProject.getMessageBus().connect(myProject).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@Nonnull FileEditorManagerEvent event) {
      if (myIdeFrame == null || myIdeFrame.getFocusOwner() == null) return;
      setActiveWindow(myIdeFrame);
    }
  });

  final MyEditorFactoryListener myEditorFactoryListener = new MyEditorFactoryListener();
  myEditorFactory.addEditorFactoryListener(myEditorFactoryListener,myProject);
  Disposer.register(myProject, new Disposable() {
    @Override
    public void dispose() {
      myEditorFactoryListener.executeOnRelease(null);
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:EditorTracker.java

示例13: StatusBarUpdater

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
public StatusBarUpdater(Project project) {
  myProject = project;

  project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@Nonnull FileEditorManagerEvent event) {
      updateLater();
    }
  });

  project.getMessageBus().connect(this).subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, new DaemonCodeAnalyzer.DaemonListenerAdapter() {
    @Override
    public void daemonFinished() {
      updateLater();
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:StatusBarUpdater.java

示例14: CurrentFileTodosPanel

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
CurrentFileTodosPanel(Project project, TodoPanelSettings settings, Content content) {
  super(project, settings, true, content);

  VirtualFile[] files = FileEditorManager.getInstance(project).getSelectedFiles();
  setFile(files.length == 0 ? null : PsiManager.getInstance(myProject).findFile(files[0]));
  // It's important to remove this listener. It prevents invocation of setFile method after the tree builder is disposed
  project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
    @Override
    public void selectionChanged(@Nonnull FileEditorManagerEvent e) {
      VirtualFile file = e.getNewFile();
      final PsiFile psiFile = file != null && file.isValid() ? PsiManager.getInstance(myProject).findFile(file) : null;
      // This invokeLater is required. The problem is setFile does a commit to PSI, but setFile is
      // invoked inside PSI change event. It causes an Exception like "Changes to PSI are not allowed inside event processing"
      DumbService.getInstance(myProject).smartInvokeLater(() -> setFile(psiFile));
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:CurrentFileTodosPanel.java

示例15: selectionChanged

import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
    VirtualFile fileNew = event.getNewFile();
    Editor rootEditor = event.getManager().getSelectedTextEditor();
    if (rootEditor == null) {
        return;
    }

    Document rootDocument = rootEditor.getDocument();
    if (fileNew != null) {
        if (!isFeatureFile(fileNew))
            return;

        String pathNewFile = getRelativePath(fileNew.getPath());

        if (openedGherkinFiles.stream().noneMatch(f -> f.equals(pathNewFile))) {
            openedGherkinFiles.add(pathNewFile);

            GherkinIconUtils gherkinIconUtils = new GherkinIconUtils(pathNewFile);
            gherkinIconUtils.generateGherkinRunIcons(rootDocument, rootEditor);

            GherkinDocumentListener listener = new GherkinDocumentListener(pathNewFile, rootEditor);
            rootDocument.addDocumentListener(listener);

            documentListeners.add(listener);
        }
    }
}
 
开发者ID:KariiO,项目名称:Gherkin-TS-Runner,代码行数:28,代码来源:GherkinFileEditorManagerListener.java


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