diff --git a/community-resources/src/CommunityFileTypes.xml b/community-resources/src/CommunityFileTypes.xml
index e15ce6cff542..b46643afa562 100644
--- a/community-resources/src/CommunityFileTypes.xml
+++ b/community-resources/src/CommunityFileTypes.xml
@@ -60,6 +60,7 @@
+
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java
index ca015a9929b2..dc80f8b139af 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java
@@ -75,7 +75,7 @@ public class VariablesPanel extends DebuggerTreePanel implements DataProvider {
@Override
protected DebuggerTree createTreeView() {
- return new FrameVariablesTree(getProject(), SystemProperties.getBooleanProperty("java.debugger.xTree", false) ? this : null);
+ return new FrameVariablesTree(getProject(), SystemProperties.getBooleanProperty("java.debugger.xTree", true) ? this : null);
}
@Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsTypeElementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsTypeElementImpl.java
index 16d971238684..9d4e3888771c 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsTypeElementImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsTypeElementImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,8 +16,8 @@
package com.intellij.psi.impl.compiled;
import com.intellij.openapi.util.AtomicNotNullLazyValue;
+import com.intellij.openapi.util.AtomicNullableLazyValue;
import com.intellij.openapi.util.NotNullLazyValue;
-import com.intellij.openapi.util.Ref;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiImplUtil;
import com.intellij.psi.impl.PsiJavaParserFacadeImpl;
@@ -39,18 +39,17 @@ public class ClsTypeElementImpl extends ClsElementImpl implements PsiTypeElement
private final PsiElement myParent;
private final String myTypeText;
private final char myVariance;
- private final NotNullLazyValue[> myChild;
+ private final AtomicNullableLazyValue myChild;
private final NotNullLazyValue myCachedType;
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
myParent = parent;
myTypeText = TypeInfo.internFrequentType(typeText);
myVariance = variance;
- myChild = new AtomicNotNullLazyValue][>() {
- @NotNull
+ myChild = new AtomicNullableLazyValue() {
@Override
- protected Ref compute() {
- return Ref.create(calculateChild());
+ protected ClsElementImpl compute() {
+ return calculateChild();
}
};
myCachedType = new AtomicNotNullLazyValue() {
@@ -65,7 +64,7 @@ public class ClsTypeElementImpl extends ClsElementImpl implements PsiTypeElement
@Override
@NotNull
public PsiElement[] getChildren() {
- ClsElementImpl child = myChild.getValue().get();
+ ClsElementImpl child = myChild.getValue();
return child != null ? new PsiElement[]{child} : PsiElement.EMPTY_ARRAY;
}
@@ -109,7 +108,7 @@ public class ClsTypeElementImpl extends ClsElementImpl implements PsiTypeElement
public void setMirror(@NotNull TreeElement element) throws InvalidMirrorException {
setMirrorCheckingType(element, JavaElementType.TYPE);
- ClsElementImpl child = myChild.getValue().get();
+ ClsElementImpl child = myChild.getValue();
if (child != null) {
child.setMirror(element.getFirstChildNode());
}
@@ -138,24 +137,23 @@ public class ClsTypeElementImpl extends ClsElementImpl implements PsiTypeElement
if (PsiJavaParserFacadeImpl.getPrimitiveType(myTypeText) != null) {
return null;
}
- else if (isArray()) {
+ if (isArray()) {
return myVariance == VARIANCE_NONE
? new ClsTypeElementImpl(this, myTypeText.substring(0, myTypeText.length() - 2), myVariance)
: new ClsTypeElementImpl(this, myTypeText, VARIANCE_NONE);
}
- else if (isVarArgs()) {
+ if (isVarArgs()) {
return new ClsTypeElementImpl(this, myTypeText.substring(0, myTypeText.length() - 3), myVariance);
}
- else {
- return myVariance != VARIANCE_INVARIANT ? new ClsJavaCodeReferenceElementImpl(this, myTypeText) : null;
- }
+ return myVariance == VARIANCE_INVARIANT ? null : new ClsJavaCodeReferenceElementImpl(this, myTypeText);
}
+ @NotNull
private PsiType calculateType() {
PsiType result = PsiJavaParserFacadeImpl.getPrimitiveType(myTypeText);
if (result != null) return result;
- ClsElementImpl childElement = myChild.getValue().get();
+ ClsElementImpl childElement = myChild.getValue();
if (childElement instanceof ClsTypeElementImpl) {
if (isArray()) {
switch (myVariance) {
@@ -175,7 +173,7 @@ public class ClsTypeElementImpl extends ClsElementImpl implements PsiTypeElement
return new PsiEllipsisType(((PsiTypeElement)childElement).getType());
}
}
- else if (childElement instanceof ClsJavaCodeReferenceElementImpl) {
+ if (childElement instanceof ClsJavaCodeReferenceElementImpl) {
PsiClassReferenceType psiClassReferenceType = new PsiClassReferenceType((PsiJavaCodeReferenceElement)childElement, null);
switch (myVariance) {
case VARIANCE_NONE:
@@ -191,10 +189,8 @@ public class ClsTypeElementImpl extends ClsElementImpl implements PsiTypeElement
return null;
}
}
- else {
- assert childElement == null : this;
- return PsiWildcardType.createUnbounded(getManager());
- }
+ assert childElement == null : this;
+ return PsiWildcardType.createUnbounded(getManager());
}
@Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java
index 5edd337f5113..d7ba848980de 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -494,20 +494,19 @@ public class PsiClassImpl extends JavaStubPsiElement> implements
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
if (isEnum()) {
- String name = getName();
- if (name != null) {
+ String myName = getName();
+ if (myName != null) {
try {
final NameHint nameHint = processor.getHint(NameHint.KEY);
final ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
- if (nameHint == null || VALUES_METHOD.equals(nameHint.getName(state))) {
- if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD)) {
- if (!processor.execute(getValuesMethod(), ResolveState.initial())) return false;
- }
+ String nameToSearch = nameHint == null ? null : nameHint.getName(state);
+ if (VALUES_METHOD.equals(nameToSearch) &&
+ (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD))) {
+ if (!processor.execute(getValuesMethod(), ResolveState.initial())) return false;
}
- if (nameHint == null || VALUE_OF_METHOD.equals(nameHint.getName(state))) {
- if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD)) {
- if (!processor.execute(getValueOfMethod(), ResolveState.initial())) return false;
- }
+ if (VALUE_OF_METHOD.equals(nameToSearch) &&
+ (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD))) {
+ if (!processor.execute(getValueOfMethod(), ResolveState.initial())) return false;
}
}
catch (IncorrectOperationException e) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassReferenceType.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassReferenceType.java
index f304fe250bae..361f2374b904 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassReferenceType.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassReferenceType.java
@@ -139,7 +139,7 @@ public class PsiClassReferenceType extends PsiClassType.Stub {
public ClassResolveResult resolveGenerics() {
PsiUtilCore.ensureValid(myReference);
final JavaResolveResult result = myReference.advancedResolve(false);
- return new DelegatingClassResolveResult(result);
+ return result.getElement() == null ? ClassResolveResult.EMPTY : new DelegatingClassResolveResult(result);
}
@Override
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy
index 4cad78b0c467..7de79b533944 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy
@@ -189,7 +189,16 @@ class Xoo {
class Xoo {
}
'''
+ }
+ public void "test cpp indirection"() {
+ myFixture.configureByText "a.c", '''f
+foo->bar
+'''
+ complete()
+ myFixture.checkResult '''foo
+foo->bar
+'''
}
private void complete() {
diff --git a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/debug/JavaDebuggerLauncherImpl.java b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/debug/JavaDebuggerLauncherImpl.java
index 76658698d034..9fb0d3f81e3c 100644
--- a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/debug/JavaDebuggerLauncherImpl.java
+++ b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/debug/JavaDebuggerLauncherImpl.java
@@ -2,6 +2,9 @@ package com.intellij.remoteServer.impl.runtime.deployment.debug;
import com.intellij.debugger.DebugEnvironment;
import com.intellij.debugger.DebugUIEnvironment;
+import com.intellij.debugger.DebuggerManager;
+import com.intellij.debugger.engine.DebugProcess;
+import com.intellij.debugger.engine.DebugProcessAdapter;
import com.intellij.debugger.engine.RemoteDebugProcessHandler;
import com.intellij.debugger.ui.DebuggerPanelsManager;
import com.intellij.diagnostic.logging.LogFilesManager;
@@ -21,6 +24,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.remoteServer.configuration.RemoteServer;
import com.intellij.remoteServer.runtime.deployment.debug.JavaDebugConnectionData;
+import com.intellij.remoteServer.runtime.deployment.debug.JavaDebugServerModeHandler;
import com.intellij.remoteServer.runtime.deployment.debug.JavaDebuggerLauncher;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -39,7 +43,9 @@ public class JavaDebuggerLauncherImpl extends JavaDebuggerLauncher {
final Project project = executionEnvironment.getProject();
Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();
final DebuggerPanelsManager manager = DebuggerPanelsManager.getInstance(project);
- final RemoteConnection remoteConnection = new RemoteConnection(true, info.getHost(), String.valueOf(info.getPort()), false);
+ final JavaDebugServerModeHandler serverModeHandler = info.getServerModeHandler();
+ boolean serverMode = serverModeHandler != null;
+ final RemoteConnection remoteConnection = new RemoteConnection(true, info.getHost(), String.valueOf(info.getPort()), serverMode);
DebugEnvironment debugEnvironment = new RemoteServerDebugEnvironment(project, remoteConnection, executionEnvironment.getRunProfile());
DebugUIEnvironment debugUIEnvironment = new RemoteServerDebugUIEnvironment(debugEnvironment, executionEnvironment);
RunContentDescriptor debugContentDescriptor = manager.attachVirtualMachine(debugUIEnvironment);
@@ -49,6 +55,20 @@ public class JavaDebuggerLauncherImpl extends JavaDebuggerLauncher {
processHandler.startNotify();
ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, debugContentDescriptor,
executionEnvironment.getContentToReuse());
+ if (serverMode) {
+ serverModeHandler.attachRemote();
+ DebuggerManager.getInstance(executionEnvironment.getProject())
+ .addDebugProcessListener(processHandler, new DebugProcessAdapter() {
+ public void processDetached(DebugProcess process, boolean closedByUser) {
+ try {
+ serverModeHandler.detachRemote();
+ }
+ catch (ExecutionException e) {
+ LOG.info(e);
+ }
+ }
+ });
+ }
}
private static class RemoteServerDebugUIEnvironment implements DebugUIEnvironment {
diff --git a/java/testFramework/src/com/intellij/debugger/impl/DescriptorTestCase.java b/java/testFramework/src/com/intellij/debugger/impl/DescriptorTestCase.java
index 0d6624d9894b..a3ad0c55ceab 100644
--- a/java/testFramework/src/com/intellij/debugger/impl/DescriptorTestCase.java
+++ b/java/testFramework/src/com/intellij/debugger/impl/DescriptorTestCase.java
@@ -34,7 +34,10 @@ import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.openapi.util.Pair;
import com.sun.jdi.Value;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
public abstract class DescriptorTestCase extends DebuggerTestCase {
private final List>> myDescriptorLog = new ArrayList>>();
@@ -51,10 +54,9 @@ public abstract class DescriptorTestCase extends DebuggerTestCase {
return getAlternateCollectionRenderer("Map");
}
- private NodeRenderer getAlternateCollectionRenderer(final String name) {
+ private static NodeRenderer getAlternateCollectionRenderer(final String name) {
final NodeRenderer[] renderers = NodeRendererSettings.getInstance().getAlternateCollectionRenderers();
- for (int idx = 0; idx < renderers.length; idx++) {
- NodeRenderer renderer = renderers[idx];
+ for (NodeRenderer renderer : renderers) {
if (name.equals(renderer.getName())) {
return renderer;
}
@@ -105,9 +107,8 @@ public abstract class DescriptorTestCase extends DebuggerTestCase {
private Pair> findDescriptorLog(final NodeDescriptorImpl descriptor) {
Pair> descriptorText = null;
- for (Iterator>> iterator = myDescriptorLog.iterator(); iterator.hasNext();) {
- Pair> pair = iterator.next();
- if(pair.getFirst() == descriptor) {
+ for (Pair> pair : myDescriptorLog) {
+ if (pair.getFirst() == descriptor) {
descriptorText = pair;
break;
}
@@ -115,24 +116,15 @@ public abstract class DescriptorTestCase extends DebuggerTestCase {
return descriptorText;
}
- protected void flushDescriptor(final NodeDescriptorImpl descriptor) {
- Pair> descriptorLog = findDescriptorLog(descriptor);
- if(descriptorLog != null) {
- printDescriptorLog(descriptorLog);
- myDescriptorLog.remove(descriptorLog);
- }
- }
-
protected void flushDescriptors() {
- for (Iterator>> iterator = myDescriptorLog.iterator(); iterator.hasNext();) {
- printDescriptorLog(iterator.next());
+ for (Pair> aMyDescriptorLog : myDescriptorLog) {
+ printDescriptorLog(aMyDescriptorLog);
}
myDescriptorLog.clear();
}
private void printDescriptorLog(Pair> pair) {
- for (Iterator it = pair.getSecond().iterator(); it.hasNext();) {
- String text = it.next();
+ for (String text : pair.getSecond()) {
print(text, ProcessOutputTypes.SYSTEM);
}
}
@@ -150,6 +142,7 @@ public abstract class DescriptorTestCase extends DebuggerTestCase {
String name) {
try {
StackFrameProxy frameProxy = evaluationContext.getFrameProxy();
+ assert frameProxy != null;
LocalVariableDescriptorImpl local = frameTree.getNodeFactory().getLocalVariableDescriptor(null, frameProxy.visibleVariableByName(name));
local.setContext(evaluationContext);
return local;
@@ -169,7 +162,7 @@ public abstract class DescriptorTestCase extends DebuggerTestCase {
doExpandAll(tree, runnable, new HashSet(), null);
}
- protected static interface NodeFilter {
+ protected interface NodeFilter {
boolean shouldExpand(DebuggerTreeNode node);
}
@@ -186,7 +179,7 @@ public abstract class DescriptorTestCase extends DebuggerTestCase {
final DebuggerTreeNode treeNode = (DebuggerTreeNode)tree.getPathForRow(i).getLastPathComponent();
if(tree.isCollapsed(i) && !treeNode.isLeaf()) {
final NodeDescriptor nodeDescriptor = treeNode.getDescriptor();
- boolean shouldExpand = filter == null? true : filter.shouldExpand(treeNode);
+ boolean shouldExpand = filter == null || filter.shouldExpand(treeNode);
if (shouldExpand) {
// additional checks to prevent infinite expand
if (nodeDescriptor instanceof ValueDescriptor) {
diff --git a/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java b/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java
index 542580662556..807ee6102b7f 100644
--- a/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java
+++ b/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,19 +18,22 @@ package com.intellij.openapi.editor.colors;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.util.*;
+import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.containers.ConcurrentHashMap;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.concurrent.ConcurrentMap;
+
/**
* A type of item with a distinct highlighting in an editor or in other views.
*/
public final class TextAttributesKey implements Comparable {
private static final TextAttributes NULL_ATTRIBUTES = new TextAttributes();
- private static final ConcurrentHashMap ourRegistry = new ConcurrentHashMap();
+ private static final ConcurrentMap ourRegistry = new ConcurrentHashMap();
private static final NullableLazyValue ourDefaultsProvider = new VolatileNullableLazyValue() {
@Nullable
@Override
@@ -58,7 +61,7 @@ public final class TextAttributesKey implements Comparable {
@NotNull
public static TextAttributesKey find(@NotNull @NonNls String externalName) {
- return ourRegistry.cacheOrGet(externalName, new TextAttributesKey(externalName));
+ return ConcurrencyUtil.cacheOrGet(ourRegistry, externalName, new TextAttributesKey(externalName));
}
public String toString() {
diff --git a/platform/core-api/src/com/intellij/openapi/project/DumbService.java b/platform/core-api/src/com/intellij/openapi/project/DumbService.java
index 4bced97e584a..3fa4bbb49f46 100644
--- a/platform/core-api/src/com/intellij/openapi/project/DumbService.java
+++ b/platform/core-api/src/com/intellij/openapi/project/DumbService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -55,7 +55,7 @@ public abstract class DumbService {
*/
public abstract boolean isDumb();
- public static boolean isDumb(Project project) {
+ public static boolean isDumb(@NotNull Project project) {
return getInstance(project).isDumb();
}
@@ -63,7 +63,7 @@ public abstract class DumbService {
* Executes the runnable immediately if not in dumb mode, or on AWT Event Dispatch thread when the dumb mode ends.
* @param runnable runnable to run
*/
- public abstract void runWhenSmart(Runnable runnable);
+ public abstract void runWhenSmart(@NotNull Runnable runnable);
/**
* Pause the current thread until dumb mode ends and then continue execution.
@@ -75,7 +75,7 @@ public abstract class DumbService {
/**
* Pause the current thread until dumb mode ends, and then run the read action. Index is guaranteed to be available inside that read action.
*/
- public T runReadActionInSmartMode(final Computable r) {
+ public T runReadActionInSmartMode(@NotNull final Computable r) {
final Ref result = new Ref();
runReadActionInSmartMode(new Runnable() {
@Override
@@ -105,7 +105,7 @@ public abstract class DumbService {
/**
* Pause the current thread until dumb mode ends, and then run the read action. Index is guaranteed to be available inside that read action.
*/
- public void runReadActionInSmartMode(final Runnable r) {
+ public void runReadActionInSmartMode(@NotNull final Runnable r) {
while (true) {
waitForSmartMode();
boolean success = ApplicationManager.getApplication().runReadAction(new Computable() {
@@ -130,7 +130,7 @@ public abstract class DumbService {
*
* @see #runReadActionInSmartMode(Runnable)
*/
- public void repeatUntilPassesInSmartMode(final Runnable r) {
+ public void repeatUntilPassesInSmartMode(@NotNull final Runnable r) {
while (true) {
waitForSmartMode();
try {
@@ -156,7 +156,7 @@ public abstract class DumbService {
});
}
- public void smartInvokeLater(@NotNull final Runnable runnable, ModalityState modalityState) {
+ public void smartInvokeLater(@NotNull final Runnable runnable, @NotNull ModalityState modalityState) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
@@ -207,7 +207,7 @@ public abstract class DumbService {
});
}
- public abstract void showDumbModeNotification(String message);
+ public abstract void showDumbModeNotification(@NotNull String message);
public abstract Project getProject();
diff --git a/platform/core-impl/src/com/intellij/mock/MockDumbService.java b/platform/core-impl/src/com/intellij/mock/MockDumbService.java
index 51b3ed0825c6..33c39d130254 100644
--- a/platform/core-impl/src/com/intellij/mock/MockDumbService.java
+++ b/platform/core-impl/src/com/intellij/mock/MockDumbService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -38,7 +38,7 @@ public class MockDumbService extends DumbService {
}
@Override
- public void runWhenSmart(Runnable runnable) {
+ public void runWhenSmart(@NotNull Runnable runnable) {
runnable.run();
}
@@ -52,7 +52,7 @@ public class MockDumbService extends DumbService {
}
@Override
- public void showDumbModeNotification(String message) {
+ public void showDumbModeNotification(@NotNull String message) {
throw new UnsupportedOperationException();
}
diff --git a/platform/core-impl/src/com/intellij/psi/stubs/StubTreeBuilder.java b/platform/core-impl/src/com/intellij/psi/stubs/StubTreeBuilder.java
index 871b7ee3d4dd..d69e62cff2ce 100644
--- a/platform/core-impl/src/com/intellij/psi/stubs/StubTreeBuilder.java
+++ b/platform/core-impl/src/com/intellij/psi/stubs/StubTreeBuilder.java
@@ -58,17 +58,18 @@ public class StubTreeBuilder {
final IFileElementType type = LanguageParserDefinitions.INSTANCE.forLanguage(l).getFileNodeType();
PsiFile psi = null;
- CharSequence contentAsText = null;
+ CharSequence contentAsText = inputData.getContentAsText();
Document document = FileDocumentManager.getInstance().getCachedDocument(inputData.getFile());
if (document != null) {
- PsiFile existingPsi = PsiDocumentManager.getInstance(inputData.getProject()).getPsiFile(document);
- if (existingPsi != null) {
- contentAsText = existingPsi.getText();
- psi = existingPsi;
+ PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(inputData.getProject());
+ if (psiDocumentManager.isUncommited(document)) {
+ PsiFile existingPsi = psiDocumentManager.getPsiFile(document);
+ if(existingPsi != null) {
+ psi = existingPsi;
+ }
}
}
- if (contentAsText == null) {
- contentAsText = inputData.getContentAsText();
+ if (psi == null) {
psi = inputData.getPsiFile();
}
psi = psi.getViewProvider().getStubBindingRoot();
diff --git a/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java
index da784dfbad22..d253ace0930c 100644
--- a/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java
+++ b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java
@@ -50,7 +50,7 @@ public final class CustomFileTypeLexer extends AbstractCustomLexer {
}
};
- final IdentifierParser identifierParser = new IdentifierParser();
+ final IdentifierParser identifierParser = new IdentifierParser(parser);
final QuotedStringParser quotedStringParser = new QuotedStringParser("\"", CustomHighlighterTokenType.STRING, table.isHasStringEscapes());
diff --git a/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/IdentifierParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/IdentifierParser.java
index 57b29ae806a8..8fc92e722e0f 100644
--- a/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/IdentifierParser.java
+++ b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/IdentifierParser.java
@@ -23,7 +23,10 @@ import com.intellij.psi.tree.IElementType;
* @author dsl
*/
public class IdentifierParser extends TokenParser {
- public IdentifierParser() {
+ private final KeywordParser myKeywordParser;
+
+ public IdentifierParser(KeywordParser keywordParser) {
+ myKeywordParser = keywordParser;
}
@Override
@@ -31,15 +34,15 @@ public class IdentifierParser extends TokenParser {
if (!Character.isJavaIdentifierStart(myBuffer.charAt(position))) return false;
final int start = position;
for (position++; position < myEndOffset; position++) {
- final char c = myBuffer.charAt(position);
- if (!isIdentifierPart(c)) break;
+ if (!isIdentifierPart(position)) break;
}
IElementType tokenType = CustomHighlighterTokenType.IDENTIFIER;
myTokenInfo.updateData(start, position, tokenType);
return true;
}
- protected boolean isIdentifierPart(final char c) {
- return Character.isJavaIdentifierPart(c) || c == '-';
+ private boolean isIdentifierPart(int position) {
+ if (myBuffer.charAt(position) == '-') return !myKeywordParser.hasToken(position, myBuffer, null);
+ return KeywordParser.isWordPart(position, myBuffer);
}
}
diff --git a/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java
index f45032c23f05..b210305c2489 100644
--- a/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java
+++ b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java
@@ -23,6 +23,7 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.util.containers.CharTrie;
import gnu.trove.THashSet;
import gnu.trove.TIntHashSet;
+import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -63,10 +64,9 @@ public class KeywordParser {
return result;
}
- public boolean hasToken(int position, CharSequence myBuffer, TokenInfo myTokenInfo) {
+ public boolean hasToken(int position, CharSequence myBuffer, @Nullable TokenInfo tokenInfo) {
int index = 0;
int offset = position;
- boolean found = false;
while (offset < myBuffer.length()) {
char c = myBuffer.charAt(offset++);
int nextIndex = myTrie.findSubNode(index, myIgnoreCase ? Character.toUpperCase(c) : c);
@@ -79,24 +79,29 @@ public class KeywordParser {
String testKeyword = myIgnoreCase ? StringUtil.toUpperCase(keyword) : keyword;
for (int i = 0; i < CustomHighlighterTokenType.KEYWORD_TYPE_COUNT; i++) {
if (myKeywordSets.get(i).contains(testKeyword)) {
- myTokenInfo.updateData(position, position + keyword.length(), getToken(i));
- found = true;
- break;
+ if (tokenInfo != null) {
+ tokenInfo.updateData(position, position + keyword.length(), getToken(i));
+ }
+ return true;
}
}
}
}
- return found;
+ return false;
}
- private static boolean isWordEnd(int offset, CharSequence myBuffer) {
- if (offset == myBuffer.length()) {
+ private static boolean isWordEnd(int offset, CharSequence sequence) {
+ if (offset == sequence.length()) {
return true;
}
+
+ return !isWordPart(offset - 1, sequence) || !isWordPart(offset, sequence);
+ }
- char ch = myBuffer.charAt(offset);
- return ch != '-' && ch != '_' && !Character.isLetterOrDigit(ch);
+ static boolean isWordPart(int offset, CharSequence sequence) {
+ char ch = sequence.charAt(offset);
+ return ch == '-' || Character.isJavaIdentifierPart(ch);
}
private static IElementType getToken(int keywordSetIndex) {
diff --git a/platform/lang-api/testSources/com/intellij/execution/filters/CompositeFilterTest.java b/platform/lang-api/testSources/com/intellij/execution/filters/CompositeFilterTest.java
index 2582f93637fb..004ca62f74ce 100644
--- a/platform/lang-api/testSources/com/intellij/execution/filters/CompositeFilterTest.java
+++ b/platform/lang-api/testSources/com/intellij/execution/filters/CompositeFilterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -40,7 +40,7 @@ public class CompositeFilterTest {
}
@Override
- public void runWhenSmart(Runnable runnable) {
+ public void runWhenSmart(@NotNull Runnable runnable) {
}
@Override
@@ -53,7 +53,7 @@ public class CompositeFilterTest {
}
@Override
- public void showDumbModeNotification(String message) {
+ public void showDumbModeNotification(@NotNull String message) {
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java b/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java
index 2f8b7c51533e..1a0235ac9d46 100644
--- a/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java
+++ b/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -30,7 +30,6 @@ import com.intellij.ide.util.PropertiesComponent;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.ListPopupStep;
@@ -53,7 +52,7 @@ import java.awt.event.MouseEvent;
import java.util.*;
import java.util.List;
-class ChooseRunConfigurationPopup implements ExecutorProvider {
+public class ChooseRunConfigurationPopup implements ExecutorProvider {
private final Project myProject;
@NotNull private final String myAddKey;
@@ -304,7 +303,7 @@ class ChooseRunConfigurationPopup implements ExecutorProvider {
}
}
- private abstract static class ItemWrapper extends Wrapper {
+ public abstract static class ItemWrapper extends Wrapper {
private final T myValue;
private boolean myDynamic;
@@ -430,7 +429,7 @@ class ChooseRunConfigurationPopup implements ExecutorProvider {
@NotNull final Project project,
@NotNull final ExecutorProvider executorProvider,
@NotNull final String title) {
- super(title, createSettingsList(project, executorProvider));
+ super(title, createSettingsList(project, executorProvider, true));
myProject = project;
myAction = action;
@@ -456,209 +455,6 @@ class ChooseRunConfigurationPopup implements ExecutorProvider {
return false;
}
- private static ItemWrapper[] createSettingsList(@NotNull final Project project, @NotNull ExecutorProvider executorProvider) {
- final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
-
- final List result = new ArrayList();
-
- final RunnerAndConfigurationSettings selectedConfiguration = manager.getSelectedConfiguration();
-
- if (selectedConfiguration != null) {
- boolean isFirst = true;
- final ExecutionTarget activeTarget = ExecutionTargetManager.getActiveTarget(project);
- for (final ExecutionTarget eachTarget : ExecutionTargetManager.getTargetsToChooseFor(project, selectedConfiguration)) {
- result.add(new ItemWrapper(eachTarget, isFirst) {
- {
- setChecked(eachTarget.equals(activeTarget));
- }
-
- @Override
- public Icon getIcon() {
- return eachTarget.getIcon();
- }
-
- @Override
- public String getText() {
- return eachTarget.getDisplayName();
- }
-
- @Override
- public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
- ExecutionTargetManager.setActiveTarget(project, eachTarget);
- doRunConfiguration(selectedConfiguration, executor, project);
- }
-
- @Override
- public boolean available(Executor executor) {
- return true;
- }
- });
- isFirst = false;
- }
- }
-
-
- final Map wrappedExisting = new LinkedHashMap();
- final ConfigurationType[] types = manager.getConfigurationFactories();
- for (final ConfigurationType type : types) {
- if (!(type instanceof UnknownConfigurationType)) {
- Map> structure = manager.getStructure(type);
- for (final Map.Entry> entry : structure.entrySet()) {
- if (entry.getValue().isEmpty())
- continue;
- final String key = entry.getKey();
- if (key != null){
- boolean isSelected = entry.getValue().contains(selectedConfiguration);
- FolderWrapper folderWrapper = new FolderWrapper(project, executorProvider, key + (isSelected ? " (mnemonic is to \"" + selectedConfiguration.getName()+"\")" : ""), entry.getValue());
- if (isSelected) {
- folderWrapper.setMnemonic(1);
- }
- result.add(folderWrapper);
- }
- else {
- for (RunnerAndConfigurationSettings configuration : entry.getValue()) {
- final ItemWrapper wrapped = ItemWrapper.wrap(project, configuration);
- if (configuration == selectedConfiguration) {
- wrapped.setMnemonic(1);
- }
- wrappedExisting.put(configuration, wrapped);
- }
- }
- }
- }
- }
-
- populateWithDynamicRunners(result, wrappedExisting, project, manager, selectedConfiguration);
- result.addAll(wrappedExisting.values());
-
- //noinspection unchecked
- final ItemWrapper edit = new ItemWrapper(null) {
- @Override
- public Icon getIcon() {
- return AllIcons.Actions.EditSource;
- }
-
- @Override
- public String getText() {
- return UIUtil.removeMnemonic(ActionsBundle.message("action.editRunConfigurations.text"));
- }
-
- @Override
- public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
- final EditConfigurationsDialog dialog = new EditConfigurationsDialog(project) {
- @Override
- protected void init() {
- setOKButtonText(executor.getStartActionText());
- setOKButtonIcon(executor.getIcon());
- myExecutor = executor;
- super.init();
- }
- };
-
- dialog.show();
- if (dialog.isOK()) {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- doRunConfiguration(RunManager.getInstance(project).getSelectedConfiguration(), executor, project);
- }
- });
- }
- }
-
- @Override
- public boolean available(Executor executor) {
- return true;
- }
- };
-
- edit.setMnemonic(0);
- result.add(0, edit);
-
- return result.toArray(new ItemWrapper[result.size()]);
- }
-
- @NotNull
- private static List populateWithDynamicRunners(final List result,
- Map existing,
- final Project project, final RunManagerEx manager,
- final RunnerAndConfigurationSettings selectedConfiguration) {
-
- final ArrayList contextConfigurations = new ArrayList();
- final DataContext dataContext = DataManager.getInstance().getDataContext();
- final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
-
- final List producers = PreferredProducerFind.getConfigurationsFromContext(context.getLocation(),
- context, false);
- if (producers == null) return Collections.emptyList();
-
- Collections.sort(producers, ConfigurationFromContext.NAME_COMPARATOR);
-
- final RunnerAndConfigurationSettings[] preferred = {null};
-
- int i = 2; // selectedConfiguration == null ? 1 : 2;
- for (final ConfigurationFromContext fromContext : producers) {
- final RunnerAndConfigurationSettings configuration = fromContext.getConfigurationSettings();
- if (existing.keySet().contains(configuration)) {
- final ItemWrapper wrapper = existing.get(configuration);
- if (wrapper.getMnemonic() != 1) {
- wrapper.setMnemonic(i);
- i++;
- }
- }
- else {
- if (selectedConfiguration != null && configuration.equals(selectedConfiguration)) continue;
- contextConfigurations.add(configuration);
-
- if (preferred[0] == null) {
- preferred[0] = configuration;
- }
-
- //noinspection unchecked
- final ItemWrapper wrapper = new ItemWrapper(configuration) {
- @Override
- public Icon getIcon() {
- return RunManagerEx.getInstanceEx(project).getConfigurationIcon(configuration);
- }
-
- @Override
- public String getText() {
- return configuration.getName();
- }
-
- @Override
- public boolean available(Executor executor) {
- return canRun(executor, configuration);
- }
-
- @Override
- public void perform(@NotNull Project project, @NotNull Executor executor, @NotNull DataContext context) {
- manager.setTemporaryConfiguration(configuration);
- RunManagerEx.getInstanceEx(project).setSelectedConfiguration(configuration);
- doRunConfiguration(configuration, executor, project);
- }
-
- @Override
- public PopupStep getNextStep(@NotNull final Project project, @NotNull final ChooseRunConfigurationPopup action) {
- return new ConfigurationActionsStep(project, action, configuration, isDynamic());
- }
-
- @Override
- public boolean hasActions() {
- return true;
- }
- };
-
- wrapper.setDynamic(true);
- wrapper.setMnemonic(i);
- result.add(wrapper);
- i++;
- }
- }
-
- return contextConfigurations;
- }
-
@Override
public ListSeparator getSeparatorAbove(ItemWrapper value) {
if (value.addSeparatorAbove()) return new ListSeparator();
@@ -1135,4 +931,212 @@ class ChooseRunConfigurationPopup implements ExecutorProvider {
return !selectedValue.getValues().isEmpty();
}
}
+
+ public static ItemWrapper[] createSettingsList(@NotNull final Project project, @NotNull ExecutorProvider executorProvider, boolean createEditAction) {
+ final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
+
+ final List result = new ArrayList();
+
+ final RunnerAndConfigurationSettings selectedConfiguration = manager.getSelectedConfiguration();
+
+ if (selectedConfiguration != null) {
+ boolean isFirst = true;
+ final ExecutionTarget activeTarget = ExecutionTargetManager.getActiveTarget(project);
+ for (final ExecutionTarget eachTarget : ExecutionTargetManager.getTargetsToChooseFor(project, selectedConfiguration)) {
+ result.add(new ItemWrapper(eachTarget, isFirst) {
+ {
+ setChecked(eachTarget.equals(activeTarget));
+ }
+
+ @Override
+ public Icon getIcon() {
+ return eachTarget.getIcon();
+ }
+
+ @Override
+ public String getText() {
+ return eachTarget.getDisplayName();
+ }
+
+ @Override
+ public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
+ ExecutionTargetManager.setActiveTarget(project, eachTarget);
+ doRunConfiguration(selectedConfiguration, executor, project);
+ }
+
+ @Override
+ public boolean available(Executor executor) {
+ return true;
+ }
+ });
+ isFirst = false;
+ }
+ }
+
+ final Map wrappedExisting = new LinkedHashMap();
+ final ConfigurationType[] types = manager.getConfigurationFactories();
+ for (final ConfigurationType type : types) {
+ if (!(type instanceof UnknownConfigurationType)) {
+ Map> structure = manager.getStructure(type);
+ for (final Map.Entry> entry : structure.entrySet()) {
+ if (entry.getValue().isEmpty())
+ continue;
+ final String key = entry.getKey();
+ if (key != null){
+ boolean isSelected = entry.getValue().contains(selectedConfiguration);
+ FolderWrapper folderWrapper = new FolderWrapper(project, executorProvider, key + (isSelected ? " (mnemonic is to \"" + selectedConfiguration.getName()+"\")" : ""), entry.getValue());
+ if (isSelected) {
+ folderWrapper.setMnemonic(1);
+ }
+ result.add(folderWrapper);
+ }
+ else {
+ for (RunnerAndConfigurationSettings configuration : entry.getValue()) {
+ final ItemWrapper wrapped = ItemWrapper.wrap(project, configuration);
+ if (configuration == selectedConfiguration) {
+ wrapped.setMnemonic(1);
+ }
+ wrappedExisting.put(configuration, wrapped);
+ }
+ }
+ }
+ }
+ }
+
+ populateWithDynamicRunners(result, wrappedExisting, project, manager, selectedConfiguration);
+ result.addAll(wrappedExisting.values());
+
+ //noinspection unchecked
+ final ItemWrapper edit = new ItemWrapper(null) {
+ @Override
+ public Icon getIcon() {
+ return AllIcons.Actions.EditSource;
+ }
+
+ @Override
+ public String getText() {
+ return UIUtil.removeMnemonic(ActionsBundle.message("action.editRunConfigurations.text"));
+ }
+
+ @Override
+ public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
+ final EditConfigurationsDialog dialog = new EditConfigurationsDialog(project) {
+ @Override
+ protected void init() {
+ setOKButtonText(executor.getStartActionText());
+ setOKButtonIcon(executor.getIcon());
+ myExecutor = executor;
+ super.init();
+ }
+ };
+
+ dialog.show();
+ if (dialog.isOK()) {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ doRunConfiguration(RunManager.getInstance(project).getSelectedConfiguration(), executor, project);
+ }
+ });
+ }
+ }
+
+ @Override
+ public boolean available(Executor executor) {
+ return true;
+ }
+ };
+
+ edit.setMnemonic(0);
+ if (createEditAction) {
+ result.add(0, edit);
+ }
+
+ return result.toArray(new ItemWrapper[result.size()]);
+ }
+
+ @NotNull
+ private static List populateWithDynamicRunners(final List result,
+ Map existing,
+ final Project project, final RunManagerEx manager,
+ final RunnerAndConfigurationSettings selectedConfiguration) {
+
+ final ArrayList contextConfigurations = new ArrayList();
+ if (!EventQueue.isDispatchThread()) {
+ return Collections.emptyList();
+ }
+
+ final DataContext dataContext = DataManager.getInstance().getDataContext();
+ final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
+
+ final List producers = PreferredProducerFind.getConfigurationsFromContext(context.getLocation(),
+ context, false);
+ if (producers == null) return Collections.emptyList();
+
+ Collections.sort(producers, ConfigurationFromContext.NAME_COMPARATOR);
+
+ final RunnerAndConfigurationSettings[] preferred = {null};
+
+ int i = 2; // selectedConfiguration == null ? 1 : 2;
+ for (final ConfigurationFromContext fromContext : producers) {
+ final RunnerAndConfigurationSettings configuration = fromContext.getConfigurationSettings();
+ if (existing.keySet().contains(configuration)) {
+ final ItemWrapper wrapper = existing.get(configuration);
+ if (wrapper.getMnemonic() != 1) {
+ wrapper.setMnemonic(i);
+ i++;
+ }
+ }
+ else {
+ if (selectedConfiguration != null && configuration.equals(selectedConfiguration)) continue;
+ contextConfigurations.add(configuration);
+
+ if (preferred[0] == null) {
+ preferred[0] = configuration;
+ }
+
+ //noinspection unchecked
+ final ItemWrapper wrapper = new ItemWrapper(configuration) {
+ @Override
+ public Icon getIcon() {
+ return RunManagerEx.getInstanceEx(project).getConfigurationIcon(configuration);
+ }
+
+ @Override
+ public String getText() {
+ return configuration.getName();
+ }
+
+ @Override
+ public boolean available(Executor executor) {
+ return canRun(executor, configuration);
+ }
+
+ @Override
+ public void perform(@NotNull Project project, @NotNull Executor executor, @NotNull DataContext context) {
+ manager.setTemporaryConfiguration(configuration);
+ RunManagerEx.getInstanceEx(project).setSelectedConfiguration(configuration);
+ doRunConfiguration(configuration, executor, project);
+ }
+
+ @Override
+ public PopupStep getNextStep(@NotNull final Project project, @NotNull final ChooseRunConfigurationPopup action) {
+ return new ConfigurationActionsStep(project, action, configuration, isDynamic());
+ }
+
+ @Override
+ public boolean hasActions() {
+ return true;
+ }
+ };
+
+ wrapper.setDynamic(true);
+ wrapper.setMnemonic(i);
+ result.add(wrapper);
+ i++;
+ }
+ }
+
+ return contextConfigurations;
+ }
}
diff --git a/platform/lang-impl/src/com/intellij/execution/actions/ExecutorProvider.java b/platform/lang-impl/src/com/intellij/execution/actions/ExecutorProvider.java
index 7f0fa25d6704..76ee20454fea 100644
--- a/platform/lang-impl/src/com/intellij/execution/actions/ExecutorProvider.java
+++ b/platform/lang-impl/src/com/intellij/execution/actions/ExecutorProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -20,6 +20,6 @@ import com.intellij.execution.Executor;
/**
* User: Vassiliy.Kudryashov
*/
-interface ExecutorProvider {
+public interface ExecutorProvider {
Executor getExecutor();
}
diff --git a/platform/lang-impl/src/com/intellij/execution/actions/RunConfigurationsComboBoxAction.java b/platform/lang-impl/src/com/intellij/execution/actions/RunConfigurationsComboBoxAction.java
index 7cb6089d963d..0453a5401cbf 100644
--- a/platform/lang-impl/src/com/intellij/execution/actions/RunConfigurationsComboBoxAction.java
+++ b/platform/lang-impl/src/com/intellij/execution/actions/RunConfigurationsComboBoxAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -198,25 +198,6 @@ public class RunConfigurationsComboBoxAction extends ComboBoxAction implements D
}
}
- //final RunnerAndConfigurationSettings[] configurations = runManager.getConfigurationSettingsList(type);
- //ArrayList configurationSettingsList = new ArrayList();
- //int i = 0;
- //for (RunnerAndConfigurationSettings configuration : configurations) {
- // if (configuration.isTemporary()) {
- // configurationSettingsList.add(configuration);
- // }
- // else {
- // configurationSettingsList.add(i++, configuration);
- // }
- //}
- //for (final RunnerAndConfigurationSettings configuration : configurationSettingsList) {
- // //if (runManager.canRunConfiguration(configuration)) {
- // final SelectConfigAction action = new SelectConfigAction(configuration, project);
- //
- // actionGroup.add(action);
- // //}
- //}
-
allActionsGroup.add(actionGroup);
allActionsGroup.addSeparator();
}
@@ -319,7 +300,10 @@ public class RunConfigurationsComboBoxAction extends ComboBoxAction implements D
}
final Presentation presentation = getTemplatePresentation();
presentation.setText(name, false);
- presentation.setDescription("Select " + configuration.getType().getConfigurationTypeDescription() + " '" + name + "'");
+ final ConfigurationType type = configuration.getType();
+ if (type != null) {
+ presentation.setDescription("Select " + type.getConfigurationTypeDescription() + " '" + name + "'");
+ }
updateIcon(presentation);
}
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
index 44b57802e88d..49231e1bf7a4 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
@@ -16,6 +16,11 @@
package com.intellij.ide.actions;
import com.intellij.codeInsight.navigation.NavigationUtil;
+import com.intellij.execution.Executor;
+import com.intellij.execution.ExecutorRegistry;
+import com.intellij.execution.actions.ChooseRunConfigurationPopup;
+import com.intellij.execution.actions.ExecutorProvider;
+import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
@@ -66,6 +71,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.VirtualFilePathWrapper;
import com.intellij.openapi.wm.IdeFocusManager;
+import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.impl.IdeFrameImpl;
@@ -115,6 +121,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
public static final int SEARCH_FIELD_COLUMNS = 25;
private static final int MAX_CLASSES = 6;
private static final int MAX_FILES = 6;
+ private static final int MAX_RUN_CONFIGURATION = 6;
private static final int MAX_TOOL_WINDOWS = 4;
private static final int MAX_SYMBOLS = 6;
private static final int MAX_SETTINGS = 5;
@@ -149,6 +156,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
private AnActionEvent myActionEvent;
private Component myContextComponent;
private CalcThread myCalcThread;
+ private static AtomicBoolean ourShiftIsPressed = new AtomicBoolean(false);
private static AtomicBoolean shift1Pressed = new AtomicBoolean(false);
private static AtomicBoolean shift1Released = new AtomicBoolean(false);
private static AtomicBoolean shift2Pressed = new AtomicBoolean(false);
@@ -170,6 +178,8 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
final int keyCode = keyEvent.getKeyCode();
if (keyCode == KeyEvent.VK_SHIFT) {
+ ourShiftIsPressed.set(event.getID() == KeyEvent.KEY_PRESSED);
+
if (keyEvent.isControlDown() || keyEvent.isAltDown() || keyEvent.isMetaDown()) {
resetState();
return false;
@@ -521,7 +531,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
private void doNavigate(int index) {
final Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(getField().getTextEditor()));
-
+ final Executor executor = ourShiftIsPressed.get()
+ ? DefaultRunExecutor.getRunExecutorInstance()
+ : ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG);
assert project != null;
if (isMoreItem(index)) {
@@ -569,7 +581,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
return;
}
}
- else if (isActionValue(value) || isSetting(value)) {
+ else if (isActionValue(value) || isSetting(value) || isRunConfiguration(value)) {
focusManager.requestDefaultFocus(true);
final Component comp = myContextComponent;
final AnActionEvent event = myActionEvent;
@@ -580,7 +592,12 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
if (c == null) {
c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
}
- GotoActionAction.openOptionOrPerformAction(value, pattern, project, c, event);
+
+ if (isRunConfiguration(value)) {
+ ((ChooseRunConfigurationPopup.ItemWrapper)value).perform(project, executor, DataManager.getInstance().getDataContext(c));
+ } else {
+ GotoActionAction.openOptionOrPerformAction(value, pattern, project, c, event);
+ }
}
});
return;
@@ -665,6 +682,20 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
myHistoryIndex = 0;
myHistoryItem = null;
}
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
+ myList.repaint();
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
+ myList.repaint();
+ }
+ }
});
initSearchField(myPopupField);
myPopupField.setOpaque(false);
@@ -817,7 +848,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
doNavigate(index);
}
}
- }.registerCustomShortcutSet(CustomShortcutSet.fromString("ENTER"), editor, balloon);
+ }.registerCustomShortcutSet(CustomShortcutSet.fromString("ENTER", "shift ENTER"), editor, balloon);
new DumbAwareAction(){
@Override
public void actionPerformed(AnActionEvent e) {
@@ -922,7 +953,8 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
&& myProject != null
&& (((VirtualFile)value).isDirectory()
|| (file = PsiManager.getInstance(myProject).findFile((VirtualFile)value)) != null)) {
- cmp = new GotoFileCellRenderer(Math.min(800, list.getWidth())).getListCellRendererComponent(list, file == null ? value : file, index, isSelected, cellHasFocus);
+ cmp = new GotoFileCellRenderer(Math.min(800, list.getWidth()))
+ .getListCellRendererComponent(list, file == null ? value : file, index, isSelected, cellHasFocus);
} else if (value instanceof PsiElement) {
cmp = myPsiRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
} else {
@@ -979,8 +1011,13 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
String name = myClassModel.getElementName(value);
assert name != null;
append(name);
- }
- else if (isVirtualFile(value)) {
+ } else if (value instanceof ChooseRunConfigurationPopup.ItemWrapper) {
+ final ChooseRunConfigurationPopup.ItemWrapper wrapper = (ChooseRunConfigurationPopup.ItemWrapper)value;
+ append(wrapper.getText());
+ setIcon(wrapper.getIcon());
+ setLocationString(ourShiftIsPressed.get() ? "Run" : "Debug");
+ myLocationIcon = ourShiftIsPressed.get() ? AllIcons.Toolwindows.ToolWindowRun : AllIcons.Toolwindows.ToolWindowDebugger;
+ } else if (isVirtualFile(value)) {
final VirtualFile file = (VirtualFile)value;
if (file instanceof VirtualFilePathWrapper) {
append(((VirtualFilePathWrapper)file).getPresentablePath());
@@ -1102,6 +1139,10 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
return o instanceof OptionDescription;
}
+ private static boolean isRunConfiguration(Object o) {
+ return o instanceof ChooseRunConfigurationPopup.ItemWrapper;
+ }
+
private static boolean isVirtualFile(Object o) {
return o instanceof VirtualFile;
}
@@ -1148,12 +1189,23 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
return;
}
- checkModelsUpToDate(); check();
- buildTopHit(pattern); check();
- buildRecentFiles(pattern); check();
- updatePopup(); check();
- buildToolWindows(pattern); check();
- updatePopup(); check();
+ checkModelsUpToDate(); check();
+ buildTopHit(pattern); check();
+ buildRecentFiles(pattern); check();
+ updatePopup(); check();
+ buildToolWindows(pattern); check();
+ updatePopup(); check();
+
+ if (!DumbServiceImpl.getInstance(project).isDumb()) {
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ public void run() {
+ buildRunConfigurations(pattern);
+ }
+ });
+
+ updatePopup();
+ check();
+ }
if (!DumbServiceImpl.getInstance(project).isDumb()) {
ApplicationManager.getApplication().runReadAction(new Runnable() {
@@ -1387,6 +1439,86 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
}
}
+ private void buildRunConfigurations(String pattern) {
+ final List]