mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Make ArrangementSettingsPanel not abstract because all its implementations are equal,
and all abstract methods were useless anyway because Arrangement tab contains no text preview.
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.application.options;
|
||||
|
||||
import com.intellij.application.options.codeStyle.arrangement.ArrangementSettingsPanel;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Denis Zhdanov
|
||||
* @since 8/8/12 8:57 AM
|
||||
*/
|
||||
public class JavaArrangementPanel extends ArrangementSettingsPanel {
|
||||
|
||||
public JavaArrangementPanel(@NotNull CodeStyleSettings settings) {
|
||||
super(settings, JavaLanguage.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRightMargin() {
|
||||
return 80;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected FileType getFileType() {
|
||||
return JavaFileType.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPreviewText() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,7 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.application.options;
|
||||
|
||||
import com.intellij.application.options.codeStyle.arrangement.ArrangementSettingsPanel;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
@@ -34,12 +21,11 @@ public class JavaCodeStyleMainPanel extends TabbedLanguageCodeStylePanel {
|
||||
super.initTabs(settings);
|
||||
addTab(new JavaDocFormattingPanel(settings));
|
||||
addTab(new CodeStyleImportsPanelWrapper(settings));
|
||||
addTab(new JavaArrangementPanel(settings));
|
||||
addTab(new ArrangementSettingsPanel(settings, JavaLanguage.INSTANCE));
|
||||
for (CodeStyleSettingsProvider provider : Extensions.getExtensions(CodeStyleSettingsProvider.EXTENSION_POINT_NAME)) {
|
||||
if (provider.getLanguage() == JavaLanguage.INSTANCE && !provider.hasSettingsPage()) {
|
||||
createTab(provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+25
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.application.options.codeStyle.arrangement;
|
||||
|
||||
import com.intellij.application.options.CodeStyleAbstractPanel;
|
||||
@@ -23,8 +9,11 @@ import com.intellij.application.options.codeStyle.arrangement.group.ArrangementG
|
||||
import com.intellij.application.options.codeStyle.arrangement.match.ArrangementMatchingRulesPanel;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypes;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
@@ -32,6 +21,7 @@ import com.intellij.psi.codeStyle.arrangement.Rearranger;
|
||||
import com.intellij.psi.codeStyle.arrangement.group.ArrangementGroupingRule;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.ArrangementSectionRule;
|
||||
import com.intellij.psi.codeStyle.arrangement.std.*;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import com.intellij.util.ui.GridBag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -48,7 +38,7 @@ import java.util.List;
|
||||
* @author Denis Zhdanov
|
||||
* @since 10/30/12 5:17 PM
|
||||
*/
|
||||
public abstract class ArrangementSettingsPanel extends CodeStyleAbstractPanel {
|
||||
public class ArrangementSettingsPanel extends CodeStyleAbstractPanel {
|
||||
|
||||
@NotNull private final JPanel myContent = new JPanel(new GridBagLayout());
|
||||
|
||||
@@ -85,8 +75,6 @@ public abstract class ArrangementSettingsPanel extends CodeStyleAbstractPanel {
|
||||
myContent.add(myGroupingRulesPanel, new GridBag().coverLine().fillCellHorizontally().weightx(1));
|
||||
myContent.add(myMatchingRulesPanel, new GridBag().fillCell().weightx(1).weighty(1).coverLine());
|
||||
|
||||
|
||||
|
||||
if (settings.getCommonSettings(myLanguage).isForceArrangeMenuAvailable()) {
|
||||
myForceArrangementPanel = new ForceArrangementPanel();
|
||||
myForceArrangementPanel.setSelectedMode(settings.getCommonSettings(language).FORCE_REARRANGE_MODE);
|
||||
@@ -182,4 +170,23 @@ public abstract class ArrangementSettingsPanel extends CodeStyleAbstractPanel {
|
||||
protected String getTabTitle() {
|
||||
return ApplicationBundle.message("arrangement.title.settings.tab");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected String getPreviewText() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRightMargin() {
|
||||
Logger.getInstance(ArrangementSettingsPanel.class).error("This method should not be called because getPreviewText() returns null");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected FileType getFileType() {
|
||||
Logger.getInstance(ArrangementSettingsPanel.class).error("This method should not be called because getPreviewText() returns null");
|
||||
return ObjectUtils.notNull(myLanguage.getAssociatedFileType(), FileTypes.UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,9 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// 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.application.options;
|
||||
|
||||
import com.intellij.ide.highlighter.HtmlFileType;
|
||||
import com.intellij.application.options.codeStyle.arrangement.ArrangementSettingsPanel;
|
||||
import com.intellij.lang.html.HTMLLanguage;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.xml.arrangement.XmlArrangementPanel;
|
||||
|
||||
/**
|
||||
* @author Rustam Vishnyakov
|
||||
@@ -32,6 +17,6 @@ public class HtmlCodeStyleMainPanel extends TabbedLanguageCodeStylePanel {
|
||||
protected void initTabs(CodeStyleSettings settings) {
|
||||
addIndentOptionsTab(settings);
|
||||
addTab(new CodeStyleHtmlPanel(settings));
|
||||
addTab(new XmlArrangementPanel(settings, HTMLLanguage.INSTANCE, HtmlFileType.INSTANCE));
|
||||
addTab(new ArrangementSettingsPanel(settings, HTMLLanguage.INSTANCE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.application.options;
|
||||
|
||||
import com.intellij.ide.highlighter.XmlFileType;
|
||||
import com.intellij.application.options.codeStyle.arrangement.ArrangementSettingsPanel;
|
||||
import com.intellij.lang.xml.XMLLanguage;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
|
||||
import com.intellij.xml.arrangement.XmlArrangementPanel;
|
||||
|
||||
/**
|
||||
* @author Rustam Vishnyakov
|
||||
@@ -34,7 +19,7 @@ public class XmlCodeStyleMainPanel extends TabbedLanguageCodeStylePanel {
|
||||
protected void initTabs(CodeStyleSettings settings) {
|
||||
addIndentOptionsTab(settings);
|
||||
addTab(new CodeStyleXmlPanel(settings));
|
||||
addTab(new XmlArrangementPanel(settings, XMLLanguage.INSTANCE, XmlFileType.INSTANCE));
|
||||
addTab(new ArrangementSettingsPanel(settings, XMLLanguage.INSTANCE));
|
||||
|
||||
for (CodeStyleSettingsProvider provider : Extensions.getExtensions(CodeStyleSettingsProvider.EXTENSION_POINT_NAME)) {
|
||||
if (provider.getLanguage() == XMLLanguage.INSTANCE && !provider.hasSettingsPage()) {
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.intellij.xml.arrangement;
|
||||
|
||||
import com.intellij.application.options.codeStyle.arrangement.ArrangementSettingsPanel;
|
||||
import com.intellij.lang.xml.XMLLanguage;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Eugene.Kudelevsky
|
||||
*/
|
||||
public class XmlArrangementPanel extends ArrangementSettingsPanel {
|
||||
private final FileType myFileType;
|
||||
|
||||
public XmlArrangementPanel(@NotNull CodeStyleSettings settings, XMLLanguage language, FileType fileType) {
|
||||
super(settings, language);
|
||||
myFileType = fileType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRightMargin() {
|
||||
return 80;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected FileType getFileType() {
|
||||
return myFileType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPreviewText() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user