mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.intellij.openapi.module;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
@@ -23,7 +25,7 @@ public class ModuleServiceManager {
|
||||
private ModuleServiceManager() {
|
||||
}
|
||||
|
||||
public static <T> T getService(Module module, Class<T> serviceClass) {
|
||||
public static <T> T getService(@NotNull Module module, @NotNull Class<T> serviceClass) {
|
||||
return (T)module.getPicoContainer().getComponentInstance(serviceClass.getName());
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -60,9 +60,8 @@ public class ConsoleExecuteActionHandler {
|
||||
languageConsole.addCurrentToHistory(range, false, myPreserveMarkup);
|
||||
}
|
||||
languageConsole.setInputText("");
|
||||
if (!StringUtil.isEmptyOrSpaces(text)) {
|
||||
myConsoleHistoryModel.addToHistory(text);
|
||||
}
|
||||
|
||||
myConsoleHistoryModel.addToHistory(text);
|
||||
// Send to interpreter / server
|
||||
|
||||
processLine(text);
|
||||
|
||||
@@ -646,6 +646,7 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider {
|
||||
|
||||
private class MyTreeSelectionListener implements TreeSelectionListener {
|
||||
private final TextAttributes myAttributes;
|
||||
private RangeHighlighter myHighlighter;
|
||||
|
||||
public MyTreeSelectionListener() {
|
||||
myAttributes = new TextAttributes();
|
||||
@@ -656,11 +657,8 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider {
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
if (!myEditor.getDocument().getText().equals(myLastParsedText)) return;
|
||||
TreePath path = myTree.getSelectionPath();
|
||||
if (path == null) {
|
||||
clearSelection();
|
||||
}
|
||||
else {
|
||||
clearSelection();
|
||||
clearSelection();
|
||||
if (path != null) {
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
|
||||
if (!(node.getUserObject() instanceof ViewerNodeDescriptor)) return;
|
||||
ViewerNodeDescriptor descriptor = (ViewerNodeDescriptor)node.getUserObject();
|
||||
@@ -684,8 +682,7 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider {
|
||||
|
||||
final int textLength = myEditor.getDocument().getTextLength();
|
||||
if (end <= textLength) {
|
||||
myEditor.getMarkupModel()
|
||||
.addRangeHighlighter(start, end, HighlighterLayer.LAST, myAttributes, HighlighterTargetArea.EXACT_RANGE);
|
||||
myHighlighter = myEditor.getMarkupModel().addRangeHighlighter(start, end, HighlighterLayer.LAST, myAttributes, HighlighterTargetArea.EXACT_RANGE);
|
||||
if (myTree.hasFocus()) {
|
||||
myEditor.getCaretModel().moveToOffset(start);
|
||||
myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
|
||||
@@ -716,7 +713,10 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider {
|
||||
}
|
||||
|
||||
private void clearSelection() {
|
||||
myEditor.getMarkupModel().removeAllHighlighters();
|
||||
if (myHighlighter != null) {
|
||||
myEditor.getMarkupModel().removeHighlighter(myHighlighter);
|
||||
myHighlighter.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.intellij.execution.process;
|
||||
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.openapi.util.ModificationTracker;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -21,11 +22,14 @@ public class ConsoleHistoryModel implements ModificationTracker {
|
||||
public void addToHistory(final String statement) {
|
||||
final int maxHistorySize = getMaxHistorySize();
|
||||
synchronized (myHistory) {
|
||||
removeFromHistory(statement);
|
||||
if (myHistory.size() >= maxHistorySize) {
|
||||
myHistory.removeLast();
|
||||
myHistoryCursor = -1;
|
||||
if (!StringUtil.isEmptyOrSpaces(statement)) {
|
||||
removeFromHistory(statement);
|
||||
if (myHistory.size() >= maxHistorySize) {
|
||||
myHistory.removeLast();
|
||||
}
|
||||
myHistory.addFirst(statement);
|
||||
}
|
||||
myHistory.addFirst(statement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +40,7 @@ public class ConsoleHistoryModel implements ModificationTracker {
|
||||
public void removeFromHistory(final String statement) {
|
||||
synchronized (myHistory) {
|
||||
myModificationTracker++;
|
||||
myHistoryCursor = -1;
|
||||
|
||||
myHistory.remove(statement);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user