Skip to content

Commit

Permalink
Use Watch colors also in FB Debug View
Browse files Browse the repository at this point in the history
  • Loading branch information
azoitl committed Jan 3, 2025
1 parent 367316c commit 25d8b8a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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$
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 25d8b8a

Please sign in to comment.