use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class LineStatusTracker method installNotification.
@Override
@CalledInAwt
protected void installNotification(@NotNull String text) {
final FileEditor[] editors = myFileEditorManager.getAllEditors(myVirtualFile);
for (FileEditor editor : editors) {
JPanel panel = editor.getUserData(PANEL_KEY);
if (panel == null) {
final JPanel newPanel = new EditorNotificationPanel().text(text);
editor.putUserData(PANEL_KEY, newPanel);
myFileEditorManager.addTopComponent(editor, newPanel);
}
}
}
use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class LineStatusTracker method destroyNotification.
@Override
@CalledInAwt
protected void destroyNotification() {
final FileEditor[] editors = myFileEditorManager.getEditors(myVirtualFile);
for (FileEditor editor : editors) {
final JPanel panel = editor.getUserData(PANEL_KEY);
if (panel != null) {
myFileEditorManager.removeTopComponent(editor, panel);
editor.putUserData(PANEL_KEY, null);
}
}
}
use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class XVariablesViewBase method registerInlineEvaluator.
private void registerInlineEvaluator(final XStackFrame stackFrame, final XSourcePosition position, final Project project) {
final VirtualFile file = position.getFile();
final FileEditor fileEditor = FileEditorManagerEx.getInstanceEx(project).getSelectedEditor(file);
if (fileEditor instanceof PsiAwareTextEditorImpl) {
final Editor editor = ((PsiAwareTextEditorImpl) fileEditor).getEditor();
removeSelectionListener();
mySelectionListener = new MySelectionListener(editor, stackFrame, project);
editor.getSelectionModel().addSelectionListener(mySelectionListener);
}
}
use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class StructureViewUpdatingTest method testExpandElementWithExitingName.
public void testExpandElementWithExitingName() throws InterruptedException {
final VirtualFile xmlVirtualFile = getContentRoot().findFileByRelativePath("test.xml");
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
FileEditor[] fileEditors = fileEditorManager.openFile(xmlVirtualFile, false);
final FileEditor fileEditor = fileEditors[0];
try {
final StructureViewComponent structureViewComponent = (StructureViewComponent) fileEditor.getStructureViewBuilder().createStructureView(fileEditor, myProject);
final JTree tree = structureViewComponent.getTree();
PlatformTestUtil.assertTreeEqual(tree, "-test.xml\n" + " -test\n" + " +level1\n" + " +level1\n" + " +level1\n" + " +level1\n");
tree.expandPath(tree.getPathForRow(3));
PlatformTestUtil.waitForAlarm(600);
PlatformTestUtil.assertTreeEqual(tree, "-test.xml\n" + " -test\n" + " +level1\n" + " -level1\n" + " +level2\n" + " +level1\n" + " +level1\n");
Disposer.dispose(structureViewComponent);
} finally {
fileEditorManager.closeFile(xmlVirtualFile);
}
}
use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class StructureViewUpdatingTest method testShowClassMembers.
public void testShowClassMembers() throws Exception {
final PsiClass psiClass = JavaDirectoryService.getInstance().getClasses(getPackageDirectory("com/package1"))[0];
final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
FileEditor[] fileEditors = fileEditorManager.openFile(virtualFile, false);
final FileEditor fileEditor = fileEditors[0];
final StructureViewComponent structureViewComponent = (StructureViewComponent) fileEditor.getStructureViewBuilder().createStructureView(fileEditor, myProject);
try {
PlatformTestUtil.assertTreeEqual(structureViewComponent.getTree(), "-Class2.java\n" + " -Class2\n" + " +InnerClass1\n" + " +InnerClass2\n" + " getValue(): int\n" + " myField1: boolean\n" + " myField2: boolean\n" + " myField3: boolean\n" + " myField4: boolean\n");
final PsiField innerClassField = psiClass.getInnerClasses()[0].getFields()[0];
structureViewComponent.select(innerClassField, true);
PlatformTestUtil.assertTreeEqual(structureViewComponent.getTree(), "-Class2.java\n" + " -Class2\n" + " -InnerClass1\n" + " +InnerClass12\n" + " myInnerClassField: int\n" + " +InnerClass2\n" + " getValue(): int\n" + " myField1: boolean\n" + " myField2: boolean\n" + " myField3: boolean\n" + " myField4: boolean\n");
CommandProcessor.getInstance().executeCommand(myProject, () -> WriteCommandAction.runWriteCommandAction(null, () -> {
try {
innerClassField.delete();
} catch (IncorrectOperationException e) {
fail(e.getLocalizedMessage());
}
}), null, null);
PlatformTestUtil.waitForAlarm(600);
PlatformTestUtil.assertTreeEqual(structureViewComponent.getTree(), "-Class2.java\n" + " -Class2\n" + " -InnerClass1\n" + " +InnerClass12\n" + " +InnerClass2\n" + " getValue(): int\n" + " myField1: boolean\n" + " myField2: boolean\n" + " myField3: boolean\n" + " myField4: boolean\n");
} finally {
Disposer.dispose(structureViewComponent);
fileEditorManager.closeFile(virtualFile);
}
}
Aggregations