diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseLibrariesConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseLibrariesConfigurable.java index 0dd554d28045..fbf6a2dd71ab 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseLibrariesConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseLibrariesConfigurable.java @@ -1,17 +1,5 @@ /* - * 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. - * 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. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package com.intellij.openapi.roots.ui.configuration.projectRoot; @@ -386,7 +374,7 @@ public abstract class BaseLibrariesConfigurable extends BaseStructureConfigurabl final LibrariesModifiableModel libsModel = configurable.getModelProvider().getModifiableModel(); final Library lib = libsModel.createLibrary(newName, library.getKind()); - final LibraryEx.ModifiableModelEx model = (LibraryEx.ModifiableModelEx)libsModel.getLibraryEditor(lib).getModel(); + final LibraryEx.ModifiableModelEx model = libsModel.getLibraryEditor(lib).getModel(); LibraryEditingUtil.copyLibrary(library, Collections.emptyMap(), model); } } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseStructureConfigurable.java index 25ab6d924100..56ef6d23bb76 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseStructureConfigurable.java @@ -1,17 +1,5 @@ /* - * 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. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package com.intellij.openapi.roots.ui.configuration.projectRoot; @@ -52,7 +40,6 @@ import java.util.*; import java.util.List; public abstract class BaseStructureConfigurable extends MasterDetailsComponent implements SearchableConfigurable, Disposable, Place.Navigator { - protected StructureConfigurableContext myContext; protected final Project myProject; @@ -68,7 +55,7 @@ public abstract class BaseStructureConfigurable extends MasterDetailsComponent i myProject = project; } - protected BaseStructureConfigurable(final Project project) { + protected BaseStructureConfigurable(@NotNull Project project) { myProject = project; } @@ -239,7 +226,6 @@ public abstract class BaseStructureConfigurable extends MasterDetailsComponent i } } - @Override public void reset() { myUiDisposed = false; @@ -286,7 +272,6 @@ public abstract class BaseStructureConfigurable extends MasterDetailsComponent i result.add(new MyFindUsagesAction(myTree)); } - return result; } @@ -392,7 +377,6 @@ public abstract class BaseStructureConfigurable extends MasterDetailsComponent i return objects; } - protected void removeFacetNodes(@NotNull List facets) { for (Facet facet : facets) { MyNode node = findNodeByObject(myRoot, facet); @@ -403,7 +387,6 @@ public abstract class BaseStructureConfigurable extends MasterDetailsComponent i } protected abstract static class AbstractAddGroup extends ActionGroup implements ActionGroupWithPreselection { - protected AbstractAddGroup(String text, Icon icon) { super(text, true); diff --git a/java/java-impl/src/com/intellij/javadoc/JavadocConfigurable.java b/java/java-impl/src/com/intellij/javadoc/JavadocConfigurable.java index e0836a6fe557..907950dbbdfd 100644 --- a/java/java-impl/src/com/intellij/javadoc/JavadocConfigurable.java +++ b/java/java-impl/src/com/intellij/javadoc/JavadocConfigurable.java @@ -1,17 +1,5 @@ /* - * 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. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package com.intellij.javadoc; @@ -19,6 +7,7 @@ import com.intellij.openapi.options.Configurable; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.JavadocOrderRootType; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiKeyword; import javax.swing.*; @@ -136,10 +125,7 @@ public final class JavadocConfigurable implements Configurable { } private static String convertString(String s) { - if (s != null && s.trim().length() == 0) { - return null; - } - return s; + return StringUtil.nullize(s, true); } private static String toSystemIndependentFormat(String directory) { diff --git a/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java b/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java index a7248ef1694e..bbd3eac45bd0 100644 --- a/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java +++ b/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java @@ -1,31 +1,15 @@ /* - * 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. - * 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. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package com.intellij.javadoc; import com.intellij.psi.PsiKeyword; -import com.intellij.util.xmlb.SerializationFilter; /** * @author Eugene Zhuravlev * @since Apr 24, 2004 */ public class JavadocConfiguration { - public static final SerializationFilter FILTER = (accessor, bean) -> - !accessor.getName().equals("OPTION_LINK_TO_JDK_DOCS") || ((JavadocConfiguration)bean).OPTION_LINK_TO_JDK_DOCS; - public String OUTPUT_DIRECTORY; public String OPTION_SCOPE = PsiKeyword.PROTECTED; public boolean OPTION_HIERARCHY = true; @@ -37,7 +21,7 @@ public class JavadocConfiguration { public boolean OPTION_DOCUMENT_TAG_VERSION; public boolean OPTION_DOCUMENT_TAG_DEPRECATED = true; public boolean OPTION_DEPRECATED_LIST = true; - public String OTHER_OPTIONS = ""; + public String OTHER_OPTIONS; public String HEAP_SIZE; public String LOCALE; public boolean OPEN_IN_BROWSER = true; diff --git a/java/java-impl/src/com/intellij/javadoc/JavadocGenerationManager.java b/java/java-impl/src/com/intellij/javadoc/JavadocGenerationManager.java index b94e25ce5399..f5638646f5be 100644 --- a/java/java-impl/src/com/intellij/javadoc/JavadocGenerationManager.java +++ b/java/java-impl/src/com/intellij/javadoc/JavadocGenerationManager.java @@ -1,17 +1,5 @@ /* - * 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. - * 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. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package com.intellij.javadoc; @@ -25,13 +13,11 @@ import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.State; import com.intellij.openapi.project.Project; -import com.intellij.util.xmlb.XmlSerializer; -import org.jdom.Element; import org.jetbrains.annotations.NotNull; @State(name = "JavadocGenerationManager") -public final class JavadocGenerationManager implements PersistentStateComponent { - private final JavadocConfiguration myConfiguration = new JavadocConfiguration(); +public final class JavadocGenerationManager implements PersistentStateComponent { + private JavadocConfiguration myConfiguration = new JavadocConfiguration(); private final Project myProject; public static JavadocGenerationManager getInstance(@NotNull Project project) { @@ -43,13 +29,13 @@ public final class JavadocGenerationManager implements PersistentStateComponent< } @Override - public Element getState() { - return XmlSerializer.serialize(myConfiguration, JavadocConfiguration.FILTER); + public JavadocConfiguration getState() { + return myConfiguration; } @Override - public void loadState(Element state) { - XmlSerializer.deserializeInto(myConfiguration, state); + public void loadState(@NotNull JavadocConfiguration state) { + myConfiguration = state; } @NotNull diff --git a/platform/configuration-store-impl/src/ComponentStoreImpl.kt b/platform/configuration-store-impl/src/ComponentStoreImpl.kt index 66be820f9922..994778e002d7 100644 --- a/platform/configuration-store-impl/src/ComponentStoreImpl.kt +++ b/platform/configuration-store-impl/src/ComponentStoreImpl.kt @@ -410,7 +410,7 @@ abstract class ComponentStoreImpl : IComponentStore { return storages.sortByDeprecated() } - override final fun isReloadPossible(componentNames: MutableSet) = !componentNames.any { isNotReloadable(it) } + final override fun isReloadPossible(componentNames: MutableSet) = !componentNames.any { isNotReloadable(it) } private fun isNotReloadable(name: String): Boolean { val component = components.get(name)?.component ?: return false diff --git a/platform/configuration-store-impl/testSrc/DoNotSaveDefaults.kt b/platform/configuration-store-impl/testSrc/DoNotSaveDefaults.kt index 2e9f3c2a9970..fe7aeee389a0 100644 --- a/platform/configuration-store-impl/testSrc/DoNotSaveDefaults.kt +++ b/platform/configuration-store-impl/testSrc/DoNotSaveDefaults.kt @@ -5,8 +5,11 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.PathManager import com.intellij.openapi.application.ex.PathManagerEx import com.intellij.openapi.application.impl.ApplicationImpl +import com.intellij.openapi.components.impl.ComponentManagerImpl import com.intellij.openapi.components.impl.ServiceManagerImpl +import com.intellij.openapi.components.impl.stores.StoreUtil import com.intellij.openapi.components.stateStore +import com.intellij.openapi.project.impl.ProjectImpl import com.intellij.openapi.util.io.FileUtil import com.intellij.testFramework.ProjectRule import com.intellij.testFramework.assertions.Assertions.assertThat @@ -32,15 +35,22 @@ class DoNotSaveDefaultsTest { } @Test - fun test() { - val app = ApplicationManager.getApplication() as ApplicationImpl - val directory = app.stateStore.stateStorageManager.expandMacros(APP_CONFIG) - val dirPath = Paths.get(directory) + fun testApp() { + doTest(ApplicationManager.getApplication() as ApplicationImpl) + } + + @Test + fun testProject() { + doTest(projectRule.project as ProjectImpl) + } + + private fun doTest(componentManager: ComponentManagerImpl) { val useModCountOldValue = System.getProperty("store.save.use.modificationCount") // wake up - ServiceManagerImpl.processAllImplementationClasses(app, { clazz, pluginDescriptor -> - app.picoContainer.getComponentInstance(clazz.name) + val appPicoContainer = componentManager.picoContainer + ServiceManagerImpl.processAllImplementationClasses(componentManager, { clazz, _ -> + appPicoContainer.getComponentInstance(clazz.name) true }) @@ -49,11 +59,13 @@ class DoNotSaveDefaultsTest { propertyComponent.unsetValue("file.gist.reindex.count") // propertyComponent.unsetValue("CommitChangeListDialog.DETAILS_SPLITTER_PROPORTION_2") + + val app = ApplicationManager.getApplication() as ApplicationImpl try { System.setProperty("store.save.use.modificationCount", "false") app.doNotSave(false) runInEdtAndWait { - app.saveAll() + StoreUtil.save(componentManager.stateStore, null) } } finally { @@ -61,13 +73,13 @@ class DoNotSaveDefaultsTest { app.doNotSave(true) } - println(directory) - val directoryTree = printDirectoryTree(dirPath, setOf( + val directoryTree = printDirectoryTree(Paths.get(componentManager.stateStore.stateStorageManager.expandMacros(if (componentManager === app) APP_CONFIG else PROJECT_CONFIG_DIR)), setOf( "path.macros.xml" /* todo EP to register (provide) macro dynamically */, "stubIndex.xml" /* low-level non-roamable stuff */, "usage.statistics.xml" /* SHOW_NOTIFICATION_ATTR in internal mode */, "feature.usage.statistics.xml" /* non-roamable usage counters */, - "tomee.extensions.xml", "jboss.extensions.xml", "glassfish.extensions.xml" /* javaee non-roamable stuff, it will be better to fix it */, + "tomee.extensions.xml", "jboss.extensions.xml", + "glassfish.extensions.xml" /* javaee non-roamable stuff, it will be better to fix it */, "dimensions.xml" /* non-roamable sizes of window, dialogs, etc. */, "debugger.renderers.xml", "debugger.xml" /* todo */, "databaseSettings.xml" diff --git a/platform/lang-impl/src/com/intellij/packageDependencies/DependenciesToolWindow.java b/platform/lang-impl/src/com/intellij/packageDependencies/DependenciesToolWindow.java index b7919b020f1d..8bac8a06e99c 100644 --- a/platform/lang-impl/src/com/intellij/packageDependencies/DependenciesToolWindow.java +++ b/platform/lang-impl/src/com/intellij/packageDependencies/DependenciesToolWindow.java @@ -1,4 +1,6 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + */ package com.intellij.packageDependencies; import com.intellij.icons.AllIcons; @@ -13,23 +15,27 @@ import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.impl.content.ToolWindowContentUi; import com.intellij.ui.content.Content; import com.intellij.ui.content.ContentManager; +import org.jetbrains.annotations.NotNull; /** * @author yole */ public class DependenciesToolWindow { - public static DependenciesToolWindow getInstance(Project project) { - return ServiceManager.getService(project, DependenciesToolWindow.class); - } - private final Project myProject; private ContentManager myContentManager; - public DependenciesToolWindow(final Project project) { + public static DependenciesToolWindow getInstance(@NotNull Project project) { + return ServiceManager.getService(project, DependenciesToolWindow.class); + } + + public DependenciesToolWindow(@NotNull Project project) { myProject = project; StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); - if (toolWindowManager == null) return; + if (toolWindowManager == null) { + return; + } + ToolWindow toolWindow = toolWindowManager.registerToolWindow(ToolWindowId.DEPENDENCIES, true, ToolWindowAnchor.BOTTOM, @@ -43,13 +49,12 @@ public class DependenciesToolWindow { }); } - public void addContent(final Content content) { - final Runnable runnable = () -> { + public void addContent(@NotNull Content content) { + StartupManager.getInstance(myProject).runWhenProjectIsInitialized(() -> { myContentManager.addContent(content); myContentManager.setSelectedContent(content); ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.DEPENDENCIES).activate(null); - }; - StartupManager.getInstance(myProject).runWhenProjectIsInitialized(runnable); + }); } public void closeContent(Content content) { diff --git a/platform/platform-api/src/com/intellij/openapi/wm/ToolWindow.java b/platform/platform-api/src/com/intellij/openapi/wm/ToolWindow.java index e0061e94b2a6..1d4446d5c828 100644 --- a/platform/platform-api/src/com/intellij/openapi/wm/ToolWindow.java +++ b/platform/platform-api/src/com/intellij/openapi/wm/ToolWindow.java @@ -1,4 +1,6 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + */ package com.intellij.openapi.wm; import com.intellij.openapi.util.ActionCallback; @@ -149,10 +151,8 @@ public interface ToolWindow extends BusyObject { */ JComponent getComponent(); - ContentManager getContentManager(); - void setDefaultState(@Nullable ToolWindowAnchor anchor, @Nullable ToolWindowType type, @Nullable Rectangle floatingBounds); diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateOptions.kt b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateOptions.kt new file mode 100644 index 000000000000..525f74aedfe4 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateOptions.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + */ +package com.intellij.openapi.updateSettings.impl + +import com.intellij.openapi.components.BaseState +import com.intellij.util.xmlb.annotations.CollectionBean +import com.intellij.util.xmlb.annotations.OptionTag + +internal class UpdateOptions : BaseState() { + @get:CollectionBean + val pluginHosts by list() + + @get:CollectionBean + val ignoredBuildNumbers by list() + + @get:CollectionBean + val enabledExternalComponentSources by list() + + @get:CollectionBean + val knownExternalComponentSources by list() + + @get:CollectionBean + val externalUpdateChannels by map() + + @get:OptionTag("CHECK_NEEDED") + var isCheckNeeded by property(false) + + @get:OptionTag("LAST_TIME_CHECKED") + var lastTimeChecked by property(0L) + + @get:OptionTag("LAST_BUILD_CHECKED") + var lastBuildChecked by string() + + @get:OptionTag("UPDATE_CHANNEL_TYPE") + var updateChannelType by string(ChannelStatus.RELEASE.code) + + @get:OptionTag("SECURE_CONNECTION") + var isUseSecureConnection by property(true) +} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettings.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettings.java index aa54e4cc8c7a..b96f4fdeaa8e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettings.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettings.java @@ -1,17 +1,5 @@ /* - * Copyright 2000-2017 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. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package com.intellij.openapi.updateSettings.impl; @@ -19,16 +7,12 @@ import com.intellij.openapi.application.ApplicationInfo; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.components.*; import com.intellij.openapi.updateSettings.UpdateStrategyCustomization; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.SmartList; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.net.NetUtils; -import com.intellij.util.xmlb.annotations.CollectionBean; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -41,29 +25,13 @@ import java.util.stream.Stream; @Storage(value = "other.xml", deprecated = true) } ) -public class UpdateSettings implements PersistentStateComponent, UserUpdateSettings { - public static class State { - @CollectionBean public final List pluginHosts = new SmartList<>(); - @CollectionBean public final List ignoredBuildNumbers = new SmartList<>(); - - @CollectionBean public final List enabledExternalComponentSources = new SmartList<>(); - @CollectionBean public final List knownExternalComponentSources = new SmartList<>(); - @CollectionBean public final Map externalUpdateChannels = new HashMap<>(); - - public boolean CHECK_NEEDED = true; - public long LAST_TIME_CHECKED = 0; - - public String LAST_BUILD_CHECKED; - public String UPDATE_CHANNEL_TYPE = ChannelStatus.RELEASE.getCode(); - public boolean SECURE_CONNECTION = true; - } - +public class UpdateSettings implements PersistentStateComponent, UserUpdateSettings { public static UpdateSettings getInstance() { return ServiceManager.getService(UpdateSettings.class); } private final String myPackageManager = System.getProperty("ide.no.platform.update"); - private State myState = new State(); + private UpdateOptions myState = new UpdateOptions(); public boolean isPlatformUpdateEnabled() { return myPackageManager == null && !PathManager.isSnap(); @@ -71,72 +39,71 @@ public class UpdateSettings implements PersistentStateComponent getStoredPluginHosts() { - return myState.pluginHosts; + return myState.getPluginHosts(); } public boolean isCheckNeeded() { - return myState.CHECK_NEEDED; + return myState.isCheckNeeded(); } public void setCheckNeeded(boolean value) { - myState.CHECK_NEEDED = value; + myState.setCheckNeeded(value); } public List getEnabledExternalUpdateSources() { - return myState.enabledExternalComponentSources; + return myState.getEnabledExternalComponentSources(); } public List getKnownExternalUpdateSources() { - return myState.knownExternalComponentSources; + return myState.getKnownExternalComponentSources(); } public Map getExternalUpdateChannels() { - return myState.externalUpdateChannels; + return myState.getExternalUpdateChannels(); } public boolean isSecureConnection() { - return myState.SECURE_CONNECTION; + return myState.isUseSecureConnection(); } public void setSecureConnection(boolean value) { - myState.SECURE_CONNECTION = value; + myState.setUseSecureConnection(value); } public long getLastTimeChecked() { - return myState.LAST_TIME_CHECKED; + return myState.getLastTimeChecked(); } @NotNull @Override public List getIgnoredBuildNumbers() { - return myState.ignoredBuildNumbers; + return myState.getIgnoredBuildNumbers(); } @NotNull @Override public ChannelStatus getSelectedChannelStatus() { - return ChannelStatus.fromCode(myState.UPDATE_CHANNEL_TYPE); + return ChannelStatus.fromCode(myState.getUpdateChannelType()); } public void setSelectedChannelStatus(@NotNull ChannelStatus channel) { - myState.UPDATE_CHANNEL_TYPE = channel.getCode(); + myState.setUpdateChannelType(channel.getCode()); } @NotNull @@ -156,8 +123,9 @@ public class UpdateSettings implements PersistentStateComponent ch.compareTo(current) > 0).findFirst().orElse(ChannelStatus.RELEASE); } + @NotNull public List getPluginHosts() { - List hosts = new ArrayList<>(myState.pluginHosts); + List hosts = new ArrayList<>(myState.getPluginHosts()); String pluginHosts = System.getProperty("idea.plugin.hosts"); if (pluginHosts != null) { ContainerUtil.addAll(hosts, pluginHosts.split(";")); @@ -166,29 +134,29 @@ public class UpdateSettings implements PersistentStateComponent /** @deprecated use {@link #getSelectedChannelStatus()} (to be removed in IDEA 2018) */ @SuppressWarnings("unused") public String getUpdateChannelType() { - return myState.UPDATE_CHANNEL_TYPE; + return myState.getUpdateChannelType(); } /** @deprecated use {@link #setSelectedChannelStatus(ChannelStatus)} (to be removed in IDEA 2018) */ @SuppressWarnings("unused") public void setUpdateChannelType(@NotNull String value) { - myState.UPDATE_CHANNEL_TYPE = value; + myState.setUpdateChannelType(value); } // } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectFrameBounds.kt b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectFrameBounds.kt index 444f9abf5856..42511f46811c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectFrameBounds.kt +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectFrameBounds.kt @@ -1,5 +1,5 @@ /* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package com.intellij.openapi.wm.impl @@ -37,8 +37,7 @@ class ProjectFrameBounds(private val project: Project) : PersistentStateComponen } override fun getModificationCount(): Long { - val windowManager = WindowManager.getInstance() as WindowManagerImpl - val frameInfoInDeviceSpace = windowManager.getFrameInfoInDeviceSpace(project) + val frameInfoInDeviceSpace = (WindowManager.getInstance() as? WindowManagerImpl)?.getFrameInfoInDeviceSpace(project) if (frameInfoInDeviceSpace != null) { if (rawFrameInfo == null) { rawFrameInfo = frameInfoInDeviceSpace @@ -78,10 +77,10 @@ fun WindowManagerImpl.getFrameInfoInDeviceSpace(project: Project): FrameInfo? { return frameInfo } -private val X_ATTR = "x" -private val Y_ATTR = "y" -private val WIDTH_ATTR = "width" -private val HEIGHT_ATTR = "height" +private const val X_ATTR = "x" +private const val Y_ATTR = "y" +private const val WIDTH_ATTR = "width" +private const val HEIGHT_ATTR = "height" fun serializeBounds(bounds: Rectangle, element: Element) { element.setAttribute(X_ATTR, Integer.toString(bounds.x)) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java index f1c9b5c2c12d..0b236074bc2e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java @@ -1,7 +1,6 @@ /* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ - package com.intellij.openapi.wm.impl; import com.intellij.openapi.Disposable; @@ -406,7 +405,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { @Override public JComponent getComponent() { - return null; + return new JLabel(); } @Override diff --git a/python/src/META-INF/python-core-common.xml b/python/src/META-INF/python-core-common.xml index 3801dc04a336..10f71887904c 100644 --- a/python/src/META-INF/python-core-common.xml +++ b/python/src/META-INF/python-core-common.xml @@ -109,8 +109,7 @@ - + { companion object { @JvmStatic - val instance: PySdkSettings = ServiceManager.getService(PySdkSettings::class.java) + val instance: PySdkSettings + get() = ServiceManager.getService(PySdkSettings::class.java) private const val VIRTUALENV_ROOT_DIR_MACRO_NAME = "VIRTUALENV_ROOT_DIR" }