Merge remote branch 'origin/master'

This commit is contained in:
Dmitry Jemerov
2011-12-30 18:39:15 +01:00
64 changed files with 496 additions and 241 deletions
@@ -23,6 +23,7 @@ import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.ui.SpeedSearchBase;
import com.intellij.ui.SpeedSearchComparator;
import com.intellij.ui.TableUtil;
import com.intellij.ui.ToolbarDecorator;
import com.intellij.ui.table.JBTable;
@@ -109,7 +110,7 @@ public class ProcessedModulesTable extends JPanel {
}
}
};
speedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false));
speedSearch.setComparator(new SpeedSearchComparator(false));
}
public void refresh() {
@@ -52,7 +52,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.SpeedSearchBase;
import com.intellij.ui.SpeedSearchComparator;
import com.intellij.ui.TreeSpeedSearch;
import com.sun.jdi.*;
@@ -119,7 +119,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
myProject = project;
final TreeSpeedSearch search = new TreeSpeedSearch(this);
search.setComparator(new SpeedSearchBase.SpeedSearchComparator(false));
search.setComparator(new SpeedSearchComparator(false));
}
protected NodeManagerImpl createNodeManager(Project project) {
@@ -65,6 +65,7 @@ public class PaletteWindow extends JPanel implements DataProvider {
setLayout(new GridLayout(1, 1));
myScrollPane.addMouseListener(new MyScrollPanePopupHandler());
myScrollPane.setBorder(null);
KeyStroke escStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
new ClearActiveItemAction().registerCustomShortcutSet(new CustomShortcutSet(escStroke), myScrollPane);
refreshPalette();
@@ -15,10 +15,12 @@
*/
package com.intellij.codeInsight.completion;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiReference;
import com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference;
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReference;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author peter
@@ -26,25 +28,25 @@ import org.jetbrains.annotations.NotNull;
public class JavaClassReferenceCompletionContributor extends CompletionContributor {
@Override
public void duringCompletion(@NotNull CompletionInitializationContext context) {
PsiReference reference = context.getFile().findReferenceAt(context.getStartOffset());
if (reference instanceof PsiMultiReference) {
for (final PsiReference psiReference : ((PsiMultiReference)reference).getReferences()) {
if (psiReference instanceof JavaClassReference) {
reference = psiReference;
break;
}
}
}
if (reference instanceof JavaClassReference) {
final JavaClassReference classReference = (JavaClassReference)reference;
if (classReference.getExtendClassNames() != null) {
final PsiReference[] references = classReference.getJavaClassReferenceSet().getReferences();
final PsiReference last = references[references.length - 1];
context.setReplacementOffset(last.getRangeInElement().getEndOffset() + last.getElement().getTextRange().getStartOffset());
}
JavaClassReference reference = findJavaClassReference(context.getFile(), context.getStartOffset());
if (reference != null && reference.getExtendClassNames() != null) {
final PsiReference[] references = reference.getJavaClassReferenceSet().getReferences();
final PsiReference last = references[references.length - 1];
context.setReplacementOffset(last.getRangeInElement().getEndOffset() + last.getElement().getTextRange().getStartOffset());
}
}
@Nullable
public static JavaClassReference findJavaClassReference(final PsiFile file, final int offset) {
PsiReference reference = file.findReferenceAt(offset);
if (reference instanceof PsiMultiReference) {
for (final PsiReference psiReference : ((PsiMultiReference)reference).getReferences()) {
if (psiReference instanceof JavaClassReference) {
return (JavaClassReference)psiReference;
}
}
}
return reference instanceof JavaClassReference ? (JavaClassReference)reference : null;
}
}
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.editorActions;
import com.intellij.codeInsight.AutoPopupController;
import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.codeInsight.completion.JavaClassReferenceCompletionContributor;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorModificationUtil;
import com.intellij.openapi.editor.ScrollType;
@@ -37,6 +38,7 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -46,19 +48,6 @@ public class JavaTypedHandler extends TypedHandlerDelegate {
static final TokenSet INVALID_INSIDE_REFERENCE = TokenSet.create(JavaTokenType.SEMICOLON, JavaTokenType.LBRACE, JavaTokenType.RBRACE);
private boolean myJavaLTTyped;
public Result checkAutoPopup(final char charTyped, final Project project, final Editor editor, final PsiFile file) {
if (charTyped == '@' && file instanceof PsiJavaFile) {
autoPopupJavadocLookup(project, editor);
return Result.STOP;
}
if (charTyped == '#' || charTyped == '.') {
autoPopupMemberLookup(project, editor);
return Result.STOP;
}
return Result.CONTINUE;
}
private static void autoPopupMemberLookup(Project project, final Editor editor) {
AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, new Condition<PsiFile>() {
public boolean value(final PsiFile file) {
@@ -79,7 +68,7 @@ public class JavaTypedHandler extends TypedHandlerDelegate {
if (parent instanceof PsiParameterList || parent instanceof PsiParameter) return false;
if (!".".equals(lastElement.getText()) && !"#".equals(lastElement.getText())) {
return false;
return JavaClassReferenceCompletionContributor.findJavaClassReference(file, offset - 1) != null;
}
else{
final PsiElement element = file.findElementAt(offset);
@@ -92,6 +81,14 @@ public class JavaTypedHandler extends TypedHandlerDelegate {
}
public Result beforeCharTyped(final char c, final Project project, final Editor editor, final PsiFile file, final FileType fileType) {
if (c == '@' && file instanceof PsiJavaFile) {
autoPopupJavadocLookup(project, editor);
}
else if (c == '#' || c == '.') {
autoPopupMemberLookup(project, editor);
}
final FileType originalFileType = getOriginalFileType(file);
int offsetBefore = editor.getCaretModel().getOffset();
@@ -143,7 +140,7 @@ public class JavaTypedHandler extends TypedHandlerDelegate {
return Result.CONTINUE;
}
public Result charTyped(final char c, final Project project, final Editor editor, final PsiFile file) {
public Result charTyped(final char c, final Project project, final Editor editor, @NotNull final PsiFile file) {
if (myJavaLTTyped) {
myJavaLTTyped = false;
handleAfterJavaLT(editor, JavaTokenType.LT, JavaTokenType.GT, INVALID_INSIDE_REFERENCE);
@@ -16,11 +16,11 @@
package com.intellij.codeInspection.miscGenerics;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInsight.guess.GuessManager;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.ex.BaseLocalInspectionTool;
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.*;
@@ -36,7 +36,6 @@ import java.util.List;
* @author ven
*/
public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspectionTool {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.miscGenerics.SuspiciousCollectionsMethodCallsInspection");
public boolean REPORT_CONVERTIBLE_METHOD_CALLS = true;
@Nullable
@@ -133,8 +132,17 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect
final IntArrayList indices) {
final PsiExpression[] args = methodCall.getArgumentList().getExpressions();
if (args.length != 1) return null;
PsiType argType = args[0].getType();
return getSuspiciousMethodCallMessage(methodCall, argType, reportConvertibleMethodCalls, patternMethods, indices);
final String plainMessage = getSuspiciousMethodCallMessage(methodCall, argType, reportConvertibleMethodCalls, patternMethods, indices);
if (plainMessage != null) {
final PsiType dfaType = GuessManager.getInstance(methodCall.getProject()).getControlFlowExpressionType(args[0]);
if (dfaType != null && getSuspiciousMethodCallMessage(methodCall, dfaType, reportConvertibleMethodCalls, patternMethods, indices) == null) {
return null;
}
}
return plainMessage;
}
@Nullable
@@ -155,6 +163,7 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect
if (calleeMethod == null) return null;
PsiMethod contextMethod = PsiTreeUtil.getParentOfType(methodCall, PsiMethod.class);
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (patternMethods) {
if (patternMethods.isEmpty()) {
setupPatternMethods(methodCall.getManager(), methodCall.getResolveScope(), patternMethods, indices);
@@ -172,6 +181,8 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect
final PsiClass calleeClass = calleeMethod.getContainingClass();
PsiSubstitutor substitutor = resolveResult.getSubstitutor();
final PsiClass patternClass = patternMethod.getContainingClass();
assert patternClass != null;
assert calleeClass != null;
substitutor = TypeConversionUtil.getClassSubstitutor(patternClass, calleeClass, substitutor);
if (substitutor == null) continue;
@@ -15,6 +15,7 @@
*/
package com.intellij.ide.structureView.impl.java;
import com.intellij.ide.actions.ViewStructureAction;
import com.intellij.ide.structureView.StructureViewModel;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.structureView.TextEditorBasedStructureViewModel;
@@ -23,15 +24,17 @@ import com.intellij.ide.util.treeView.smartTree.Grouper;
import com.intellij.ide.util.treeView.smartTree.NodeProvider;
import com.intellij.ide.util.treeView.smartTree.Sorter;
import com.intellij.psi.*;
import com.intellij.ui.PlaceHolder;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Collection;
public class JavaFileTreeModel extends TextEditorBasedStructureViewModel implements StructureViewModel.ElementInfoProvider {
public class JavaFileTreeModel extends TextEditorBasedStructureViewModel implements StructureViewModel.ElementInfoProvider, PlaceHolder<String> {
private static final Collection<NodeProvider> NODE_PROVIDERS = Arrays.<NodeProvider>asList(new JavaInheritedMembersNodeProvider(),
new JavaAnonymousClassesNodeProvider());
private final PsiJavaFile myFile;
private String myPlace;
public JavaFileTreeModel(@NotNull PsiJavaFile file) {
super(file);
@@ -65,7 +68,11 @@ public class JavaFileTreeModel extends TextEditorBasedStructureViewModel impleme
@NotNull
public Sorter[] getSorters() {
return new Sorter[]{KindSorter.INSTANCE, VisibilitySorter.INSTANCE, AnonymousClassesSorter.INSTANCE, Sorter.ALPHA_SORTER};
return new Sorter[] {
ViewStructureAction.isInStructureViewPopup(this) ? KindSorter.POPUP_INSTANCE : KindSorter.INSTANCE,
VisibilitySorter.INSTANCE,
AnonymousClassesSorter.INSTANCE,
Sorter.ALPHA_SORTER};
}
protected PsiFile getPsiFile() {
@@ -110,4 +117,14 @@ public class JavaFileTreeModel extends TextEditorBasedStructureViewModel impleme
protected Class[] getSuitableClasses() {
return new Class[]{PsiClass.class, PsiMethod.class, PsiField.class, PsiJavaFile.class};
}
@Override
public void setPlace(String place) {
myPlace = place;
}
@Override
public String getPlace() {
return myPlace;
}
}
@@ -25,9 +25,13 @@ import java.util.Comparator;
public class KindSorter implements Sorter {
public static final Sorter INSTANCE = new KindSorter();
public static final Sorter POPUP_INSTANCE = new KindSorter(){{isPopup = true;}};
@NonNls public static final String ID = "KIND";
private static final Comparator COMPARATOR = new Comparator() {
boolean isPopup = false;
private final Comparator COMPARATOR = new Comparator() {
public int compare(final Object o1, final Object o2) {
return getWeight(o1) - getWeight(o2);
}
@@ -37,7 +41,7 @@ public class KindSorter implements Sorter {
return 55;
}
if (value instanceof JavaClassTreeElement) {
return 10;
return isPopup ? 53 : 10;
}
if (value instanceof ClassInitializerTreeElement) {
return 15;
@@ -1,3 +1,4 @@
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
@@ -10,6 +11,6 @@ class Clazz {
}
void foo(List<? extends Number> c) {
c.contains("");
c.contains(<warning descr="'List<? extends Number>' may not contain objects of type 'String'">""</warning>);
}
}
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>Test.java</file>
<line>13</line>
<description>'List&lt;? extends Number&gt;' may not contain objects of type 'String'</description>
</problem>
</problems>
@@ -0,0 +1,11 @@
import java.lang.Integer;
import java.util.Map;
class Clazz {
void f(Map<Integer, String> map, Object o) {
if (o instanceof Integer && map.containsKey(o)) {
System.out.println();
}
}
}
@@ -0,0 +1,12 @@
import java.util.List;
import java.util.ArrayList;
class Clazz {
void foo(List<? extends Number> l) {
boolean b = l.contains(<warning descr="'List<? extends Number>' may not contain objects of type 'String'">""</warning>); }
void bar() {
List<? extends Class<?>> l = new ArrayList<Class<?>>();
Class<?> o = String.class;
int i = l.indexOf(o);
}
}
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>Test.java</file>
<line>6</line>
<description>'List&lt;? extends Number&gt;' may not contain objects of type 'String'</description>
</problem>
</problems>
@@ -1,8 +0,0 @@
import java.util.List;
import java.util.ArrayList;
class Clazz {
void foo(List<? extends Number> l) {
boolean b = l.contains("");
}
}
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
</problems>
@@ -1,8 +0,0 @@
import java.util.List;
import java.util.ArrayList;
class Clazz {
List<? extends Class<?>> l = new ArrayList<Class<?>>();
Class<?> o = String.class;
int i = l.indexOf(o);
}
@@ -1150,5 +1150,16 @@ class Foo {{
myFixture.checkResult 'class Foo extends Abcdefg <caret>'
}
public void testClassNameInProperties() {
myFixture.addClass("package java.langa; public class Abcdefg {}")
myFixture.configureByText 'a.properties', 'key.11=java<caret>'
type '.'
assert lookup
type 'lang'
assert myFixture.lookupElementStrings.size() >= 2
type '.'
assert lookup
}
}
@@ -1,24 +1,23 @@
package com.intellij.codeInspection;
import com.intellij.JavaTestUtil;
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import com.intellij.codeInspection.miscGenerics.SuspiciousCollectionsMethodCallsInspection;
import com.intellij.testFramework.InspectionTestCase;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
public class SuspiciousCollectionMethodCallsTest extends InspectionTestCase {
public class SuspiciousCollectionMethodCallsTest extends LightCodeInsightFixtureTestCase {
private final SuspiciousCollectionsMethodCallsInspection myTool = new SuspiciousCollectionsMethodCallsInspection();
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() + "/inspection";
protected String getBasePath() {
return JavaTestUtil.getRelativeJavaTestDataPath() + "/inspection/suspiciousCalls";
}
private void doTest() throws Exception {
final LocalInspectionToolWrapper tool = new LocalInspectionToolWrapper(myTool);
doTest("suspiciousCalls/" + getTestName(false), tool, "java 1.5");
myFixture.enableInspections(myTool);
myFixture.testHighlighting(getTestName(false) + ".java");
}
public void testWildcardCapture() throws Exception { doTest(); }
public void testUseDfa() throws Exception { doTest(); }
public void testWildcard() throws Exception { doTest(); }
public void testIgnoreConvertible() throws Exception {
myTool.REPORT_CONVERTIBLE_METHOD_CALLS = false;
@@ -20,6 +20,7 @@ import com.intellij.lang.impl.PsiBuilderFactoryImpl;
import com.intellij.mock.*;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.impl.DocumentImpl;
import com.intellij.openapi.extensions.ExtensionPoint;
@@ -34,9 +35,13 @@ import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.StaticGetter;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.openapi.vfs.encoding.EncodingRegistry;
import com.intellij.openapi.vfs.impl.VirtualFileManagerImpl;
import com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem;
import com.intellij.openapi.vfs.local.CoreLocalFileSystem;
import com.intellij.openapi.vfs.newvfs.FileSystemPersistence;
import com.intellij.psi.PsiFileFactory;
import com.intellij.psi.PsiManager;
import com.intellij.psi.impl.*;
@@ -53,6 +58,7 @@ import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.util.CachedValuesManagerImpl;
import com.intellij.util.Function;
import com.intellij.util.messages.impl.MessageBusImpl;
import org.picocontainer.MutablePicoContainer;
import java.lang.reflect.Modifier;
@@ -95,6 +101,22 @@ public class CoreEnvironment {
}
}, null));
registerComponentInstance(appContainer, VirtualFileManager.class,
new VirtualFileManagerImpl(new VirtualFileSystem[] {myLocalFileSystem, myJarFileSystem},
new MessageBusImpl(myApplication, null),
new FileSystemPersistence() {
@Override
public void refresh(boolean asynchronous, Runnable postAction, ModalityState modalityState) {
}
@Override
public int getCheapFileSystemModificationCount() {
return 0;
}
}
)
);
myApplication.registerService(DefaultASTFactory.class, new CoreASTFactory());
myApplication.registerService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl());
myApplication.registerService(ReferenceProvidersRegistry.class, new MockReferenceProvidersRegistry());
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -72,7 +72,7 @@ public class HighlightsExtractor {
if (openTag == -1) {
return null;
}
if (text.charAt(openTag + 1) == '<') {
while (text.charAt(openTag + 1) == '<') {
openTag++;
}
if (text.charAt(openTag + 1) == '/') {
@@ -104,7 +104,7 @@ public class HighlightsExtractor {
sb.append(text.substring(index, text.length()));
break;
}
if (text.charAt(from+1) == '<') {
while (text.charAt(from+1) == '<') {
from++;
}
int to = text.indexOf('>', from+1);
@@ -167,7 +167,9 @@ public class TypedHandler extends TypedActionHandlerBase {
for(TypedHandlerDelegate delegate: delegates) {
final TypedHandlerDelegate.Result result = delegate.checkAutoPopup(charTyped, project, editor, file);
handled = result == TypedHandlerDelegate.Result.STOP;
if (result != TypedHandlerDelegate.Result.CONTINUE) break;
if (result != TypedHandlerDelegate.Result.CONTINUE) {
break;
}
}
if (!handled) {
@@ -8,27 +8,6 @@
<properties/>
<border type="none"/>
<children>
<grid id="c496" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="ed462" binding="myPoweredByPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="none" title-resource-bundle="messages/CodeInsightBundle" title-key="powered.by"/>
<children/>
</grid>
</children>
</grid>
<grid id="596f2" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
@@ -65,13 +44,13 @@
<grid id="3853d" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="none" title-resource-bundle="messages/CodeInsightBundle" title-key="dialog.intention.settings.description.usage.example.title"/>
<border type="none"/>
<children>
<xy id="a6fdd" binding="myAfterPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
@@ -95,7 +74,9 @@
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<properties>
<text value="Before"/>
</properties>
</component>
<component id="967ce" class="com.intellij.ui.TitledSeparator" binding="myAfterSeparator">
<constraints>
@@ -103,10 +84,22 @@
</constraints>
<properties>
<alignmentY value="0.2"/>
<text value="After"/>
</properties>
</component>
</children>
</grid>
<grid id="ed462" binding="myPoweredByPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="none" title-resource-bundle="messages/CodeInsightBundle" title-key="powered.by"/>
<children/>
</grid>
</children>
</grid>
</form>
@@ -181,7 +181,6 @@ public class IntentionDescriptionPanel {
}
usagePanel.reset(exampleUsage.getText(), fileType);
separator.setText(name);
if (!reuse) {
if (i == exampleUsages.length) {
gb.gridwidth = GridBagConstraints.REMAINDER;
@@ -30,8 +30,8 @@
<border type="none"/>
<children/>
</grid>
<grid id="42207" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="5" bottom="5" right="5"/>
<grid id="42207" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="5"/>
<constraints>
<splitpane position="left"/>
</constraints>
@@ -41,20 +41,12 @@
<xy id="c0963" binding="myTreePanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</xy>
<component id="6ba53" class="com.intellij.ui.TitledSeparator">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/CodeInsightBundle" key="dialog.intention.settings.intention.list.title"/>
</properties>
</component>
</children>
</grid>
</children>
@@ -452,7 +452,13 @@ class RunConfigurable extends BaseConfigurable {
group.add(new AnAction(ExecutionBundle.message("run.configuration.edit.default.configuration.settings.button"),
ExecutionBundle.message("run.configuration.edit.default.configuration.settings.button"), EDIT_DEFAULTS_ICON) {
public void actionPerformed(final AnActionEvent e) {
final TreeNode defaults = TreeUtil.findNodeWithObject("Defaults", myTree.getModel(), myRoot);
TreeNode defaults = TreeUtil.findNodeWithObject("Defaults", myTree.getModel(), myRoot);
if (defaults != null) {
final ConfigurationType configurationType = getSelectedConfigurationType();
if (configurationType != null) {
defaults = TreeUtil.findNodeWithObject(configurationType, myTree.getModel(), defaults);
}
}
final DefaultMutableTreeNode defaultsNode = (DefaultMutableTreeNode)defaults;
final TreePath path = TreeUtil.getPath(myRoot, defaultsNode);
myTree.expandPath(path);
@@ -49,10 +49,7 @@ import com.intellij.psi.SmartPsiElementPointer;
import com.intellij.psi.search.ProjectScope;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.search.SearchScope;
import com.intellij.ui.InplaceButton;
import com.intellij.ui.JBTableWithHintProvider;
import com.intellij.ui.SpeedSearchBase;
import com.intellij.ui.TableScrollingUtil;
import com.intellij.ui.*;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.usageView.UsageViewBundle;
import com.intellij.usages.*;
@@ -414,7 +411,7 @@ public class ShowUsagesAction extends AnAction implements PopupAction {
table.getSelectionModel().setSelectionInterval(viewRow, viewRow);
}
};
speedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false));
speedSearch.setComparator(new SpeedSearchComparator(false));
PopupChooserBuilder builder = new PopupChooserBuilder(table);
if (title != null) {
@@ -33,10 +33,13 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.ui.PlaceHolder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ViewStructureAction extends AnAction {
private static final String PLACE = "StructureViewPopup";
public ViewStructureAction() {
setEnabledInModalContext(true);
}
@@ -91,7 +94,16 @@ public class ViewStructureAction extends AnAction {
final StructureViewBuilder structureViewBuilder = fileEditor.getStructureViewBuilder();
if (structureViewBuilder == null) return null;
StructureView structureView = structureViewBuilder.createStructureView(fileEditor, project);
return createStructureViewPopup(structureView.getTreeModel(), editor, project, navigatable, structureView);
final StructureViewModel model = structureView.getTreeModel();
if (model instanceof PlaceHolder) {
//noinspection unchecked
((PlaceHolder)model).setPlace(PLACE);
}
return createStructureViewPopup(model, editor, project, navigatable, structureView);
}
public static boolean isInStructureViewPopup(@NotNull PlaceHolder<String> model) {
return PLACE.equals(model.getPlace());
}
public static FileStructureDialog createStructureViewBasedDialog(final StructureViewModel structureViewModel,
@@ -520,10 +520,11 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
scrollAction = (ScrollFromSourceAction)action;
myActionGroup.remove(scrollAction);
}
//if (action instanceof CollapseAllToolbarAction) {
// collapseAction = (CollapseAllToolbarAction)action;
// myActionGroup.remove(collapseAction);
//}
if (action instanceof CollapseAllToolbarAction) {
collapseAction = (CollapseAllToolbarAction)action;
collapseAction.getTemplatePresentation().setIcon(IconLoader.getIcon("/general/collapseAll.png"));
myActionGroup.remove(collapseAction);
}
}
decorator.setTitleActions(new AnAction[] {scrollAction, collapseAction});
}
@@ -684,7 +685,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
AbstractProjectViewPane pane = getCurrentProjectViewPane();
JTree tree = pane.myTree;
if (tree != null) {
TreeUtil.collapseAll(tree, -1);
TreeUtil.collapseAll(tree, 0);
}
}
@@ -48,10 +48,7 @@ import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.ListScrollingUtil;
import com.intellij.ui.SideBorder;
import com.intellij.ui.SpeedSearchBase;
import com.intellij.ui.*;
import com.intellij.ui.docking.DockManager;
import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.util.ArrayUtil;
@@ -448,7 +445,7 @@ public class FileStructureDialog extends DialogWrapper {
}
ArrayList<Object> filteredElements = new ArrayList<Object>(childElements.length);
SpeedSearchBase.SpeedSearchComparator speedSearchComparator = createSpeedSearchComparator();
SpeedSearchComparator speedSearchComparator = createSpeedSearchComparator();
for (Object child : childElements) {
if (child instanceof AbstractTreeNode) {
@@ -474,8 +471,8 @@ public class FileStructureDialog extends DialogWrapper {
}
}
private static SpeedSearchBase.SpeedSearchComparator createSpeedSearchComparator() {
return new SpeedSearchBase.SpeedSearchComparator(false);
private static SpeedSearchComparator createSpeedSearchComparator() {
return new SpeedSearchComparator(false);
}
private class MyTreeActionsOwner implements TreeActionsOwner {
@@ -33,6 +33,7 @@ import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.DimensionService;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.TextRange;
@@ -43,8 +44,9 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.SpeedSearchBase;
import com.intellij.ui.SpeedSearchComparator;
import com.intellij.ui.TreeSpeedSearch;
import com.intellij.ui.docking.DockManager;
import com.intellij.ui.popup.AbstractPopup;
import com.intellij.ui.speedSearch.ElementFilter;
import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.ui.treeStructure.Tree;
@@ -80,14 +82,14 @@ public class FileStructurePopup implements Disposable {
private final MyTreeActionsOwner myTreeActionsOwner;
private JBPopup myPopup;
@NonNls private static final String ourPropertyKey = "FileStructure.narrowDown";
@NonNls private static final String narrowDownPropertyKey = "FileStructurePopup.narrowDown";
private boolean myShouldNarrowDown = false;
private Tree myTree;
private FilteringTreeBuilder myAbstractTreeBuilder;
private String myTitle;
private TreeSpeedSearch mySpeedSearch;
private SmartTreeStructure myTreeStructure;
private JComponent myPanel;
private int myPrefferedWidth;
public FileStructurePopup(StructureViewModel structureViewModel,
@Nullable Editor editor,
@@ -142,6 +144,8 @@ public class FileStructurePopup implements Disposable {
return myPopup.getContent().getVisibleRect();
}
};
mySpeedSearch.setComparator(new SpeedSearchComparator(false, true));
myAbstractTreeBuilder = new FilteringTreeBuilder(project, myTree, new FileStructurePopupFilter(), myTreeStructure, null) {
@Override
protected boolean validateNode(Object child) {
@@ -158,9 +162,10 @@ public class FileStructurePopup implements Disposable {
}
public void show() {
myPanel = createCenterPanel();
new MnemonicHelper().register(myPanel);
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myPanel, null)
JComponent panel = createCenterPanel();
new MnemonicHelper().register(panel);
boolean shouldSetWidth = DimensionService.getInstance().getSize(getDimensionServiceKey(), myProject) == null;
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, null)
.setTitle(myTitle)
.setResizable(true)
.setFocusable(true)
@@ -171,20 +176,30 @@ public class FileStructurePopup implements Disposable {
Disposer.register(myPopup, myDisposable);
Disposer.register(myPopup, this);
Disposer.register(myPopup, myAbstractTreeBuilder);
myPopup.showInCenterOf(myEditor.getComponent());
myAbstractTreeBuilder.expandAll(new Runnable() {
myPopup.showInBestPositionFor(myEditor);
((AbstractPopup)myPopup).setShowHints(true);
if (shouldSetWidth) {
myPopup.setSize(new Dimension(myPrefferedWidth + 10, myPopup.getSize().height));
}
new Alarm().addRequest(new Runnable() {
@Override
public void run() {
IdeFocusManager.getInstance(myProject).requestFocus(myTree, true);
myAbstractTreeBuilder.queueUpdate().doWhenDone(new Runnable() {
myAbstractTreeBuilder.expandAll(new Runnable() {
@Override
public void run() {
myAbstractTreeBuilder.expandAll(null);
selectPsiElement(getCurrentElement(getPsiFile(myProject)));
IdeFocusManager.getInstance(myProject).requestFocus(myTree, true);
myAbstractTreeBuilder.queueUpdate().doWhenDone(new Runnable() {
@Override
public void run() {
myAbstractTreeBuilder.expandAll(null);
selectPsiElement(getCurrentElement(getPsiFile(myProject)));
}
});
}
});
}
});
}, 100);
final Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, myPopup);
alarm.addRequest(new Runnable() {
String filter = "";
@@ -192,7 +207,7 @@ public class FileStructurePopup implements Disposable {
public void run() {
alarm.cancelAllRequests();
String prefix = mySpeedSearch.getEnteredPrefix();
myTree.getEmptyText().setText("Can't find '" + prefix + "'");
myTree.getEmptyText().setText(StringUtil.isEmpty(prefix) ? "Nothing to show" : "Can't find '" + prefix + "'");
if (prefix == null) prefix = "";
if (!filter.equals(prefix)) {
@@ -254,8 +269,8 @@ public class FileStructurePopup implements Disposable {
public void dispose() {
}
protected String getDimensionServiceKey() {
return DockManager.getInstance(myProject).getDimensionKeyForFocus("#com.intellij.ide.util.FileStructureDialog");
protected static String getDimensionServiceKey() {
return "StructurePopup";
}
@Nullable
@@ -324,7 +339,7 @@ public class FileStructurePopup implements Disposable {
for (FileStructureNodeProvider provider : fileStructureNodeProviders) {
addCheckbox(comboPanel, provider);
}
myPrefferedWidth = Math.max(comboPanel.getPreferredSize().width, 350);
panel.add(comboPanel, BorderLayout.NORTH);
panel.add(ScrollPaneFactory.createScrollPane(myAbstractTreeBuilder.getTree()), BorderLayout.CENTER);
panel.add(createSouthPanel(), BorderLayout.SOUTH);
@@ -375,12 +390,12 @@ public class FileStructurePopup implements Disposable {
}
private JComponent createSouthPanel() {
final JCheckBox checkBox = new JCheckBox(IdeBundle.message("checkbox.narrow.down.the.list.on.typing"));
checkBox.setSelected(PropertiesComponent.getInstance().isTrueValue(ourPropertyKey));
final JCheckBox checkBox = new JCheckBox(IdeBundle.message("checkbox.narrow.down.on.typing"));
checkBox.setSelected(PropertiesComponent.getInstance().getBoolean(narrowDownPropertyKey, true));
checkBox.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
myShouldNarrowDown = checkBox.isSelected();
PropertiesComponent.getInstance().setValue(ourPropertyKey, Boolean.toString(myShouldNarrowDown));
PropertiesComponent.getInstance().setValue(narrowDownPropertyKey, Boolean.toString(myShouldNarrowDown));
myAbstractTreeBuilder.queueUpdate();
}
@@ -463,13 +478,13 @@ public class FileStructurePopup implements Disposable {
}
}
private class MyFilter extends ElementFilter.Active.Impl<StructureViewComponent.StructureViewTreeElementWrapper> {
@Override
public boolean shouldBeShowing(StructureViewComponent.StructureViewTreeElementWrapper value) {
return true;
}
}
//private class MyFilter extends ElementFilter.Active.Impl<StructureViewComponent.StructureViewTreeElementWrapper> {
//
// @Override
// public boolean shouldBeShowing(StructureViewComponent.StructureViewTreeElementWrapper value) {
// return true;
// }
//}
private class FileStructurePopupFilter implements ElementFilter {
@@ -328,7 +328,7 @@ public class MemberChooser<T extends ClassMember> extends DialogWrapper implemen
return delegate.getText();
}
});
treeSpeedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false));
treeSpeedSearch.setComparator(new SpeedSearchComparator(false));
treeSpeedSearch.addChangeListener(new PropertyChangeListener() {
@Override
@@ -128,7 +128,7 @@ public class RegistryUi implements Disposable {
tb.setTargetComponent(myTable);
myContent.add(tb.getComponent(), BorderLayout.NORTH);
new TableSpeedSearch(myTable).setComparator(new SpeedSearchBase.SpeedSearchComparator(false));
new TableSpeedSearch(myTable).setComparator(new SpeedSearchComparator(false));
}
@@ -17,6 +17,7 @@ package com.intellij.openapi.actionSystem;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.PlaceProvider;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
@@ -32,7 +33,7 @@ import java.util.Map;
* @see AnAction#update(AnActionEvent)
*/
public class AnActionEvent {
public class AnActionEvent implements PlaceProvider<String> {
private final InputEvent myInputEvent;
private final ActionManager myActionManager;
@NotNull private final DataContext myDataContext;
@@ -546,7 +546,7 @@ public class Messages {
public static String showInputDialog(Project project,
@Nls String message,
@Nls String title,
Icon icon,
@Nullable Icon icon,
@NonNls String initialValue,
@Nullable InputValidator validator) {
if (isApplicationInUnitTestOrHeadless()) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -15,12 +15,9 @@
*/
package com.intellij.ui;
import javax.swing.*;
/**
* @deprecated use {@link com.intellij.ui.treeStructure.Tree} instead
* @author Konstantin Bulenkov
*/
public class TreeToolTipHandler {
public static void install(JTree tree) {
}
public interface PlaceHolder<Place> extends PlaceProvider<Place> {
void setPlace(Place place);
}
@@ -0,0 +1,23 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ui;
/**
* @author Konstantin Bulenkov
*/
public interface PlaceProvider<Place> {
Place getPlace();
}
@@ -18,6 +18,7 @@ package com.intellij.ui.tabs;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.util.IconLoader;
import com.intellij.ui.PlaceProvider;
import com.intellij.ui.SimpleColoredText;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.content.AlertIcon;
@@ -31,7 +32,7 @@ import java.beans.PropertyChangeSupport;
import java.lang.ref.WeakReference;
import java.util.Map;
public final class TabInfo implements Queryable {
public final class TabInfo implements Queryable, PlaceProvider<String> {
public static final String ACTION_GROUP = "actionGroup";
public static final String ICON = "icon";
@@ -112,7 +112,7 @@ public class FilteringTreeBuilder extends AbstractTreeBuilder {
refilter(null, true, false);
}
public ActionCallback refilter(final Object preferredSelection, final boolean adjustSelection, final boolean now) {
public ActionCallback refilter(@Nullable final Object preferredSelection, final boolean adjustSelection, final boolean now) {
if (myRefilterQueue != null) {
myRefilterQueue.cancelAllUpdates();
}
@@ -134,7 +134,7 @@ public class ElementsChooser<T> extends JPanel implements ComponentWithEmptyText
}
}
};
speedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false));
speedSearch.setComparator(new SpeedSearchComparator(false));
setElements(elements, marked);
installActions(myTable);
}
@@ -18,6 +18,7 @@ package com.intellij.ui;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.popup.AbstractPopup;
import com.intellij.util.Alarm;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -213,7 +214,19 @@ abstract public class AbstractExpandableItemsHandler<KeyType, ComponentType exte
private boolean isPopup() {
Window window = SwingUtilities.getWindowAncestor(myComponent);
return window != null && !(window instanceof Dialog || window instanceof Frame);
return window != null
&& !(window instanceof Dialog || window instanceof Frame)
&& !isHintsAllowed(window);
}
private static boolean isHintsAllowed(Window window) {
if (window instanceof RootPaneContainer) {
final JRootPane pane = ((RootPaneContainer)window).getRootPane();
if (pane != null) {
return Boolean.TRUE.equals(pane.getClientProperty(AbstractPopup.SHOW_HINTS));
}
}
return false;
}
private void hideHint() {
@@ -27,7 +27,6 @@ import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.openapi.wm.ex.ToolWindowManagerAdapter;
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
import com.intellij.openapi.wm.ex.ToolWindowManagerListener;
import com.intellij.psi.codeStyle.NameUtil;
import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
@@ -163,34 +162,6 @@ public abstract class SpeedSearchBase<Comp extends JComponent> extends SpeedSear
myComparator = comparator;
}
public static class SpeedSearchComparator {
private NameUtil.MinusculeMatcher myMinusculeMatcher;
private String myRecentSearchText;
private boolean myShouldMatchFromTheBeginning;
public SpeedSearchComparator() {
this(true);
}
public SpeedSearchComparator(boolean shouldMatchFromTheBeginning) {
myShouldMatchFromTheBeginning = shouldMatchFromTheBeginning;
}
@Nullable
public Iterable<TextRange> matchingFragments(String pattern, String text) {
if (myRecentSearchText == null || !myRecentSearchText.equals(pattern)) {
myRecentSearchText = pattern;
myMinusculeMatcher = new NameUtil.MinusculeMatcher(myShouldMatchFromTheBeginning ? pattern : "*" + pattern, NameUtil.MatchingCaseSensitivity.NONE);
}
return myMinusculeMatcher.matchingFragments(text);
}
public String getRecentSearchText() {
return myRecentSearchText;
}
}
@Nullable
private Object findNextElement(String s) {
final String _s = s.trim();
@@ -0,0 +1,64 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ui;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.codeStyle.NameUtil;
import org.jetbrains.annotations.Nullable;
/**
* @author Konstantin Bulenkov
*/
public class SpeedSearchComparator {
private NameUtil.MinusculeMatcher myMinusculeMatcher;
private String myRecentSearchText;
private boolean myShouldMatchFromTheBeginning;
private boolean myShouldMatchCamelCase;
public SpeedSearchComparator() {
this(true);
}
public SpeedSearchComparator(boolean shouldMatchFromTheBeginning) {
this(shouldMatchFromTheBeginning, false);
}
public SpeedSearchComparator(boolean shouldMatchFromTheBeginning, boolean shouldMatchCamelCase) {
myShouldMatchFromTheBeginning = shouldMatchFromTheBeginning;
myShouldMatchCamelCase = shouldMatchCamelCase;
}
@Nullable
public Iterable<TextRange> matchingFragments(String pattern, String text) {
if (myRecentSearchText == null || !myRecentSearchText.equals(pattern)) {
myRecentSearchText = pattern;
if (myShouldMatchCamelCase) {
pattern = StringUtil.join(NameUtil.nameToWords(pattern), "*");
}
if (!myShouldMatchFromTheBeginning && !pattern.startsWith("*")) {
pattern = "*" + pattern;
}
myMinusculeMatcher = new NameUtil.MinusculeMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE);
}
return myMinusculeMatcher.matchingFragments(text);
}
public String getRecentSearchText() {
return myRecentSearchText;
}
}
@@ -62,6 +62,7 @@ public class AbstractPopup implements JBPopup {
private static final Image ourMacCorner = ImageLoader.loadFromResource("/general/macCorner.png");
private static final Object SUPPRESS_MAC_CORNER = new Object();
public static final String SHOW_HINTS = "ShowHints";
private PopupComponent myPopup;
private MyContentPanel myContent;
@@ -322,6 +323,16 @@ public class AbstractPopup implements JBPopup {
return true;
}
public void setShowHints(boolean show) {
final Window ancestor = SwingUtilities.getWindowAncestor(myComponent);
if (ancestor instanceof RootPaneContainer) {
final JRootPane rootPane = ((RootPaneContainer)ancestor).getRootPane();
if (rootPane != null) {
rootPane.putClientProperty(SHOW_HINTS, Boolean.valueOf(show));
}
}
}
public static void suppressMacCornerFor(JComponent popupComponent) {
popupComponent.putClientProperty(SUPPRESS_MAC_CORNER, Boolean.TRUE);
}
@@ -800,6 +800,7 @@ action.show.classes=Show Classes
action.expand.all=Expand All
action.collapse.all=Collapse All
checkbox.narrow.down.the.list.on.typing=&Narrow &&down the list on typing
checkbox.narrow.down.on.typing=&Narrow &&down on typing
node.default=<default>
node.default.package=<Default Package>
prompt.enter.a.new.package.name=Enter a new package name:
@@ -149,8 +149,6 @@ jvmbugfix.mac.caccessibleLeak=true
projectView.showHierarchyErrors=true
projectView.hide.dot.idea=true
dir.diff.default.src.folder=
dir.diff.default.trg.folder=
show.live.templates.in.completion=false
documentation.component.editor.font=false
@@ -163,13 +161,9 @@ ide.enable.toolwindow.stack=false
change.signature.awesome.mode=true
change.signature.awesome.mode.description=Enables list view for change signature
navbar.is.decorated=true
navbar.is.decorated.description=NavBar with decorations
show.anonymous.in.structure.view=false
show.anonymous.in.structure.view.description=Enables Java anonymous classes in Structure View
enable.groovy.hotswap=true
enable.groovy.hotswap.description=Whether IDEA should add a special java agent to the debugged process which allows to hot-swap Groovy changes in some cases
file.structure.tree.mode=false
file.structure.tree.mode=true
rename.preselect=true
@@ -22,12 +22,13 @@ import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeList;
import com.intellij.openapi.vcs.ui.Refreshable;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.PlaceProvider;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Collection;
public interface VcsContext {
public interface VcsContext extends PlaceProvider<String> {
Project getProject();
@Nullable
@@ -45,8 +46,6 @@ public interface VcsContext {
Refreshable getRefreshableDialog();
String getPlace();
File getSelectedIOFile();
FilePath[] getSelectedFilePaths();
@@ -23,6 +23,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.EditorSettings;
import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.DumbAwareRunnable;
@@ -396,6 +397,7 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
editorSettings.setLineNumbersShown(false);
editorSettings.setFoldingOutlineShown(false);
((EditorImpl)editor).getScrollPane().setBorder(null);
myEditorAdapter = new EditorAdapter(editor, myProject);
final JPanel panel = new JPanel(new BorderLayout());
panel.add(editor.getComponent(), BorderLayout.CENTER);
@@ -148,7 +148,9 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton implements Di
}
protected JComponent createCenterPanel() {
myCenterPanel.add(CARD_STATUS, ScrollPaneFactory.createScrollPane(myTree));
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
myCenterPanel.add(CARD_STATUS, scrollPane);
myTreeBrowser = new CommittedChangesTreeBrowser(myProject, Collections.<CommittedChangeList>emptyList());
Disposer.register(this, myTreeBrowser);
myTreeBrowser.setHelpId(getHelpId());
@@ -142,6 +142,11 @@ public class GradleScriptType extends GroovyScriptType {
@Override
public GroovyScriptRunner getRunner() {
return new GroovyScriptRunner() {
@Override
public boolean shouldRefreshAfterFinish() {
return true;
}
@Override
public boolean isValidModule(@NotNull Module module) {
GradleLibraryManager libraryManager = ServiceManager.getService(GradleLibraryManager.class);
@@ -40,6 +40,10 @@ import java.io.File;
* @author ilyas
*/
public class GantRunner extends GroovyScriptRunner {
@Override
public boolean shouldRefreshAfterFinish() {
return true;
}
@Override
public boolean isValidModule(@NotNull Module module) {
@@ -21,8 +21,12 @@ import com.intellij.execution.ExecutionException;
import com.intellij.execution.Executor;
import com.intellij.execution.configurations.*;
import com.intellij.execution.filters.TextConsoleBuilderFactory;
import com.intellij.execution.process.OSProcessHandler;
import com.intellij.execution.process.ProcessAdapter;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.util.ProgramParametersUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PathMacroManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
@@ -40,6 +44,7 @@ import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
@@ -180,6 +185,24 @@ public class GroovyScriptRunConfiguration extends ModuleBasedConfiguration<RunCo
final boolean tests = ProjectRootManager.getInstance(getProject()).getFileIndex().isInTestSourceContent(script);
final JavaCommandLineState state = new JavaCommandLineState(environment) {
@NotNull
@Override
protected OSProcessHandler startProcess() throws ExecutionException {
final OSProcessHandler handler = super.startProcess();
if (scriptRunner.shouldRefreshAfterFinish()) {
handler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
if (!ApplicationManager.getApplication().isDisposed()) {
VirtualFileManager.getInstance().refresh(true);
}
}
});
}
return handler;
}
protected JavaParameters createJavaParameters() throws ExecutionException {
JavaParameters params = createJavaParametersWithSdk(module);
ProgramParametersUtil.configureConfiguration(params, GroovyScriptRunConfiguration.this);
@@ -51,6 +51,10 @@ public abstract class GroovyScriptRunner {
public abstract void configureCommandLine(JavaParameters params, @Nullable Module module, boolean tests, VirtualFile script,
GroovyScriptRunConfiguration configuration) throws CantRunException;
public boolean shouldRefreshAfterFinish() {
return false;
}
protected static String getConfPath(final String groovyHomePath) {
String confpath = FileUtil.toSystemDependentName(groovyHomePath + "/conf/groovy-starter.conf");
if (new File(confpath).exists()) {
@@ -157,7 +157,7 @@ public class MavenModuleWizardStep extends ModuleWizardStep {
MavenArchetype info = getArchetypeInfoFromPathComponent(path.getLastPathComponent());
return info.groupId + ":" + info.artifactId + ":" + info.version;
}
}).setComparator(new SpeedSearchBase.SpeedSearchComparator(false));
}).setComparator(new SpeedSearchComparator(false));
myArchetypeDescriptionField.setEditable(false);
myArchetypeDescriptionField.setBackground(UIUtil.getPanelBackground());
@@ -15,9 +15,7 @@
<component>
<interface-class>com.intellij.tasks.TaskManager</interface-class>
<implementation-class>com.intellij.tasks.impl.TaskManagerImpl</implementation-class>
<skipForDefaultProject/>
</component>
</project-components>
<actions>
@@ -111,6 +109,7 @@
<tasks.repositoryType implementation="com.intellij.tasks.redmine.RedmineRepositoryType"/>
<tasks.repositoryType implementation="com.intellij.tasks.trac.TracRepositoryType"/>
<checkinHandlerFactory implementation="com.intellij.tasks.impl.TaskCheckinHandlerFactory"/>
<!--<tasks.repositoryType implementation="com.intellij.tasks.mantis.MantisRepositoryType"/>-->
</extensions>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.tasks.config.TaskConfigurable">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="555" height="400"/>
@@ -10,10 +10,10 @@
<children>
<component id="e53da" class="javax.swing.JCheckBox" binding="myUpdateCheckBox" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Enable issue cache"/>
<text value="Enable issue &amp;cache"/>
</properties>
</component>
<component id="9f69d" class="javax.swing.JFormattedTextField" binding="myHistoryLength">
@@ -33,18 +33,18 @@
</constraints>
<properties>
<horizontalAlignment value="4"/>
<text value="Task history length:"/>
<text value="Task history &amp;length:"/>
</properties>
</component>
<vspacer id="3f700">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="e4d1f" binding="myCacheSettings" layout-manager="GridLayoutManager" row-count="1" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
@@ -111,6 +111,14 @@
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="6f93" class="javax.swing.JCheckBox" binding="mySaveContextOnCommit">
<constraints>
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Save context on commit"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -41,6 +41,9 @@ public class TaskConfigurable extends BindableConfigurable implements Searchable
private JTextField myHistoryLength;
private JPanel myCacheSettings;
@BindControl("saveContextOnCommit")
private JCheckBox mySaveContextOnCommit;
private final Project myProject;
private Configurable[] myConfigurables;
private final NotNullLazyValue<ControlBinder> myControlBinder = new NotNullLazyValue<ControlBinder>() {
@@ -107,7 +107,7 @@ public class WorkingContextManager {
saveContext(entryName, TASKS_ZIP_POSTFIX, task.getSummary());
}
public void saveContext(String entryName, @Nullable String comment) {
public void saveContext(@Nullable String entryName, @Nullable String comment) {
saveContext(entryName, CONTEXT_ZIP_POSTFIX, comment);
}
@@ -0,0 +1,57 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.tasks.impl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.CheckinProjectPanel;
import com.intellij.openapi.vcs.changes.CommitContext;
import com.intellij.openapi.vcs.checkin.CheckinHandler;
import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory;
import com.intellij.tasks.TaskManager;
import com.intellij.tasks.context.WorkingContextManager;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* @author Dmitry Avdeev
* Date: 12/29/11
*/
public class TaskCheckinHandlerFactory extends CheckinHandlerFactory {
@NotNull
@Override
public CheckinHandler createHandler(final CheckinProjectPanel panel, final CommitContext commitContext) {
return new CheckinHandler() {
@Override
public void checkinSuccessful() {
final String message = panel.getCommitMessage();
if (message != null) {
final Project project = panel.getProject();
TaskManagerImpl manager = (TaskManagerImpl)TaskManager.getManager(project);
if (manager.getState().saveContextOnCommit) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
WorkingContextManager.getInstance(project).saveContext(null, message);
}
});
}
}
}
};
}
}
@@ -782,6 +782,7 @@ public class TaskManagerImpl extends TaskManager implements ProjectComponent, Pe
public boolean clearContext = true;
public boolean createChangelist = true;
public boolean saveContextOnCommit = true;
public boolean trackContextForNewChangelist = true;
public boolean markAsInProgress = false;
@@ -18,7 +18,9 @@ package com.intellij.uiDesigner.propertyInspector;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ex.MultiLineLabel;
import com.intellij.openapi.util.Comparing;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.SideBorder;
import com.intellij.uiDesigner.UIDesignerBundle;
import com.intellij.uiDesigner.componentTree.ComponentSelectionListener;
import com.intellij.uiDesigner.componentTree.ComponentTree;
@@ -65,6 +67,7 @@ public final class PropertyInspector extends JPanel{
// Card with property inspector
final JPanel inspectorCard = new JPanel(new GridBagLayout());
final JScrollPane inspectorScrollPane = ScrollPaneFactory.createScrollPane(myInspectorTable);
inspectorScrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
inspectorCard.add(inspectorScrollPane,
new GridBagConstraints(0, 0, 0, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)
);
@@ -31,7 +31,9 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.SideBorder;
import com.intellij.uiDesigner.UIDesignerBundle;
import com.intellij.uiDesigner.componentTree.ComponentTree;
import com.intellij.uiDesigner.componentTree.ComponentTreeBuilder;
@@ -95,6 +97,7 @@ public class UIDesignerToolWindowManager implements ProjectComponent {
}
myPendingListeners.clear();
final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myComponentTree);
scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
scrollPane.setPreferredSize(new Dimension(250, -1));
myComponentTree.initQuickFixManager(scrollPane.getViewport());
myPropertyInspector= new PropertyInspector(myProject, myComponentTree);
@@ -59,9 +59,10 @@ public final class DataBindingWizard extends AbstractWizard{
}
protected void updateStep() {
super.updateStep();
// "Finish" button is enabled only at the last step
getFinishButton().setEnabled(getCurrentStep() == mySteps.size() - 1);
getFinishButton().setEnabled(isLastStep());
super.updateStep();
}
protected void doOKAction() {