From 5e0f014c773bdad9409dc48ab8c55504a56b8260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Wed, 11 Feb 2015 09:03:43 +0100 Subject: [PATCH 01/11] jetbrains.dic: +"uncommenting" --- spellchecker/src/com/intellij/spellchecker/jetbrains.dic | 1 + 1 file changed, 1 insertion(+) diff --git a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic index 55a6c61237b4..99657468b768 100644 --- a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic +++ b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic @@ -601,6 +601,7 @@ unboxing unbuffered uncomment uncommented +uncommenting undef underwave undoable From 4c8db81822baf0f785b4fba382105d1556e96e45 Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Wed, 11 Feb 2015 11:10:05 +0300 Subject: [PATCH 02/11] Added not null check to prevent from inserting fqn in javadoc if fqn is null (EA-64712) --- .../JavaClassNameInsertHandler.java | 2 +- .../completion/JavadocCompletionTest.groovy | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameInsertHandler.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameInsertHandler.java index 51ab95efc0da..48ddfdcaa851 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameInsertHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameInsertHandler.java @@ -132,7 +132,7 @@ class JavaClassNameInsertHandler implements InsertHandler} + */ + Super aSuper = new Super(); + + } +} +''' + myFixture.configureByText "a.java", text + myFixture.completeBasic() + myFixture.type('\t') + myFixture.checkResult ''' +public class Test { + + public static void main(String[] args) { + class Super { + } + + /** + * {@link Super} + */ + Super aSuper = new Super(); + + } +} +''' + + } public void testShortNameIfImplicitlyImported() { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED From 752dfdc582d6b0952bb3edd3829e60f7e2293336 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Wed, 11 Feb 2015 09:27:39 +0100 Subject: [PATCH 03/11] CIDR: temp fix for IDEA installers --- build/scripts/libLicenses.gant | 1 + 1 file changed, 1 insertion(+) diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant index f7c62a02dc4d..333c8135687b 100644 --- a/build/scripts/libLicenses.gant +++ b/build/scripts/libLicenses.gant @@ -278,6 +278,7 @@ libraryLicense(name: "json-smart", libraryName: "json-smart-1.1.1.jar", version: libraryLicense(name: "fxg-utils", libraryName: "fxg-utils", version: "4.9.1", license: "Apache 2.0", url: "http://flex.apache.org", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0") libraryLicense(name: "jayatana", libraryName: "jayatana", version: "1.2.4", license: "MIT License", url: "https://code.google.com/p/java-swing-ayatana/", licenseUrl: "http://opensource.org/licenses/mit-license.php") libraryLicense(name: "ForkJoin", version: "", license: "Creative Commons Public Domain Dedication", url: "http://gee.cs.oswego.edu/dl/concurrency-interest/index.html", licenseUrl: "http://creativecommons.org/publicdomain/zero/1.0/") +libraryLicense(name: "ANTLR 4 Runtime", libraryName: "antlr-runtime-4.1.jar", version: "4.1", license: "BSD", url: "http://www.antlr.org", licenseUrl: "http://www.antlr.org/license.html") libraryLicense(name: "minlog", libraryName: "minlog-1.2.jar", version: "1.2", license: "BSD", url: "https://github.com/EsotericSoftware/minlog", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause") libraryLicense(name: "ReflectASM", libraryName: "reflectasm-1.0.7.jar", version: "1.0.7", license: "BSD", url: "https://github.com/EsotericSoftware/reflectasm", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause") libraryLicense(name: "Objenesis", libraryName: "objenesis-1.2.jar", version: "1.2", license: "Apache 2.0", url: "http://objenesis.org/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0") From 177450ca468b0784d821a68b132dcd7cc77eef55 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Wed, 11 Feb 2015 11:27:42 +0300 Subject: [PATCH 04/11] Properties Files: insert new property in alpha-order if it is possible (addPropertyFirst, addPropertyLast) removed --- .../lang/properties/psi/PropertiesFile.java | 11 +--- ...AlphaUnsortedPropertiesFileInspection.java | 33 ++---------- .../lang/properties/PropertiesImplUtil.java | 20 +++++-- .../psi/impl/PropertiesFileImpl.java | 53 +++++++++++++------ .../properties/xml/XmlPropertiesFileImpl.java | 15 ++---- ...urceBundlePropertiesInsertManagerImpl.java | 40 ++++++-------- 6 files changed, 78 insertions(+), 94 deletions(-) diff --git a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertiesFile.java b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertiesFile.java index 2b9a3743631e..b269e1a6fdb4 100644 --- a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertiesFile.java +++ b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertiesFile.java @@ -89,18 +89,9 @@ public interface PropertiesFile { */ @NotNull PsiElement addPropertyAfter(@NotNull Property property, @Nullable Property anchor) throws IncorrectOperationException; - /** - * delegates call to {@link PropertiesFile#addPropertyLast()} method - */ - @Deprecated IProperty addProperty(String key, String value); - IProperty addPropertyFirst(String key, String value); - - IProperty addPropertyLast(String key, String value); - IProperty addPropertyAfter(String key, String value, Property anchor); - /** * @return Property key to the property value map. * Do not modify this map. It's no use anyway. @@ -116,4 +107,6 @@ public interface PropertiesFile { Project getProject(); String getText(); + + boolean isAlphaSorted(); } diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unsorted/AlphaUnsortedPropertiesFileInspection.java b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unsorted/AlphaUnsortedPropertiesFileInspection.java index 360d9ce86dda..60ad79f7e1b3 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unsorted/AlphaUnsortedPropertiesFileInspection.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unsorted/AlphaUnsortedPropertiesFileInspection.java @@ -17,7 +17,6 @@ package com.intellij.codeInspection.unsorted; import com.intellij.codeInspection.*; import com.intellij.lang.properties.IProperty; -import com.intellij.lang.properties.PropertiesBundle; import com.intellij.lang.properties.PropertiesImplUtil; import com.intellij.lang.properties.ResourceBundle; import com.intellij.lang.properties.psi.PropertiesElementFactory; @@ -30,11 +29,8 @@ import com.intellij.openapi.util.Comparing; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.util.NullableFunction; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; @@ -68,7 +64,7 @@ public class AlphaUnsortedPropertiesFileInspection extends LocalInspectionTool { holder.registerProblem(file, String.format(MESSAGE_TEMPLATE_WHOLE_RESOURCE_BUNDLE, resourceBundleBaseName), ProblemHighlightType.INFO, new PropertiesSorterQuickFix(true, propertiesFile)); return; } - if (!isAlphaSorted(propertiesFile)) { + if (!propertiesFile.isAlphaSorted()) { holder.registerProblem(file, "Properties file is unsorted", ProblemHighlightType.INFO, new PropertiesSorterQuickFix(true, propertiesFile)); } } @@ -81,32 +77,9 @@ public class AlphaUnsortedPropertiesFileInspection extends LocalInspectionTool { if (!(file instanceof PropertiesFileImpl)) { return true; } - if (!file.equals(exceptedFile)) { - if (!isAlphaSorted(file)) { - return false; - } - } - } - return true; - } - - private static boolean isAlphaSorted(final @NotNull PropertiesFile propertiesFile) { - return isAlphaSorted(ContainerUtil.mapNotNull(propertiesFile.getProperties(), new NullableFunction() { - @Nullable - @Override - public String fun(IProperty property) { - return property.getKey(); - } - })); - } - - private static boolean isAlphaSorted(final List keys) { - String prevKey = null; - for (String key : keys) { - if (prevKey != null && prevKey.compareTo(key) > 0) { + if (!file.equals(exceptedFile) && !file.isAlphaSorted()) { return false; } - prevKey = key; } return true; } @@ -137,7 +110,7 @@ public class AlphaUnsortedPropertiesFileInspection extends LocalInspectionTool { public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final boolean force = myFilesToSort.length == 1; for (PropertiesFile file : myFilesToSort) { - if (!force && isAlphaSorted(file)) { + if (!force && file.isAlphaSorted()) { continue; } sortPropertiesFile(file); diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java index 47569143b922..00feb42ba56e 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java @@ -33,10 +33,7 @@ import com.intellij.util.indexing.FileBasedIndex; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; /** * @author Konstantin Bulenkov @@ -162,4 +159,19 @@ public class PropertiesImplUtil extends PropertiesUtil { } return getResourceBundle(baseName, baseDirectory); } + + public static boolean isAlphaSorted(final Collection properties) { + String previousKey = null; + for (IProperty property : properties) { + final String key = property.getKey(); + if (key == null) { + return false; + } + if (previousKey != null && previousKey.compareTo(key) > 0) { + return false; + } + previousKey = key; + } + return true; + } } \ No newline at end of file diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertiesFileImpl.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertiesFileImpl.java index 9d04b993b6ca..7c77848a47ba 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertiesFileImpl.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertiesFileImpl.java @@ -25,6 +25,7 @@ import com.intellij.lang.properties.parsing.PropertiesElementTypes; import com.intellij.lang.properties.psi.PropertiesElementFactory; import com.intellij.lang.properties.psi.PropertiesFile; import com.intellij.lang.properties.psi.Property; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileTypes.FileType; import com.intellij.psi.FileViewProvider; import com.intellij.psi.PsiElement; @@ -44,9 +45,11 @@ import org.jetbrains.annotations.Nullable; import java.util.*; public class PropertiesFileImpl extends PsiFileBase implements PropertiesFile { + private static final Logger LOG = Logger.getInstance(PropertiesFileImpl.class); private static final TokenSet PROPERTIES_LIST_SET = TokenSet.create(PropertiesElementTypes.PROPERTIES_LIST); private volatile MostlySingularMultiMap myPropertiesMap; //guarded by lock private volatile List myProperties; //guarded by lock + private volatile boolean myAlphaSorted; private final Object lock = new Object(); public PropertiesFileImpl(FileViewProvider viewProvider) { @@ -87,10 +90,12 @@ public class PropertiesFileImpl extends PsiFileBase implements PropertiesFile { propertiesMap.add(key, property); properties.add(property); } + final boolean isAlphaSorted = PropertiesImplUtil.isAlphaSorted(properties); synchronized (lock) { if (myPropertiesMap != null) return; myProperties = properties; myPropertiesMap = propertiesMap; + myAlphaSorted = isAlphaSorted; } } @@ -135,12 +140,30 @@ public class PropertiesFileImpl extends PsiFileBase implements PropertiesFile { @Override @NotNull public PsiElement addProperty(@NotNull IProperty property) throws IncorrectOperationException { - if (haveToAddNewLine()) { - insertLineBreakBefore(null); + final IProperty position = findInsertionPosition(property); + return addPropertyAfter((Property)property, (Property)position); + } + + private IProperty findInsertionPosition(@NotNull IProperty property) { + synchronized (lock) { + ensurePropertiesLoaded(); + if (myProperties.isEmpty()) { + return null; + } + if (myAlphaSorted) { + final int insertIndex = Collections.binarySearch(myProperties, property, new Comparator() { + @Override + public int compare(IProperty p1, IProperty p2) { + final String k1 = p1.getKey(); + final String k2 = p2.getKey(); + LOG.assertTrue(k1 != null && k2 != null); + return k1.compareTo(k2); + } + }); + return insertIndex == -1 ? null :myProperties.get(insertIndex < 0 ? - insertIndex - 2 : insertIndex); + } + return myProperties.get(myProperties.size() - 1); } - final TreeElement copy = ChangeUtil.copyToElement(property.getPsiElement()); - getPropertiesList().addChild(copy); - return copy.getPsi(); } @Override @@ -171,18 +194,6 @@ public class PropertiesFileImpl extends PsiFileBase implements PropertiesFile { return (IProperty)addProperty(PropertiesElementFactory.createProperty(getProject(), key, value)); } - @NotNull - @Override - public IProperty addPropertyFirst(String key, String value) { - return (IProperty)addPropertyAfter((Property) PropertiesElementFactory.createProperty(getProject(), key, value), null); - } - - @NotNull - @Override - public IProperty addPropertyLast(String key, String value) { - return addProperty(key, value); - } - @NotNull @Override public IProperty addPropertyAfter(String key, String value, @Nullable Property anchor) { @@ -208,6 +219,14 @@ public class PropertiesFileImpl extends PsiFileBase implements PropertiesFile { return result; } + @Override + public boolean isAlphaSorted() { + synchronized (lock) { + ensurePropertiesLoaded(); + return myAlphaSorted; + } + } + @Override public void clearCaches() { super.clearCaches(); diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesFileImpl.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesFileImpl.java index b110dc429d74..a3a94c8f7f18 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesFileImpl.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesFileImpl.java @@ -120,16 +120,6 @@ public class XmlPropertiesFileImpl extends XmlPropertiesFile { return null; } - @Override - public IProperty addPropertyFirst(String key, String value) { - return null; - } - - @Override - public IProperty addPropertyLast(String key, String value) { - return null; - } - @Override public IProperty addPropertyAfter(String key, String value, Property anchor) { return null; @@ -202,6 +192,11 @@ public class XmlPropertiesFileImpl extends XmlPropertiesFile { return getContainingFile().getText(); } + @Override + public boolean isAlphaSorted() { + return PropertiesImplUtil.isAlphaSorted(getProperties()); + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertiesInsertManagerImpl.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertiesInsertManagerImpl.java index 213b0f2c47cc..fa1ac625769c 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertiesInsertManagerImpl.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertiesInsertManagerImpl.java @@ -65,17 +65,9 @@ public class ResourceBundlePropertiesInsertManagerImpl implements ResourceBundle } final PropertiesFile propertiesFile = myResourceBundle.getDefaultPropertiesFile(); if (myAlphaSorted) { - final Pair propertyAndPosition = findExistedPrevSiblingProperty(key, propertiesFile); - if (propertyAndPosition == null) { - propertiesFile.addPropertyFirst(key, value); - myKeysOrder.add(0, key); - } else { - propertiesFile.addPropertyAfter(key, value, (Property)propertyAndPosition.getFirst()); - final Integer position = propertyAndPosition.getSecond(); - myKeysOrder.add(position, key); - } + propertiesFile.addProperty(key, value); } else { - propertiesFile.addPropertyLast(key, value); + insertPropertyLast(key, value, propertiesFile); if (myOrdered) { myKeysOrder.add(key); } @@ -85,14 +77,14 @@ public class ResourceBundlePropertiesInsertManagerImpl implements ResourceBundle @Override public void insertTranslation(String key, String value, final PropertiesFile propertiesFile) { if (myOrdered) { - final Pair propertyAndPosition = findExistedPrevSiblingProperty(key, propertiesFile); - if (propertyAndPosition == null) { - propertiesFile.addPropertyFirst(key, value); - } else { - propertiesFile.addPropertyAfter(key, value, (Property)propertyAndPosition.getFirst()); + if (myAlphaSorted) { + propertiesFile.addProperty(key, value); + return; } + final Pair propertyAndPosition = findExistedPrevSiblingProperty(key, propertiesFile); + propertiesFile.addPropertyAfter(key, value, propertyAndPosition == null ? null :(Property)propertyAndPosition.getFirst()); } else { - propertiesFile.addPropertyLast(key, value); + insertPropertyLast(key, value, propertiesFile); } } @@ -100,13 +92,7 @@ public class ResourceBundlePropertiesInsertManagerImpl implements ResourceBundle if (myKeysOrder.isEmpty()) { return null; } - final int prevPosition; - if (myAlphaSorted) { - final int rawInsertionPosition = Collections.binarySearch(myKeysOrder, key); - prevPosition = rawInsertionPosition < 0 ? - rawInsertionPosition - 2 : rawInsertionPosition - 1; - } else { - prevPosition = myKeysOrder.indexOf(key); - } + final int prevPosition = myKeysOrder.indexOf(key); for (int i = prevPosition; i >= 0 ; i--) { final String prevKey = myKeysOrder.get(i); final IProperty property = file.findPropertyByKey(prevKey); @@ -117,6 +103,12 @@ public class ResourceBundlePropertiesInsertManagerImpl implements ResourceBundle return null; } + public void insertPropertyLast(String key, String value, PropertiesFile propertiesFile) { + final List properties = propertiesFile.getProperties(); + final IProperty lastProperty = properties.isEmpty() ? null : properties.get(properties.size() - 1); + propertiesFile.addPropertyAfter(key, value, (Property)lastProperty); + } + @Override public void reload() { final List keysOrder = keysOrder(myResourceBundle); @@ -124,7 +116,7 @@ public class ResourceBundlePropertiesInsertManagerImpl implements ResourceBundle if (myOrdered) { Collections.reverse(keysOrder); myAlphaSorted = isAlphaSorted(keysOrder); - myKeysOrder = keysOrder; + myKeysOrder = myAlphaSorted ? null : keysOrder; } else { myKeysOrder = null; } From 4b93f0346d194665df05f85e1fcacf985bef9e79 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Wed, 11 Feb 2015 12:19:40 +0300 Subject: [PATCH 05/11] editor settings statistics --- .../EditorSettingsStatisticsCollector.java | 122 ++++++++++++++++++ .../src/META-INF/LangExtensions.xml | 1 + 2 files changed, 123 insertions(+) create mode 100644 platform/lang-impl/src/com/intellij/internal/statistic/editor/EditorSettingsStatisticsCollector.java diff --git a/platform/lang-impl/src/com/intellij/internal/statistic/editor/EditorSettingsStatisticsCollector.java b/platform/lang-impl/src/com/intellij/internal/statistic/editor/EditorSettingsStatisticsCollector.java new file mode 100644 index 000000000000..f2591af1689f --- /dev/null +++ b/platform/lang-impl/src/com/intellij/internal/statistic/editor/EditorSettingsStatisticsCollector.java @@ -0,0 +1,122 @@ +/* + * Copyright 2000-2015 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.internal.statistic.editor; + +import com.intellij.codeInsight.CodeInsightSettings; +import com.intellij.codeInsight.editorActions.SmartBackspaceMode; +import com.intellij.internal.statistic.CollectUsagesException; +import com.intellij.internal.statistic.UsagesCollector; +import com.intellij.internal.statistic.beans.GroupDescriptor; +import com.intellij.internal.statistic.beans.UsageDescriptor; +import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; +import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces; +import com.intellij.openapi.editor.richcopy.settings.RichCopySettings; +import com.intellij.openapi.util.Comparing; +import org.jetbrains.annotations.NotNull; + +import java.util.HashSet; +import java.util.Set; + +class EditorSettingsStatisticsCollector extends UsagesCollector { + @NotNull + @Override + public GroupDescriptor getGroupId() { + return GroupDescriptor.create("Editor"); + } + + @NotNull + @Override + public Set getUsages() throws CollectUsagesException { + Set set = new HashSet(); + + EditorSettingsExternalizable es = EditorSettingsExternalizable.getInstance(); + addIfDiffers(set, es.isVirtualSpace(), false, "caretAfterLineEnd"); + addIfDiffers(set, es.isCaretInsideTabs(), false, "caretInsideTabs"); + addIfDiffers(set, es.isAdditionalPageAtBottom(), false, "virtualSpaceAtFileBottom"); + addIfDiffers(set, es.isUseSoftWraps(SoftWrapAppliancePlaces.MAIN_EDITOR), false, "softWraps"); + addIfDiffers(set, es.isUseSoftWraps(SoftWrapAppliancePlaces.CONSOLE), false, "softWraps.console"); + addIfDiffers(set, es.isUseCustomSoftWrapIndent(), false, "softWraps.relativeIndent"); + addIfDiffers(set, es.isAllSoftWrapsShown(), false, "softWraps.showAll"); + addIfDiffers(set, es.getStripTrailingSpaces(), EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED, "stripTrailingSpaces"); + addIfDiffers(set, es.isEnsureNewLineAtEOF(), false, "ensureNewlineAtEOF"); + addIfDiffers(set, es.isShowQuickDocOnMouseOverElement(), false, "quickDocOnMouseHover"); + addIfDiffers(set, es.isBlinkCaret(), true, "nonBlinkingCaret"); + addIfDiffers(set, es.isBlockCursor(), false, "blockCaret"); + addIfDiffers(set, es.isRightMarginShown(), true, "noRightMargin"); + addIfDiffers(set, es.isLineNumbersShown(), false, "lineNumbers"); + addIfDiffers(set, es.isFoldingOutlineShown(), true, "noFoldingOutline"); + addIfDiffers(set, es.isWhitespacesShown() && es.isLeadingWhitespacesShown(), false, "showLeadingWhitespace"); + addIfDiffers(set, es.isWhitespacesShown() && es.isInnerWhitespacesShown(), false, "showInnerWhitespace"); + addIfDiffers(set, es.isWhitespacesShown() && es.isTrailingWhitespacesShown(), false, "showTrailingWhitespace"); + addIfDiffers(set, es.isIndentGuidesShown(), true, "noIndentGuides"); + addIfDiffers(set, es.isSmoothScrolling(), true, "noAnimatedScroll"); + addIfDiffers(set, es.isDndEnabled(), false, "dragNDrop"); + addIfDiffers(set, es.isWheelFontChangeEnabled(), false, "wheelZoom"); + addIfDiffers(set, es.isMouseClickSelectionHonorsCamelWords(), true, "mouseNoCamel"); + addIfDiffers(set, es.isVariableInplaceRenameEnabled(), true, "noInplaceRename"); + addIfDiffers(set, es.isPreselectRename(), true, "noPreselectOnRename"); + addIfDiffers(set, es.isShowInlineLocalDialog(), true, "noInlineDialog"); + addIfDiffers(set, es.isRefrainFromScrolling(), false, "minimizeScrolling"); + addIfDiffers(set, es.getOptions().SHOW_REFORMAT_DIALOG, true, "noReformatDialog"); + addIfDiffers(set, es.getOptions().SHOW_OPIMIZE_IMPORTS_DIALOG, true, "noOptimizeImportsDialog"); + addIfDiffers(set, es.isSmartHome(), true, "noSmartHome"); + addIfDiffers(set, es.isCamelWords(), false, "camelWords"); + + RichCopySettings rcs = RichCopySettings.getInstance(); + addIfDiffers(set, rcs.isEnabled(), true, "noRichCopy"); + + CodeInsightSettings cis = CodeInsightSettings.getInstance(); + addIfDiffers(set, cis.AUTO_POPUP_PARAMETER_INFO, true, "noParameterAutoPopup"); + addIfDiffers(set, cis.AUTO_POPUP_JAVADOC_INFO, false, "javadocAutoPopup"); + addIfDiffers(set, cis.AUTO_POPUP_COMPLETION_LOOKUP, true, "noCompletionAutoPopup"); + addIfDiffers(set, cis.COMPLETION_CASE_SENSITIVE, CodeInsightSettings.FIRST_LETTER, "completionCaseSensitivity"); + addIfDiffers(set, cis.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS, false, "autoPopupCharComplete"); + addIfDiffers(set, cis.AUTOCOMPLETE_ON_CODE_COMPLETION, true, "noAutoCompleteBasic"); + addIfDiffers(set, cis.AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION, true, "noAutoCompleteSmart"); + addIfDiffers(set, cis.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO, false, "parameterInfoFullSignature"); + addIfDiffers(set, cis.getBackspaceMode(), SmartBackspaceMode.AUTOINDENT, "smartBackspace"); + addIfDiffers(set, cis.SMART_INDENT_ON_ENTER, true, "noIndentOnEnter"); + addIfDiffers(set, cis.INSERT_BRACE_ON_ENTER, true, "noBraceOnEnter"); + addIfDiffers(set, cis.JAVADOC_STUB_ON_ENTER, true, "noJavadocOnEnter"); + addIfDiffers(set, cis.SMART_END_ACTION, true, "noSmartEnd"); + addIfDiffers(set, cis.JAVADOC_GENERATE_CLOSING_TAG, true, "noAutoCloseJavadocTags"); + addIfDiffers(set, cis.SURROUND_SELECTION_ON_QUOTE_TYPED, false, "surroundByQuoteOrBrace"); + addIfDiffers(set, cis.AUTOINSERT_PAIR_BRACKET, true, "noPairBracketAutoInsert"); + addIfDiffers(set, cis.AUTOINSERT_PAIR_QUOTE, true, "noPairQuoteAutoInsert"); + addIfDiffers(set, cis.REFORMAT_BLOCK_ON_RBRACE, true, "noReformatOnRBrace"); + addIfDiffers(set, cis.REFORMAT_ON_PASTE, CodeInsightSettings.INDENT_EACH_LINE, "reformatOnPaste"); + addIfDiffers(set, cis.ADD_IMPORTS_ON_PASTE, CodeInsightSettings.ASK, "importsOnPaste"); + addIfDiffers(set, cis.HIGHLIGHT_BRACES, true, "noBracesHighlight"); + addIfDiffers(set, cis.HIGHLIGHT_SCOPE, false, "scopeHighlight"); + addIfDiffers(set, cis.HIGHLIGHT_IDENTIFIER_UNDER_CARET, true, "noIdentifierUnderCaretHighlight"); + addIfDiffers(set, cis.OPTIMIZE_IMPORTS_ON_THE_FLY, false, "autoOptimizeImports"); + addIfDiffers(set, cis.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY, false, "autoAddImports"); + + return set; + } + + private static void addIfDiffers(Set set, boolean value, boolean defaultValue, String featureId) { + if (value != defaultValue) { + set.add(new UsageDescriptor(featureId, 1)); + } + } + + private static void addIfDiffers(Set set, Object value, Object defaultValue, String featureIdPrefix) { + if (!Comparing.equal(value, defaultValue)) { + set.add(new UsageDescriptor(featureIdPrefix + "." + value, 1)); + } + } +} diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index 65f8821d530a..091211c6d028 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -813,6 +813,7 @@ + From ce62eac5056e41bbf893ffa1d4badde3fb7105cd Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Wed, 11 Feb 2015 11:29:05 +0300 Subject: [PATCH 06/11] Detect indent notification: refactoring, made LabelWithAction inner class of EditorNotificationInfo --- .../psi/codeStyle/EditorNotificationInfo.java | 11 +++++++ .../psi/codeStyle/LabelWithAction.java | 29 ------------------- .../DetectableIndentOptionsProvider.java | 2 ++ ...ctedIndentOptionsNotificationProvider.java | 2 ++ 4 files changed, 15 insertions(+), 29 deletions(-) delete mode 100644 platform/lang-api/src/com/intellij/psi/codeStyle/LabelWithAction.java diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java index 59315c245631..e937357cd692 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java @@ -64,6 +64,17 @@ public class EditorNotificationInfo { return myTitle; } + + public static class LabelWithAction { + public final String label; + public final Runnable action; + + public LabelWithAction(@NotNull String label, @NotNull Runnable action) { + this.label = label; + this.action = action; + } + } + } diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/LabelWithAction.java b/platform/lang-api/src/com/intellij/psi/codeStyle/LabelWithAction.java deleted file mode 100644 index b39afc320102..000000000000 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/LabelWithAction.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2000-2015 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.psi.codeStyle; - -import org.jetbrains.annotations.NotNull; - -public class LabelWithAction { - - public final String label; - public final Runnable action; - - public LabelWithAction(@NotNull String label, @NotNull Runnable action) { - this.label = label; - this.action = action; - } -} diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java index 1687817f5a22..1606e5dc64a0 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java @@ -35,6 +35,8 @@ import org.jetbrains.annotations.TestOnly; import java.util.List; +import static com.intellij.psi.codeStyle.EditorNotificationInfo.*; + /** * @author Rustam Vishnyakov */ diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java index b0be0cee284f..9035aa334dcb 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java @@ -32,6 +32,8 @@ import com.intellij.util.Processor; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import static com.intellij.psi.codeStyle.EditorNotificationInfo.*; + /** * @author Rustam Vishnyakov */ From 8721aef9026564153f02e218798c146e28697dea Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Wed, 11 Feb 2015 11:48:15 +0300 Subject: [PATCH 07/11] Detect Indent Notification: refactoring: added flag to updateAllNotification on action finish --- .../psi/codeStyle/EditorNotificationInfo.java | 6 ++++++ .../DetectableIndentOptionsProvider.java | 9 +++------ .../DetectedIndentOptionsNotificationProvider.java | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java index e937357cd692..429cbbca6742 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java @@ -68,11 +68,17 @@ public class EditorNotificationInfo { public static class LabelWithAction { public final String label; public final Runnable action; + public boolean updateAllNotificationsOnFinish; public LabelWithAction(@NotNull String label, @NotNull Runnable action) { this.label = label; this.action = action; } + + public LabelWithAction setUpdateAllNotificationsOnActionEnd(boolean value) { + updateAllNotificationsOnFinish = value; + return this; + } } } diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java index 1606e5dc64a0..320de2a70e7c 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java @@ -94,10 +94,9 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { @Override public void run() { setAccepted(file); - EditorNotifications.getInstance(project).updateAllNotifications(); } } - ); + ).setUpdateAllNotificationsOnActionEnd(true); LabelWithAction disableForSingleFile = new LabelWithAction( labels.revertToOldSettingsLabel, @@ -108,10 +107,9 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { if (editor instanceof EditorEx) { ((EditorEx)editor).reinitSettings(); } - EditorNotifications.getInstance(project).updateAllNotifications(); } } - ); + ).setUpdateAllNotificationsOnActionEnd(true); LabelWithAction showSettings = new LabelWithAction( ApplicationBundle.message("code.style.indents.detector.show.settings"), @@ -120,10 +118,9 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { public void run() { ShowSettingsUtilImpl.showSettingsDialog(project, "preferences.sourceCode", ApplicationBundle.message("settings.code.style.general.autodetect.indents")); - EditorNotifications.getInstance(project).updateAllNotifications(); } } - ); + ).setUpdateAllNotificationsOnActionEnd(true); return new EditorNotificationInfo(labels.title, okAction, disableForSingleFile, showSettings); } diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java index 9035aa334dcb..7e23d577094c 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java @@ -79,8 +79,18 @@ public class DetectedIndentOptionsNotificationProvider extends EditorNotificatio if (info.getIcon() != null) { panel.icon(info.getIcon()); } - for (LabelWithAction action : info.getLabelAndActions()) { - panel.createActionLabel(action.label, action.action); + for (final LabelWithAction actionLabelData : info.getLabelAndActions()) { + Runnable onClickAction = actionLabelData.action; + if (actionLabelData.updateAllNotificationsOnFinish) { + onClickAction = new Runnable() { + @Override + public void run() { + actionLabelData.action.run(); + EditorNotifications.getInstance(project).updateAllNotifications(); + } + }; + } + panel.createActionLabel(actionLabelData.label, onClickAction); } return panel; } From d0d37fc9c4f995202b8de57bcfc05c015759a489 Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Wed, 11 Feb 2015 11:49:58 +0300 Subject: [PATCH 08/11] Detect Indent Notification: renamed LabelWithAction into ActionLabelData --- .../psi/codeStyle/EditorNotificationInfo.java | 18 +++++++++--------- .../DetectableIndentOptionsProvider.java | 7 +++---- ...ectedIndentOptionsNotificationProvider.java | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java index 429cbbca6742..c71c68fc319d 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java @@ -27,11 +27,11 @@ public class EditorNotificationInfo { private String myTitle; private Icon myIcon; - private List myLabelsWithActions = ContainerUtil.newArrayList(); + private List myLabelsWithActions = ContainerUtil.newArrayList(); public EditorNotificationInfo(@NotNull String title, - @NotNull LabelWithAction firstLabel, - @Nullable LabelWithAction... otherLabels) + @NotNull ActionLabelData firstLabel, + @Nullable ActionLabelData... otherLabels) { myTitle = title; myLabelsWithActions.add(firstLabel); @@ -42,15 +42,15 @@ public class EditorNotificationInfo { public EditorNotificationInfo(@NotNull String title, @NotNull Icon icon, - @NotNull LabelWithAction firstLabel, - @Nullable LabelWithAction... otherLabels) + @NotNull ActionLabelData firstLabel, + @Nullable ActionLabelData... otherLabels) { this(title, firstLabel, otherLabels); myIcon = icon; } @NotNull - public List getLabelAndActions() { + public List getLabelAndActions() { return myLabelsWithActions; } @@ -65,17 +65,17 @@ public class EditorNotificationInfo { } - public static class LabelWithAction { + public static class ActionLabelData { public final String label; public final Runnable action; public boolean updateAllNotificationsOnFinish; - public LabelWithAction(@NotNull String label, @NotNull Runnable action) { + public ActionLabelData(@NotNull String label, @NotNull Runnable action) { this.label = label; this.action = action; } - public LabelWithAction setUpdateAllNotificationsOnActionEnd(boolean value) { + public ActionLabelData setUpdateAllNotificationsOnActionEnd(boolean value) { updateAllNotificationsOnFinish = value; return this; } diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java index 320de2a70e7c..0b1e26f616be 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java @@ -27,7 +27,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.*; import com.intellij.testFramework.LightVirtualFile; -import com.intellij.ui.EditorNotifications; import com.intellij.util.containers.WeakList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -88,7 +87,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { final Editor editor = fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null; if (labels == null || editor == null) return null; - LabelWithAction okAction = new LabelWithAction( + ActionLabelData okAction = new ActionLabelData( ApplicationBundle.message("code.style.indents.detector.accept"), new Runnable() { @Override @@ -98,7 +97,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { } ).setUpdateAllNotificationsOnActionEnd(true); - LabelWithAction disableForSingleFile = new LabelWithAction( + ActionLabelData disableForSingleFile = new ActionLabelData( labels.revertToOldSettingsLabel, new Runnable() { @Override @@ -111,7 +110,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { } ).setUpdateAllNotificationsOnActionEnd(true); - LabelWithAction showSettings = new LabelWithAction( + ActionLabelData showSettings = new ActionLabelData( ApplicationBundle.message("code.style.indents.detector.show.settings"), new Runnable() { @Override diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java index 7e23d577094c..c50a0d487e0d 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java @@ -79,7 +79,7 @@ public class DetectedIndentOptionsNotificationProvider extends EditorNotificatio if (info.getIcon() != null) { panel.icon(info.getIcon()); } - for (final LabelWithAction actionLabelData : info.getLabelAndActions()) { + for (final ActionLabelData actionLabelData : info.getLabelAndActions()) { Runnable onClickAction = actionLabelData.action; if (actionLabelData.updateAllNotificationsOnFinish) { onClickAction = new Runnable() { From 8c387992449d6a9996b5a05aff98a59b017cfb1a Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Wed, 11 Feb 2015 12:07:18 +0300 Subject: [PATCH 09/11] Detect Indent Notification: updating all notifications on after every action --- .../psi/codeStyle/EditorNotificationInfo.java | 6 ------ .../DetectableIndentOptionsProvider.java | 6 +++--- ...tectedIndentOptionsNotificationProvider.java | 17 +++++++---------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java index c71c68fc319d..4787fa37d0de 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java @@ -68,17 +68,11 @@ public class EditorNotificationInfo { public static class ActionLabelData { public final String label; public final Runnable action; - public boolean updateAllNotificationsOnFinish; public ActionLabelData(@NotNull String label, @NotNull Runnable action) { this.label = label; this.action = action; } - - public ActionLabelData setUpdateAllNotificationsOnActionEnd(boolean value) { - updateAllNotificationsOnFinish = value; - return this; - } } } diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java index 0b1e26f616be..fb1ddb804f12 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java @@ -95,7 +95,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { setAccepted(file); } } - ).setUpdateAllNotificationsOnActionEnd(true); + ); ActionLabelData disableForSingleFile = new ActionLabelData( labels.revertToOldSettingsLabel, @@ -108,7 +108,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { } } } - ).setUpdateAllNotificationsOnActionEnd(true); + ); ActionLabelData showSettings = new ActionLabelData( ApplicationBundle.message("code.style.indents.detector.show.settings"), @@ -119,7 +119,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { ApplicationBundle.message("settings.code.style.general.autodetect.indents")); } } - ).setUpdateAllNotificationsOnActionEnd(true); + ); return new EditorNotificationInfo(labels.title, okAction, disableForSingleFile, showSettings); } diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java index c50a0d487e0d..078d8f5eff0f 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java @@ -80,16 +80,13 @@ public class DetectedIndentOptionsNotificationProvider extends EditorNotificatio panel.icon(info.getIcon()); } for (final ActionLabelData actionLabelData : info.getLabelAndActions()) { - Runnable onClickAction = actionLabelData.action; - if (actionLabelData.updateAllNotificationsOnFinish) { - onClickAction = new Runnable() { - @Override - public void run() { - actionLabelData.action.run(); - EditorNotifications.getInstance(project).updateAllNotifications(); - } - }; - } + Runnable onClickAction = new Runnable() { + @Override + public void run() { + actionLabelData.action.run(); + EditorNotifications.getInstance(project).updateAllNotifications(); + } + }; panel.createActionLabel(actionLabelData.label, onClickAction); } return panel; From 7af0c70ead4903288a30889a59b4ef23b11673ec Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Wed, 11 Feb 2015 12:12:54 +0300 Subject: [PATCH 10/11] Detect Indent Notification: EditorNotification info made abstract --- .../psi/codeStyle/EditorNotificationInfo.java | 45 +++---------------- .../DetectableIndentOptionsProvider.java | 18 +++++++- 2 files changed, 23 insertions(+), 40 deletions(-) diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java index 4787fa37d0de..8455382bf1e6 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/EditorNotificationInfo.java @@ -15,56 +15,25 @@ */ package com.intellij.psi.codeStyle; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.*; -import java.util.Collections; +import javax.swing.Icon; import java.util.List; -public class EditorNotificationInfo { - - private String myTitle; - private Icon myIcon; - private List myLabelsWithActions = ContainerUtil.newArrayList(); - - public EditorNotificationInfo(@NotNull String title, - @NotNull ActionLabelData firstLabel, - @Nullable ActionLabelData... otherLabels) - { - myTitle = title; - myLabelsWithActions.add(firstLabel); - if (otherLabels != null) { - Collections.addAll(myLabelsWithActions, otherLabels); - } - } - - public EditorNotificationInfo(@NotNull String title, - @NotNull Icon icon, - @NotNull ActionLabelData firstLabel, - @Nullable ActionLabelData... otherLabels) - { - this(title, firstLabel, otherLabels); - myIcon = icon; - } +public abstract class EditorNotificationInfo { @NotNull - public List getLabelAndActions() { - return myLabelsWithActions; - } + public abstract List getLabelAndActions(); + + @NotNull + public abstract String getTitle(); @Nullable public Icon getIcon() { - return myIcon; + return null; } - @NotNull - public String getTitle() { - return myTitle; - } - - public static class ActionLabelData { public final String label; public final Runnable action; diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java index fb1ddb804f12..7dc8bdbd2dd3 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java @@ -27,6 +27,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.*; import com.intellij.testFramework.LightVirtualFile; +import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.WeakList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -83,7 +84,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { @NotNull CommonCodeStyleSettings.IndentOptions userOptions, @NotNull CommonCodeStyleSettings.IndentOptions detectedOptions) { - NotificationLabels labels = getNotificationLabels(userOptions, detectedOptions); + final NotificationLabels labels = getNotificationLabels(userOptions, detectedOptions); final Editor editor = fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null; if (labels == null || editor == null) return null; @@ -121,7 +122,20 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { } ); - return new EditorNotificationInfo(labels.title, okAction, disableForSingleFile, showSettings); + final List actions = ContainerUtil.newArrayList(okAction, disableForSingleFile, showSettings); + return new EditorNotificationInfo() { + @NotNull + @Override + public List getLabelAndActions() { + return actions; + } + + @NotNull + @Override + public String getTitle() { + return labels.title; + } + }; } @Nullable From dbeac272f865b54a1ed63142df6ce7ddefdb3500 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 11 Feb 2015 12:33:08 +0300 Subject: [PATCH 11/11] IDEA-136331 View text popups does not appear - reverted faulty change --- .../src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java index 6758d5e9b356..43f159e5b6db 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -127,8 +127,8 @@ public class DebuggerUIUtil { JComponent component, @Nullable final FullValueEvaluationCallbackImpl callback) { ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(component, null); - builder.setResizable(true).setAlpha(1) - .setMovable(true) + builder.setResizable(true)/*.setAlpha(1)*/ // alpha disabled because of IDEA-136331 + .setMovable(true) .setDimensionServiceKey(project, FULL_VALUE_POPUP_DIMENSION_KEY, false) .setRequestFocus(false); if (callback != null) {