@@ -62,6 +62,9 @@ public class StartTab extends AbstractLaunchConfigurationTab {
6262 /** Configuration map key with a value stating whether or not the associated project ran in a container. */
6363 public static final String PROJECT_RUN_IN_CONTAINER = "io.openliberty.tools.eclipse.launch.project.container.run" ;
6464
65+ /** Configuration map key with a value stating whether or not the console has colored output. */
66+ public static final String PROJECT_COLOR_OUTPUT = "io.openliberty.tools.eclipse.launch.project.color.output" ;
67+
6568 /** Main preference page ID. */
6669 public static final String MAIN_PREFERENCE_PAGE_ID = "io.openliberty.tools.eclipse.ui.preferences.page" ;
6770
@@ -70,6 +73,8 @@ public class StartTab extends AbstractLaunchConfigurationTab {
7073
7174 private static final String EXAMPLE_START_PARMS = "Example: -DhotTests=true" ;
7275
76+ private static final String COLOR_STYLE_PARM = "-Dstyle.color" ;
77+
7378 /** The font to use for the contents of this Tab. */
7479 private Font font ;
7580
@@ -85,6 +90,9 @@ public class StartTab extends AbstractLaunchConfigurationTab {
8590 /** Holds the run in container check box. */
8691 private Button runInContainerCheckBox ;
8792
93+ /** Holds the color output check box. */
94+ private Button colorOutputCheckBox ;
95+
8896 /** DevModeOperations instance. */
8997 private DevModeOperations devModeOps = DevModeOperations .getInstance ();
9098
@@ -112,6 +120,7 @@ public void createControl(Composite parent) {
112120 Composite parmsGroupComposite = createGroupComposite (mainComposite , "" , 2 );
113121 createInputParmText (parmsGroupComposite );
114122 createRunInContainerButton (parmsGroupComposite );
123+ createColorOutputButton (parmsGroupComposite );
115124
116125 createLabelWithPreferenceLink (mainComposite );
117126 }
@@ -136,6 +145,8 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
136145
137146 configuration .setAttribute (PROJECT_RUN_IN_CONTAINER , false );
138147
148+ configuration .setAttribute (PROJECT_COLOR_OUTPUT , true );
149+
139150 if (Trace .isEnabled ()) {
140151 Trace .getTracer ().traceExit (Trace .TRACE_UI );
141152 }
@@ -160,6 +171,9 @@ public void initializeFrom(ILaunchConfiguration configuration) {
160171 boolean runInContainer = configuration .getAttribute (PROJECT_RUN_IN_CONTAINER , false );
161172 runInContainerCheckBox .setSelection (runInContainer );
162173
174+ boolean colorOutput = configuration .getAttribute (PROJECT_COLOR_OUTPUT , true );
175+ colorOutputCheckBox .setSelection (colorOutput );
176+
163177 String projectName = configuration .getAttribute (PROJECT_NAME , (String ) null );
164178 if (projectName == null ) {
165179 super .setErrorMessage (
@@ -236,16 +250,17 @@ public boolean isValid(ILaunchConfiguration config) {
236250 public void performApply (ILaunchConfigurationWorkingCopy configuration ) {
237251
238252 String startParamStr = startParmText .getText ();
253+ configuration .setAttribute (PROJECT_START_PARM , startParamStr );
239254
240255 boolean runInContainerBool = runInContainerCheckBox .getSelection ();
241-
242256 configuration .setAttribute (PROJECT_RUN_IN_CONTAINER , runInContainerBool );
243257
244- configuration .setAttribute (PROJECT_START_PARM , startParamStr );
258+ boolean colorOutputBool = colorOutputCheckBox .getSelection ();
259+ configuration .setAttribute (PROJECT_COLOR_OUTPUT , colorOutputBool );
245260
246261 if (Trace .isEnabled ()) {
247262 Trace .getTracer ().trace (Trace .TRACE_UI , "In performApply with project name = " + projectNameLabel .getText () + ", text = "
248- + startParamStr + ", runInContainer = " + runInContainerBool );
263+ + startParamStr + ", runInContainer = " + runInContainerBool + ", colorOutput = " + colorOutputBool );
249264 }
250265 }
251266
@@ -399,6 +414,33 @@ public void widgetSelected(SelectionEvent event) {
399414 GridDataFactory .swtDefaults ().applyTo (emptyColumnLabel );
400415 }
401416
417+ /**
418+ * Creates the button entry that indicates whether or not the console should run with color styling.
419+ *
420+ * @param parent The parent composite.
421+ */
422+ private void createColorOutputButton (Composite parent ) {
423+ colorOutputCheckBox = new Button (parent , SWT .CHECK );
424+ colorOutputCheckBox .setText ("Color Output" );
425+ colorOutputCheckBox .setSelection (true );
426+ colorOutputCheckBox .setFont (font );
427+ colorOutputCheckBox .addSelectionListener (new SelectionAdapter () {
428+
429+ /**
430+ * {@inheritDoc}
431+ */
432+ @ Override
433+ public void widgetSelected (SelectionEvent event ) {
434+ setDirty (true );
435+ updateLaunchConfigurationDialog ();
436+ }
437+ });
438+ GridDataFactory .swtDefaults ().applyTo (colorOutputCheckBox );
439+
440+ Label emptyColumnLabel = new Label (parent , SWT .NONE );
441+ GridDataFactory .swtDefaults ().applyTo (emptyColumnLabel );
442+ }
443+
402444 /**
403445 * Returns the default start parameters.
404446 *
0 commit comments