mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
initializing editors in background
This commit is contained in:
@@ -130,7 +130,7 @@ class DaemonListeners implements Disposable {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
Editor editor = e.getEditor();
|
||||
if (!worthBothering(editor.getDocument(), editor.getProject())) {
|
||||
if (!editor.getComponent().isShowing() || !worthBothering(editor.getDocument(), editor.getProject())) {
|
||||
return; //no need to stop daemon if something happened in the console
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class DaemonListeners implements Disposable {
|
||||
Project editorProject = editor.getProject();
|
||||
// worthBothering() checks for getCachedPsiFile, so call getPsiFile here
|
||||
PsiFile file = editorProject == null ? null : PsiDocumentManager.getInstance(editorProject).getPsiFile(document);
|
||||
if (!worthBothering(document, editorProject)) {
|
||||
if (!editor.getComponent().isShowing() || !worthBothering(document, editorProject)) {
|
||||
LOG.debug("Not worth: " + file);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
@@ -23,9 +22,6 @@ import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.editor.ex.DocumentEx;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerAdapter;
|
||||
@@ -53,14 +49,6 @@ public class StatusBarUpdater implements Disposable {
|
||||
public StatusBarUpdater(Project project) {
|
||||
myProject = project;
|
||||
|
||||
CaretListener caretListener = new CaretListener() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
updateLater();
|
||||
}
|
||||
};
|
||||
EditorFactory.getInstance().getEventMulticaster().addCaretListener(caretListener, this);
|
||||
|
||||
project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
|
||||
@Override
|
||||
public void selectionChanged(FileEditorManagerEvent event) {
|
||||
|
||||
@@ -652,10 +652,14 @@ public class JBTabsImpl extends JComponent
|
||||
|
||||
@NotNull
|
||||
public TabInfo addTab(TabInfo info, int index) {
|
||||
return addTab(info, index, false);
|
||||
return addTab(info, index, false, true);
|
||||
}
|
||||
|
||||
private TabInfo addTab(TabInfo info, int index, boolean isDropTarget) {
|
||||
public TabInfo addTabSilently(TabInfo info, int index) {
|
||||
return addTab(info, index, false, false);
|
||||
}
|
||||
|
||||
private TabInfo addTab(TabInfo info, int index, boolean isDropTarget, boolean fireEvents) {
|
||||
if (!isDropTarget && getTabs().contains(info)) {
|
||||
return getTabs().get(getTabs().indexOf(info));
|
||||
}
|
||||
@@ -694,7 +698,7 @@ public class JBTabsImpl extends JComponent
|
||||
updateHiding();
|
||||
}
|
||||
|
||||
if (!isDropTarget) {
|
||||
if (!isDropTarget && fireEvents) {
|
||||
if (getTabCount() == 1) {
|
||||
fireBeforeSelectionChanged(null, info);
|
||||
fireSelectionChanged(null, info);
|
||||
@@ -3247,7 +3251,7 @@ public class JBTabsImpl extends JComponent
|
||||
|
||||
int index = myLayout.getDropIndexFor(point.getPoint(this));
|
||||
setDropInfoIndex(index);
|
||||
addTab(myDropInfo, index, true);
|
||||
addTab(myDropInfo, index, true, true);
|
||||
|
||||
TabLabel label = myInfo2Label.get(myDropInfo);
|
||||
Dimension size = label.getPreferredSize();
|
||||
|
||||
@@ -57,7 +57,6 @@ public class MarkupModelImpl extends UserDataHolderBase implements MarkupModelEx
|
||||
private final RangeHighlighterTree myHighlighterTree;
|
||||
|
||||
MarkupModelImpl(@NotNull DocumentImpl document) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
myDocument = document;
|
||||
myHighlighterTree = new RangeHighlighterTree(myDocument, this);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,9 @@ public class SelectionModelImpl implements SelectionModel, PrioritizedDocumentLi
|
||||
return result == null ? defaultPosition : result;
|
||||
}
|
||||
|
||||
private static void validateContext(boolean isWrite) {
|
||||
private void validateContext(boolean isWrite) {
|
||||
|
||||
if (!myEditor.getComponent().isShowing()) return;
|
||||
if (isWrite) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
}
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ import java.util.Map;
|
||||
final class EditorTabbedContainer implements Disposable, CloseAction.CloseTarget {
|
||||
private final EditorWindow myWindow;
|
||||
private final Project myProject;
|
||||
private final JBTabs myTabs;
|
||||
private final JBEditorTabs myTabs;
|
||||
|
||||
@NonNls public static final String HELP_ID = "ideaInterface.editor";
|
||||
|
||||
@@ -306,7 +306,7 @@ final class EditorTabbedContainer implements Disposable, CloseAction.CloseTarget
|
||||
tabActions.add(new CloseTab(comp, tab));
|
||||
|
||||
tab.setTabLabelActions(tabActions, ActionPlaces.EDITOR_TAB);
|
||||
myTabs.addTab(tab, indexToInsert);
|
||||
myTabs.addTabSilently(tab, indexToInsert);
|
||||
}
|
||||
|
||||
public boolean isEmptyVisible() {
|
||||
|
||||
@@ -588,7 +588,11 @@ public class EditorWindow {
|
||||
if (editor != null) {
|
||||
final int index = findFileIndex(editor.getFile());
|
||||
if (index != -1) {
|
||||
myTabbedPane.setSelectedIndex(index, focusEditor);
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
public void run() {
|
||||
myTabbedPane.setSelectedIndex(index, focusEditor);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -995,13 +999,15 @@ public class EditorWindow {
|
||||
}
|
||||
|
||||
public void setFilePinned(final VirtualFile file, final boolean pinned) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
final EditorComposite editorComposite = findFileComposite(file);
|
||||
if (editorComposite == null) {
|
||||
throw new IllegalArgumentException("file is not open: " + file.getPath());
|
||||
}
|
||||
boolean wasPinned = editorComposite.isPinned();
|
||||
editorComposite.setPinned(pinned);
|
||||
updateFileIcon(file);
|
||||
if (wasPinned != pinned && ApplicationManager.getApplication().isDispatchThread()) {
|
||||
updateFileIcon(file);
|
||||
}
|
||||
}
|
||||
|
||||
void trimToSize(final int limit, @Nullable final VirtualFile fileToIgnore, final boolean transferFocus) {
|
||||
|
||||
+70
-70
@@ -28,10 +28,7 @@ import com.intellij.openapi.keymap.KeymapManager;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.*;
|
||||
@@ -68,6 +65,8 @@ public class EditorsSplitters extends JPanel {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.fileEditor.impl.EditorsSplitters");
|
||||
|
||||
private EditorWindow myCurrentWindow;
|
||||
final Set<EditorWindow> myWindows = new ArrayListSet<EditorWindow>();
|
||||
|
||||
private final FileEditorManagerImpl myManager;
|
||||
private Element mySplittersElement; // temporarily used during initialization
|
||||
int myInsideChange = 0;
|
||||
@@ -265,7 +264,8 @@ public class EditorsSplitters extends JPanel {
|
||||
|
||||
public void openFiles() {
|
||||
if (mySplittersElement != null) {
|
||||
final JPanel comp = readExternalPanel(mySplittersElement, getTopPanel());
|
||||
Ref<EditorWindow> currentWindow = new Ref<EditorWindow>();
|
||||
final JPanel comp = readExternalPanel(mySplittersElement, getTopPanel(), currentWindow);
|
||||
if (comp != null) {
|
||||
removeAll();
|
||||
add(comp, BorderLayout.CENTER);
|
||||
@@ -279,6 +279,9 @@ public class EditorsSplitters extends JPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!currentWindow.isNull()) {
|
||||
setCurrentWindow(currentWindow.get(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,77 +291,76 @@ public class EditorsSplitters extends JPanel {
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public JPanel readExternalPanel(final Element element, @Nullable JPanel panel) {
|
||||
private JPanel readExternalPanel(final Element element, @Nullable JPanel panel, Ref<EditorWindow> currentWindow) {
|
||||
final Element splitterElement = element.getChild("splitter");
|
||||
if (splitterElement != null) {
|
||||
LOG.info("splitter");
|
||||
final boolean orientation = "vertical".equals(splitterElement.getAttributeValue("split-orientation"));
|
||||
final float proportion = Float.valueOf(splitterElement.getAttributeValue("split-proportion")).floatValue();
|
||||
final Element first = splitterElement.getChild("split-first");
|
||||
final Element second = splitterElement.getChild("split-second");
|
||||
|
||||
Splitter splitter;
|
||||
if (panel == null) {
|
||||
panel = new JPanel(new BorderLayout());
|
||||
panel.setOpaque(false);
|
||||
splitter = new Splitter(orientation, proportion, 0.1f, 0.9f);
|
||||
panel.add(splitter, BorderLayout.CENTER);
|
||||
splitter.setFirstComponent(readExternalPanel(first, null));
|
||||
splitter.setSecondComponent(readExternalPanel(second, null));
|
||||
} else if (panel.getComponent(0) instanceof Splitter) {
|
||||
splitter = (Splitter)panel.getComponent(0);
|
||||
readExternalPanel(first, (JPanel)splitter.getFirstComponent());
|
||||
readExternalPanel(second, (JPanel)splitter.getSecondComponent());
|
||||
} else {
|
||||
readExternalPanel(first, panel);
|
||||
readExternalPanel(second, panel);
|
||||
}
|
||||
return panel;
|
||||
return readSplitter(panel, splitterElement, currentWindow);
|
||||
}
|
||||
|
||||
final Element leaf = element.getChild("leaf");
|
||||
if (leaf != null) {
|
||||
EditorWindow window;
|
||||
if (panel == null) {
|
||||
window = new EditorWindow(this);
|
||||
} else {
|
||||
window = findWindowWith(panel);
|
||||
LOG.assertTrue(window != null);
|
||||
}
|
||||
@SuppressWarnings("unchecked") final List<Element> children = Lists.newArrayList(leaf.getChildren("file"));
|
||||
VirtualFile currentFile = null;
|
||||
|
||||
if (UISettings.getInstance().ACTIVATE_RIGHT_EDITOR_ON_CLOSE) {
|
||||
Collections.reverse(children);
|
||||
}
|
||||
|
||||
for (final Element file : children) {
|
||||
try {
|
||||
final HistoryEntry entry = new HistoryEntry(getManager().getProject(), file.getChild(HistoryEntry.TAG), true);
|
||||
boolean isCurrent = Boolean.valueOf(file.getAttributeValue("current")).booleanValue();
|
||||
getManager().openFileImpl3(window, entry.myFile, false, entry, isCurrent);
|
||||
if (getManager().isFileOpen(entry.myFile)) {
|
||||
window.setFilePinned(entry.myFile, Boolean.valueOf(file.getAttributeValue("pinned")).booleanValue());
|
||||
if (Boolean.valueOf(file.getAttributeValue("current-in-tab")).booleanValue()) {
|
||||
currentFile = entry.myFile;
|
||||
}
|
||||
if (isCurrent) {
|
||||
setCurrentWindow(window, true);
|
||||
}
|
||||
if (leaf == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EditorWindow window = (panel == null) ? new EditorWindow(this) : findWindowWith(panel);
|
||||
LOG.assertTrue(window != null);
|
||||
|
||||
@SuppressWarnings("unchecked") final List<Element> children = Lists.newArrayList(leaf.getChildren("file"));
|
||||
if (UISettings.getInstance().ACTIVATE_RIGHT_EDITOR_ON_CLOSE) {
|
||||
Collections.reverse(children);
|
||||
}
|
||||
|
||||
VirtualFile currentFile = null;
|
||||
for (final Element file : children) {
|
||||
try {
|
||||
final HistoryEntry entry = new HistoryEntry(getManager().getProject(), file.getChild(HistoryEntry.TAG), true);
|
||||
boolean isCurrent = Boolean.valueOf(file.getAttributeValue("current")).booleanValue();
|
||||
getManager().openFileImpl3(window, entry.myFile, false, entry, isCurrent);
|
||||
if (getManager().isFileOpen(entry.myFile)) {
|
||||
window.setFilePinned(entry.myFile, Boolean.valueOf(file.getAttributeValue("pinned")).booleanValue());
|
||||
if (Boolean.valueOf(file.getAttributeValue("current-in-tab")).booleanValue()) {
|
||||
currentFile = entry.myFile;
|
||||
}
|
||||
}
|
||||
catch (InvalidDataException e) {
|
||||
// OK
|
||||
}
|
||||
}
|
||||
if (currentFile != null) {
|
||||
final EditorComposite editor = window.findFileComposite(currentFile);
|
||||
if (editor != null) {
|
||||
window.setSelectedEditor(editor, true);
|
||||
}
|
||||
catch (InvalidDataException e) {
|
||||
// OK
|
||||
}
|
||||
return window.myPanel;
|
||||
}
|
||||
return null;
|
||||
if (currentFile != null) {
|
||||
final EditorComposite editor = window.findFileComposite(currentFile);
|
||||
if (editor != null) {
|
||||
window.setSelectedEditor(editor, true);
|
||||
}
|
||||
}
|
||||
return window.myPanel;
|
||||
}
|
||||
|
||||
private JPanel readSplitter(JPanel panel, Element splitterElement, Ref<EditorWindow> currentWindow) {
|
||||
final boolean orientation = "vertical".equals(splitterElement.getAttributeValue("split-orientation"));
|
||||
final float proportion = Float.valueOf(splitterElement.getAttributeValue("split-proportion")).floatValue();
|
||||
final Element first = splitterElement.getChild("split-first");
|
||||
final Element second = splitterElement.getChild("split-second");
|
||||
|
||||
Splitter splitter;
|
||||
if (panel == null) {
|
||||
panel = new JPanel(new BorderLayout());
|
||||
panel.setOpaque(false);
|
||||
splitter = new Splitter(orientation, proportion, 0.1f, 0.9f);
|
||||
panel.add(splitter, BorderLayout.CENTER);
|
||||
splitter.setFirstComponent(readExternalPanel(first, null, currentWindow));
|
||||
splitter.setSecondComponent(readExternalPanel(second, null, currentWindow));
|
||||
}
|
||||
else if (panel.getComponent(0) instanceof Splitter) {
|
||||
splitter = (Splitter)panel.getComponent(0);
|
||||
readExternalPanel(first, (JPanel)splitter.getFirstComponent(), currentWindow);
|
||||
readExternalPanel(second, (JPanel)splitter.getSecondComponent(), currentWindow);
|
||||
}
|
||||
else {
|
||||
readExternalPanel(first, panel, currentWindow);
|
||||
readExternalPanel(second, panel, currentWindow);
|
||||
}
|
||||
return panel;
|
||||
}
|
||||
|
||||
@NotNull public VirtualFile[] getOpenFiles() {
|
||||
@@ -673,7 +675,7 @@ public class EditorsSplitters extends JPanel {
|
||||
getManager().updateFileName(window == null ? null : window.getSelectedFile());
|
||||
|
||||
if (window != null) {
|
||||
final EditorWithProviderComposite selectedEditor = myCurrentWindow.getSelectedEditor();
|
||||
final EditorWithProviderComposite selectedEditor = window.getSelectedEditor();
|
||||
if (selectedEditor != null) {
|
||||
fireRunnable.run();
|
||||
}
|
||||
@@ -700,8 +702,6 @@ public class EditorsSplitters extends JPanel {
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
||||
final Set<EditorWindow> myWindows = new ArrayListSet<EditorWindow>();
|
||||
|
||||
@NotNull
|
||||
public List<EditorWithProviderComposite> findEditorComposites(final VirtualFile file) {
|
||||
final ArrayList<EditorWithProviderComposite> res = new ArrayList<EditorWithProviderComposite>();
|
||||
|
||||
+6
-6
@@ -137,7 +137,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
|
||||
myQueue.setTrackUiActivity(true);
|
||||
}
|
||||
|
||||
private void initDockableContentFactory() {
|
||||
void initDockableContentFactory() {
|
||||
if (myContentFactory != null) return;
|
||||
|
||||
myContentFactory = new DockableEditorContainerFactory(myProject, this, myDockManager);
|
||||
@@ -770,7 +770,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
|
||||
}
|
||||
if (state == null && !open) {
|
||||
// We have to try to get state from the history only in case
|
||||
// if editor is not opened. Otherwise history enty might have a state
|
||||
// if editor is not opened. Otherwise history entry might have a state
|
||||
// out of sync with the current editor state.
|
||||
state = editorHistoryManager.getState(file, provider);
|
||||
}
|
||||
@@ -1032,7 +1032,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
|
||||
|
||||
|
||||
public boolean isFileOpen(@NotNull final VirtualFile file) {
|
||||
return getEditors(file).length != 0;
|
||||
return !getEditorComposites(file).isEmpty();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -1253,13 +1253,13 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
|
||||
|
||||
StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() {
|
||||
public void run() {
|
||||
|
||||
setTabsMode(UISettings.getInstance().EDITOR_TAB_PLACEMENT != UISettings.TABS_NONE);
|
||||
|
||||
ToolWindowManager.getInstance(myProject).invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
|
||||
public void run() {
|
||||
setTabsMode(UISettings.getInstance().EDITOR_TAB_PLACEMENT != UISettings.TABS_NONE);
|
||||
getMainSplitters().openFiles();
|
||||
initDockableContentFactory();
|
||||
|
||||
LaterInvocator.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.fileEditor.impl;
|
||||
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupActivity;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
* Date: 4/11/12
|
||||
*/
|
||||
public class OpenFilesActivity implements StartupActivity, DumbAware {
|
||||
|
||||
@Override
|
||||
public void runActivity(Project project) {
|
||||
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
|
||||
if (fileEditorManager instanceof FileEditorManagerImpl) {
|
||||
Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
FileEditorManagerImpl manager = (FileEditorManagerImpl)fileEditorManager;
|
||||
manager.getMainSplitters().openFiles();
|
||||
manager.initDockableContentFactory();
|
||||
}
|
||||
};
|
||||
if (Registry.is("ide.open.editors.asynchronously")) {
|
||||
runnable.run();
|
||||
}
|
||||
else {
|
||||
UIUtil.invokeLaterIfNeeded(runnable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-32
@@ -70,8 +70,6 @@ class TextEditorComponent extends JPanel implements DataProvider{
|
||||
private final Document myDocument;
|
||||
|
||||
private final MyEditorMouseListener myEditorMouseListener;
|
||||
private final MyEditorCaretListener myEditorCaretListener;
|
||||
private final MyEditorSelectionListener myEditorSelectionListener;
|
||||
private final MyDocumentListener myDocumentListener;
|
||||
private final MyEditorPropertyChangeListener myEditorPropertyChangeListener;
|
||||
private final MyVirtualFileListener myVirtualFileListener;
|
||||
@@ -90,8 +88,6 @@ class TextEditorComponent extends JPanel implements DataProvider{
|
||||
TextEditorComponent(@NotNull final Project project, @NotNull final VirtualFile file, @NotNull final TextEditorImpl textEditor) {
|
||||
super(new BorderLayout (), true);
|
||||
|
||||
assertThread();
|
||||
|
||||
myProject = project;
|
||||
myFile = file;
|
||||
myTextEditor = textEditor;
|
||||
@@ -102,8 +98,6 @@ class TextEditorComponent extends JPanel implements DataProvider{
|
||||
myDocument.addDocumentListener(myDocumentListener);
|
||||
|
||||
myEditorMouseListener = new MyEditorMouseListener();
|
||||
myEditorCaretListener = new MyEditorCaretListener();
|
||||
myEditorSelectionListener = new MyEditorSelectionListener();
|
||||
myEditorPropertyChangeListener = new MyEditorPropertyChangeListener();
|
||||
|
||||
myConnection = project.getMessageBus().connect();
|
||||
@@ -177,8 +171,6 @@ class TextEditorComponent extends JPanel implements DataProvider{
|
||||
((EditorEx) editor).setFile(myFile);
|
||||
|
||||
editor.addEditorMouseListener(myEditorMouseListener);
|
||||
editor.getCaretModel().addCaretListener(myEditorCaretListener);
|
||||
editor.getSelectionModel().addSelectionListener(myEditorSelectionListener);
|
||||
((EditorEx)editor).addPropertyChangeListener(myEditorPropertyChangeListener);
|
||||
|
||||
((EditorImpl) editor).setDropHandler(new FileDropHandler(editor));
|
||||
@@ -194,8 +186,6 @@ class TextEditorComponent extends JPanel implements DataProvider{
|
||||
private void disposeEditor(final Editor editor){
|
||||
EditorFactory.getInstance().releaseEditor(editor);
|
||||
editor.removeEditorMouseListener(myEditorMouseListener);
|
||||
editor.getCaretModel().removeCaretListener(myEditorCaretListener);
|
||||
editor.getSelectionModel().removeSelectionListener(myEditorSelectionListener);
|
||||
((EditorEx)editor).removePropertyChangeListener(myEditorPropertyChangeListener);
|
||||
}
|
||||
|
||||
@@ -311,27 +301,6 @@ class TextEditorComponent extends JPanel implements DataProvider{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getts events about caret movements and modifies status bar
|
||||
*/
|
||||
private final class MyEditorCaretListener implements CaretListener {
|
||||
public void caretPositionChanged(final CaretEvent e) {
|
||||
assertThread();
|
||||
if (e.getEditor() == getEditor()) {
|
||||
updateStatusBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class MyEditorSelectionListener implements SelectionListener {
|
||||
public void selectionChanged(SelectionEvent e) {
|
||||
assertThread();
|
||||
if (e.getEditor() == getEditor()) {
|
||||
updateStatusBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates "modified" property
|
||||
@@ -357,7 +326,7 @@ class TextEditorComponent extends JPanel implements DataProvider{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets event obout insert/overwrite modes
|
||||
* Gets event about insert/overwrite modes
|
||||
*/
|
||||
private final class MyEditorPropertyChangeListener implements PropertyChangeListener {
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
|
||||
@@ -199,12 +199,10 @@ public final class ToolWindowImpl implements ToolWindowEx {
|
||||
}
|
||||
|
||||
public final boolean isVisible() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
return myToolWindowManager.isToolWindowVisible(myId);
|
||||
}
|
||||
|
||||
public final ToolWindowAnchor getAnchor() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
return myToolWindowManager.getToolWindowAnchor(myId);
|
||||
}
|
||||
|
||||
@@ -257,7 +255,6 @@ public final class ToolWindowImpl implements ToolWindowEx {
|
||||
}
|
||||
|
||||
public final ToolWindowType getType() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
return myToolWindowManager.getToolWindowType(myId);
|
||||
}
|
||||
|
||||
@@ -316,7 +313,6 @@ public final class ToolWindowImpl implements ToolWindowEx {
|
||||
* passed content manager.
|
||||
*/
|
||||
public final boolean isAvailable() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
return myAvailable && myComponent != null;
|
||||
}
|
||||
|
||||
|
||||
@@ -776,7 +776,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
}
|
||||
|
||||
public String[] getToolWindowIds() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
final WindowInfoImpl[] infos = myLayout.getInfos();
|
||||
final String[] ids = ArrayUtil.newStringArray(infos.length);
|
||||
for (int i = 0; i < infos.length; i++) {
|
||||
@@ -845,7 +844,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
}
|
||||
|
||||
public ToolWindow getToolWindow(final String id) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
if (!myLayout.isToolWindowRegistered(id)) {
|
||||
return null;
|
||||
}
|
||||
@@ -1586,7 +1584,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
}
|
||||
|
||||
boolean isToolWindowVisible(final String id) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
checkId(id);
|
||||
return getInfo(id).isVisible();
|
||||
}
|
||||
|
||||
+3
-2
@@ -62,9 +62,10 @@ public abstract class EditorBasedWidget extends FileEditorManagerAdapter impleme
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
protected boolean isOurEditor(Editor editor) {
|
||||
return editor != null && getEditor() == editor;
|
||||
return editor != null &&
|
||||
editor.getComponent().isShowing() &&
|
||||
WindowManager.getInstance().getStatusBar(editor.getComponent()) == myStatusBar;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.LogicalPosition;
|
||||
import com.intellij.openapi.editor.SelectionModel;
|
||||
import com.intellij.openapi.editor.event.*;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerEvent;
|
||||
import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -118,22 +117,11 @@ public class PositionPanel extends EditorBasedWidget implements StatusBarWidget.
|
||||
|
||||
@Override
|
||||
public void selectionChanged(final SelectionEvent e) {
|
||||
final Editor editor = e.getEditor();
|
||||
Project project = editor.getProject();
|
||||
if (project != null && !project.isDisposed() && FileEditorManager.getInstance(project).getSelectedTextEditor() == e.getEditor()) {
|
||||
updatePosition(editor);
|
||||
}
|
||||
updatePosition(e.getEditor());
|
||||
}
|
||||
|
||||
public void caretPositionChanged(final CaretEvent e) {
|
||||
final Editor editor = e.getEditor();
|
||||
Project project = editor.getProject();
|
||||
if (project != null && !project.isDisposed()) {
|
||||
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); // returns null for default project
|
||||
if (fileEditorManager != null && fileEditorManager.getSelectedTextEditor() == e.getEditor()) {
|
||||
updatePosition(editor);
|
||||
}
|
||||
}
|
||||
updatePosition(e.getEditor());
|
||||
}
|
||||
|
||||
private void updatePosition(final Editor editor) {
|
||||
|
||||
@@ -214,4 +214,7 @@ ide.use.nautilus3=true
|
||||
ide.use.nautilus3.description=Use Nautilus if available
|
||||
|
||||
ide.goto.implementation.show.interfaces=false
|
||||
ide.goto.implementation.show.interfaces.description=Whether to show sub-interfaces when invoking Goto Implementation (Ctrl+Alt+B) on an interface
|
||||
ide.goto.implementation.show.interfaces.description=Whether to show sub-interfaces when invoking Goto Implementation (Ctrl+Alt+B) on an interface
|
||||
|
||||
ide.open.editors.asynchronously=false
|
||||
ide.open.editors.asynchronously.description=Prepare editors in background thread
|
||||
@@ -258,6 +258,8 @@
|
||||
|
||||
<postStartupActivity implementation="com.intellij.ide.TipOfTheDayManager"/>
|
||||
<postStartupActivity implementation="com.intellij.openapi.actionSystem.impl.ActionPreloader"/>
|
||||
<postStartupActivity implementation="com.intellij.openapi.fileEditor.impl.OpenFilesActivity"/>
|
||||
|
||||
<patch.extension implementation="com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP"/>
|
||||
<patch.extension implementation="com.intellij.openapi.diff.impl.patch.CharsetEP"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user