diff --git a/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/DebugColorProvider.java b/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/DebugColorProvider.java new file mode 100644 index 0000000000..7f8d0c0408 --- /dev/null +++ b/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/DebugColorProvider.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2024 Martin Erich Jobst + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Martin Jobst - initial API and implementation and/or initial documentation + * Alois Zoitl - extracted from org.eclipse.fordiac.ide.deployment.debug.ui.DeploymentDebugModelPresentation + *******************************************************************************/ +package org.eclipse.fordiac.ide.debug.ui; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.graphics.Color; + +public final class DebugColorProvider { + + public static final String WATCH_COLOR = "org.eclipse.fordiac.ide.deployment.debug.ui.watchColor"; //$NON-NLS-1$ + + public static final String WATCH_TEXT_COLOR = "org.eclipse.fordiac.ide.deployment.debug.ui.watchTextColor"; //$NON-NLS-1$ + + public static Color getWatchColor() { + return JFaceResources.getColorRegistry().get(WATCH_COLOR); + } + + public static Color getWatchTextColor() { + return JFaceResources.getColorRegistry().get(WATCH_TEXT_COLOR); + } + + private DebugColorProvider() { + throw new UnsupportedOperationException("Utility class must not be inherited"); //$NON-NLS-1$ + } +} diff --git a/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/view/editparts/AbstractDebugInterfaceValueEditPart.java b/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/view/editparts/AbstractDebugInterfaceValueEditPart.java index a2cbfb9a74..18fa9d1d39 100644 --- a/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/view/editparts/AbstractDebugInterfaceValueEditPart.java +++ b/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/view/editparts/AbstractDebugInterfaceValueEditPart.java @@ -21,6 +21,7 @@ import org.eclipse.draw2d.LineBorder; import org.eclipse.draw2d.geometry.Insets; import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.fordiac.ide.debug.ui.DebugColorProvider; import org.eclipse.fordiac.ide.fbtypeeditor.editparts.InterfaceEditPart; import org.eclipse.fordiac.ide.gef.editparts.ValueEditPart; import org.eclipse.fordiac.ide.model.libraryElement.IInterfaceElement; @@ -78,7 +79,8 @@ protected String getTruncationString() { }; l.setSize(100, -1); l.setOpaque(true); - l.setBackgroundColor(org.eclipse.draw2d.ColorConstants.yellow); + l.setBackgroundColor(DebugColorProvider.getWatchColor()); + l.setForegroundColor(DebugColorProvider.getWatchTextColor()); l.setPreferredSize(150, 20); final LineBorder lb = new LineBorder() { @Override diff --git a/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/view/editparts/InputEventValueEditPart.java b/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/view/editparts/InputEventValueEditPart.java index d96a7d9aa7..9c2a03c4cc 100644 --- a/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/view/editparts/InputEventValueEditPart.java +++ b/plugins/org.eclipse.fordiac.ide.debug.ui/src/org/eclipse/fordiac/ide/debug/ui/view/editparts/InputEventValueEditPart.java @@ -15,6 +15,7 @@ import org.eclipse.draw2d.Button; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.Label; +import org.eclipse.fordiac.ide.debug.ui.DebugColorProvider; import org.eclipse.fordiac.ide.model.eval.fb.FBEvaluatorEventQueue; import org.eclipse.fordiac.ide.model.eval.fb.FBEvaluatorExternalEventQueue; import org.eclipse.gef.EditPart; @@ -27,7 +28,8 @@ protected IFigure createFigure() { final Button bt = new Button(""); //$NON-NLS-1$ bt.setSize(50, -1); bt.setOpaque(true); - bt.setBackgroundColor(org.eclipse.draw2d.ColorConstants.yellow); + bt.setBackgroundColor(DebugColorProvider.getWatchColor()); + bt.setForegroundColor(DebugColorProvider.getWatchTextColor()); bt.addActionListener(e -> triggerEvent()); return bt; }