mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+4
-3
@@ -106,11 +106,12 @@ public class TextEditorHighlightingPassRegistrarImpl extends TextEditorHighlight
|
||||
}
|
||||
}
|
||||
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
|
||||
PsiFile fileFromDoc = documentManager.getPsiFile(editor.getDocument());
|
||||
final Document document = editor.getDocument();
|
||||
PsiFile fileFromDoc = documentManager.getPsiFile(document);
|
||||
if (!(fileFromDoc instanceof PsiCompiledElement)) {
|
||||
assert fileFromDoc == psiFile : "Files are different: " + psiFile + ";" + fileFromDoc;
|
||||
Document documentFromFile = documentManager.getDocument(psiFile);
|
||||
assert documentFromFile == editor.getDocument() : "Documents are different: " + editor.getDocument() + ";" + documentFromFile;
|
||||
assert documentFromFile == document : "Documents are different: " + document + ";" + documentFromFile;
|
||||
}
|
||||
final TIntObjectHashMap<TextEditorHighlightingPass> id2Pass = new TIntObjectHashMap<TextEditorHighlightingPass>();
|
||||
final TIntArrayList passesRefusedToCreate = new TIntArrayList();
|
||||
@@ -147,7 +148,7 @@ public class TextEditorHighlightingPassRegistrarImpl extends TextEditorHighlight
|
||||
final FileStatusMap statusMap = ((DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(myProject)).getFileStatusMap();
|
||||
passesRefusedToCreate.forEach(new TIntProcedure() {
|
||||
public boolean execute(int passId) {
|
||||
statusMap.markFileUpToDate(editor.getDocument(), psiFile, passId);
|
||||
statusMap.markFileUpToDate(document, psiFile, passId);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public abstract class VisibleHighlightingPassFactory extends AbstractProjectComp
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static TextRange calculateVisibleRange(Editor editor) {
|
||||
public static TextRange calculateVisibleRange(@NotNull Editor editor) {
|
||||
Rectangle rect = editor.getScrollingModel().getVisibleArea();
|
||||
LogicalPosition startPosition = editor.xyToLogicalPosition(new Point(rect.x, rect.y));
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ public class EditorWindow {
|
||||
}
|
||||
disposeTabs();
|
||||
if (currentFile != null) {
|
||||
getManager().openFileImpl2(this, currentFile, focusEditor && myOwner.getCurrentWindow() == this, null);
|
||||
getManager().openFileImpl2(this, currentFile, focusEditor && myOwner.getCurrentWindow() == this);
|
||||
}
|
||||
else {
|
||||
myPanel.repaint();
|
||||
|
||||
+8
-9
@@ -41,7 +41,6 @@ import com.intellij.openapi.fileEditor.impl.text.TextEditorImpl;
|
||||
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
|
||||
import com.intellij.openapi.fileTypes.FileTypeEvent;
|
||||
import com.intellij.openapi.fileTypes.FileTypeListener;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.DumbAwareRunnable;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -71,7 +70,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
@@ -464,18 +462,19 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
|
||||
throw new IllegalArgumentException("file is not valid: " + file);
|
||||
}
|
||||
assertDispatchThread();
|
||||
return openFileImpl2(getSplitters().getOrCreateCurrentWindow(file), file, focusEditor, null);
|
||||
return openFileImpl2(getSplitters().getOrCreateCurrentWindow(file), file, focusEditor);
|
||||
}
|
||||
|
||||
@NotNull Pair<FileEditor[], FileEditorProvider[]> openFileImpl2(final EditorWindow window, final VirtualFile file, final boolean focusEditor,
|
||||
final HistoryEntry entry) {
|
||||
final Ref<Pair<FileEditor[], FileEditorProvider[]>> resHolder = new Ref<Pair<FileEditor[], FileEditorProvider[]>>();
|
||||
@NotNull Pair<FileEditor[], FileEditorProvider[]> openFileImpl2(@NotNull final EditorWindow window,
|
||||
@NotNull final VirtualFile file,
|
||||
final boolean focusEditor) {
|
||||
final Ref<Pair<FileEditor[], FileEditorProvider[]>> result = new Ref<Pair<FileEditor[], FileEditorProvider[]>>();
|
||||
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
|
||||
public void run() {
|
||||
resHolder.set(openFileImpl3(window, file, focusEditor, entry, true));
|
||||
result.set(openFileImpl3(window, file, focusEditor, null, true));
|
||||
}
|
||||
}, "", null);
|
||||
return resHolder.get();
|
||||
return result.get();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -487,7 +486,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
|
||||
* @param entry map between FileEditorProvider and FileEditorState. If this parameter
|
||||
* @param current
|
||||
*/
|
||||
@NotNull Pair<FileEditor[], FileEditorProvider[]> openFileImpl3(final EditorWindow window,
|
||||
@NotNull Pair<FileEditor[], FileEditorProvider[]> openFileImpl3(@NotNull final EditorWindow window,
|
||||
@NotNull final VirtualFile file,
|
||||
final boolean focusEditor,
|
||||
final HistoryEntry entry,
|
||||
|
||||
+3
-12
@@ -70,11 +70,7 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware {
|
||||
}
|
||||
|
||||
final FileType ft = file.getFileType();
|
||||
if (ft.isBinary()) {
|
||||
return BinaryFileTypeDecompilers.INSTANCE.forFileType(ft) != null;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !ft.isBinary() || BinaryFileTypeDecompilers.INSTANCE.forFileType(ft) != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -143,12 +139,7 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware {
|
||||
if (editor instanceof DocumentsEditor) {
|
||||
DocumentsEditor documentsEditor = (DocumentsEditor)editor;
|
||||
Document[] documents = documentsEditor.getDocuments();
|
||||
if (documents.length > 0) {
|
||||
return documents;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
return documents.length > 0 ? documents : null;
|
||||
}
|
||||
|
||||
if (editor instanceof TextEditor) {
|
||||
@@ -182,7 +173,7 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware {
|
||||
state.SELECTION_END = editor.getSelectionModel().getSelectionEnd();
|
||||
|
||||
// Saving scrolling proportion on UNDO may cause undesirable results of undo action fails to perform since
|
||||
// scrolling proportion restored sligtly differs from what have been saved.
|
||||
// scrolling proportion restored slightly differs from what have been saved.
|
||||
state.VERTICAL_SCROLL_PROPORTION = level == FileEditorStateLevel.UNDO ? -1 : EditorUtil.calcVerticalScrollProportion(editor);
|
||||
return state;
|
||||
}
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.CodeInsightUtilBase;
|
||||
import com.intellij.codeInsight.completion.ExtendedTagInsertHandler;
|
||||
import com.intellij.codeInsight.daemon.XmlErrorMessages;
|
||||
import com.intellij.codeInsight.daemon.impl.ShowAutoImportPass;
|
||||
import com.intellij.codeInsight.daemon.impl.VisibleHighlightingPassFactory;
|
||||
import com.intellij.codeInsight.hint.HintManager;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.HintAction;
|
||||
@@ -182,7 +183,7 @@ public class CreateNSDeclarationIntentionFix implements HintAction, LocalQuickFi
|
||||
final String title = getTitle();
|
||||
final ImportNSAction action = new ImportNSAction(namespaces, myFile, myElement, editor, title);
|
||||
if (myElement instanceof XmlTag) {
|
||||
if (ShowAutoImportPass.getVisibleRange(editor).contains(myToken.getTextRange())) {
|
||||
if (VisibleHighlightingPassFactory.calculateVisibleRange(editor).contains(myToken.getTextRange())) {
|
||||
HintManager.getInstance().showQuestionHint(editor, message,
|
||||
myToken.getTextOffset(),
|
||||
myToken.getTextOffset() + myNamespacePrefix.length(), action);
|
||||
|
||||
Reference in New Issue
Block a user