From 2e89dfbe9551341660741705613e4e93e21d9395 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 9 Jan 2014 13:08:56 +0100 Subject: [PATCH] platform: PlatformUtils returned to the platform --- .../vcs/checkout/ProjectCheckoutListener.java | 4 +- .../JavaCodeStyleSettingsProvider.java | 6 +- ...JavaLanguageCodeStyleSettingsProvider.java | 6 +- .../com/intellij/util/PlatformUtilsCore.java | 23 ++-- .../src/com/intellij/ide/ui/UISettings.java | 75 ++++++------- .../projectView/impl/ShowModulesAction.java | 28 +++-- .../actions/ModuleDeleteProvider.java | 4 +- .../src/com/intellij/util/PlatformUtils.java | 101 ++++++++++++------ .../com/intellij/help/impl/MacHelpUtil.java | 5 +- .../ide/actions/CreateDesktopEntryAction.java | 4 +- .../application/impl/ApplicationInfoImpl.java | 6 +- .../fileTypes/impl/FileTypeManagerImpl.java | 4 +- .../PluginsAdvertiser.java | 16 +-- .../src/com/intellij/ui/AppUIUtil.java | 4 +- .../src/com/intellij/idea/MainImpl.java | 5 +- .../src/run/PluginRunConfiguration.java | 15 ++- 16 files changed, 182 insertions(+), 124 deletions(-) diff --git a/java/idea-ui/src/com/intellij/openapi/vcs/checkout/ProjectCheckoutListener.java b/java/idea-ui/src/com/intellij/openapi/vcs/checkout/ProjectCheckoutListener.java index 2832333ff6a7..f7bc32e0be00 100644 --- a/java/idea-ui/src/com/intellij/openapi/vcs/checkout/ProjectCheckoutListener.java +++ b/java/idea-ui/src/com/intellij/openapi/vcs/checkout/ProjectCheckoutListener.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. @@ -55,7 +55,7 @@ public class ProjectCheckoutListener implements CheckoutListener { final ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance(); // example: "to create an IntelliJ IDEA project" (full product name is ok); // "to create a JetBrains Astella project" (better use not full product name: "to create an Astella project") - final String productName = PlatformUtils.isIdea() ? namesInfo.getFullProductName() : namesInfo.getProductName(); + final String productName = PlatformUtils.isIdeaUltimate() ? namesInfo.getFullProductName() : namesInfo.getProductName(); final String article = StringUtil.isVowel(Character.toLowerCase(productName.charAt(0))) ? "an " : "a "; return article + productName; } diff --git a/java/java-impl/src/com/intellij/application/options/JavaCodeStyleSettingsProvider.java b/java/java-impl/src/com/intellij/application/options/JavaCodeStyleSettingsProvider.java index f40b5bacf779..937d40858288 100644 --- a/java/java-impl/src/com/intellij/application/options/JavaCodeStyleSettingsProvider.java +++ b/java/java-impl/src/com/intellij/application/options/JavaCodeStyleSettingsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 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. @@ -29,7 +29,7 @@ public class JavaCodeStyleSettingsProvider extends CodeStyleSettingsProvider { @NotNull @Override public Configurable createSettingsPage(CodeStyleSettings settings, CodeStyleSettings originalSettings) { - return new CodeStyleAbstractConfigurable(settings, originalSettings, "Java") { + return new CodeStyleAbstractConfigurable(settings, originalSettings, "Java") { protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) { return new JavaCodeStyleMainPanel(getCurrentSettings(), settings); } @@ -41,7 +41,7 @@ public class JavaCodeStyleSettingsProvider extends CodeStyleSettingsProvider { @Override public DisplayPriority getPriority() { - return PlatformUtils.isIdea() ? DisplayPriority.KEY_LANGUAGE_SETTINGS : DisplayPriority.LANGUAGE_SETTINGS; + return PlatformUtils.isIdeaUltimate() ? DisplayPriority.KEY_LANGUAGE_SETTINGS : DisplayPriority.LANGUAGE_SETTINGS; } @Override diff --git a/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java b/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java index b9ef35513802..9583ef968c51 100644 --- a/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java +++ b/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.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. @@ -74,7 +74,7 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett @Override public DisplayPriority getDisplayPriority() { - if (PlatformUtils.isIdea()) return DisplayPriority.KEY_LANGUAGE_SETTINGS; + if (PlatformUtils.isIdeaUltimate()) return DisplayPriority.KEY_LANGUAGE_SETTINGS; return DisplayPriority.LANGUAGE_SETTINGS; } @@ -185,7 +185,7 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett "\n" + " public void foo(int x, int y) {" + " Runnable r = () -> {};\n" + - " Runnable r1 = this :: bar;\n" + + " Runnable r1 = this :: bar;\n" + " for (int i = 0; i < x; i++) {\n" + " y += (y ^ 0x123) << 2;\n" + " }\n" + diff --git a/platform/core-api/src/com/intellij/util/PlatformUtilsCore.java b/platform/core-api/src/com/intellij/util/PlatformUtilsCore.java index 6cda4f5b0a0f..19854ccdb88e 100644 --- a/platform/core-api/src/com/intellij/util/PlatformUtilsCore.java +++ b/platform/core-api/src/com/intellij/util/PlatformUtilsCore.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. @@ -15,8 +15,10 @@ */ package com.intellij.util; +/** @deprecated use PlatformUtils (to remove in IDEA 14) */ public class PlatformUtilsCore { public static final String PLATFORM_PREFIX_KEY = "idea.platform.prefix"; + public static final String IDEA_PREFIX = "idea"; public static final String COMMUNITY_PREFIX = "Idea"; public static final String APPCODE_PREFIX = "AppCode"; @@ -36,6 +38,10 @@ public class PlatformUtilsCore { return System.getProperty(PLATFORM_PREFIX_KEY, defaultPrefix); } + public static boolean isIntelliJ() { + return isIdea() || isCommunity(); + } + public static boolean isIdea() { return IDEA_PREFIX.equals(getPlatformPrefix()); } @@ -57,8 +63,15 @@ public class PlatformUtilsCore { } public static boolean isPyCharm() { - String prefix = getPlatformPrefix(); - return PYCHARM_PREFIX.equals(prefix) || (prefix != null && prefix.startsWith(PYCHARM_PREFIX2)); + return isPyCharmPro() || isPyCharmCommunity(); + } + + static boolean isPyCharmPro() { + return PYCHARM_PREFIX.equals(getPlatformPrefix()); + } + + static boolean isPyCharmCommunity() { + return PYCHARM_PREFIX2.equals(getPlatformPrefix()); } public static boolean isPhpStorm() { @@ -68,8 +81,4 @@ public class PlatformUtilsCore { public static boolean isWebStorm() { return WEB_PREFIX.equals(getPlatformPrefix()); } - - public static boolean isIntelliJ() { - return isIdea() || isCommunity(); - } } diff --git a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java index 69934b6ee250..2b7b3eb64594 100644 --- a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java +++ b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.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. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.ide.ui; import com.intellij.ide.IdeBundle; @@ -51,14 +50,24 @@ import static com.intellij.util.ui.UIUtil.isValidFont; )} ) public class UISettings implements PersistentStateComponent, ExportableApplicationComponent { - private final EventListenerList myListenerList; + /** Not tabbed pane. */ + public static final int TABS_NONE = 0; - @Property(filter = FontFilter.class) - @NonNls - public String FONT_FACE; - @Property(filter = FontFilter.class) - public int FONT_SIZE; + public static UISettings getInstance() { + return ApplicationManager.getApplication().getComponent(UISettings.class); + } + /** + * Use this method if you are not sure whether the application is initialized. + * @return persisted UISettings instance or default values. + */ + public static UISettings getShadowInstance() { + Application application = ApplicationManager.getApplication(); + return application != null ? getInstance() : new UISettings(); + } + + @Property(filter = FontFilter.class) public String FONT_FACE; + @Property(filter = FontFilter.class) public int FONT_SIZE; public int RECENT_FILES_LIMIT = 50; public int CONSOLE_COMMAND_HISTORY_LIMIT = 300; public int EDITOR_TAB_LIMIT = 10; @@ -77,14 +86,14 @@ public class UISettings implements PersistentStateComponent, Exporta public boolean SHOW_NAVIGATION_BAR = true; public boolean ALWAYS_SHOW_WINDOW_BUTTONS = false; public boolean CYCLE_SCROLLING = true; - public boolean SCROLL_TAB_LAYOUT_IN_EDITOR = PlatformUtilsCore.isAppCode(); + public boolean SCROLL_TAB_LAYOUT_IN_EDITOR = false; public boolean SHOW_CLOSE_BUTTON = true; public int EDITOR_TAB_PLACEMENT = 1; public boolean HIDE_KNOWN_EXTENSION_IN_TABS = false; public boolean SHOW_ICONS_IN_QUICK_NAVIGATION = true; public boolean CLOSE_NON_MODIFIED_FILES_FIRST = false; public boolean ACTIVATE_MRU_EDITOR_ON_CLOSE = false; - public boolean ACTIVATE_RIGHT_EDITOR_ON_CLOSE = PlatformUtilsCore.isAppCode(); + public boolean ACTIVATE_RIGHT_EDITOR_ON_CLOSE = false; public boolean ANTIALIASING_IN_EDITOR = true; public boolean MOVE_MOUSE_ON_DEFAULT_BUTTON = false; public boolean ENABLE_ALPHA_MODE = false; @@ -104,18 +113,10 @@ public class UISettings implements PersistentStateComponent, Exporta public boolean DEFAULT_AUTOSCROLL_TO_SOURCE = false; public boolean PRESENTATION_MODE = false; public int PRESENTATION_MODE_FONT_SIZE = 24; - - /** - * Defines whether asterisk is shown on modified editor tab or not - */ public boolean MARK_MODIFIED_TABS_WITH_ASTERISK = false; - public boolean SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES = false; - /** - * Not tabbed pane - */ - public static final int TABS_NONE = 0; + private final EventListenerList myListenerList; public UISettings() { myListenerList = new EventListenerList(); @@ -124,11 +125,11 @@ public class UISettings implements PersistentStateComponent, Exporta } private void tweakPlatformDefaults() { - // TODO: Make it pluggable + // TODO[anton] consider making all IDEs use the same settings if (PlatformUtilsCore.isAppCode()) { - SHOW_MAIN_TOOLBAR = false; + SCROLL_TAB_LAYOUT_IN_EDITOR = true; + ACTIVATE_RIGHT_EDITOR_ON_CLOSE = true; SHOW_ICONS_IN_MENUS = false; - SHOW_MEMORY_INDICATOR = false; } } @@ -140,7 +141,7 @@ public class UISettings implements PersistentStateComponent, Exporta } public void addUISettingsListener(@NotNull final UISettingsListener listener, @NotNull Disposable parentDisposable) { - myListenerList.add(UISettingsListener.class,listener); + myListenerList.add(UISettingsListener.class, listener); Disposer.register(parentDisposable, new Disposable() { @Override public void dispose() { @@ -153,27 +154,14 @@ public class UISettings implements PersistentStateComponent, Exporta * Notifies all registered listeners that UI settings has been changed. */ public void fireUISettingsChanged() { - UISettingsListener[] listeners= myListenerList.getListeners(UISettingsListener.class); + UISettingsListener[] listeners = myListenerList.getListeners(UISettingsListener.class); for (UISettingsListener listener : listeners) { listener.uiSettingsChanged(this); } } - public static UISettings getInstance() { - return ApplicationManager.getApplication().getComponent(UISettings.class); - } - - /** - * Use this method if you are not sure is application initialized or not - * @return UISettings instance or default values - */ - public static UISettings getShadowInstance() { - Application application = ApplicationManager.getApplication(); - return application != null ? getInstance() : new UISettings(); - } - public void removeUISettingsListener(UISettingsListener listener) { - myListenerList.remove(UISettingsListener.class,listener); + myListenerList.remove(UISettingsListener.class, listener); } private void setSystemFontFaceAndSize() { @@ -322,24 +310,27 @@ public class UISettings implements PersistentStateComponent, Exporta } @NotNull + @Override public File[] getExportFiles() { return new File[]{PathManager.getOptionsFile("ui.lnf")}; } @NotNull + @Override public String getPresentableName() { return IdeBundle.message("ui.settings"); } @NonNls @NotNull + @Override public String getComponentName() { return "UISettings"; } - public void initComponent() { - } + @Override + public void initComponent() { } - public void disposeComponent() { - } + @Override + public void disposeComponent() { } } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ShowModulesAction.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ShowModulesAction.java index 6430732021a7..6e53e96725b5 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ShowModulesAction.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ShowModulesAction.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 com.intellij.ide.projectView.impl; import com.intellij.icons.AllIcons; @@ -11,12 +26,9 @@ import com.intellij.openapi.util.Comparing; import com.intellij.util.PlatformUtils; /** -* Created by IntelliJ IDEA. -* User: anna -* Date: 8/5/11 -* Time: 9:33 PM -* To change this template use File | Settings | File Templates. -*/ + * @author anna + * @since 8/5/11 + */ public abstract class ShowModulesAction extends ToggleAction { private final Project myProject; @@ -48,8 +60,6 @@ public abstract class ShowModulesAction extends ToggleAction { } private static boolean hasModules() { - return PlatformUtils.isIdea() || - PlatformUtils.isCommunity() || - PlatformUtils.isFlexIde(); + return PlatformUtils.isIntelliJ(); } } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/actions/ModuleDeleteProvider.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/actions/ModuleDeleteProvider.java index e6a784f77364..cecfc4497d50 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/actions/ModuleDeleteProvider.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/actions/ModuleDeleteProvider.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. @@ -57,7 +57,7 @@ public class ModuleDeleteProvider implements DeleteProvider, TitledHandler { private static boolean isPrimaryModule(Module[] modules) { if (!ProjectAttachProcessor.canAttachToProject()) { - return !PlatformUtils.isIdea(); + return !PlatformUtils.isIdeaUltimate(); } for (Module module : modules) { final File moduleFile = new File(module.getModuleFilePath()); diff --git a/platform/platform-api/src/com/intellij/util/PlatformUtils.java b/platform/platform-api/src/com/intellij/util/PlatformUtils.java index b8e66c5b5afe..a20d3f42d002 100644 --- a/platform/platform-api/src/com/intellij/util/PlatformUtils.java +++ b/platform/platform-api/src/com/intellij/util/PlatformUtils.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. @@ -22,61 +22,76 @@ import org.jetbrains.annotations.Nullable; /** * @author Konstantin Bulenkov */ -public class PlatformUtils extends PlatformUtilsCore { - private PlatformUtils() { - } +@SuppressWarnings({"deprecation", "UnusedDeclaration"}) +public class PlatformUtils { + public static final String PLATFORM_PREFIX_KEY = PlatformUtilsCore.PLATFORM_PREFIX_KEY; + + public static final String IDEA_PREFIX = PlatformUtilsCore.IDEA_PREFIX; + public static final String IDEA_CE_PREFIX = PlatformUtilsCore.COMMUNITY_PREFIX; + public static final String APPCODE_PREFIX = PlatformUtilsCore.APPCODE_PREFIX; + public static final String CPP_PREFIX = PlatformUtilsCore.CPP_PREFIX; + public static final String PYCHARM_PREFIX = PlatformUtilsCore.PYCHARM_PREFIX; + public static final String PYCHARM_CE_PREFIX = PlatformUtilsCore.PYCHARM_PREFIX2; + public static final String RUBY_PREFIX = PlatformUtilsCore.RUBY_PREFIX; + public static final String PHP_PREFIX = PlatformUtilsCore.PHP_PREFIX; + public static final String WEB_PREFIX = PlatformUtilsCore.WEB_PREFIX; + + private PlatformUtils() { } public static String getPlatformPrefix() { - return getPlatformPrefix(IDEA_PREFIX); + return PlatformUtilsCore.getPlatformPrefix(); } public static String getPlatformPrefix(String defaultPrefix) { - return System.getProperty(PLATFORM_PREFIX_KEY, defaultPrefix); + return PlatformUtilsCore.getPlatformPrefix(defaultPrefix); } - public static boolean isIdea() { - return IDEA_PREFIX.equals(getPlatformPrefix()); + public static boolean isIntelliJ() { + return PlatformUtilsCore.isIntelliJ(); } - public static boolean isCommunity() { - return COMMUNITY_PREFIX.equals(getPlatformPrefix()); + public static boolean isIdeaUltimate() { + return PlatformUtilsCore.isIdea(); + } + + public static boolean isIdeaCommunity() { + return PlatformUtilsCore.isCommunity(); } public static boolean isRubyMine() { - return RUBY_PREFIX.equals(getPlatformPrefix()); + return PlatformUtilsCore.isRubyMine(); + } + + public static boolean isAppCode() { + return PlatformUtilsCore.isAppCode(); + } + + public static boolean isCppIde() { + return PlatformUtilsCore.isCppIde(); } public static boolean isCidr() { return isAppCode() || isCppIde(); } - public static boolean isAppCode() { - return APPCODE_PREFIX.equals(getPlatformPrefix()); - } - - public static boolean isCppIde() { - return CPP_PREFIX.equals(getPlatformPrefix()); - } - public static boolean isPyCharm() { - String prefix = getPlatformPrefix(); - return PYCHARM_PREFIX.equals(prefix) || (prefix != null && prefix.startsWith(PYCHARM_PREFIX2)); + return PlatformUtilsCore.isPyCharm(); + } + + public static boolean isPyCharmPro() { + return PlatformUtilsCore.isPyCharmPro(); + } + + public static boolean isPyCharmCommunity() { + return PlatformUtilsCore.isPyCharmCommunity(); } public static boolean isPhpStorm() { - return PHP_PREFIX.equals(getPlatformPrefix()); + return PlatformUtilsCore.isPhpStorm(); } public static boolean isWebStorm() { - return WEB_PREFIX.equals(getPlatformPrefix()); - } - - public static boolean isFlexIde() { - return FLEX_PREFIX.equals(getPlatformPrefix()); - } - - public static boolean isIntelliJ() { - return isIdea() || isCommunity(); + return PlatformUtilsCore.isWebStorm(); } public static boolean isIdeaProject(@Nullable Project project) { @@ -85,4 +100,28 @@ public class PlatformUtils extends PlatformUtilsCore { if (baseDir == null) return false; return baseDir.findChild("idea.iml") != null || baseDir.findChild("community-main.iml") != null; } + + /** @deprecated use {@link #IDEA_CE_PREFIX} (to remove in IDEA 15) */ + @SuppressWarnings("UnusedDeclaration") + public static final String COMMUNITY_PREFIX = IDEA_CE_PREFIX; + + /** @deprecated use {@link #isIdeaUltimate()} (to remove in IDEA 15) */ + @SuppressWarnings("UnusedDeclaration") + public static boolean isIdea() { return isIdeaUltimate(); } + + /** @deprecated use {@link #isIdeaCommunity()} (to remove in IDEA 15) */ + @SuppressWarnings("UnusedDeclaration") + public static boolean isCommunity() { return isIdeaCommunity(); } + + /** @deprecated use {@link #PYCHARM_CE_PREFIX} (to remove in IDEA 14) */ + @SuppressWarnings("UnusedDeclaration") + public static final String PYCHARM_PREFIX2 = PYCHARM_CE_PREFIX; + + /** @deprecated to remove in IDEA 14 */ + @SuppressWarnings("UnusedDeclaration") + public static final String FLEX_PREFIX = PlatformUtilsCore.FLEX_PREFIX; + + /** @deprecated to remove in IDEA 14 */ + @SuppressWarnings("UnusedDeclaration") + public static boolean isFlexIde() { return false; } } diff --git a/platform/platform-impl/src/com/intellij/help/impl/MacHelpUtil.java b/platform/platform-impl/src/com/intellij/help/impl/MacHelpUtil.java index 2728c456af85..90d633f0d621 100644 --- a/platform/platform-impl/src/com/intellij/help/impl/MacHelpUtil.java +++ b/platform/platform-impl/src/com/intellij/help/impl/MacHelpUtil.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. @@ -41,6 +41,7 @@ public class MacHelpUtil { } static boolean isApplicable() { - return SystemInfo.isMac && Registry.is("ide.mac.show.native.help", false) && !PlatformUtils.isCidr() && !PlatformUtils.isCommunity(); + return SystemInfo.isMac && Registry.is("ide.mac.show.native.help", false) && !PlatformUtils.isCidr() && !PlatformUtils + .isIdeaCommunity(); } } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/CreateDesktopEntryAction.java b/platform/platform-impl/src/com/intellij/ide/actions/CreateDesktopEntryAction.java index f03aff7efff0..7728781bc3f2 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/CreateDesktopEntryAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/CreateDesktopEntryAction.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. @@ -134,7 +134,7 @@ public class CreateDesktopEntryAction extends DumbAwareAction { assert new File(binPath).isDirectory() : "Invalid bin/ path: '" + binPath + "'"; String name = ApplicationNamesInfo.getInstance().getFullProductName(); - if (PlatformUtils.isCommunity()) name += " Community Edition"; + if (PlatformUtils.isIdeaCommunity()) name += " Community Edition"; final String iconPath = AppUIUtil.findIcon(binPath); if (iconPath == null) { diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java index 14346fe66407..4f30ec18eaa7 100755 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.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. @@ -191,10 +191,10 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern private static String getProductPrefix() { String prefix = null; - if (PlatformUtils.isCommunity()) { + if (PlatformUtils.isIdeaCommunity()) { prefix = "IC"; } - else if (PlatformUtils.isIdea()) { + else if (PlatformUtils.isIdeaUltimate()) { prefix = "IU"; } return prefix; diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java index 13783e82b4da..1418b1f6f34f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.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. @@ -1072,7 +1072,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME } public static String getFileTypeComponentName() { - return PlatformUtils.isCommunity() ? "CommunityFileTypes" : "FileTypeManager"; + return PlatformUtils.isIdeaCommunity() ? "CommunityFileTypes" : "FileTypeManager"; } public FileTypeAssocTable getExtensionMap() { diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java index f7ca502ed6d1..00c777649941 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.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. @@ -90,7 +90,7 @@ public class PluginsAdvertiser implements StartupActivity { final JsonObject jsonObject = jsonElement.getAsJsonObject(); final JsonElement pluginId = jsonObject.get("pluginId"); final JsonElement bundled = jsonObject.get("bundled"); - result.add(new Plugin(PluginId.getId(StringUtil.unquoteString(pluginId.toString())), + result.add(new Plugin(PluginId.getId(StringUtil.unquoteString(pluginId.toString())), Boolean.parseBoolean(StringUtil.unquoteString(bundled.toString())))); } return result; @@ -132,7 +132,7 @@ public class PluginsAdvertiser implements StartupActivity { final IdeaPluginDescriptor loadedPlugin = PluginManager.getPlugin(PluginId.getId(pluginId)); if (loadedPlugin != null && loadedPlugin.isEnabled()) continue; - if (loadedPlugin != null && fromServerPluginDescription != null && + if (loadedPlugin != null && fromServerPluginDescription != null && StringUtil.compareVersionNumbers(loadedPlugin.getVersion(), fromServerPluginDescription.getVersion()) >= 0) continue; final JsonElement ext = jsonObject.get("implementationName"); @@ -188,7 +188,7 @@ public class PluginsAdvertiser implements StartupActivity { } public static void openDownloadPage() { - BrowserUtil.open(ApplicationInfo.getInstance().getCompanyURL()); + BrowserUtil.open(ApplicationInfo.getInstance().getCompanyURL()); } static void enablePlugins(Project project, final Collection disabledPlugins) { @@ -216,7 +216,7 @@ public class PluginsAdvertiser implements StartupActivity { } static boolean hasBundledPluginToInstall(Collection plugins) { - if (PlatformUtils.isIdea()) return false; + if (PlatformUtils.isIdeaUltimate()) return false; for (Plugin plugin : plugins) { if (plugin.myBundled && PluginManager.getPlugin(PluginId.getId(plugin.myPluginId)) == null) { return true; @@ -275,7 +275,7 @@ public class PluginsAdvertiser implements StartupActivity { if (pluginDescriptor != null) { myDisabledPlugins.put(plugin, pluginDescriptor); } - } + } } myBundledPlugins = hasBundledPluginToInstall(ids.values()); @@ -363,7 +363,7 @@ public class PluginsAdvertiser implements StartupActivity { } } } - + @Tag("plugin") public static class Plugin implements Comparable { public String myPluginId; @@ -415,7 +415,7 @@ public class PluginsAdvertiser implements StartupActivity { public ConfigurePluginsListener(Set unknownFeatures, Project project, List allPlugins, - Set plugins, + Set plugins, Map disabledPlugins) { myUnknownFeatures = unknownFeatures; myProject = project; diff --git a/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java b/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java index 77c7eca433c7..bce9324938cd 100644 --- a/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java +++ b/platform/platform-impl/src/com/intellij/ui/AppUIUtil.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. @@ -122,7 +122,7 @@ public class AppUIUtil { if ("true".equals(System.getProperty("idea.debug.mode"))) { wmClass += "-debug"; } - return PlatformUtils.isCommunity() ? wmClass + "-ce" : wmClass; + return PlatformUtils.isIdeaCommunity() ? wmClass + "-ce" : wmClass; } public static void registerBundledFonts() { diff --git a/platform/platform-main/src/com/intellij/idea/MainImpl.java b/platform/platform-main/src/com/intellij/idea/MainImpl.java index afaf62e87e9d..32a41d49d02f 100644 --- a/platform/platform-main/src/com/intellij/idea/MainImpl.java +++ b/platform/platform-main/src/com/intellij/idea/MainImpl.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. @@ -17,7 +17,6 @@ package com.intellij.idea; import com.intellij.ide.plugins.PluginManager; import com.intellij.util.PlatformUtils; -import com.intellij.util.PlatformUtilsCore; import javax.swing.*; @@ -29,7 +28,7 @@ public class MainImpl { * Called from PluginManager via reflection. */ protected static void start(final String[] args) { - System.setProperty(PlatformUtilsCore.PLATFORM_PREFIX_KEY, PlatformUtils.getPlatformPrefix(PlatformUtilsCore.COMMUNITY_PREFIX)); + System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, PlatformUtils.getPlatformPrefix(PlatformUtils.IDEA_CE_PREFIX)); StartupUtil.prepareAndStart(args, new StartupUtil.AppStarter() { @Override diff --git a/plugins/devkit/src/run/PluginRunConfiguration.java b/plugins/devkit/src/run/PluginRunConfiguration.java index c477c0dc82f2..e226ecab9ded 100644 --- a/plugins/devkit/src/run/PluginRunConfiguration.java +++ b/plugins/devkit/src/run/PluginRunConfiguration.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. @@ -145,11 +145,14 @@ public class PluginRunConfiguration extends RunConfigurationBase implements Modu String prefix = null; if (buildNumber.startsWith("IC")) { - prefix = PlatformUtils.COMMUNITY_PREFIX; + prefix = PlatformUtils.IDEA_CE_PREFIX; } else if (buildNumber.startsWith("PY")) { prefix = PlatformUtils.PYCHARM_PREFIX; } + else if (buildNumber.startsWith("PC")) { + prefix = PlatformUtils.PYCHARM_CE_PREFIX; + } else if (buildNumber.startsWith("RM")) { prefix = PlatformUtils.RUBY_PREFIX; } @@ -162,7 +165,13 @@ public class PluginRunConfiguration extends RunConfigurationBase implements Modu else if (buildNumber.startsWith("OC")) { prefix = buildNumber.contains("121") ? "CIDR" : PlatformUtils.APPCODE_PREFIX; } - if (prefix != null) vm.defineProperty(PlatformUtils.PLATFORM_PREFIX_KEY, prefix); + else if (buildNumber.startsWith("CP")) { + prefix = PlatformUtils.CPP_PREFIX; + } + + if (prefix != null) { + vm.defineProperty(PlatformUtils.PLATFORM_PREFIX_KEY, prefix); + } } }