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


Java EditorFactoryEvent类代码示例

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


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

示例1: editorCreated

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
private void editorCreated(@NotNull EditorFactoryEvent event) {
    final Editor editor = event.getEditor();
    LineSelectionManager manager = new LineSelectionManager(editor);
    myLineSelectionManagers.put(editor, manager);
    myDelayedRunner.addRunnable(editor, () -> {
        myLineSelectionManagers.remove(editor);
        Disposer.dispose(manager);
    });

    if (editor.getProject() != null) {
        PluginProjectComponent projectComponent = editor.getProject().getComponent(PluginProjectComponent.class);
        if (projectComponent != null) {
            projectComponent.editorCreated(editor);
            myDelayedRunner.addRunnable(editor, () -> {
                projectComponent.editorReleased(editor);
            });
        }
    }

    if (mySettings.isOverrideStandardPaste()) {
        registerPasteOverrides(editor);
        myDelayedRunner.addRunnable(editor, () -> unRegisterPasteOverrides(editor));
    }
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:25,代码来源:Plugin.java

示例2: releaseEditor

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
@Override
public void releaseEditor(@NotNull Editor editor) {
  try {
    myEditorFactoryEventDispatcher.getMulticaster().editorReleased(new EditorFactoryEvent(this, editor));
  }
  finally {
    try {
      ((EditorImpl)editor).release();
    }
    finally {
      myEditors.remove(editor);
      if (LOG.isDebugEnabled()) {
        LOG.debug("number of Editor's:" + myEditors.size());
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EditorFactoryImpl.java

示例3: TemplateManagerImpl

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
public TemplateManagerImpl(Project project) {
  myProject = project;
  final EditorFactoryListener myEditorFactoryListener = new EditorFactoryAdapter() {
    @Override
    public void editorReleased(@NotNull EditorFactoryEvent event) {
      Editor editor = event.getEditor();
      if (editor.getProject() != null && editor.getProject() != myProject) return;
      if (myProject.isDisposed() || !myProject.isOpen()) return;
      TemplateState state = getTemplateState(editor);
      if (state != null) {
        state.gotoEnd();
      }
      clearTemplateState(editor);
    }
  };
  EditorFactory.getInstance().addEditorFactoryListener(myEditorFactoryListener, myProject);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TemplateManagerImpl.java

示例4: editorReleased

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
@Override
public void editorReleased(@NotNull EditorFactoryEvent event) {
  final EditorEx editor = (EditorEx)event.getEditor();
  final Document document = editor.getDocument();

  VirtualFile file = myDocumentManager.getFile(document);
  if (file == null) {
    file = editor.getVirtualFile();
  }
  if (file != null && file.isValid()) {
    for (FileEditor fileEditor : myFileEditorManager.getAllEditors(file)) {
      if (fileEditor instanceof TextEditor && ((TextEditor)fileEditor).getEditor() != editor) {
        return;
      }
    }
  }
  removeDocListener(document, file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ChangeSignatureGestureDetector.java

示例5: editorReleased

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
public void editorReleased(@NotNull EditorFactoryEvent event) {
  final Editor editor = event.getEditor();
  if (editor.getProject() != myProject) return;
  try {
    final SrcFileAnnotator fileAnnotator;
    synchronized (ANNOTATORS_LOCK) {
      fileAnnotator = myAnnotators.remove(editor);
    }
    if (fileAnnotator != null) {
      Disposer.dispose(fileAnnotator);
    }
  }
  finally {
    final Runnable request = myCurrentEditors.remove(editor);
    if (request != null) {
      myAlarm.cancelRequest(request);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:CoverageDataManagerImpl.java

示例6: editorCreated

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
@Override
public void editorCreated(@NotNull EditorFactoryEvent event) {
  Editor editor = event.getEditor();
  if (!openedEditors.contains(editor)) {
    reflectivelyCheckCurrentListeners("editorCreated.before", editor);
    openedEditors.add(editor);
    editor.getScrollingModel().addVisibleAreaListener(this);

    logger.info("editorCreated: createdCount=" + editorCreatedCount.incrementAndGet()
        + " listening for editor=" + shortObjectString(editor)
        + " openedEditors=" + listShortObjects(openedEditors));
    reflectivelyCheckCurrentListeners("editorCreated.after", editor);
  } else {
    logger.warn("editorCreated: createdCount=" + editorCreatedCount.incrementAndGet()
        + " (should not happen) already contains editor=" + shortObjectString(editor));
  }
}
 
开发者ID:jawspeak,项目名称:intellij-joined-tab-scrolling,代码行数:18,代码来源:JoinedScroller.java

示例7: editorReleased

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
@Override
public void editorReleased(@NotNull EditorFactoryEvent event) {
  Editor editor = event.getEditor();
  if (openedEditors.contains(editor)) {
    logger.info("editorReleased: releasedCount=" + editorReleasedCount.incrementAndGet()
        + " removed listener for editor=" + shortObjectString(editor)
        + " openedEditors=" + listShortObjects(openedEditors));
    reflectivelyCheckCurrentListeners("editorReleased.before", editor);

    editor.getScrollingModel().removeVisibleAreaListener(this);
    openedEditors.remove(editor);
    reflectivelyCheckCurrentListeners("editorReleased.after", editor);
  } else {
    logger.warn("editorReleased: releasedCount=" + editorReleasedCount.incrementAndGet()
        + " (should not happen) released editor we were not tracking editor="
        + shortObjectString(editor));
  }
}
 
开发者ID:jawspeak,项目名称:intellij-joined-tab-scrolling,代码行数:19,代码来源:JoinedScroller.java

示例8: editorReleased

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
@Override
public void editorReleased(@NotNull EditorFactoryEvent event) {
    Editor editor = event.getEditor();
    final Document doc = editor.getDocument();
    if (editor.getProject() != null && editor.getProject() != project) {
        return;
    }
    STGroupFileEditorListener listener = editor.getUserData(EDITOR_DOCUMENT_LISTENER_KEY);
    if (listener != null) {
        doc.removeDocumentListener(listener);
        doc.putUserData(EDITOR_DOCUMENT_LISTENER_KEY, null);
    }
    DocumentListener listener2 = editor.getUserData(EDITOR_STRUCTVIEW_LISTENER_KEY);
    if (listener2 != null) {
        doc.removeDocumentListener(listener2);
        doc.putUserData(EDITOR_STRUCTVIEW_LISTENER_KEY, null);
    }
}
 
开发者ID:antlr,项目名称:jetbrains-plugin-st4,代码行数:19,代码来源:STGroupPluginController.java

示例9: editorCreated

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
public void editorCreated(@NotNull EditorFactoryEvent event) {
  // note that in case of lazy loading of configurables, this event can happen
  // outside of EDT, so the EDT check mustn't be done here
  Editor editor = event.getEditor();
  if (editor.getProject() != null && editor.getProject() != myProject) return;
  final Document document = editor.getDocument();
  final VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document);

  new AbstractCalledLater(myProject, ModalityState.NON_MODAL) {
    @Override
    public void run() {
      if (shouldBeInstalled(virtualFile)) {
        installTracker(virtualFile, document);
      }
    }
  }.callMe();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:LineStatusTrackerManager.java

示例10: projectOpened

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
@Override
public void projectOpened() {
  final EditorFactoryListener myEditorFactoryListener = new EditorFactoryAdapter() {
    @Override
    public void editorReleased(@NotNull EditorFactoryEvent event) {
      Editor editor = event.getEditor();
      if (editor.getProject() != null && editor.getProject() != myProject) return;
      if (myProject.isDisposed() || !myProject.isOpen()) return;
      TemplateState tState = getTemplateState(editor);
      if (tState != null) {
        tState.gotoEnd();
      }
      editor.putUserData(TEMPLATE_STATE_KEY, null);
    }
  };
  EditorFactory.getInstance().addEditorFactoryListener(myEditorFactoryListener, myProject);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:TemplateManagerImpl.java

示例11: editorReleased

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
public void editorReleased(@Nonnull EditorFactoryEvent event) {
  final Editor editor = event.getEditor();
  if (editor.getProject() != myProject) return;
  try {
    final SrcFileAnnotator fileAnnotator;
    synchronized (ANNOTATORS_LOCK) {
      fileAnnotator = myAnnotators.remove(editor);
    }
    if (fileAnnotator != null) {
      Disposer.dispose(fileAnnotator);
    }
  }
  finally {
    final Runnable request = myCurrentEditors.remove(editor);
    if (request != null) {
      myAlarm.cancelRequest(request);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:CoverageDataManagerImpl.java

示例12: EncodingManagerImpl

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
public EncodingManagerImpl(@Nonnull EditorFactory editorFactory) {
  editorFactory.getEventMulticaster().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      Document document = e.getDocument();
      if (isEditorOpenedFor(document)) {
        queueUpdateEncodingFromContent(document);
      }
    }
  }, this);
  editorFactory.addEditorFactoryListener(new EditorFactoryAdapter() {
    @Override
    public void editorCreated(@Nonnull EditorFactoryEvent event) {
      queueUpdateEncodingFromContent(event.getEditor().getDocument());
    }
  }, this);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:EncodingManagerImpl.java

示例13: disposeWithEditor

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
public static void disposeWithEditor(@Nonnull Editor editor, @Nonnull Disposable disposable) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (Disposer.isDisposed(disposable)) return;
  if (editor.isDisposed()) {
    Disposer.dispose(disposable);
    return;
  }
  // for injected editors disposal will happen only when host editor is disposed,
  // but this seems to be the best we can do (there are no notifications on disposal of injected editor)
  Editor hostEditor = editor instanceof EditorWindow ? ((EditorWindow)editor).getDelegate() : editor;
  EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
    @Override
    public void editorReleased(@Nonnull EditorFactoryEvent event) {
      if (event.getEditor() == hostEditor) {
        Disposer.dispose(disposable);
      }
    }
  }, disposable);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:EditorUtil.java

示例14: releaseEditor

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
@Override
public void releaseEditor(@Nonnull Editor editor) {
  try {
    myEditorFactoryEventDispatcher.getMulticaster().editorReleased(new EditorFactoryEvent(this, editor));
  }
  finally {
    try {
      ((EditorImpl)editor).release();
    }
    finally {
      myEditors.remove(editor);
      if (LOG.isDebugEnabled()) {
        LOG.debug("number of Editors after release: " + myEditors.size());
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:EditorFactoryImpl.java

示例15: TemplateManagerImpl

import com.intellij.openapi.editor.event.EditorFactoryEvent; //导入依赖的package包/类
public TemplateManagerImpl(Project project) {
  myProject = project;
  final EditorFactoryListener myEditorFactoryListener = new EditorFactoryAdapter() {
    @Override
    public void editorReleased(@Nonnull EditorFactoryEvent event) {
      Editor editor = event.getEditor();
      if (editor.getProject() != null && editor.getProject() != myProject) return;
      if (myProject.isDisposed() || !myProject.isOpen()) return;
      TemplateState state = getTemplateState(editor);
      if (state != null) {
        state.gotoEnd();
      }
      clearTemplateState(editor);
    }
  };
  EditorFactory.getInstance().addEditorFactoryListener(myEditorFactoryListener, myProject);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:TemplateManagerImpl.java


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