package org.eclipse.uml2.diagram.profile.providers;
import java.util.ArrayList;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants;
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.notation.CanonicalStyle;
import org.eclipse.gmf.runtime.notation.Connector;
import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.DrawerStyle;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.Location;
import org.eclipse.gmf.runtime.notation.MeasurementUnit;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
import org.eclipse.gmf.runtime.notation.Routing;
import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.gmf.runtime.notation.TitleStyle;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.uml2.diagram.common.notation.u2tnotation.U2TDiagramCanonicalStyle;
import org.eclipse.uml2.diagram.common.notation.u2tnotation.U2TNotationFactory;
import org.eclipse.uml2.diagram.common.view.ViewProviderUtils;
import org.eclipse.uml2.diagram.profile.edit.parts.CommentAnnotatedElementEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.CommentBodyEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.CommentEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.Constraint2EditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ConstraintConstrainedElementEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ConstraintEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ConstraintLanguageEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ConstraintNameEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ElementImport2EditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ElementImportEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.EnumerationEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.EnumerationLiteralEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.EnumerationLiteralsEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.EnumerationNameEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.EnumerationQualifiedNameEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ExtensionEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ExtensionLink_requiredEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.GeneralizationEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ImageEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.Profile2EditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.Profile3EditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ProfileContentsEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ProfileEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ProfileName2EditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ProfileNameEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ProfileProfileLabelsEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ProfileStereoEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.PropertyEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.ReferencedMetaclassNode_classNameEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.Stereotype2EditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.StereotypeAttributesEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.StereotypeConstraintsEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.StereotypeEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.StereotypeImagesEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.StereotypeNameEditPart;
import org.eclipse.uml2.diagram.profile.edit.parts.StereotypeStereoEditPart;
import org.eclipse.uml2.diagram.profile.part.UMLVisualIDRegistry;
/**
* @generated
*/
public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
public final boolean provides(IOperation operation) {
if (operation instanceof CreateViewForKindOperation) {
return provides((CreateViewForKindOperation) operation);
}
assert operation instanceof CreateViewOperation;
if (operation instanceof CreateDiagramViewOperation) {
return provides((CreateDiagramViewOperation) operation);
} else if (operation instanceof CreateEdgeViewOperation) {
return provides((CreateEdgeViewOperation) operation);
} else if (operation instanceof CreateNodeViewOperation) {
return provides((CreateNodeViewOperation) operation);
}
return false;
}
/**
* @generated
*/
protected boolean provides(CreateViewForKindOperation op) {
/*
if (op.getViewKind() == Node.class)
return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
if (op.getViewKind() == Edge.class)
return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
*/
return true;
}
/**
* @generated
*/
protected boolean provides(CreateDiagramViewOperation op) {
return ProfileEditPart.MODEL_ID.equals(op.getSemanticHint()) && UMLVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter())) != -1;
}
/**
* @generated
*/
protected boolean provides(CreateNodeViewOperation op) {
if (op.getContainerView() == null) {
return false;
}
IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
EObject domainElement = getSemanticElement(op.getSemanticAdapter());
int visualID;
if (op.getSemanticHint() == null) {
// Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
// In this situation there should be NO elementType, visualID will be determined
// by VisualIDRegistry.getNodeVisualID() for domainElement.
if (elementType != null || domainElement == null) {
return false;
}
visualID = UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement);
} else {
visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
if (elementType != null) {
if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
return false; // foreign element type
}
String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
if (!op.getSemanticHint().equals(elementTypeHint)) {
return false; // if semantic hint is specified it should be the same as in element type
}
if (domainElement != null && !UMLVisualIDRegistry.checkNodeVisualID(op.getContainerView(), domainElement, visualID)) {
return false; // visual id for node EClass should match visual id from element type, or at least be substitutable for it
}
} else {
if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(op.getContainerView()))) {
return false; // foreign diagram
}
switch (visualID) {
case StereotypeEditPart.VISUAL_ID:
case EnumerationEditPart.VISUAL_ID:
case ElementImportEditPart.VISUAL_ID:
case CommentEditPart.VISUAL_ID:
case PropertyEditPart.VISUAL_ID:
case ConstraintEditPart.VISUAL_ID:
case ImageEditPart.VISUAL_ID:
case EnumerationLiteralEditPart.VISUAL_ID:
case Profile2EditPart.VISUAL_ID:
case Profile3EditPart.VISUAL_ID:
case Constraint2EditPart.VISUAL_ID:
case Stereotype2EditPart.VISUAL_ID:
case ElementImport2EditPart.VISUAL_ID:
if (domainElement == null || visualID != UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) {
return false; // visual id in semantic hint should match visual id for domain element
}
break;
default:
return false;
}
}
}
return StereotypeEditPart.VISUAL_ID == visualID || Profile2EditPart.VISUAL_ID == visualID || EnumerationEditPart.VISUAL_ID == visualID || ElementImportEditPart.VISUAL_ID == visualID
|| Profile3EditPart.VISUAL_ID == visualID || Constraint2EditPart.VISUAL_ID == visualID || CommentEditPart.VISUAL_ID == visualID || PropertyEditPart.VISUAL_ID == visualID
|| ConstraintEditPart.VISUAL_ID == visualID || ImageEditPart.VISUAL_ID == visualID || Stereotype2EditPart.VISUAL_ID == visualID || EnumerationLiteralEditPart.VISUAL_ID == visualID
|| ElementImport2EditPart.VISUAL_ID == visualID;
}
/**
* @generated
*/
protected boolean provides(CreateEdgeViewOperation op) {
IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
return false; // foreign element type
}
String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
if (elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) {
return false; // our hint is visual id and must be specified, and it should be the same as in element type
}
int visualID = UMLVisualIDRegistry.getVisualID(elementTypeHint);
EObject domainElement = getSemanticElement(op.getSemanticAdapter());
if (domainElement != null && visualID != UMLVisualIDRegistry.getLinkWithClassVisualID(domainElement)) {
return false; // visual id for link EClass should match visual id from element type
}
return true;
}
/**
* @generated
*/
public Diagram createDiagram(IAdaptable semanticAdapter, String diagramKind, PreferencesHint preferencesHint) {
Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle());
U2TDiagramCanonicalStyle canonicalStyle_Profile_1000 = U2TNotationFactory.eINSTANCE.createU2TDiagramCanonicalStyle();
canonicalStyle_Profile_1000.setCanonical(true);
canonicalStyle_Profile_1000.setSyncNodes(true);
canonicalStyle_Profile_1000.setSyncLinks(true);
diagram.getStyles().add(canonicalStyle_Profile_1000);
diagram.setType(ProfileEditPart.MODEL_ID);
diagram.setElement(getSemanticElement(semanticAdapter));
diagram.setMeasurementUnit(MeasurementUnit.PIXEL_LITERAL);
return diagram;
}
/**
* @generated
*/
public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
final EObject domainElement = getSemanticElement(semanticAdapter);
final int visualID;
if (semanticHint == null) {
visualID = UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
} else {
visualID = UMLVisualIDRegistry.getVisualID(semanticHint);
}
switch (visualID) {
case StereotypeEditPart.VISUAL_ID:
return createStereotype_2001(domainElement, containerView, index, persisted, preferencesHint);
case Profile2EditPart.VISUAL_ID:
return createProfile_2002(domainElement, containerView, index, persisted, preferencesHint);
case EnumerationEditPart.VISUAL_ID:
return createEnumeration_2003(domainElement, containerView, index, persisted, preferencesHint);
case ElementImportEditPart.VISUAL_ID:
return createElementImport_2006(domainElement, containerView, index, persisted, preferencesHint);
case Profile3EditPart.VISUAL_ID:
return createProfile_2007(domainElement, containerView, index, persisted, preferencesHint);
case Constraint2EditPart.VISUAL_ID:
return createConstraint_2008(domainElement, containerView, index, persisted, preferencesHint);
case CommentEditPart.VISUAL_ID:
return createComment_2009(domainElement, containerView, index, persisted, preferencesHint);
case PropertyEditPart.VISUAL_ID:
return createProperty_3001(domainElement, containerView, index, persisted, preferencesHint);
case ConstraintEditPart.VISUAL_ID:
return createConstraint_3008(domainElement, containerView, index, persisted, preferencesHint);
case ImageEditPart.VISUAL_ID:
return createImage_3010(domainElement, containerView, index, persisted, preferencesHint);
case Stereotype2EditPart.VISUAL_ID:
return createStereotype_3003(domainElement, containerView, index, persisted, preferencesHint);
case EnumerationLiteralEditPart.VISUAL_ID:
return createEnumerationLiteral_3005(domainElement, containerView, index, persisted, preferencesHint);
case ElementImport2EditPart.VISUAL_ID:
return createElementImport_3009(domainElement, containerView, index, persisted, preferencesHint);
}
// can't happen, provided #provides(CreateNodeViewOperation) is correct
return null;
}
/**
* @generated
*/
public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
IElementType elementType = getSemanticElementType(semanticAdapter);
String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
switch (UMLVisualIDRegistry.getVisualID(elementTypeHint)) {
case GeneralizationEditPart.VISUAL_ID:
return createGeneralization_4001(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
case ExtensionEditPart.VISUAL_ID:
return createExtension_4002(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
case ConstraintConstrainedElementEditPart.VISUAL_ID:
return createConstraintConstrainedElement_4003(containerView, index, persisted, preferencesHint);
case CommentAnnotatedElementEditPart.VISUAL_ID:
return createCommentAnnotatedElement_4004(containerView, index, persisted, preferencesHint);
}
// can never happen, provided #provides(CreateEdgeViewOperation) is correct
return null;
}
/**
* @generated
*/
public Node createStereotype_2001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(StereotypeEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
if (nodeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
nodeFontStyle.setFontName(fontData.getName());
nodeFontStyle.setFontHeight(fontData.getHeight());
nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
Node label5001 = createLabel(node, UMLVisualIDRegistry.getType(StereotypeNameEditPart.VISUAL_ID));
Node label5012 = createLabel(node, UMLVisualIDRegistry.getType(StereotypeStereoEditPart.VISUAL_ID));
Node compartment7001 = createCompartment(node, UMLVisualIDRegistry.getType(StereotypeAttributesEditPart.VISUAL_ID), true, true, true, true);
CanonicalStyle canonicalStyle_StereotypeAttributes_7001 = NotationFactory.eINSTANCE.createCanonicalStyle();
canonicalStyle_StereotypeAttributes_7001.setCanonical(true);
compartment7001.getStyles().add(canonicalStyle_StereotypeAttributes_7001);
Node compartment7002 = createCompartment(node, UMLVisualIDRegistry.getType(StereotypeConstraintsEditPart.VISUAL_ID), true, true, true, true);
CanonicalStyle canonicalStyle_StereotypeConstraints_7002 = NotationFactory.eINSTANCE.createCanonicalStyle();
canonicalStyle_StereotypeConstraints_7002.setCanonical(true);
compartment7002.getStyles().add(canonicalStyle_StereotypeConstraints_7002);
Node compartment7006 = createCompartment(node, UMLVisualIDRegistry.getType(StereotypeImagesEditPart.VISUAL_ID), true, true, true, true);
CanonicalStyle canonicalStyle_StereotypeImages_7006 = NotationFactory.eINSTANCE.createCanonicalStyle();
canonicalStyle_StereotypeImages_7006.setCanonical(true);
compartment7006.getStyles().add(canonicalStyle_StereotypeImages_7006);
return node;
}
/**
* @generated
*/
public Node createProfile_2002(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createNode();
node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle());
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(Profile2EditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
if (nodeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
nodeFontStyle.setFontName(fontData.getName());
nodeFontStyle.setFontHeight(fontData.getHeight());
nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
Node label5003 = createLabel(node, UMLVisualIDRegistry.getType(ProfileNameEditPart.VISUAL_ID));
Node label5013 = createLabel(node, UMLVisualIDRegistry.getType(ProfileStereoEditPart.VISUAL_ID));
Node compartment7003 = createCompartment(node, UMLVisualIDRegistry.getType(ProfileContentsEditPart.VISUAL_ID), true, true, true, true);
CanonicalStyle canonicalStyle_ProfileContents_7003 = NotationFactory.eINSTANCE.createCanonicalStyle();
canonicalStyle_ProfileContents_7003.setCanonical(true);
compartment7003.getStyles().add(canonicalStyle_ProfileContents_7003);
return node;
}
/**
* @generated
*/
public Node createEnumeration_2003(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(EnumerationEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
if (nodeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
nodeFontStyle.setFontName(fontData.getName());
nodeFontStyle.setFontHeight(fontData.getHeight());
nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
Node label5005 = createLabel(node, UMLVisualIDRegistry.getType(EnumerationNameEditPart.VISUAL_ID));
Node label5011 = createLabel(node, UMLVisualIDRegistry.getType(EnumerationQualifiedNameEditPart.VISUAL_ID));
Node compartment7004 = createCompartment(node, UMLVisualIDRegistry.getType(EnumerationLiteralsEditPart.VISUAL_ID), true, true, true, true);
CanonicalStyle canonicalStyle_EnumerationLiterals_7004 = NotationFactory.eINSTANCE.createCanonicalStyle();
canonicalStyle_EnumerationLiterals_7004.setCanonical(true);
compartment7004.getStyles().add(canonicalStyle_EnumerationLiterals_7004);
return node;
}
/**
* @generated
*/
public Node createElementImport_2006(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createNode();
node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(ElementImportEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
if (nodeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
nodeFontStyle.setFontName(fontData.getName());
nodeFontStyle.setFontHeight(fontData.getHeight());
nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
Node label5008 = createLabel(node, UMLVisualIDRegistry.getType(ReferencedMetaclassNode_classNameEditPart.VISUAL_ID));
return node;
}
/**
* @generated
*/
public Node createProfile_2007(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(Profile3EditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
if (nodeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
nodeFontStyle.setFontName(fontData.getName());
nodeFontStyle.setFontHeight(fontData.getHeight());
nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
Node label5009 = createLabel(node, UMLVisualIDRegistry.getType(ProfileName2EditPart.VISUAL_ID));
Node compartment7005 = createCompartment(node, UMLVisualIDRegistry.getType(ProfileProfileLabelsEditPart.VISUAL_ID), true, false, true, true);
CanonicalStyle canonicalStyle_ProfileProfile_imports_7005 = NotationFactory.eINSTANCE.createCanonicalStyle();
canonicalStyle_ProfileProfile_imports_7005.setCanonical(true);
compartment7005.getStyles().add(canonicalStyle_ProfileProfile_imports_7005);
DrawerStyle drawerStyle = (DrawerStyle) compartment7005.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
if (drawerStyle != null) {
//#216573 [SecondaryDiagramElement] Collapse imports compartment after creation
drawerStyle.setCollapsed(true);
}
return node;
}
/**
* @generated
*/
public Node createConstraint_2008(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(Constraint2EditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
if (nodeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
nodeFontStyle.setFontName(fontData.getName());
nodeFontStyle.setFontHeight(fontData.getHeight());
nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
Node label5010 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID));
Node label5015 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintLanguageEditPart.VISUAL_ID));
return node;
}
/**
* @generated
*/
public Node createComment_2009Gen(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(CommentEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
if (nodeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
nodeFontStyle.setFontName(fontData.getName());
nodeFontStyle.setFontHeight(fontData.getHeight());
nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
Node label5014 = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
return node;
}
/**
* @generated NOT
*/
public Node createComment_2009(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = createComment_2009Gen(domainElement, containerView, index, persisted, preferencesHint);
ViewProviderUtils.initializeCommentColor(node, preferencesHint);
return node;
}
/**
* @generated
*/
public Node createProperty_3001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createNode();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(PropertyEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
return node;
}
/**
* @generated
*/
public Node createConstraint_3008(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createNode();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(ConstraintEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
return node;
}
/**
* @generated
*/
public Node createImage_3010(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createNode();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(ImageEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
return node;
}
/**
* @generated
*/
public Node createStereotype_3003(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createNode();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(Stereotype2EditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
return node;
}
/**
* @generated
*/
public Node createEnumerationLiteral_3005(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createNode();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(EnumerationLiteralEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
return node;
}
/**
* @generated
*/
public Node createElementImport_3009(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createNode();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(ElementImport2EditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
return node;
}
/**
* @generated
*/
public Edge createGeneralization_4001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Connector edge = NotationFactory.eINSTANCE.createConnector();
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
points.add(new RelativeBendpoint());
points.add(new RelativeBendpoint());
bendpoints.setPoints(points);
edge.setBendpoints(bendpoints);
ViewUtil.insertChildView(containerView, edge, index, persisted);
edge.setType(UMLVisualIDRegistry.getType(GeneralizationEditPart.VISUAL_ID));
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
if (edgeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
edgeFontStyle.setFontName(fontData.getName());
edgeFontStyle.setFontHeight(fontData.getHeight());
edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
if (routing != null) {
ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
}
return edge;
}
/**
* @generated
*/
public Edge createExtension_4002(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Edge edge = NotationFactory.eINSTANCE.createEdge();
edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle());
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
points.add(new RelativeBendpoint());
points.add(new RelativeBendpoint());
bendpoints.setPoints(points);
edge.setBendpoints(bendpoints);
ViewUtil.insertChildView(containerView, edge, index, persisted);
edge.setType(UMLVisualIDRegistry.getType(ExtensionEditPart.VISUAL_ID));
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
if (edgeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
edgeFontStyle.setFontName(fontData.getName());
edgeFontStyle.setFontHeight(fontData.getHeight());
edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
if (routing != null) {
ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
}
Node label6001 = createLabel(edge, UMLVisualIDRegistry.getType(ExtensionLink_requiredEditPart.VISUAL_ID));
label6001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location location6001 = (Location) label6001.getLayoutConstraint();
location6001.setX(0);
location6001.setY(-15);
return edge;
}
/**
* @generated
*/
public Edge createConstraintConstrainedElement_4003(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Connector edge = NotationFactory.eINSTANCE.createConnector();
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
points.add(new RelativeBendpoint());
points.add(new RelativeBendpoint());
bendpoints.setPoints(points);
edge.setBendpoints(bendpoints);
ViewUtil.insertChildView(containerView, edge, index, persisted);
edge.setType(UMLVisualIDRegistry.getType(ConstraintConstrainedElementEditPart.VISUAL_ID));
edge.setElement(null);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
if (edgeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
edgeFontStyle.setFontName(fontData.getName());
edgeFontStyle.setFontHeight(fontData.getHeight());
edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
if (routing != null) {
ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
}
return edge;
}
/**
* @generated
*/
public Edge createCommentAnnotatedElement_4004(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Connector edge = NotationFactory.eINSTANCE.createConnector();
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
points.add(new RelativeBendpoint());
points.add(new RelativeBendpoint());
bendpoints.setPoints(points);
edge.setBendpoints(bendpoints);
ViewUtil.insertChildView(containerView, edge, index, persisted);
edge.setType(UMLVisualIDRegistry.getType(CommentAnnotatedElementEditPart.VISUAL_ID));
edge.setElement(null);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
if (edgeFontStyle != null) {
FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
edgeFontStyle.setFontName(fontData.getName());
edgeFontStyle.setFontHeight(fontData.getHeight());
edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
}
Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
if (routing != null) {
ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
}
return edge;
}
/**
* @generated
*/
private void stampShortcut(View containerView, Node target) {
if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
shortcutAnnotation.getDetails().put("modelID", ProfileEditPart.MODEL_ID); //$NON-NLS-1$
target.getEAnnotations().add(shortcutAnnotation);
}
}
/**
* @generated
*/
private Node createLabel(View owner, String hint) {
DecorationNode rv = NotationFactory.eINSTANCE.createDecorationNode();
rv.setType(hint);
ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true);
return rv;
}
/**
* @generated
*/
private Node createCompartment(View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) {
//SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment();
//rv.setShowTitle(showTitle);
//rv.setCollapsed(isCollapsed);
Node rv;
if (canCollapse) {
rv = NotationFactory.eINSTANCE.createBasicCompartment();
} else {
rv = NotationFactory.eINSTANCE.createDecorationNode();
}
if (hasTitle) {
TitleStyle ts = NotationFactory.eINSTANCE.createTitleStyle();
ts.setShowTitle(true);
rv.getStyles().add(ts);
}
if (canSort) {
rv.getStyles().add(NotationFactory.eINSTANCE.createSortingStyle());
}
if (canFilter) {
rv.getStyles().add(NotationFactory.eINSTANCE.createFilteringStyle());
}
rv.setType(hint);
ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true);
return rv;
}
/**
* @generated
*/
private EObject getSemanticElement(IAdaptable semanticAdapter) {
if (semanticAdapter == null) {
return null;
}
EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
if (eObject != null) {
return EMFCoreUtil.resolve(TransactionUtil.getEditingDomain(eObject), eObject);
}
return null;
}
/**
* @generated
*/
private IElementType getSemanticElementType(IAdaptable semanticAdapter) {
if (semanticAdapter == null) {
return null;
}
return (IElementType) semanticAdapter.getAdapter(IElementType.class);
}
}