Fix margins for CodeStyle objects inside TabbedPaneWrapper

This commit is contained in:
Sergey Malenkov
2014-11-20 16:22:31 +03:00
parent 2b8dd92eb5
commit 6d62ca9382
17 changed files with 31 additions and 18 deletions
@@ -16,7 +16,7 @@
<border type="empty"/>
<children>
<grid id="452da" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<margin top="0" left="10" bottom="0" right="10"/>
<constraints/>
<properties/>
<border type="none"/>
@@ -12,10 +12,11 @@
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="empty"/>
<children>
<grid id="72ab4" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<margin top="0" left="10" bottom="10" right="10"/>
<constraints/>
<properties/>
<border type="none"/>
@@ -53,7 +53,6 @@ public class CodeStyleImportsPanel extends JPanel {
public CodeStyleImportsPanel(CodeStyleSettings settings) {
mySettings = settings;
setLayout(new BorderLayout());
setBorder(IdeBorderFactory.createEmptyBorder(2, 2, 2, 2));
add(myWholePanel, BorderLayout.CENTER);
myGeneralPanel.add(createGeneralOptionsPanel(), BorderLayout.CENTER);
@@ -21,8 +21,10 @@ import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.ui.OnePixelDivider;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;
import com.intellij.ui.border.CustomLineBorder;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -58,6 +60,7 @@ public class JavaDocFormattingPanel extends OptionTreeWithPreviewPanel {
}
});
myPanel.setBorder(new CustomLineBorder(OnePixelDivider.BACKGROUND, 1, 0, 0, 0));
myJavaDocPanel.add(BorderLayout.CENTER, myPanel);
myJavaDocPanel.add(myEnableCheckBox, BorderLayout.NORTH);
}
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.json.formatter.JsonCodeStylePanel">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<margin top="0" left="10" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
@@ -35,6 +35,7 @@ import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectUtil;
import com.intellij.openapi.ui.OnePixelDivider;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
@@ -42,8 +43,10 @@ import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiFileFactory;
import com.intellij.psi.codeStyle.*;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.UserActivityListener;
import com.intellij.ui.UserActivityWatcher;
import com.intellij.ui.border.CustomLineBorder;
import com.intellij.util.Alarm;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.LocalTimeCounter;
@@ -468,6 +471,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable {
protected void installPreviewPanel(final JPanel previewPanel) {
previewPanel.setLayout(new BorderLayout());
previewPanel.add(myEditor.getComponent(), BorderLayout.CENTER);
previewPanel.setBorder(new CustomLineBorder(OnePixelDivider.BACKGROUND, 0, 1, 0, 0));
}
@NonNls
@@ -31,10 +31,12 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectUtil;
import com.intellij.openapi.ui.JBMenuItem;
import com.intellij.openapi.ui.JBPopupMenu;
import com.intellij.openapi.ui.OnePixelDivider;
import com.intellij.openapi.util.Disposer;
import com.intellij.psi.codeStyle.*;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.TabbedPaneWrapper;
import com.intellij.ui.border.CustomLineBorder;
import com.intellij.util.containers.hash.HashSet;
import com.intellij.util.ui.GraphicsUtil;
import org.jetbrains.annotations.NotNull;
@@ -396,6 +398,7 @@ public abstract class TabbedLanguageCodeStylePanel extends CodeStyleAbstractPane
protected void installPreviewPanel(JPanel previewPanel) {
previewPanel.setLayout(new BorderLayout());
previewPanel.add(getEditor().getComponent(), BorderLayout.CENTER);
previewPanel.setBorder(new CustomLineBorder(OnePixelDivider.BACKGROUND, 0, 1, 0, 0));
}
@Override
@@ -425,6 +428,7 @@ public abstract class TabbedLanguageCodeStylePanel extends CodeStyleAbstractPane
protected void installPreviewPanel(JPanel previewPanel) {
previewPanel.setLayout(new BorderLayout());
previewPanel.add(getEditor().getComponent(), BorderLayout.CENTER);
previewPanel.setBorder(new CustomLineBorder(OnePixelDivider.BACKGROUND, 0, 1, 0, 0));
}
}
@@ -445,6 +449,7 @@ public abstract class TabbedLanguageCodeStylePanel extends CodeStyleAbstractPane
protected void installPreviewPanel(JPanel previewPanel) {
previewPanel.setLayout(new BorderLayout());
previewPanel.add(getEditor().getComponent(), BorderLayout.CENTER);
previewPanel.setBorder(new CustomLineBorder(OnePixelDivider.BACKGROUND, 0, 1, 0, 0));
}
}
@@ -563,22 +568,20 @@ public abstract class TabbedLanguageCodeStylePanel extends CodeStyleAbstractPane
private final IndentOptionsEditor myEditor;
private final LanguageCodeStyleSettingsProvider myProvider;
private final JPanel myTopPanel;
private final JPanel myLeftPanel;
private final JPanel myTopPanel = new JPanel(new BorderLayout());
private final JPanel myLeftPanel = new JPanel(new BorderLayout());
private final JPanel myRightPanel;
protected MyIndentOptionsWrapper(CodeStyleSettings settings, LanguageCodeStyleSettingsProvider provider, IndentOptionsEditor editor) {
super(settings);
myProvider = provider;
myTopPanel = new JPanel();
myTopPanel.setLayout(new BorderLayout(8, 0));
myLeftPanel = new JPanel(new BorderLayout());
myTopPanel.add(myLeftPanel, BorderLayout.WEST);
myRightPanel = new JPanel();
installPreviewPanel(myRightPanel);
myEditor = editor;
if (myEditor != null) {
JPanel panel = myEditor.createPanel();
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JScrollPane scroll = ScrollPaneFactory.createScrollPane(panel, true);
scroll.setPreferredSize(new Dimension(panel.getPreferredSize().width + scroll.getVerticalScrollBar().getPreferredSize().width + 5, -1));
myLeftPanel.add(scroll, BorderLayout.CENTER);
@@ -55,7 +55,6 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
public CodeStyleBlankLinesPanel(CodeStyleSettings settings) {
super(settings);
myPanel.setBorder(IdeBorderFactory.createEmptyBorder(2, 2, 2, 2));
init();
}
@@ -85,6 +84,7 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
new GridBagConstraints(0, 2, 1, 1, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0,
0));
optionsPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
JScrollPane scroll = ScrollPaneFactory.createScrollPane(optionsPanel, true);
scroll.getVerticalScrollBar().setUnitIncrement(10);
scroll.setMinimumSize(new Dimension(optionsPanel.getPreferredSize().width + scroll.getVerticalScrollBar().getPreferredSize().width + 5, -1));
@@ -92,7 +92,7 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
myPanel
.add(scroll,
new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));
new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
final JPanel previewPanel = createPreviewPanel();
myPanel
@@ -29,6 +29,7 @@ import com.intellij.openapi.fileTypes.FileTypeEditorHighlighterProviders;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectUtil;
import com.intellij.openapi.ui.OnePixelDivider;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleManager;
@@ -36,6 +37,7 @@ import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable;
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;
import com.intellij.ui.AncestorListenerAdapter;
import com.intellij.ui.border.CustomLineBorder;
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
@@ -246,6 +248,7 @@ public abstract class MultilanguageCodeStyleAbstractPanel extends CodeStyleAbstr
else {
// If settings are language-specific
previewPanel.add(getEditor().getComponent(), BorderLayout.CENTER);
previewPanel.setBorder(new CustomLineBorder(OnePixelDivider.BACKGROUND, 0, 1, 0, 0));
updatePreview(true);
}
}
@@ -85,7 +85,7 @@ public abstract class OptionTableWithPreviewPanel extends MultilanguageCodeStyle
};
myPanel.add(scrollPane
, new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 8), 0, 0));
new Insets(0, 0, 0, 0), 0, 0));
final JPanel previewPanel = createPreviewPanel();
myPanel.add(previewPanel,
@@ -80,7 +80,7 @@ public abstract class OptionTreeWithPreviewPanel extends MultilanguageCodeStyleA
};
myPanel.add(scrollPane,
new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 8), 0, 0));
new Insets(0, 0, 0, 0), 0, 0));
JPanel previewPanel = createPreviewPanel();
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.codeStyle.RightMarginForm">
<grid id="27dc6" binding="myTopPanel" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
@@ -81,6 +81,7 @@ public abstract class ArrangementSettingsPanel extends CodeStyleAbstractPanel {
myGroupingRulesPanel = new ArrangementGroupingRulesPanel(settingsManager, colorsProvider);
myMatchingRulesPanel = new ArrangementMatchingRulesPanel(myLanguage, settingsManager, colorsProvider);
myContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
myContent.add(myGroupingRulesPanel, new GridBag().coverLine().fillCellHorizontally().weightx(1));
myContent.add(myMatchingRulesPanel, new GridBag().fillCell().weightx(1).weighty(1).coverLine());
@@ -16,7 +16,7 @@
<border type="none"/>
<children>
<grid id="72ab4" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<margin top="0" left="10" bottom="10" right="10"/>
<constraints/>
<properties/>
<border type="none"/>
@@ -49,7 +49,6 @@ public class GrCodeStyleImportsPanel extends JPanel {
public GrCodeStyleImportsPanel() {
setLayout(new BorderLayout());
setBorder(IdeBorderFactory.createEmptyBorder(2, 2, 2, 2));
add(myWholePanel, BorderLayout.CENTER);
myGeneralPanel.add(createGeneralOptionsPanel(), BorderLayout.CENTER);
@@ -35,7 +35,7 @@
<border type="empty"/>
<children>
<grid id="b4cfb" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<margin top="10" left="10" bottom="10" right="10"/>
<constraints/>
<properties/>
<border type="none"/>
@@ -18,7 +18,7 @@
<border type="empty"/>
<children>
<grid id="265f" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<margin top="10" left="10" bottom="10" right="10"/>
<constraints/>
<properties/>
<border type="none"/>