Skip to content

Commit

Permalink
Add vertical padding to preferences page options
Browse files Browse the repository at this point in the history
  • Loading branch information
PyvesB committed Jul 20, 2024
1 parent 70b0f7d commit 1b77f99
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ public void createFieldEditors() {
parent.setLayout(new GridLayout(1, false));
Font defaultFont = parent.getFont();

addPadding(parent, 1);

Group pathsGroup = new Group(parent, SWT.NONE);
pathsGroup.setText("Solargraph (language server) and Readapt (debugger) executables");
pathsGroup.setLayout(new GridLayout(3, false)); // 3 columns for label, input field, and browse button.
pathsGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
addPadding(pathsGroup, 3);
Composite gemPathComposite = new Composite(pathsGroup, SWT.NONE);
gemPathComposite.setLayout(new GridLayout(3, false));
gemPathComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Expand All @@ -86,11 +89,15 @@ public void createFieldEditors() {
pathsGroup);
updateGemFieldEditor.getDescriptionControl(pathsGroup).setFont(defaultFont);
addField(updateGemFieldEditor);
addPadding(pathsGroup, 3);

addPadding(parent, 1);

Group runAsGroup = new Group(parent, SWT.NONE);
runAsGroup.setText("Run *.rb, Gemfile, and *.gemspec files");
runAsGroup.setLayout(new GridLayout(1, false));
runAsGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
addPadding(runAsGroup, 1);
systemRubyFieldEditor = new BooleanFieldEditor(SYSTEM_RUBY.getKey(), SYSTEM_RUBY.getDesc(), runAsGroup);
systemRubyFieldEditor.getDescriptionControl(runAsGroup).setFont(defaultFont);
addField(systemRubyFieldEditor);
Expand All @@ -104,11 +111,15 @@ public void createFieldEditors() {
rubyDirFieldEditor.getLabelControl(rubyDirFieldEditorParent).setFont(defaultFont);
rubyDirFieldEditor.setEnabled(!SYSTEM_RUBY.getValue(), rubyDirFieldEditorParent);
addField(rubyDirFieldEditor);
addPadding(runAsGroup, 1);

addPadding(parent, 1);

Group optionsGroup = new Group(parent, SWT.NONE);
optionsGroup.setText("Other options");
optionsGroup.setLayout(new GridLayout(1, false));
optionsGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
addPadding(optionsGroup, 1);
BooleanFieldEditor solargraphDiagnosticsFieldEditor = new BooleanFieldEditor(SOLARGRAPH_DIAGNOSTICS.getKey(),
SOLARGRAPH_DIAGNOSTICS.getDesc(), optionsGroup);
solargraphDiagnosticsFieldEditor.getDescriptionControl(optionsGroup).setFont(defaultFont);
Expand All @@ -117,6 +128,9 @@ public void createFieldEditors() {
DEBUG_READAPT.getDesc(), optionsGroup);
debugReadaptFieldEditor.getDescriptionControl(optionsGroup).setFont(defaultFont);
addField(debugReadaptFieldEditor);
addPadding(optionsGroup, 1);

addPadding(parent, 1);

Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new RowLayout(SWT.HORIZONTAL));
Expand Down Expand Up @@ -157,4 +171,12 @@ public void dispose() {
public FileFieldEditor getPathField(String gem) {
return "readapt".equalsIgnoreCase(gem) ? readaptPath : gemPath;
}

private void addPadding(Composite composite, int columns) {
Label spacer = new Label(composite, SWT.NONE);
GridData spacerData = new GridData();
spacerData.horizontalSpan = columns;
spacerData.heightHint = 2;
spacer.setLayoutData(spacerData);
}
}

0 comments on commit 1b77f99

Please sign in to comment.