Skip to content

Commit

Permalink
Minor style cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
PyvesB committed Feb 20, 2022
1 parent d3f9fd1 commit d6ff0eb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public void createControl(Composite parent) {
Composite resComposite = new Composite(parent, SWT.NONE);
resComposite.setLayout(new GridLayout(2, false));
new Label(resComposite, SWT.NONE).setText("Ruby script");
this.programPathText = new Text(resComposite, SWT.BORDER);
this.programPathText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
programPathText = new Text(resComposite, SWT.BORDER);
programPathText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
ControlDecoration decoration = new ControlDecoration(programPathText, SWT.TOP | SWT.LEFT);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
FieldDecorationRegistry.DEC_ERROR);
decoration.setImage(fieldDecoration.getImage());
this.programPathText.addModifyListener(event -> {
programPathText.addModifyListener(event -> {
setDirty(true);
File file = new File(programPathText.getText());
if (!file.isFile()) {
Expand All @@ -76,16 +76,16 @@ public void createControl(Composite parent) {
updateLaunchConfigurationDialog();
});
new Label(resComposite, SWT.NONE).setText("Arguments");
this.argumentsText = new Text(resComposite, SWT.BORDER);
this.argumentsText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
this.argumentsText.addModifyListener(e -> {
argumentsText = new Text(resComposite, SWT.BORDER);
argumentsText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
argumentsText.addModifyListener(e -> {
setDirty(true);
updateLaunchConfigurationDialog();
});
new Label(resComposite, SWT.NONE).setText("Working directory");
this.workingDirectoryText = new Text(resComposite, SWT.BORDER);
this.workingDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
this.workingDirectoryText.addModifyListener(e -> {
workingDirectoryText = new Text(resComposite, SWT.BORDER);
workingDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
workingDirectoryText.addModifyListener(e -> {
setDirty(true);
updateLaunchConfigurationDialog();
});
Expand All @@ -100,19 +100,19 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
try {
this.programPathText.setText(configuration.getAttribute(RubyLaunchShortcut.SCRIPT, ""));
this.argumentsText.setText(configuration.getAttribute(RubyLaunchShortcut.ARGUMENTS, ""));
this.workingDirectoryText.setText(configuration.getAttribute(DebugPlugin.ATTR_WORKING_DIRECTORY, ""));
programPathText.setText(configuration.getAttribute(RubyLaunchShortcut.SCRIPT, ""));
argumentsText.setText(configuration.getAttribute(RubyLaunchShortcut.ARGUMENTS, ""));
workingDirectoryText.setText(configuration.getAttribute(DebugPlugin.ATTR_WORKING_DIRECTORY, ""));
} catch (CoreException e) {
LogHelper.error("Exception whilst initializing launch configuration tab", e);
}
}

@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(RubyLaunchShortcut.SCRIPT, this.programPathText.getText());
configuration.setAttribute(RubyLaunchShortcut.ARGUMENTS, this.argumentsText.getText());
configuration.setAttribute(DebugPlugin.ATTR_WORKING_DIRECTORY, this.workingDirectoryText.getText());
configuration.setAttribute(RubyLaunchShortcut.SCRIPT, programPathText.getText());
configuration.setAttribute(RubyLaunchShortcut.ARGUMENTS, argumentsText.getText());
configuration.setAttribute(DebugPlugin.ATTR_WORKING_DIRECTORY, workingDirectoryText.getText());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class RubyLaunchTabGroup extends AbstractLaunchConfigurationTabGroup {
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
setTabs(new RubyLaunchTab(), new CommonTab());

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void dispose() {
gitHubImage.dispose();
}
}

public FileFieldEditor getPathField(String gem) {
return "readapt".equalsIgnoreCase(gem) ? readaptPath : gemPath;
}
Expand Down

0 comments on commit d6ff0eb

Please sign in to comment.