本文整理汇总了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));
}
}
示例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());
}
}
}
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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));
}
}
示例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));
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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());
}
}
}
}
示例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);
}