1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/**
* Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Martin Fluegge - initial API and implementation
*/
package org.eclipse.emf.cdo.dawn.appearance;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.util.EditPartUtilities;
import org.eclipse.swt.graphics.Color;
/**
* @author Martin Fluegge
*/
public class DawnAppearancer
{
public static final int DEFAULT_BORDER_THICKNESS = 2;
public static final int DEFAULT_LINE_THICKNESS = 3;
public static final Color COLOR_NO_BORDER = new Color(null, 255, 255, 255);
public static final Color COLOR_LOCKED_REMOTELY = ColorConstants.yellow;
public static final Color COLOR_LOCKED_LOCALLY = ColorConstants.green;
public static final Color COLOR_DELETE_CONFLICT = new Color(null, 255, 0, 0);
public static final Color COLOR_CHANGE_CONFLICT = new Color(null, 0, 0, 255);
public static final Color COLOR_NO_CONFLICT = new Color(null, 255, 255, 255);
public static final int TYPE_CONFLICT_NONE = -1;
public static final int TYPE_CONFLICT_LOCALLY_DELETED = 0;
public static final int TYPE_CONFLICT_REMOTELY_DELETED = 1;
public static final int TYPE_CONFLICT_REMOTELY_AND_LOCALLY_CHANGED = 2;
public static final int TYPE_LOCKED_LOCALLY = 3;
public static final int TYPE_LOCKED_GLOBALLY = 4;
public static void setEdiPartConflicted(EditPart editPart, int type)
{
DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart);
if (stylizer != null)
{
stylizer.setConflicted(editPart, type);
}
}
public static void setEditPartDefaultAllChildren(EditPart editPart)
{
setEditPartDefault(editPart);
for (Object child : EditPartUtilities.getAllChildren((GraphicalEditPart)editPart))
{
setEditPartDefaultAllChildren((EditPart)child);
}
}
public static void setEditPartDefault(EditPart editPart)
{
DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart);
if (stylizer != null)
{
stylizer.setDefault(editPart);
}
}
protected static void setEditPartLocked(EditPart editPart, int type)
{
DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart);
if (stylizer != null)
{
stylizer.setDefault(editPart);
}
}
}
|