diff --git a/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectSettingsGroup.java b/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectSettingsGroup.java index 13cd06844bca..43a25fe47005 100644 --- a/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectSettingsGroup.java +++ b/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectSettingsGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -21,33 +21,29 @@ package com.intellij.ide.actions; import com.intellij.execution.actions.EditRunConfigurationsAction; import com.intellij.icons.AllIcons; +import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.openapi.actionSystem.Presentation; +import javax.swing.*; + public class TemplateProjectSettingsGroup extends DefaultActionGroup { public TemplateProjectSettingsGroup() { setPopup(true); - Presentation presentation = getTemplatePresentation(); + Presentation presentation = getTemplatePresentation(); presentation.setText("Project Defaults"); presentation.setIcon(AllIcons.General.TemplateProjectSettings); - add(new TemplateProjectPropertiesAction() {{ - Presentation p = getTemplatePresentation(); - p.setText("Settings"); - p.setIcon(AllIcons.General.TemplateProjectSettings); - }}); - - add(new TemplateProjectStructureAction(){{ - Presentation p = getTemplatePresentation(); - p.setText("Project Structure"); - p.setIcon(AllIcons.General.TemplateProjectStructure); - }}); - - add(new EditRunConfigurationsAction() {{ - Presentation p = getTemplatePresentation(); - p.setText("Run Configurations"); - p.setIcon(AllIcons.General.CreateNewProjectfromExistingFiles); - }}); + add(withTextAndIcon(new TemplateProjectPropertiesAction(), "Settings", AllIcons.General.TemplateProjectSettings)); + add(withTextAndIcon(new TemplateProjectStructureAction(), "Project Structure", AllIcons.General.TemplateProjectStructure)); + add(withTextAndIcon(new EditRunConfigurationsAction(), "Run Configurations", AllIcons.General.CreateNewProjectfromExistingFiles)); } -} + + private static AnAction withTextAndIcon(AnAction action, String text, Icon icon) { + Presentation presentation = action.getTemplatePresentation(); + presentation.setText(text); + presentation.setIcon(icon); + return action; + } +} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/windows/WindowsCryptUtils.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/windows/WindowsCryptUtils.java index 159f8a523e50..2858fb554607 100644 --- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/windows/WindowsCryptUtils.java +++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/windows/WindowsCryptUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -16,6 +16,7 @@ package com.intellij.ide.passwordSafe.impl.providers.masterKey.windows; import com.intellij.ide.passwordSafe.MasterPasswordUnavailableException; +import com.intellij.util.containers.ContainerUtil; import com.sun.jna.Memory; import com.sun.jna.Native; import com.sun.jna.Pointer; @@ -25,10 +26,10 @@ import com.sun.jna.win32.W32APIFunctionMapper; import com.sun.jna.win32.W32APITypeMapper; import java.util.Arrays; -import java.util.HashMap; import java.util.List; import java.util.Map; +import static com.intellij.openapi.util.Pair.pair; import static com.sun.jna.Library.OPTION_FUNCTION_MAPPER; import static com.sun.jna.Library.OPTION_TYPE_MAPPER; @@ -39,10 +40,9 @@ public class WindowsCryptUtils { /** * Unicode options for the libraries */ - static final Map UNICODE_OPTIONS = new HashMap() {{ - put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE); - put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE); - }}; + private static final Map UNICODE_OPTIONS = ContainerUtil.newHashMap( + pair(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE), + pair(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE)); private WindowsCryptUtils() { } @@ -143,4 +143,4 @@ public class WindowsCryptUtils { Pointer LocalFree(Pointer hMem); W32API.DWORD GetLastError(); } -} +} \ No newline at end of file diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassWriter.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassWriter.java index dc0f3fcaa32b..b438695f4110 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassWriter.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassWriter.java @@ -980,19 +980,21 @@ public class ClassWriter { } } - private static final Map MODIFIERS = new LinkedHashMap() {{ - put(CodeConstants.ACC_PUBLIC, "public"); - put(CodeConstants.ACC_PROTECTED, "protected"); - put(CodeConstants.ACC_PRIVATE, "private"); - put(CodeConstants.ACC_ABSTRACT, "abstract"); - put(CodeConstants.ACC_STATIC, "static"); - put(CodeConstants.ACC_FINAL, "final"); - put(CodeConstants.ACC_STRICT, "strictfp"); - put(CodeConstants.ACC_TRANSIENT, "transient"); - put(CodeConstants.ACC_VOLATILE, "volatile"); - put(CodeConstants.ACC_SYNCHRONIZED, "synchronized"); - put(CodeConstants.ACC_NATIVE, "native"); - }}; + private static final Map MODIFIERS; + static { + MODIFIERS = new LinkedHashMap<>(); + MODIFIERS.put(CodeConstants.ACC_PUBLIC, "public"); + MODIFIERS.put(CodeConstants.ACC_PROTECTED, "protected"); + MODIFIERS.put(CodeConstants.ACC_PRIVATE, "private"); + MODIFIERS.put(CodeConstants.ACC_ABSTRACT, "abstract"); + MODIFIERS.put(CodeConstants.ACC_STATIC, "static"); + MODIFIERS.put(CodeConstants.ACC_FINAL, "final"); + MODIFIERS.put(CodeConstants.ACC_STRICT, "strictfp"); + MODIFIERS.put(CodeConstants.ACC_TRANSIENT, "transient"); + MODIFIERS.put(CodeConstants.ACC_VOLATILE, "volatile"); + MODIFIERS.put(CodeConstants.ACC_SYNCHRONIZED, "synchronized"); + MODIFIERS.put(CodeConstants.ACC_NATIVE, "native"); + } private static final int CLASS_ALLOWED = CodeConstants.ACC_PUBLIC | CodeConstants.ACC_PROTECTED | CodeConstants.ACC_PRIVATE | CodeConstants.ACC_ABSTRACT | diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java index cd6333b003cd..c1ceecd3b4f4 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -59,37 +59,43 @@ public interface IFernflowerPreferences { String LINE_SEPARATOR_WIN = "\r\n"; String LINE_SEPARATOR_UNX = "\n"; - Map DEFAULTS = Collections.unmodifiableMap(new HashMap() {{ - put(REMOVE_BRIDGE, "1"); - put(REMOVE_SYNTHETIC, "0"); - put(DECOMPILE_INNER, "1"); - put(DECOMPILE_CLASS_1_4, "1"); - put(DECOMPILE_ASSERTIONS, "1"); - put(HIDE_EMPTY_SUPER, "1"); - put(HIDE_DEFAULT_CONSTRUCTOR, "1"); - put(DECOMPILE_GENERIC_SIGNATURES, "0"); - put(NO_EXCEPTIONS_RETURN, "1"); - put(DECOMPILE_ENUM, "1"); - put(REMOVE_GET_CLASS_NEW, "1"); - put(LITERALS_AS_IS, "0"); - put(BOOLEAN_TRUE_ONE, "1"); - put(ASCII_STRING_CHARACTERS, "0"); - put(SYNTHETIC_NOT_SET, "1"); - put(UNDEFINED_PARAM_TYPE_OBJECT, "1"); - put(USE_DEBUG_VAR_NAMES, "1"); - put(REMOVE_EMPTY_RANGES, "1"); - put(FINALLY_DEINLINE, "1"); - put(IDEA_NOT_NULL_ANNOTATION, "1"); - put(LAMBDA_TO_ANONYMOUS_CLASS, "0"); - put(BYTECODE_SOURCE_MAPPING, "0"); + Map DEFAULTS = getDefaults(); - put(LOG_LEVEL, IFernflowerLogger.Severity.INFO.name()); - put(MAX_PROCESSING_METHOD, "0"); - put(RENAME_ENTITIES, "0"); - put(NEW_LINE_SEPARATOR, (InterpreterUtil.IS_WINDOWS ? "0" : "1")); - put(INDENT_STRING, " "); - put(BANNER, ""); - put(UNIT_TEST_MODE, "0"); - put(DUMP_ORIGINAL_LINES, "0"); - }}); -} + static Map getDefaults() { + Map defaults = new HashMap<>(); + + defaults.put(REMOVE_BRIDGE, "1"); + defaults.put(REMOVE_SYNTHETIC, "0"); + defaults.put(DECOMPILE_INNER, "1"); + defaults.put(DECOMPILE_CLASS_1_4, "1"); + defaults.put(DECOMPILE_ASSERTIONS, "1"); + defaults.put(HIDE_EMPTY_SUPER, "1"); + defaults.put(HIDE_DEFAULT_CONSTRUCTOR, "1"); + defaults.put(DECOMPILE_GENERIC_SIGNATURES, "0"); + defaults.put(NO_EXCEPTIONS_RETURN, "1"); + defaults.put(DECOMPILE_ENUM, "1"); + defaults.put(REMOVE_GET_CLASS_NEW, "1"); + defaults.put(LITERALS_AS_IS, "0"); + defaults.put(BOOLEAN_TRUE_ONE, "1"); + defaults.put(ASCII_STRING_CHARACTERS, "0"); + defaults.put(SYNTHETIC_NOT_SET, "1"); + defaults.put(UNDEFINED_PARAM_TYPE_OBJECT, "1"); + defaults.put(USE_DEBUG_VAR_NAMES, "1"); + defaults.put(REMOVE_EMPTY_RANGES, "1"); + defaults.put(FINALLY_DEINLINE, "1"); + defaults.put(IDEA_NOT_NULL_ANNOTATION, "1"); + defaults.put(LAMBDA_TO_ANONYMOUS_CLASS, "0"); + defaults.put(BYTECODE_SOURCE_MAPPING, "0"); + + defaults.put(LOG_LEVEL, IFernflowerLogger.Severity.INFO.name()); + defaults.put(MAX_PROCESSING_METHOD, "0"); + defaults.put(RENAME_ENTITIES, "0"); + defaults.put(NEW_LINE_SEPARATOR, (InterpreterUtil.IS_WINDOWS ? "0" : "1")); + defaults.put(INDENT_STRING, " "); + defaults.put(BANNER, ""); + defaults.put(UNIT_TEST_MODE, "0"); + defaults.put(DUMP_ORIGINAL_LINES, "0"); + + return Collections.unmodifiableMap(defaults); + } +} \ No newline at end of file diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java index 4b9b687382d9..8fcf176a8b90 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import org.jetbrains.java.decompiler.struct.gen.FieldDescriptor; import org.jetbrains.java.decompiler.struct.gen.VarType; import org.jetbrains.java.decompiler.struct.match.MatchEngine; import org.jetbrains.java.decompiler.struct.match.MatchNode; -import org.jetbrains.java.decompiler.struct.match.IMatchable.MatchProperties; import org.jetbrains.java.decompiler.struct.match.MatchNode.RuleValue; import org.jetbrains.java.decompiler.util.InterpreterUtil; @@ -33,16 +32,18 @@ import java.util.*; import java.util.Map.Entry; public class ConstExprent extends Exprent { - private static final Map ESCAPES = new HashMap() {{ - put(new Integer(0x8), "\\b"); /* \u0008: backspace BS */ - put(new Integer(0x9), "\\t"); /* \u0009: horizontal tab HT */ - put(new Integer(0xA), "\\n"); /* \u000a: linefeed LF */ - put(new Integer(0xC), "\\f"); /* \u000c: form feed FF */ - put(new Integer(0xD), "\\r"); /* \u000d: carriage return CR */ - put(new Integer(0x22), "\\\""); /* \u0022: double quote " */ - put(new Integer(0x27), "\\\'"); /* \u0027: single quote ' */ - put(new Integer(0x5C), "\\\\"); /* \u005c: backslash \ */ - }}; + private static final Map ESCAPES; + static { + ESCAPES = new HashMap<>(); + ESCAPES.put(new Integer(0x8), "\\b"); /* \u0008: backspace BS */ + ESCAPES.put(new Integer(0x9), "\\t"); /* \u0009: horizontal tab HT */ + ESCAPES.put(new Integer(0xA), "\\n"); /* \u000a: linefeed LF */ + ESCAPES.put(new Integer(0xC), "\\f"); /* \u000c: form feed FF */ + ESCAPES.put(new Integer(0xD), "\\r"); /* \u000d: carriage return CR */ + ESCAPES.put(new Integer(0x22), "\\\""); /* \u0022: double quote " */ + ESCAPES.put(new Integer(0x27), "\\\'"); /* \u0027: single quote ' */ + ESCAPES.put(new Integer(0x5C), "\\\\"); /* \u005c: backslash \ */ + } private VarType constType; private final Object value; @@ -432,5 +433,4 @@ public class ConstExprent extends Exprent { return true; } - -} +} \ No newline at end of file diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java index f08a52c3a63f..66db90408354 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -41,6 +41,7 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import static com.intellij.openapi.util.Pair.pair; import static com.intellij.openapi.util.text.StringUtil.startsWithIgnoreCase; public class XmlEmmetParser extends EmmetParser { @@ -57,23 +58,23 @@ public class XmlEmmetParser extends EmmetParser { private boolean hasTagContext = false; private final Stack tagLevel = new Stack(); - private static final Map parentChildTagMapping = new HashMap() {{ - put("p", "span"); - put("ul", "li"); - put("ol", "li"); - put("table", "tr"); - put("tr", "td"); - put("tbody", "tr"); - put("thead", "tr"); - put("tfoot", "tr"); - put("colgroup", "col"); - put("select", "option"); - put("optgroup", "option"); - put("audio", "source"); - put("video", "source"); - put("object", "param"); - put("map", "area"); - }}; + private static final Map parentChildTagMapping = ContainerUtil.newHashMap( + pair("p", "span"), + pair("ul", "li"), + pair("ol", "li"), + pair("table", "tr"), + pair("tr", "td"), + pair("tbody", "tr"), + pair("thead", "tr"), + pair("tfoot", "tr"), + pair("colgroup", "col"), + pair("select", "option"), + pair("optgroup", "option"), + pair("audio", "source"), + pair("video", "source"), + pair("object", "param"), + pair("map", "area")); + private boolean isHtml; public XmlEmmetParser(List tokens,