From 3b281d3e7e5681bb3d1710df798ff37c33bcc0fe Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Wed, 22 Oct 2014 15:39:46 +0400 Subject: [PATCH 01/64] screen mode -> view mode --- .../src/messages/ActionsBundle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index f80f272c8933..81e770d767b3 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -1009,8 +1009,8 @@ action.ChangeKeymap.text=Keymap action.ChangeKeymap.description=Change current keymap action.ChangeLaf.text=Look and Feel action.ChangeLaf.description=Change current Look\\&Feel -action.ChangeView.text=Screen Mode -action.ChangeView.description=Change screen mode +action.ChangeView.text=View Mode +action.ChangeView.description=Change view mode action.ChangeInspectionProfile.text=Switch Error Highlighting action.ChangeInspectionProfile.description=Change current editor inspection profile action.ChangeCustomizationSchema.text=Switch Customization Scheme From 9821cbab0304ac6a0630f8248bab5dde54cfbab4 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 22 Oct 2014 13:41:06 +0200 Subject: [PATCH 02/64] dfa live var analysis should honor variables read in closures (IDEA-131719) --- .../dataFlow/DataFlowRunner.java | 23 +---- .../codeInspection/dataFlow/DfaUtil.java | 24 ++++- .../dataFlow/LiveVariablesAnalyzer.java | 95 +++++++++++++------ .../DontFlushVariablesUsedInClosures.java | 19 ++++ .../DataFlowInspectionTest.java | 1 + 5 files changed, 111 insertions(+), 51 deletions(-) create mode 100644 java/java-tests/testData/inspection/dataFlow/fixture/DontFlushVariablesUsedInClosures.java diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java index 6db340c5ea10..6eeb6414ff22 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java @@ -222,24 +222,11 @@ public class DataFlowRunner { protected DfaInstructionState[] acceptInstruction(InstructionVisitor visitor, DfaInstructionState instructionState) { Instruction instruction = instructionState.getInstruction(); - if (instruction instanceof MethodCallInstruction) { - PsiCallExpression anchor = ((MethodCallInstruction)instruction).getCallExpression(); - if (anchor instanceof PsiNewExpression) { - PsiAnonymousClass anonymousClass = ((PsiNewExpression)anchor).getAnonymousClass(); - if (anonymousClass != null) { - registerNestedClosures(instructionState, anonymousClass); - } - } - } - else if (instruction instanceof LambdaInstruction) { - PsiLambdaExpression lambdaExpression = ((LambdaInstruction)instruction).getLambdaExpression(); - registerNestedClosures(instructionState, lambdaExpression); - } - else if (instruction instanceof EmptyInstruction) { - PsiElement anchor = ((EmptyInstruction)instruction).getAnchor(); - if (anchor instanceof PsiClass) { - registerNestedClosures(instructionState, (PsiClass)anchor); - } + PsiElement closure = DfaUtil.getClosureInside(instruction); + if (closure instanceof PsiClass) { + registerNestedClosures(instructionState, (PsiClass)closure); + } else if (closure instanceof PsiLambdaExpression) { + registerNestedClosures(instructionState, (PsiLambdaExpression)closure); } return instruction.accept(this, instructionState.getMemoryState(), visitor); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaUtil.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaUtil.java index d147c270c1c5..6bb70010c9ca 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaUtil.java @@ -15,9 +15,7 @@ */ package com.intellij.codeInspection.dataFlow; -import com.intellij.codeInspection.dataFlow.instructions.AssignInstruction; -import com.intellij.codeInspection.dataFlow.instructions.Instruction; -import com.intellij.codeInspection.dataFlow.instructions.PushInstruction; +import com.intellij.codeInspection.dataFlow.instructions.*; import com.intellij.codeInspection.dataFlow.value.DfaValue; import com.intellij.codeInspection.dataFlow.value.DfaVariableValue; import com.intellij.openapi.util.MultiValuesMap; @@ -113,6 +111,26 @@ public class DfaUtil { return Collections.emptyList(); } + @Nullable + static PsiElement getClosureInside(Instruction instruction) { + if (instruction instanceof MethodCallInstruction) { + PsiCallExpression anchor = ((MethodCallInstruction)instruction).getCallExpression(); + if (anchor instanceof PsiNewExpression) { + return ((PsiNewExpression)anchor).getAnonymousClass(); + } + } + else if (instruction instanceof LambdaInstruction) { + return ((LambdaInstruction)instruction).getLambdaExpression(); + } + else if (instruction instanceof EmptyInstruction) { + PsiElement anchor = ((EmptyInstruction)instruction).getAnchor(); + if (anchor instanceof PsiClass) { + return anchor; + } + } + return null; + } + private static class ValuableInstructionVisitor extends StandardInstructionVisitor { final Map myResults = ContainerUtil.newHashMap(); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/LiveVariablesAnalyzer.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/LiveVariablesAnalyzer.java index 55709d71ca49..937caa84e24d 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/LiveVariablesAnalyzer.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/LiveVariablesAnalyzer.java @@ -21,10 +21,11 @@ import com.intellij.codeInspection.dataFlow.value.DfaValueFactory; import com.intellij.codeInspection.dataFlow.value.DfaVariableValue; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.util.Pair; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiRecursiveElementWalkingVisitor; +import com.intellij.psi.PsiReferenceExpression; import com.intellij.util.PairFunction; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.containers.FilteringIterator; -import com.intellij.util.containers.MultiMap; +import com.intellij.util.containers.*; import com.intellij.util.containers.Queue; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,6 +40,26 @@ public class LiveVariablesAnalyzer { private final Instruction[] myInstructions; private final MultiMap myForwardMap; private final MultiMap myBackwardMap; + @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") private final FactoryMap> myClosureReads = new FactoryMap>() { + @Nullable + @Override + protected List create(PsiElement closure) { + final Set result = ContainerUtil.newLinkedHashSet(); + closure.accept(new PsiRecursiveElementWalkingVisitor() { + @Override + public void visitElement(PsiElement element) { + if (element instanceof PsiReferenceExpression) { + DfaValue value = myFactory.createValue((PsiReferenceExpression)element); + if (value instanceof DfaVariableValue) { + result.add((DfaVariableValue)value); + } + } + super.visitElement(element); + } + }); + return ContainerUtil.newArrayList(result); + } + }; public LiveVariablesAnalyzer(ControlFlow flow, DfaValueFactory factory) { myFactory = factory; @@ -96,12 +117,36 @@ public class LiveVariablesAnalyzer { return result; } + @Nullable + private static DfaVariableValue getWrittenVariable(Instruction instruction) { + if (instruction instanceof AssignInstruction) { + DfaValue value = ((AssignInstruction)instruction).getAssignedValue(); + return value instanceof DfaVariableValue ? (DfaVariableValue)value : null; + } + if (instruction instanceof FlushVariableInstruction) return ((FlushVariableInstruction)instruction).getVariable(); + return null; + } + + @NotNull + private List getReadVariables(Instruction instruction) { + if (instruction instanceof PushInstruction && !((PushInstruction)instruction).isReferenceWrite()) { + DfaValue value = ((PushInstruction)instruction).getValue(); + if (value instanceof DfaVariableValue) { + return Collections.singletonList((DfaVariableValue)value); + } + } else { + PsiElement closure = DfaUtil.getClosureInside(instruction); + if (closure != null) { + return myClosureReads.get(closure); + } + } + return Collections.emptyList(); + } + private boolean isInterestingInstruction(Instruction instruction) { if (instruction == myInstructions[0]) return true; - if (instruction instanceof PushInstruction) return ((PushInstruction)instruction).getValue() instanceof DfaVariableValue; - if (instruction instanceof AssignInstruction) return ((AssignInstruction)instruction).getAssignedValue() != null; + if (!getReadVariables(instruction).isEmpty() || getWrittenVariable(instruction) != null) return true; return instruction instanceof FinishElementInstruction || - instruction instanceof FlushVariableInstruction || instruction instanceof GotoInstruction || instruction instanceof ConditionalGotoInstruction || instruction instanceof ReturnInstruction; @@ -124,34 +169,24 @@ public class LiveVariablesAnalyzer { } } - if (instruction instanceof AssignInstruction) { - DfaValue value = ((AssignInstruction)instruction).getAssignedValue(); - if (value instanceof DfaVariableValue) { - liveVars = (BitSet)liveVars.clone(); - liveVars.clear(value.getID()); - for (DfaVariableValue var : myFactory.getVarFactory().getAllQualifiedBy((DfaVariableValue)value)) { - liveVars.clear(var.getID()); - } + DfaVariableValue written = getWrittenVariable(instruction); + if (written != null) { + liveVars = (BitSet)liveVars.clone(); + liveVars.clear(written.getID()); + for (DfaVariableValue var : myFactory.getVarFactory().getAllQualifiedBy(written)) { + liveVars.clear(var.getID()); } - } - - if (instruction instanceof PushInstruction) { - DfaValue value = ((PushInstruction)instruction).getValue(); - if (value instanceof DfaVariableValue) { - if (!((PushInstruction)instruction).isReferenceWrite() && !liveVars.get(value.getID())) { - liveVars = (BitSet)liveVars.clone(); + } else { + boolean cloned = false; + for (DfaVariableValue value : getReadVariables(instruction)) { + if (!liveVars.get(value.getID())) { + if (!cloned) { + liveVars = (BitSet)liveVars.clone(); + cloned = true; + } liveVars.set(value.getID()); } } - } else if (instruction instanceof FlushVariableInstruction) { - DfaVariableValue variable = ((FlushVariableInstruction)instruction).getVariable(); - if (variable != null) { - liveVars = (BitSet)liveVars.clone(); - liveVars.clear(variable.getID()); - for (DfaVariableValue var : myFactory.getVarFactory().getAllQualifiedBy(variable)) { - liveVars.clear(var.getID()); - } - } } return liveVars; diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/DontFlushVariablesUsedInClosures.java b/java/java-tests/testData/inspection/dataFlow/fixture/DontFlushVariablesUsedInClosures.java new file mode 100644 index 000000000000..bc2ed3cfe2f1 --- /dev/null +++ b/java/java-tests/testData/inspection/dataFlow/fixture/DontFlushVariablesUsedInClosures.java @@ -0,0 +1,19 @@ +import org.jetbrains.annotations.Nullable; + +class Foo { + + void foo(final @Nullable String s, String s2) { + if (s2 == null) return; + if (s == null) return; + + System.out.println(s2); + + new Runnable() { + @Override + public void run() { + s.hashCode(); + } + }.run(); + } + +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java index dba230fbed32..cc86a456004f 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java @@ -242,6 +242,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { public void testManyContinuesNotComplex() { doTest(); } public void testFinallyNotComplex() { doTest(); } public void testFlushFurtherUnusedVariables() { doTest(); } + public void testDontFlushVariablesUsedInClosures() { doTest(); } public void testVariablesDiverge() { doTest(); } public void testMergeByNullability() { doTest(); } From 195648e0e4eb5ba96a4d1434d42a501a3bea51b4 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 22 Oct 2014 13:54:50 +0200 Subject: [PATCH 03/64] an ability to turn dfa live var analysis off in registry --- .../codeInspection/dataFlow/ControlFlowAnalyzer.java | 5 ++++- platform/util/resources/misc/registry.properties | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java index 496bd289247e..3face7908ec1 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java @@ -20,6 +20,7 @@ import com.intellij.codeInspection.dataFlow.instructions.*; import com.intellij.codeInspection.dataFlow.value.*; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Condition; +import com.intellij.openapi.util.registry.Registry; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.tree.IElementType; @@ -100,7 +101,9 @@ public class ControlFlowAnalyzer extends JavaElementVisitor { addInstruction(new ReturnInstruction(false, null)); - new LiveVariablesAnalyzer(myCurrentFlow, myFactory).flushDeadVariablesOnStatementFinish(); + if (Registry.is("idea.dfa.live.variables.analysis")) { + new LiveVariablesAnalyzer(myCurrentFlow, myFactory).flushDeadVariablesOnStatementFinish(); + } return myCurrentFlow; } diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index bef1c10517d7..5a14ade2ba5c 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -281,6 +281,9 @@ ide.dfa.time.limit.online.description=Time limit (in milliseconds) that is allow ide.dfa.time.limit.offline=5000 ide.dfa.time.limit.offline.description=Time limit (in milliseconds) that is allowed to analyze data flow for one method in Analyze | Inspect Code... +idea.dfa.live.variables.analysis=true +idea.dfa.live.variables.analysis.description=Whether to flush dead variables when they're not needed when performing data flow analysis + ide.ignore.call.result.inspection.honor.inferred.pure=false ide.ignore.call.result.inspection.honor.inferred.pure.description=Whether inferred @Contract(pure=true) annotations should be taken into account in ''Result of method call ignored'' inspection From 4d4559cb50c70977479639fb319e62cabbe2393a Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 22 Oct 2014 16:05:46 +0400 Subject: [PATCH 04/64] support breakpoints in decompiled code --- .../engine/CompoundPositionManager.java | 21 +++++++++++++++++++ .../debugger/engine/PositionManagerImpl.java | 2 +- .../JavaLineBreakpointTypeBase.java | 8 +++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java index 5ec84a8429f5..73d6f8bdb62b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java @@ -22,6 +22,7 @@ import com.intellij.debugger.engine.evaluation.EvaluationContext; import com.intellij.debugger.jdi.StackFrameProxyImpl; import com.intellij.debugger.requests.ClassPrepareRequestor; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ThreeState; import com.intellij.xdebugger.frame.XStackFrame; import com.sun.jdi.InternalException; @@ -101,9 +102,29 @@ public class CompoundPositionManager extends PositionManagerEx { return Collections.emptyList(); } + private static int mapToOriginalLine(int line, int[] mapping) { + for (int i = 0; i < mapping.length; i += 2) { + if (mapping[i + 1] == line) { + return mapping[i]; + } + } + return -1; + } + @Override @NotNull public List locationsOfLine(@NotNull ReferenceType type, @NotNull SourcePosition position) { + VirtualFile file = position.getFile().getVirtualFile(); + if (file != null) { + int[] data = file.getUserData(LINE_NUMBERS_MAPPING_KEY); + if (data != null) { + int line = mapToOriginalLine(position.getLine() + 1, data); + if (line > -1) { + position = SourcePosition.createFromLine(position.getFile(), line - 1); + } + } + } + for (PositionManager positionManager : myPositionManagers) { try { return positionManager.locationsOfLine(type, position); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java index 44337a6f1ee3..c58e7770d449 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java @@ -140,7 +140,7 @@ public class PositionManagerImpl implements PositionManager { lineNumber = -1; } - if (psiFile instanceof PsiCompiledElement && lineNumber > -1) { + if (lineNumber > -1) { VirtualFile file = psiFile.getVirtualFile(); if (file != null) { int[] data = file.getUserData(LINE_NUMBERS_MAPPING_KEY); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointTypeBase.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointTypeBase.java index 7427f91df500..8f092e26975b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointTypeBase.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointTypeBase.java @@ -15,6 +15,7 @@ */ package com.intellij.debugger.ui.breakpoints; +import com.intellij.debugger.PositionManager; import com.intellij.debugger.engine.DebuggerUtils; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -81,8 +82,8 @@ public abstract class JavaLineBreakpointTypeBase

Date: Wed, 22 Oct 2014 16:07:36 +0400 Subject: [PATCH 05/64] [log] more debug info for "no references pointing to head" error --- .../vcs/log/ui/tables/GraphTableModel.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/GraphTableModel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/GraphTableModel.java index 47b9375a7369..5abaaf2da696 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/GraphTableModel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/GraphTableModel.java @@ -8,7 +8,6 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Function; -import com.intellij.util.NotNullFunction; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.text.DateFormatUtil; import com.intellij.vcs.log.*; @@ -75,24 +74,32 @@ public class GraphTableModel extends AbstractTableModel { List> commits = myDataPack.getPermanentGraph().getAllCommits(); for (int i = 0; i < 100 && i < commits.size(); i++) { GraphCommit commit = commits.get(i); - sb.append(myDataHolder.getHash(commit.getId()) + "\n"); + sb.append(String.format("%s -> %s\n", myDataHolder.getHash(commit.getId()).toShortString(), getParents(commit))); } sb.append("\nALL REFS:\n"); - printRefs(sb, myDataHolder.getHashMap().asIndexGetter(), myDataPack.getRefsModel().getAllRefsByRoot()); + printRefs(sb, myDataPack.getRefsModel().getAllRefsByRoot()); return sb.toString(); } - private static void printRefs(@NotNull StringBuilder sb, - @NotNull final NotNullFunction indexGetter, - @NotNull Map> refs) { + @NotNull + private String getParents(@NotNull GraphCommit commit) { + return StringUtil.join(commit.getParents(), new Function() { + @Override + public String fun(Integer integer) { + return myDataHolder.getHash(integer).toShortString(); + } + }, ", "); + } + + private static void printRefs(@NotNull StringBuilder sb, @NotNull Map> refs) { for (Map.Entry> entry : refs.entrySet()) { - sb.append(entry.getKey().getName() + ":\n"); + sb.append("\n\n" + entry.getKey().getName() + ":\n"); sb.append(StringUtil.join(entry.getValue(), new Function() { @Override public String fun(@NotNull VcsRef ref) { - return ref.getName() + "(" + indexGetter.fun(ref.getCommitHash()) + ")"; + return ref.getName() + " : " + ref.getCommitHash().toShortString(); } - }, ",")); + }, "\n")); } } From 9f3baaa1544b3bbf7870f51cf7b703837411cb6f Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Wed, 22 Oct 2014 14:09:21 +0200 Subject: [PATCH 06/64] test for IDEA-128919 --- .../testSrc/com/intellij/index/IndexTest.java | 159 ++++++++++++++++-- 1 file changed, 146 insertions(+), 13 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/index/IndexTest.java b/java/java-tests/testSrc/com/intellij/index/IndexTest.java index 4fcb40296a48..f561fef91882 100644 --- a/java/java-tests/testSrc/com/intellij/index/IndexTest.java +++ b/java/java-tests/testSrc/com/intellij/index/IndexTest.java @@ -15,19 +15,26 @@ */ package com.intellij.index; +import com.intellij.codeHighlighting.BackgroundEditorHighlighter; +import com.intellij.codeInsight.CodeInsightTestCase; +import com.intellij.ide.structureView.StructureViewBuilder; import com.intellij.openapi.command.WriteCommandAction; +import com.intellij.openapi.command.undo.UndoManager; import com.intellij.openapi.editor.Document; -import com.intellij.openapi.fileEditor.FileDocumentManager; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.fileEditor.*; import com.intellij.openapi.fileTypes.PlainTextFileType; import com.intellij.openapi.util.Factory; +import com.intellij.openapi.util.Key; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry; +import com.intellij.pom.Navigatable; import com.intellij.psi.*; import com.intellij.psi.impl.PsiManagerEx; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.search.PsiSearchHelper; -import com.intellij.testFramework.IdeaTestCase; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.PsiTestUtil; import com.intellij.testFramework.SkipSlowTestLocally; @@ -35,7 +42,10 @@ import com.intellij.util.indexing.MapIndexStorage; import com.intellij.util.indexing.StorageException; import com.intellij.util.io.*; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import javax.swing.*; +import java.beans.PropertyChangeListener; import java.io.DataInput; import java.io.DataOutput; import java.io.File; @@ -47,7 +57,7 @@ import java.util.*; * Date: Dec 12, 2007 */ @SkipSlowTestLocally -public class IndexTest extends IdeaTestCase { +public class IndexTest extends CodeInsightTestCase { public void testUpdate() throws StorageException, IOException { final File storageFile = FileUtil.createTempFile("indextest", "storage"); @@ -208,8 +218,7 @@ public class IndexTest extends IdeaTestCase { VfsUtil.saveText(vFile, "class Foo {}"); final GlobalSearchScope scope = GlobalSearchScope.allScope(getProject()); - final JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject()); - assertNotNull(facade.findClass("Foo", scope)); + assertNotNull(myJavaFacade.findClass("Foo", scope)); WriteCommandAction.runWriteCommandAction(null, new Runnable() { @Override public void run() { @@ -218,20 +227,20 @@ public class IndexTest extends IdeaTestCase { Document document = FileDocumentManager.getInstance().getDocument(vFile); document.deleteString(0, document.getTextLength()); - assertNotNull(facade.findClass("Foo", scope)); + assertNotNull(myJavaFacade.findClass("Foo", scope)); psiFile = null; PlatformTestUtil.tryGcSoftlyReachableObjects(); assertNull(((PsiManagerEx)PsiManager.getInstance(getProject())).getFileManager().getCachedPsiFile(vFile)); - PsiClass foo = facade.findClass("Foo", scope); + PsiClass foo = myJavaFacade.findClass("Foo", scope); assertNotNull(foo); assertTrue(foo.isValid()); assertEquals("class Foo {}", foo.getText()); assertTrue(foo.isValid()); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); - assertNull(facade.findClass("Foo", scope)); + assertNull(myJavaFacade.findClass("Foo", scope)); } }); } @@ -244,8 +253,7 @@ public class IndexTest extends IdeaTestCase { VfsUtil.saveText(vFile, ""); final GlobalSearchScope scope = GlobalSearchScope.allScope(getProject()); - final JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject()); - assertNull(facade.findClass("Foo", scope)); + assertNull(myJavaFacade.findClass("Foo", scope)); WriteCommandAction.runWriteCommandAction(null, new Runnable() { @Override public void run() { @@ -259,11 +267,11 @@ public class IndexTest extends IdeaTestCase { FileDocumentManager.getInstance().saveDocument(document); assertTrue(count == PsiManager.getInstance(myProject).getModificationTracker().getModificationCount()); - assertNull(facade.findClass("Foo", scope)); + assertNull(myJavaFacade.findClass("Foo", scope)); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); - assertNotNull(facade.findClass("Foo", scope)); - assertNotNull(facade.findClass("Foo", scope).getText()); + assertNotNull(myJavaFacade.findClass("Foo", scope)); + assertNotNull(myJavaFacade.findClass("Foo", scope).getText()); // if Foo exists now, mod count should be different assertTrue(count != PsiManager.getInstance(myProject).getModificationTracker().getModificationCount()); } @@ -308,4 +316,129 @@ public class IndexTest extends IdeaTestCase { }); } + public void testUndoToFileContentForUnsavedCommittedDocument() throws IOException { + VirtualFile dir = getVirtualFile(createTempDirectory()); + PsiTestUtil.addSourceContentToRoots(myModule, dir); + + final VirtualFile vFile = createChildData(dir, "Foo.java"); + VfsUtil.saveText(vFile, "class Foo {}"); + ((VirtualFileSystemEntry)vFile).setModificationStamp(0); // as unchanged file + + final Document document = FileDocumentManager.getInstance().getDocument(vFile); + assertTrue(document != null && document.getModificationStamp() == 0); + final GlobalSearchScope scope = GlobalSearchScope.projectScope(myProject); + assertNotNull(myJavaFacade.findClass("Foo", scope)); + + WriteCommandAction.runWriteCommandAction(myProject, new Runnable() { + @Override + public void run() { + document.insertString(0, "import Bar;\n"); + PsiDocumentManager.getInstance(myProject).commitAllDocuments(); + assertNotNull(myJavaFacade.findClass("Foo", scope)); + } + }); + + final UndoManager undoManager = UndoManager.getInstance(getProject()); + final Editor editor = createEditor(vFile); + final FileEditor selectedEditor = new TextEditor() { + @NotNull + @Override + public Editor getEditor() { + return editor; + } + + @Override + public boolean canNavigateTo(@NotNull Navigatable navigatable) { + return false; + } + + @Override + public void navigateTo(@NotNull Navigatable navigatable) {} + + @NotNull + @Override + public JComponent getComponent() { + return null; + } + + @Nullable + @Override + public JComponent getPreferredFocusedComponent() { + return null; + } + + @NotNull + @Override + public String getName() { + return null; + } + + @NotNull + @Override + public FileEditorState getState(@NotNull FileEditorStateLevel level) { + return null; + } + + @Override + public void setState(@NotNull FileEditorState state) {} + + @Override + public boolean isModified() { + return false; + } + + @Override + public boolean isValid() { + return false; + } + + @Override + public void selectNotify() {} + + @Override + public void deselectNotify() {} + + @Override + public void addPropertyChangeListener(@NotNull PropertyChangeListener listener) {} + + @Override + public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) {} + + @Nullable + @Override + public BackgroundEditorHighlighter getBackgroundHighlighter() { + return null; + } + + @Nullable + @Override + public FileEditorLocation getCurrentLocation() { + return null; + } + + @Nullable + @Override + public StructureViewBuilder getStructureViewBuilder() { + return null; + } + + @Override + public void dispose() {} + + @Nullable + @Override + public T getUserData(@NotNull Key key) { + return null; + } + + @Override + public void putUserData(@NotNull Key key, @Nullable T value) {} + }; + + assertTrue(undoManager.isUndoAvailable(selectedEditor)); + FileDocumentManager.getInstance().saveDocument(document); + undoManager.undo(selectedEditor); + + assertNotNull(myJavaFacade.findClass("Foo", scope)); + } } From b179691a1bde9ed9a4ec54ec9fd2be65d66c87ef Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Wed, 22 Oct 2014 16:25:32 +0400 Subject: [PATCH 07/64] html viewer: don't check deprecated Nimbus L&F --- .../platform-impl/src/com/intellij/util/ui/SwingHelper.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java index 721e04469d24..488c52d14207 100644 --- a/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java +++ b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java @@ -436,13 +436,10 @@ public class SwingHelper { textPane.setContentType(UIUtil.HTML_MIME); textPane.setEditable(false); if (background != null) { - textPane.setBackground(background); // e.g. UIUtil.getOptionPaneBackground() + textPane.setBackground(background); } else { textPane.setOpaque(false); - if (UIUtil.isUnderNimbusLookAndFeel()) { - textPane.setBackground(UIUtil.TRANSPARENT_COLOR); - } } textPane.setForeground(foreground != null ? foreground : UIUtil.getLabelForeground()); return textPane; From b762b79d4b9de05e4320d7f0b566502610ea05eb Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Wed, 22 Oct 2014 13:47:50 +0400 Subject: [PATCH 08/64] WEB-13675 Do not insert redundant alignment between array elements and properties. This alignment included in ChildAttributes for new properties and array elements leads to spaces being inserted instead of tabs inside indents for corresponding blocks when both SMART_TABS and USE_TAB_CHARACTER options are active. Test data for tests of line movements was updated because it made use of these alignments. --- .../intellij/json/formatter/JsonBlock.java | 14 ++++++------- .../com/intellij/json/JsonEditingTest.java | 21 +++++++++++++++++++ ...dentWithTabsWhenSmartTabEnabled.after.json | 5 +++++ .../IndentWithTabsWhenSmartTabEnabled.json | 4 ++++ .../mover/ArraySelectionMovedDown.json | 7 +++++-- .../ArraySelectionMovedDown_afterDown.json | 7 +++++-- .../mover/ObjectSelectionMovedDown.json | 10 ++++++--- .../ObjectSelectionMovedDown_afterDown.json | 10 ++++++--- 8 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 json/tests/testData/editing/IndentWithTabsWhenSmartTabEnabled.after.json create mode 100644 json/tests/testData/editing/IndentWithTabsWhenSmartTabEnabled.json diff --git a/json/src/com/intellij/json/formatter/JsonBlock.java b/json/src/com/intellij/json/formatter/JsonBlock.java index 2dccd347e177..8ffff7f2dc44 100644 --- a/json/src/com/intellij/json/formatter/JsonBlock.java +++ b/json/src/com/intellij/json/formatter/JsonBlock.java @@ -48,8 +48,6 @@ public class JsonBlock implements ASTBlock { // lazy initialized on first call to #getSubBlocks() private List mySubBlocks = null; - private final Alignment myChildAlignment = Alignment.createAlignment(); - private final Alignment myPropertyValueAlignment; private final Wrap myChildWrap; @@ -119,9 +117,8 @@ public class JsonBlock implements ASTBlock { JsonCodeStyleSettings customSettings = getCustomSettings(); if (isContainer() && childNodeType != JsonElementTypes.COMMA && !BRACES.contains(childNodeType)) { - assert myChildWrap != null && myChildAlignment != null; + assert myChildWrap != null; wrap = myChildWrap; - alignment = myChildAlignment; indent = Indent.getNormalIndent(); } // Handle properties alignment @@ -184,7 +181,10 @@ public class JsonBlock implements ASTBlock { @Override public ChildAttributes getChildAttributes(int newChildIndex) { if (isContainer()) { - return new ChildAttributes(Indent.getNormalIndent(), myChildAlignment); + // WEB-13675: For some reason including alignment in child attributes causes + // indents to consist solely of spaces when both USE_TABS and SMART_TAB + // options are enabled. + return new ChildAttributes(Indent.getNormalIndent(), null); } // Will use continuation indent for cases like { "foo" } return new ChildAttributes(null, null); @@ -192,8 +192,8 @@ public class JsonBlock implements ASTBlock { @Override public boolean isIncomplete() { - IElementType nodeType = myNode.getElementType(); - ASTNode lastChildNode = myNode.getLastChildNode(); + final IElementType nodeType = myNode.getElementType(); + final ASTNode lastChildNode = myNode.getLastChildNode(); if (nodeType == JsonElementTypes.OBJECT) { return lastChildNode != null && lastChildNode.getElementType() != JsonElementTypes.R_CURLY; } diff --git a/json/tests/test/com/intellij/json/JsonEditingTest.java b/json/tests/test/com/intellij/json/JsonEditingTest.java index bb6f5088c89c..42421979f490 100644 --- a/json/tests/test/com/intellij/json/JsonEditingTest.java +++ b/json/tests/test/com/intellij/json/JsonEditingTest.java @@ -3,6 +3,9 @@ package com.intellij.json; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.util.Computable; import com.intellij.psi.PsiFile; +import com.intellij.psi.codeStyle.CodeStyleSettings; +import com.intellij.psi.codeStyle.CodeStyleSettingsManager; +import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import org.jetbrains.annotations.NotNull; /** @@ -37,4 +40,22 @@ public class JsonEditingTest extends JsonTestCase { public void testNormalIndentAfterPropertyWithoutComma() { doTest("\n"); } + + // WEB-13675 + public void testIndentWithTabsWhenSmartTabEnabled() { + CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(myFixture.getProject()); + CommonCodeStyleSettings.IndentOptions indentOptions = settings.getCommonSettings(JsonLanguage.INSTANCE).getIndentOptions(); + assertNotNull(indentOptions); + CommonCodeStyleSettings.IndentOptions oldSettings = (CommonCodeStyleSettings.IndentOptions)indentOptions.clone(); + indentOptions.TAB_SIZE = 4; + indentOptions.INDENT_SIZE = 4; + indentOptions.USE_TAB_CHARACTER = true; + indentOptions.SMART_TABS = true; + try { + doTest("\n\"baz\""); + } + finally { + indentOptions.copyFrom(oldSettings); + } + } } diff --git a/json/tests/testData/editing/IndentWithTabsWhenSmartTabEnabled.after.json b/json/tests/testData/editing/IndentWithTabsWhenSmartTabEnabled.after.json new file mode 100644 index 000000000000..152513cad497 --- /dev/null +++ b/json/tests/testData/editing/IndentWithTabsWhenSmartTabEnabled.after.json @@ -0,0 +1,5 @@ +{ + "foo": true, + "bar": false, + "baz" +} \ No newline at end of file diff --git a/json/tests/testData/editing/IndentWithTabsWhenSmartTabEnabled.json b/json/tests/testData/editing/IndentWithTabsWhenSmartTabEnabled.json new file mode 100644 index 000000000000..69824365e9e8 --- /dev/null +++ b/json/tests/testData/editing/IndentWithTabsWhenSmartTabEnabled.json @@ -0,0 +1,4 @@ +{ + "foo": true, + "bar": false, +} \ No newline at end of file diff --git a/json/tests/testData/mover/ArraySelectionMovedDown.json b/json/tests/testData/mover/ArraySelectionMovedDown.json index 476b56d42dea..81e4dc2bcd0e 100644 --- a/json/tests/testData/mover/ArraySelectionMovedDown.json +++ b/json/tests/testData/mover/ArraySelectionMovedDown.json @@ -1,5 +1,8 @@ [ - 1, [2], [true, - false], + 1, [2], + [ + true, + false + ], null ] \ No newline at end of file diff --git a/json/tests/testData/mover/ArraySelectionMovedDown_afterDown.json b/json/tests/testData/mover/ArraySelectionMovedDown_afterDown.json index 9db514b06905..1a7a49635d95 100644 --- a/json/tests/testData/mover/ArraySelectionMovedDown_afterDown.json +++ b/json/tests/testData/mover/ArraySelectionMovedDown_afterDown.json @@ -1,5 +1,8 @@ [ null, - 1, [2], [true, - false] + 1, [2], + [ + true, + false + ] ] \ No newline at end of file diff --git a/json/tests/testData/mover/ObjectSelectionMovedDown.json b/json/tests/testData/mover/ObjectSelectionMovedDown.json index 57efbe402072..ed363c1d3d6f 100644 --- a/json/tests/testData/mover/ObjectSelectionMovedDown.json +++ b/json/tests/testData/mover/ObjectSelectionMovedDown.json @@ -1,6 +1,10 @@ { - "foo": false, "bar": 42, - "baz": [1, 2, - 3], + "foo": false, + "bar": 42, + "baz": [ + 1, + 2, + 3 + ], "quux": null } \ No newline at end of file diff --git a/json/tests/testData/mover/ObjectSelectionMovedDown_afterDown.json b/json/tests/testData/mover/ObjectSelectionMovedDown_afterDown.json index 860d3b5d3783..ebf686822340 100644 --- a/json/tests/testData/mover/ObjectSelectionMovedDown_afterDown.json +++ b/json/tests/testData/mover/ObjectSelectionMovedDown_afterDown.json @@ -1,6 +1,10 @@ { + "foo": false, "quux": null, - "foo": false, "bar": 42, - "baz": [1, 2, - 3] + "bar": 42, + "baz": [ + 1, + 2, + 3 + ] } \ No newline at end of file From 9ec8fbb7d8603f4de70a5de9d3099e6cd3803b35 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Wed, 22 Oct 2014 15:54:31 +0400 Subject: [PATCH 09/64] WEB-13587 Align compound property values on opening brace/bracket Also updated test data with more complete example from user and changed preview shown in settings so effect was more clear. --- .../intellij/json/formatter/JsonBlock.java | 32 ++++++++++++------- .../json/formatter/JsonCodeStylePanel.java | 20 ++++++------ .../formatting/AlignPropertiesOnColon.json | 20 ++++++++++-- .../AlignPropertiesOnColon_after.json | 20 ++++++++++-- .../formatting/AlignPropertiesOnValue.json | 20 ++++++++++-- .../AlignPropertiesOnValue_after.json | 20 ++++++++++-- 6 files changed, 99 insertions(+), 33 deletions(-) diff --git a/json/src/com/intellij/json/formatter/JsonBlock.java b/json/src/com/intellij/json/formatter/JsonBlock.java index 8ffff7f2dc44..85bbe545f2bb 100644 --- a/json/src/com/intellij/json/formatter/JsonBlock.java +++ b/json/src/com/intellij/json/formatter/JsonBlock.java @@ -3,7 +3,6 @@ package com.intellij.json.formatter; import com.intellij.formatting.*; import com.intellij.json.JsonElementTypes; import com.intellij.json.JsonLanguage; -import com.intellij.json.JsonParserDefinition; import com.intellij.json.psi.JsonArray; import com.intellij.json.psi.JsonObject; import com.intellij.json.psi.JsonProperty; @@ -23,8 +22,7 @@ import org.jetbrains.annotations.Nullable; import java.util.List; -import static com.intellij.json.JsonParserDefinition.JSON_BRACES; -import static com.intellij.json.JsonParserDefinition.JSON_BRACKETS; +import static com.intellij.json.JsonParserDefinition.*; import static com.intellij.json.formatter.JsonCodeStyleSettings.PropertyAlignment.ALIGN_ON_COLON; import static com.intellij.json.formatter.JsonCodeStyleSettings.PropertyAlignment.ALIGN_ON_VALUE; @@ -115,21 +113,31 @@ public class JsonBlock implements ASTBlock { Alignment alignment = null; Wrap wrap = null; - JsonCodeStyleSettings customSettings = getCustomSettings(); - if (isContainer() && childNodeType != JsonElementTypes.COMMA && !BRACES.contains(childNodeType)) { - assert myChildWrap != null; - wrap = myChildWrap; - indent = Indent.getNormalIndent(); + final JsonCodeStyleSettings customSettings = getCustomSettings(); + if (isContainer()) { + if (childNodeType != JsonElementTypes.COMMA && !BRACES.contains(childNodeType)) { + assert myChildWrap != null; + wrap = myChildWrap; + indent = Indent.getNormalIndent(); + } + else if (OPEN_BRACES.contains(childNodeType)) { + if (JsonPsiUtil.isPropertyValue(myPsiElement) && customSettings.PROPERTY_ALIGNMENT == ALIGN_ON_VALUE) { + // WEB-13587 Align compound values on opening brace/bracket, not the whole block + assert myParent != null && myParent.myParent != null && myParent.myParent.myPropertyValueAlignment != null; + alignment = myParent.myParent.myPropertyValueAlignment; + } + } } // Handle properties alignment else if (myNode.getElementType() == JsonElementTypes.PROPERTY) { - assert myParent.myNode.getElementType() == JsonElementTypes.OBJECT; - assert myParent.myPropertyValueAlignment != null; + assert myParent != null && myParent.myPropertyValueAlignment != null; if (childNode.getElementType() == JsonElementTypes.COLON && customSettings.PROPERTY_ALIGNMENT == ALIGN_ON_COLON) { alignment = myParent.myPropertyValueAlignment; } else if (JsonPsiUtil.isPropertyValue(childNode.getPsi()) && customSettings.PROPERTY_ALIGNMENT == ALIGN_ON_VALUE) { - alignment = myParent.myPropertyValueAlignment; + if (!JSON_CONTAINERS.contains(childNodeType)) { + alignment = myParent.myPropertyValueAlignment; + } } } return new JsonBlock(this, childNode, mySettings, alignment, indent, wrap); @@ -216,7 +224,7 @@ public class JsonBlock implements ASTBlock { } private boolean isContainer() { - return JsonParserDefinition.JSON_CONTAINERS.contains(myNode.getElementType()); + return JSON_CONTAINERS.contains(myNode.getElementType()); } private JsonCodeStyleSettings getCustomSettings() { diff --git a/json/src/com/intellij/json/formatter/JsonCodeStylePanel.java b/json/src/com/intellij/json/formatter/JsonCodeStylePanel.java index c5c78f78227b..fa858ab98d95 100644 --- a/json/src/com/intellij/json/formatter/JsonCodeStylePanel.java +++ b/json/src/com/intellij/json/formatter/JsonCodeStylePanel.java @@ -23,13 +23,16 @@ import java.awt.event.ItemListener; * @author Mikhail Golubev */ public class JsonCodeStylePanel extends CodeStyleAbstractPanel { - public static final String SAMPLE = "{\n" + - " \"longKeyName\": true,\n" + - " \"short\": false,\n" + - "\n" + - " \"group2-longKeyName\": null,\n" + - " \"group2-short\": 42\n" + - "}"; + public static final String ALIGNMENT_SAMPLE = "{\n" + + " \"foo\": {\n" + + " \"bar\": true,\n" + + " \"baz\": false\n" + + " },\n" + + " \"quux\": [\n" + + " 1, 2.0, 3e0, 4.0e0\n" + + " ],\n" + + " \"longPropertyName\": null\n" + + "}"; private JComboBox myPropertiesAlignmentCombo; private JPanel myPreviewPanel; @@ -59,7 +62,6 @@ public class JsonCodeStylePanel extends CodeStyleAbstractPanel { } } }); - } @Override @@ -82,7 +84,7 @@ public class JsonCodeStylePanel extends CodeStyleAbstractPanel { @Nullable @Override protected String getPreviewText() { - return SAMPLE; + return ALIGNMENT_SAMPLE; } @Override diff --git a/json/tests/testData/formatting/AlignPropertiesOnColon.json b/json/tests/testData/formatting/AlignPropertiesOnColon.json index e6bb1d6956be..c71adabb752f 100644 --- a/json/tests/testData/formatting/AlignPropertiesOnColon.json +++ b/json/tests/testData/formatting/AlignPropertiesOnColon.json @@ -1,5 +1,19 @@ { - "a": 1, - "aaa": 2, - "aaaaa": 3 + "require-dev": { + "phpunit/phpunit": "~3.7", + "phpunit/phpunit-selenium": "@stable", + "phpunit/phpunit-story": "@stable", + "phpunit/dbunit": "@stable" + }, + "minimum-stability": "dev", + "autoload": { + "psr-4": { + "DreamFactory\\Yii\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-develop": "1.5.x-dev" + } + } } \ No newline at end of file diff --git a/json/tests/testData/formatting/AlignPropertiesOnColon_after.json b/json/tests/testData/formatting/AlignPropertiesOnColon_after.json index d8c115391024..7a673e8c3c21 100644 --- a/json/tests/testData/formatting/AlignPropertiesOnColon_after.json +++ b/json/tests/testData/formatting/AlignPropertiesOnColon_after.json @@ -1,5 +1,19 @@ { - "a" : 1, - "aaa" : 2, - "aaaaa": 3 + "require-dev" : { + "phpunit/phpunit" : "~3.7", + "phpunit/phpunit-selenium": "@stable", + "phpunit/phpunit-story" : "@stable", + "phpunit/dbunit" : "@stable" + }, + "minimum-stability": "dev", + "autoload" : { + "psr-4": { + "DreamFactory\\Yii\\": "src/" + } + }, + "extra" : { + "branch-alias": { + "dev-develop": "1.5.x-dev" + } + } } \ No newline at end of file diff --git a/json/tests/testData/formatting/AlignPropertiesOnValue.json b/json/tests/testData/formatting/AlignPropertiesOnValue.json index e6bb1d6956be..c71adabb752f 100644 --- a/json/tests/testData/formatting/AlignPropertiesOnValue.json +++ b/json/tests/testData/formatting/AlignPropertiesOnValue.json @@ -1,5 +1,19 @@ { - "a": 1, - "aaa": 2, - "aaaaa": 3 + "require-dev": { + "phpunit/phpunit": "~3.7", + "phpunit/phpunit-selenium": "@stable", + "phpunit/phpunit-story": "@stable", + "phpunit/dbunit": "@stable" + }, + "minimum-stability": "dev", + "autoload": { + "psr-4": { + "DreamFactory\\Yii\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-develop": "1.5.x-dev" + } + } } \ No newline at end of file diff --git a/json/tests/testData/formatting/AlignPropertiesOnValue_after.json b/json/tests/testData/formatting/AlignPropertiesOnValue_after.json index 0cebf089466a..d4269bcc90b6 100644 --- a/json/tests/testData/formatting/AlignPropertiesOnValue_after.json +++ b/json/tests/testData/formatting/AlignPropertiesOnValue_after.json @@ -1,5 +1,19 @@ { - "a": 1, - "aaa": 2, - "aaaaa": 3 + "require-dev": { + "phpunit/phpunit": "~3.7", + "phpunit/phpunit-selenium": "@stable", + "phpunit/phpunit-story": "@stable", + "phpunit/dbunit": "@stable" + }, + "minimum-stability": "dev", + "autoload": { + "psr-4": { + "DreamFactory\\Yii\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-develop": "1.5.x-dev" + } + } } \ No newline at end of file From a2b4b60088943bb2e80922de71667041109edd08 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Wed, 22 Oct 2014 15:12:56 +0400 Subject: [PATCH 10/64] Add utility methods for unified comparison of element/node with element type --- .../intellij/json/formatter/JsonBlock.java | 50 ++++++++----------- .../com/intellij/json/psi/JsonPsiUtil.java | 32 ++++++++++++ 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/json/src/com/intellij/json/formatter/JsonBlock.java b/json/src/com/intellij/json/formatter/JsonBlock.java index 85bbe545f2bb..307e4a7fbc59 100644 --- a/json/src/com/intellij/json/formatter/JsonBlock.java +++ b/json/src/com/intellij/json/formatter/JsonBlock.java @@ -1,7 +1,6 @@ package com.intellij.json.formatter; import com.intellij.formatting.*; -import com.intellij.json.JsonElementTypes; import com.intellij.json.JsonLanguage; import com.intellij.json.psi.JsonArray; import com.intellij.json.psi.JsonObject; @@ -22,17 +21,19 @@ import org.jetbrains.annotations.Nullable; import java.util.List; +import static com.intellij.json.JsonElementTypes.*; import static com.intellij.json.JsonParserDefinition.*; import static com.intellij.json.formatter.JsonCodeStyleSettings.PropertyAlignment.ALIGN_ON_COLON; import static com.intellij.json.formatter.JsonCodeStyleSettings.PropertyAlignment.ALIGN_ON_VALUE; +import static com.intellij.json.psi.JsonPsiUtil.hasElementType; /** * @author Mikhail Golubev */ public class JsonBlock implements ASTBlock { - private static final TokenSet OPEN_BRACES = TokenSet.create(JsonElementTypes.L_BRACKET, JsonElementTypes.L_CURLY); - private static final TokenSet CLOSE_BRACES = TokenSet.create(JsonElementTypes.R_BRACKET, JsonElementTypes.R_CURLY); - private static final TokenSet BRACES = TokenSet.orSet(OPEN_BRACES, CLOSE_BRACES); + private static final TokenSet JSON_OPEN_BRACES = TokenSet.create(L_BRACKET, L_CURLY); + private static final TokenSet JSON_CLOSE_BRACES = TokenSet.create(R_BRACKET, R_CURLY); + private static final TokenSet JSON_ALL_BRACES = TokenSet.orSet(JSON_OPEN_BRACES, JSON_CLOSE_BRACES); private final JsonBlock myParent; @@ -107,20 +108,18 @@ public class JsonBlock implements ASTBlock { } private Block makeSubBlock(@NotNull ASTNode childNode) { - final IElementType childNodeType = childNode.getElementType(); - Indent indent = Indent.getNoneIndent(); Alignment alignment = null; Wrap wrap = null; final JsonCodeStyleSettings customSettings = getCustomSettings(); - if (isContainer()) { - if (childNodeType != JsonElementTypes.COMMA && !BRACES.contains(childNodeType)) { + if (hasElementType(myNode, JSON_CONTAINERS)) { + if (!hasElementType(childNode, COMMA) && !hasElementType(childNode, JSON_ALL_BRACES)) { assert myChildWrap != null; wrap = myChildWrap; indent = Indent.getNormalIndent(); } - else if (OPEN_BRACES.contains(childNodeType)) { + else if (hasElementType(childNode, JSON_OPEN_BRACES)) { if (JsonPsiUtil.isPropertyValue(myPsiElement) && customSettings.PROPERTY_ALIGNMENT == ALIGN_ON_VALUE) { // WEB-13587 Align compound values on opening brace/bracket, not the whole block assert myParent != null && myParent.myParent != null && myParent.myParent.myPropertyValueAlignment != null; @@ -129,13 +128,13 @@ public class JsonBlock implements ASTBlock { } } // Handle properties alignment - else if (myNode.getElementType() == JsonElementTypes.PROPERTY) { + else if (hasElementType(myNode, PROPERTY) ) { assert myParent != null && myParent.myPropertyValueAlignment != null; - if (childNode.getElementType() == JsonElementTypes.COLON && customSettings.PROPERTY_ALIGNMENT == ALIGN_ON_COLON) { + if (hasElementType(childNode, COLON) && customSettings.PROPERTY_ALIGNMENT == ALIGN_ON_COLON) { alignment = myParent.myPropertyValueAlignment; } else if (JsonPsiUtil.isPropertyValue(childNode.getPsi()) && customSettings.PROPERTY_ALIGNMENT == ALIGN_ON_VALUE) { - if (!JSON_CONTAINERS.contains(childNodeType)) { + if (!hasElementType(childNode, JSON_CONTAINERS)) { alignment = myParent.myPropertyValueAlignment; } } @@ -165,17 +164,17 @@ public class JsonBlock implements ASTBlock { @Override public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { final CommonCodeStyleSettings commonSettings = getCommonSettings(); - final IElementType leftChildType = child1 instanceof JsonBlock ? ((JsonBlock)child1).myNode.getElementType() : null; - final IElementType rightChildType = child2 instanceof JsonBlock ? ((JsonBlock)child2).myNode.getElementType() : null; + final ASTNode leftChild = child1 instanceof JsonBlock ? ((JsonBlock)child1).myNode : null; + final ASTNode rightChild = child2 instanceof JsonBlock ? ((JsonBlock)child2).myNode : null; // This causes braces/brackets to be on their own lines if whole object/array spans several lines. - if (leftChildType != null && rightChildType != null) { - if (JSON_BRACES.contains(leftChildType) ^ JSON_BRACES.contains(rightChildType)) { + if (leftChild != null && rightChild != null) { + if (hasElementType(leftChild, JSON_BRACES) ^ hasElementType(rightChild, JSON_BRACES)) { final int numSpaces = commonSettings.SPACE_WITHIN_BRACES ? 1 : 0; return Spacing.createDependentLFSpacing(numSpaces, numSpaces, myNode.getTextRange(), commonSettings.KEEP_LINE_BREAKS, commonSettings.KEEP_BLANK_LINES_IN_CODE); } - else if (JSON_BRACKETS.contains(leftChildType) ^ JSON_BRACKETS.contains(rightChildType)) { + else if (hasElementType(leftChild, JSON_BRACKETS) ^ hasElementType(rightChild, JSON_BRACKETS)) { final int numSpaces = commonSettings.SPACE_WITHIN_BRACKETS ? 1 : 0; return Spacing.createDependentLFSpacing(numSpaces, numSpaces, myNode.getTextRange(), commonSettings.KEEP_LINE_BREAKS, @@ -188,7 +187,7 @@ public class JsonBlock implements ASTBlock { @NotNull @Override public ChildAttributes getChildAttributes(int newChildIndex) { - if (isContainer()) { + if (hasElementType(myNode, JSON_CONTAINERS)) { // WEB-13675: For some reason including alignment in child attributes causes // indents to consist solely of spaces when both USE_TABS and SMART_TAB // options are enabled. @@ -200,15 +199,14 @@ public class JsonBlock implements ASTBlock { @Override public boolean isIncomplete() { - final IElementType nodeType = myNode.getElementType(); final ASTNode lastChildNode = myNode.getLastChildNode(); - if (nodeType == JsonElementTypes.OBJECT) { - return lastChildNode != null && lastChildNode.getElementType() != JsonElementTypes.R_CURLY; + if (hasElementType(myNode, OBJECT)) { + return lastChildNode != null && lastChildNode.getElementType() != R_CURLY; } - else if (nodeType == JsonElementTypes.ARRAY) { - return lastChildNode != null && lastChildNode.getElementType() != JsonElementTypes.R_BRACKET; + else if (hasElementType(myNode, ARRAY)) { + return lastChildNode != null && lastChildNode.getElementType() != R_BRACKET; } - else if (myPsiElement instanceof JsonProperty) { + else if (hasElementType(myNode, PROPERTY)) { return ((JsonProperty)myPsiElement).getValue() == null; } return false; @@ -223,10 +221,6 @@ public class JsonBlock implements ASTBlock { return node.getElementType() == TokenType.WHITE_SPACE || node.getTextLength() == 0; } - private boolean isContainer() { - return JSON_CONTAINERS.contains(myNode.getElementType()); - } - private JsonCodeStyleSettings getCustomSettings() { return mySettings.getCustomSettings(JsonCodeStyleSettings.class); } diff --git a/json/src/com/intellij/json/psi/JsonPsiUtil.java b/json/src/com/intellij/json/psi/JsonPsiUtil.java index e3520f7526b1..0b9a151212e6 100644 --- a/json/src/com/intellij/json/psi/JsonPsiUtil.java +++ b/json/src/com/intellij/json/psi/JsonPsiUtil.java @@ -5,6 +5,7 @@ import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; +import com.intellij.psi.tree.TokenSet; import org.jetbrains.annotations.NotNull; import static com.intellij.json.JsonParserDefinition.JSON_COMMENTARIES; @@ -86,4 +87,35 @@ public class JsonPsiUtil { } return lastSeen.getPsi(); } + + /** + * Check that element type of the given AST node belongs to the token set. + *

+ * It slightly less verbose than {@code set.contains(node.getElementType())} and overloaded methods with the same name + * allow check ASTNode/PsiElement against both concrete element types and token sets in uniform way. + */ + public static boolean hasElementType(@NotNull ASTNode node, @NotNull TokenSet set) { + return set.contains(node.getElementType()); + } + + /** + * @see #hasElementType(com.intellij.lang.ASTNode, com.intellij.psi.tree.TokenSet) + */ + public static boolean hasElementType(@NotNull ASTNode node, IElementType... types) { + return hasElementType(node, TokenSet.create(types)); + } + + /** + * @see #hasElementType(com.intellij.lang.ASTNode, com.intellij.psi.tree.TokenSet) + */ + public static boolean hasElementType(@NotNull PsiElement element, @NotNull TokenSet set) { + return element.getNode() != null && hasElementType(element.getNode(), set); + } + + /** + * @see #hasElementType(com.intellij.lang.ASTNode, com.intellij.psi.tree.IElementType...) + */ + public static boolean hasElementType(@NotNull PsiElement element, IElementType... types) { + return element.getNode() != null && hasElementType(element.getNode(), types); + } } From 679c59f06fb4b89cb2949bfcb014ea1c38b7ee49 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Wed, 22 Oct 2014 16:58:05 +0400 Subject: [PATCH 11/64] [git] IDEA-131705 Fix a misprint :( If there is no error, do change the target --- plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java b/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java index 40eaf69b9f7b..aa03697963c8 100644 --- a/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java +++ b/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java @@ -182,7 +182,7 @@ class GitPushTargetPanel extends PushTargetPanel { @Override public void fireOnChange() { - if (myError == null) { + if (myError != null) { return; } String remoteName = myRemoteLabel.getText(); From 78380e948d3ca6fadf94f21699834d943c87db11 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Wed, 22 Oct 2014 14:55:51 +0200 Subject: [PATCH 12/64] less verbose test --- .../testSrc/com/intellij/index/IndexTest.java | 113 ++---------------- 1 file changed, 10 insertions(+), 103 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/index/IndexTest.java b/java/java-tests/testSrc/com/intellij/index/IndexTest.java index f561fef91882..b3be1f9f4feb 100644 --- a/java/java-tests/testSrc/com/intellij/index/IndexTest.java +++ b/java/java-tests/testSrc/com/intellij/index/IndexTest.java @@ -15,22 +15,21 @@ */ package com.intellij.index; -import com.intellij.codeHighlighting.BackgroundEditorHighlighter; import com.intellij.codeInsight.CodeInsightTestCase; -import com.intellij.ide.structureView.StructureViewBuilder; import com.intellij.openapi.command.WriteCommandAction; +import com.intellij.openapi.command.impl.CurrentEditorProvider; +import com.intellij.openapi.command.impl.UndoManagerImpl; import com.intellij.openapi.command.undo.UndoManager; import com.intellij.openapi.editor.Document; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.fileEditor.*; +import com.intellij.openapi.fileEditor.FileDocumentManager; +import com.intellij.openapi.fileEditor.FileEditor; +import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileTypes.PlainTextFileType; import com.intellij.openapi.util.Factory; -import com.intellij.openapi.util.Key; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry; -import com.intellij.pom.Navigatable; import com.intellij.psi.*; import com.intellij.psi.impl.PsiManagerEx; import com.intellij.psi.search.GlobalSearchScope; @@ -42,10 +41,7 @@ import com.intellij.util.indexing.MapIndexStorage; import com.intellij.util.indexing.StorageException; import com.intellij.util.io.*; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import javax.swing.*; -import java.beans.PropertyChangeListener; import java.io.DataInput; import java.io.DataOutput; import java.io.File; @@ -311,7 +307,6 @@ public class IndexTest extends CodeInsightTestCase { PsiDocumentManager.getInstance(myProject).commitAllDocuments(); assertEquals(" Foo", file.getText()); assertOneElement(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo")); - } }); } @@ -339,101 +334,13 @@ public class IndexTest extends CodeInsightTestCase { }); final UndoManager undoManager = UndoManager.getInstance(getProject()); - final Editor editor = createEditor(vFile); - final FileEditor selectedEditor = new TextEditor() { - @NotNull + final FileEditor selectedEditor = FileEditorManager.getInstance(myProject).openFile(vFile, false)[0]; + ((UndoManagerImpl)undoManager).setEditorProvider(new CurrentEditorProvider() { @Override - public Editor getEditor() { - return editor; + public FileEditor getCurrentEditor() { + return selectedEditor; } - - @Override - public boolean canNavigateTo(@NotNull Navigatable navigatable) { - return false; - } - - @Override - public void navigateTo(@NotNull Navigatable navigatable) {} - - @NotNull - @Override - public JComponent getComponent() { - return null; - } - - @Nullable - @Override - public JComponent getPreferredFocusedComponent() { - return null; - } - - @NotNull - @Override - public String getName() { - return null; - } - - @NotNull - @Override - public FileEditorState getState(@NotNull FileEditorStateLevel level) { - return null; - } - - @Override - public void setState(@NotNull FileEditorState state) {} - - @Override - public boolean isModified() { - return false; - } - - @Override - public boolean isValid() { - return false; - } - - @Override - public void selectNotify() {} - - @Override - public void deselectNotify() {} - - @Override - public void addPropertyChangeListener(@NotNull PropertyChangeListener listener) {} - - @Override - public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) {} - - @Nullable - @Override - public BackgroundEditorHighlighter getBackgroundHighlighter() { - return null; - } - - @Nullable - @Override - public FileEditorLocation getCurrentLocation() { - return null; - } - - @Nullable - @Override - public StructureViewBuilder getStructureViewBuilder() { - return null; - } - - @Override - public void dispose() {} - - @Nullable - @Override - public T getUserData(@NotNull Key key) { - return null; - } - - @Override - public void putUserData(@NotNull Key key, @Nullable T value) {} - }; + }); assertTrue(undoManager.isUndoAvailable(selectedEditor)); FileDocumentManager.getInstance().saveDocument(document); From 7b940b6f91a86bb0195cb044a38d87120ef0cb8b Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 22 Oct 2014 17:06:12 +0400 Subject: [PATCH 13/64] IDEA-131712 Debugger is showing current position on evaluate --- .../src/com/intellij/xdebugger/impl/frame/XFramesView.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java index 4fb2b75c13a0..77e154a329c2 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java @@ -121,6 +121,7 @@ public class XFramesView extends XDebugView { XDebugSession session = getSession(e); if (session != null) { mySelectedFrameIndex = 0; + myRefresh = false; updateFrames((XExecutionStack)item, session); } } @@ -305,7 +306,7 @@ public class XFramesView extends XDebugView { Object selected = myFramesList.getSelectedValue(); if (selected instanceof XStackFrame) { if (session != null) { - if (force || !myRefresh) { + if (force || (!myRefresh && session.getCurrentStackFrame() != selected)) { session.setCurrentStackFrame(mySelectedStack, (XStackFrame)selected, mySelectedFrameIndex == 0); } } From b73348f83c353078d05fd0b8b58dda0ebe8eb2f0 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Wed, 22 Oct 2014 17:03:55 +0400 Subject: [PATCH 14/64] IDEA-131732 Update label in "Server Certificates" configurable --- .../com/intellij/util/net/ssl/CertificateConfigurable.form | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateConfigurable.form b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateConfigurable.form index 18c12cb56090..fc148671aeab 100644 --- a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateConfigurable.form +++ b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateConfigurable.form @@ -3,7 +3,7 @@ - + @@ -56,7 +56,7 @@ - + From dfcbd14bb077acf22e9a53963073589bdae93324 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 22 Oct 2014 17:07:41 +0400 Subject: [PATCH 15/64] UP-2253 --- .../xml/impl/schema/XmlElementDescriptorImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java index 7bf9f02710b3..49d3c4c12245 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java @@ -219,7 +219,6 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor if (type instanceof ComplexTypeDescriptor) { final ComplexTypeDescriptor descriptor = (ComplexTypeDescriptor)type; - String contextNs; PsiFile containingFile = context != null ? context.getContainingFile():null; if (context != null && !containingFile.isPhysical()) { @@ -227,10 +226,11 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor //context = context.getParentTag(); } + String contextNs; if (context != null && - ( descriptor.canContainTag(context.getLocalName(), contextNs = context.getNamespace(), context ) && - (!contextNs.equals(getNamespace()) || descriptor.hasAnyInContentModel()) - ) ) { + descriptor.canContainTag(context.getLocalName(), contextNs = context.getNamespace(), context) && + (!contextNs.equals(getNamespace()) || descriptor.hasAnyInContentModel()) && + containingFile instanceof XmlFile) { // JSXmlLiteralExpressionImpl is crazy final XmlNSDescriptor nsDescriptor = getNSDescriptor(); if (nsDescriptor != null) { From b69b10a65d7e01d78cdbd4b7afbee183128f4322 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 22 Oct 2014 14:33:15 +0200 Subject: [PATCH 16/64] back reference is two words --- .../intellij/lang/regexp/validation/RegExpAnnotator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java index 1d32bf8ab6eb..d326d2c28557 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java @@ -124,14 +124,14 @@ public final class RegExpAnnotator extends RegExpElementVisitor implements Annot public void visitRegExpBackref(final RegExpBackref backref) { final RegExpGroup group = backref.resolve(); if (group == null) { - final Annotation a = myHolder.createErrorAnnotation(backref, "Unresolved backreference"); + final Annotation a = myHolder.createErrorAnnotation(backref, "Unresolved back reference"); if (a != null) { // IDEA-9381 a.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); } } else if (PsiTreeUtil.isAncestor(group, backref, true)) { - myHolder.createWarningAnnotation(backref, "Backreference is nested into the capturing group it refers to"); + myHolder.createWarningAnnotation(backref, "Back reference is nested into the capturing group it refers to"); } } @@ -173,7 +173,7 @@ public final class RegExpAnnotator extends RegExpElementVisitor implements Annot */ final RegExpGroup group = groupRef.resolve(); if (group == null) { - final Annotation a = myHolder.createErrorAnnotation(groupRef, "Unresolved backreference"); + final Annotation a = myHolder.createErrorAnnotation(groupRef, "Unresolved back reference"); if (a != null) { // IDEA-9381 a.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); From 49dfd377d1e801bb8d301d9d2006081d5669dcb9 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 22 Oct 2014 14:38:11 +0200 Subject: [PATCH 17/64] regexp: brace matching for named groups (IDEA-124018) --- .../src/org/intellij/lang/regexp/RegExpBraceMatcher.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpBraceMatcher.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpBraceMatcher.java index 748458d218d5..c815d4bc9c48 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpBraceMatcher.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpBraceMatcher.java @@ -30,6 +30,8 @@ public class RegExpBraceMatcher implements PairedBraceMatcher { new BracePair(RegExpTT.POS_LOOKBEHIND, RegExpTT.GROUP_END, true), new BracePair(RegExpTT.NEG_LOOKBEHIND, RegExpTT.GROUP_END, true), new BracePair(RegExpTT.PYTHON_NAMED_GROUP, RegExpTT.GROUP_END, true), new BracePair(RegExpTT.PYTHON_NAMED_GROUP_REF, RegExpTT.GROUP_END, true), + new BracePair(RegExpTT.RUBY_NAMED_GROUP, RegExpTT.GROUP_END, true), + new BracePair(RegExpTT.RUBY_QUOTED_NAMED_GROUP, RegExpTT.GROUP_END, true), new BracePair(RegExpTT.CLASS_BEGIN, RegExpTT.CLASS_END, false), new BracePair(RegExpTT.LBRACE, RegExpTT.RBRACE, false), new BracePair(RegExpTT.QUOTE_BEGIN, RegExpTT.QUOTE_END, false),}; } From 6239e6086ac33e83e52f5d6b6feef9b3eaa64f94 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 22 Oct 2014 15:16:33 +0200 Subject: [PATCH 18/64] java regex does not support Ruby quoted named group syntax --- .../src/org/intellij/lang/regexp/psi/RegExpGroup.java | 2 ++ .../org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java | 4 ++++ java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.java | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/RegExpSupport/src/org/intellij/lang/regexp/psi/RegExpGroup.java b/RegExpSupport/src/org/intellij/lang/regexp/psi/RegExpGroup.java index d1afd4e05b79..c0a1278b72dd 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/psi/RegExpGroup.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/psi/RegExpGroup.java @@ -29,6 +29,8 @@ public interface RegExpGroup extends RegExpAtom { boolean isRubyNamedGroup(); + boolean isNamedGroup(); + @Nullable String getGroupName(); } diff --git a/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java b/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java index b24669757917..023f64cf16b2 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java @@ -56,6 +56,10 @@ public class RegExpGroupImpl extends RegExpElementImpl implements RegExpGroup { getNode().findChildByType(RegExpTT.RUBY_QUOTED_NAMED_GROUP) != null; } + public boolean isNamedGroup() { + return getNode().findChildByType(RegExpTT.RUBY_NAMED_GROUP) != null; + } + public String getGroupName() { if (!isPythonNamedGroup()) { return null; diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.java b/java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.java index 21a03d7e2bc3..86ca15a074dd 100644 --- a/java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.java +++ b/java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.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. @@ -60,7 +60,7 @@ public class JavaRegExpHost implements RegExpLanguageHost { @Override public boolean supportsNamedGroupSyntax(RegExpGroup group) { - if (group.isRubyNamedGroup()) { + if (group.isNamedGroup()) { final Module module = ModuleUtilCore.findModuleForPsiElement(group); if (module != null) { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); From a3b5205ae4bd195839b42320b48c613b4e8aa64c Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 22 Oct 2014 15:22:22 +0200 Subject: [PATCH 19/64] regex: highlight groups as parentheses (IDEA-124018) --- .../org/intellij/lang/regexp/RegExpHighlighter.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpHighlighter.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpHighlighter.java index fd3a8b03bd22..971cf56755fe 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpHighlighter.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpHighlighter.java @@ -120,6 +120,16 @@ public class RegExpHighlighter extends SyntaxHighlighterBase { keys1.put(RegExpTT.QUOTE_BEGIN, QUOTE_CHARACTER); keys1.put(RegExpTT.QUOTE_END, QUOTE_CHARACTER); + keys1.put(RegExpTT.NON_CAPT_GROUP, PARENTHS); + keys1.put(RegExpTT.POS_LOOKBEHIND, PARENTHS); + keys1.put(RegExpTT.NEG_LOOKBEHIND, PARENTHS); + keys1.put(RegExpTT.POS_LOOKAHEAD, PARENTHS); + keys1.put(RegExpTT.NEG_LOOKAHEAD, PARENTHS); + keys1.put(RegExpTT.SET_OPTIONS, PARENTHS); + keys1.put(RegExpTT.PYTHON_NAMED_GROUP, PARENTHS); + keys1.put(RegExpTT.PYTHON_NAMED_GROUP_REF, PARENTHS); + keys1.put(RegExpTT.RUBY_NAMED_GROUP, PARENTHS); + keys1.put(RegExpTT.RUBY_QUOTED_NAMED_GROUP, PARENTHS); keys1.put(RegExpTT.GROUP_BEGIN, PARENTHS); keys1.put(RegExpTT.GROUP_END, PARENTHS); From 16ab0a8322c19010473b557245fcd1f155cdc1ee Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Wed, 22 Oct 2014 15:25:24 +0200 Subject: [PATCH 20/64] Project View: sort directories by type as well (e.g. OS X bundles .app, .framework) --- .../intellij/projectView/ProjectTreeSortingTest.java | 10 +++++----- .../ide/projectView/impl/nodes/PsiDirectoryNode.java | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/projectView/ProjectTreeSortingTest.java b/java/java-tests/testSrc/com/intellij/projectView/ProjectTreeSortingTest.java index cc06d15c396e..b25ca382f2fb 100644 --- a/java/java-tests/testSrc/com/intellij/projectView/ProjectTreeSortingTest.java +++ b/java/java-tests/testSrc/com/intellij/projectView/ProjectTreeSortingTest.java @@ -132,11 +132,11 @@ public class ProjectTreeSortingTest extends BaseProjectViewTestCase { ((ProjectViewImpl)myProjectView).setFoldersAlwaysOnTop(false); assertTree("-foldersOnTop\n" + " a.java\n" + + " +b.java\n" + " c.java\n" + " a.txt\n" + - " c.txt\n" + - " +b.java\n" + - " +b.txt\n"); + " +b.txt\n"+ + " c.txt\n"); } public void testSortByTypeBetweenFilesAndFolders() throws Exception { @@ -156,11 +156,11 @@ public class ProjectTreeSortingTest extends BaseProjectViewTestCase { assertTree("-sortByTypeBetweenFilesAndFolders\n" + " a.java\n" + " b.java\n" + + " +a.java_folder\n" + + " +b.java_folder\n" + " a.txt\n" + " b.txt\n" + - " +a.java_folder\n" + " +a_folder\n" + - " +b.java_folder\n" + " +b_folder\n"); } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java index 16aa930b806a..ec0b9dd8b6c6 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java @@ -318,6 +318,14 @@ public class PsiDirectoryNode extends BasePsiNode implements Navig return null; } + @Override + public Comparable getTypeSortKey() { + VirtualFile file = getVirtualFile(); + if (file == null) return null; + String extension = file.getExtension(); + return extension == null ? null : new PsiFileNode.ExtensionSortKey(extension); + } + @Override public String getQualifiedNameSortKey() { final PsiDirectoryFactory factory = PsiDirectoryFactory.getInstance(getProject()); From 34abbd85c020fbf69b320487fb676fd4b8ef4688 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Wed, 22 Oct 2014 17:49:47 +0400 Subject: [PATCH 21/64] invoke FileEditorProvider.accept() from read action --- .../fileEditor/impl/FileEditorManagerImpl.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java index c4ac427f89b5..0dc4f5bc7209 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java @@ -771,15 +771,13 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec try { final FileEditorProvider provider = newProviders[i]; LOG.assertTrue(provider != null, "Provider for file "+file+" is null. All providers: "+Arrays.asList(newProviders)); - LOG.assertTrue(provider.accept(myProject, file), "Provider " + provider + " doesn't accept file " + file); - if ((provider instanceof AsyncFileEditorProvider)) { - builders[i] = ApplicationManager.getApplication().runReadAction(new Computable() { - @Override - public AsyncFileEditorProvider.Builder compute() { - return ((AsyncFileEditorProvider)provider).createEditorAsync(myProject, file); - } - }); - } + builders[i] = ApplicationManager.getApplication().runReadAction(new Computable() { + @Override + public AsyncFileEditorProvider.Builder compute() { + LOG.assertTrue(provider.accept(myProject, file), "Provider " + provider + " doesn't accept file " + file); + return provider instanceof AsyncFileEditorProvider ? ((AsyncFileEditorProvider)provider).createEditorAsync(myProject, file) : null; + } + }); } catch (Exception e) { LOG.error(e); From 9bb274c2696a3f7df93dc822c84794e5d2cdc600 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 22 Oct 2014 18:22:39 +0400 Subject: [PATCH 22/64] IDEA-92343 File Structure popup appears on wrong monitor --- .../openapi/util/DimensionService.java | 18 +++++++++--------- .../com/intellij/ui/popup/AbstractPopup.java | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java b/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java index 715b703e2321..5844767aac87 100644 --- a/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java +++ b/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java @@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.wm.IdeFocusManager; +import com.intellij.openapi.wm.IdeFrame; import com.intellij.openapi.wm.WindowManager; import com.intellij.ui.ScreenUtil; import com.intellij.util.containers.hash.LinkedHashMap; @@ -252,15 +253,14 @@ public class DimensionService implements PersistentStateComponent { } JFrame frame = null; - if (project == null) { - final Component owner = IdeFocusManager.findInstance().getFocusOwner(); - if (owner != null) { - frame = UIUtil.getParentOfType(JFrame.class, owner); - } - if (frame == null) { - frame = WindowManager.getInstance().findVisibleFrame(); - } - } else { + final Component owner = IdeFocusManager.findInstance().getFocusOwner(); + if (owner != null) { + frame = UIUtil.getParentOfType(JFrame.class, owner); + } + if (frame == null) { + frame = WindowManager.getInstance().findVisibleFrame(); + } + if (project != null && (frame == null || (frame instanceof IdeFrame && project != ((IdeFrame)frame).getProject()))) { frame = WindowManager.getInstance().getFrame(project); } Rectangle screen = new Rectangle(0, 0, 0, 0); diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java index 7274d0930824..039868096f10 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -747,7 +747,7 @@ public class AbstractPopup implements JBPopup { Point xy = new Point(aScreenX, aScreenY); boolean adjustXY = true; - if (myDimensionServiceKey != null) { + if (myUseDimServiceForXYLocation && myDimensionServiceKey != null) { final Point storedLocation = DimensionService.getInstance().getLocation(myDimensionServiceKey, myProject); if (storedLocation != null) { xy = storedLocation; From 9679d0e594fc7da1aaa9b43b503f374e07588abf Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 22 Oct 2014 18:45:21 +0400 Subject: [PATCH 23/64] decompiler: more correct toString --- .../org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java index 44c58f04e196..13658580fe4e 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java @@ -82,6 +82,7 @@ public class ControlFlowGraph implements CodeConstants { } public String toString() { + if (blocks == null) return "Empty"; String new_line_separator = DecompilerContext.getNewLineSeparator(); From 9c1a6769f516413b33848cfe996f6485ec7b4ccd Mon Sep 17 00:00:00 2001 From: nik Date: Fri, 17 Oct 2014 21:33:08 +0400 Subject: [PATCH 24/64] deserialization of type-specific inner properties: don't pass 'null' to 'loadState' --- .../openapi/components/ComponentSerializationUtil.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/core-impl/src/com/intellij/openapi/components/ComponentSerializationUtil.java b/platform/core-impl/src/com/intellij/openapi/components/ComponentSerializationUtil.java index 33eee1a79178..0093d0016881 100644 --- a/platform/core-impl/src/com/intellij/openapi/components/ComponentSerializationUtil.java +++ b/platform/core-impl/src/com/intellij/openapi/components/ComponentSerializationUtil.java @@ -35,7 +35,10 @@ public class ComponentSerializationUtil { public static void loadComponentState(@NotNull PersistentStateComponent configuration, @Nullable Element element) { if (element != null) { Class stateClass = getStateClass(configuration.getClass()); - configuration.loadState(XmlSerializer.deserialize(element, stateClass)); + S state = XmlSerializer.deserialize(element, stateClass); + if (state != null) { + configuration.loadState(state); + } } } } From 5cad53fa66e829024072197ce13a0bbd7287d033 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Wed, 22 Oct 2014 19:29:46 +0400 Subject: [PATCH 25/64] 118571 Fixed setting locale for svn command line client - "LC_ALL" variable is set to configured locale, "LANGUAGE" variable is cleared (to use english output, if localization files for configured locale are not found) --- .../idea/svn/commandLine/CommandExecutor.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java index cdca82de6966..e00b8f1e3183 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java @@ -75,8 +75,7 @@ public class CommandExecutor { public CommandExecutor(@NotNull @NonNls String exePath, @NotNull Command command) { myCommand = command; myResultBuilder = command.getResultBuilder(); - if (myResultBuilder != null) - { + if (myResultBuilder != null) { myListeners.addListener(myResultBuilder); // cancel tracker should be executed after result builder myListeners.addListener(new CommandCancelTracker()); @@ -160,12 +159,13 @@ public class CommandExecutor { private void setupLocale() { String locale = Registry.stringValue("svn.executable.locale"); - Map environment = myCommandLine.getEnvironment(); - // TODO: check if we need to set LC_ALL to configured locale or just clear it - environment.put("LC_ALL", ""); - environment.put("LC_MESSAGES", locale); - environment.put("LANG", locale); + if (!StringUtil.isEmpty(locale)) { + Map environment = myCommandLine.getEnvironment(); + + environment.put("LANGUAGE", ""); + environment.put("LC_ALL", locale); + } } private void ensureMessageFile() throws SvnBindException { @@ -413,7 +413,7 @@ public class CommandExecutor { * @throws IllegalStateException if process has not been started */ protected void checkStarted() { - if (! isStarted()) { + if (!isStarted()) { throw new IllegalStateException("The process is not started yet"); } } From 17c554f98a76918352143ea0cfd0d11191066da9 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Wed, 22 Oct 2014 19:33:02 +0400 Subject: [PATCH 26/64] 118571 Changed default value for "svn.executable.locale" to "en_US.UTF-8" (instead of "C.UTF-8") --- platform/util/resources/misc/registry.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index c7a10d57d8e2..d2365fb50adc 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -353,7 +353,7 @@ search.everywhere.configurations=true search.everywhere.settings=false svn.use.incoming.optimization=false -svn.executable.locale=C.UTF-8 +svn.executable.locale=en_US.UTF-8 svn.lowest.supported.format.for.command.line=1.7.0 svn.use.svnkit.for.https.server.certificate.check=true From 542aa23b043654eb6b7366ea8f9cbdd4476827f1 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 22 Oct 2014 17:38:07 +0200 Subject: [PATCH 27/64] continue Firefox RDP --- .../jetbrains/rpc/ChannelBufferToString.java | 11 ++- .../src/org/jetbrains/rpc/MessageDecoder.java | 87 ++++++++++++++++++ .../connection/RemoteVmConnection.java | 49 +++++++++++ .../debugger/connection/VmConnection.java | 1 - .../src/org/jetbrains/io/JsonReaderEx.java | 22 +++-- .../jsonProtocol/JsonParseMethod.java | 1 - .../protocol-reader/protocol-reader.iml | 6 +- .../protocolReader/AbsentSubtypeAspect.java | 29 ------ .../protocolReader/DynamicReader.java | 45 +++++----- .../protocolReader/ExistingSubtypeAspect.java | 8 +- .../protocolReader/FieldProcessor.java | 17 +--- .../jetbrains/protocolReader/GlobalScope.java | 3 +- .../protocolReader/InterfaceReader.java | 5 +- .../protocolReader/MethodHandler.java | 17 ++-- .../protocolReader/ObjectValueReader.java | 2 +- .../protocolReader/ReadDelegate.java | 17 +++- .../protocolReader/ReaderGenerator.java | 19 ++-- .../jetbrains/protocolReader/ReaderRoot.java | 9 +- .../protocolReader/SubtypeAspect.java | 19 ---- .../jetbrains/protocolReader/TypeHandler.java | 88 ++++++++++++------- .../org/jetbrains/protocolReader/Util.java | 6 +- 21 files changed, 296 insertions(+), 165 deletions(-) create mode 100644 platform/script-debugger/backend/src/org/jetbrains/rpc/MessageDecoder.java delete mode 100644 platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/AbsentSubtypeAspect.java delete mode 100644 platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/SubtypeAspect.java diff --git a/platform/script-debugger/backend/src/org/jetbrains/rpc/ChannelBufferToString.java b/platform/script-debugger/backend/src/org/jetbrains/rpc/ChannelBufferToString.java index 0b18ebcd1eb2..bb776e55ea20 100644 --- a/platform/script-debugger/backend/src/org/jetbrains/rpc/ChannelBufferToString.java +++ b/platform/script-debugger/backend/src/org/jetbrains/rpc/ChannelBufferToString.java @@ -3,6 +3,8 @@ package org.jetbrains.rpc; import com.intellij.util.text.StringFactory; import io.netty.buffer.ByteBuf; import io.netty.util.CharsetUtil; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.nio.ByteBuffer; import java.nio.CharBuffer; @@ -29,7 +31,7 @@ public final class ChannelBufferToString { } } - public static CharBuffer readIntoCharBuffer(CharBuffer charBuffer, ByteBuf buffer, int byteCount) { + public static CharBuffer readIntoCharBuffer(@Nullable CharBuffer charBuffer, @NotNull ByteBuf buffer, int byteCount) { CharsetDecoder decoder = CharsetUtil.getDecoder(CharsetUtil.UTF_8); ByteBuffer in = buffer.nioBuffer(buffer.readerIndex(), byteCount); if (charBuffer == null) { @@ -52,4 +54,11 @@ public final class ChannelBufferToString { buffer.skipBytes(byteCount); return charBuffer; } + + public static void writeIntAsAscii(int value, @NotNull ByteBuf buffer) { + String string = Integer.toString(value); + for (int i = 0; i < string.length(); i++) { + buffer.writeByte(string.charAt(i)); + } + } } \ No newline at end of file diff --git a/platform/script-debugger/backend/src/org/jetbrains/rpc/MessageDecoder.java b/platform/script-debugger/backend/src/org/jetbrains/rpc/MessageDecoder.java new file mode 100644 index 000000000000..9d7e35198225 --- /dev/null +++ b/platform/script-debugger/backend/src/org/jetbrains/rpc/MessageDecoder.java @@ -0,0 +1,87 @@ +package org.jetbrains.rpc; + +import io.netty.buffer.ByteBuf; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.io.SimpleChannelInboundHandlerAdapter; + +import java.nio.CharBuffer; + +public abstract class MessageDecoder extends SimpleChannelInboundHandlerAdapter { + protected int contentLength; + protected final StringBuilder builder = new StringBuilder(64); + + private CharBuffer chunkedContent; + private int consumedContentByteCount = 0; + + protected final int parseContentLength() { + return parseInt(builder, 0, false, 10); + } + + @Nullable + protected String doReadContent(@NotNull ByteBuf buffer) { + int required = contentLength - consumedContentByteCount; + String result; + if (buffer.readableBytes() < required) { + if (chunkedContent == null) { + chunkedContent = CharBuffer.allocate(contentLength); + } + + int count = buffer.readableBytes(); + ChannelBufferToString.readIntoCharBuffer(chunkedContent, buffer, count); + consumedContentByteCount += count; + return null; + } + else if (chunkedContent != null) { + ChannelBufferToString.readIntoCharBuffer(chunkedContent, buffer, required); + result = ChannelBufferToString.charBufferToString(chunkedContent); + + chunkedContent = null; + consumedContentByteCount = 0; + return result; + } + else { + // we can produce char sequence CharSequence result = CharsetUtil.UTF_8.decode(buffer.toByteBuffer(buffer.readerIndex(), required)); + // but later, in JsonReaderEx, it will be toString in any case, so, in this case, intermediate java.nio.HeapCharBuffer will be created - so, we stay with String + return ChannelBufferToString.readString(buffer, required); + } + } + + /** + * Javolution - Java(TM) Solution for Real-Time and Embedded Systems + * Copyright (C) 2006 - Javolution (http://javolution.org/) + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software is + * freely granted, provided that this notice is preserved. + */ + private static int parseInt(final CharSequence value, final int start, final boolean isNegative, final int radix) { + final int end = value.length(); + int result = 0; // Accumulates negatively (avoid MIN_VALUE overflow). + int i = start; + for (; i < end; i++) { + char c = value.charAt(i); + int digit = (c <= '9') ? c - '0' + : ((c <= 'Z') && (c >= 'A')) ? c - 'A' + 10 + : ((c <= 'z') && (c >= 'a')) ? c - 'a' + 10 : -1; + if ((digit >= 0) && (digit < radix)) { + int newResult = result * radix - digit; + if (newResult > result) { + throw new NumberFormatException("Overflow parsing " + value.subSequence(start, end)); + } + result = newResult; + } + else { + break; + } + } + // Requires one valid digit character and checks for opposite overflow. + if ((result == 0) && ((end == 0) || (value.charAt(i - 1) != '0'))) { + throw new NumberFormatException("Invalid integer representation for " + value.subSequence(start, end)); + } + if ((result == Integer.MIN_VALUE) && !isNegative) { + throw new NumberFormatException("Overflow parsing " + value.subSequence(start, end)); + } + return isNegative ? result : -result; + } +} \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.java index 6557de5130fe..753ec0c05cb9 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.java +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.java @@ -2,15 +2,22 @@ package org.jetbrains.debugger.connection; import com.intellij.ide.browsers.WebBrowser; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.util.ActionCallback; import com.intellij.openapi.util.AsyncResult; +import com.intellij.ui.ColoredListCellRenderer; +import com.intellij.ui.components.JBList; import com.intellij.util.Consumer; +import com.intellij.util.Function; +import com.intellij.util.containers.ContainerUtil; import com.intellij.util.io.socketConnection.ConnectionStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.debugger.Vm; +import javax.swing.*; import java.net.InetSocketAddress; +import java.util.Collection; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicReference; @@ -87,4 +94,46 @@ public abstract class RemoteVmConnection extends VmConnection { } return callback; } + + @NotNull + public static AsyncResult chooseDebuggee(@NotNull final Collection targets, final int selectedIndex, @NotNull final Function itemToString) { + if (targets.size() == 1) { + return AsyncResult.done(ContainerUtil.getFirstItem(targets)); + } + + final AsyncResult result = new AsyncResult(); + ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override + public void run() { + final JBList list = new JBList(targets); + list.setCellRenderer(new ColoredListCellRenderer() { + @Override + protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { + //noinspection unchecked + append(itemToString.fun((T)value)); + } + }); + list.setSelectedIndex(selectedIndex); + + JBPopupFactory.getInstance(). + createListPopupBuilder(list). + setTitle("Choose Page to debug"). + setItemChoosenCallback(new Runnable() { + @Override + public void run() { + @SuppressWarnings("unchecked") + T value = (T)list.getSelectedValue(); + if (value == null) { + result.setRejected(); + } + else { + result.setDone(value); + } + } + }). + createPopup().showInFocusCenter(); + } + }); + return result; + } } \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/VmConnection.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/VmConnection.java index 7a6c17169e7f..6f7d14c65100 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/VmConnection.java +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/VmConnection.java @@ -24,7 +24,6 @@ public abstract class VmConnection implements Disposable, BrowserC protected volatile T vm; private final ActionCallback opened = new ActionCallback(); - private final AtomicBoolean closed = new AtomicBoolean(); public final Vm getVm() { diff --git a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/io/JsonReaderEx.java b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/io/JsonReaderEx.java index 7dad7854ca0d..eaf83b872be8 100644 --- a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/io/JsonReaderEx.java +++ b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/io/JsonReaderEx.java @@ -665,6 +665,15 @@ public final class JsonReaderEx implements Closeable { * Returns the next token, a {@link JsonToken#NAME property name}, and consumes it */ public String nextName() { + String result = nextNameOrNull(); + if (result == null) { + throw createParseError("Expected a name but was " + peek()); + } + return result; + } + + @Nullable + public String nextNameOrNull() { int p = peeked; if (p == PEEKED_NONE) { p = doPeek(); @@ -680,7 +689,10 @@ public final class JsonReaderEx implements Closeable { result = nextQuotedValue('"'); } else { - throw createParseError("Expected a name but was " + peek()); + if (p != PEEKED_END_OBJECT && p != PEEKED_END_ARRAY) { + throw createParseError("Expected a name but was " + peek()); + } + return null; } peeked = PEEKED_NONE; return result; @@ -713,6 +725,7 @@ public final class JsonReaderEx implements Closeable { return in.charAt(offset + index); } + @NotNull @Override public CharSequence subSequence(int start, int end) { if ((end - start) > length) { @@ -1153,6 +1166,7 @@ public final class JsonReaderEx implements Closeable { /** * Closes this JSON reader and the underlying {@link java.io.Reader}. */ + @Override public void close() { peeked = PEEKED_NONE; stack[0] = JsonScope.CLOSED; @@ -1180,11 +1194,7 @@ public final class JsonReaderEx implements Closeable { push(JsonScope.EMPTY_OBJECT); count++; } - else if (p == PEEKED_END_ARRAY) { - stackSize--; - count--; - } - else if (p == PEEKED_END_OBJECT) { + else if (p == PEEKED_END_ARRAY || p == PEEKED_END_OBJECT) { stackSize--; count--; } diff --git a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonParseMethod.java b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonParseMethod.java index 8016b9b59539..6e7d21dee963 100644 --- a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonParseMethod.java +++ b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonParseMethod.java @@ -1,7 +1,6 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - package org.jetbrains.jsonProtocol; import java.lang.annotation.ElementType; diff --git a/platform/script-debugger/protocol/protocol-reader/protocol-reader.iml b/platform/script-debugger/protocol/protocol-reader/protocol-reader.iml index d809f8c5132e..f8259f8992b9 100644 --- a/platform/script-debugger/protocol/protocol-reader/protocol-reader.iml +++ b/platform/script-debugger/protocol/protocol-reader/protocol-reader.iml @@ -1,6 +1,6 @@ - + @@ -10,6 +10,6 @@ + - - + \ No newline at end of file diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/AbsentSubtypeAspect.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/AbsentSubtypeAspect.java deleted file mode 100644 index 4a3b18df1d0e..000000000000 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/AbsentSubtypeAspect.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.jetbrains.protocolReader; - -class AbsentSubtypeAspect extends SubtypeAspect { - - @Override - void writeGetSuperMethodJava(TextOutput out) { - } - - @Override - void writeSuperFieldJava(TextOutput out) { - } - - @Override - void writeSuperConstructorParamJava(TextOutput out) { - } - - @Override - void writeSuperConstructorInitialization(TextOutput out) { - } - - @Override - void writeParseMethod(String className, ClassScope scope, TextOutput out) { - } - - @Override - public void writeInstantiateCode(String className, TextOutput out) { - out.append("new ").append(className); - } -} diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/DynamicReader.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/DynamicReader.java index 3485c83e684f..bd4b5f332ada 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/DynamicReader.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/DynamicReader.java @@ -1,10 +1,11 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - package org.jetbrains.protocolReader; -import java.util.*; +import gnu.trove.THashMap; +import org.jetbrains.annotations.NotNull; + +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.Map; public class DynamicReader { final LinkedHashMap, TypeHandler> typeToTypeHandler; @@ -15,20 +16,20 @@ public class DynamicReader { root = new ReaderRoot<>(readerRootClass, typeToTypeHandler); } - public GeneratedCodeMap generateStaticReader(StringBuilder stringBuilder, String packageName, String className, - Collection basePackages) { - final GlobalScope globalScope = new GlobalScope(typeToTypeHandler.values(), basePackages); + @NotNull + public GeneratedCodeMap generateReader(StringBuilder stringBuilder, String packageName, String className, + Collection basePackages) { + GlobalScope globalScope = new GlobalScope(typeToTypeHandler.values(), basePackages); FileScope fileScope = globalScope.newFileScope(stringBuilder); - final TextOutput out = fileScope.getOutput(); + TextOutput out = fileScope.getOutput(); out.append("// Generated source"); out.newLine().append("package ").append(packageName).append(';'); out.newLine().newLine().append("import org.jetbrains.jsonProtocol.*;"); out.newLine().newLine().append("import static org.jetbrains.jsonProtocol.JsonReaders.*;"); out.newLine().newLine().append("public final class ").append(className).space(); - out.append(root.getType().isInterface() ? "implements" : "extends").space().append(root.getType().getCanonicalName()).openBlock( - false); + out.append(root.getType().isInterface() ? "implements" : "extends").space().append(root.getType().getCanonicalName()).openBlock(false); - final ClassScope rootClassScope = fileScope.newClassScope(); + ClassScope rootClassScope = fileScope.newClassScope(); root.writeStaticMethodJava(rootClassScope); for (TypeHandler typeHandler : typeToTypeHandler.values()) { @@ -37,27 +38,31 @@ public class DynamicReader { out.newLine(); } + boolean isFirst = true; for (TypeHandler typeHandler : globalScope.getTypeFactories()) { - String name = globalScope.getTypeImplShortName(typeHandler); + if (isFirst) { + isFirst = false; + } + else { + out.newLine(); + } + String originName = typeHandler.getTypeClass().getCanonicalName(); - out.newLine().append("static final class ").append(name).append(Util.TYPE_FACTORY_NAME_POSTFIX).append(" extends ObjectFactory<"); + out.newLine().append("private static final class ").append(globalScope.getTypeImplShortName(typeHandler)).append(Util.TYPE_FACTORY_NAME_POSTFIX).append(" extends ObjectFactory<"); out.append(originName).append('>').openBlock(); out.append("@Override").newLine().append("public ").append(originName).append(" read(").append(Util.JSON_READER_PARAMETER_DEF); out.append(')').openBlock(); out.append("return "); typeHandler.writeInstantiateCode(rootClassScope, out); - out.append('(').append(Util.READER_NAME).append(");").closeBlock(); + out.append('(').append(Util.READER_NAME).append(", null);").closeBlock(); out.closeBlock(); - out.newLine(); } out.closeBlock(); - Map, String> typeToImplClassName = new HashMap<>(); + Map, String> typeToImplClassName = new THashMap<>(); for (TypeHandler typeHandler : typeToTypeHandler.values()) { - String shortName = fileScope.getTypeImplShortName(typeHandler); - String fullReference = packageName + "." + className + "." + shortName; - typeToImplClassName.put(typeHandler.getTypeClass(), fullReference); + typeToImplClassName.put(typeHandler.getTypeClass(), packageName + "." + className + "." + fileScope.getTypeImplShortName(typeHandler)); } return new GeneratedCodeMap(typeToImplClassName); diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ExistingSubtypeAspect.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ExistingSubtypeAspect.java index 4e79fb71498d..326d3f9a1c81 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ExistingSubtypeAspect.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ExistingSubtypeAspect.java @@ -1,6 +1,6 @@ package org.jetbrains.protocolReader; -class ExistingSubtypeAspect extends SubtypeAspect { +class ExistingSubtypeAspect { private SubtypeCaster subtypeCaster; private final TypeRef jsonSuperClass; @@ -12,28 +12,23 @@ class ExistingSubtypeAspect extends SubtypeAspect { this.subtypeCaster = subtypeCaster; } - @Override void writeGetSuperMethodJava(TextOutput out) { out.newLine().append("@Override").newLine().append("public ").append(jsonSuperClass.get().getTypeClass().getCanonicalName() ).append(" getSuper()").openBlock(); out.append("return ").append(Util.BASE_VALUE_PREFIX).semi().closeBlock(); } - @Override void writeSuperFieldJava(TextOutput out) { out.newLine().append("private final ").append(jsonSuperClass.get().getTypeClass().getCanonicalName()).append(' ').append(Util.BASE_VALUE_PREFIX).semi().newLine(); } - @Override void writeSuperConstructorParamJava(TextOutput out) { out.comma().append(jsonSuperClass.get().getTypeClass().getCanonicalName()).append(' ').append(Util.BASE_VALUE_PREFIX); } - @Override void writeSuperConstructorInitialization(TextOutput out) { out.append("this.").append(Util.BASE_VALUE_PREFIX).append(" = ").append(Util.BASE_VALUE_PREFIX).append(';').newLine().newLine(); } - @Override void writeParseMethod(String className, ClassScope scope, TextOutput out) { out.newLine().append("public static ").append(className).space().append("parse").append("(").append(Util.JSON_READER_PARAMETER_DEF).append(')').openBlock(); out.append("return "); @@ -44,7 +39,6 @@ class ExistingSubtypeAspect extends SubtypeAspect { out.newLine(); } - @Override public void writeInstantiateCode(String className, TextOutput out) { out.append(className).append(".parse"); } diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/FieldProcessor.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/FieldProcessor.java index 111e58caa3a6..77a91e8543d1 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/FieldProcessor.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/FieldProcessor.java @@ -1,5 +1,6 @@ package org.jetbrains.protocolReader; +import org.jetbrains.annotations.NotNull; import org.jetbrains.jsonProtocol.JsonField; import org.jetbrains.jsonProtocol.JsonNullable; import org.jetbrains.jsonProtocol.JsonOptionalField; @@ -28,7 +29,7 @@ class FieldProcessor { // todo sort by source location Arrays.sort(methods, new Comparator() { @Override - public int compare(Method o1, Method o2) { + public int compare(@NotNull Method o1, @NotNull Method o2) { return o1.getName().compareTo(o2.getName()); } }); @@ -120,20 +121,10 @@ class FieldProcessor { int position = volatileFields.size(); FieldTypeInfo fieldTypeInfo; if (internalType) { - fieldTypeInfo = new FieldTypeInfo() { - @Override - public void appendValueTypeNameJava(FileScope scope, TextOutput out) { - fieldTypeParser.appendInternalValueTypeName(scope, out); - } - }; + fieldTypeInfo = fieldTypeParser::appendInternalValueTypeName; } else { - fieldTypeInfo = new FieldTypeInfo() { - @Override - public void appendValueTypeNameJava(FileScope scope, TextOutput out) { - fieldTypeParser.appendFinishedValueTypeName(out); - } - }; + fieldTypeInfo = (scope, out) -> fieldTypeParser.appendFinishedValueTypeName(out); } VolatileFieldBinding binding = new VolatileFieldBinding(position, fieldTypeInfo); volatileFields.add(binding); diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/GlobalScope.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/GlobalScope.java index 6a31b5ad59c0..9866d7b71d01 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/GlobalScope.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/GlobalScope.java @@ -2,6 +2,7 @@ package org.jetbrains.protocolReader; import gnu.trove.THashMap; import gnu.trove.THashSet; +import org.jetbrains.annotations.NotNull; import java.util.*; @@ -84,7 +85,7 @@ public class GlobalScope { // Sort to produce consistent GeneratedCodeMap later. Collections.sort(list, new Comparator>() { @Override - public int compare(TypeHandler o1, TypeHandler o2) { + public int compare(@NotNull TypeHandler o1, @NotNull TypeHandler o2) { return getName(o1).compareTo(getName(o2)); } diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/InterfaceReader.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/InterfaceReader.java index cc4e2566f4dd..a02b4ae8f18a 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/InterfaceReader.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/InterfaceReader.java @@ -117,7 +117,10 @@ class InterfaceReader { } for (SubtypeCaster subtypeCaster : subtypeCasters) { - subtypeCaster.getSubtypeHandler().getSubtypeSupport().setSubtypeCaster(subtypeCaster); + ExistingSubtypeAspect subtypeSupport = subtypeCaster.getSubtypeHandler().getSubtypeSupport(); + if (subtypeSupport != null) { + subtypeSupport.setSubtypeCaster(subtypeCaster); + } } return typeToTypeHandler; diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/MethodHandler.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/MethodHandler.java index adf5ac6f7ddf..a877b654c020 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/MethodHandler.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/MethodHandler.java @@ -4,19 +4,22 @@ package org.jetbrains.protocolReader; +import org.jetbrains.annotations.NotNull; + import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.Collections; -import java.util.Iterator; +import java.util.List; abstract class MethodHandler { abstract void writeMethodImplementationJava(ClassScope classScope, Method m, TextOutput out); - protected static void appendMethodSignatureJava(Method m, Iterable paramNames, TextOutput out) { + protected static void appendMethodSignatureJava(@NotNull Method m, @NotNull List paramNames, @NotNull TextOutput out) { out.append(m.getName()).append('('); boolean firstArg = true; - Iterator namesIt = paramNames.iterator(); - for (Type arg : m.getGenericParameterTypes()) { + Type[] types = m.getGenericParameterTypes(); + for (int i = 0, length = types.length; i < length; i++) { + Type arg = types[i]; if (firstArg) { firstArg = false; } @@ -24,7 +27,7 @@ abstract class MethodHandler { out.comma(); } Util.writeJavaTypeName(arg, out); - out.append(' ').append(namesIt.next()); + out.space().append(paramNames.get(i)); } out.append(')'); } @@ -33,10 +36,10 @@ abstract class MethodHandler { writeMethodDeclarationJava(out, m, Collections.emptyList()); } - protected static void writeMethodDeclarationJava(TextOutput out, Method m, Iterable paramNames) { + protected static void writeMethodDeclarationJava(@NotNull TextOutput out, @NotNull Method m, @NotNull List paramNames) { out.append("@Override").newLine().append("public "); Util.writeJavaTypeName(m.getGenericReturnType(), out); - out.append(' '); + out.space(); appendMethodSignatureJava(m, paramNames, out); } } diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ObjectValueReader.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ObjectValueReader.java index 025fb525c367..d6e4275ae0e3 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ObjectValueReader.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ObjectValueReader.java @@ -43,7 +43,7 @@ class ObjectValueReader extends ValueReader { refToType.get().writeInstantiateCode(scope.getRootClassScope(), subtyping, out); out.append('('); addReaderParameter(subtyping, out); - if (subtyping && refToType.get().getSubtypeSupport() instanceof ExistingSubtypeAspect) { + if (subtyping && refToType.get().getSubtypeSupport() != null) { out.comma().append("this"); } out.append(')'); diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReadDelegate.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReadDelegate.java index fade272204a5..56dcc310fa83 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReadDelegate.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReadDelegate.java @@ -1,22 +1,30 @@ package org.jetbrains.protocolReader; +import org.jetbrains.annotations.NotNull; + import java.lang.reflect.Method; +import java.util.Arrays; import java.util.Collections; import java.util.List; class ReadDelegate { private static final List STATIC_METHOD_PARAM_NAME_LIST = Collections.singletonList(Util.READER_NAME); + private static final List STATIC_METHOD_PARAM_NAME_LIST2 = Arrays.asList(Util.READER_NAME, "nextName"); private final TypeHandler typeHandler; private final boolean isList; - ReadDelegate(TypeHandler typeHandler, boolean isList) { + private final List paramNames; + + ReadDelegate(@NotNull TypeHandler typeHandler, boolean isList, boolean hasNextNameParam) { this.typeHandler = typeHandler; this.isList = isList; + + paramNames = hasNextNameParam ? STATIC_METHOD_PARAM_NAME_LIST2 : STATIC_METHOD_PARAM_NAME_LIST; } void write(ClassScope scope, Method method, TextOutput out) { - MethodHandler.writeMethodDeclarationJava(out, method, STATIC_METHOD_PARAM_NAME_LIST); + MethodHandler.writeMethodDeclarationJava(out, method, paramNames); out.openBlock(); out.append("return "); if (isList) { @@ -24,7 +32,10 @@ class ReadDelegate { } else { typeHandler.writeInstantiateCode(scope, out); - out.append("(").append(Util.READER_NAME).append(')'); + out.append('(').append(Util.READER_NAME); + out.comma().space(); + out.append(paramNames.size() == 1 ? "null" : "nextName"); + out.append(')'); } out.semi(); diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReaderGenerator.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReaderGenerator.java index 6988139a5bcb..8299afe91ece 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReaderGenerator.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReaderGenerator.java @@ -18,7 +18,7 @@ public class ReaderGenerator { configuration.getPackageName().replace('.', File.separatorChar), configuration.getClassName() + ".java")); - generateImpl(configuration, fileUpdater.builder); + generate(configuration, fileUpdater.builder); fileUpdater.update(); } @@ -96,12 +96,7 @@ public class ReaderGenerator { } } - return new Params() { - @Override - public String outputDirectory() { - return outputDirParam.getValue(); - } - }; + return outputDirParam::getValue; } private interface ParamListener { @@ -128,12 +123,12 @@ public class ReaderGenerator { } protected static GeneratedCodeMap buildParserMap(GenerateConfiguration configuration) { - return generateImpl(configuration, new StringBuilder()); + return generate(configuration, new StringBuilder()); } - private static GeneratedCodeMap generateImpl(GenerateConfiguration configuration, StringBuilder stringBuilder) { - return configuration.getParser().generateStaticReader(stringBuilder, - configuration.getPackageName(), configuration.getClassName(), - configuration.getBasePackagesMap()); + private static GeneratedCodeMap generate(GenerateConfiguration configuration, StringBuilder stringBuilder) { + return configuration.getParser().generateReader(stringBuilder, + configuration.getPackageName(), configuration.getClassName(), + configuration.getBasePackagesMap()); } } diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReaderRoot.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReaderRoot.java index 7914a5103ac6..f7ce9eb9eb39 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReaderRoot.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/ReaderRoot.java @@ -1,7 +1,8 @@ package org.jetbrains.protocolReader; -import org.jetbrains.io.JsonReaderEx; import gnu.trove.THashSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.io.JsonReaderEx; import org.jetbrains.jsonProtocol.JsonParseMethod; import java.lang.reflect.Method; @@ -32,7 +33,7 @@ class ReaderRoot { Method[] methods = clazz.getMethods(); Arrays.sort(methods, new Comparator() { @Override - public int compare(Method o1, Method o2) { + public int compare(@NotNull Method o1, @NotNull Method o2) { return o1.getName().compareTo(o2.getName()); } }); @@ -68,12 +69,12 @@ class ReaderRoot { } Type[] arguments = m.getGenericParameterTypes(); - if (arguments.length != 1) { + if (arguments.length > 2) { throw new JsonProtocolModelParseException("Exactly one argument is expected in " + m); } Type argument = arguments[0]; if (argument == JsonReaderEx.class || argument == Object.class) { - methodMap.put(m, new ReadDelegate(typeHandler, isList)); + methodMap.put(m, new ReadDelegate(typeHandler, isList, arguments.length != 1)); } else { throw new JsonProtocolModelParseException("Unrecognized argument type in " + m); diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/SubtypeAspect.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/SubtypeAspect.java deleted file mode 100644 index 9af37de01e55..000000000000 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/SubtypeAspect.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jetbrains.protocolReader; - -/** - * Encapsulate subtype aspects of the type. - */ -abstract class SubtypeAspect { - abstract void writeSuperFieldJava(TextOutput out); - abstract void writeSuperConstructorParamJava(TextOutput out); - abstract void writeSuperConstructorInitialization(TextOutput out); - - abstract void writeParseMethod(String className, ClassScope scope, TextOutput out); - - public abstract void writeInstantiateCode(String className, TextOutput out); - - abstract void writeGetSuperMethodJava(TextOutput out); - - public void setSubtypeCaster(SubtypeCaster subtypeCaster) { - } -} \ No newline at end of file diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/TypeHandler.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/TypeHandler.java index 401fbcff79d0..a2aaf4424429 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/TypeHandler.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/TypeHandler.java @@ -1,9 +1,7 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - package org.jetbrains.protocolReader; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.jetbrains.jsonProtocol.JsonObjectBased; import java.lang.reflect.Method; @@ -16,14 +14,13 @@ class TypeHandler { private final List volatileFields; - /** Method implementation for dynamic proxy. */ private final LinkedHashMap methodHandlerMap; /** Loaders that should read values and save them in field array on parse time. */ private final List fieldLoaders; /** Subtype aspects of the type or null */ - private final SubtypeAspect subtypeAspect; + private final ExistingSubtypeAspect subtypeAspect; private final boolean hasLazyFields; @@ -37,29 +34,25 @@ class TypeHandler { this.methodHandlerMap = methodHandlerMap; this.fieldLoaders = fieldLoaders; this.hasLazyFields = hasLazyFields; - if (jsonSuperClass == null) { - subtypeAspect = new AbsentSubtypeAspect(); - } - else { - subtypeAspect = new ExistingSubtypeAspect(jsonSuperClass); - } + subtypeAspect = jsonSuperClass == null ? null : new ExistingSubtypeAspect(jsonSuperClass); } public Class getTypeClass() { return typeClass; } - public SubtypeAspect getSubtypeSupport() { + @Nullable + public ExistingSubtypeAspect getSubtypeSupport() { return subtypeAspect; } - public void writeInstantiateCode(ClassScope scope, TextOutput out) { + public void writeInstantiateCode(@NotNull ClassScope scope, @NotNull TextOutput out) { writeInstantiateCode(scope, false, out); } - public void writeInstantiateCode(ClassScope scope, boolean deferredReading, TextOutput out) { + public void writeInstantiateCode(@NotNull ClassScope scope, boolean deferredReading, @NotNull TextOutput out) { String className = scope.getTypeImplReference(this); - if (deferredReading) { + if (deferredReading || subtypeAspect == null) { out.append("new ").append(className); } else { @@ -67,10 +60,10 @@ class TypeHandler { } } - public void writeStaticClassJava(FileScope fileScope) { + public void writeStaticClassJava(@NotNull FileScope fileScope) { TextOutput out = fileScope.getOutput(); String valueImplClassName = fileScope.getTypeImplShortName(this); - out.append("public static final class ").append(valueImplClassName); + out.append("private static final class ").append(valueImplClassName); out.append(" implements ").append(getTypeClass().getCanonicalName()).openBlock(); @@ -89,12 +82,16 @@ class TypeHandler { out.newLine(); } - subtypeAspect.writeSuperFieldJava(out); + if (subtypeAspect != null) { + subtypeAspect.writeSuperFieldJava(out); + } writeConstructorMethod(valueImplClassName, classScope, out); out.newLine(); - subtypeAspect.writeParseMethod(valueImplClassName, classScope, out); + if (subtypeAspect != null) { + subtypeAspect.writeParseMethod(valueImplClassName, classScope, out); + } for (Map.Entry en : methodHandlerMap.entrySet()) { out.newLine(); @@ -103,7 +100,9 @@ class TypeHandler { } writeBaseMethods(out); - subtypeAspect.writeGetSuperMethodJava(out); + if (subtypeAspect != null) { + subtypeAspect.writeGetSuperMethodJava(out); + } out.indentOut().append('}'); } @@ -132,27 +131,47 @@ class TypeHandler { out.closeBlock(); } - private void writeConstructorMethod(String valueImplClassName, ClassScope classScope, TextOutput out) { - out.newLine().append("public ").append(valueImplClassName).append("(").append(Util.JSON_READER_PARAMETER_DEF); - subtypeAspect.writeSuperConstructorParamJava(out); + private void writeConstructorMethod(@NotNull String valueImplClassName, @NotNull ClassScope classScope, @NotNull TextOutput out) { + out.newLine().append(valueImplClassName).append('(').append(Util.JSON_READER_PARAMETER_DEF).comma().append("String name"); + if (subtypeAspect != null) { + subtypeAspect.writeSuperConstructorParamJava(out); + } out.append(')').openBlock(); - subtypeAspect.writeSuperConstructorInitialization(out); + if (subtypeAspect != null) { + subtypeAspect.writeSuperConstructorInitialization(out); + } if (JsonObjectBased.class.isAssignableFrom(typeClass) || hasLazyFields) { - out.append(Util.PENDING_INPUT_READER_NAME).append(" = ").append(Util.READER_NAME).append(".subReader();").newLine(); + out.append(Util.PENDING_INPUT_READER_NAME).append(" = ").append(Util.READER_NAME).append(".subReader()").semi().newLine(); } if (fieldLoaders.isEmpty()) { out.append(Util.READER_NAME).append(".skipValue()").semi(); } else { - out.append(Util.READER_NAME).append(".beginObject();"); + out.append("if (name == null)").openBlock(); + { + out.append("reader.beginObject()").semi(); + out.newLine().append("if (reader.hasNext())").openBlock(); + { + out.append("name = reader.nextName()").semi(); + } + out.closeBlock(); + out.newLine().append("else").openBlock(); + { + out.append("return").semi(); + } + out.closeBlock(); + } + out.closeBlock(); + out.newLine(); + writeReadFields(out, classScope); // we don't read all data if we have lazy fields, so, we should not check end of stream //if (!hasLazyFields) { - out.newLine().append(Util.READER_NAME).append(".endObject();"); + out.newLine().newLine().append(Util.READER_NAME).append(".endObject()").semi(); //} } out.closeBlock(); @@ -166,16 +185,16 @@ class TypeHandler { out.newLine().append("int i = 0").semi(); } - out.newLine().append("while (reader.hasNext())").openBlock(!hasOnlyOneFieldLoader); - if (!hasOnlyOneFieldLoader) { - out.append("CharSequence name = reader.nextNameAsCharSequence();"); - } - + out.newLine().append("do").openBlock(); boolean isFirst = true; String operator = "if"; for (FieldLoader fieldLoader : fieldLoaders) { + if (!isFirst) { + out.newLine(); + } + String fieldName = fieldLoader.getFieldName(); - out.newLine().append(operator).append(" (").append(hasOnlyOneFieldLoader ? "reader.nextName()" : "name"); + out.append(operator).append(" (").append(hasOnlyOneFieldLoader ? "reader.nextName()" : "name"); out.append(".equals(\"").append(fieldName).append("\"))").openBlock(); { assignField(out, fieldName); @@ -204,6 +223,7 @@ class TypeHandler { out.newLine().append("else").openBlock().append("i++").semi().closeBlock(); } out.closeBlock(); + out.newLine().append("while ((name = reader.nextNameOrNull()) != null)").semi(); } private static TextOutput assignField(TextOutput out, String fieldName) { diff --git a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/Util.java b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/Util.java index 105cd6665b2e..13c7fd1c39e0 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/Util.java +++ b/platform/script-debugger/protocol/protocol-reader/src/org/jetbrains/protocolReader/Util.java @@ -1,5 +1,7 @@ package org.jetbrains.protocolReader; +import org.jetbrains.annotations.NotNull; + import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.WildcardType; @@ -14,12 +16,12 @@ public class Util { public static final String BASE_VALUE_PREFIX = "baseMessage"; public static final String JSON_READER_CLASS_NAME = "org.jetbrains.io.JsonReaderEx"; - public static final String JSON_READER_PARAMETER_DEF = JSON_READER_CLASS_NAME + " " + READER_NAME; + public static final String JSON_READER_PARAMETER_DEF = JSON_READER_CLASS_NAME + ' ' + READER_NAME; /** * Generate Java type name of the passed type. Type may be parameterized. */ - public static void writeJavaTypeName(Type arg, TextOutput out) { + public static void writeJavaTypeName(@NotNull Type arg, @NotNull TextOutput out) { if (arg instanceof Class) { out.append(((Class)arg).getCanonicalName()); } From 3542ff05a7ee30525728d2dc04be410fde48eb05 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 22 Oct 2014 17:39:16 +0200 Subject: [PATCH 28/64] update icons for new welcome --- platform/icons/src/welcome/createNewProject.png | Bin 410 -> 442 bytes .../icons/src/welcome/createNewProject@2x.png | Bin 741 -> 857 bytes platform/icons/src/welcome/fromVCS.png | Bin 247 -> 225 bytes platform/icons/src/welcome/fromVCS@2x.png | Bin 374 -> 318 bytes platform/icons/src/welcome/importProject.png | Bin 250 -> 321 bytes platform/icons/src/welcome/importProject@2x.png | Bin 438 -> 487 bytes platform/icons/src/welcome/openProject.png | Bin 174 -> 183 bytes platform/icons/src/welcome/openProject@2x.png | Bin 226 -> 218 bytes 8 files changed, 0 insertions(+), 0 deletions(-) diff --git a/platform/icons/src/welcome/createNewProject.png b/platform/icons/src/welcome/createNewProject.png index 3bf27883974ba38d7fb7d6afcd8482799f36dde6..27f390cbaeebd33a9c4cc08059f9812b90db677e 100644 GIT binary patch delta 417 zcmV;S0bc%^1G)o{BYyxHbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUz zTuDShRCwBi(#tD^Q5eVZcU~j5l!kFjVIvEa71>!ywwRSafXsrOe?ZAXDP=qU03yl) z$xgYf6uFEHWg`paGQN*~uTICzIQ8j$&pFR|&NX(C9u7*B4u6C=D;5yyTV13-h4BLI zF;uw;tg?eXFK85FPMnoNY)5TT$0ZJNfGzYWSu+~Zk6!F*@H(DiT6>C3L9qwPce%Y4B$~gtEfR8R@C;65#3B0Cvhk1mkutW z`jE2)cjk6{7CJ=R-;(|)PzfW^j#t z+~7_x^a|73|B)sMqBA%a{}$Fz<}BaJi&hf235u1>KN|hPw*UhGS${`2FtM5{00000 LNkvXXu0mjf*Oa?w delta 384 zcmV-`0e}9w1DXSnBYy#5NkliYS!X zU_wd^aQ+d{fO%6tz&8l1)G$@y2W-QLs)3^14#PY_f5Z6>{;u(fzt e6J-ga-17rmCLmU2C#c&10000fVvI< diff --git a/platform/icons/src/welcome/createNewProject@2x.png b/platform/icons/src/welcome/createNewProject@2x.png index 4486b9a4a32654c9269af684c0a7164b467c18b3..b1df70704f192e4c165e293b3a01b07cbb2be9e8 100644 GIT binary patch delta 835 zcmV-J1HAm@1=$9WBYyxHbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU! z`$HGC&^`qNHj6?f;2TI^1wV$iWv=#aT))w{zt22?X}n0dw=GuU+ultUf=rG+TShu zsyZ17A=AMC&>B=hED}ztKstcT-_Ndapsz$7pM%yV2*1S-7@$WhS~ zu-HLa+T+>lpz=){7-;(ihrnoXpUk$LWS#Q978HAYy9_)9b>KC)Wivo-VJDyE7Mj5g zFjM<(DHy4|kADEmwQt1uhu}7t1%86vE>0*GUQ^yzfoI?{m}a^1v=W+E`70MF^QS=j zf1d1-2PT4-V6Zm+3tR;24Rbjfxe3IzxsRY6bh?J&J8;l2E{ZdT&GS)|F>Ee!z_htv z9yo5gvHGEUV1EcGp`*4LzLT|0K~k|KizJ;Y zY1n)&!?PQF1&tijjY!dm6my5wfG9KJ8SnvI2OB^_TeIK8p}N36Z7jivk+6ObYQcQ& z^)C!(Fox62?S4|iQ%5`^;k$zliL!bj#(Ey_gVJ1x6qC4Y`U30$lfgo84t%mKUSyfG zRa3c{OMhSm7!Rr?MAcJEs5}DOz&Nl5TrphfVNhz=U?@1EjpcQ21!MV}r8fNbi-I3? z9I1GB4Q-g@`IU6C1fQEZr^*-VxIia0rdFG51gkxI!J7{MdKfs$8z?vtjRB|oz~Q!l zIYA7lWt|Tz67w~THfIAiGkfXMO~bw!=5m}f<$nliNVdBgAQ5m<8+*gBDWf9O|8L}+ zG^u+*hc++eeUys6JX0 zUQX|5$*Pm_t#?libU-1?JW%0fKoQ@|*ax)x^a@$!JFrKotR@uG+)g*J^^ zgEoo{epV`a@tDmXJ$Xg#niNE1;3)GAb#Bh=sy4zfq_&FoG*0$Pa(dl27}8jiQ5$6?P&Wc?H{iUl)vh^4Gu?25Jf zH~6Y2LBLVKVpXpV|K6rd(bfPJj$UI zPz{cNCm<|3O@CHlaz6+p@Qf$tbeBjx4IBg`AnNoA<^W#OpI`v2rC`~QS1XtOE8scB z%6`>UogwnOFIQNlHY_a6=>q}Dr&aRdY?FLeft!N;2Uuac39l&fEja zUp*xMLMO>nC+znipx5sb=u+YbovBr&nULQB$J=;F9cWklv|&30s9VxSO=8h|ih8Z_kp5Z}S0`92O*%{N?u_!@{kp)>_Cl3=m)dvehky@;Icr;?ei-4FNW>f$OM-Z?b8P7urL?oOH z6#PX%^Gu9bK*qrE$i}02I@V}JGXR83v1p!!CE4RN0EFAH`I!_0Kp3QP0WQrT3;<9R VEccCwO*jAm002ovPDHLkV1mxHTvq@9 diff --git a/platform/icons/src/welcome/fromVCS@2x.png b/platform/icons/src/welcome/fromVCS@2x.png index 1734213448d9e0701e2abfbe0da8941d3c709546..d19eb74ea8c9f2a8b166ec5c19363e98ee40e391 100644 GIT binary patch delta 292 zcmV+<0o(re0=@!}BYyxHbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUy z;7LS5RCwBA{Qv(y!$1Nih5-gFFoyTk{e;w#8dQwdBqG?R%G*OCeFhAI;&@kIt8n68+JNU`}8IG~tN&LXBDnhM0z z$*>%xXCk#qLQ=~Jl)O$22ar-mkd$_qsFj+@%{@%i%FpDMALP`A*nCNL2}*8tj2zDt q)gdfYsMS~~sU1ZbM||%XAiw~_VNSAe*4Ci_0000xsBYy!sNklVRS800uG~z(A}6a)G!Ph}-bssbn}{DgiV5fjA4~ zfM_xdrxp%|1%(q3|DdDAPdq2@H2_BekO9U(jy({6ri10TfPeOBz|#QC0Z{A;6#Pyr z%Yo*f17caIhp{>Ugac^gfD1sg6_7$4rvpF|{y_Yjik5?XE{A3ZZU;bdC{V#aDg^s} zAQr;nNrDal;aCbCuoq|sKaNl)$^jrnab#M)2dG~dkGaG-0E*K{4EC)+%uT>!Bsl0onfg0l@;0B!3xnMObuGZ)S9NVRB^vL1b@YWgtmyVP|DhWnpA_ami&o0002v zNklB?AFa4#bm~7{~*eK-><*{EX->Aj0N!Af5)qAj^62xxfU6 zv!_EfzXakh_zc(!#5Pbi2N2Hz;tn8Ygo^D05nwNLc6Gyb@qfLQgE2vV`v$}rKwJpK zhG-Tz0`UPBB*kFxN%#?n%7q%l1;mT6xDMo+0}N2VkP3DHaW;&@f+op`07*qoM6N<$g03cc5dZ)H delta 222 zcmV<403rXu0{Q`vB!9t4L_t(|+GF_t|33pIm|@@zh+dp=3y7cNz^{P#1rX;0F#|RX zBK{M=cY#0ax)FAl{24rUZ+|cR*|j zwZRIAUlS3%EwESsg|;V}|IC2+A|B0aftV9!fDMj75{IV1J6ph+APCdOCm+h#P>oABaCw z6a{1eE+C!<#Nkl>Kaw3lLA)yg@j4*ZM-qEYNfdCApw=0P&wrp<4gwD;allp}<|RU1 zCJ^rcVnHl&_b73I0}$`RVK4}A0P!3ko`xri&r+HTEP!|~5R0OTD+2K`AWp`k_dhgb zD9(n4KztC0rJ#IoAU+2b#|O3}rvZ2nb#`^*)y2mkhfP=$hz|qtHXzQ1=5<1#16NUu zw^H~d{0KxP@_)UR!X)YUO@bjQU{O& z9s{ux5I-TcI!5s=Qrs^g!ScI6>;l9Oa4Dc=2!IlG6F$pn?Ep{+&PJ*M>Fxj!U<2Z% zK%6j84gdjWXj>p_pd0{;j;TOg2CgPM!zpT%GNP4`F-K^*g_K-El_uF@G(K${0Ids% zQdeG9O0)w8qFGLK2+*a=G~gjH>Hx-p?i~+!2mk~a0HcIT_9(n_c>n+a07*qoM6N<$ Ef|S9tE&u=k delta 413 zcmV;O0b>5=1GWQ@BYy#XNklhT5&x-(L&$N!M=DtS9*8YTwVYZG0O|K4$8u^o;42VEl507o4)_bisgzhwi331B z&!^OKAl4<<0S#2J9E9u1b-+w2Sgs7jYbi+sEfhKc z^ehKr4tx&S2*is>bOTzK@QtW zq2-T(SRPx8=oHkKgt8DQg*TCD`5hqE!&Vz^2VyxA3lnP~UI@g$iL@M~RuNZqEJ0>* z$^pb$K%4=@i=md%B!6{DL_t(|+G998(cl&kKgWWv1FWn4l^$t?!8R01E&B07*qoM6N<$f>Dq< Ah5!Hn diff --git a/platform/icons/src/welcome/openProject@2x.png b/platform/icons/src/welcome/openProject@2x.png index 35646a827e078efae33a6b021182dcecfbaa0d1f..8e8c4d2ca40bc847cb2571deaca3600ccfdf7c20 100644 GIT binary patch delta 190 zcmV;v073ua0onnOB!3xnMObuGZ)S9NVRB^vL1b@YWgtmyVP|DhWnpA_ami&o0001d zNklsW%D!k4C|$14bP%>VQ!P s47s}C|7aA92nR5Z_6ZOR3WNaP(5R_+5W;;nPVs)OClpbexQa@<{R5Jjo00bZa0k8my z832U^(2Qcwns|;E3mAxiK>^*k1xB6Ff5&XV4`MO+R$0+s3IG5A07*qoM6N<$f=k;{ AC;$Ke From 3f102212fa657310018fae662194667d36e66277 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 22 Oct 2014 17:39:44 +0200 Subject: [PATCH 29/64] put Register action in left bottom corner --- .../impl/welcomeScreen/FlatWelcomeFrame.java | 58 +++++++++++++------ 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index 2d77629feeb5..320171a1e55f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -59,7 +59,6 @@ import java.awt.event.*; import java.io.File; import java.io.InputStream; import java.net.URL; -import java.util.Arrays; /** * @author Konstantin Bulenkov @@ -173,6 +172,10 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { return new JBColor(Gray.xFF, new Color(58, 61, 63)); } + public static Color getLinkNormalColor() { + return new JBColor(Gray._0, Gray.xBB); + } + private class FlatWelcomeScreen extends JPanel implements WelcomeScreen { public FlatWelcomeScreen() { super(new BorderLayout()); @@ -224,17 +227,41 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { } private JComponent createSettingsAndDocs() { - NonOpaquePanel toolbar = new NonOpaquePanel(); - toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS)); - toolbar.add(createActionLink("Configure", IdeActions.GROUP_WELCOME_SCREEN_CONFIGURE, AllIcons.General.Settings)); - toolbar.add(createActionLink("Get Help", IdeActions.GROUP_WELCOME_SCREEN_DOC, null)); JPanel panel = new NonOpaquePanel(new BorderLayout()); + NonOpaquePanel toolbar = new NonOpaquePanel(); + AnAction register = ActionManager.getInstance().getAction("Register"); + boolean registeredVisible = false; + if (register != null) { + Presentation presentation = register.getTemplatePresentation(); + register.update(new AnActionEvent(null, DataManager.getInstance().getDataContext(this), + ActionPlaces.WELCOME_SCREEN, presentation, ActionManager.getInstance(), 0)); + if (presentation.isEnabled()) { + ActionLink registerLink = new ActionLink("Register", register); + registerLink.setNormalColor(getLinkNormalColor()); + NonOpaquePanel button = new NonOpaquePanel(new BorderLayout()); + button.setBorder(new EmptyBorder(4, 10, 4, 10)); + button.add(registerLink); + installFocusable(button, register, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, true); + NonOpaquePanel wrap = new NonOpaquePanel(); + wrap.setBorder(new EmptyBorder(0, 10, 0, 0)); + wrap.add(button); + panel.add(wrap, BorderLayout.WEST); + registeredVisible = true; + } + } + + toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS)); + toolbar.add(createActionLink("Configure", IdeActions.GROUP_WELCOME_SCREEN_CONFIGURE, AllIcons.General.Settings, !registeredVisible)); + toolbar.add(createActionLink("Get Help", IdeActions.GROUP_WELCOME_SCREEN_DOC, null, false)); + panel.add(toolbar, BorderLayout.EAST); + + panel.setBorder(new EmptyBorder(0,0,8,21)); return panel; } - private JComponent createActionLink(final String text, final String groupId, Icon icon) { + private JComponent createActionLink(final String text, final String groupId, Icon icon, boolean focusListOnLeft) { final Ref settings = new Ref(null); AnAction action = new AnAction() { @Override @@ -248,11 +275,14 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { }; settings.set(new ActionLink(text, icon, action)); settings.get().setPaintUnderline(false); + settings.get().setNormalColor(getLinkNormalColor()); NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout()); - panel.setBorder(new EmptyBorder(4, 16, 4, 4)); + panel.setBorder(new EmptyBorder(4, 10, 4, 10)); panel.add(settings.get()); - panel.add(new JLabel(AllIcons.General.Combo2), BorderLayout.EAST); - installFocusable(panel, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, !Arrays.asList("Get Help", "Register").contains(text)); + JLabel arrow = new JLabel(AllIcons.General.Combo2); + arrow.setVerticalAlignment(SwingConstants.BOTTOM); + panel.add(arrow, BorderLayout.EAST); + installFocusable(panel, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, focusListOnLeft); return panel; } @@ -264,12 +294,6 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { DefaultActionGroup group = new DefaultActionGroup(); collectAllActions(group, quickStart); - // so, we sure this is the last action - final AnAction register = actionManager.getAction("WelcomeScreen.Register"); - if (register != null) { - group.add(register); - } - for (AnAction action : group.getChildren(null)) { JPanel button = new JPanel(new BorderLayout()); button.setOpaque(false); @@ -280,7 +304,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { if (presentation.isVisible()) { ActionLink link = new ActionLink(presentation.getText(), presentation.getIcon(), action); link.setPaintUnderline(false); - link.setNormalColor(new JBColor(Gray._0, Gray.xBB)); + link.setNormalColor(getLinkNormalColor()); installFocusable(button, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, true); button.add(link); actions.add(button); @@ -306,7 +330,6 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { private JComponent createLogo() { NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout()); JLabel logo = new JLabel(IconLoader.getIcon(ApplicationInfoEx.getInstanceEx().getWelcomeScreenLogoUrl())); - logo.setBorder(new EmptyBorder(20, 0, 0, 0)); logo.setHorizontalAlignment(SwingConstants.CENTER); panel.add(logo, BorderLayout.NORTH); JLabel appName = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName()); @@ -321,6 +344,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { panel.add(appName); panel.add(version, BorderLayout.SOUTH); + panel.setBorder(new EmptyBorder(20, 10, 30, 10)); return panel; } From fdc313450baf1bdf11743cfc319d4037cf897ac5 Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Wed, 22 Oct 2014 19:53:46 +0400 Subject: [PATCH 30/64] IDEA-131592 Menu disappeared after debugging Node application --- .../platform-impl/src/com/intellij/ui/BalloonImpl.java | 9 +++++++++ .../com/intellij/xdebugger/impl/ui/BreakpointEditor.java | 4 ---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java index d41d0bb5ef18..88353779a83c 100644 --- a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java @@ -57,6 +57,7 @@ import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; import java.awt.image.BufferedImage; +import java.util.List; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; @@ -792,6 +793,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui { private void hideAndDispose(final boolean ok) { if (myDisposed) return; myDisposed = true; + hideComboBoxPopups(); final Runnable disposeRunnable = new Runnable() { @Override @@ -827,6 +829,13 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui { myTracker = null; } + private void hideComboBoxPopups() { + List comboBoxes = UIUtil.findComponentsOfType(myComp, JComboBox.class); + for (JComboBox box : comboBoxes) { + box.hidePopup(); + } + } + protected void onDisposed() { } @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/BreakpointEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/BreakpointEditor.java index 5c14020f603f..79c8dc49c398 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/BreakpointEditor.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/BreakpointEditor.java @@ -90,10 +90,6 @@ public class BreakpointEditor { } public void actionPerformed(AnActionEvent e) { - Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(e.getDataContext()); - if (component instanceof JComboBox && SwingUtilities.isDescendingFrom(component, getMainPanel())) { - ((JComboBox)component).hidePopup(); - } done(); } }; From 01d3aedd0430f067e83f8fb8d48bc5063dc6ba31 Mon Sep 17 00:00:00 2001 From: Alexander Kirillin Date: Wed, 22 Oct 2014 18:25:04 +0400 Subject: [PATCH 31/64] OC-10346 AppCode marks available API as not available for deployment target 10.10 --- platform/util/src/com/intellij/openapi/util/Version.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/util/src/com/intellij/openapi/util/Version.java b/platform/util/src/com/intellij/openapi/util/Version.java index afcd6eaaecf7..638d3100d7b6 100644 --- a/platform/util/src/com/intellij/openapi/util/Version.java +++ b/platform/util/src/com/intellij/openapi/util/Version.java @@ -1,8 +1,9 @@ package com.intellij.openapi.util; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class Version { +public class Version implements Comparable { public final int major; public final int minor; public final int bugfix; @@ -49,6 +50,10 @@ public class Version { return compareTo(major, minor, bugfix) < 0; } + public int compareTo(@NotNull Version version) { + return compareTo(version.major, version.minor, version.bugfix); + } + public int compareTo(@Nullable Integer major) { return compareTo(major, null); } From 3723e7b196b9f21ecc7b9f8bbac5cd650c015577 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 22 Oct 2014 20:36:57 +0400 Subject: [PATCH 32/64] IDEA-131530 Search field in Settings dialog should receive focus when you start typing --- .../intellij/openapi/options/newEditor/SettingsFilter.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsFilter.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsFilter.java index 1885a852c5da..fdd4fa96aaee 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsFilter.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsFilter.java @@ -22,6 +22,7 @@ import com.intellij.openapi.options.ConfigurableGroup; import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.ActionCallback; +import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.DocumentAdapter; import com.intellij.ui.LightColors; import com.intellij.ui.SearchTextField; @@ -58,6 +59,11 @@ abstract class SettingsFilter extends ElementFilter.Active.Impl { @Override protected void textChanged(DocumentEvent event) { update(event.getType(), true, false); + // request focus if needed on changing the filter text + IdeFocusManager manager = IdeFocusManager.findInstanceByComponent(mySearch); + if (manager.getFocusedDescendantFor(mySearch) == null) { + manager.requestFocus(mySearch, true); + } } }); mySearch.getTextEditor().addMouseListener(new MouseAdapter() { From 95055340e3500568ff40cd6ed1f641d2f303ffe6 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Wed, 22 Oct 2014 20:42:20 +0400 Subject: [PATCH 33/64] 118571 Implemented ability to configure svn command line client locale in "Subversion" settings (instead of using "svn.executable.locale" registry key) --- .../openapi/ui/FixedComboBoxEditor.java | 6 ++- .../util/resources/misc/registry.properties | 1 - .../idea/svn/SvnApplicationSettings.java | 11 +++++ .../jetbrains/idea/svn/SvnBundle.properties | 2 + .../jetbrains/idea/svn/SvnConfigurable.form | 32 ++++++++++---- .../jetbrains/idea/svn/SvnConfigurable.java | 43 ++++++++++++++++++- .../idea/svn/api/CmdVersionClient.java | 3 +- .../idea/svn/commandLine/CommandExecutor.java | 11 +++-- .../idea/svn/commandLine/CommandRuntime.java | 12 ++++-- .../svn/commandLine/TerminalExecutor.java | 4 +- .../svn/commandLine/WinTerminalExecutor.java | 4 +- 11 files changed, 101 insertions(+), 28 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/ui/FixedComboBoxEditor.java b/platform/platform-api/src/com/intellij/openapi/ui/FixedComboBoxEditor.java index 2066f661ca89..317d44c364bd 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/FixedComboBoxEditor.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/FixedComboBoxEditor.java @@ -21,6 +21,7 @@ import com.intellij.ui.components.JBTextField; import com.intellij.util.ReflectionUtil; import com.intellij.util.ui.MacUIUtil; import com.intellij.util.ui.UIUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -47,7 +48,7 @@ public class FixedComboBoxEditor implements ComboBoxEditor { public static final Border EDITOR_BORDER = new MacComboBoxEditorBorder(false); public static final Border DISABLED_EDITOR_BORDER = new MacComboBoxEditorBorder(true); - private JBTextField myField; + @NotNull private final JBTextField myField; private Object oldValue; public FixedComboBoxEditor() { @@ -60,7 +61,8 @@ public class FixedComboBoxEditor implements ComboBoxEditor { } } - protected JTextField getField() { + @NotNull + public JBTextField getField() { return myField; } diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index d2365fb50adc..92ff474f2d4f 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -353,7 +353,6 @@ search.everywhere.configurations=true search.everywhere.settings=false svn.use.incoming.optimization=false -svn.executable.locale=en_US.UTF-8 svn.lowest.supported.format.for.command.line=1.7.0 svn.use.svnkit.for.https.server.certificate.check=true diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnApplicationSettings.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnApplicationSettings.java index a01dc322d9a3..5cf6d6db4389 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnApplicationSettings.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnApplicationSettings.java @@ -18,6 +18,7 @@ package org.jetbrains.idea.svn; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.components.*; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNURL; @@ -43,6 +44,7 @@ public class SvnApplicationSettings implements PersistentStateComponent myCheckoutURLs = new ArrayList(); public List myTypedURLs = new ArrayList(); public String mySvnCommandLine = "svn"; + public String myExecutableLocale = SvnConfigurable.EN_US_LOCALE; } private ConfigurationBean myConfigurationBean; @@ -74,6 +76,15 @@ public class SvnApplicationSettings implements PersistentStateComponentEmulates the behavior when Subversion commands are executed directly from the terminal (in the interactive mode).
\ This is required to handle password/passphrase prompts for svn+ssh repositories, and trust invalid server certificates for https repositories. +command.line.locale.label=Locale\: +command.line.locale.system.default.title= ssh.settings.title=SSH Settings ssh.settings.executable.label=SSH executable\: diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form index b3d5afb2e2d4..12ca521de64a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form @@ -18,7 +18,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -96,7 +96,7 @@ - + @@ -123,18 +123,18 @@ - + - + - + @@ -158,7 +158,7 @@ - + @@ -167,12 +167,26 @@ - + + + + + + + + + + + + + + +
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java index 2433a816adce..e28fe277beb1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java @@ -24,6 +24,8 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.ComboBox; +import com.intellij.openapi.ui.FixedComboBoxEditor; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.SystemInfo; @@ -31,10 +33,13 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; +import com.intellij.ui.CollectionComboBoxModel; +import com.intellij.ui.ListCellRendererWrapper; import com.intellij.ui.MultiLineTooltipUI; import com.intellij.ui.components.JBCheckBox; import com.intellij.ui.components.JBRadioButton; import com.intellij.util.Consumer; +import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,11 +52,18 @@ import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.io.File; +import java.util.List; public class SvnConfigurable implements Configurable { public static final String DISPLAY_NAME = SvnVcs.VCS_DISPLAY_NAME; + + public static final String EN_US_LOCALE = "en_US.UTF-8"; + public static final List EXECUTABLE_LOCALES = ContainerUtil.newArrayList("", EN_US_LOCALE, "C.UTF-8", "C"); + private final Project myProject; private JCheckBox myUseDefaultCheckBox; private TextFieldWithBrowseButton myConfigurationDirectoryText; @@ -68,6 +80,7 @@ public class SvnConfigurable implements Configurable { private JCheckBox myShowMergeSourceInAnnotate; private JBCheckBox myWithCommandLineClient; private JBCheckBox myRunUnderTerminal; + private ComboBox myLocalesList; private JSpinner myNumRevsInAnnotations; private JCheckBox myMaximumNumberOfRevisionsCheckBox; private JSpinner mySSHConnectionTimeout; @@ -108,7 +121,28 @@ public class SvnConfigurable implements Configurable { } }); myCommandLineClient.addBrowseFolderListener("Subversion", "Select path to Subversion executable (1.7+)", project, - FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); + FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); + //noinspection unchecked + myLocalesList.setModel(new CollectionComboBoxModel(EXECUTABLE_LOCALES)); + myLocalesList.setEditable(true); + FixedComboBoxEditor editor = new FixedComboBoxEditor(); + editor.getField().getEmptyText().setText(SvnBundle.message("command.line.locale.system.default.title")); + myLocalesList.setEditor(editor); + myLocalesList.setRenderer(new ListCellRendererWrapper() { + + @Override + public void customize(JList list, String value, int index, boolean selected, boolean hasFocus) { + setText(StringUtil.isEmpty(value) ? SvnBundle.message("command.line.locale.system.default.title") : value); + } + }); + myLocalesList.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + myLocalesList.getEditor().setItem(myLocalesList.getSelectedItem()); + } + } + }); myClearAuthButton.addActionListener(new ActionListener(){ public void actionPerformed(final ActionEvent e) { @@ -263,6 +297,7 @@ public class SvnConfigurable implements Configurable { if (! getSelectedSSL().equals(configuration.getSslProtocols())) return true; final SvnApplicationSettings applicationSettings17 = SvnApplicationSettings.getInstance(); if (! Comparing.equal(applicationSettings17.getCommandLinePath(), myCommandLineClient.getText().trim())) return true; + if (!Comparing.equal(applicationSettings17.getExecutableLocale(), myLocalesList.getEditor().getItem())) return true; if (!configuration.getConfigurationDirectory().equals(myConfigurationDirectoryText.getText().trim())) return true; return mySshSettingsPanel.isModified(configuration); } @@ -292,13 +327,16 @@ public class SvnConfigurable implements Configurable { final SvnApplicationSettings applicationSettings17 = SvnApplicationSettings.getInstance(); boolean reloadWorkingCopies = !acceleration().equals(configuration.getUseAcceleration()) || - !StringUtil.equals(applicationSettings17.getCommandLinePath(), myCommandLineClient.getText().trim()); + !StringUtil.equals(applicationSettings17.getCommandLinePath(), myCommandLineClient.getText().trim()) || + !StringUtil.equals(applicationSettings17.getExecutableLocale(), + myLocalesList.getEditor().getItem().toString()); configuration.setUseAcceleration(acceleration()); configuration.setRunUnderTerminal(myRunUnderTerminal.isSelected()); configuration.setSslProtocols(getSelectedSSL()); SvnVcs.getInstance(myProject).getSvnKitManager().refreshSSLProperty(); applicationSettings17.setCommandLinePath(myCommandLineClient.getText().trim()); + applicationSettings17.setExecutableLocale(myLocalesList.getEditor().getItem().toString()); boolean isClientValid = vcs17.checkCommandLineVersion(); if (isClientValid && reloadWorkingCopies) { vcs17.invokeRefreshSvnRoots(); @@ -345,6 +383,7 @@ public class SvnConfigurable implements Configurable { myRunUnderTerminal.setEnabled(myWithCommandLineClient.isSelected()); final SvnApplicationSettings applicationSettings17 = SvnApplicationSettings.getInstance(); myCommandLineClient.setText(applicationSettings17.getCommandLinePath()); + myLocalesList.setSelectedItem(applicationSettings17.getExecutableLocale()); if (SvnConfiguration.SSLProtocols.sslv3.equals(configuration.getSslProtocols())) { mySSLv3RadioButton.setSelected(true); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdVersionClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdVersionClient.java index 5b1484944285..95b4734f84d1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdVersionClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdVersionClient.java @@ -30,7 +30,8 @@ public class CmdVersionClient extends BaseSvnClient implements VersionClient { Command command = new Command(SvnCommandName.version); command.put("--quiet"); - CommandExecutor executor = new CommandExecutor(SvnApplicationSettings.getInstance().getCommandLinePath(), command); + SvnApplicationSettings settings = SvnApplicationSettings.getInstance(); + CommandExecutor executor = new CommandExecutor(settings.getCommandLinePath(), settings.getExecutableLocale(), command); executor.run(30 * 1000); return executor.getProcessOutput(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java index e00b8f1e3183..97c5f9c00ed2 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java @@ -23,7 +23,6 @@ import com.intellij.openapi.application.PathManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.util.EventDispatcher; @@ -58,6 +57,7 @@ public class CommandExecutor { private volatile String myDestroyReason; private volatile boolean myWasCancelled; @NotNull protected final GeneralCommandLine myCommandLine; + @NotNull protected final String myLocale; protected Process myProcess; protected SvnProcessHandler myHandler; private OutputStreamWriter myProcessWriter; @@ -72,7 +72,7 @@ public class CommandExecutor { @Nullable private final LineCommandListener myResultBuilder; @NotNull private final Command myCommand; - public CommandExecutor(@NotNull @NonNls String exePath, @NotNull Command command) { + public CommandExecutor(@NotNull @NonNls String exePath, @NotNull String locale, @NotNull Command command) { myCommand = command; myResultBuilder = command.getResultBuilder(); if (myResultBuilder != null) { @@ -89,6 +89,7 @@ public class CommandExecutor { } myCommandLine.addParameter(command.getName().getName()); myCommandLine.addParameters(prepareParameters(command)); + myLocale = locale; myExitCodeReference = new AtomicReference(); } @@ -158,13 +159,11 @@ public class CommandExecutor { } private void setupLocale() { - String locale = Registry.stringValue("svn.executable.locale"); - - if (!StringUtil.isEmpty(locale)) { + if (!StringUtil.isEmpty(myLocale)) { Map environment = myCommandLine.getEnvironment(); environment.put("LANGUAGE", ""); - environment.put("LC_ALL", locale); + environment.put("LC_ALL", myLocale); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java index 46b716c3bde2..a64821e24aad 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java @@ -43,11 +43,15 @@ public class CommandRuntime { @NotNull private final SvnVcs myVcs; @NotNull private final List myModules; private final String exePath; + @NotNull private final String executableLocale; public CommandRuntime(@NotNull SvnVcs vcs, @NotNull AuthenticationService authenticationService) { myVcs = vcs; myAuthenticationService = authenticationService; - exePath = SvnApplicationSettings.getInstance().getCommandLinePath(); + + SvnApplicationSettings settings = SvnApplicationSettings.getInstance(); + exePath = settings.getCommandLinePath(); + executableLocale = settings.getExecutableLocale(); myModules = ContainerUtil.newArrayList(); myModules.add(new CommandParametersResolutionModule(this)); @@ -218,7 +222,7 @@ public class CommandRuntime { if (!myVcs.getSvnConfiguration().isRunUnderTerminal() || isLocal(command)) { command.putIfNotPresent("--non-interactive"); - executor = new CommandExecutor(exePath, command); + executor = new CommandExecutor(exePath, executableLocale, command); } else { // do not explicitly specify "--force-interactive" as it is not supported in svn 1.7 - commands will be interactive by default as @@ -234,7 +238,9 @@ public class CommandRuntime { @NotNull private TerminalExecutor newTerminalExecutor(@NotNull Command command) { - return SystemInfo.isWindows ? new WinTerminalExecutor(exePath, command) : new TerminalExecutor(exePath, command); + return SystemInfo.isWindows + ? new WinTerminalExecutor(exePath, executableLocale, command) + : new TerminalExecutor(exePath, executableLocale, command); } public static boolean isLocal(@NotNull Command command) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalExecutor.java index 63fa3bbc0700..1509629b032b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalExecutor.java @@ -35,8 +35,8 @@ public class TerminalExecutor extends CommandExecutor { private final List myInteractiveListeners = ContainerUtil.createLockFreeCopyOnWriteList(); - public TerminalExecutor(@NotNull @NonNls String exePath, @NotNull Command command) { - super(exePath, command); + public TerminalExecutor(@NotNull @NonNls String exePath, @NotNull String locale, @NotNull Command command) { + super(exePath, locale, command); } public void addInteractiveListener(@NotNull InteractiveCommandListener listener) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalExecutor.java index e08594d33c28..08979ab6d3e3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalExecutor.java @@ -49,8 +49,8 @@ public class WinTerminalExecutor extends TerminalExecutor { @Nullable private File myRedirectFile; @Nullable private FileInputStream myRedirectStream; - public WinTerminalExecutor(@NotNull @NonNls String exePath, @NotNull Command command) { - super(exePath, command); + public WinTerminalExecutor(@NotNull @NonNls String exePath, @NotNull String locale, @NotNull Command command) { + super(exePath, locale, command); } @NotNull From 515e42f93f997760201926023f4f42f33595e907 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 22 Oct 2014 20:48:05 +0400 Subject: [PATCH 34/64] IDEA-131710 Unclear behavior of smart step into method after conditional operator --- .../actions/JavaSmartStepIntoHandler.java | 24 +++++++++++++++---- .../debugger/actions/SmartStepTarget.java | 6 ++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java index 48efa9ac87dc..cbeca23dd6f3 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java @@ -19,6 +19,7 @@ import com.intellij.debugger.SourcePosition; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; +import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; @@ -80,8 +81,7 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler { //noinspection unchecked final List targets = new OrderedSet(); - TextRange textRange = element.getTextRange(); - final Range lines = new Range(doc.getLineNumber(textRange.getStartOffset()), doc.getLineNumber(textRange.getEndOffset())); + final Ref textRange = new Ref(lineRange); final PsiElementVisitor methodCollector = new JavaRecursiveElementVisitor() { final Stack myContextStack = new Stack(); @@ -96,12 +96,12 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler { @Override public void visitAnonymousClass(PsiAnonymousClass aClass) { for (PsiMethod psiMethod : aClass.getMethods()) { - targets.add(new MethodSmartStepTarget(psiMethod, getCurrentParamName(), psiMethod.getBody(), true, lines)); + targets.add(new MethodSmartStepTarget(psiMethod, getCurrentParamName(), psiMethod.getBody(), true, null)); } } public void visitLambdaExpression(PsiLambdaExpression expression) { - targets.add(new LambdaSmartStepTarget(expression, getCurrentParamName(), expression.getBody(), myNextLambdaExpressionOrdinal++, lines)); + targets.add(new LambdaSmartStepTarget(expression, getCurrentParamName(), expression.getBody(), myNextLambdaExpressionOrdinal++, null)); } @Override @@ -111,6 +111,15 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler { } } + @Override + public void visitExpression(PsiExpression expression) { + TextRange range = expression.getTextRange(); + if (lineRange.intersects(range)) { + textRange.set(textRange.get().union(range)); + } + super.visitExpression(expression); + } + public void visitExpressionList(PsiExpressionList expressionList) { final PsiMethod psiMethod = myContextStack.isEmpty()? null : myContextStack.peek(); if (psiMethod != null) { @@ -146,7 +155,7 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler { ((PsiMethodCallExpression)expression).getMethodExpression().getReferenceNameElement() : expression instanceof PsiNewExpression? ((PsiNewExpression)expression).getClassOrAnonymousClassReference() : expression, false, - lines + null )); } try { @@ -168,6 +177,11 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler { } sibling.accept(methodCollector); } + + Range lines = new Range(doc.getLineNumber(textRange.get().getStartOffset()), doc.getLineNumber(textRange.get().getEndOffset())); + for (SmartStepTarget target : targets) { + target.setCallingExpressionLines(lines); + } return targets; } return Collections.emptyList(); diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/SmartStepTarget.java b/java/debugger/impl/src/com/intellij/debugger/actions/SmartStepTarget.java index ed758c902784..a6579a94357c 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/SmartStepTarget.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/SmartStepTarget.java @@ -27,7 +27,7 @@ public abstract class SmartStepTarget { private final PsiElement myHighlightElement; private final String myLabel; private final boolean myNeedBreakpointRequest; - private final Range myExpressionLines; + private Range myExpressionLines; protected SmartStepTarget(@Nullable String label, @Nullable PsiElement highlightElement, boolean needBreakpointRequest, Range expressionLines) { myHighlightElement = highlightElement; @@ -53,4 +53,8 @@ public abstract class SmartStepTarget { public Range getCallingExpressionLines() { return myExpressionLines; } + + public void setCallingExpressionLines(Range expressionLines) { + myExpressionLines = expressionLines; + } } From a8e01bb0eebd3e5e786a469155adb62161948230 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Wed, 22 Oct 2014 21:36:44 +0400 Subject: [PATCH 35/64] svn: Fixed enabling/disabling svn command line client options ("Locale", "Enable interactive mode") in "Subversion" settings (depending on whether "Use command line client" checkbox is checked) --- .../jetbrains/idea/svn/SvnConfigurable.form | 78 +++++++++++-------- .../jetbrains/idea/svn/SvnConfigurable.java | 14 +++- 2 files changed, 54 insertions(+), 38 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form index 12ca521de64a..c09b5cee65cd 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form @@ -18,7 +18,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -96,7 +96,7 @@ - + @@ -123,12 +123,12 @@ - + - + @@ -156,37 +156,47 @@ - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java index e28fe277beb1..b12a830a722e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java @@ -40,6 +40,7 @@ import com.intellij.ui.components.JBCheckBox; import com.intellij.ui.components.JBRadioButton; import com.intellij.util.Consumer; import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -86,6 +87,7 @@ public class SvnConfigurable implements Configurable { private JSpinner mySSHConnectionTimeout; private JSpinner mySSHReadTimeout; private TextFieldWithBrowseButton myCommandLineClient; + private JPanel myCommandLineClientOptions; private JSpinner myHttpTimeout; private JBRadioButton mySSLv3RadioButton; private JBRadioButton myTLSv1RadioButton; @@ -98,12 +100,13 @@ public class SvnConfigurable implements Configurable { public SvnConfigurable(Project project) { myProject = project; - myWithCommandLineClient.addActionListener(new ActionListener() { + myWithCommandLineClient.addItemListener(new ItemListener() { @Override - public void actionPerformed(ActionEvent e) { - myRunUnderTerminal.setEnabled(myWithCommandLineClient.isSelected()); + public void itemStateChanged(ItemEvent e) { + enableCommandLineClientOptions(); } }); + enableCommandLineClientOptions(); myUseDefaultCheckBox.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { boolean enabled = !myUseDefaultCheckBox.isSelected(); @@ -209,6 +212,10 @@ public class SvnConfigurable implements Configurable { mySshSettingsPanel.load(SvnConfiguration.getInstance(myProject)); } + public void enableCommandLineClientOptions() { + UIUtil.setEnabled(myCommandLineClientOptions, myWithCommandLineClient.isSelected(), true); + } + public static void selectConfigurationDirectory(@NotNull String path, @NotNull final Consumer dirConsumer, final Project project, @@ -380,7 +387,6 @@ public class SvnConfigurable implements Configurable { myHttpTimeout.setValue(Long.valueOf(configuration.getHttpTimeout() / 1000)); myWithCommandLineClient.setSelected(configuration.isCommandLine()); myRunUnderTerminal.setSelected(configuration.isRunUnderTerminal()); - myRunUnderTerminal.setEnabled(myWithCommandLineClient.isSelected()); final SvnApplicationSettings applicationSettings17 = SvnApplicationSettings.getInstance(); myCommandLineClient.setText(applicationSettings17.getCommandLinePath()); myLocalesList.setSelectedItem(applicationSettings17.getExecutableLocale()); From 3943e99e658f0f9031bf8015d258a72e59d84c25 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 22 Oct 2014 20:05:18 +0200 Subject: [PATCH 36/64] IDEA-131555 (Named capture groups in Groovy regular expressions - "This named group syntax is not supported") --- plugins/groovy/jetgroovy.iml | 4 +- plugins/groovy/src/META-INF/plugin.xml | 3 ++ .../groovy/regexp/GroovyRegExpHost.java | 40 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 plugins/groovy/src/org/jetbrains/plugins/groovy/regexp/GroovyRegExpHost.java diff --git a/plugins/groovy/jetgroovy.iml b/plugins/groovy/jetgroovy.iml index 4ae317b2555c..c06341abadd7 100644 --- a/plugins/groovy/jetgroovy.iml +++ b/plugins/groovy/jetgroovy.iml @@ -37,6 +37,6 @@ + - - + \ No newline at end of file diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index ea356d13e917..6d171987ccd5 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -598,6 +598,9 @@ + + = 0; + } + } + return false; + } +} From 7d1d700ea631090e8d28c3f5d139dc1c5c2de900 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 22 Oct 2014 21:33:42 +0200 Subject: [PATCH 37/64] fix borders under Darcula in Change method signature and other places --- .../ui/laf/darcula/ui/DarculaEditorTextFieldBorder.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaEditorTextFieldBorder.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaEditorTextFieldBorder.java index 4cb617e5440a..cf96ea6235f4 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaEditorTextFieldBorder.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaEditorTextFieldBorder.java @@ -32,7 +32,9 @@ import java.awt.*; public class DarculaEditorTextFieldBorder implements Border { @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - if (isComboBoxEditor(c) || isCellEditor(c)) { + if (isComboBoxEditor(c) /*|| isCellEditor(c)*/) { + g.setColor(c.getBackground()); + g.fillRect(x, y, width, height); return; } final EditorTextField textField = UIUtil.getParentOfType(EditorTextField.class, c); @@ -65,8 +67,8 @@ public class DarculaEditorTextFieldBorder implements Border { @Override public Insets getBorderInsets(Component c) { - if (isComboBoxEditor(c) || isCellEditor(c)) { - return new InsetsUIResource(0,0,0,0); + if (isComboBoxEditor(c) /*|| isCellEditor(c)*/) { + return new InsetsUIResource(2,3,2,3); } return new InsetsUIResource(6, 7, 6, 7); } From 2a5d9c635b771f1fb41e220542592ceb87d85166 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 22 Oct 2014 21:34:39 +0200 Subject: [PATCH 38/64] UI Designer under Darcula: combo cell editor has gaps around text editor --- .../com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java index 0eba3d3ce28a..9c61666f3a2d 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java @@ -199,7 +199,7 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border { public void paint(Graphics g, JComponent c) { final Container parent = c.getParent(); if (parent != null) { - g.setColor(parent.getBackground()); + g.setColor(isTableCellEditor(c) && editor != null ? editor.getBackground() : parent.getBackground()); g.fillRect(0, 0, c.getWidth(), c.getHeight()); } Rectangle r = rectangleForCurrentValue(); @@ -212,7 +212,7 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border { } private static boolean isTableCellEditor(JComponent c) { - return Boolean.TRUE.equals(c.getClientProperty("JComboBox.isTableCellEditor")); + return Boolean.TRUE.equals(c.getClientProperty("JComboBox.isTableCellEditor")) || c.getParent() instanceof JTable; } @Override From 1b233b361be345831c1fd3c6991be76b31fd1c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Wed, 22 Oct 2014 21:48:47 +0200 Subject: [PATCH 39/64] DomService: getDomFileCandidates() cleanup/performance, deprecation --- .../src/util/ExtensionPointLocator.java | 2 +- .../util/xml/impl/DomServiceImpl.java | 12 ++++++-- .../intellij/util/xml/DomFileDescription.java | 3 +- .../src/com/intellij/util/xml/DomService.java | 29 +++++++++---------- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/plugins/devkit/src/util/ExtensionPointLocator.java b/plugins/devkit/src/util/ExtensionPointLocator.java index c4a5b19c156a..e8d895a1e7dc 100644 --- a/plugins/devkit/src/util/ExtensionPointLocator.java +++ b/plugins/devkit/src/util/ExtensionPointLocator.java @@ -75,7 +75,7 @@ public class ExtensionPointLocator { } final Project project = psiClass.getProject(); - final Collection candidates = DomService.getInstance().getDomFileCandidates(IdeaPlugin.class, project); + final Collection candidates = DomService.getInstance().getDomFileCandidates(IdeaPlugin.class, project, GlobalSearchScope.allScope(project)); GlobalSearchScope scope = GlobalSearchScope.filesScope(project, candidates); PsiSearchHelper.SERVICE.getInstance(project).processUsagesInNonJavaFiles(name, new PsiNonJavaFileReferenceProcessor() { @Override diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java index 94987bc604a9..eb8c57a9c281 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java @@ -164,12 +164,19 @@ public class DomServiceImpl extends DomService { @Override public Collection getDomFileCandidates(Class description, Project project) { - return FileBasedIndex.getInstance().getContainingFiles(DomFileIndex.NAME, description.getName(), GlobalSearchScope.allScope(project)); + return getDomFileCandidates(description, project, GlobalSearchScope.allScope(project)); + } + + @Override + public Collection getDomFileCandidates(Class rootElementClass, + Project project, + final GlobalSearchScope scope) { + return FileBasedIndex.getInstance().getContainingFiles(DomFileIndex.NAME, rootElementClass.getName(), scope); } @Override public List> getFileElements(final Class clazz, final Project project, @Nullable final GlobalSearchScope scope) { - final Collection list = scope == null ? getDomFileCandidates(clazz, project) : getDomFileCandidates(clazz, project, scope); + final Collection list = getDomFileCandidates(clazz, project, scope != null ? scope : GlobalSearchScope.allScope(project)); final ArrayList> result = new ArrayList>(list.size()); for (VirtualFile file : list) { final PsiFile psiFile = PsiManager.getInstance(project).findFile(file); @@ -189,5 +196,4 @@ public class DomServiceImpl extends DomService { public StructureViewBuilder createSimpleStructureViewBuilder(final XmlFile file, final Function modeProvider) { return new DomStructureViewBuilder(file, modeProvider); } - } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java b/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java index eb5de3eebf43..97950b30037e 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java @@ -126,7 +126,8 @@ public class DomFileDescription { /** * @return some version. Override and change (e.g. super.getVersion()+1) when after some changes some files stopped being * described by this description or vice versa, so that the - * {@link com.intellij.util.xml.DomService#getDomFileCandidates(Class, com.intellij.openapi.project.Project)} index is rebuilt correctly. + * {@link com.intellij.util.xml.DomService#getDomFileCandidates(Class, com.intellij.openapi.project.Project, com.intellij.psi.search.GlobalSearchScope)} + * index is rebuilt correctly. */ public int getVersion() { return myRootTagName.hashCode(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomService.java b/xml/dom-openapi/src/com/intellij/util/xml/DomService.java index dced490f43d5..a2d567e9c87a 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DomService.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DomService.java @@ -19,12 +19,10 @@ package com.intellij.util.xml; import com.intellij.ide.structureView.StructureViewBuilder; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Condition; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.xml.XmlFile; import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -44,24 +42,21 @@ public abstract class DomService { return ourCachedInstance; } + /** + * @deprecated use {@link #getDomFileCandidates(Class, com.intellij.openapi.project.Project, com.intellij.psi.search.GlobalSearchScope)} (to remove in IDEA 15) + */ + public abstract Collection getDomFileCandidates(Class description, Project project); + /** * @param rootElementClass class of root (file-level) element in DOM model - * @param project current project - * @param scope search scope + * @param project current project + * @param scope search scope * @return files containing given root element - * * @see #getFileElements(Class, com.intellij.openapi.project.Project, com.intellij.psi.search.GlobalSearchScope) */ - public Collection getDomFileCandidates(Class rootElementClass, Project project, final GlobalSearchScope scope) { - return ContainerUtil.findAll(getDomFileCandidates(rootElementClass, project), new Condition() { - @Override - public boolean value(final VirtualFile file) { - return scope.contains(file); - } - }); - } - - public abstract Collection getDomFileCandidates(Class description, Project project); + public abstract Collection getDomFileCandidates(Class rootElementClass, + Project project, + GlobalSearchScope scope); /** * @param rootElementClass class of root (file-level) element in DOM model @@ -89,5 +84,7 @@ public abstract class DomService { public enum StructureViewMode { SHOW, SHOW_CHILDREN, SKIP } - public abstract StructureViewBuilder createSimpleStructureViewBuilder(final XmlFile file, final Function modeProvider); + + public abstract StructureViewBuilder createSimpleStructureViewBuilder(final XmlFile file, + final Function modeProvider); } From d12935c039007beb19a4e682fc59d51724be0be6 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 22 Oct 2014 22:02:37 +0200 Subject: [PATCH 40/64] update new Welcome for Darcula --- .../impl/welcomeScreen/FlatWelcomeFrame.java | 24 ++++++++++++++----- .../welcomeScreen/NewRecentProjectPanel.java | 10 ++++---- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index 320171a1e55f..d5a9660c1b00 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -165,17 +165,29 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { } public static Color getMainBackground() { - return new JBColor(new Color(0xf5f6f8), new Color(0x3c3f41)); + return new JBColor(0xf7f7f7, 0x45474a); } - public static Color getProjectsBackGround() { - return new JBColor(Gray.xFF, new Color(58, 61, 63)); + public static Color getProjectsBackground() { + return new JBColor(Gray.xFF, Gray.x39); } public static Color getLinkNormalColor() { return new JBColor(Gray._0, Gray.xBB); } + public static Color getListSelectionColor() { + return new JBColor(0x3875d6, 0x4b6eaf); + } + + public static Color getActionLinkSelectionColor() { + return new JBColor(0xdbe5f5, 0x485875); + } + + public static JBColor getSeparatorColor() { + return new JBColor(Gray.xEC, new Color(0x4e5154)); + } + private class FlatWelcomeScreen extends JPanel implements WelcomeScreen { public FlatWelcomeScreen() { super(new BorderLayout()); @@ -374,8 +386,8 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { private JComponent createRecentProjects() { JPanel panel = new JPanel(new BorderLayout()); panel.add(new NewRecentProjectPanel(this), BorderLayout.CENTER); - panel.setBackground(getProjectsBackGround()); - panel.setBorder(new CustomLineBorder(new JBColor(Gray.xEC, new Color(0x3c3f41)), 0,0,0,1)); + panel.setBackground(getProjectsBackground()); + panel.setBorder(new CustomLineBorder(getSeparatorColor(), 0,0,0,1)); return panel; } @@ -414,7 +426,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { @Override public void focusGained(FocusEvent e) { comp.setOpaque(true); - comp.setBackground(new JBColor(new Color(0xd2e1f0), new Color(0x455565))); + comp.setBackground(getActionLinkSelectionColor()); } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewRecentProjectPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewRecentProjectPanel.java index f2152bd449c8..9f48ba5435b0 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewRecentProjectPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewRecentProjectPanel.java @@ -37,17 +37,17 @@ public class NewRecentProjectPanel extends RecentProjectPanel { public NewRecentProjectPanel(WelcomeScreen screen) { super(screen); setBorder(null); - setBackground(FlatWelcomeFrame.getProjectsBackGround()); + setBackground(FlatWelcomeFrame.getProjectsBackground()); JScrollPane scrollPane = UIUtil.findComponentOfType(this, JScrollPane.class); if (scrollPane != null) { - scrollPane.setBackground(FlatWelcomeFrame.getProjectsBackGround()); + scrollPane.setBackground(FlatWelcomeFrame.getProjectsBackground()); scrollPane.setSize(245, 460); scrollPane.setMinimumSize(new Dimension(245, 460)); scrollPane.setPreferredSize(new Dimension(245, 460)); } ListWithFilter panel = UIUtil.findComponentOfType(this, ListWithFilter.class); if (panel != null) { - panel.setBackground(FlatWelcomeFrame.getProjectsBackGround()); + panel.setBackground(FlatWelcomeFrame.getProjectsBackground()); } } @@ -58,7 +58,7 @@ public class NewRecentProjectPanel extends RecentProjectPanel { @Override protected JBList createList(AnAction[] recentProjectActions, Dimension size) { final JBList list = super.createList(recentProjectActions, size); - list.setBackground(FlatWelcomeFrame.getProjectsBackGround()); + list.setBackground(FlatWelcomeFrame.getProjectsBackground()); list.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { @@ -87,7 +87,7 @@ public class NewRecentProjectPanel extends RecentProjectPanel { } @Override protected Color getListBackground(boolean isSelected, boolean hasFocus) { - return isSelected ? new Color(0x2484fd) : FlatWelcomeFrame.getProjectsBackGround(); + return isSelected ? FlatWelcomeFrame.getListSelectionColor() : FlatWelcomeFrame.getProjectsBackground(); } @Override From 1c014fae8d0da337d348dc639e53a2ea16497b9c Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 22 Oct 2014 22:36:43 +0200 Subject: [PATCH 41/64] update selection bg for new welcome screen --- .../impl/welcomeScreen/FlatWelcomeFrame.java | 18 +++++++++++++++--- .../welcomeScreen/NewRecentProjectPanel.java | 4 ++-- .../impl/welcomeScreen/RecentProjectPanel.java | 4 ++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index d5a9660c1b00..31259a6aad4b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -91,6 +91,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { } else { setSize(555, 460); } + setResizable(false); //int x = bounds.x + (bounds.width - getWidth()) / 2; //int y = bounds.y + (bounds.height - getHeight()) / 2; Point location = DimensionService.getInstance().getLocation(WelcomeFrame.DIMENSION_KEY, null); @@ -176,8 +177,8 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { return new JBColor(Gray._0, Gray.xBB); } - public static Color getListSelectionColor() { - return new JBColor(0x3875d6, 0x4b6eaf); + public static Color getListSelectionColor(boolean hasFocus) { + return hasFocus ? new JBColor(0x3875d6, 0x4b6eaf) : new JBColor(Gray.xDD, Gray.x45); } public static Color getActionLinkSelectionColor() { @@ -185,7 +186,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { } public static JBColor getSeparatorColor() { - return new JBColor(Gray.xEC, new Color(0x4e5154)); + return new JBColor(Gray.xEC, new Color(72, 75, 78)); } private class FlatWelcomeScreen extends JPanel implements WelcomeScreen { @@ -220,6 +221,17 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { removeIfNeeded(); } }); + projectsList.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + projectsList.repaint(); + } + + @Override + public void focusLost(FocusEvent e) { + projectsList.repaint(); + } + }); } } add(createBody(), BorderLayout.CENTER); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewRecentProjectPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewRecentProjectPanel.java index 9f48ba5435b0..0d7fccb29982 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewRecentProjectPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewRecentProjectPanel.java @@ -87,12 +87,12 @@ public class NewRecentProjectPanel extends RecentProjectPanel { } @Override protected Color getListBackground(boolean isSelected, boolean hasFocus) { - return isSelected ? FlatWelcomeFrame.getListSelectionColor() : FlatWelcomeFrame.getProjectsBackground(); + return isSelected ? FlatWelcomeFrame.getListSelectionColor(hasFocus) : FlatWelcomeFrame.getProjectsBackground(); } @Override protected Color getListForeground(boolean isSelected, boolean hasFocus) { - return UIUtil.getListForeground(isSelected); + return UIUtil.getListForeground(isSelected && hasFocus); } }; } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java index 2c2d68541bc6..f47c53330771 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java @@ -257,8 +257,8 @@ public class RecentProjectPanel extends JPanel { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { ReopenProjectAction item = (ReopenProjectAction)value; - Color fore = getListForeground(isSelected, cellHasFocus); - Color back = getListBackground(isSelected, cellHasFocus); + Color fore = getListForeground(isSelected, list.hasFocus()); + Color back = getListBackground(isSelected, list.hasFocus()); myName.setForeground(fore); myPath.setForeground(isSelected ? fore : UIUtil.getInactiveTextColor()); From 89f20ace026003667ddb53dc3b3a04dac22c8bbe Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 22 Oct 2014 22:43:34 +0200 Subject: [PATCH 42/64] don't remove recent project panel on speed search --- .../openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index 31259a6aad4b..47353f52326e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -209,7 +209,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { } private void removeIfNeeded() { - if (projectsList.getModel().getSize() == 0) { + if (RecentProjectsManager.getInstance().getRecentProjectsActions(false).length == 0) { FlatWelcomeScreen.this.remove(recentProjects); FlatWelcomeScreen.this.revalidate(); FlatWelcomeScreen.this.repaint(); From aa6fec2634652f4a8b8222422748d73365942776 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 23 Oct 2014 01:44:14 +0200 Subject: [PATCH 43/64] add combo3 icon --- platform/icons/src/general/combo3.png | Bin 0 -> 128 bytes platform/icons/src/general/combo3@2x.png | Bin 0 -> 212 bytes platform/icons/src/general/combo3@2x_dark.png | Bin 0 -> 212 bytes platform/icons/src/general/combo3_dark.png | Bin 0 -> 129 bytes .../util/src/com/intellij/icons/AllIcons.java | 1 + 5 files changed, 1 insertion(+) create mode 100644 platform/icons/src/general/combo3.png create mode 100644 platform/icons/src/general/combo3@2x.png create mode 100644 platform/icons/src/general/combo3@2x_dark.png create mode 100644 platform/icons/src/general/combo3_dark.png diff --git a/platform/icons/src/general/combo3.png b/platform/icons/src/general/combo3.png new file mode 100644 index 0000000000000000000000000000000000000000..bfdd4c4627e570065da499fa1e538afe4ba53952 GIT binary patch literal 128 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`?w&4=Ar-fhfBgS%l@k&Et zwnIwF6BC7h{jC1V*BH_i?sY7aJd&<T>dG=4 zy6EtSzvDl{MtL*SEoBTG;S7apdOt5tDu7tdU?{<`wmE3KrT=<%pfedfUHx3vIVCg! E02cO2AOHXW literal 0 HcmV?d00001 diff --git a/platform/icons/src/general/combo3@2x_dark.png b/platform/icons/src/general/combo3@2x_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..9313cace3c80996f0b830b3deb628efac3e0a5e8 GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ*`6+rAr-fhfBgS%f7l_ZEs(v( zD&Y#_Vm^t|11p%_WDQhgHk7@+mFe(jzRMj~Uv>lLk8VOb>?>23En{|=!QJ66koc2x zMHE|>HA9PQ;}0{r)A`O<4KAEwR9M4yM1DiWKdz3@30E%x`EOW`*iY2?&voS4i&q&h z83g*+9@RViVek06VdcWD%nm!4I*bcX_D^epTHSGwVcU)a-*;^KTn=<5gQu&X%Q~lo FCIG*rQ>g#| literal 0 HcmV?d00001 diff --git a/platform/icons/src/general/combo3_dark.png b/platform/icons/src/general/combo3_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..51040859202b09448b72d926cd4046e946fdc34f GIT binary patch literal 129 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`9-c0aAr-fhfBgS%l@k&Et z_JLblvzIe|tk Date: Thu, 23 Oct 2014 01:45:14 +0200 Subject: [PATCH 44/64] use combo3 icon to align combo triangle --- .../openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index 47353f52326e..126e827b0af5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -303,7 +303,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout()); panel.setBorder(new EmptyBorder(4, 10, 4, 10)); panel.add(settings.get()); - JLabel arrow = new JLabel(AllIcons.General.Combo2); + JLabel arrow = new JLabel(AllIcons.General.Combo3); arrow.setVerticalAlignment(SwingConstants.BOTTOM); panel.add(arrow, BorderLayout.EAST); installFocusable(panel, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, focusListOnLeft); From d0557917aee7555e7a2aa6a2db0795b1ee27fbed Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 23 Oct 2014 01:45:40 +0200 Subject: [PATCH 45/64] optimize icons size --- platform/icons/src/welcome/createNewProject.png | Bin 442 -> 344 bytes .../icons/src/welcome/createNewProject@2x.png | Bin 857 -> 630 bytes platform/icons/src/welcome/fromVCS.png | Bin 225 -> 178 bytes platform/icons/src/welcome/fromVCS@2x.png | Bin 318 -> 263 bytes platform/icons/src/welcome/importProject.png | Bin 321 -> 219 bytes platform/icons/src/welcome/importProject@2x.png | Bin 487 -> 372 bytes platform/icons/src/welcome/openProject.png | Bin 183 -> 118 bytes platform/icons/src/welcome/openProject@2x.png | Bin 218 -> 153 bytes 8 files changed, 0 insertions(+), 0 deletions(-) diff --git a/platform/icons/src/welcome/createNewProject.png b/platform/icons/src/welcome/createNewProject.png index 27f390cbaeebd33a9c4cc08059f9812b90db677e..0055e1840808f3d935bf4049fc323670cfdff670 100644 GIT binary patch delta 318 zcmV-E0m1&d1K0wPBYy!ONkl520fnnV}p5h04W@jh6liloUyPg%8L|&BB z9`q#=_OKs`cc9l77{@v0gQOeWqT=E!%I)_B%r1U#hFL7=+kY%!4j1~~43A*Cajk@J zJh%e)irM%QU9kdY)h$X{jy17;X503Y5>HXX2%3u7+@kMEroYL$-3oqb&=nsD=2}{l z+vF4uA_Zy%1s-vTX@7)@w)d>0rWOw4M6nO7p)=LQ^%70oNi}f@FG~8vom*t%FOA>T z*gpkqo3ChKR5zE$U!*Y{;SI-Off;O|r^HpRVhag9~qs(he$^U!Kzp;4rbN9w& QhyVZp07*qoM6N<$f)ibrb^rhX delta 417 zcmV;S0bc&t0=ff`BYyxHbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUz zTuDShRCwBi(#tD^Q5eVZcU~j5l!kFjVIvEa71>!ywwRSafXsrOe?ZAXDP=qU03yl) z$xgYf6uFEHWg`paGQN*~uTICzIQ8j$&pFR|&NX(C9u7*B4u6C=D;5yyTV13-h4BLI zF;uw;tg?eXFK85FPMnoNY)5TT$0ZJNfGzYWSu+~Zk6!F*@H(DiT6>C3L9qwPce%Y4B$~gtEfR8R@C;65#3B0Cvhk1mkutW z`jE2)cjk6{7CJ=R-;(|)PzfW^j#t z+~7_x^a|73|B)sMqBA%a{}$Fz<}BaJi&hf235u1>KN|hPw*UhGS${`2FtM5{00000 LNkvXXu0mjfI{~|- diff --git a/platform/icons/src/welcome/createNewProject@2x.png b/platform/icons/src/welcome/createNewProject@2x.png index b1df70704f192e4c165e293b3a01b07cbb2be9e8..7cf70232ada78cb120ba7f5581fed44f94ceb4f0 100644 GIT binary patch delta 606 zcmV-k0-^oc2KEGyBYy%tNklCN)}f4?yl9J5`~or3$G%N@2Nx6G&8^XJ;LI%nsd&4XXeZ~ zGoiiix{wcYK)#=b-) zdkuRPfxPnDOMe}pMB5Eu^8cnf;dIqXeNIk!@XK!{R3+RF--Kk41ZqG;VK?Ws6vy!d zH2JM!a#cd5DnyX)0;uOBH42F0?HcF8qTAMb!-{GReiU;86!Tnf0`kBBHx`?7O)>~b zu#9oUT{J($Rc@HO+ItB&0e?V&+%TxCO*tGvtwBJI!GDkPVHQ+@7^ftp#?rv$RZhYP zC!Fk)qDaC=?g#A}AFFG)tXNHiSDVP_uHhv}^HT?!1E_@4UInB(nR3 zwwQP}0@^fzuDDR?+A)n?YkWIx1!RB=$(i1AT|y?C9wc8ukD{(96H+B$O*p#^&hTgt zPqJ9h1XunEHZx8F+IgEtRqr?Ht#B@_E^M$b-T&90>8A?h`g4#$p8QV07*qoM6N<$g2sy-DgXcg delta 835 zcmV-J1HAn91lb0VBYyxHbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU! z`$HGC&^`qNHj6?f;2TI^1wV$iWv=#aT))w{zt22?X}n0dw=GuU+ultUf=rG+TShu zsyZ17A=AMC&>B=hED}ztKstcT-_Ndapsz$7pM%yV2*1S-7@$WhS~ zu-HLa+T+>lpz=){7-;(ihrnoXpUk$LWS#Q978HAYy9_)9b>KC)Wivo-VJDyE7Mj5g zFjM<(DHy4|kADEmwQt1uhu}7t1%86vE>0*GUQ^yzfoI?{m}a^1v=W+E`70MF^QS=j zf1d1-2PT4-V6Zm+3tR;24Rbjfxe3IzxsRY6bh?J&J8;l2E{ZdT&GS)|F>Ee!z_htv z9yo5gvHGEUV1EcGp`*4LzLT|0K~k|KizJ;Y zY1n)&!?PQF1&tijjY!dm6my5wfG9KJ8SnvI2OB^_TeIK8p}N36Z7jivk+6ObYQcQ& z^)C!(Fox62?S4|iQ%5`^;k$zliL!bj#(Ey_gVJ1x6qC4Y`U30$lfgo84t%mKUSyfG zRa3c{OMhSm7!Rr?MAcJEs5}DOz&Nl5TrphfVNhz=U?@1EjpcQ21!MV}r8fNbi-I3? z9I1GB4Q-g@`IU6C1fQEZr^*-VxIia0rdFG51gkxI!J7{MdKfs$8z?vtjRB|oz~Q!l zIYA7lWt|Tz67w~THfIAiGkfXMO~bw!=5m}f<$nliNVdBgAQ5m<8+*gBDWf9O|8L}+ zG^u+*hc++eeUys6JX0 zUQX|5$*Pm_t#?libU-1?JW%0fKoQ@|*ax)x^a@$!J0kQ#*B!78HL_t(|+GF_t|33pI7)*Fg*@uq*jUjOb_tVLu@L1I2#W)DSWNgfoFS7neNT07@_bAs9-7&JPdTSO5S307*qoM6N<$ Eg7OYN-T(jq delta 197 zcmV;$06PD&0pS6VB!3xnMObuGZ)S9NVRB^vL1b@YWgtmyVP|DhWnpA_ami&o0001k zNkl=;F9cWklv|&30s9VxSO=8h|ih8Z_kp5Z}S0`92O*%{N?u_!@{kp)>_Cl3=m)dvehky@;I=wDp>v%Y8F}9&<}|JP+<8Vs2LQM17z70I3S-|1ra%A#58J_ zgrt@c8=-orS`-soM!@qrwH-iA8G(}5Y2g5TWdufEr$G+N l2xkIuE;)J!U*~k7FaUBUDim~IPL2Qo002ovPDHLkV1kidZ%$Aw7+_{^Gy%>lVUyonB;-UPJ^!vTMRI1-3Y($MmgP=7oA;z|SGfY=v^@6f>V zJ5aN~5lV!wf!GsDQw!iUlZh19k_qsJDibO3MFt?4u9%2OvH27@pqNn3BBmgk3dGaN zupFdkBDG3FQp*UGyiN@VkWxmFly;b?m72-TJxtWf&*YXL9fLMYYo6~{# zFA)C+Vjg@3nBZ{sKd9yxATfLfd<0?}D4PR_=Rh^W@G`go9i3fpjAQ^v(N`dj1>$pP znnBnB*?|9OI0uUcWIP*Y5jh5I2Vyo{2B3QZ9iKziOpXDd7&yqG!~htsAjSYN289PS tOfcj?dWkUrEJv&X_%PNyLmdMs!2s+?T>v}|B9{OF002ovPDHLkV1nn?M`i#3 delta 294 zcmV+>0onfB0l@;0B!3xnMObuGZ)S9NVRB^vL1b@YWgtmyVP|DhWnpA_ami&o0002v zNklB?AFa4#bm~7{~*eK-><*{EX->Aj0N!Af5)qAj^62xxfU6 zv!_EfzXakh_zc(!#5Pbi2N2Hz;tn8Ygo^D05nwNLc6Gyb@qfLQgE2vV`v$}rKwJpK zhG-Tz0`UPBB*kFxN%#?n%7q%l1;mT6xDMo+0}N2VkP3DHaW;&@f+op`07*qoM6N<$f{KiI@&Et; diff --git a/platform/icons/src/welcome/importProject@2x.png b/platform/icons/src/welcome/importProject@2x.png index 4aca3fc3b826d3444aaf3d11941e3d0b9ca5cbf9..e5243159e1bc4fa0796f5a81bc6318d368e6cfaf 100644 GIT binary patch delta 346 zcmV-g0j2)u1M~urBYy!qNkl)$ zEC=FG^mYIj5U+q*4#FQub^rxIt^~vvkSqt`+mtwfiv-J^f%qMocWWaGC7Q|sO2N2J}VKEG+Q|bT^J_p32Xn&R~LdEe}{tt-dso?++ zz6QinP;qY{eow%15Z($>kKurh&Mv$dhXX+PE)Y+K`s_au*cO)q{u6-{h_nP3UJCOF zxekb;!17B#%ulHUqRF)U0T9a|Cs=wq;1RSmWFXZ6#3n*~_zn;&U@I@^;Q&ysh{IJ< z(kldh0&)02I#U3I{{V5qKso>x9a#hE02nSqwwzoCpkSa}3^FFBoj`2|py;ES1MpxB sePs0u2BQPW#iI@wq7E2Ry<=)(0MV-fh`+KK3IG5A07*qoM6N<$f_3YPZU6uP delta 462 zcmV;<0Wtpc0_OveBYyxHbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUz ziAh93RCwBA{Qv(y!$1NSax_gZUrDLGRhgaPZ6F5I0C>6ph+APCdOCm+h#P>oABaCw z6a{1eE+C!<#Nkl>Kaw3lLA)yg@j4*ZM-qEYNfdCApw=0P&wrp<4gwD;allp}<|RU1 zCJ^rcVnHl&_b73I0}$`RVK4}A0P!3ko`xri&r+HTEP!|~5R0OTD+2K`AWp`k_dhgb zD9(n4KztC0rJ#IoAU+2b#|O3}rvZ2nb#`^*)y2mkhfP=$hz|qtHXzQ1=5<1#16NUu zw^H~d{0KxP@_)UR!X)YUO@bjQU{O& z9s{ux5I-TcI!5s=Qrs^g!ScI6>;l9Oa4Dc=2!IlG6F$pn?Ep{+&PJ*M>Fxj!U<2Z% zK%6j84gdjWXj>p_pd0{;j;TOg2CgPM!zpT%GNP4`F-K^*g_K-El_uF@G(K${0Ids% zQdeG9O0)w8qFGLK2+*a=G~gjH>Hx-p?i~+!2mk~a0HcIT_9(n_c>n+a07*qoM6N<$ Ef&%BWYXATM diff --git a/platform/icons/src/welcome/openProject.png b/platform/icons/src/welcome/openProject.png index fa9914f605ff51b374bd3eeea2ccabba532ceaf6..ea39bc0f541c08701966bc22a45b4f7513c4ef4d 100644 GIT binary patch delta 88 zcmdnaST;c=$kx-vF{I*F@{j-j?U_|)G-|QEnLF)^Joi85Bc2Xt8n}gx7+U@_7HX=p sJveG&*wE-jzZihP)78&qol`;+04UudQ2+n{ delta 154 zcmV;L0A>Gnw*inOe;IT|SaefwW^{L9a%BKPWN%_+AW3auXJt}lVPtu6$z?nM003D@ zL_t(|+G70w|33pIfRQQ&?3xw=2oPWZ6qwu|sb$8@u>b%707*qo IM6N<$g0sW%D!k4C|$14bP%>VQ!P s47s}C|7aA92nR5Z_6 Date: Thu, 23 Oct 2014 06:55:11 +0200 Subject: [PATCH 46/64] cleanup --- .../src/com/intellij/ide/util/TipPanel.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/util/TipPanel.java b/platform/platform-impl/src/com/intellij/ide/util/TipPanel.java index 8ca9576795c5..b2221f632a89 100644 --- a/platform/platform-impl/src/com/intellij/ide/util/TipPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/util/TipPanel.java @@ -24,6 +24,7 @@ import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.SimpleTextAttributes; import com.intellij.ui.components.JBLabel; import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; @@ -44,13 +45,13 @@ public class TipPanel extends JPanel { setLayout(new BorderLayout()); JLabel jlabel = new JLabel(AllIcons.General.Tip); jlabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - JLabel jlabel1 = new JLabel(IdeBundle.message("label.did.you.know")); - Font font = jlabel1.getFont(); - jlabel1.setFont(font.deriveFont(Font.PLAIN, font.getSize() + 4)); + JLabel label1 = new JLabel(IdeBundle.message("label.did.you.know")); + Font font = label1.getFont(); + label1.setFont(font.deriveFont(Font.PLAIN, font.getSize() + 4)); JPanel jpanel = new JPanel(); jpanel.setLayout(new BorderLayout()); jpanel.add(jlabel, BorderLayout.WEST); - jpanel.add(jlabel1, BorderLayout.CENTER); + jpanel.add(label1, BorderLayout.CENTER); jpanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); add(jpanel, BorderLayout.NORTH); myBrowser = TipUIUtil.createTipBrowser(); @@ -63,7 +64,8 @@ public class TipPanel extends JPanel { final GeneralSettings settings = GeneralSettings.getInstance(); showOnStartCheckBox.setSelected(settings.isShowTipsOnStartup()); showOnStartCheckBox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { + @Override + public void itemStateChanged(@NotNull ItemEvent e) { settings.setShowTipsOnStartup(e.getStateChange() == ItemEvent.SELECTED); } }); @@ -79,6 +81,7 @@ public class TipPanel extends JPanel { Collections.addAll(myTips, Extensions.getExtensions(TipAndTrickBean.EP_NAME)); } + @Override public Dimension getPreferredSize() { return new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT); } From 260ae5220e4d4cd5565544cc192064147d8a65fd Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 23 Oct 2014 07:13:27 +0200 Subject: [PATCH 47/64] IDEA-131692 Settings repository plugin: it doesn't make sense to sync last seen tip between different IDEs --- .../src/com/intellij/ide/GeneralSettings.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ide/GeneralSettings.java b/platform/platform-api/src/com/intellij/ide/GeneralSettings.java index 57128945ef5c..3be1a37f7094 100644 --- a/platform/platform-api/src/com/intellij/ide/GeneralSettings.java +++ b/platform/platform-api/src/com/intellij/ide/GeneralSettings.java @@ -15,9 +15,12 @@ */ package com.intellij.ide; +import com.intellij.ide.util.PropertiesComponent; import com.intellij.openapi.components.*; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.xmlb.XmlSerializerUtil; import com.intellij.util.xmlb.annotations.OptionTag; +import com.intellij.util.xmlb.annotations.Transient; import org.intellij.lang.annotations.MagicConstant; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; @@ -38,7 +41,6 @@ public class GeneralSettings implements PersistentStateComponent Date: Thu, 23 Oct 2014 07:22:12 +0200 Subject: [PATCH 48/64] IDEA-131691 Settings repository plugin: it doesn't make sense to sync last opened project between IDEs --- .../ide/RecentDirectoryProjectsManagerEx.java | 11 ++++++----- .../intellij/ide/RecentDirectoryProjectsManager.java | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/RecentDirectoryProjectsManagerEx.java b/platform/lang-impl/src/com/intellij/ide/RecentDirectoryProjectsManagerEx.java index b9086439906b..c65aa04b91a1 100644 --- a/platform/lang-impl/src/com/intellij/ide/RecentDirectoryProjectsManagerEx.java +++ b/platform/lang-impl/src/com/intellij/ide/RecentDirectoryProjectsManagerEx.java @@ -15,10 +15,7 @@ */ package com.intellij.ide; -import com.intellij.openapi.components.RoamingType; -import com.intellij.openapi.components.State; -import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; +import com.intellij.openapi.components.*; import com.intellij.openapi.project.Project; import com.intellij.platform.ModuleAttachProcessor; import com.intellij.util.messages.MessageBus; @@ -29,7 +26,11 @@ import org.jetbrains.annotations.NotNull; */ @State( name = "RecentDirectoryProjectsManager", - storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml", roamingType = RoamingType.DISABLED)} + storages = { + @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml"), + @Storage(file = StoragePathMacros.APP_CONFIG + "/recentProjectDirectories.xml", roamingType = RoamingType.DISABLED) + }, + storageChooser = LastStorageChooserForWrite.class ) public class RecentDirectoryProjectsManagerEx extends RecentDirectoryProjectsManager { public RecentDirectoryProjectsManagerEx(MessageBus messageBus) { diff --git a/platform/platform-impl/src/com/intellij/ide/RecentDirectoryProjectsManager.java b/platform/platform-impl/src/com/intellij/ide/RecentDirectoryProjectsManager.java index 59b115a43105..5282f61543b6 100644 --- a/platform/platform-impl/src/com/intellij/ide/RecentDirectoryProjectsManager.java +++ b/platform/platform-impl/src/com/intellij/ide/RecentDirectoryProjectsManager.java @@ -15,10 +15,7 @@ */ package com.intellij.ide; -import com.intellij.openapi.components.RoamingType; -import com.intellij.openapi.components.State; -import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; +import com.intellij.openapi.components.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.LocalFileSystem; @@ -34,7 +31,11 @@ import org.jetbrains.annotations.Nullable; */ @State( name = "RecentDirectoryProjectsManager", - storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml", roamingType = RoamingType.DISABLED)} + storages = { + @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml"), + @Storage(file = StoragePathMacros.APP_CONFIG + "/recentProjectDirectories.xml", roamingType = RoamingType.DISABLED) + }, + storageChooser = LastStorageChooserForWrite.class ) public class RecentDirectoryProjectsManager extends RecentProjectsManagerBase { public RecentDirectoryProjectsManager(MessageBus messageBus) { From 78ad5bf8ee14c333860cbe71a2036097ef9e390b Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Thu, 23 Oct 2014 11:18:19 +0400 Subject: [PATCH 49/64] additional validation (following CR-IC-6639) --- .../openapi/fileEditor/impl/FileEditorManagerImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java index 0dc4f5bc7209..fdbba254571b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java @@ -774,6 +774,9 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec builders[i] = ApplicationManager.getApplication().runReadAction(new Computable() { @Override public AsyncFileEditorProvider.Builder compute() { + if (myProject.isDisposed() || !file.isValid()) { + return null; + } LOG.assertTrue(provider.accept(myProject, file), "Provider " + provider + " doesn't accept file " + file); return provider instanceof AsyncFileEditorProvider ? ((AsyncFileEditorProvider)provider).createEditorAsync(myProject, file) : null; } From d24f468b482d849e9f7a1c38792499eb95f83178 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Thu, 23 Oct 2014 09:32:24 +0200 Subject: [PATCH 50/64] skip null TextAttributesKey when processing var arg (EA-59728) --- platform/usageView/src/com/intellij/usages/ChunkExtractor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/usageView/src/com/intellij/usages/ChunkExtractor.java b/platform/usageView/src/com/intellij/usages/ChunkExtractor.java index b9db68c69ce3..ceba6f18df09 100644 --- a/platform/usageView/src/com/intellij/usages/ChunkExtractor.java +++ b/platform/usageView/src/com/intellij/usages/ChunkExtractor.java @@ -282,6 +282,7 @@ public class ChunkExtractor { ) { return true; } + if (key == null) continue; final TextAttributesKey fallbackAttributeKey = key.getFallbackAttributeKey(); if (fallbackAttributeKey != null && isHighlightedAsComment(fallbackAttributeKey)) { return true; @@ -295,6 +296,7 @@ public class ChunkExtractor { if (key == DefaultLanguageHighlighterColors.STRING || key == SyntaxHighlighterColors.STRING) { return true; } + if (key == null) continue; final TextAttributesKey fallbackAttributeKey = key.getFallbackAttributeKey(); if (fallbackAttributeKey != null && isHighlightedAsString(fallbackAttributeKey)) { return true; From f40e4521db87d4d54f2b2334052cc8ee4a8cb3ea Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 23 Oct 2014 11:49:30 +0400 Subject: [PATCH 51/64] exclude from detection: return default state instead of 'null' from 'getState' method to fix problem with not saved settings --- .../DetectionExcludesConfigurable.java | 31 ++++++++----------- .../DetectionExcludesConfigurationImpl.java | 5 +-- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurable.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurable.java index 6239cbbab4ac..8cf5f461baa8 100644 --- a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurable.java +++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurable.java @@ -256,9 +256,6 @@ public class DetectionExcludesConfigurable implements Configurable { @Nullable private ExcludesConfigurationState computeState() { - if (myModel.getItems().isEmpty() && myEnabledDetectionCheckBox.isSelected()) { - return null; - } final ExcludesConfigurationState state = new ExcludesConfigurationState(); state.setDetectionEnabled(myEnabledDetectionCheckBox.isSelected()); for (ExcludeListItem item : myModel.getItems()) { @@ -278,22 +275,20 @@ public class DetectionExcludesConfigurable implements Configurable { public void reset() { myModel.clear(); final ExcludesConfigurationState state = myConfiguration.getActualState(); - myEnabledDetectionCheckBox.setSelected(state == null || state.isDetectionEnabled()); - if (state != null) { - for (String typeId : state.getFrameworkTypes()) { - final FrameworkType frameworkType = FrameworkDetectorRegistry.getInstance().findFrameworkType(typeId); - myModel.add(frameworkType != null ? new ValidExcludeListItem(frameworkType, null) : new InvalidExcludeListItem(typeId, null)); + myEnabledDetectionCheckBox.setSelected(state.isDetectionEnabled()); + for (String typeId : state.getFrameworkTypes()) { + final FrameworkType frameworkType = FrameworkDetectorRegistry.getInstance().findFrameworkType(typeId); + myModel.add(frameworkType != null ? new ValidExcludeListItem(frameworkType, null) : new InvalidExcludeListItem(typeId, null)); + } + for (ExcludedFileState fileState : state.getFiles()) { + VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(fileState.getUrl()); + final String typeId = fileState.getFrameworkType(); + if (typeId == null) { + myModel.add(file != null ? new ValidExcludeListItem(null, file) : new InvalidExcludeListItem(null, fileState.getUrl())); } - for (ExcludedFileState fileState : state.getFiles()) { - VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(fileState.getUrl()); - final String typeId = fileState.getFrameworkType(); - if (typeId == null) { - myModel.add(file != null ? new ValidExcludeListItem(null, file) : new InvalidExcludeListItem(null, fileState.getUrl())); - } - else { - final FrameworkType frameworkType = FrameworkDetectorRegistry.getInstance().findFrameworkType(typeId); - myModel.add(frameworkType != null && file != null? new ValidExcludeListItem(frameworkType, file) : new InvalidExcludeListItem(typeId, fileState.getUrl())); - } + else { + final FrameworkType frameworkType = FrameworkDetectorRegistry.getInstance().findFrameworkType(typeId); + myModel.add(frameworkType != null && file != null? new ValidExcludeListItem(frameworkType, file) : new InvalidExcludeListItem(typeId, fileState.getUrl())); } } } diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurationImpl.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurationImpl.java index a110e3435984..e89c65197563 100644 --- a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurationImpl.java +++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurationImpl.java @@ -185,12 +185,9 @@ public class DetectionExcludesConfigurationImpl extends DetectionExcludesConfigu } } - @Nullable + @NotNull public ExcludesConfigurationState getActualState() { ensureOldSettingsLoaded(); - if (myExcludedFiles.isEmpty() && myExcludedFrameworks.isEmpty() && myDetectionEnabled) { - return null; - } final ExcludesConfigurationState state = new ExcludesConfigurationState(); state.setDetectionEnabled(myDetectionEnabled); From 01e9523b959373c9498ca3853c35fbe4894c85d8 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Thu, 23 Oct 2014 12:17:52 +0400 Subject: [PATCH 52/64] WEB-13295 Incorrect files downloaded for ZURB Foundation projects, on phpStorm 7.1.3 (and don't re-use previously downloaded archives) --- ...ctGithubTagDownloadedProjectGenerator.java | 36 +++++++------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/AbstractGithubTagDownloadedProjectGenerator.java b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/AbstractGithubTagDownloadedProjectGenerator.java index 09bca34d2a24..6ab678bf722c 100644 --- a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/AbstractGithubTagDownloadedProjectGenerator.java +++ b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/AbstractGithubTagDownloadedProjectGenerator.java @@ -89,34 +89,22 @@ public abstract class AbstractGithubTagDownloadedProjectGenerator extends WebPro @NotNull File extractToDir, @NotNull GithubTagInfo tag) throws GeneratorException { File zipArchiveFile = getCacheFile(tag); - boolean brokenZip = true; - boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode(); - if (!unitTestMode && zipArchiveFile.isFile()) { + String primaryUrl = getPrimaryZipArchiveUrlForDownload(tag); + boolean downloaded = false; + if (primaryUrl != null) { try { - ZipUtil.unzipWithProgressSynchronously(project, getTitle(), zipArchiveFile, extractToDir, true); - brokenZip = false; - } - catch (GeneratorException ignored) { + downloadAndUnzip(project, primaryUrl, zipArchiveFile, extractToDir, false); + downloaded = true; + } catch (GeneratorException e) { + LOG.info("Can't download " + primaryUrl, e); + FileUtil.delete(zipArchiveFile); } } - if (brokenZip) { - String primaryUrl = getPrimaryZipArchiveUrlForDownload(tag); - boolean downloaded = false; - if (primaryUrl != null) { - try { - downloadAndUnzip(project, primaryUrl, zipArchiveFile, extractToDir, false); - downloaded = true; - } catch (GeneratorException e) { - LOG.info("Can't download " + primaryUrl, e); - FileUtil.delete(zipArchiveFile); - } - } - if (!downloaded) { - if (unitTestMode) { - throw new GeneratorException("Download " + tag.getZipballUrl() + " is skipped in unit test mode"); - } - downloadAndUnzip(project, tag.getZipballUrl(), zipArchiveFile, extractToDir, true); + if (!downloaded) { + if (ApplicationManager.getApplication().isUnitTestMode()) { + throw new GeneratorException("Download " + tag.getZipballUrl() + " is skipped in unit test mode"); } + downloadAndUnzip(project, tag.getZipballUrl(), zipArchiveFile, extractToDir, true); } } From ba07a9515abacda6cdc6f2edfdd181594ce83fc5 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 23 Oct 2014 10:13:37 +0200 Subject: [PATCH 53/64] =?UTF-8?q?UsageViewSettings,=20RefactoringSettings?= =?UTF-8?q?=20=E2=80=94=20set=20exportable=20name,=20use=20own=20storage?= =?UTF-8?q?=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/intellij/refactoring/RefactoringSettings.java | 10 +++++----- .../src/messages/OptionsBundle.properties | 2 ++ .../src/com/intellij/usages/UsageViewSettings.java | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/refactoring/RefactoringSettings.java b/platform/lang-impl/src/com/intellij/refactoring/RefactoringSettings.java index e2952f9b5a53..a5ef4e198993 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/RefactoringSettings.java +++ b/platform/lang-impl/src/com/intellij/refactoring/RefactoringSettings.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. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.refactoring; import com.intellij.openapi.components.*; @@ -25,9 +24,10 @@ import com.intellij.util.xmlb.XmlSerializerUtil; @State( name = "BaseRefactoringSettings", storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} + @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml"), + @Storage(file = StoragePathMacros.APP_CONFIG + "/baseRefactoring.xml") + }, + storageChooser = LastStorageChooserForWrite.class ) public class RefactoringSettings implements PersistentStateComponent { public static RefactoringSettings getInstance() { diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties index aa64f5d80717..c76075a2bb85 100644 --- a/platform/platform-resources-en/src/messages/OptionsBundle.properties +++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties @@ -303,3 +303,5 @@ exportable.NotificationConfiguration.presentable.name=Notifications exportable.CodeInsightSettings.presentable.name=CodeInsight exportable.HttpConfigurable.presentable.name=HTTP Proxy exportable.KeymapManager.presentable.name=Key maps +exportable.UsageViewSettings.presentable.name=Usage View +exportable.BaseRefactoringSettings.presentable.name=Refactoring diff --git a/platform/usageView/src/com/intellij/usages/UsageViewSettings.java b/platform/usageView/src/com/intellij/usages/UsageViewSettings.java index 8312c330b987..136d95038c24 100644 --- a/platform/usageView/src/com/intellij/usages/UsageViewSettings.java +++ b/platform/usageView/src/com/intellij/usages/UsageViewSettings.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. @@ -25,9 +25,10 @@ import java.io.File; @State( name = "UsageViewSettings", storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} + @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml"), + @Storage(file = StoragePathMacros.APP_CONFIG + "/usageView.xml") + }, + storageChooser = LastStorageChooserForWrite.class ) public class UsageViewSettings implements PersistentStateComponent { @NonNls public String EXPORT_FILE_NAME = "report.txt"; From 0e281c4f60a349a8e76f83005f610d36f71f06a4 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 23 Oct 2014 10:19:21 +0200 Subject: [PATCH 54/64] =?UTF-8?q?DuplocatorSettings=20=E2=80=94=20set=20ex?= =?UTF-8?q?portable=20name,=20use=20own=20storage=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dupLocator/DuplocatorSettings.java | 19 ++++++------------- .../src/messages/OptionsBundle.properties | 1 + 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/platform/duplicates-analysis/src/com/intellij/dupLocator/DuplocatorSettings.java b/platform/duplicates-analysis/src/com/intellij/dupLocator/DuplocatorSettings.java index 66983d376eb6..337b52e293de 100644 --- a/platform/duplicates-analysis/src/com/intellij/dupLocator/DuplocatorSettings.java +++ b/platform/duplicates-analysis/src/com/intellij/dupLocator/DuplocatorSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2007 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. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.dupLocator; import com.intellij.openapi.components.*; @@ -22,19 +21,13 @@ import com.intellij.util.xmlb.XmlSerializerUtil; import java.util.HashSet; import java.util.Set; -/** - * Created by IntelliJ IDEA. - * User: db - * Date: Apr 8, 2004 - * Time: 2:47:43 PM - * To change this template use File | Settings | File Templates. - */ @State( - name="DuplocatorSettings", + name = "DuplocatorSettings", storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} + @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml"), + @Storage(file = StoragePathMacros.APP_CONFIG + "/duplocator.xml") + }, + storageChooser = LastStorageChooserForWrite.class ) public class DuplocatorSettings implements PersistentStateComponent { public boolean DISTINGUISH_VARIABLES = false; diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties index c76075a2bb85..6078417810ba 100644 --- a/platform/platform-resources-en/src/messages/OptionsBundle.properties +++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties @@ -305,3 +305,4 @@ exportable.HttpConfigurable.presentable.name=HTTP Proxy exportable.KeymapManager.presentable.name=Key maps exportable.UsageViewSettings.presentable.name=Usage View exportable.BaseRefactoringSettings.presentable.name=Refactoring +exportable.DuplocatorSettings.presentable.name=Duplocator From 8fd638506bafd7c8ba460075ee70067a239971df Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 23 Oct 2014 10:20:44 +0200 Subject: [PATCH 55/64] use existing duplocatorSettings file --- .../src/com/intellij/dupLocator/DuplocatorSettings.java | 2 +- .../intellij/dupLocator/MultilanguageDuplocatorSettings.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/platform/duplicates-analysis/src/com/intellij/dupLocator/DuplocatorSettings.java b/platform/duplicates-analysis/src/com/intellij/dupLocator/DuplocatorSettings.java index 337b52e293de..d805b8319743 100644 --- a/platform/duplicates-analysis/src/com/intellij/dupLocator/DuplocatorSettings.java +++ b/platform/duplicates-analysis/src/com/intellij/dupLocator/DuplocatorSettings.java @@ -25,7 +25,7 @@ import java.util.Set; name = "DuplocatorSettings", storages = { @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml"), - @Storage(file = StoragePathMacros.APP_CONFIG + "/duplocator.xml") + @Storage(file = StoragePathMacros.APP_CONFIG + "/duplocatorSettings.xml") }, storageChooser = LastStorageChooserForWrite.class ) diff --git a/platform/duplicates-analysis/src/com/intellij/dupLocator/MultilanguageDuplocatorSettings.java b/platform/duplicates-analysis/src/com/intellij/dupLocator/MultilanguageDuplocatorSettings.java index 92fc5b3b3175..738c498838f0 100644 --- a/platform/duplicates-analysis/src/com/intellij/dupLocator/MultilanguageDuplocatorSettings.java +++ b/platform/duplicates-analysis/src/com/intellij/dupLocator/MultilanguageDuplocatorSettings.java @@ -17,9 +17,7 @@ import java.util.Map; */ @State( name = "MultiLanguageDuplocatorSettings", - storages = { - @Storage(file = StoragePathMacros.APP_CONFIG + "/duplocatorSettings.xml") - } + storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/duplocatorSettings.xml") ) public class MultilanguageDuplocatorSettings implements PersistentStateComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.dupLocator.MultiLanguageDuplocatorSettings"); From f8e2472341e5f9b93deb1618f645c8e3f3492e6b Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 23 Oct 2014 10:23:12 +0200 Subject: [PATCH 56/64] =?UTF-8?q?MultiLanguageDuplocatorSettings=20?= =?UTF-8?q?=E2=80=94=20set=20exportable=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intellij/dupLocator/MultilanguageDuplocatorSettings.java | 4 ++-- .../src/messages/OptionsBundle.properties | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/duplicates-analysis/src/com/intellij/dupLocator/MultilanguageDuplocatorSettings.java b/platform/duplicates-analysis/src/com/intellij/dupLocator/MultilanguageDuplocatorSettings.java index 738c498838f0..da840978ff4b 100644 --- a/platform/duplicates-analysis/src/com/intellij/dupLocator/MultilanguageDuplocatorSettings.java +++ b/platform/duplicates-analysis/src/com/intellij/dupLocator/MultilanguageDuplocatorSettings.java @@ -6,7 +6,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.JDOMExternalizable; import com.intellij.openapi.util.WriteExternalException; -import com.intellij.util.containers.HashMap; +import com.intellij.util.containers.hash.LinkedHashMap; import org.jdom.Element; import org.jetbrains.annotations.NotNull; @@ -22,7 +22,7 @@ import java.util.Map; public class MultilanguageDuplocatorSettings implements PersistentStateComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.dupLocator.MultiLanguageDuplocatorSettings"); - private final Map mySettingsMap = new HashMap(); + private final Map mySettingsMap = new LinkedHashMap(); public static MultilanguageDuplocatorSettings getInstance() { return ServiceManager.getService(MultilanguageDuplocatorSettings.class); diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties index 6078417810ba..1906440c7ecc 100644 --- a/platform/platform-resources-en/src/messages/OptionsBundle.properties +++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties @@ -306,3 +306,4 @@ exportable.KeymapManager.presentable.name=Key maps exportable.UsageViewSettings.presentable.name=Usage View exportable.BaseRefactoringSettings.presentable.name=Refactoring exportable.DuplocatorSettings.presentable.name=Duplocator +exportable.MultiLanguageDuplocatorSettings.presentable.name=Duplocator From 54a94da28fc0a24e4cdfe89fc2008effaedae533 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Thu, 23 Oct 2014 12:51:39 +0400 Subject: [PATCH 57/64] maven: resolve run configuration system properties https://youtrack.jetbrains.com/issue/IDEA-120890#comment=27-826442 --- .../maven/execution/MavenJUnitPatcher.java | 26 +++++++++++++++ .../execution/MavenJUnitPatcherTest.java | 33 +++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/MavenJUnitPatcher.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/MavenJUnitPatcher.java index 7636a02fe98b..3249bd48ac32 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/MavenJUnitPatcher.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/MavenJUnitPatcher.java @@ -17,9 +17,12 @@ package org.jetbrains.idea.maven.execution; import com.intellij.execution.JUnitPatcher; import com.intellij.execution.configurations.JavaParameters; +import com.intellij.execution.configurations.ParametersList; import com.intellij.openapi.module.Module; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.containers.ContainerUtil; import org.jdom.Element; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.dom.MavenDomUtil; import org.jetbrains.idea.maven.dom.MavenPropertyResolver; @@ -31,11 +34,15 @@ import org.jetbrains.idea.maven.project.MavenTestRunningSettings; import org.jetbrains.idea.maven.utils.MavenJDOMUtil; import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * @author Sergey Evdokimov */ public class MavenJUnitPatcher extends JUnitPatcher { + public static final Pattern PROPERTY_PATTERN = Pattern.compile("\\$\\{(.+?)\\}"); @Override public void patchJavaParameters(@Nullable Module module, JavaParameters javaParameters) { @@ -71,6 +78,7 @@ public class MavenJUnitPatcher extends JUnitPatcher { if (!javaParameters.getVMParametersList().hasProperty(propertyName)) { String value = resolveSurefireProperties(element.getValue()); + value = resolveVmProperties(javaParameters.getVMParametersList(), value); if (isResolved(value)) { javaParameters.getVMParametersList().addProperty(propertyName, value); } @@ -87,6 +95,7 @@ public class MavenJUnitPatcher extends JUnitPatcher { if (!javaParameters.getEnv().containsKey(variableName)) { String value = resolveSurefireProperties(element.getValue()); + value = resolveVmProperties(javaParameters.getVMParametersList(), value); if (isResolved(value)) { javaParameters.addEnv(variableName, value); } @@ -99,6 +108,7 @@ public class MavenJUnitPatcher extends JUnitPatcher { Element argLine = config.getChild("argLine"); if (argLine != null) { String value = resolveSurefireProperties(argLine.getTextTrim()); + value = resolveVmProperties(javaParameters.getVMParametersList(), value); if (StringUtil.isNotEmpty(value) && isResolved(value)) { javaParameters.getVMParametersList().addParametersString(value); } @@ -110,6 +120,22 @@ public class MavenJUnitPatcher extends JUnitPatcher { return value.replaceAll("\\$\\{surefire\\.(forkNumber|threadNumber)\\}", "1"); } + private static String resolveVmProperties(@NotNull ParametersList vmParameters, @NotNull String value) { + Matcher matcher = PROPERTY_PATTERN.matcher(value); + Map toReplace = ContainerUtil.newHashMap(); + while (matcher.find()) { + String finding = matcher.group(); + final String propertyValue = vmParameters.getPropertyValue(finding.substring(2, finding.length() - 1)); + if(propertyValue == null) continue; + toReplace.put(finding, propertyValue); + } + for (Map.Entry entry : toReplace.entrySet()) { + value = value.replace(entry.getKey(), entry.getValue()); + } + + return value; + } + private static boolean isEnabled(String s) { return !Boolean.valueOf(System.getProperty("idea.maven.surefire.disable." + s)); } diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/execution/MavenJUnitPatcherTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/execution/MavenJUnitPatcherTest.java index d2166e9383a7..4d285412a00c 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/execution/MavenJUnitPatcherTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/execution/MavenJUnitPatcherTest.java @@ -64,4 +64,37 @@ public class MavenJUnitPatcherTest extends MavenImportingTestCase { assertEquals(asList("-Xmx2048M", "-XX:MaxPermSize=512M", "-Dargs=can have spaces"), javaParameters.getVMParametersList().getList()); } + + public void testVmPropertiesResolve() throws Exception { + VirtualFile m1 = createModulePom("m1", "test" + + "m1" + + "1" + + "" + + " " + + " test" + + " m2" + + " 1" + + " " + + "" + + "" + + " " + + " org.apache.maven.plugins" + + " maven-surefire-plugin" + + " 2.16" + + " " + + " -Xmx2048M -XX:MaxPermSize=512M \"-Dargs=can have spaces\" ${argLineApx}" + + " " + + " " + + ""); + + importProjects(m1); + Module module = getModule("m1"); + + MavenJUnitPatcher mavenJUnitPatcher = new MavenJUnitPatcher(); + JavaParameters javaParameters = new JavaParameters(); + javaParameters.getVMParametersList().addProperty("argLineApx", "-DsomeKey=someValue"); + mavenJUnitPatcher.patchJavaParameters(module, javaParameters); + assertEquals(asList("-DargLineApx=-DsomeKey=someValue", "-Xmx2048M", "-XX:MaxPermSize=512M", "-Dargs=can have spaces", "-DsomeKey=someValue"), + javaParameters.getVMParametersList().getList()); + } } From 1869ad4cb089e4efb7491c92103599aa280536e4 Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 23 Oct 2014 12:54:30 +0400 Subject: [PATCH 58/64] update from sources for community: skip android plugin if its sources aren't checked out --- build/update.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/build/update.xml b/build/update.xml index e06cfce3ee93..ae4871b2eb6b 100644 --- a/build/update.xml +++ b/build/update.xml @@ -31,6 +31,7 @@ + From 086d2083e8ecf39edb4cc10b1e6a5dd93f2c949d Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 23 Oct 2014 11:40:23 +0200 Subject: [PATCH 59/64] don't expose whole document text through subsequences in document change events (IDEA-131780) --- .../openapi/editor/impl/DocumentImpl.java | 15 +++++++++------ .../src/com/intellij/util/text/ImmutableText.java | 11 +++++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java index 918ebaa22425..34512a6fc714 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java @@ -493,7 +493,9 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { throwGuardedFragment(marker, offset, null, s.toString()); } - updateText(myText.insert(offset, ImmutableText.valueOf(s)), offset, null, s, false, LocalTimeCounter.currentTime()); + myText = myText.ensureChunked(); + ImmutableText newText = myText.insert(offset, ImmutableText.valueOf(s)); + updateText(newText, offset, null, newText.subtext(offset, offset + s.length()), false, LocalTimeCounter.currentTime()); trimToSize(); } @@ -511,14 +513,13 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { if (!isWritable()) throw new ReadOnlyModificationException(this); if (startOffset == endOffset) return; - CharSequence sToDelete = myText.subSequence(startOffset, endOffset); - RangeMarker marker = getRangeGuard(startOffset, endOffset); if (marker != null) { - throwGuardedFragment(marker, startOffset, sToDelete.toString(), null); + throwGuardedFragment(marker, startOffset, myText.subSequence(startOffset, endOffset).toString(), null); } - updateText(myText.delete(startOffset, endOffset), startOffset, sToDelete, null, false, LocalTimeCounter.currentTime()); + myText = myText.ensureChunked(); + updateText(myText.delete(startOffset, endOffset), startOffset, myText.subtext(startOffset, endOffset), null, false, LocalTimeCounter.currentTime()); } @Override @@ -582,7 +583,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } CharSequence changedPart = s.subSequence(newStartInString, newEndInString); - CharSequence sToDelete = myText.subSequence(startOffset, endOffset); + CharSequence sToDelete = myText.subtext(startOffset, endOffset); RangeMarker guard = getRangeGuard(startOffset, endOffset); if (guard != null) { throwGuardedFragment(guard, startOffset, sToDelete.toString(), changedPart.toString()); @@ -593,7 +594,9 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { newText = (ImmutableText)s; } else { + myText = myText.ensureChunked(); newText = myText.delete(startOffset, endOffset).insert(startOffset, changedPart); + changedPart = newText.subtext(startOffset, startOffset + changedPart.length()); } updateText(newText, startOffset, sToDelete, changedPart, wholeTextReplaced, newModificationStamp); trimToSize(); diff --git a/platform/util/src/com/intellij/util/text/ImmutableText.java b/platform/util/src/com/intellij/util/text/ImmutableText.java index 4ec4b93ec2b2..2dde3eb60293 100644 --- a/platform/util/src/com/intellij/util/text/ImmutableText.java +++ b/platform/util/src/com/intellij/util/text/ImmutableText.java @@ -96,7 +96,14 @@ public final class ImmutableText extends ImmutableCharSequence implements CharAr return new ImmutableText(new LeafNode(chars)); } - private ImmutableText ensureChunked() { + /** + * When first loaded, ImmutableText contents are stored as a single large array. This saves memory but isn't + * modification-friendly as it disallows slightly changed texts to retain most of the internal structure of the + * original document. Whoever retains old non-chunked version will use more memory than really needed. + * + * @return a copy of this text better prepared for small modifications to fully enable structure-sharing capabilities + */ + public ImmutableText ensureChunked() { if (length() > BLOCK_SIZE && myNode instanceof LeafNode) { return new ImmutableText(nodeOf(((LeafNode)myNode)._data, 0, length())); } @@ -292,7 +299,7 @@ public final class ImmutableText extends ImmutableCharSequence implements CharAr * @throws IndexOutOfBoundsException if (start < 0) || (end < 0) || * (start > end) || (end > this.length()) */ - private ImmutableText subtext(int start, int end) { + public ImmutableText subtext(int start, int end) { if ((start < 0) || (start > end) || (end > length())) throw new IndexOutOfBoundsException(); if ((start == 0) && (end == length())) From 8d49d9feab7e23d0a2c68fa915d36e72b22e8095 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Thu, 23 Oct 2014 11:54:31 +0200 Subject: [PATCH 60/64] fixt test --- RegExpSupport/testData/RETest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RegExpSupport/testData/RETest.xml b/RegExpSupport/testData/RETest.xml index 3aac79ea8de6..0a8d963a861b 100644 --- a/RegExpSupport/testData/RETest.xml +++ b/RegExpSupport/testData/RETest.xml @@ -719,7 +719,7 @@ ERR - \1)]]> + \1)]]> OK From 371db8c42b809963767158520d56d005bc55a506 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Thu, 23 Oct 2014 13:54:47 +0400 Subject: [PATCH 61/64] in resource bundle getBaseName counts of getUrl() calls and regexp matching reduced --- .../com/intellij/lang/properties/PropertiesUtil.java | 5 +++++ .../lang/properties/ResourceBundleManager.java | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java index 0867b6b5faa1..ac673f634791 100644 --- a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java +++ b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java @@ -80,6 +80,11 @@ public class PropertiesUtil { @NotNull public static String getDefaultBaseName(@NotNull final VirtualFile file) { final String name = file.getName(); + + if (!StringUtil.containsChar(name, '_')) { + return FileUtil.getNameWithoutExtension(name); + } + final Matcher matcher = LOCALE_PATTERN.matcher(name); final String baseNameWithExtension; if (matcher.find()) { diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java index a01c123f8763..2dba8899afe7 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java @@ -21,6 +21,7 @@ import com.intellij.openapi.components.*; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.NullableComputable; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.util.Function; @@ -151,6 +152,11 @@ public class ResourceBundleManager implements PersistentStateComponent Date: Thu, 23 Oct 2014 11:52:25 +0200 Subject: [PATCH 62/64] remove "..." from welcome screen --- .../wm/impl/welcomeScreen/FlatWelcomeFrame.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index 126e827b0af5..5a3800cff537 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -46,6 +46,7 @@ import com.intellij.ui.*; import com.intellij.ui.border.CustomLineBorder; import com.intellij.ui.components.labels.ActionLink; import com.intellij.ui.components.panels.NonOpaquePanel; +import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -326,7 +327,15 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { action.update(new AnActionEvent(null, DataManager.getInstance().getDataContext(this), ActionPlaces.WELCOME_SCREEN, presentation, ActionManager.getInstance(), 0)); if (presentation.isVisible()) { - ActionLink link = new ActionLink(presentation.getText(), presentation.getIcon(), action); + String text = presentation.getText(); + if (text.endsWith("...")) { + text = text.substring(0, text.length() - 3); + } + Icon icon = presentation.getIcon(); + if (icon.getIconHeight() != 16 || icon.getIconWidth() != 16) { + icon = EmptyIcon.ICON_16; + } + ActionLink link = new ActionLink(text, icon, action); link.setPaintUnderline(false); link.setNormalColor(getLinkNormalColor()); installFocusable(button, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, true); From 084c0a3e94a185e9966ae84317f2b774c0cf531b Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Thu, 23 Oct 2014 14:10:17 +0400 Subject: [PATCH 63/64] resource bundle manager reduced count of getUrl() call while listening psi changes --- .../properties/ResourceBundleManager.java | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java index 2dba8899afe7..9e2e8e477d64 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java @@ -20,7 +20,9 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.*; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.NotNullLazyValue; import com.intellij.openapi.util.NullableComputable; +import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; @@ -65,18 +67,31 @@ public class ResourceBundleManager implements PersistentStateComponent> oldAndNewUrls = new NotNullLazyValue>() { + @NotNull + @Override + protected Pair compute() { + final String newUrl = propertiesFile.getVirtualFile().getUrl(); + return Pair.create(oldParentUrl + newUrl.substring(newParentUrl.length()), newUrl); + } + }; + + if (!myState.getDissociatedFiles().isEmpty()) { + if (myState.getDissociatedFiles().remove(oldAndNewUrls.getValue().getFirst())) { + myState.getDissociatedFiles().add(oldAndNewUrls.getValue().getSecond()); } } + + if (!myState.getCustomResourceBundles().isEmpty()) { + for (CustomResourceBundleState customResourceBundleState : myState.getCustomResourceBundles()) { + if (customResourceBundleState.getFileUrls().remove(oldAndNewUrls.getValue().getFirst())) { + customResourceBundleState.getFileUrls().add(oldAndNewUrls.getValue().getSecond()); + break; + } + } + } + } @Nullable From 435754bba0bf4567758eed057e0476c443471327 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 23 Oct 2014 12:32:51 +0200 Subject: [PATCH 64/64] add arrow button to get from VCS --- .../impl/welcomeScreen/FlatWelcomeFrame.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index 5a3800cff537..d2a21a482e1a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -304,9 +304,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout()); panel.setBorder(new EmptyBorder(4, 10, 4, 10)); panel.add(settings.get()); - JLabel arrow = new JLabel(AllIcons.General.Combo3); - arrow.setVerticalAlignment(SwingConstants.BOTTOM); - panel.add(arrow, BorderLayout.EAST); + panel.add(createArrow(settings.get()), BorderLayout.EAST); installFocusable(panel, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, focusListOnLeft); return panel; } @@ -338,8 +336,11 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { ActionLink link = new ActionLink(text, icon, action); link.setPaintUnderline(false); link.setNormalColor(getLinkNormalColor()); - installFocusable(button, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, true); button.add(link); + if (action instanceof WelcomePopupAction) { + button.add(createArrow(link), BorderLayout.EAST); + } + installFocusable(button, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, true); actions.add(button); } } @@ -536,6 +537,22 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame { } } + private static JLabel createArrow(final ActionLink link) { + JLabel arrow = new JLabel(AllIcons.General.Combo3); + arrow.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + arrow.setVerticalAlignment(SwingConstants.BOTTOM); + new ClickListener() { + @Override + public boolean onClick(@NotNull MouseEvent e, int clickCount) { + final MouseEvent newEvent = new MouseEvent(link, e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getClickCount(), + e.isPopupTrigger(), e.getButton()); + link.doClick(newEvent); + return true; + } + }.installOn(arrow); + return arrow; + } + @Override public BalloonLayout getBalloonLayout() { return myBalloonLayout;