diff --git a/.idea/libraries/Ant.xml b/.idea/libraries/Ant.xml
index dfdd147fd7bc..4d69c6899db3 100644
--- a/.idea/libraries/Ant.xml
+++ b/.idea/libraries/Ant.xml
@@ -28,7 +28,6 @@
-
diff --git a/.idea/libraries/CGLIB.xml b/.idea/libraries/CGLIB.xml
index 061f6f213744..b7e692fa647e 100644
--- a/.idea/libraries/CGLIB.xml
+++ b/.idea/libraries/CGLIB.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/DTDParser.xml b/.idea/libraries/DTDParser.xml
index dcc82b44e627..c40d012406c8 100644
--- a/.idea/libraries/DTDParser.xml
+++ b/.idea/libraries/DTDParser.xml
@@ -3,7 +3,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/EasyMock.xml b/.idea/libraries/EasyMock.xml
index 05648438f07a..cc51a3eea9a6 100644
--- a/.idea/libraries/EasyMock.xml
+++ b/.idea/libraries/EasyMock.xml
@@ -4,7 +4,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Eclipse.xml b/.idea/libraries/Eclipse.xml
index 09b7e2c73bd4..7fa7c6724800 100644
--- a/.idea/libraries/Eclipse.xml
+++ b/.idea/libraries/Eclipse.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/Gant.xml b/.idea/libraries/Gant.xml
index ec46297abec3..ccd8bf04bef7 100644
--- a/.idea/libraries/Gant.xml
+++ b/.idea/libraries/Gant.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/Groovy.xml b/.idea/libraries/Groovy.xml
index 82c7bd9c0740..39ef164c7fa7 100644
--- a/.idea/libraries/Groovy.xml
+++ b/.idea/libraries/Groovy.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/JDOM.xml b/.idea/libraries/JDOM.xml
index 17d2e7336796..bce78cc5489e 100644
--- a/.idea/libraries/JDOM.xml
+++ b/.idea/libraries/JDOM.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/JMock1.xml b/.idea/libraries/JMock1.xml
index ca4dac06d5e2..28bec95a2700 100644
--- a/.idea/libraries/JMock1.xml
+++ b/.idea/libraries/JMock1.xml
@@ -4,7 +4,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/JUnit3.xml b/.idea/libraries/JUnit3.xml
index c8e5da0d1ec9..c1b662d9bfb0 100644
--- a/.idea/libraries/JUnit3.xml
+++ b/.idea/libraries/JUnit3.xml
@@ -3,7 +3,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/JUnit4.xml b/.idea/libraries/JUnit4.xml
index 6e7ba44fb1d0..3293fe32308b 100644
--- a/.idea/libraries/JUnit4.xml
+++ b/.idea/libraries/JUnit4.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/JavaHelp.xml b/.idea/libraries/JavaHelp.xml
index 458f03548750..a581fbd1d42b 100644
--- a/.idea/libraries/JavaHelp.xml
+++ b/.idea/libraries/JavaHelp.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/Jaxen.xml b/.idea/libraries/Jaxen.xml
index dd17c6df93a6..8c9fa7adb99c 100644
--- a/.idea/libraries/Jaxen.xml
+++ b/.idea/libraries/Jaxen.xml
@@ -3,7 +3,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Log4J.xml b/.idea/libraries/Log4J.xml
index 6e3948c15fc9..3179b1470772 100644
--- a/.idea/libraries/Log4J.xml
+++ b/.idea/libraries/Log4J.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/Mac.xml b/.idea/libraries/Mac.xml
index 256d4c9e54a9..a12291d435e5 100644
--- a/.idea/libraries/Mac.xml
+++ b/.idea/libraries/Mac.xml
@@ -4,7 +4,6 @@
-
diff --git a/.idea/libraries/Mocks.xml b/.idea/libraries/Mocks.xml
index 5a52b9d16391..e4bf218554bf 100644
--- a/.idea/libraries/Mocks.xml
+++ b/.idea/libraries/Mocks.xml
@@ -12,7 +12,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/NanoXML.xml b/.idea/libraries/NanoXML.xml
index b189c1aeccf4..0bb733ed7323 100644
--- a/.idea/libraries/NanoXML.xml
+++ b/.idea/libraries/NanoXML.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/OroMatcher.xml b/.idea/libraries/OroMatcher.xml
index 11cae893cfea..91713b2ea1e2 100644
--- a/.idea/libraries/OroMatcher.xml
+++ b/.idea/libraries/OroMatcher.xml
@@ -3,7 +3,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/TestNG.xml b/.idea/libraries/TestNG.xml
index 5ab2412b1a6e..a5778213fdef 100644
--- a/.idea/libraries/TestNG.xml
+++ b/.idea/libraries/TestNG.xml
@@ -3,7 +3,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Trove4j.xml b/.idea/libraries/Trove4j.xml
index ffb447bb506b..3f41197d62e8 100644
--- a/.idea/libraries/Trove4j.xml
+++ b/.idea/libraries/Trove4j.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/Velocity.xml b/.idea/libraries/Velocity.xml
index 6af932840678..3d7e67090faf 100644
--- a/.idea/libraries/Velocity.xml
+++ b/.idea/libraries/Velocity.xml
@@ -4,7 +4,6 @@
-
diff --git a/.idea/libraries/XStream.xml b/.idea/libraries/XStream.xml
index 1ae2bba6df3e..d910ea261e1e 100644
--- a/.idea/libraries/XStream.xml
+++ b/.idea/libraries/XStream.xml
@@ -3,7 +3,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Xerces.xml b/.idea/libraries/Xerces.xml
index 70f9b6a585a0..c5dbcdcf4e97 100644
--- a/.idea/libraries/Xerces.xml
+++ b/.idea/libraries/Xerces.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/XmlBeans.xml b/.idea/libraries/XmlBeans.xml
index 9ba2a85a0698..77058a249a98 100644
--- a/.idea/libraries/XmlBeans.xml
+++ b/.idea/libraries/XmlBeans.xml
@@ -5,7 +5,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/XmlRPC.xml b/.idea/libraries/XmlRPC.xml
index 4dc45f5b4c27..ac9c9a5dbc94 100644
--- a/.idea/libraries/XmlRPC.xml
+++ b/.idea/libraries/XmlRPC.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/asm.xml b/.idea/libraries/asm.xml
index 449c600c9d8d..183a1bb65b08 100644
--- a/.idea/libraries/asm.xml
+++ b/.idea/libraries/asm.xml
@@ -4,7 +4,6 @@
-
diff --git a/.idea/libraries/commons_codec.xml b/.idea/libraries/commons_codec.xml
index 3921ae1a3395..edbee5956ef0 100644
--- a/.idea/libraries/commons_codec.xml
+++ b/.idea/libraries/commons_codec.xml
@@ -3,7 +3,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/commons_collections.xml b/.idea/libraries/commons_collections.xml
index 489c3f067ebf..346eec1cf896 100644
--- a/.idea/libraries/commons_collections.xml
+++ b/.idea/libraries/commons_collections.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/commons_lang.xml b/.idea/libraries/commons_lang.xml
index ba16df792f70..735f56f94f1e 100644
--- a/.idea/libraries/commons_lang.xml
+++ b/.idea/libraries/commons_lang.xml
@@ -3,7 +3,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/commons_net.xml b/.idea/libraries/commons_net.xml
index 73d5abb5afc1..a67717822b3e 100644
--- a/.idea/libraries/commons_net.xml
+++ b/.idea/libraries/commons_net.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/jcip.xml b/.idea/libraries/jcip.xml
index 5109f151a699..1a6bfae9c4c1 100644
--- a/.idea/libraries/jcip.xml
+++ b/.idea/libraries/jcip.xml
@@ -3,7 +3,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/jgoodies_forms.xml b/.idea/libraries/jgoodies_forms.xml
index 0acd33f16bd7..6d2c19a1d4c8 100644
--- a/.idea/libraries/jgoodies_forms.xml
+++ b/.idea/libraries/jgoodies_forms.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/jna.xml b/.idea/libraries/jna.xml
index 8c0751775e1e..9fbb37eb48fc 100644
--- a/.idea/libraries/jna.xml
+++ b/.idea/libraries/jna.xml
@@ -4,7 +4,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/microba.xml b/.idea/libraries/microba.xml
index 893e0dcc7f2a..771a1df5a98f 100644
--- a/.idea/libraries/microba.xml
+++ b/.idea/libraries/microba.xml
@@ -4,7 +4,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/libraries/picocontainer.xml b/.idea/libraries/picocontainer.xml
index 0850ebb24085..e07ed90f94b5 100644
--- a/.idea/libraries/picocontainer.xml
+++ b/.idea/libraries/picocontainer.xml
@@ -3,7 +3,6 @@
-
diff --git a/.idea/libraries/tcServiceMessages.xml b/.idea/libraries/tcServiceMessages.xml
index e3cc93f1d751..2117ae66d481 100644
--- a/.idea/libraries/tcServiceMessages.xml
+++ b/.idea/libraries/tcServiceMessages.xml
@@ -3,7 +3,6 @@
-
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/StepSequence.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/StepSequence.java
index 26ab9a35bf03..87dd1330a927 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/StepSequence.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/StepSequence.java
@@ -23,6 +23,7 @@ package com.intellij.ide.util.newProjectWizard;
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
import com.intellij.openapi.module.ModuleType;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
@@ -41,7 +42,7 @@ public class StepSequence {
myParentSequence = stepSequence;
}
- public void addCommonStep(ModuleWizardStep step){
+ public void addCommonStep(@NotNull ModuleWizardStep step){
myCommonSteps.add(step);
}
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceFieldHandler.java b/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceFieldHandler.java
index 967b5054fd2d..69f89f7678b0 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceFieldHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceFieldHandler.java
@@ -65,9 +65,13 @@ public class IntroduceFieldHandler extends BaseExpressionToFieldHandler {
protected Settings showRefactoringDialog(Project project, Editor editor, PsiClass parentClass, PsiExpression expr,
PsiType type,
PsiExpression[] occurences, PsiElement anchorElement, PsiElement anchorElementIfAll) {
- final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(expr, PsiMethod.class);
- PsiElement element = expr.getUserData(ElementToWorkOn.PARENT);
- if (element == null) element = expr;
+ final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(expr != null ? expr : anchorElement, PsiMethod.class);
+ PsiElement element = null;
+ if (expr != null) {
+ element = expr.getUserData(ElementToWorkOn.PARENT);
+ if (element == null) element = expr;
+ }
+ if (element == null) element = anchorElement;
final PsiModifierListOwner staticParentElement = PsiUtil.getEnclosingStaticElement(element, parentClass);
boolean declareStatic = staticParentElement != null;
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersProcessor.java b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersProcessor.java
index 6ddce912fa95..bc6d43828c3b 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersProcessor.java
@@ -156,19 +156,21 @@ public class MoveMembersProcessor extends BaseRefactoringProcessor {
protected void performRefactoring(final UsageInfo[] usages) {
try {
// correct references to moved members from the outside
- LanguageExtension extension=new LanguageExtension("com.intellij.refactoring.moveMemberHandler");
PsiClass targetClass = JavaPsiFacade.getInstance(myProject)
.findClass(myOptions.getTargetClassName(), GlobalSearchScope.projectScope(myProject));
if (targetClass == null) return;
final Map anchors = new HashMap();
for (PsiMember member : myMembersToMove) {
- anchors.put(member, extension.forLanguage(member.getLanguage()).getAnchor(member, targetClass));
+ final MoveMemberHandler handler = MoveMemberHandler.EP_NAME.forLanguage(member.getLanguage());
+ if (handler != null) {
+ anchors.put(member, handler.getAnchor(member, targetClass));
+ }
}
ArrayList otherUsages = new ArrayList();
for (UsageInfo usageInfo : usages) {
MoveMembersUsageInfo usage = (MoveMembersUsageInfo)usageInfo;
if (!usage.reference.isValid()) continue;
- final MoveMemberHandler handler = extension.forLanguage(usageInfo.getElement().getLanguage());
+ final MoveMemberHandler handler = MoveMemberHandler.EP_NAME.forLanguage(usageInfo.getElement().getLanguage());
if (handler!=null) {
if (handler.changeExternalUsage(myOptions, usage)) continue;
}
@@ -189,13 +191,15 @@ public class MoveMembersProcessor extends BaseRefactoringProcessor {
}
}
final RefactoringElementListener elementListener = getTransaction().getElementListener(member);
- final MoveMemberHandler handler = extension.forLanguage(member.getLanguage());
- PsiMember newMember=handler.doMove(myOptions, member, anchors.get(member), targetClass);
- elementListener.elementMoved(newMember);
+ final MoveMemberHandler handler = MoveMemberHandler.EP_NAME.forLanguage(member.getLanguage());
+ if (handler != null) {
+ PsiMember newMember=handler.doMove(myOptions, member, anchors.get(member), targetClass);
+ elementListener.elementMoved(newMember);
- fixModifierList(newMember, usages);
- for (PsiReference reference : refsToBeRebind) {
- reference.bindToElement(newMember);
+ fixModifierList(newMember, usages);
+ for (PsiReference reference : refsToBeRebind) {
+ reference.bindToElement(newMember);
+ }
}
}
diff --git a/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java b/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java
index d2ebffc8bfbd..b475e65c66c4 100644
--- a/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java
+++ b/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java
@@ -29,9 +29,9 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.TableUtil;
import com.intellij.ui.UIBundle;
+import com.intellij.ui.table.JBTable;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.ItemRemovable;
-import com.intellij.util.ui.Table;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -66,7 +66,7 @@ public class ClassFilterEditor extends JPanel {
myAddClassButton = new JButton(getAddButtonText());
myAddPatternButton = new JButton(getAddPatternButtonText());
myRemoveButton = new JButton(UIBundle.message("button.remove"));
- myTable = new Table();
+ myTable = new JBTable();
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable);
add(scrollPane, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 3, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 6), 0, 0));
@@ -347,4 +347,8 @@ public class ClassFilterEditor extends JPanel {
TableUtil.removeSelectedItems(myTable);
}
}
+
+ public void setAddPatternButtonVisible(boolean visible) {
+ myAddPatternButton.setVisible(visible);
+ }
}
diff --git a/platform/lang-api/src/com/intellij/lang/refactoring/InlineActionHandler.java b/platform/lang-api/src/com/intellij/lang/refactoring/InlineActionHandler.java
index 950d9660c986..bc9ddaf7a954 100644
--- a/platform/lang-api/src/com/intellij/lang/refactoring/InlineActionHandler.java
+++ b/platform/lang-api/src/com/intellij/lang/refactoring/InlineActionHandler.java
@@ -38,6 +38,10 @@ public abstract class InlineActionHandler {
return canInlineElement(element);
}
+ public boolean isEnabledOnElement(PsiElement element, Editor editor) {
+ return isEnabledOnElement(element);
+ }
+
public abstract boolean isEnabledForLanguage(Language l);
public abstract boolean canInlineElement(PsiElement element);
diff --git a/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java b/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
index 34509ab6cb43..02577d3b0d7b 100644
--- a/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
+++ b/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
@@ -431,6 +431,14 @@ public class PsiUtilBase {
return narrowLanguage(lang, file.getLanguage());
}
+ @Nullable
+ public static PsiElement getElementAtCaret(Editor editor) {
+ Project project = editor.getProject();
+ if (project == null) return null;
+ PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
+ return file == null ? null : file.findElementAt(editor.getCaretModel().getOffset());
+ }
+
public static Language getDialect(@NotNull PsiElement element) {
return narrowLanguage(element.getLanguage(), element.getContainingFile().getLanguage());
}
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
index 5980a99f166a..6d80319c7077 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
@@ -572,7 +572,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
if (myTree == null) return null;
TreePath[] paths = myTree.getSelectionPaths();
- if (paths == null) return null;
+ if (paths == null || paths.length == 0) return null;
if (paths.length > 1) {
if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java
index b0dc4e89699c..139614aae1c7 100644
--- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java
+++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java
@@ -555,6 +555,10 @@ public class NavBarPanel extends OpaquePanel.List implements DataProvider, Popup
}
});
+ if (!isValid()) {
+ validate();
+ }
+
myNodePopup.showUnderneathOf(item);
}
}
diff --git a/platform/lang-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java b/platform/lang-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java
index fd614033652e..7a55ed3f5969 100644
--- a/platform/lang-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java
+++ b/platform/lang-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java
@@ -569,15 +569,7 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
@SuppressWarnings({"SuspiciousMethodCalls"})
public void doneBefore(Marker marker, Marker before) {
-// TODO: there could be not done markers after 'marker' and that's normal
- if (((StartMarker)marker).myDoneMarker != null) {
- LOG.error("Marker already done.");
- }
-
- int idx = myProduction.lastIndexOf(marker);
- if (idx < 0) {
- LOG.error("Marker never been added.");
- }
+ doValidityChecks(marker, before);
int beforeIndex = myProduction.lastIndexOf(before);
@@ -599,7 +591,7 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
}
public void error(Marker marker, String message) {
- doValidityChecks(marker);
+ doValidityChecks(marker, null);
DoneWithErrorMarker doneMarker = new DoneWithErrorMarker((StartMarker)marker, myCurrentLexeme, message);
((StartMarker)marker).myDoneMarker = doneMarker;
@@ -608,27 +600,18 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
@SuppressWarnings({"SuspiciousMethodCalls"})
public void errorBefore(Marker marker, String message, Marker before) {
-// TODO: there could be not done markers after 'marker' and that's normal
- if (((StartMarker)marker).myDoneMarker != null) {
- LOG.error("Marker already done.");
- }
-
- int idx = myProduction.lastIndexOf(marker);
- if (idx < 0) {
- LOG.error("Marker has never been added.");
- }
+ doValidityChecks(marker, before);
int beforeIndex = myProduction.lastIndexOf(before);
DoneWithErrorMarker doneMarker = new DoneWithErrorMarker((StartMarker)marker, myCurrentLexeme, message);
doneMarker.myLexemeIndex = ((StartMarker)before).myLexemeIndex;
-
((StartMarker)marker).myDoneMarker = doneMarker;
myProduction.add(beforeIndex, doneMarker);
}
public void done(final Marker marker) {
- doValidityChecks(marker);
+ doValidityChecks(marker, null);
DoneMarker doneMarker = DONE_MARKERS.alloc();
doneMarker.myStart = (StartMarker)marker;
@@ -644,30 +627,41 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
}
@SuppressWarnings({"UseOfSystemOutOrSystemErr", "SuspiciousMethodCalls"})
- private void doValidityChecks(final Marker marker) {
- if (myDebugMode) {
- final DoneMarker doneMarker = ((StartMarker)marker).myDoneMarker;
- if (doneMarker != null) {
- LOG.error("Marker already done.");
- }
- int idx = myProduction.lastIndexOf(marker);
- if (idx < 0) {
- LOG.error("Marker never been added.");
- }
+ private void doValidityChecks(final Marker marker, @Nullable final Marker before) {
+ if (!myDebugMode) return;
- for (int i = myProduction.size() - 1; i > idx; i--) {
- Object item = myProduction.get(i);
- if (item instanceof StartMarker) {
- StartMarker otherMarker = (StartMarker)item;
- if (otherMarker.myDoneMarker == null) {
- final Throwable debugAllocOther = otherMarker.myDebugAllocationPosition;
- final Throwable debugAllocThis = ((StartMarker)marker).myDebugAllocationPosition;
- if (debugAllocOther != null) {
- debugAllocThis.printStackTrace(System.err);
- debugAllocOther.printStackTrace(System.err);
- }
- LOG.error("Another not done marker added after this one. Must be done before this.");
+ final DoneMarker doneMarker = ((StartMarker)marker).myDoneMarker;
+ if (doneMarker != null) {
+ LOG.error("Marker already done.");
+ }
+ int idx = myProduction.lastIndexOf(marker);
+ if (idx < 0) {
+ LOG.error("Marker has never been added.");
+ }
+
+ int endIdx = myProduction.size();
+ if (before != null) {
+ endIdx = myProduction.lastIndexOf(before);
+ if (endIdx < 0) {
+ LOG.error("'Before' marker has never been added.");
+ }
+ if (idx > endIdx) {
+ LOG.error("'Before' marker precedes this one.");
+ }
+ }
+
+ for (int i = endIdx - 1; i > idx; i--) {
+ Object item = myProduction.get(i);
+ if (item instanceof StartMarker) {
+ StartMarker otherMarker = (StartMarker)item;
+ if (otherMarker.myDoneMarker == null) {
+ final Throwable debugAllocOther = otherMarker.myDebugAllocationPosition;
+ final Throwable debugAllocThis = ((StartMarker)marker).myDebugAllocationPosition;
+ if (debugAllocOther != null) {
+ debugAllocThis.printStackTrace(System.err);
+ debugAllocOther.printStackTrace(System.err);
}
+ LOG.error("Another not done marker added after this one. Must be done before this.");
}
}
}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java b/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java
index fea3861e633b..997c4578e2f4 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java
@@ -17,6 +17,7 @@
package com.intellij.psi.impl.include;
import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.containers.FactoryMap;
@@ -68,14 +69,14 @@ public class FileIncludeIndex extends FileBasedIndexExtension, FileContent> getIndexer() {
- return new DataIndexer, FileContent>() {
+ public DataIndexer, FileContent> getIndexer() {
+ return new DataIndexer, FileContent>() {
@NotNull
- public Map> map(FileContent inputData) {
+ public Map> map(FileContent inputData) {
- Map> map = new FactoryMap>() {
+ Map> map = new FactoryMap>() {
@Override
- protected List create(FileIncludeIndex.Key key) {
+ protected List create(Key key) {
return new ArrayList();
}
};
@@ -144,6 +145,9 @@ public class FileIncludeIndex extends FileBasedIndexExtension result = new HashSet();
+ LinkedHashSet result = new LinkedHashSet();
final NameSuggestionProvider[] providers = Extensions.getExtensions(NameSuggestionProvider.EP_NAME);
for(NameSuggestionProvider provider: providers) {
SuggestedNameInfo info = provider.getSuggestedNames(myPsiElement, myNameSuggestionContext, result);
diff --git a/platform/lang-impl/src/com/intellij/ui/DeferredIconImpl.java b/platform/lang-impl/src/com/intellij/ui/DeferredIconImpl.java
index 7dbc4a248c92..11c207c33154 100644
--- a/platform/lang-impl/src/com/intellij/ui/DeferredIconImpl.java
+++ b/platform/lang-impl/src/com/intellij/ui/DeferredIconImpl.java
@@ -23,6 +23,7 @@ import com.intellij.concurrency.Job;
import com.intellij.concurrency.JobUtil;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.IndexNotReadyException;
+import com.intellij.openapi.util.Ref;
import com.intellij.util.Alarm;
import com.intellij.util.Function;
import com.intellij.util.ui.EmptyIcon;
@@ -66,29 +67,37 @@ public class DeferredIconImpl implements DeferredIcon {
if (!myIsScheduled) {
myIsScheduled = true;
- final Component target;
+ final Ref target = new Ref(null);
+ final Ref paintingParent = new Ref(null);
+ final Ref paintingParentRec = new Ref(null);
final Container list = SwingUtilities.getAncestorOfClass(JList.class, c);
if (list != null) {
- target = list;
+ target.set(list);
}
else {
final Container tree = SwingUtilities.getAncestorOfClass(JTree.class, c);
if (tree != null) {
- target = tree;
+ target.set(tree);
}
else {
final Container table = SwingUtilities.getAncestorOfClass(JTable.class, c);
if (table != null) {
- target = table;
+ target.set(table);
}
else {
- target = c;
+ target.set(c);
}
}
}
- myLastTarget = new WeakReference(target);
+ Container pp = SwingUtilities.getAncestorOfClass(PaintingParent.class, c);
+ paintingParent.set(pp);
+ if (paintingParent.get() != null) {
+ paintingParentRec.set(((PaintingParent)pp).getChildRec(c));
+ }
+
+ myLastTarget = new WeakReference(target.get());
JobUtil.submitToJobThread(new Runnable() {
public void run() {
@@ -100,10 +109,23 @@ public class DeferredIconImpl implements DeferredIcon {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
public void run() {
+ Component actualTarget = target.get();
+ if (SwingUtilities.getWindowAncestor(actualTarget) == null) {
+ actualTarget = paintingParent.get();
+ if (actualTarget == null || SwingUtilities.getWindowAncestor(actualTarget) == null) {
+ actualTarget = null;
+ myLastTarget = null;
+ }
+ }
+
+ if (actualTarget == null) return;
+
+ myLastTarget = new WeakReference(actualTarget);
+
if (shouldRevalidate) {
// revalidate will not work: jtree caches size of nodes
- if (target instanceof JTree) {
- final TreeUI ui = ((JTree)target).getUI();
+ if (actualTarget instanceof JTree) {
+ final TreeUI ui = ((JTree)actualTarget).getUI();
if (ui instanceof BasicTreeUI) {
// this call is "fake" and only need to reset tree layout cache
((BasicTreeUI)ui).setLeftChildIndent(((Integer)UIManager.get("Tree.leftChildIndent")).intValue());
@@ -111,11 +133,16 @@ public class DeferredIconImpl implements DeferredIcon {
}
}
- if (c == target) {
+ if (c == actualTarget) {
c.repaint(x, y, getIconWidth(), getIconHeight());
}
else {
- ourRepaintScheduler.pushDirtyComponent(target);
+ Rectangle rec = null;
+ if (paintingParentRec.get() != null) {
+ rec = paintingParentRec.get();
+ }
+
+ ourRepaintScheduler.pushDirtyComponent(actualTarget, rec);
}
}
});
@@ -191,20 +218,44 @@ public class DeferredIconImpl implements DeferredIcon {
private static class RepaintScheduler {
private final Alarm myAlarm = new Alarm();
- private final Set myQueue = new LinkedHashSet();
+ private final Set myQueue = new LinkedHashSet();
- public void pushDirtyComponent(Component c) {
+ public void pushDirtyComponent(final Component c, final Rectangle rec) {
myAlarm.cancelAllRequests();
myAlarm.addRequest(new Runnable() {
public void run() {
- for (Component component : myQueue) {
- component.repaint();
+ for (RepaintRequest each : myQueue) {
+ Rectangle r = each.getRectangle();
+ if (r != null) {
+ each.getComponent().repaint(r.x, r.y, r.width, r.height);
+ } else {
+ each.getComponent().repaint();
+ }
}
myQueue.clear();
}
}, 50);
- myQueue.add(c);
+ myQueue.add(new RepaintRequest(c, rec));
}
}
+
+ private static class RepaintRequest {
+ private Component myComponent;
+ private Rectangle myRectangle;
+
+ private RepaintRequest(Component component, Rectangle rectangle) {
+ myComponent = component;
+ myRectangle = rectangle;
+ }
+
+ public Component getComponent() {
+ return myComponent;
+ }
+
+ public Rectangle getRectangle() {
+ return myRectangle;
+ }
+ }
+
}
diff --git a/platform/lang-impl/testSrc/com/intellij/lang/LightPsiBuilderTest.java b/platform/lang-impl/testSrc/com/intellij/lang/LightPsiBuilderTest.java
index 83ee93a92f03..111228759fff 100644
--- a/platform/lang-impl/testSrc/com/intellij/lang/LightPsiBuilderTest.java
+++ b/platform/lang-impl/testSrc/com/intellij/lang/LightPsiBuilderTest.java
@@ -20,9 +20,13 @@ import com.intellij.lexer.LexerBase;
import com.intellij.psi.impl.DebugUtil;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
+import com.sun.tools.internal.xjc.util.NullStream;
import org.junit.Test;
+import java.io.PrintStream;
+
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
public class LightPsiBuilderTest {
@@ -140,6 +144,45 @@ public class LightPsiBuilderTest {
" PsiElement(DIGIT)('1')\n");
}
+ @Test
+ public void testValidityChecksOnDone() throws Exception {
+ doFailTest("a",
+ new Parser() {
+ public void parse(PsiBuilder builder) {
+ final PsiBuilder.Marker first = builder.mark();
+ builder.advanceLexer();
+ builder.mark();
+ first.done(LETTER);
+ }
+ });
+ }
+
+ @Test
+ public void testValidityChecksOnDoneBefore1() throws Exception {
+ doFailTest("a",
+ new Parser() {
+ public void parse(PsiBuilder builder) {
+ final PsiBuilder.Marker first = builder.mark();
+ builder.advanceLexer();
+ final PsiBuilder.Marker second = builder.mark();
+ second.precede();
+ first.doneBefore(LETTER, second);
+ }
+ });
+ }
+
+ @Test
+ public void testValidityChecksOnDoneBefore2() throws Exception {
+ doFailTest("a",
+ new Parser() {
+ public void parse(PsiBuilder builder) {
+ final PsiBuilder.Marker first = builder.mark();
+ builder.advanceLexer();
+ final PsiBuilder.Marker second = builder.mark();
+ second.doneBefore(LETTER, first);
+ }
+ });
+ }
private interface Parser {
void parse(PsiBuilder builder);
@@ -154,6 +197,27 @@ public class LightPsiBuilderTest {
assertEquals(expected, DebugUtil.nodeTreeToString(root, true));
}
+ private static void doFailTest(final String text, final Parser parser) {
+ final PrintStream std = System.err;
+ //noinspection IOResourceOpenedButNotSafelyClosed
+ System.setErr(new PrintStream(new NullStream()));
+ try {
+ try {
+ final PsiBuilder builder = new PsiBuilderImpl(new MyTestLexer(), TokenSet.EMPTY, TokenSet.EMPTY, text);
+ builder.setDebugMode(true);
+ parser.parse(builder);
+ fail("should fail");
+ }
+ catch (AssertionError e) {
+ //System.out.println("caught: " + e);
+ if ("should fail".equals(e.getMessage())) throw e;
+ }
+ }
+ finally {
+ System.setErr(std);
+ }
+ }
+
private static class MyTestLexer extends LexerBase {
private CharSequence myBuffer = "";
private int myIndex = 0;
diff --git a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java
index 0c6efad5db99..e9c6eab32b81 100644
--- a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java
+++ b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java
@@ -25,6 +25,7 @@ import com.intellij.openapi.ui.Messages;
import com.intellij.ui.CommandButtonGroup;
import com.intellij.ui.components.panels.OpaquePanel;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -221,7 +222,7 @@ public abstract class AbstractWizard extends DialogWrapper {
return mySteps.get(myCurrentStep);
}
- public void addStep(final T step) {
+ public void addStep(@NotNull final T step) {
mySteps.add(step);
if (step instanceof StepAdapter) {
diff --git a/platform/platform-api/src/com/intellij/ui/PaintingParent.java b/platform/platform-api/src/com/intellij/ui/PaintingParent.java
new file mode 100644
index 000000000000..a49f1235e11f
--- /dev/null
+++ b/platform/platform-api/src/com/intellij/ui/PaintingParent.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.ui;
+
+import org.jetbrains.annotations.Nullable;
+
+import java.awt.*;
+
+/**
+ * Used for deferred re-painting (i.e. for deferred icons). As a paint() method is invoked through the normal AWT painting cycle, deferred painting
+ * of children may be queued. It means that actual data used for painting is pushed for calculation and, as it gets ready, there is need for repaint.
+ * The target component for further repaint() is either the component that was originally exposed to painting or, if it's no longer showing (in case of a flyweight
+ * renderer) -- the first component up in the hierarchy that implements PaintingParent.
+ *
+ */
+public interface PaintingParent {
+
+ /**
+ * Returns rectangle of a child component for further repainting
+ * @param c
+ * @return a rectange, if null -- the whole component will be repainted
+ */
+ @Nullable
+ Rectangle getChildRec(Component c);
+
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java
index a23ab8fb9e91..2a54b574ba1b 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java
@@ -440,7 +440,7 @@ public class WelcomeScreen {
final boolean e2 = ((IdeaPluginDescriptorImpl)o2).isEnabled();
if (e1 && !e2) return -1;
if (!e1 && e2) return 1;
- return o1.getName().compareTo(o2.getName());
+ return o1.getName().toLowerCase().compareTo(o2.getName().toLowerCase());
}
};
Collections.sort(installedPlugins, pluginsComparator);
diff --git a/platform/platform-resources-en/src/messages/RefactoringBundle.properties b/platform/platform-resources-en/src/messages/RefactoringBundle.properties
index 69c2d469036d..031d2b333c23 100644
--- a/platform/platform-resources-en/src/messages/RefactoringBundle.properties
+++ b/platform/platform-resources-en/src/messages/RefactoringBundle.properties
@@ -452,11 +452,10 @@ instances.upcasted.to.object=Instances upcasted to Object
instances.upcasted.to.java.lang.object.found=Instances upcasted to java.lang.Object found
replace.inheritance.with.delegation.command=Replacing inheritance with delegation in {0}
replace.inheritance.with.delegation.elements.header=Replace inheritance with delegation
+# Inline included file
inline.included.file.title=Inline included file
-the.caret.should.be.positioned.on.the.include.directive.to.inline=The caret should be positioned on the include directive to inline
-cannot.determine.the.structure.of.included.file=Cannot determine the structure of included file.
-included.file.uses.another.syntax=Included file uses another syntax.
-cannot.resolve.included.file=Cannot resolve included file
+the.caret.should.be.positioned.on.the.included.file.to.inline=The caret should be positioned on the included file reference to inline
+
inline.the.contents.include.prompt=Inline the contents of ''{0}''?
remove.include.prompt=Included file is no longer used. Remove it?
delete.include.command=Delete {0}
diff --git a/platform/usageView/src/com/intellij/usages/TextChunk.java b/platform/usageView/src/com/intellij/usages/TextChunk.java
index 3888ddae0f8b..bc2cabcef047 100644
--- a/platform/usageView/src/com/intellij/usages/TextChunk.java
+++ b/platform/usageView/src/com/intellij/usages/TextChunk.java
@@ -23,7 +23,7 @@ public class TextChunk {
private final AttributesFlyweight myAttributes;
private final String myText;
- public TextChunk(TextAttributes attributesKey, @NotNull String text) {
+ public TextChunk(@NotNull TextAttributes attributesKey, @NotNull String text) {
myAttributes = attributesKey.getFlyweight();
myText = text;
}
diff --git a/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java b/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java
index 7d10f844cf4b..d7bc0a6acb7a 100644
--- a/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java
+++ b/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java
@@ -24,6 +24,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.RangeMarker;
+import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
@@ -91,7 +92,7 @@ public class UsageInfo2UsageAdapter implements UsageInModule, UsageInLibrary, Us
initChunks();
} else { // element over light virtual file
myTextChunks = new TextChunk[] {
- new TextChunk(null, element.getText())
+ new TextChunk(new TextAttributes(), element.getText())
};
myOffset = element.getTextOffset();
}
diff --git a/plugins/groovy/resources/intentionDescriptions/ConvertJavaStyleArrayCreationIntention/after.groovy.template b/plugins/groovy/resources/intentionDescriptions/ConvertJavaStyleArrayCreationIntention/after.groovy.template
new file mode 100644
index 000000000000..221308e2c833
--- /dev/null
+++ b/plugins/groovy/resources/intentionDescriptions/ConvertJavaStyleArrayCreationIntention/after.groovy.template
@@ -0,0 +1 @@
+def objects = [foo, bar]
\ No newline at end of file
diff --git a/plugins/groovy/resources/intentionDescriptions/ConvertJavaStyleArrayCreationIntention/before.groovy.template b/plugins/groovy/resources/intentionDescriptions/ConvertJavaStyleArrayCreationIntention/before.groovy.template
new file mode 100644
index 000000000000..9944d004075f
--- /dev/null
+++ b/plugins/groovy/resources/intentionDescriptions/ConvertJavaStyleArrayCreationIntention/before.groovy.template
@@ -0,0 +1 @@
+def objects = new Object[] {foo, bar}
diff --git a/plugins/groovy/resources/intentionDescriptions/ConvertJavaStyleArrayCreationIntention/description.html b/plugins/groovy/resources/intentionDescriptions/ConvertJavaStyleArrayCreationIntention/description.html
new file mode 100644
index 000000000000..a57eb1cb3c81
--- /dev/null
+++ b/plugins/groovy/resources/intentionDescriptions/ConvertJavaStyleArrayCreationIntention/description.html
@@ -0,0 +1,7 @@
+
+
+
+This intention converts java-style array creation to groovy syntax.
+
+
+
diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
index 0418c136e6bf..1eedae80b8bd 100644
--- a/plugins/groovy/src/META-INF/plugin.xml
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -375,6 +375,11 @@
-->
+
+ org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle
+ intention.category.groovy/intention.category.conversions
+ org.jetbrains.plugins.groovy.intentions.conversions.ConvertJavaStyleArrayCreationIntention
+
org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle
intention.category.groovy/intention.category.conversions
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
index e9429f30b52e..ef9bbbb5c317 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
@@ -283,6 +283,7 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
if (body != null) checkDuplicateMethod(body.getGroovyMethods(), myHolder);
checkImplementedMethodsOfClass(myHolder, typeDefinition);
checkConstructors(myHolder, typeDefinition);
+ highligtClassReference(myHolder, typeDefinition.getNameIdentifierGroovy());
}
private static void checkConstructors(AnnotationHolder holder, GrTypeDefinition typeDefinition) {
@@ -1296,6 +1297,9 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
if (member instanceof PsiMethod) {
annotation.setTextAttributes(!isStatic ? DefaultHighlighter.METHOD_CALL : DefaultHighlighter.STATIC_METHOD_ACCESS);
}
+ if (member instanceof PsiClass) {
+ highligtClassReference(holder, refExpr);
+ }
}
@@ -1536,16 +1540,24 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
private static void highlightAnnotation(AnnotationHolder holder, PsiElement refElement, GroovyResolveResult result) {
PsiElement element = result.getElement();
PsiElement parent = refElement.getParent();
- if (element instanceof PsiClass && ((PsiClass)element).isAnnotationType() && !(parent instanceof GrImportStatement)) {
- Annotation annotation = holder.createInfoAnnotation(parent, null);
- annotation.setTextAttributes(DefaultHighlighter.ANNOTATION);
- GroovyPsiElement context = result.getCurrentFileResolveContext();
- if (context instanceof GrImportStatement) {
- annotation = holder.createInfoAnnotation(((GrImportStatement)context).getImportReference(), null);
+ if (element instanceof PsiClass) {
+ if (((PsiClass)element).isAnnotationType() && !(parent instanceof GrImportStatement)) {
+ Annotation annotation = holder.createInfoAnnotation(parent, null);
annotation.setTextAttributes(DefaultHighlighter.ANNOTATION);
+ GroovyPsiElement context = result.getCurrentFileResolveContext();
+ if (context instanceof GrImportStatement) {
+ annotation = holder.createInfoAnnotation(((GrImportStatement)context).getImportReference(), null);
+ annotation.setTextAttributes(DefaultHighlighter.ANNOTATION);
+ }
+ } else {
+ highligtClassReference(holder, refElement);
}
}
+ }
+ private static void highligtClassReference(AnnotationHolder holder, PsiElement classReference) {
+ final Annotation annotation = holder.createInfoAnnotation(classReference, null);
+ annotation.setTextAttributes(DefaultHighlighter.CLASS_REFERENCE);
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/DefaultHighlighter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/DefaultHighlighter.java
index a924b235f92a..a3b5dd8321e9 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/DefaultHighlighter.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/DefaultHighlighter.java
@@ -70,6 +70,8 @@ public class DefaultHighlighter {
static final String METHOD_CALL_ID = "Method call";
@NonNls
static final String STATIC_METHOD_ACCESS_ID = "Static method access";
+ @NonNls
+ static final String CLASS_REFERENCE_ID = "Class";
@NonNls
@@ -103,6 +105,9 @@ public class DefaultHighlighter {
public static TextAttributesKey DOC_COMMENT_TAG = TextAttributesKey.createTextAttributesKey(DOC_COMMENT_TAG_ID,
SyntaxHighlighterColors.DOC_COMMENT_TAG.getDefaultAttributes());
+ public static TextAttributesKey CLASS_REFERENCE =
+ TextAttributesKey.createTextAttributesKey(CLASS_REFERENCE_ID, HighlighterColors.TEXT.getDefaultAttributes().clone());
+
public static final TextAttributes KEYWORD_ATTRIBUTES = SyntaxHighlighterColors.KEYWORD.getDefaultAttributes().clone();
static{
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/GroovyColorsAndFontsPage.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/GroovyColorsAndFontsPage.java
index d19624f62087..e9bab50b59a5 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/GroovyColorsAndFontsPage.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/GroovyColorsAndFontsPage.java
@@ -67,7 +67,7 @@ public class GroovyColorsAndFontsPage implements ColorSettingsPage {
new AttributesDescriptor(DefaultHighlighter.ANNOTATION_ID, DefaultHighlighter.ANNOTATION),
new AttributesDescriptor(DefaultHighlighter.STATIC_FIELD_ID, DefaultHighlighter.STATIC_FIELD),
new AttributesDescriptor(DefaultHighlighter.STATIC_FIELD_ID, DefaultHighlighter.INSTANCE_FIELD),
- new AttributesDescriptor(DefaultHighlighter.STATIC_METHOD_ACCESS_ID, DefaultHighlighter.STATIC_METHOD_ACCESS),
+ new AttributesDescriptor(DefaultHighlighter.CLASS_REFERENCE_ID, DefaultHighlighter.CLASS_REFERENCE),
};
@NotNull
@@ -83,23 +83,23 @@ public class GroovyColorsAndFontsPage implements ColorSettingsPage {
@NonNls
@NotNull
public String getDemoText() {
- return "import javax.swing.JPanel\n" +
+ return "import javax.swing.JPanel\n" +
" ### \n" +
"/**\n" +
" * This is Groovydoc comment\n" +
- " * @see java.lang.String#equals\n" +
+ " * @see java.lang.String#equals\n" +
" */\n" +
"@SpecialBean \n" +
- "class Demo {\n" +
+ "class Demo {\n" +
" def property\n" +
"//This is a line comment\n" +
"/* This is a block comment */\n" +
" static def foo(int i) { return [i, i, property] }\n" +
- " static def panel = new JPanel()\n" +
+ " static def panel = new JPanel()\n" +
"}\n" +
"\n" +
- "Demo.panel.size = " +
- "Demo.foo(\"123${456}789\".toInteger()) \n" +
+ "Demo.panel.size = " +
+ "Demo.foo(\"123${456}789\".toInteger()) \n" +
"'JetBrains'.matches(/Jw+Bw+/) \n" +
"def x=1 + unresolved"
;
@@ -115,6 +115,7 @@ public class GroovyColorsAndFontsPage implements ColorSettingsPage {
map.put("gdoc", DefaultHighlighter.DOC_COMMENT_CONTENT);
map.put("doctag", DefaultHighlighter.DOC_COMMENT_TAG);
map.put("unresolved", DefaultHighlighter.UNRESOLVED_ACCESS);
+ map.put("classref", DefaultHighlighter.CLASS_REFERENCE);
return map;
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/GroovyIntentionsBundle.properties b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/GroovyIntentionsBundle.properties
index 113f31b0d971..beb7dffac824 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/GroovyIntentionsBundle.properties
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/GroovyIntentionsBundle.properties
@@ -82,4 +82,7 @@ do.not.create.first.new=Use &existing first parameter as map for named arguments
convert.cannot.itself=Refactoring is not available for map parameter itself
perform.refactoring=Performing refactoring
map.param.name=Map parameter &name:
-convert.param.to.map.entry=Convert parameter to map entry
\ No newline at end of file
+convert.param.to.map.entry=Convert parameter to map entry
+
+convert.java.style.array.creation.intention.name=Convert java-style array creation
+convert.java.style.array.creation.intention.family.name=Convert Java-Style Array Creation to Groovy Syntax
\ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertJavaStyleArrayCreationIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertJavaStyleArrayCreationIntention.java
new file mode 100644
index 000000000000..a2c6052d879e
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertJavaStyleArrayCreationIntention.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.intentions.conversions;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.intentions.base.Intention;
+import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrNewExpression;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression;
+
+/**
+ * @author Maxim.Medvedev
+ */
+public class ConvertJavaStyleArrayCreationIntention extends Intention {
+ @Override
+ protected void processIntention(@NotNull PsiElement element) throws IncorrectOperationException {
+ final GrClosableBlock block = ((GrMethodCallExpression)element).getClosureArguments()[0];
+ final String text = block.getText();
+ int start = block.getLBrace().getStartOffsetInParent() + 1;
+ int finish = block.getRBrace().getStartOffsetInParent();
+ String newText = "[" + text.substring(start, finish) + "]";
+ final GrExpression newExpr = GroovyPsiElementFactory.getInstance(element.getProject()).createExpressionFromText(newText);
+ ((GrMethodCallExpression)element).replaceWithStatement(newExpr);
+ }
+
+ @NotNull
+ @Override
+ protected PsiElementPredicate getElementPredicate() {
+ return new PsiElementPredicate() {
+ @Override
+ public boolean satisfiedBy(PsiElement element) {
+ if (!(element instanceof GrMethodCallExpression)) return false;
+ final GrExpression expression = ((GrMethodCallExpression)element).getInvokedExpression();
+ if (!(expression instanceof GrNewExpression)) return false;
+ if (((GrNewExpression)expression).getArrayCount() == 0) return false;
+
+ if (((GrMethodCallExpression)element).getArgumentList().getText().trim().length() > 0) return false;
+
+ final GrClosableBlock[] closureArguments = ((GrMethodCallExpression)element).getClosureArguments();
+ if (closureArguments.length != 1) return false;
+ final GrClosableBlock block = closureArguments[0];
+ if (block.getLBrace() == null || block.getRBrace() == null) return false;
+ return true;
+ }
+ };
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/ConvertParameterToMapEntryIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/ConvertParameterToMapEntryIntention.java
index 3ce5f8148c7d..494bdb90eb55 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/ConvertParameterToMapEntryIntention.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/ConvertParameterToMapEntryIntention.java
@@ -185,42 +185,53 @@ public class ConvertParameterToMapEntryIntention extends Intention {
//final List calls = getCallOccurrences(occurrences);
try {
for (PsiElement occurrence : occurrences) {
- if (occurrence instanceof GrReferenceExpression && occurrence.getParent() instanceof GrCall) {
- final GrReferenceExpression refExpr = (GrReferenceExpression)occurrence;
- final GrClosureSignature signature = generateSignature(owner, refExpr);
- if (signature == null) continue;
- final GrCall call = (GrCall)refExpr.getParent();
- final GrArgumentList argumentList = call.getArgumentList();
- final GrClosableBlock[] closureArguments =
- call instanceof GrCallExpression ? ((GrCallExpression)call).getClosureArguments() : GrClosableBlock.EMPTY_ARRAY;
-
- final GrClosureSignatureUtil.ArgInfo[] argInfos =
- GrClosureSignatureUtil.mapParametersToArguments(signature, argumentList, closureArguments, owner.getResolveScope());
- if (argInfos == null) continue;
- final GrClosureSignatureUtil.ArgInfo argInfo = argInfos[index];
-
- final GrNamedArgument namedArg;
- if (argInfo.isMultiArg) {
- if (argInfo.args.size() == 0) continue;
- String arg = "[" + StringUtil.join(ContainerUtil.map(argInfo.args, new Function() {
- public String fun(PsiElement element) {
- return element.getText();
- }
- }), ", ") + "]";
- for (PsiElement psiElement : argInfo.args) {
- psiElement.delete();
+ GrReferenceExpression refExpr = null;
+ if (occurrence instanceof GrReferenceExpression) {
+ final PsiElement parent = occurrence.getParent();
+ if (parent instanceof GrCall) {
+ refExpr = (GrReferenceExpression)occurrence;
+ }
+ else if (parent instanceof GrReferenceExpression) {
+ final PsiElement resolved = ((GrReferenceExpression)parent).resolve();
+ if (resolved instanceof PsiMethod && "call".equals(((PsiMethod)resolved).getName())) {
+ refExpr = (GrReferenceExpression)parent;
}
- namedArg = factory.createNamedArgument(paramName, factory.createExpressionFromText(arg));
}
- else {
- if (argInfo.args.size() == 0) continue;
- final PsiElement argument = argInfo.args.iterator().next();
- assert argument instanceof GrExpression;
- namedArg = factory.createNamedArgument(paramName, (GrExpression)argument);
- argument.delete();
- }
- ((GrCall)refExpr.getParent()).addNamedArgument(namedArg);
}
+ if (refExpr == null) continue;
+ final GrClosureSignature signature = generateSignature(owner, refExpr);
+ if (signature == null) continue;
+ final GrCall call = (GrCall)refExpr.getParent();
+ final GrArgumentList argumentList = call.getArgumentList();
+ final GrClosableBlock[] closureArguments =
+ call instanceof GrCallExpression ? ((GrCallExpression)call).getClosureArguments() : GrClosableBlock.EMPTY_ARRAY;
+
+ final GrClosureSignatureUtil.ArgInfo[] argInfos =
+ GrClosureSignatureUtil.mapParametersToArguments(signature, argumentList, closureArguments, owner.getResolveScope());
+ if (argInfos == null) continue;
+ final GrClosureSignatureUtil.ArgInfo argInfo = argInfos[index];
+
+ final GrNamedArgument namedArg;
+ if (argInfo.isMultiArg) {
+ if (argInfo.args.size() == 0) continue;
+ String arg = "[" + StringUtil.join(ContainerUtil.map(argInfo.args, new Function() {
+ public String fun(PsiElement element) {
+ return element.getText();
+ }
+ }), ", ") + "]";
+ for (PsiElement psiElement : argInfo.args) {
+ psiElement.delete();
+ }
+ namedArg = factory.createNamedArgument(paramName, factory.createExpressionFromText(arg));
+ }
+ else {
+ if (argInfo.args.size() == 0) continue;
+ final PsiElement argument = argInfo.args.iterator().next();
+ assert argument instanceof GrExpression;
+ namedArg = factory.createNamedArgument(paramName, (GrExpression)argument);
+ argument.delete();
+ }
+ ((GrCall)refExpr.getParent()).addNamedArgument(namedArg);
}
}
catch (IncorrectOperationException e) {
@@ -369,10 +380,8 @@ public class ConvertParameterToMapEntryIntention extends Intention {
final PsiElement namedElem = getReferencedElement(owner);
if (namedElem == null) return true;
final Ref result = new Ref(true);
- final Task task = new Task.Modal(project, GroovyIntentionsBundle.message("find.method.ro.closure.usages.0",
- owner instanceof GrClosableBlock
- ? CLOSURE_CAPTION
- : METHOD_CAPTION), true) {
+ final Task task = new Task.Modal(project, GroovyIntentionsBundle
+ .message("find.method.ro.closure.usages.0", owner instanceof GrClosableBlock ? CLOSURE_CAPTION : METHOD_CAPTION), true) {
public void run(@NotNull final ProgressIndicator indicator) {
final GlobalSearchScope projectScope = GlobalSearchScope.projectScope(getProject());
final Query query = ReferencesSearch.search(namedElem, projectScope);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java
index c2f07fe0df08..23a3fd0794f6 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java
@@ -227,38 +227,11 @@ public class PsiImplUtil {
}
public static void setName(String name, PsiElement nameElement) {
- ASTNode node = nameElement.getNode();
- ASTNode newNameNode = GroovyPsiElementFactory.getInstance(nameElement.getProject()).createReferenceNameFromText(name).getNode();
- assert newNameNode != null && node != null;
- node.getTreeParent().replaceChild(node, newNameNode);
+ final PsiElement newNameElement = GroovyPsiElementFactory.getInstance(nameElement.getProject()).createReferenceNameFromText(name);
+ nameElement.replace(newNameElement);
}
public static boolean isExtendsSignature(MethodSignature superSignatureCandidate, MethodSignature subSignature) {
- /*final String name1 = superSignatureCandidate.getName();
- final String name2 = subSignature.getName();
- if (!name1.equals(name2)) return false;
-
- final PsiType[] superTypes = superSignatureCandidate.getParameterTypes();
- final PsiType[] subTypes = subSignature.getParameterTypes();
- if (subTypes.length != superTypes.length) return false;
- for (int i = 0; i < subTypes.length - 1; i++) {
- PsiType superType = TypeConversionUtil.erasure(superTypes[i]);
- PsiType subType = subTypes[i];
- if (!superType.isAssignableFrom(subType)) return false;
- }
-
- if (superTypes.length > 0) {
- final PsiType lastSuperType = TypeConversionUtil.erasure(superTypes[superTypes.length - 1]);
- final PsiType lastSubType = subTypes[superTypes.length - 1];
- if (lastSuperType instanceof PsiArrayType && !(lastSubType instanceof PsiArrayType)) {
- final PsiType componentType = ((PsiArrayType) lastSuperType).getComponentType();
- if (!lastSubType.isConvertibleFrom(componentType)) return false;
- } else {
- if (!lastSuperType.isAssignableFrom(lastSubType)) return false;
- }
- }
-
- return true;*/
return MethodSignatureUtil.isSubsignature(superSignatureCandidate, subSignature);
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java
index 68d1dc80d232..b21d9252909f 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java
@@ -138,6 +138,7 @@ public abstract class GrTypeDefinitionImpl extends GroovyBaseElementImplject[] {1, 2, 3}
\ No newline at end of file
diff --git a/plugins/groovy/testdata/intentions/convertJavaStyleArrayCreation/Conversion_after.groovy b/plugins/groovy/testdata/intentions/convertJavaStyleArrayCreation/Conversion_after.groovy
new file mode 100644
index 000000000000..2be10eba8fd1
--- /dev/null
+++ b/plugins/groovy/testdata/intentions/convertJavaStyleArrayCreation/Conversion_after.groovy
@@ -0,0 +1 @@
+def foo = [1, 2, 3]
\ No newline at end of file
diff --git a/plugins/groovy/testdata/paramToMap/callMethod/A.groovy b/plugins/groovy/testdata/paramToMap/callMethod/A.groovy
new file mode 100644
index 000000000000..23d1c8b94211
--- /dev/null
+++ b/plugins/groovy/testdata/paramToMap/callMethod/A.groovy
@@ -0,0 +1,3 @@
+def clos = { int i -> println(i) }
+clos(1)
+clos.call(1)
\ No newline at end of file
diff --git a/plugins/groovy/testdata/paramToMap/callMethod/A.test b/plugins/groovy/testdata/paramToMap/callMethod/A.test
new file mode 100644
index 000000000000..0b7f54921e34
--- /dev/null
+++ b/plugins/groovy/testdata/paramToMap/callMethod/A.test
@@ -0,0 +1,3 @@
+def clos = { Map attrs -> println(attrs.i) }
+clos(i: 1)
+clos.call(i: 1)
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/AbstractHgTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAbstractTestCase.java
similarity index 97%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/AbstractHgTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAbstractTestCase.java
index 23e1d5586630..bf6c44932ee2 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/AbstractHgTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAbstractTestCase.java
@@ -10,7 +10,7 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.execution.process.ProcessOutput;
import com.intellij.openapi.application.PluginPathManager;
@@ -24,7 +24,8 @@ import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import com.intellij.testFramework.fixtures.TempDirTestFixture;
import com.intellij.vcsUtil.VcsUtil;
import org.testng.annotations.BeforeMethod;
-import org.zmlx.hg4idea.org.zmlx.hg4idea.test.TestChangeListManager;
+import org.zmlx.hg4idea.HgFile;
+import org.zmlx.hg4idea.HgVcs;
import java.io.*;
@@ -33,7 +34,7 @@ import static org.testng.Assert.assertTrue;
/**
* The ancestor of all hg4idea test cases.
*/
-public abstract class AbstractHgTestCase extends AbstractVcsTestCase {
+public abstract class HgAbstractTestCase extends AbstractVcsTestCase {
public static final String HG_EXECUTABLE_PATH = "IDEA_TEST_HG_EXECUTABLE_PATH";
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgAddTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAddTestCase.java
similarity index 97%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgAddTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAddTestCase.java
index 84755453a10f..9f945b127033 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgAddTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAddTestCase.java
@@ -10,7 +10,7 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.openapi.vfs.VirtualFile;
import org.testng.annotations.Test;
@@ -18,7 +18,7 @@ import org.testng.annotations.Test;
/**
* Tests adding files to the Mercurial repository.
*/
-public class HgAddTestCase extends AbstractHgTestCase {
+public class HgAddTestCase extends HgAbstractTestCase {
/**
* 1. Create a file in the file system.
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgCopyTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCopyTestCase.java
similarity index 96%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgCopyTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCopyTestCase.java
index 5288f98a17e2..f58ce982a6b2 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgCopyTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCopyTestCase.java
@@ -10,14 +10,14 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.openapi.vfs.VirtualFile;
import org.testng.annotations.Test;
import java.io.File;
-public class HgCopyTestCase extends AbstractHgTestCase {
+public class HgCopyTestCase extends HgAbstractTestCase {
@Test
public void testCopyUnmodifiedFile() throws Exception {
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgDeleteTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgDeleteTestCase.java
similarity index 96%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgDeleteTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgDeleteTestCase.java
index 2e46e5b0668c..b118ffc62d24 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgDeleteTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgDeleteTestCase.java
@@ -10,7 +10,7 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.openapi.vfs.VirtualFile;
import org.testng.Assert;
@@ -18,7 +18,7 @@ import org.testng.annotations.Test;
import java.io.File;
-public class HgDeleteTestCase extends AbstractHgTestCase {
+public class HgDeleteTestCase extends HgAbstractTestCase {
@Test
public void testDeleteUnmodifiedFile() throws Exception {
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgFromClonedTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgFromClonedTestCase.java
similarity index 96%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgFromClonedTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgFromClonedTestCase.java
index d5ebdb7fcc00..05a632198a3b 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgFromClonedTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgFromClonedTestCase.java
@@ -10,7 +10,7 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.openapi.vfs.VirtualFile;
@@ -19,12 +19,13 @@ import com.intellij.testFramework.fixtures.TempDirTestFixture;
import com.intellij.vcsUtil.VcsUtil;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.zmlx.hg4idea.HgVcs;
import java.io.File;
import static org.testng.Assert.assertTrue;
-public class HgFromClonedTestCase extends AbstractHgTestCase {
+public class HgFromClonedTestCase extends HgAbstractTestCase {
protected File remoteRepo;
protected File projectRepo;
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgHistoryTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgHistoryTestCase.java
similarity index 96%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgHistoryTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgHistoryTestCase.java
index 1cfc4ac5f6f1..b0d3be8157d0 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgHistoryTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgHistoryTestCase.java
@@ -1,10 +1,11 @@
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.history.VcsFileRevision;
import com.intellij.openapi.vcs.history.VcsHistorySession;
import com.intellij.vcsUtil.VcsUtil;
import org.testng.annotations.Test;
+import org.zmlx.hg4idea.HgVcs;
import java.io.File;
import java.util.Collection;
@@ -16,7 +17,7 @@ import static org.testng.Assert.assertTrue;
/**
* HgHistoryTestCase tests retrieving file history and specific revisions.
*/
-public class HgHistoryTestCase extends AbstractHgTestCase {
+public class HgHistoryTestCase extends HgAbstractTestCase {
/**
* 1. Make two versions of a file (create, add, commit, modify, commit).
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgLogTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgLogTestCase.java
similarity index 91%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgLogTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgLogTestCase.java
index 3ca617d2cfd0..581cb62e38fa 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgLogTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgLogTestCase.java
@@ -10,16 +10,17 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import org.testng.annotations.Test;
+import org.zmlx.hg4idea.HgFileRevision;
import org.zmlx.hg4idea.command.HgLogCommand;
import java.util.List;
import static org.testng.Assert.assertEquals;
-public class HgLogTestCase extends AbstractHgTestCase {
+public class HgLogTestCase extends HgAbstractTestCase {
@Test
public void testCommitMessagesWithMultipleLines() throws Exception {
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgMoveTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMoveTestCase.java
similarity index 96%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgMoveTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMoveTestCase.java
index def256e6a0f2..af9e863d2bef 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgMoveTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMoveTestCase.java
@@ -10,14 +10,14 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.openapi.vfs.VirtualFile;
import org.testng.annotations.Test;
import java.io.File;
-public class HgMoveTestCase extends AbstractHgTestCase {
+public class HgMoveTestCase extends HgAbstractTestCase {
@Test
public void testMoveNewFile() throws Exception {
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgRenameTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRenameTestCase.java
similarity index 97%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgRenameTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRenameTestCase.java
index a97949c990d1..8d8310071b1f 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgRenameTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRenameTestCase.java
@@ -10,14 +10,14 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.openapi.vfs.VirtualFile;
import org.testng.annotations.Test;
import java.io.File;
-public class HgRenameTestCase extends AbstractHgTestCase {
+public class HgRenameTestCase extends HgAbstractTestCase {
@Test
public void testRenameUnmodifiedFile() throws Exception {
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgResolveConflictTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgResolveConflictTestCase.java
similarity index 95%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgResolveConflictTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgResolveConflictTestCase.java
index 8d1443264c5f..bf5a0df75e61 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgResolveConflictTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgResolveConflictTestCase.java
@@ -10,14 +10,14 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.openapi.vfs.VirtualFile;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.zmlx.hg4idea.command.HgResolveCommand;
-public class HgResolveConflictTestCase extends AbstractHgTestCase {
+public class HgResolveConflictTestCase extends HgAbstractTestCase {
public static final String BASE = "one\n" +
"conflicting\n" +
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgRevertTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRevertTestCase.java
similarity index 92%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgRevertTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRevertTestCase.java
index 14e895755f1c..674835517c0c 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgRevertTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRevertTestCase.java
@@ -1,6 +1,7 @@
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import org.testng.annotations.Test;
+import org.zmlx.hg4idea.HgRevisionNumber;
import org.zmlx.hg4idea.command.HgCatCommand;
import org.zmlx.hg4idea.command.HgRevertCommand;
@@ -8,7 +9,7 @@ import java.nio.charset.Charset;
import static org.testng.Assert.assertEquals;
-public class HgRevertTestCase extends AbstractHgTestCase {
+public class HgRevertTestCase extends HgAbstractTestCase {
@Test
public void testRevertToCurrentRevision() throws Exception {
fillFile(myProjectRepo, new String[]{"file.txt"}, "initial contents");
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgUpdateTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTestCase.java
similarity index 99%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgUpdateTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTestCase.java
index 4fed9d4d2dbe..619f0e231675 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgUpdateTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTestCase.java
@@ -10,7 +10,7 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import com.intellij.execution.process.ProcessOutput;
import com.intellij.openapi.progress.EmptyProgressIndicator;
@@ -18,6 +18,8 @@ import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.update.UpdatedFiles;
import com.intellij.openapi.vfs.VirtualFile;
import org.testng.annotations.Test;
+import org.zmlx.hg4idea.HgFile;
+import org.zmlx.hg4idea.HgRevisionNumber;
import org.zmlx.hg4idea.command.*;
import org.zmlx.hg4idea.provider.update.HgRegularUpdater;
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgUrlTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUrlTestCase.java
similarity index 99%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgUrlTestCase.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUrlTestCase.java
index 0cda4bc06df8..ed7f7086aaef 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/HgUrlTestCase.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUrlTestCase.java
@@ -10,7 +10,7 @@
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
-package org.zmlx.hg4idea;
+package org.zmlx.hg4idea.test;
import org.testng.Assert;
import org.testng.annotations.Test;
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/org/zmlx/hg4idea/test/TestChangeListManager.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/TestChangeListManager.java
similarity index 98%
rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/org/zmlx/hg4idea/test/TestChangeListManager.java
rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/TestChangeListManager.java
index e0bb3b3c56a6..791699be0f9f 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/org/zmlx/hg4idea/test/TestChangeListManager.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/TestChangeListManager.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.zmlx.hg4idea.org.zmlx.hg4idea.test;
+package org.zmlx.hg4idea.test;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationManager.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationManager.java
index 93f5c6b26672..937be282dd2b 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationManager.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationManager.java
@@ -16,12 +16,14 @@
package org.jetbrains.idea.svn;
import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.changes.ui.ChangesViewBalloonProblemNotifier;
+import com.intellij.ui.GuiUtils;
import com.intellij.util.containers.SoftHashMap;
import com.intellij.util.net.HttpConfigurable;
import org.jetbrains.annotations.Nullable;
@@ -35,36 +37,41 @@ import org.tmatesoft.svn.core.io.SVNRepository;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* @author alex
*/
public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager {
+ private static final Logger LOG = Logger.getInstance(SvnAuthenticationManager.class.getName());
private final Project myProject;
private final File myConfigDirectory;
private PersistentAuthenticationProviderProxy myPersistentAuthenticationProviderProxy;
private SvnConfiguration myConfig;
+ private AtomicBoolean myStoreInPlainTextAnyway = new AtomicBoolean(false);
public SvnAuthenticationManager(final Project project, final File configDirectory) {
- super(configDirectory, true, null, null);
- myProject = project;
+ super(configDirectory, true, null, null);
+ myProject = project;
myConfigDirectory = configDirectory;
myConfig = SvnConfiguration.getInstance(myProject);
- if (myPersistentAuthenticationProviderProxy != null) {
- myPersistentAuthenticationProviderProxy.setProject(myProject);
- }
+ if (myPersistentAuthenticationProviderProxy != null) {
+ myPersistentAuthenticationProviderProxy.setProject(myProject);
}
+ }
@Override
protected ISVNAuthenticationProvider createCacheAuthenticationProvider(File authDir, String userName) {
+ myStoreInPlainTextAnyway = new AtomicBoolean(false);
myPersistentAuthenticationProviderProxy = new PersistentAuthenticationProviderProxy(super.createCacheAuthenticationProvider(authDir, userName), authDir);
return myPersistentAuthenticationProviderProxy;
}
- private static class PersistentAuthenticationProviderProxy implements ISVNAuthenticationProvider, IPersistentAuthenticationProvider {
+ private class PersistentAuthenticationProviderProxy implements ISVNAuthenticationProvider, IPersistentAuthenticationProvider {
private final Map myRewritePreventer;
private static final long ourRefreshInterval = 6000 * 1000;
private final ISVNAuthenticationProvider myDelegate;
@@ -84,7 +91,7 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager {
public SVNAuthentication requestClientAuthentication(final String kind, final SVNURL url, final String realm, final SVNErrorMessage errorMessage,
final SVNAuthentication previousAuth,
final boolean authMayBeStored) {
- return myDelegate.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
+ return myDelegate.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, false);
}
public int acceptServerAuthentication(final SVNURL url, final String realm, final Object certificate, final boolean resultMayBeStored) {
@@ -101,7 +108,22 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager {
File authFile = new File(dir, fileName);
if ((! authFile.exists()) || recent == null || ((recent != null) && ((currTime - recent.longValue()) > ourRefreshInterval))) {
- ((IPersistentAuthenticationProvider) myDelegate).saveAuthentication(auth, kind, realm);
+
+ if (auth.isStorageAllowed() && ISVNAuthenticationManager.USERNAME != kind) {
+ try {
+ GuiUtils.runOrInvokeAndWait(new Runnable() {
+ public void run() {
+ checkContinueSaveCredentials(auth, kind, realm);
+ }
+ });
+ } catch (InvocationTargetException e) {
+ LOG.error(e);
+ } catch (InterruptedException e) {
+ LOG.error(e);
+ }
+ }
+
+ ((DefaultSVNAuthenticationManager.IPersistentAuthenticationProvider)myDelegate).saveAuthentication(auth, kind, realm);
// do not make password file readonly
setWriteable(authFile);
@@ -305,7 +327,7 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager {
catch (SVNException e) {
return false;
}
-
+
final String host = svnurl.getHost();
return matches(patterns, host) && (! matches(exceptions, host));
}
@@ -419,52 +441,61 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager {
}
// check can encrypt
- if (! (SystemInfo.isWindows && SVNJNAUtil.isWinCryptEnabled())) {
+ if (!(SystemInfo.isWindows && SVNJNAUtil.isWinCryptEnabled())) {
if (ISVNAuthenticationManager.SSL.equals(kind)) {
try {
- if (! isStorePlainTextPassphrases(realm, auth)) {
- final SVNSSLAuthentication svnsslAuthentication = (SVNSSLAuthentication)auth;
- ApplicationManager.getApplication().invokeLater(new Runnable() {
- public void run() {
- Messages.showWarningDialog(myProject, "Your passphrase for client certificate:\n\n" +
- svnsslAuthentication.getCertificateFile().getPath() +
- "\n\ncan only be stored to disk unencrypted. (Encryption is not supported)\n\n" +
- "But storage in plain text is not allowed.\nTo allow plain text passphrases caching, set \"store-ssl-client-cert-pp-plaintext=yes\"",
- "Cannot save passphrase");
- }
- });
- /*ChangesViewBalloonProblemNotifier.showMe(myProject, "Your passphrase for client certificate:\n" +
- svnsslAuthentication.getCertificateFile().getPath() +
- "\ncan only be stored to disk unencrypted! (Encryption is not supported)\n" +
- "But storage in plain text is not allowed.\nTo allow plain text passphrases caching, set \"store-ssl-client-cert-pp-plaintext\"=\"yes\"", MessageType.ERROR);*/
- return false;
+ if (!isStorePlainTextPassphrases(realm, auth)) {
+ return askToStoreUnencrypted("Store the passphrase in plaintext?",
+ String.format("Your passphrase for client certificate:\n%s\ncan only be stored to disk unencrypted. Would you like to store it in plaintext?",
+ ((SVNSSLAuthentication)auth).getCertificateFile().getPath()));
}
- }
- catch (SVNException e) {
- // should not occur, anyway means not allowed
+ } catch (SVNException e) {
+ LOG.error(e); // should not occur, anyway means not allowed
}
} else {
try {
- if (! isStorePlainTextPasswords(realm, auth)) {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
- public void run() {
- Messages.showWarningDialog(myProject, "Your password for authentication realm:\n\n" + realm +
- "\n\ncan only be stored to disk unencrypted. (Encryption is not supported)\n\n" +
- "But storage in plain text is not allowed.\nTo allow plain text passwords caching, set \"store-plaintext-passwords=yes\"",
- "Cannot save password");
- }
- });
- /*ChangesViewBalloonProblemNotifier.showMe(myProject, "Your password for authentication realm:\n" + realm +
- "\ncan only be stored to disk unencrypted! (Encryption is not supported)\n" +
- "But storage in plain text is not allowed.\nTo allow plain text passwords caching, set \"store-plaintext-passwords\"=\"yes\"", MessageType.ERROR);*/
- return false;
+ if (!isStorePlainTextPasswords(realm, auth)) {
+ return askToStoreUnencrypted("Store the password in plaintext?",
+ String.format("Your password for authentication realm:\n%s\ncan only be stored to disk unencrypted. Would you like to store it in plaintext?",
+ realm));
}
- }
- catch (SVNException e) {
- //
+ } catch (SVNException e) {
+ LOG.error(e);
}
}
}
return true;
}
-}
+
+ @Override
+ protected boolean isStorePlainTextPasswords(String realm, SVNAuthentication auth) throws SVNException {
+ // normally check user preferences, but the user may override them via the dialog from checkContinueSaveCredentials()
+ return myStoreInPlainTextAnyway.get() || super.isStorePlainTextPasswords(realm, auth);
+ }
+
+ @Override
+ protected boolean isStorePlainTextPassphrases(String realm, SVNAuthentication auth) throws SVNException {
+ return myStoreInPlainTextAnyway.get() || super.isStorePlainTextPassphrases(realm, auth);
+ }
+
+ /**
+ * Shows a yes/no question whether user wants to store his password in plain text and returns his answer.
+ * Also updates the 'myStoreInPlainTextAnyway' variable correspondingly.
+ * This method shuld be called from the event dispatching thread.
+ * @param title title of the questioning dialog.
+ * @param message questioning message to be displayed.
+ * @return true if user agrees to store his password in plaintext, false if he doesn't.
+ */
+ private boolean askToStoreUnencrypted(String title, String message) {
+ final int answer = Messages.showYesNoDialog(myProject, message, title, Messages.getQuestionIcon());
+ if (answer == 0) {
+ myStoreInPlainTextAnyway.set(true);
+ } else {
+ myStoreInPlainTextAnyway.set(false);
+ ChangesViewBalloonProblemNotifier.showMe(myProject, "Cannot store password", MessageType.ERROR);
+ }
+ return myStoreInPlainTextAnyway.get();
+
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnInteractiveAuthenticationProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnInteractiveAuthenticationProvider.java
index 6a8e6c1ab2de..e26528930dda 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnInteractiveAuthenticationProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnInteractiveAuthenticationProvider.java
@@ -173,15 +173,9 @@ public class SvnInteractiveAuthenticationProvider implements ISVNAuthenticationP
}
log("3 authentication result: " + result[0]);
}
+
final boolean wasCanceled = result[0] == null;
callState.setWasCancelled(wasCanceled);
- if ((! wasCanceled) && (ISVNAuthenticationManager.USERNAME != kind) && (result[0].isStorageAllowed())) {
- ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
- public void run() {
- myManager.checkContinueSaveCredentials(result[0], kind, realm);
- }
- });
- }
return result[0];
}
diff --git a/xml/impl/src/com/intellij/xml/util/XmlRefCountHolder.java b/xml/impl/src/com/intellij/xml/util/XmlRefCountHolder.java
index 58c1ead70368..ef8dc3839ce9 100644
--- a/xml/impl/src/com/intellij/xml/util/XmlRefCountHolder.java
+++ b/xml/impl/src/com/intellij/xml/util/XmlRefCountHolder.java
@@ -17,7 +17,6 @@ package com.intellij.xml.util;
import com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor;
import com.intellij.lang.Language;
-import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.UserDataCache;
@@ -31,6 +30,7 @@ import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.xml.*;
+import com.intellij.util.NullableFunction;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xml.XmlAttributeDescriptor;
import com.intellij.xml.XmlElementDescriptor;
@@ -102,14 +102,14 @@ public class XmlRefCountHolder {
}
else if (!soft) {
// mark as duplicate
- Pair notSoft = ContainerUtil.find(list, new Condition>() {
+ List notSoft = ContainerUtil.mapNotNull(list, new NullableFunction, XmlAttributeValue>() {
@Override
- public boolean value(Pair xmlAttributeValueBooleanPair) {
- return !xmlAttributeValueBooleanPair.second;
+ public XmlAttributeValue fun(Pair pair) {
+ return pair.second ? null : pair.first;
}
});
- if (notSoft != null) {
- myPossiblyDuplicateIds.add(notSoft.first);
+ if (!notSoft.isEmpty()) {
+ myPossiblyDuplicateIds.addAll(notSoft);
myPossiblyDuplicateIds.add(attributeValue);
}
}
diff --git a/xml/openapi/src/com/intellij/psi/xml/XmlTagChild.java b/xml/openapi/src/com/intellij/psi/xml/XmlTagChild.java
index 60c822b92d3a..5e0129ab5df5 100644
--- a/xml/openapi/src/com/intellij/psi/xml/XmlTagChild.java
+++ b/xml/openapi/src/com/intellij/psi/xml/XmlTagChild.java
@@ -20,7 +20,6 @@ import org.jetbrains.annotations.Nullable;
public interface XmlTagChild extends XmlElement{
XmlTagChild[] EMPTY_ARRAY = new XmlTagChild[0];
- @Nullable
XmlTag getParentTag();
@Nullable