Skip to content
Snippets Groups Projects
Commit 2c711204 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

improves highlighting

refs 2620
parent 8e8bdcb1
No related branches found
No related tags found
No related merge requests found
......@@ -117,7 +117,7 @@ import org.fortiss.tooling.kernel.ui.service.IEditPartFactoryService;
* @author hoelzl
* @author $Author: aravantinos $
* @version $Rev: 13954 $
* @ConQAT.Rating YELLOW Hash: AA59F547B0610F86EC4E42B739733731
* @ConQAT.Rating YELLOW Hash: C96404EE24E8C30B5A2AABFB1342F04A
*/
abstract class CommonDiagramEditorBase<T extends EObject> extends GEFEditorBase<T> implements
IPostSelectionProvider, ContextMenuContextProvider {
......@@ -596,19 +596,28 @@ abstract class CommonDiagramEditorBase<T extends EObject> extends GEFEditorBase<
*/
protected void setHighlight(IFigure fig, boolean highlighted) {
if(highlighted) {
if(!highlightedFigures2NormalColor.containsKey(fig)) {
highlightedFigures2NormalColor.put(fig, fig.getForegroundColor());
if(!highlightedFigures2NormalFgColor.containsKey(fig)) {
highlightedFigures2NormalFgColor.put(fig, fig.getForegroundColor());
fig.setForegroundColor(ColorConstants.red);
highlightedFigures2NormalBgColor.put(fig, fig.getBackgroundColor());
fig.setBackgroundColor(ColorConstants.red);
}
} else {
Color normalColor = highlightedFigures2NormalColor.get(fig);
Color normalColor = highlightedFigures2NormalFgColor.get(fig);
fig.setForegroundColor(normalColor);
highlightedFigures2NormalColor.remove(fig);
normalColor = highlightedFigures2NormalBgColor.get(fig);
fig.setBackgroundColor(normalColor);
highlightedFigures2NormalFgColor.remove(fig);
}
}
/** A map from figures that are currently highlighted to their normal foreground color. */
private HashMap<IFigure, Color> highlightedFigures2NormalColor = new HashMap<IFigure, Color>();
private HashMap<IFigure, Color> highlightedFigures2NormalFgColor =
new HashMap<IFigure, Color>();
/** A map from figures that are currently highlighted to their normal foreground color. */
private HashMap<IFigure, Color> highlightedFigures2NormalBgColor =
new HashMap<IFigure, Color>();
/** Returns the edit part corresponding to the EObject or null if it cannot be found. */
@SuppressWarnings("unchecked")
......@@ -641,7 +650,7 @@ abstract class CommonDiagramEditorBase<T extends EObject> extends GEFEditorBase<
/** {@inheritDoc} */
@Override
public void clearAllHighlights() {
Set<IFigure> figs = new HashSet<IFigure>(highlightedFigures2NormalColor.keySet());
Set<IFigure> figs = new HashSet<IFigure>(highlightedFigures2NormalFgColor.keySet());
for(IFigure figure : figs) {
setHighlight(figure, false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment