From 34e550f64374f4e341531199741adbd0988ba891 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 3 Apr 2014 20:26:10 +0400 Subject: [PATCH] notnull --- .../src/com/intellij/profile/Profile.java | 3 +- .../openapi/options/ExternalizableScheme.java | 4 +-- .../com/intellij/openapi/options/Scheme.java | 5 ++- .../options/AbstractSchemesManager.java | 5 +-- .../colors/impl/AbstractColorsScheme.java | 5 +-- .../colors/impl/DefaultColorsScheme.java | 4 ++- .../psi/codeStyle/CodeStyleScheme.java | 4 ++- .../codeStyle/CodeStyleSchemesModel.java | 34 +++++-------------- .../options/colors/ColorAndFontOptions.java | 5 +-- .../template/impl/TemplateImpl.java | 6 ++-- .../template/impl/TemplateListPanel.java | 4 +-- .../source/codeStyle/CodeStyleSchemeImpl.java | 21 ++++++------ .../codeStyle/CodeStyleSchemesImpl.java | 7 ++-- .../src/com/intellij/tools/Tool.java | 19 +++++------ .../com/intellij/openapi/keymap/Keymap.java | 5 ++- .../openapi/options/CompoundScheme.java | 5 +-- .../openapi/options/SchemeElement.java | 6 ++-- .../application/options/SaveSchemeDialog.java | 8 +++-- .../openapi/actionSystem/ex/QuickList.java | 5 +-- .../colors/impl/DelegateColorScheme.java | 3 +- .../colors/impl/EditorColorsManagerImpl.java | 6 +--- .../fileTypes/impl/AbstractFileType.java | 10 +++--- .../openapi/keymap/impl/KeymapImpl.java | 23 +++++++++++-- .../openapi/options/SchemesManagerImpl.java | 4 +-- .../util/text/UniqueNameGenerator.java | 14 ++++++-- .../JBTerminalSystemSettingsProvider.java | 16 +++++++++ 26 files changed, 140 insertions(+), 91 deletions(-) diff --git a/platform/analysis-api/src/com/intellij/profile/Profile.java b/platform/analysis-api/src/com/intellij/profile/Profile.java index ad4c4bc01859..89092a686caf 100644 --- a/platform/analysis-api/src/com/intellij/profile/Profile.java +++ b/platform/analysis-api/src/com/intellij/profile/Profile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ public interface Profile extends JDOMExternalizable, Comparable, Scheme { boolean isLocal(); void setName(@NotNull String name); + @Override @NotNull String getName(); diff --git a/platform/core-api/src/com/intellij/openapi/options/ExternalizableScheme.java b/platform/core-api/src/com/intellij/openapi/options/ExternalizableScheme.java index f625ad50da0c..d018a3efa8a4 100644 --- a/platform/core-api/src/com/intellij/openapi/options/ExternalizableScheme.java +++ b/platform/core-api/src/com/intellij/openapi/options/ExternalizableScheme.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,5 +21,5 @@ public interface ExternalizableScheme extends Scheme{ @NotNull ExternalInfo getExternalInfo(); - void setName(String newName); + void setName(@NotNull String newName); } diff --git a/platform/core-api/src/com/intellij/openapi/options/Scheme.java b/platform/core-api/src/com/intellij/openapi/options/Scheme.java index 8d971e6243fd..f0bd8360309c 100644 --- a/platform/core-api/src/com/intellij/openapi/options/Scheme.java +++ b/platform/core-api/src/com/intellij/openapi/options/Scheme.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,9 @@ */ package com.intellij.openapi.options; +import org.jetbrains.annotations.NotNull; + public interface Scheme { + @NotNull String getName(); } diff --git a/platform/core-impl/src/com/intellij/openapi/options/AbstractSchemesManager.java b/platform/core-impl/src/com/intellij/openapi/options/AbstractSchemesManager.java index aff705c1a5c8..d1ed93f3a2be 100644 --- a/platform/core-impl/src/com/intellij/openapi/options/AbstractSchemesManager.java +++ b/platform/core-impl/src/com/intellij/openapi/options/AbstractSchemesManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,6 +70,7 @@ public abstract class AbstractSchemesManager configuredSchemesSet = new HashSet(getSchemes()); Set savedSchemesSet = new HashSet(Arrays.asList(schemes.getSchemes())); - if (!configuredSchemesSet.equals(savedSchemesSet)) return true; - return false; + return !configuredSchemesSet.equals(savedSchemesSet); } public void apply() { @@ -220,26 +220,9 @@ public class CodeStyleSchemesModel { public void copyToProject(final CodeStyleScheme selectedScheme) { myProjectScheme.getCodeStyleSettings().copyFrom(selectedScheme.getCodeStyleSettings()); myDispatcher.getMulticaster().schemeChanged(myProjectScheme); - //if (mySettingsToClone.containsKey(myProjectScheme)) { - // CodeStyleSettings projectSettings = mySettingsToClone.get(myProjectScheme); - // projectSettings.copyFrom(getEditedSchemeSettings(selectedScheme)); - //} - //else { - // mySettingsToClone.put(myProjectScheme, getEditedSchemeSettings(selectedScheme).clone()); - //} - //myDispatcher.getMulticaster().schemeChanged(myProjectScheme); } - private CodeStyleSettings getEditedSchemeSettings(final CodeStyleScheme selectedScheme) { - if (mySettingsToClone.containsKey(selectedScheme)) { - return mySettingsToClone.get(selectedScheme); - } - else { - return selectedScheme.getCodeStyleSettings(); - } - } - - public CodeStyleScheme exportProjectScheme(final String name) { + public CodeStyleScheme exportProjectScheme(@NotNull String name) { CodeStyleScheme newScheme = createNewScheme(name, myProjectScheme); ((CodeStyleSchemeImpl)newScheme).setCodeStyleSettings(getCloneSettings(myProjectScheme)); addScheme(newScheme, false); @@ -250,11 +233,12 @@ public class CodeStyleSchemesModel { public CodeStyleScheme createNewScheme(final String preferredName, final CodeStyleScheme parentScheme) { String name; if (preferredName == null) { + if (parentScheme == null) throw new IllegalArgumentException("parentScheme must not be null"); // Generate using parent name name = null; for (int i = 1; name == null; i++) { String currName = parentScheme.getName() + " (" + i + ")"; - if (null == findSchemeByName(currName)) { + if (findSchemeByName(currName) == null) { name = currName; } } @@ -263,7 +247,7 @@ public class CodeStyleSchemesModel { name = null; for (int i = 0; name == null; i++) { String currName = i == 0 ? preferredName : preferredName + " (" + i + ")"; - if (null == findSchemeByName(currName)) { + if (findSchemeByName(currName) == null) { name = currName; } } diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java index 5159dfc04cc7..7a2bc3aa8655 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1022,13 +1022,14 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract initFonts(); } + @NotNull @Override public String getName() { return myName; } @Override - public void setName(String name) { + public void setName(@NotNull String name) { myName = name; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateImpl.java index 576184241507..d2ae6ba225ae 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateImpl.java @@ -104,14 +104,14 @@ public class TemplateImpl extends Template implements SchemeElement { - public TemplateImpl(@NotNull String key, String group) { + public TemplateImpl(@NotNull String key, @NotNull String group) { this(key, null, group); toParseSegments = false; myTemplateText = ""; mySegments = new ArrayList(); } - public TemplateImpl(@NotNull String key, String string, String group) { + public TemplateImpl(@NotNull String key, String string, @NotNull String group) { myKey = key; myString = string; myGroupName = group; @@ -414,7 +414,7 @@ public class TemplateImpl extends Template implements SchemeElement { } @Override - public void setGroupName(String groupName) { + public void setGroupName(@NotNull String groupName) { myGroupName = groupName; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java index 1aed0f448a6f..ed0419eb3a1f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -389,7 +389,7 @@ public class TemplateListPanel extends JPanel implements Disposable { return null; } - private void moveTemplates(Map map, String newGroupName) { + private void moveTemplates(Map map, @NotNull String newGroupName) { List toSelect = new ArrayList(); for (TemplateImpl template : map.keySet()) { DefaultMutableTreeNode oldTemplateNode = map.get(template); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemeImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemeImpl.java index 1189ef5a4b9e..99320b44c5e6 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemeImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,26 +56,26 @@ public class CodeStyleSchemeImpl implements JDOMExternalizable, CodeStyleScheme, private volatile CodeStyleSettings myCodeStyleSettings; private final ExternalInfo myExternalInfo = new ExternalInfo(); - public CodeStyleSchemeImpl(String name, String parentSchemeName, Element rootElement) { + public CodeStyleSchemeImpl(@NotNull String name, String parentSchemeName, Element rootElement) { myName = name; myRootElement = rootElement; myIsDefault = false; myParentSchemeName = parentSchemeName; } - public void init(CodeStyleSchemes schemesManager) { + public CodeStyleSchemeImpl(@NotNull String name, boolean isDefault, CodeStyleScheme parentScheme){ + myName = name; + myIsDefault = isDefault; + init(parentScheme, null); + } + + public void init(@NotNull CodeStyleSchemes schemesManager) { LOG.assertTrue(myCodeStyleSettings == null, "Already initialized"); init(schemesManager.findSchemeByName(myParentSchemeName), myRootElement); myParentSchemeName = null; myRootElement = null; } - public CodeStyleSchemeImpl(String name, boolean isDefault, CodeStyleScheme parentScheme){ - myName = name; - myIsDefault = isDefault; - init(parentScheme, null); - } - private void init(CodeStyleScheme parentScheme, Element root) { CodeStyleSettings parentSettings = parentScheme == null ? null : parentScheme.getCodeStyleSettings(); if (parentSettings == null){ @@ -107,6 +107,7 @@ public class CodeStyleSchemeImpl implements JDOMExternalizable, CodeStyleScheme, } @Override + @NotNull public String getName(){ return myName; } @@ -169,7 +170,7 @@ public class CodeStyleSchemeImpl implements JDOMExternalizable, CodeStyleScheme, } @Override - public void setName(final String name) { + public void setName(@NotNull final String name) { myName = name; } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemesImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemesImpl.java index 546a590acc95..40ee4adf70f2 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemesImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemesImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,11 +101,12 @@ public abstract class CodeStyleSchemesImpl extends CodeStyleSchemes implements E public CodeStyleScheme createNewScheme(String preferredName, CodeStyleScheme parentScheme) { String name; if (preferredName == null) { + if (parentScheme == null) throw new IllegalArgumentException("parentScheme must not be null"); // Generate using parent name name = null; for (int i = 1; name == null; i++) { String currName = parentScheme.getName() + " (" + i + ")"; - if (null == findSchemeByName(currName)) { + if (findSchemeByName(currName) == null) { name = currName; } } @@ -114,7 +115,7 @@ public abstract class CodeStyleSchemesImpl extends CodeStyleSchemes implements E name = null; for (int i = 0; name == null; i++) { String currName = i == 0 ? preferredName : preferredName + " (" + i + ")"; - if (null == findSchemeByName(currName)) { + if (findSchemeByName(currName) == null) { name = currName; } } diff --git a/platform/lang-impl/src/com/intellij/tools/Tool.java b/platform/lang-impl/src/com/intellij/tools/Tool.java index 80ffc7626f30..b5ec3a643207 100644 --- a/platform/lang-impl/src/com/intellij/tools/Tool.java +++ b/platform/lang-impl/src/com/intellij/tools/Tool.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,13 +34,13 @@ import com.intellij.ide.macro.MacroManager; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.options.SchemeElement; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; @@ -48,11 +48,11 @@ import java.util.ArrayList; import java.util.Arrays; public class Tool implements SchemeElement { - @NonNls public final static String ACTION_ID_PREFIX = "Tool_"; + @NonNls public static final String ACTION_ID_PREFIX = "Tool_"; private String myName; private String myDescription; - private String myGroup; + @NotNull private String myGroup; private boolean myShownInMainMenu; private boolean myShownInEditor; private boolean myShownInProjectViews; @@ -81,6 +81,7 @@ public class Tool implements SchemeElement { return myDescription; } + @NotNull public String getGroup() { return myGroup; } @@ -133,7 +134,7 @@ public class Tool implements SchemeElement { myDescription = description; } - void setGroup(String group) { + void setGroup(@NotNull String group) { myGroup = group; } @@ -256,10 +257,8 @@ public class Tool implements SchemeElement { public String getActionId() { StringBuilder name = new StringBuilder(getActionIdPrefix()); - if (myGroup != null) { - name.append(myGroup); - name.append('_'); - } + name.append(myGroup); + name.append('_'); if (myName != null) { name.append(myName); } @@ -354,7 +353,7 @@ public class Tool implements SchemeElement { } @Override - public void setGroupName(final String name) { + public void setGroupName(@NotNull final String name) { setGroup(name); } diff --git a/platform/platform-api/src/com/intellij/openapi/keymap/Keymap.java b/platform/platform-api/src/com/intellij/openapi/keymap/Keymap.java index 35a9c5e55633..e224f09c5665 100644 --- a/platform/platform-api/src/com/intellij/openapi/keymap/Keymap.java +++ b/platform/platform-api/src/com/intellij/openapi/keymap/Keymap.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.intellij.openapi.actionSystem.MouseShortcut; import com.intellij.openapi.actionSystem.Shortcut; import com.intellij.openapi.options.Scheme; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.util.ArrayList; @@ -27,6 +28,8 @@ import java.util.Map; public interface Keymap extends Scheme { //think about name + @NotNull + @Override String getName(); //think about name diff --git a/platform/platform-api/src/com/intellij/openapi/options/CompoundScheme.java b/platform/platform-api/src/com/intellij/openapi/options/CompoundScheme.java index 2c2e278b6b67..2240c75dd6fe 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/CompoundScheme.java +++ b/platform/platform-api/src/com/intellij/openapi/options/CompoundScheme.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,11 +52,12 @@ public class CompoundScheme implements ExternalizableSc return Collections.unmodifiableList(new ArrayList(myElements)); } + @NotNull public String getName() { return myName; } - public void setName(final String name) { + public void setName(@NotNull final String name) { myName = name; for (T template : myElements) { template.setGroupName(name); diff --git a/platform/platform-api/src/com/intellij/openapi/options/SchemeElement.java b/platform/platform-api/src/com/intellij/openapi/options/SchemeElement.java index 74b0db866cc6..5720b7af38cd 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/SchemeElement.java +++ b/platform/platform-api/src/com/intellij/openapi/options/SchemeElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,10 @@ package com.intellij.openapi.options; +import org.jetbrains.annotations.NotNull; + public interface SchemeElement { - void setGroupName(final String name); + void setGroupName(@NotNull String name); String getKey(); diff --git a/platform/platform-impl/src/com/intellij/application/options/SaveSchemeDialog.java b/platform/platform-impl/src/com/intellij/application/options/SaveSchemeDialog.java index 82e83b84f7b3..5433b279d5e1 100644 --- a/platform/platform-impl/src/com/intellij/application/options/SaveSchemeDialog.java +++ b/platform/platform-impl/src/com/intellij/application/options/SaveSchemeDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ public class SaveSchemeDialog extends DialogWrapper { return mySchemeName.getText(); } + @Override protected JComponent createNorthPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); @@ -65,8 +66,9 @@ public class SaveSchemeDialog extends DialogWrapper { return panel; } + @Override protected void doOKAction() { - if (getSchemeName().trim().length()==0) { + if (getSchemeName().trim().isEmpty()) { Messages.showMessageDialog(getContentPane(), ApplicationBundle.message("error.scheme.must.have.a.name"), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; @@ -89,10 +91,12 @@ public class SaveSchemeDialog extends DialogWrapper { super.doOKAction(); } + @Override protected JComponent createCenterPanel() { return null; } + @Override public JComponent getPreferredFocusedComponent() { return mySchemeName; } diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/ex/QuickList.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/ex/QuickList.java index da1b00c4508c..08559c69e7a5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/ex/QuickList.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/ex/QuickList.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,6 +97,7 @@ public class QuickList implements ExternalizableScheme { + @NotNull public String getName() { return getDisplayName(); @@ -239,7 +240,7 @@ public class QuickList implements ExternalizableScheme { - public void setName(final String newName) { + public void setName(@NotNull final String newName) { setDisplayName(newName); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DelegateColorScheme.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DelegateColorScheme.java index 8de66aaec458..de856c86aee5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DelegateColorScheme.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DelegateColorScheme.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -151,6 +151,7 @@ public abstract class DelegateColorScheme implements EditorColorsScheme { public void writeExternal(Element element) throws WriteExternalException { } + @NotNull @Override public String getName() { return myDelegate.getName(); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java index 60ceeb3a015a..452d7e144356 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -394,10 +394,6 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Name return new Document(root); } - public void renameScheme(final String name, final EditorColorsScheme scheme) { - scheme.setName(name); - } - @Override public boolean shouldBeSaved(@NotNull final EditorColorsSchemeImpl scheme) { return !(scheme instanceof ReadOnlyColorsScheme); diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/AbstractFileType.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/AbstractFileType.java index 6a87aadc44eb..f3ba81716bb7 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/AbstractFileType.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/AbstractFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -317,7 +317,8 @@ public class AbstractFileType extends UserFileType implements @NonNls private static final String ELEMENT_REMOVED_MAPPING = "removed_mapping"; @NonNls private static final String ATTRIBUTE_TYPE = "type"; - public static List> readAssociations(final Element e) { + @NotNull + public static List> readAssociations(@NotNull Element e) { ArrayList> result = new ArrayList>(); List mappings = e.getChildren(ELEMENT_MAPPING); @@ -333,7 +334,8 @@ public class AbstractFileType extends UserFileType implements return result; } - public static List> readRemovedAssociations(final Element e) { + @NotNull + public static List> readRemovedAssociations(@NotNull Element e) { ArrayList> result = new ArrayList>(); List removedMappings = e.getChildren(ELEMENT_REMOVED_MAPPING); for (Object removedMapping : removedMappings) { @@ -349,7 +351,7 @@ public class AbstractFileType extends UserFileType implements return result; } - public static Element writeMapping(final FileType type, final FileNameMatcher matcher, boolean specifyTypeName) { + public static Element writeMapping(@NotNull FileType type, final FileNameMatcher matcher, boolean specifyTypeName) { Element mapping = new Element(ELEMENT_MAPPING); if (matcher instanceof ExtensionFileNameMatcher) { mapping.setAttribute(ATTRIBUTE_EXT, ((ExtensionFileNameMatcher)matcher).getExtension()); diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapImpl.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapImpl.java index 7e2e860e7c43..72df51f1a243 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,15 +117,19 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { } } + @NotNull + @Override public String getName() { return myName; } + @Override public String getPresentableName() { return getName(); } - public void setName(String name) { + @Override + public void setName(@NotNull String name) { myName = name; } @@ -184,10 +188,12 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { return hashCode; } + @Override public Keymap getParent() { return myParent; } + @Override public boolean canModify() { return myCanModify; } @@ -200,6 +206,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { return myParent.getShortcuts(actionId); } + @Override public void addShortcut(String actionId, Shortcut shortcut) { addShortcutSilently(actionId, shortcut, true); fireShortcutChanged(actionId); @@ -226,6 +233,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { myMouseShortcut2ListOfIds = null; } + @Override public void removeAllActionShortcuts(String actionId) { Shortcut[] allShortcuts = getShortcuts(actionId); for (Shortcut shortcut : allShortcuts) { @@ -233,6 +241,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { } } + @Override public void removeShortcut(String actionId, Shortcut shortcut) { LinkedHashSet list = myActionId2ListOfShortcuts.get(actionId); if (list != null) { @@ -391,6 +400,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { return sortInOrderOfRegistration(ArrayUtil.toStringArray(list)); } + @Override public String[] getActionIds(KeyStroke firstKeyStroke) { // first, get keystrokes from own map List list = getKeystroke2ListOfIds().get(firstKeyStroke); @@ -418,6 +428,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { return sortInOrderOfRegistration(ArrayUtil.toStringArray(list)); } + @Override public String[] getActionIds(KeyStroke firstKeyStroke, KeyStroke secondKeyStroke) { String[] ids = getActionIds(firstKeyStroke); ArrayList actualBindings = new ArrayList(); @@ -437,6 +448,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { return ArrayUtil.toStringArray(actualBindings); } + @Override public String[] getActionIds(final Shortcut shortcut) { if (shortcut instanceof KeyboardShortcut) { final KeyboardShortcut kb = (KeyboardShortcut)shortcut; @@ -460,6 +472,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { } + @Override public String[] getActionIds(MouseShortcut shortcut) { // first, get shortcuts from own map List list = getMouseShortcut2ListOfIds().get(shortcut); @@ -497,6 +510,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { return getKeymapManager().getBoundActions().contains(actionId); } + @Override public Shortcut[] getShortcuts(String actionId) { LinkedHashSet shortcuts = myActionId2ListOfShortcuts.get(actionId); @@ -815,6 +829,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { myActionId2ListOfShortcuts.clear(); } + @Override public String[] getActionIds() { ArrayList ids = new ArrayList(); if (myParent != null) { @@ -835,6 +850,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { } + @Override public HashMap> getConflicts(String actionId, KeyboardShortcut keyboardShortcut) { HashMap> result = new HashMap>(); @@ -887,10 +903,12 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { return result; } + @Override public void addShortcutChangeListener(Listener listener) { myListeners.add(listener); } + @Override public void removeShortcutChangeListener(Listener listener) { myListeners.remove(listener); } @@ -916,6 +934,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { } + @Override @NotNull public ExternalInfo getExternalInfo() { return myExternalInfo; diff --git a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java index ecff0b34e668..5ca7ea0a7aac 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java @@ -600,11 +600,11 @@ public class SchemesManagerImpl { private final Set myExistingNames = new HashSet(); - public UniqueNameGenerator(final Collection elements, @Nullable Function namer) { + public UniqueNameGenerator(@NotNull Collection elements, @Nullable Function namer) { for (final T t : elements) { addExistingName(namer != null ? namer.fun(t) : t.toString()); } @@ -47,10 +48,12 @@ public class UniqueNameGenerator implements Condition { return value(prefix + name + suffix); } + @NotNull public static String generateUniqueName(final String defaultName, final Collection existingNames) { return generateUniqueName(defaultName, "", "", existingNames); } + @NotNull public static String generateUniqueName(final String defaultName, final String prefix, final String suffix, final Collection existingNames) { return generateUniqueName(defaultName, prefix, suffix, new Condition() { @Override @@ -59,15 +62,18 @@ public class UniqueNameGenerator implements Condition { } }); } - + + @NotNull public static String generateUniqueName(final String defaultName, final Condition validator) { return generateUniqueName(defaultName, "", "", validator); } + @NotNull public static String generateUniqueName(final String defaultName, final String prefix, final String suffix, final Condition validator) { return generateUniqueName(defaultName, prefix, suffix, "", "", validator); } + @NotNull public static String generateUniqueName(final String defaultName, final String prefix, final String suffix, final String beforeNumber, final String afterNumber, final Condition validator) { final String defaultFullName = prefix + defaultName + suffix; @@ -83,10 +89,12 @@ public class UniqueNameGenerator implements Condition { } } + @NotNull public String generateUniqueName(final String defaultName, final String prefix, final String suffix) { return generateUniqueName(defaultName, prefix, suffix, "", ""); } + @NotNull public String generateUniqueName(final String defaultName, final String prefix, final String suffix, final String beforeNumber, final String afterNumber) { final String result = generateUniqueName(defaultName, prefix, suffix, beforeNumber, afterNumber, this); addExistingName(result); diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalSystemSettingsProvider.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalSystemSettingsProvider.java index 7f5564e39a4b..12026184d4c4 100644 --- a/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalSystemSettingsProvider.java +++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalSystemSettingsProvider.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * 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.terminal; import com.google.common.collect.Sets; @@ -238,6 +253,7 @@ class JBTerminalSystemSettingsProvider extends DefaultTabbedSettingsProvider imp return myGlobalScheme; } + @NotNull @Override public String getName() { return getGlobal().getName();