Skip to content

Commit

Permalink
[eclipse] Refactoring the main SARL launching UI panel.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Dec 5, 2020
1 parent 0033c14 commit 0d5f64d
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 10 deletions.
Expand Up @@ -68,6 +68,8 @@ public class Messages extends NLS {
public static String SARLMainLaunchConfigurationTab_1;
public static String SARLMainLaunchConfigurationTab_2;
public static String SARLMainLaunchConfigurationTab_3;
public static String SARLMainLaunchConfigurationTab_4;
public static String SARLMainLaunchConfigurationTab_5;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Expand Down
Expand Up @@ -312,9 +312,6 @@ protected void createLaunchOptionEditor(Composite parent, String text) {
this.logLevelCombo = SWTFactory.createCombo(group, SWT.READ_ONLY, 1, new String[0]);
this.logLevelCombo.addSelectionListener(this.defaultListener);

this.logShowStartInformationButton = SWTFactory.createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_3, null, false, 2);
this.logShowStartInformationButton.addSelectionListener(this.defaultListener);

createVerticalSpacer(group, 2);

this.enableAssertionsInRunModeButton = SWTFactory.createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_2, null, false, 2);
Expand All @@ -325,8 +322,13 @@ protected void createLaunchOptionEditor(Composite parent, String text) {

createVerticalSpacer(group, 2);

this.runInEclipseButton = SWTFactory.createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_0, null, false, 2);
this.runInEclipseButton = SWTFactory.createCheckButton(group,
MessageFormat.format(Messages.SARLMainLaunchConfigurationTab_0, Messages.SARLMainLaunchConfigurationTab_5),
null, false, 2);
this.runInEclipseButton.addSelectionListener(this.defaultListener);

this.logShowStartInformationButton = SWTFactory.createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_3, null, false, 2);
this.logShowStartInformationButton.addSelectionListener(this.defaultListener);
}

@Override
Expand Down
Expand Up @@ -22,6 +22,8 @@
package io.sarl.eclipse.launching.dialog;

import java.lang.ref.SoftReference;
import java.text.MessageFormat;

import javax.inject.Inject;

import org.eclipse.debug.core.ILaunchConfiguration;
Expand Down Expand Up @@ -128,14 +130,18 @@ public void createControl(Composite parent) {
*/
protected void createLaunchOptionEditor(Composite parent, String text) {
final Group group = SWTFactory.createGroup(parent, text, 1, 1, GridData.FILL_HORIZONTAL);
this.logShowStartInformationButton = SWTFactory.createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_3, null, false, 2);
this.logShowStartInformationButton.addSelectionListener(this.defaultListener);
this.enableAssertionsInRunModeButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_2);
this.enableAssertionsInRunModeButton.addSelectionListener(this.defaultListener);
this.enableAssertionsInDebugModeButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_1);
this.enableAssertionsInDebugModeButton.addSelectionListener(this.defaultListener);
this.runInEclipseButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_0);

createVerticalSpacer(group, 1);

this.runInEclipseButton = createCheckButton(group,
MessageFormat.format(Messages.SARLMainLaunchConfigurationTab_0, Messages.SARLMainLaunchConfigurationTab_4));
this.runInEclipseButton.addSelectionListener(this.defaultListener);
this.logShowStartInformationButton = SWTFactory.createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_3, null, false, 2);
this.logShowStartInformationButton.addSelectionListener(this.defaultListener);
}

/**
Expand Down
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Spinner;

/**
Expand Down Expand Up @@ -110,8 +111,34 @@ public static ControlDecoration createInfoDecorator(Control parent, String text,
* @param text the information message.
* @return the decorator.
*/
public static ControlDecoration createInfoDecorator(Control parent, String text) {
public static ControlDecoration createInfoDecorator_(Control parent, String text) {
return createInfoDecorator(parent, text, SWT.TOP | SWT.LEFT);
}

/** Create a big information icon that shows up an information message in its tool tip text.
*
* @param parent the component that receives the info bubble.
* @param text the information message.
* @param hspan the number of columns occupied by the bubble icon.
* @return the information icon widget.
*/
public static Label createInfoBubble(Composite parent, String text, int hspan) {
final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
final Image img = fieldDecoration.getImage();
final Label txtDecorator = createLabel(parent, "", hspan); //$NON-NLS-0$
txtDecorator.setImage(img);
txtDecorator.setToolTipText(text);
return txtDecorator;
}

/** Create a big information icon that shows up an information message in its tool tip text.
*
* @param parent the component that receives the info bubble.
* @param text the information message.
* @return the information icon widget.
*/
public static Label createInfoBubble(Composite parent, String text) {
return createInfoBubble(parent, text, 1);
}

}
Expand Up @@ -28,7 +28,9 @@ SARLArgumentsTab_2=Arguments for the Java virtual machine (JVM):
SARLArgumentsTab_3=Arguments for the Java virtual machine (JVM):
SARLArgumentsTab_4=Exception occurred reading configuration: {0}
SARLArgumentsTab_5=For setting the max memory size of your application, use "-Xmx <SIZE>M"
SARLMainLaunchConfigurationTab_0=Run in the SARL product VM (experimental)
SARLMainLaunchConfigurationTab_0=Run in the SARL product VM (experimental). Only {0}, SRE and '-D' JVM arguments are considered.
SARLMainLaunchConfigurationTab_1=Enable assertions (-ea) in debug mode
SARLMainLaunchConfigurationTab_2=Enable assertions (-ea) in run mode
SARLMainLaunchConfigurationTab_3=Show launch parameters on the console
SARLMainLaunchConfigurationTab_3=Show launch parameters in the SARL product logs
SARLMainLaunchConfigurationTab_4=program
SARLMainLaunchConfigurationTab_5=boot agent

0 comments on commit 0d5f64d

Please sign in to comment.