Merge remote-tracking branch 'origin/master'

This commit is contained in:
anna
2013-03-01 15:15:39 +01:00
24 changed files with 207 additions and 223 deletions
@@ -23,10 +23,9 @@ import com.intellij.execution.filters.ExceptionFilters;
import com.intellij.execution.filters.Filter;
import com.intellij.execution.filters.TextConsoleBuilder;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.openapi.module.Module;
import com.intellij.execution.runners.RunContentBuilder;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -58,26 +57,7 @@ public class DefaultDebugEnvironment implements DebugEnvironment {
myRemoteConnection = remoteConnection;
myPollConnection = pollConnection;
mySearchScope = createSearchScope(project, runProfile);
}
@NotNull
public static GlobalSearchScope createSearchScope(Project project, RunProfile runProfile) {
Module[] modules = null;
if (runProfile instanceof ModuleRunProfile) {
modules = ((ModuleRunProfile)runProfile).getModules();
}
if (modules == null || modules.length == 0) {
return GlobalSearchScope.allScope(project);
}
else {
GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(modules[0], true);
for (int idx = 1; idx < modules.length; idx++) {
Module module = modules[idx];
scope = scope.uniteWith(GlobalSearchScope.moduleRuntimeScope(module, true));
}
return scope;
}
mySearchScope = RunContentBuilder.createSearchScope(project, runProfile);
}
@Override
@@ -86,14 +86,10 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
private final ThreadsPanel myThreadsPanel;
private static final String THREAD_DUMP_CONTENT_PREFIX = "Dump";
private final Icon myIcon;
public DebuggerSessionTab(final Project project,
final String sessionName,
@NotNull final DebugUIEnvironment environment,
DebuggerSession debuggerSession) throws ExecutionException {
super(project, "JavaDebugger", sessionName);
myIcon = environment.getIcon();
public DebuggerSessionTab(final Project project, final String sessionName, @NotNull final DebugUIEnvironment environment,
@NotNull DebuggerSession debuggerSession) throws ExecutionException {
super(project, "JavaDebugger", sessionName, debuggerSession.getSearchScope());
myDebuggerSession = debuggerSession;
myDebugUIEnvironment = environment;
@@ -204,7 +200,8 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
ExecutionResult executionResult = debuggerSession.getProcess().getExecutionResult();
myConsole = executionResult.getExecutionConsole();
myRunContentDescriptor = new RunContentDescriptor(myConsole, executionResult.getProcessHandler(), myUi.getComponent(), getSessionName(), myIcon);
myRunContentDescriptor = new RunContentDescriptor(myConsole, executionResult.getProcessHandler(), myUi.getComponent(), getSessionName(),
environment.getIcon());
initUI(executionResult);
}
@@ -516,8 +513,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
private class AutoVarsSwitchAction extends ToggleAction {
private volatile boolean myAutoModeEnabled;
private static final String myAutoModeText = "Auto-Variables Mode";
private static final String myDefaultModeText = "All-Variables Mode";
public AutoVarsSwitchAction() {
super("", "", AllIcons.Debugger.AutoVariablesMode);
@@ -528,7 +523,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
super.update(e);
final Presentation presentation = e.getPresentation();
final boolean autoModeEnabled = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
presentation.setText(autoModeEnabled ? myDefaultModeText : myAutoModeText);
presentation.setText(autoModeEnabled ? "All-Variables Mode" : "Auto-Variables Mode");
}
public boolean isSelected(AnActionEvent e) {
@@ -86,10 +86,8 @@ public class DefaultJavaProgramRunner extends JavaPatchableProgramRunner {
onProcessStarted(env.getRunnerSettings(), executionResult);
final RunContentBuilder contentBuilder = new RunContentBuilder(project, this, executor);
final RunContentBuilder contentBuilder = new RunContentBuilder(project, this, executor, executionResult, env);
Disposer.register(project, contentBuilder);
contentBuilder.setExecutionResult(executionResult);
contentBuilder.setEnvironment(env);
if (shouldAddDefaultActions) {
addDefaultActions(contentBuilder);
}
@@ -110,12 +110,14 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey>, J
*/
public TextAttributes getDefaultAttributes() {
if (myDefaultAttributes == NULL_ATTRIBUTES) {
// E.g. if one text key reuse default attributes of some other predefined key
myDefaultAttributes = null;
final TextAttributeKeyDefaultsProvider provider = ourDefaultsProvider.getValue();
if (provider != null)
myDefaultAttributes = provider.getDefaultAttributes(this);
}
else if (myDefaultAttributes == null) {
myDefaultAttributes = NULL_ATTRIBUTES;
}
return myDefaultAttributes;
}
@@ -23,21 +23,37 @@ import com.intellij.openapi.editor.colors.TextAttributesKey;
* @deprecated Use DefaultLanguageHighlighterColors to inherit default attributes.
*/
public class SyntaxHighlighterColors {
public static final TextAttributesKey LINE_COMMENT = TextAttributesKey.createTextAttributesKey("JAVA_LINE_COMMENT");
public static final TextAttributesKey JAVA_BLOCK_COMMENT = TextAttributesKey.createTextAttributesKey("JAVA_BLOCK_COMMENT");
public static final TextAttributesKey DOC_COMMENT = TextAttributesKey.createTextAttributesKey("JAVA_DOC_COMMENT");
public static final TextAttributesKey KEYWORD = TextAttributesKey.createTextAttributesKey("JAVA_KEYWORD");
public static final TextAttributesKey NUMBER = TextAttributesKey.createTextAttributesKey("JAVA_NUMBER");
public static final TextAttributesKey STRING = TextAttributesKey.createTextAttributesKey("JAVA_STRING");
public static final TextAttributesKey OPERATION_SIGN = TextAttributesKey.createTextAttributesKey("JAVA_OPERATION_SIGN");
public static final TextAttributesKey PARENTHS = TextAttributesKey.createTextAttributesKey("JAVA_PARENTH");
public static final TextAttributesKey BRACKETS = TextAttributesKey.createTextAttributesKey("JAVA_BRACKETS");
public static final TextAttributesKey BRACES = TextAttributesKey.createTextAttributesKey("JAVA_BRACES");
public static final TextAttributesKey COMMA = TextAttributesKey.createTextAttributesKey("JAVA_COMMA");
public static final TextAttributesKey DOT = TextAttributesKey.createTextAttributesKey("JAVA_DOT");
public static final TextAttributesKey JAVA_SEMICOLON = TextAttributesKey.createTextAttributesKey("JAVA_SEMICOLON");
public static final TextAttributesKey DOC_COMMENT_TAG = TextAttributesKey.createTextAttributesKey("JAVA_DOC_TAG");
public static final TextAttributesKey DOC_COMMENT_MARKUP = TextAttributesKey.createTextAttributesKey("JAVA_DOC_MARKUP");
public static final TextAttributesKey VALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey("JAVA_VALID_STRING_ESCAPE");
public static final TextAttributesKey INVALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey("JAVA_INVALID_STRING_ESCAPE");
public static final TextAttributesKey LINE_COMMENT =
TextAttributesKey.createTextAttributesKey("JAVA_LINE_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
public static final TextAttributesKey JAVA_BLOCK_COMMENT =
TextAttributesKey.createTextAttributesKey("JAVA_BLOCK_COMMENT", DefaultLanguageHighlighterColors.BLOCK_COMMENT);
public static final TextAttributesKey DOC_COMMENT =
TextAttributesKey.createTextAttributesKey("JAVA_DOC_COMMENT", DefaultLanguageHighlighterColors.DOC_COMMENT);
public static final TextAttributesKey KEYWORD =
TextAttributesKey.createTextAttributesKey("JAVA_KEYWORD", DefaultLanguageHighlighterColors.KEYWORD);
public static final TextAttributesKey NUMBER =
TextAttributesKey.createTextAttributesKey("JAVA_NUMBER", DefaultLanguageHighlighterColors.NUMBER);
public static final TextAttributesKey STRING =
TextAttributesKey.createTextAttributesKey("JAVA_STRING", DefaultLanguageHighlighterColors.STRING);
public static final TextAttributesKey OPERATION_SIGN =
TextAttributesKey.createTextAttributesKey("JAVA_OPERATION_SIGN", DefaultLanguageHighlighterColors.OPERATION_SIGN);
public static final TextAttributesKey PARENTHS =
TextAttributesKey.createTextAttributesKey("JAVA_PARENTH", DefaultLanguageHighlighterColors.PARENTHESES);
public static final TextAttributesKey BRACKETS =
TextAttributesKey.createTextAttributesKey("JAVA_BRACKETS", DefaultLanguageHighlighterColors.BRACKETS);
public static final TextAttributesKey BRACES =
TextAttributesKey.createTextAttributesKey("JAVA_BRACES", DefaultLanguageHighlighterColors.BRACES);
public static final TextAttributesKey COMMA =
TextAttributesKey.createTextAttributesKey("JAVA_COMMA", DefaultLanguageHighlighterColors.COMMA);
public static final TextAttributesKey DOT = TextAttributesKey.createTextAttributesKey("JAVA_DOT", DefaultLanguageHighlighterColors.DOT);
public static final TextAttributesKey JAVA_SEMICOLON =
TextAttributesKey.createTextAttributesKey("JAVA_SEMICOLON", DefaultLanguageHighlighterColors.SEMICOLON);
public static final TextAttributesKey DOC_COMMENT_TAG =
TextAttributesKey.createTextAttributesKey("JAVA_DOC_TAG", DefaultLanguageHighlighterColors.DOC_COMMENT_TAG);
public static final TextAttributesKey DOC_COMMENT_MARKUP =
TextAttributesKey.createTextAttributesKey("JAVA_DOC_MARKUP", DefaultLanguageHighlighterColors.DOC_COMMENT_MARKUP);
public static final TextAttributesKey VALID_STRING_ESCAPE =
TextAttributesKey.createTextAttributesKey("JAVA_VALID_STRING_ESCAPE", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
public static final TextAttributesKey INVALID_STRING_ESCAPE =
TextAttributesKey.createTextAttributesKey("JAVA_INVALID_STRING_ESCAPE", DefaultLanguageHighlighterColors.INVALID_STRING_ESCAPE);
}
@@ -37,6 +37,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.FilterComponent;
import com.intellij.util.Alarm;
import com.intellij.util.containers.ContainerUtil;
@@ -54,7 +55,6 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
/**
@@ -98,7 +98,12 @@ public abstract class LogConsoleBase extends AdditionalTabComponent implements L
private JComboBox myLogFilterCombo;
private JPanel myTextFilterWrapper;
public LogConsoleBase(Project project, @Nullable Reader reader, String title, final boolean buildInActions, LogFilterModel model) {
public LogConsoleBase(@NotNull Project project, @Nullable Reader reader, String title, final boolean buildInActions, LogFilterModel model) {
this(project, reader, title, buildInActions, model, GlobalSearchScope.allScope(project));
}
public LogConsoleBase(@NotNull Project project, @Nullable Reader reader, String title, final boolean buildInActions, LogFilterModel model,
@NotNull GlobalSearchScope scope) {
super(new BorderLayout());
myProject = project;
myTitle = title;
@@ -106,7 +111,7 @@ public abstract class LogConsoleBase extends AdditionalTabComponent implements L
myFilters = myModel.getLogFilters();
myReaderThread = new ReaderThread(reader);
myBuildInActions = buildInActions;
TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project, scope);
myConsole = builder.getConsole();
myConsole.attachToProcess(myProcessHandler);
myDisposed = false;
@@ -18,6 +18,7 @@ package com.intellij.diagnostic.logging;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -36,8 +37,27 @@ public abstract class LogConsoleImpl extends LogConsoleBase {
private final Charset myCharset;
private long myOldLength = 0;
public LogConsoleImpl(Project project, @NotNull File file, @NotNull Charset charset, long skippedContents, String title, final boolean buildInActions) {
super(project, getReader(file, charset, skippedContents),title, buildInActions, new DefaultLogFilterModel(project));
/**
* @deprecated use {@link #LogConsoleImpl(com.intellij.openapi.project.Project, java.io.File, java.nio.charset.Charset, long, String, boolean, com.intellij.psi.search.GlobalSearchScope)}
*/
public LogConsoleImpl(Project project,
@NotNull File file,
@NotNull Charset charset,
long skippedContents,
String title,
final boolean buildInActions) {
this(project, file, charset, skippedContents, title, buildInActions, GlobalSearchScope.allScope(project));
}
public LogConsoleImpl(Project project,
@NotNull File file,
@NotNull Charset charset,
long skippedContents,
String title,
final boolean buildInActions,
final GlobalSearchScope searchScope) {
super(project, getReader(file, charset, skippedContents), title, buildInActions, new DefaultLogFilterModel(project),
searchScope);
myPath = file.getAbsolutePath();
myFile = file;
myCharset = charset;
@@ -23,12 +23,12 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComponentWithActions;
import com.intellij.openapi.util.Disposer;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentManagerAdapter;
import com.intellij.ui.content.ContentManagerEvent;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.io.File;
@@ -48,9 +48,18 @@ public abstract class LogConsoleManagerBase implements LogConsoleManager, Dispos
private final Map<AdditionalTabComponent, Content> myAdditionalContent = new HashMap<AdditionalTabComponent, Content>();
private ExecutionEnvironment myEnvironment;
private GlobalSearchScope mySearchScope;
/**
* @deprecated use {@link #LogConsoleManagerBase(com.intellij.openapi.project.Project, com.intellij.psi.search.GlobalSearchScope)}
*/
protected LogConsoleManagerBase(@NotNull Project project) {
this(project, GlobalSearchScope.allScope(project));
}
protected LogConsoleManagerBase(@NotNull Project project, @NotNull GlobalSearchScope searchScope) {
myProject = project;
mySearchScope = searchScope;
}
protected final Project getProject() {
@@ -71,7 +80,7 @@ public abstract class LogConsoleManagerBase implements LogConsoleManager, Dispos
}
public void addLogConsole(final String name, final String path, @NotNull Charset charset, final long skippedContent, Icon icon) {
doAddLogConsole(new LogConsoleImpl(myProject, new File(path), charset, skippedContent, name, false) {
doAddLogConsole(new LogConsoleImpl(myProject, new File(path), charset, skippedContent, name, false, mySearchScope) {
@Override
public boolean isActive() {
@@ -90,7 +99,7 @@ public abstract class LogConsoleManagerBase implements LogConsoleManager, Dispos
reader,
name,
false,
new DefaultLogFilterModel(myProject)) {
new DefaultLogFilterModel(myProject), mySearchScope) {
@Override
public boolean isActive() {
@@ -35,9 +35,7 @@ public abstract class DefaultProgramRunner extends GenericProgramRunner {
ExecutionResult executionResult = state.execute(executor, this);
if (executionResult == null) return null;
final RunContentBuilder contentBuilder = new RunContentBuilder(project, this, executor);
contentBuilder.setExecutionResult(executionResult);
contentBuilder.setEnvironment(env);
final RunContentBuilder contentBuilder = new RunContentBuilder(project, this, executor, executionResult, env);
return contentBuilder.showRunContent(contentToReuse);
}
@@ -19,6 +19,7 @@ import com.intellij.diagnostic.logging.LogConsoleManagerBase;
import com.intellij.diagnostic.logging.LogFilesManager;
import com.intellij.diagnostic.logging.OutputFileUtil;
import com.intellij.execution.*;
import com.intellij.execution.configurations.ModuleRunProfile;
import com.intellij.execution.configurations.RunConfigurationBase;
import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.impl.ConsoleViewImpl;
@@ -31,8 +32,10 @@ import com.intellij.ide.actions.ContextHelpAction;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.tabs.PinToolwindowTabAction;
import org.jetbrains.annotations.NonNls;
@@ -57,6 +60,22 @@ public class RunContentBuilder extends LogConsoleManagerBase {
private RunnerLayoutUi myUi;
private final Executor myExecutor;
public RunContentBuilder(@NotNull Project project,
ProgramRunner runner,
Executor executor,
ExecutionResult executionResult,
@NotNull ExecutionEnvironment environment) {
super(project, createSearchScope(project, environment.getRunProfile()));
myRunner = runner;
myExecutor = executor;
myManager = new LogFilesManager(project, this, this);
myExecutionResult = executionResult;
setEnvironment(environment);
}
/**
* @deprecated use {@link #RunContentBuilder(com.intellij.openapi.project.Project, ProgramRunner, com.intellij.execution.Executor, com.intellij.execution.ExecutionResult, ExecutionEnvironment)}
*/
public RunContentBuilder(final Project project, final ProgramRunner runner, Executor executor) {
super(project);
myRunner = runner;
@@ -64,10 +83,30 @@ public class RunContentBuilder extends LogConsoleManagerBase {
myManager = new LogFilesManager(project, this, this);
}
@NotNull
public static GlobalSearchScope createSearchScope(Project project, RunProfile runProfile) {
Module[] modules = null;
if (runProfile instanceof ModuleRunProfile) {
modules = ((ModuleRunProfile)runProfile).getModules();
}
if (modules == null || modules.length == 0) {
return GlobalSearchScope.allScope(project);
}
else {
GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(modules[0], true);
for (int idx = 1; idx < modules.length; idx++) {
Module module = modules[idx];
scope = scope.uniteWith(GlobalSearchScope.moduleRuntimeScope(module, true));
}
return scope;
}
}
public ExecutionResult getExecutionResult() {
return myExecutionResult;
}
@Deprecated
public void setExecutionResult(final ExecutionResult executionResult) {
myExecutionResult = executionResult;
}
@@ -623,8 +623,13 @@ public final class WindowManagerImpl extends WindowManagerEx implements Applicat
frame.setFileTitle(null, null);
myProject2Frame.remove(project);
Disposer.dispose(frame.getStatusBar());
frame.dispose();
if (myProject2Frame.isEmpty()) {
myProject2Frame.put(null, frame);
}
else {
Disposer.dispose(frame.getStatusBar());
frame.dispose();
}
}
public final void disposeRootFrame() {
@@ -189,78 +189,6 @@
<option name="FONT_TYPE" value="1"/>
</value>
</option>
<option name="JAVA_STRING">
<value>
<option name="FOREGROUND" value="008000"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
<option name="FONT_TYPE" value="1"/>
</value>
</option>
<option name="JAVA_INVALID_STRING_ESCAPE">
<value>
<option name="FOREGROUND" value="008000"/>
<option name="BACKGROUND" value="ffcccc"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="JAVA_VALID_STRING_ESCAPE">
<value>
<option name="FOREGROUND" value="000080"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
<option name="FONT_TYPE" value="1"/>
</value>
</option>
<option name="JAVA_OPERATION_SIGN">
<value>
<option name="FOREGROUND"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="JAVA_PARENTH">
<value>
<option name="FOREGROUND"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="JAVA_BRACKETS">
<value>
<option name="FOREGROUND"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="JAVA_BRACES">
<value>
<option name="FOREGROUND"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="JAVA_COMMA">
<value>
<option name="FOREGROUND"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="JAVA_DOT">
<value>
<option name="FOREGROUND"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="JAVA_SEMICOLON">
<value>
<option name="FOREGROUND"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="FOLDED_TEXT_ATTRIBUTES">
<value>
@@ -281,14 +209,6 @@
</value>
</option>
<option name="JAVA_DOC_MARKUP">
<value>
<option name="FOREGROUND"/>
<option name="BACKGROUND" value="e2ffe2"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="JAVADOC_WRONG_REFERENCES_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="ff0000"/>
@@ -473,16 +393,6 @@
</value>
</option>
<option name="JAVA_DOC_TAG">
<value>
<option name="FOREGROUND"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR" value="808080"/>
<option name="EFFECT_TYPE" value="1"/>
<option name="FONT_TYPE" value="1"/>
</value>
</option>
<option name="DOC_COMMENT_TAG_VALUE">
<value>
<option name="FOREGROUND" value="3d3d3d"/>
@@ -649,33 +559,6 @@
<option name="FONT_TYPE" value="1"/>
</value>
</option>
<option name="JAVA_NUMBER">
<value>
<option name="FOREGROUND" value="ff"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
</value>
</option>
<option name="JAVA_LINE_COMMENT">
<value>
<option name="FOREGROUND" value="808080"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
<option name="FONT_TYPE" value="2"/>
</value>
</option>
<option name="JAVA_BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="808080"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
<option name="FONT_TYPE" value="2"/>
</value>
</option>
<option name="INSTANCE_FIELD_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="660e7a"/>
@@ -684,16 +567,6 @@
<option name="FONT_TYPE" value="1"/>
</value>
</option>
<option name="JAVA_DOC_COMMENT">
<value>
<option name="FOREGROUND" value="808080"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
<option name="FONT_TYPE" value="2"/>
</value>
</option>
<option name="DIFF_ABSENT">
<value>
<option name="FOREGROUND"/>
@@ -771,16 +644,6 @@
<option name="EFFECT_TYPE" value="0"/>
</value>
</option>
<option name="JAVA_KEYWORD">
<value>
<option name="FOREGROUND" value="80"/>
<option name="BACKGROUND"/>
<option name="EFFECT_COLOR"/>
<option name="FONT_TYPE" value="1"/>
</value>
</option>
<option name="ANNOTATION_NAME_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="808000" />
@@ -35,6 +35,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.AppIcon;
import com.intellij.ui.content.Content;
import com.intellij.xdebugger.XDebuggerBundle;
@@ -56,8 +57,9 @@ public abstract class DebuggerSessionTabBase extends LogConsoleManagerBase imple
protected ExecutionConsole myConsole;
protected RunContentDescriptor myRunContentDescriptor;
public DebuggerSessionTabBase(Project project, @NotNull String runnerId, @NotNull final String sessionName) {
super(project);
public DebuggerSessionTabBase(@NotNull Project project, @NotNull String runnerId, @NotNull final String sessionName,
@NotNull GlobalSearchScope searchScope) {
super(project, searchScope);
Disposer.register(project, this);
myManager = new LogFilesManager(project, this, this);
@@ -33,6 +33,7 @@ import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.tabs.PinToolwindowTabAction;
import com.intellij.xdebugger.XDebugProcess;
@@ -61,7 +62,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
public XDebugSessionTab(@NotNull final Project project, @NotNull final XDebugSessionImpl session, final @Nullable Icon icon,
ExecutionEnvironment environment, ProgramRunner runner) {
super(project, "Debug", session.getSessionName());
super(project, "Debug", session.getSessionName(), GlobalSearchScope.allScope(project));
if (environment != null) {
setEnvironment(environment);
}
+4 -3
View File
@@ -35,7 +35,7 @@
interface="org.jetbrains.plugins.groovy.lang.resolve.ClosureMissingMethodContributor"/>
<extensionPoint name="variableEnhancer" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrVariableEnhancer"/>
<extensionPoint name="referenceTypeEnhancer" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrReferenceTypeEnhancer"/>
<extensionPoint name="typeConverter" interface="org.jetbrains.plugins.groovy.lang.psi.GrTypeConverter"/>
<extensionPoint name="typeConverter" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrTypeConverter"/>
<extensionPoint name="expectedTypesContributor"
interface="org.jetbrains.plugins.groovy.lang.psi.expectedTypes.GroovyExpectedTypesContributor"/>
<extensionPoint name="classSubstitutor" interface="org.jetbrains.plugins.groovy.lang.psi.GrClassSubstitutor"/>
@@ -145,8 +145,9 @@
<variableEnhancer implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureAsAnonymousParameterEnhancer"/>
<typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.impl.GrContainerTypeConverter"/>
<typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.impl.types.GrStringTypeConverter"/>
<typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrContainerTypeConverter"/>
<typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrStringTypeConverter"/>
<typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrBooleanTypeConverter"/>
<typeConverter implementation="org.jetbrains.plugins.groovy.gpp.GppTypeConverter"/>
<expectedTypesContributor implementation="org.jetbrains.plugins.groovy.gpp.GppExpectedTypesContributor"/>
@@ -224,7 +224,7 @@ public class GrUnresolvedAccessInspection extends GroovySuppressableInspectionTo
if (cannotBeDynamic || shouldHighlightAsUnresolved(ref)) {
HighlightInfo info = createAnnotationForRef(ref, cannotBeDynamic, GroovyBundle.message("cannot.resolve", ref.getReferenceName()));
LOG.assertTrue(info != null);
if (info == null) return null;
HighlightDisplayKey displayKey = HighlightDisplayKey.find(SHORT_NAME);
if (ref.getParent() instanceof GrMethodCall) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -63,6 +63,7 @@ public class GroovyQuoteHandler implements MultiCharQuoteHandler {
final IElementType tokenType = iterator.getTokenType();
if (tokenType == mSTRING_LITERAL || tokenType == mGSTRING_BEGIN || tokenType == mGSTRING_LITERAL || tokenType == mGSTRING_CONTENT) {
final Document document = iterator.getDocument();
if (document == null) return false;
final String literal = document.getText().substring(iterator.getStart(), offset + 1);
if ("'''".equals(literal) || "\"\"\"".equals(literal) || "'".equals(literal) || "\"".equals(literal)) {
return true;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -22,7 +22,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.dsl.toplevel.AnnotatedContextFilter;
import org.jetbrains.plugins.groovy.findUsages.LiteralConstructorReference;
import org.jetbrains.plugins.groovy.lang.psi.GrTypeConverter;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap;
import org.jetbrains.plugins.groovy.lang.psi.api.signatures.GrSignature;
@@ -31,6 +30,7 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType;
import org.jetbrains.plugins.groovy.lang.psi.impl.GrTupleType;
import org.jetbrains.plugins.groovy.lang.psi.impl.signatures.GrClosureSignatureUtil;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrTypeConverter;
/**
* @author peter
@@ -35,7 +35,6 @@ import gnu.trove.TObjectIntHashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.GrTypeConverter;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
import org.jetbrains.plugins.groovy.lang.psi.api.SpreadState;
@@ -49,6 +48,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpres
import org.jetbrains.plugins.groovy.lang.psi.impl.*;
import org.jetbrains.plugins.groovy.lang.psi.impl.signatures.GrClosureSignatureImpl;
import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureParameterEnhancer;
import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrTypeConverter;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
import org.jetbrains.plugins.groovy.util.LightCacheKey;
@@ -0,0 +1,41 @@
/*
* Copyright 2000-2013 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 org.jetbrains.plugins.groovy.lang.psi.typeEnhancers;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.PsiType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
/**
* @author Max Medvedev
*/
public class GrBooleanTypeConverter extends GrTypeConverter {
@Override
public boolean isAllowedInMethodCall() {
return false;
}
@Override
public Boolean isConvertible(@NotNull PsiType lType, @NotNull PsiType rType, @NotNull GroovyPsiElement context) {
if (PsiType.BOOLEAN.equals(lType) || lType.equalsToText(CommonClassNames.JAVA_LANG_BOOLEAN)) {
return !PsiType.NULL.equals(rType);
}
return null;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.lang.psi.impl;
package org.jetbrains.plugins.groovy.lang.psi.typeEnhancers;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.PsiArrayType;
@@ -22,7 +22,6 @@ import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.GrTypeConverter;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.lang.psi.impl.types;
package org.jetbrains.plugins.groovy.lang.psi.typeEnhancers;
import com.intellij.psi.PsiType;
import com.intellij.psi.util.InheritanceUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
import org.jetbrains.plugins.groovy.lang.psi.GrTypeConverter;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.lang.psi;
package org.jetbrains.plugins.groovy.lang.psi.typeEnhancers;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.PsiClass;
@@ -21,6 +21,7 @@ import com.intellij.psi.PsiClassType;
import com.intellij.psi.PsiType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
/**
@@ -500,6 +500,15 @@ import groovy.transform.Immutable
Money d = [amount: 100, currency:'USA']
''')
}
void testBooleanIsAssignableToAny() {
testHighlighting('''\
boolean b1 = new Object()
boolean b2 = <warning descr="Cannot assign 'null' to 'boolean'">null</warning>
Boolean b3 = new Object()
Boolean b4 = null
''')
}