From bd61c66418db3265d3ba603fcdd6438d74e90fc8 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Mon, 18 Aug 2014 11:34:36 +0400 Subject: [PATCH 1/5] resource bundle editor: delete properties on multiple selection fixed --- .../ResourceBundleEditorViewElement.java | 2 - .../properties/editor/NewPropertyAction.java | 2 +- .../editor/ResourceBundleEditor.java | 58 +++++++++++++------ .../ResourceBundleStructureViewComponent.java | 18 ++++-- ...ResourceBundleFromEditorRenameHandler.java | 2 +- 5 files changed, 55 insertions(+), 27 deletions(-) diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleEditorViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleEditorViewElement.java index 58932d1fd4c5..8a8d3b0390d4 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleEditorViewElement.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleEditorViewElement.java @@ -16,9 +16,7 @@ package com.intellij.lang.properties.editor; -import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; -import org.jetbrains.annotations.NotNull; /** * @author Dmitry Batkovich diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java b/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java index d25b780bd769..2218b7598884 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java @@ -60,7 +60,7 @@ class NewPropertyAction extends AnAction { prefix = null; separator = null; } else { - final ResourceBundleEditorViewElement selectedElement = resourceBundleEditor.getSelectedElement(); + final ResourceBundleEditorViewElement selectedElement = resourceBundleEditor.getSelectedElementIfOnlyOne(); if (selectedElement == null) { return; } diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java index e9eb9e9f72d2..0339b09b8c88 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java @@ -57,7 +57,10 @@ import com.intellij.ui.JBColor; import com.intellij.ui.JBSplitter; import com.intellij.ui.components.JBScrollPane; import com.intellij.util.Alarm; +import com.intellij.util.Function; import com.intellij.util.IncorrectOperationException; +import com.intellij.util.NullableFunction; +import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtilRt; import com.intellij.util.containers.Stack; import com.intellij.util.ui.UIUtil; @@ -129,7 +132,7 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit @Override public void valueChanged(TreeSelectionEvent e) { // filter out temp unselect/select events - if (getSelectedProperty() == null) return; + if (Comparing.equal(e.getNewLeadSelectionPath(), e.getOldLeadSelectionPath()) || getSelectedProperty() == null) return; if (!arePropertiesEquivalent(selectedProperty, getSelectedProperty()) || !Comparing.equal(selectedPropertiesFile, getSelectedPropertiesFile())) { @@ -570,13 +573,21 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit document.replaceString(0, document.getTextLength(), text); } - @Nullable - private DefaultMutableTreeNode getSelectedNode() { + @NotNull + private Collection getSelectedNodes() { + if (!isValid()) { + return Collections.emptyList(); + } JTree tree = myStructureViewComponent.getTree(); - if (tree == null) return null; - TreePath selected = tree.getSelectionModel().getSelectionPath(); - if (selected == null) return null; - return (DefaultMutableTreeNode)selected.getLastPathComponent(); + if (tree == null) return Collections.emptyList(); + TreePath[] selected = tree.getSelectionModel().getSelectionPaths(); + if (selected == null || selected.length == 0) return Collections.emptyList(); + return ContainerUtil.map(selected, new Function() { + @Override + public DefaultMutableTreeNode fun(TreePath treePath) { + return (DefaultMutableTreeNode)treePath.getLastPathComponent(); + } + }); } @Nullable @@ -587,25 +598,34 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit @Nullable private IProperty getSelectedProperty() { - final DefaultMutableTreeNode selectedNode = getSelectedNode(); - if (selectedNode == null) { + final Collection selectedNode = getSelectedNodes(); + if (selectedNode.isEmpty()) { return null; } - final ResourceBundleEditorViewElement element = getSelectedElement(selectedNode); + final ResourceBundleEditorViewElement element = getSelectedElement(ContainerUtil.getFirstItem(selectedNode)); return element instanceof ResourceBundlePropertyStructureViewElement ? ((ResourceBundlePropertyStructureViewElement)element).getProperty() : null; } + @NotNull + public Collection getSelectedElements() { + final Collection selectedNodes = getSelectedNodes(); + return ContainerUtil.mapNotNull(selectedNodes, new NullableFunction() { + @Nullable + @Override + public ResourceBundleEditorViewElement fun(DefaultMutableTreeNode selectedNode) { + Object userObject = selectedNode.getUserObject(); + if (!(userObject instanceof AbstractTreeNode)) return null; + Object value = ((AbstractTreeNode)userObject).getValue(); + return value instanceof ResourceBundleEditorViewElement ? (ResourceBundleEditorViewElement) value : null; + } + }); + } + @Nullable - public ResourceBundleEditorViewElement getSelectedElement() { - final DefaultMutableTreeNode selectedNode = getSelectedNode(); - if (selectedNode == null) { - return null; - } - Object userObject = selectedNode.getUserObject(); - if (!(userObject instanceof AbstractTreeNode)) return null; - Object value = ((AbstractTreeNode)userObject).getValue(); - return value instanceof ResourceBundleEditorViewElement ? (ResourceBundleEditorViewElement) value : null; + public ResourceBundleEditorViewElement getSelectedElementIfOnlyOne() { + final Collection selectedElements = getSelectedElements(); + return selectedElements.size() == 1 ? ContainerUtil.getFirstItem(selectedElements) : null; } @Override diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java index 0985f35a5e12..da376abe05b2 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java @@ -25,7 +25,6 @@ import com.intellij.lang.properties.psi.Property; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.ide.CopyPasteManager; -import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiNamedElement; @@ -34,10 +33,13 @@ import com.intellij.refactoring.safeDelete.SafeDeleteHandler; import com.intellij.ui.PopupHandler; import com.intellij.usages.UsageTarget; import com.intellij.usages.UsageView; +import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.awt.datatransfer.StringSelection; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.List; /** @@ -74,9 +76,17 @@ class ResourceBundleStructureViewComponent extends PropertiesGroupingStructureVi } else if (PlatformDataKeys.FILE_EDITOR.is(dataId)) { return getFileEditor(); } else if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) { - final ResourceBundleEditorViewElement selectedElement = ((ResourceBundleEditor)getFileEditor()).getSelectedElement(); - if (selectedElement != null) { - return selectedElement.getPsiElements(); + final Collection selectedElements = ((ResourceBundleEditor)getFileEditor()).getSelectedElements(); + if (selectedElements.isEmpty()) { + return null; + } else if (selectedElements.size() == 1) { + return ContainerUtil.getFirstItem(selectedElements).getPsiElements(); + } else { + final List psiElements = new ArrayList(); + for (ResourceBundleEditorViewElement selectedElement : selectedElements) { + Collections.addAll(psiElements, selectedElement.getPsiElements()); + } + return psiElements.toArray(new PsiElement[psiElements.size()]); } } else if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) { final PsiElement[] psiElements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(this); diff --git a/plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromEditorRenameHandler.java b/plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromEditorRenameHandler.java index 0c04bec80620..e105195cb9b3 100644 --- a/plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromEditorRenameHandler.java +++ b/plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromEditorRenameHandler.java @@ -74,7 +74,7 @@ public class ResourceBundleFromEditorRenameHandler implements RenameHandler { public void invoke(final @NotNull Project project, Editor editor, final PsiFile file, DataContext dataContext) { final ResourceBundleEditor resourceBundleEditor = (ResourceBundleEditor)PlatformDataKeys.FILE_EDITOR.getData(dataContext); assert resourceBundleEditor != null; - final ResourceBundleEditorViewElement selectedElement = resourceBundleEditor.getSelectedElement(); + final ResourceBundleEditorViewElement selectedElement = resourceBundleEditor.getSelectedElementIfOnlyOne(); if (selectedElement != null) { CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { @Override From 06134b0c3cfae41157c6aa027e3ba36b24d5f5c4 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Mon, 18 Aug 2014 11:40:26 +0400 Subject: [PATCH 2/5] IDEA-107072 Breakpoint dialog: usability problems and other bug - icon size fix --- .../src/actions/GroupByClass@2x_dark.png | Bin 3836 -> 1216 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/platform/icons/src/actions/GroupByClass@2x_dark.png b/platform/icons/src/actions/GroupByClass@2x_dark.png index c4de0f6ab17d0122cde640f6b69708ea6f041468..8b8c42ceb33bdeb0fecea96351951bea73ff8b8f 100644 GIT binary patch literal 1216 zcmV;x1V8(UP){t zL0U|cMv6^i(>A2tY*qHqMdGH!I3SRn;bG!%kf?@Dc;=nF#iz`S0-n$uhR3pvh5a!?x^0nxo=7 zXe7WR`ivBChub4zpQ*{D@P)k|*oJNK@eTO0%D&OuMyEjE`uraE7Kf@@N>aK=C*pMa z_yk=%`x|AnBo*@i#H&9Prl$uEuX4b)@DYivBsl24ta=q2wBCTvYcEQZuPj}m@ehZ| z-5jEAJr9v57`pMkT0BNhUx11Rd5wKQK<`Eb+~ssSY$YjM{u(`sr8QIM&PS-N`+ibP ztM9RrL1twi=(=krBZJmrHk(cI@-O@`O@Z)c3T^GAvSOloGCBLuU%&MV$Q3cW$)x=I zq+GfYVU=jFr_~Z!tsYp+<_ksncm*Tvlv;_=;>G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z8;C(UuOt&{JPNg=kweI2%i>z%gU*|JT5P~X(i-ibAy&vY(D7dYaIC`$EL*lL&2G0p zgvR6WAPWFqf^0)w=s<_rg;CEhykR(Jus5UlbFIxL=i40)&`FfwI#J_-`=m%ZVKFmO zYSu7rL!)(~gc6HJ1EEl$3KZIcy}%ZfRmwV-Ra$DbX1 zxPXSVxHSUuAu`X+Q>IMmQrLRzwU1>@c4zPgxg6f;O0>IL6r~Jo7pkp1*f=urn0_U97BI^ zgLa!i?Zyr(Kr6x+@De<{1E0S|!*a~xTQHtA-5n{>(qeOikd2~kf0kp0h=MeT6NEgD zMxqVL~c`)bDWr_h?Kjz#BoSB~?{b!Jdk{ zvp1H>qQYGY+ZaR#Lb8(!!lZ&sbW27rl;xRb-O%W=A2BrjK-};9@ACRxfm0QCsq${O z8|-x4iFf8g51NB*1bv=^R|>XHYUlDgpP!$99bT9MMG7JN@X`jn^hHnQbvju6MdNH7 zk|vh0R79PiR!6iG!A_;a<1Z1hw^S2SOpP9O)I@2J>P(r|-|&hy%={Rz;WxN95kk)e z-h-W%wr4~a_XjEsfa0`1I=RIX_rPPUgbGJGpN^br@ZR1>Ray)L0y!9eI%E_i1%0jt zy}vX|J?*aU09eqlFVO!H?P!q;cBU;x@Yo5c+=F`Ftq<0Y1OPc)L&4UynHqjSb+U6P>uITZJ9a(|TWbGjTQwcYcQ+DPe`( yusQng1~jra<1^Hg^EkUC>|AJjj{5k;1NcAp;-jf@Mk-YR00001N From 858b3e306a956c376923c6745865f27e1444c3af Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Mon, 18 Aug 2014 11:24:51 +0400 Subject: [PATCH 3/5] Remove usages of deprecated CodeStyleSettings.RIGHT_MARGIN field --- .../src/com/intellij/psi/formatter/XmlFormatterTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestCase.java b/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestCase.java index d0600b52b34f..064fb0e7efbf 100644 --- a/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestCase.java +++ b/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestCase.java @@ -27,7 +27,7 @@ public abstract class XmlFormatterTestCase extends FormatterTestCase{ public void testDontKeepLineBreaksInText() throws Throwable { final CodeStyleSettings settings = getSettings(); final XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class); - settings.RIGHT_MARGIN = 15; + settings.setDefaultRightMargin(15); settings.HTML_KEEP_LINE_BREAKS_IN_TEXT = false; xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT = false; From 72876e00de65f8faafee6d118ca48623ee64e246 Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Mon, 18 Aug 2014 11:51:31 +0400 Subject: [PATCH 4/5] fixed IndexOutOfBoundsException on check action --- .../src/com/jetbrains/python/edu/StudyDocumentListener.java | 2 +- .../src/com/jetbrains/python/edu/course/TaskFile.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/StudyDocumentListener.java b/python/edu/learn-python/src/com/jetbrains/python/edu/StudyDocumentListener.java index f72135d7f181..9fdcf704a29b 100644 --- a/python/edu/learn-python/src/com/jetbrains/python/edu/StudyDocumentListener.java +++ b/python/edu/learn-python/src/com/jetbrains/python/edu/StudyDocumentListener.java @@ -51,7 +51,7 @@ public class StudyDocumentListener extends DocumentAdapter { int change = event.getNewLength() - event.getOldLength(); if (myTaskWindow != null) { int newLength = myTaskWindow.getLength() + change; - myTaskWindow.setLength(newLength); + myTaskWindow.setLength(newLength <= 0 ? 0 : newLength); } int newEnd = offset + event.getNewLength(); int newLine = document.getLineNumber(newEnd); diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/course/TaskFile.java b/python/edu/learn-python/src/com/jetbrains/python/edu/course/TaskFile.java index ed4f2bfe80da..aa6a5becddb3 100644 --- a/python/edu/learn-python/src/com/jetbrains/python/edu/course/TaskFile.java +++ b/python/edu/learn-python/src/com/jetbrains/python/edu/course/TaskFile.java @@ -112,7 +112,8 @@ public class TaskFile implements Stateful{ for (TaskWindow tw : taskWindows) { if (tw.getLine() <= line) { int twStartOffset = tw.getRealStartOffset(document); - int twEndOffset = twStartOffset + tw.getLength(); + final int length = tw.getLength() > 0 ? tw.getLength() : 0; + int twEndOffset = twStartOffset + length; if (twStartOffset <= offset && offset <= twEndOffset) { return tw; } From 5ffdd2b01557a21137f590ebb9e58d0412e911da Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Mon, 18 Aug 2014 12:13:03 +0400 Subject: [PATCH 5/5] inspections ui: SeverityEditorDialog AssertionError fixed while pressing "Colors&Fonts" button --- .../com/intellij/codeInspection/ex/SeverityEditorDialog.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java index 527235b5166c..a7bcd970660d 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java @@ -37,6 +37,7 @@ import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.openapi.options.ShowSettingsUtil; +import com.intellij.openapi.options.ex.ConfigurableWrapper; import com.intellij.openapi.options.newEditor.OptionsEditor; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.InputValidator; @@ -231,7 +232,8 @@ public class SeverityEditorDialog extends DialogWrapper { final DataContext dataContext = DataManager.getInstance().getDataContext(myPanel); final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext); if (optionsEditor != null) { - final ColorAndFontOptions colorAndFontOptions = optionsEditor.findConfigurable(ColorAndFontOptions.class); + final ColorAndFontOptions colorAndFontOptions = + (ColorAndFontOptions)((ConfigurableWrapper)optionsEditor.findConfigurableById("reference.settingsdialog.IDE.editor.colors")).getConfigurable(); assert colorAndFontOptions != null; final SearchableConfigurable javaPage = colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class); LOG.assertTrue(javaPage != null);