Merge branch 'sdombrovsky/OC-15178'

This commit is contained in:
Stanislav Dombrovsky
2017-11-20 15:35:01 +03:00
6 changed files with 143 additions and 8 deletions

View File

@@ -27,6 +27,13 @@ public class WelcomeWizardUtil {
private static volatile String ourWizardMacKeymap;
private static volatile String ourWizardEditorScheme;
private static volatile Boolean ourAutoScrollToSource;
private static volatile Integer ourCompletionCaseSensitive;
private static volatile Boolean ourManualOrder;
private static volatile Integer ourTabsPlacement;
private static volatile Integer ourContinuationIndent;
private static volatile Integer ourAppearanceFontSize;
private static volatile String ourAppearanceFontFace;
private static volatile Boolean ourDisableBreakpointsOnClick;
private static final Set<String> ourFeaturedPluginsToInstall = new HashSet<>();
public static void setDefaultLAF(String laf) {
@@ -80,4 +87,60 @@ public class WelcomeWizardUtil {
ourFeaturedPluginsToInstall.clear();
ourFeaturedPluginsToInstall.addAll(pluginsToInstall);
}
public static Boolean getDisableBreakpointsOnClick() {
return ourDisableBreakpointsOnClick;
}
public static void setDisableBreakpointsOnClick(Boolean disableBreakpointsOnClick) {
ourDisableBreakpointsOnClick = disableBreakpointsOnClick;
}
public static void setCompletionCaseSensitive(Integer completionCaseSensitive) {
ourCompletionCaseSensitive = completionCaseSensitive;
}
public static Integer getCompletionCaseSensitive() {
return ourCompletionCaseSensitive;
}
public static Boolean getManualOrder() {
return ourManualOrder;
}
public static void setManualOrder(Boolean manualOrder) {
ourManualOrder = manualOrder;
}
public static void setTabsPlacement(Integer tabsPlacement) {
ourTabsPlacement = tabsPlacement;
}
public static Integer getTabsPlacement() {
return ourTabsPlacement;
}
public static void setContinuationIndent(Integer continuationIndent) {
ourContinuationIndent = continuationIndent;
}
public static Integer getContinuationIndent() {
return ourContinuationIndent;
}
public static Integer getAppearanceFontSize() {
return ourAppearanceFontSize;
}
public static void setAppearanceFontSize(Integer appearanceFontSize) {
ourAppearanceFontSize = appearanceFontSize;
}
public static String getAppearanceFontFace() {
return ourAppearanceFontFace;
}
public static void setAppearanceFontFace(String appearanceFontFace) {
ourAppearanceFontFace = appearanceFontFace;
}
}

View File

@@ -15,7 +15,6 @@
*/
package com.intellij.ide.ui
import com.intellij.ide.WelcomeWizardUtil
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.*
@@ -84,7 +83,7 @@ class UISettings : BaseState(), PersistentStateComponent<UISettings> {
@get:OptionTag("SCROLL_TAB_LAYOUT_IN_EDITOR") var scrollTabLayoutInEditor by storedProperty(true)
@get:OptionTag("HIDE_TABS_IF_NEED") var hideTabsIfNeed by storedProperty(true)
@get:OptionTag("SHOW_CLOSE_BUTTON") var showCloseButton by storedProperty(true)
@get:OptionTag("EDITOR_TAB_PLACEMENT") var editorTabPlacement by storedProperty(1)
@get:OptionTag("EDITOR_TAB_PLACEMENT") var editorTabPlacement by storedProperty(SwingConstants.TOP)
@get:OptionTag("HIDE_KNOWN_EXTENSION_IN_TABS") var hideKnownExtensionInTabs by storedProperty(false)
@get:OptionTag("SHOW_ICONS_IN_QUICK_NAVIGATION") var showIconInQuickNavigation by storedProperty(true)
@@ -127,12 +126,6 @@ class UISettings : BaseState(), PersistentStateComponent<UISettings> {
private val myTreeDispatcher = ComponentTreeEventDispatcher.create(UISettingsListener::class.java)
init {
WelcomeWizardUtil.getAutoScrollToSource()?.let {
defaultAutoScrollToSource = it
}
}
private fun withDefFont(): UISettings {
initDefFont()
return this

View File

@@ -0,0 +1,69 @@
/*
* 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.
*/
package com.intellij.ide.customize
import com.intellij.codeInsight.CodeInsightSettings
import com.intellij.ide.WelcomeWizardUtil
import com.intellij.ide.projectView.impl.ProjectViewSharedSettings
import com.intellij.ide.ui.LafManager
import com.intellij.ide.ui.UISettings
import com.intellij.lang.Language
import com.intellij.openapi.components.ApplicationComponent
import com.intellij.openapi.util.registry.Registry
import com.intellij.psi.codeStyle.*
class WelcomeWizardHelper : ApplicationComponent {
override fun initComponent() {
//Project View settings
WelcomeWizardUtil.getAutoScrollToSource()?.let {
ProjectViewSharedSettings.instance.autoscrollToSource = it
}
WelcomeWizardUtil.getManualOrder()?.let {
ProjectViewSharedSettings.instance.manualOrder = it
}
//Debugger settings
WelcomeWizardUtil.getDisableBreakpointsOnClick()?.let{
Registry.get("debugger.click.disable.breakpoints").setValue(it)
}
//Code insight settings
WelcomeWizardUtil.getCompletionCaseSensitive()?.let {
CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = it
}
//Code style settings
WelcomeWizardUtil.getContinuationIndent()?.let {
Language.getRegisteredLanguages()
.map { CodeStyleSettingsManager.getInstance().currentSettings.getIndentOptions(it.associatedFileType) }
.filter { it.CONTINUATION_INDENT_SIZE > WelcomeWizardUtil.getContinuationIndent() }
.forEach { it.CONTINUATION_INDENT_SIZE = WelcomeWizardUtil.getContinuationIndent() }
}
//UI settings
WelcomeWizardUtil.getTabsPlacement()?.let {
UISettings.instance.editorTabPlacement = it
}
WelcomeWizardUtil.getAppearanceFontSize()?.let {
UISettings.instance.overrideLafFonts = true
UISettings.instance.fontSize = it
}
WelcomeWizardUtil.getAppearanceFontFace()?.let {
UISettings.instance.overrideLafFonts = true
UISettings.instance.fontFace = it
}
LafManager.getInstance().updateUI()
}
}

View File

@@ -1933,11 +1933,17 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
@Override
public boolean isManualOrder(String paneId) {
if (isGlobalOptions()) {
return getGlobalOptions().getManualOrder();
}
return getPaneOptionValue(myManualOrder, paneId, ourManualOrderDefaults);
}
@Override
public void setManualOrder(@NotNull String paneId, final boolean enabled) {
if (isGlobalOptions()) {
getGlobalOptions().setManualOrder(enabled);
}
setPaneOption(myManualOrder, enabled, paneId, false);
final AbstractProjectViewPane pane = getProjectViewPaneById(paneId);
pane.installComparator();

View File

@@ -38,6 +38,7 @@ class ProjectViewSharedSettings : PersistentStateComponent<ProjectViewSharedSett
var autoscrollFromSource = false
var autoscrollToSource = false
var foldersAlwaysOnTop = true
var manualOrder = false
override fun getState(): ProjectViewSharedSettings? {
return this

View File

@@ -145,6 +145,9 @@
<interface-class>org.jetbrains.ide.BuiltInServerManager</interface-class>
<implementation-class>org.jetbrains.ide.BuiltInServerManagerImpl</implementation-class>
</component>
<component>
<implementation-class>com.intellij.ide.customize.WelcomeWizardHelper</implementation-class>
</component>
</application-components>
<project-components>