Java Reference
In-Depth Information
Diagram Preferences
Our generated diagram code includes preference settings that are accessible from
the Eclipse preference dialog in a Mindmap Diagram category. Diagram general,
appearance, connection, ruler, grid, and printing preferences are all available
from a set of contributed preference pages. In our generated
org.eclipse.
mindmap.diagram.preferences
package is code that supports further exten-
sion and enables us to set defaults. For example, if we want all the mindmap
diagram lines to be blue by default, we can adjust our
DiagramAppearance
PreferencePage
class as follows:
public class
DiagramAppearancePreferencePage
extends
AppearancePreferencePage {
private static
RGB LINE_COLOR =
new
RGB(90, 140, 255);
/**
* @generated
*/
public
DiagramAppearancePreferencePage() {
setPreferenceStore(MindmapDiagramEditorPlugin.getInstance().
getPreferenceStore());
}
public static void
initDefaults(IPreferenceStore store) {
AppearancePreferencePage.initDefaults(store);
PreferenceConverter.setDefault(store,
IPreferenceConstants.PREF_LINE_COLOR, LINE_COLOR);
}
}
We can set more preferences and add new preferences. Section 4.6.6, “Color
Preferences,” looks at how to modify code-generation templates to add custom
preferences for the color modeling diagram.
Audits and Metrics
GMF provides the capability to define OCL-based audits and metrics for the
domain and diagram models. Using the mapping definition model, we can define
diagram audits and metrics for both domain and notation model elements.
What's generated leverages the EMF Validation Framework. To begin, we open
our mindmap.gmfmap model in the editor, right-click on the
Mapping
element,
and add a new
Audit Container
child. To the container, add the two audit
rules in Table 4-9.
Search WWH ::
Custom Search