/** @generated */ public Edge createAssociation_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( edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part .NECSIS14_ClassDiagramVisualIDRegistry.getType( edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts .AssociationEditPart.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); } Node label6001 = createLabel( edge, edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part .NECSIS14_ClassDiagramVisualIDRegistry.getType( edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts .AssociationNameEditPart.VISUAL_ID)); label6001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6001 = (Location) label6001.getLayoutConstraint(); location6001.setX(0); location6001.setY(40); return edge; }
/** @generated */ public Node createPersistentTable_2003( 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.createLineStyle()); node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle()); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(SqlmodelVisualIDRegistry.getType(PersistentTable2EditPart.VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // 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)); org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR); ViewUtil.setStructuralFeatureValue( node, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB)); return node; }
/** @generated */ public Node createAttribute_3001( EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType( edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part .NECSIS14_ClassDiagramVisualIDRegistry.getType( edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.AttributeEditPart .VISUAL_ID)); ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); // 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, edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part .NECSIS14_ClassDiagramVisualIDRegistry.getType( edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts .AttributeNameEditPart.VISUAL_ID)); return node; }
/** * initialize the background for a graphical element * * @param view the element to initialize * @param store the preference store * @param elementName the name to the element */ public static void initBackgroundFromPrefs( View view, final IPreferenceStore store, String elementName) { if (!usePreferenceInitializer(view)) { return; } String fillColorConstant = getpreferenceKey(view, elementName, PreferenceConstantHelper.COLOR_FILL); String gradientColorConstant = getpreferenceKey(view, elementName, PreferenceConstantHelper.COLOR_GRADIENT); String gradientPolicyConstant = getpreferenceKey(view, elementName, PreferenceConstantHelper.GRADIENT_POLICY); String shadowConstant = getpreferenceKey(view, elementName, PreferenceConstantHelper.SHADOW); String elementIcon = getpreferenceKey(view, elementName, PreferenceConstantHelper.ELEMENTICON); String qualifiedName = getpreferenceKey(view, elementName, PreferenceConstantHelper.QUALIFIEDNAME); org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(store, fillColorConstant); ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB)); FillStyle fillStyle = (FillStyle) view.getStyle(NotationPackage.Literals.FILL_STYLE); fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue()); if (store.getBoolean(gradientPolicyConstant)) { GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(gradientColorConstant)); fillStyle.setGradient(gradientPreferenceConverter.getGradientData()); fillStyle.setTransparency(gradientPreferenceConverter.getTransparency()); } EditingDomain domain = EMFHelper.resolveEditingDomain(view); if (domain instanceof TransactionalEditingDomain) { TransactionalEditingDomain editingDomain = (TransactionalEditingDomain) domain; // shadow RecordingCommand shadowcommand = AnnotationStyleProvider.getSetShadowCommand( editingDomain, view, store.getBoolean(shadowConstant)); if (shadowcommand.canExecute()) { shadowcommand.execute(); } // icon label RecordingCommand namelabelIconCommand = AnnotationStyleProvider.getSetElementIconCommand( editingDomain, view, store.getBoolean(elementIcon)); if (namelabelIconCommand.canExecute()) { namelabelIconCommand.execute(); } // qualified name if (!store.getBoolean(qualifiedName)) { RecordingCommand qualifiedNameCommand = AnnotationStyleProvider.getSetQualifiedNameDepthCommand(editingDomain, view, 1000); if (qualifiedNameCommand.canExecute()) { qualifiedNameCommand.execute(); } } } }
/** @generated */ public Edge createViewTableViewedTables_3002( 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 points = new ArrayList(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(SqlmodelVisualIDRegistry.getType(ViewTableViewedTables2EditPart.VISUAL_ID)); edge.setElement(null); // 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); } return edge; }
/** @generated */ public Node createStakeHolder_2011( EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); node.setType(RdalVisualIDRegistry.getType(StakeHolderEditPart.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 label5018 = createLabel(node, RdalVisualIDRegistry.getType(StakeHolderNameEditPart.VISUAL_ID)); label5018.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location5018 = (Location) label5018.getLayoutConstraint(); location5018.setX(0); location5018.setY(5); return node; }
protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { if (null == viewAdapter || null == newValue) return CommandResult.newCancelledCommandResult(); View view = (View) viewAdapter.getAdapter(View.class); Point p = (Point) newValue.getAdapter(IPropertyValueDeferred.class); ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getLocation_X(), Integer.valueOf(p.x)); ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getLocation_Y(), Integer.valueOf(p.y)); // clear for garbage collection viewAdapter = null; newValue = null; return CommandResult.newOKCommandResult(); }
@Override protected void initializeFromPreferences(View view) { super.initializeFromPreferences(view); IPreferenceStore store = (IPreferenceStore) getPreferencesHint().getPreferenceStore(); if (store == null) { return; } // Get default size from preferences use set view size. String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey( view, view.getType(), PreferenceConstantHelper.WIDTH); String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey( view, view.getType(), PreferenceConstantHelper.HEIGHT); ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getSize_Width(), store.getInt(preferenceConstantWitdh)); ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getSize_Height(), store.getInt(preferenceConstantHeight)); }
/** * initialize the routing for a graphical element * * @param view the element to initialize * @param store the preference store * @param elementName the name to the element */ public static void initRoutingFromPrefs( View view, final IPreferenceStore store, String elementName) { if (!usePreferenceInitializer(view)) { return; } Routing routing = Routing.get( store.getInt( getpreferenceKey(view, elementName, PreferenceConstantHelper.ROUTING_STYLE))); if (routing != null) { ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } Smoothness smoothness = Smoothness.get( store.getInt(getpreferenceKey(view, elementName, PreferenceConstantHelper.SMOOTHNESS))); if (routing != null) { ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getRoutingStyle_Smoothness(), smoothness); } JumpLinkStatus jumpLinkStatus = JumpLinkStatus.get( getpreferenceKey(view, elementName, PreferenceConstantHelper.JUMPLINK_STATUS)); if (routing != null) { ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getRoutingStyle_JumpLinkStatus(), jumpLinkStatus); } JumpLinkType jumpLinkType = JumpLinkType.get( getpreferenceKey(view, elementName, PreferenceConstantHelper.JUMPLINK_TYPE)); if (routing != null) { ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getRoutingStyle_JumpLinkType(), jumpLinkType); } boolean jumpLinksReverse = store.getBoolean( getpreferenceKey(view, elementName, PreferenceConstantHelper.JUMPLINK_REVERSE)); ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getRoutingStyle_JumpLinksReverse(), jumpLinksReverse); boolean routingObstruction = store.getBoolean( getpreferenceKey( view, elementName, PreferenceConstantHelper.ROUTING_POLICY_OBSTRUCTION)); ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getRoutingStyle_AvoidObstructions(), routingObstruction); boolean routingDistance = store.getBoolean( getpreferenceKey(view, elementName, PreferenceConstantHelper.ROUTING_POLICY_DISTANCE)); ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getRoutingStyle_ClosestDistance(), routingDistance); }
/** * initialize the foreground for a graphical element * * @param view the element to initialize * @param store the preference store * @param elementName the name to the element */ public static void initForegroundFromPrefs( View view, final IPreferenceStore store, String elementName) { if (!usePreferenceInitializer(view)) { return; } String lineColorConstant = getpreferenceKey(view, elementName, PreferenceConstantHelper.COLOR_LINE); org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(store, lineColorConstant); ViewUtil.setStructuralFeatureValue( view, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB)); }
/** * initialize the status of the compartment for the node (Showed or hidden) * * @param view the element to initialize * @param store the preference store * @param elementName the name to the element */ public static void initCompartmentsStatusFromPrefs( View view, final IPreferenceStore store, String elementName) { EList<?> children = view.getPersistedChildren(); if (children != null) { for (Object object : children) { // we look for the name of the compartment for this view EditPart dummyEP = EditPartService.getInstance().createGraphicEditPart((View) object); IGraphicalEditPart epp = (IGraphicalEditPart) dummyEP; IFigure fig1 = epp.getFigure(); if (fig1 instanceof ResizableCompartmentFigure) { String compartmentName = ((ResizableCompartmentFigure) fig1).getCompartmentTitle(); if (compartmentName != null) { String diagramKind = view.getDiagram().getType(); String preferenceKey = PreferenceConstantHelper.getCompartmentElementConstant( diagramKind + "_" + elementName, compartmentName, PreferenceConstantHelper.COMPARTMENT_VISIBILITY); // $NON-NLS-1$ boolean value = store.getBoolean(preferenceKey); if (!value) { // the default value is true : nothing to // do ENamedElement namedElement = PackageUtil.getElement("notation.View.visible"); // $NON-NLS-1$ ViewUtil.setStructuralFeatureValue( (View) object, (EStructuralFeature) namedElement, value); } String compartmentNameVisibilityPreference = PreferenceConstantHelper.getCompartmentElementConstant( diagramKind + "_" + elementName, compartmentName, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY); // $NON-NLS-1$ boolean showCompartmentName = store.getBoolean(compartmentNameVisibilityPreference); View childView = (View) object; TitleStyle style = (TitleStyle) childView.getStyle(NotationPackage.eINSTANCE.getTitleStyle()); if (style != null) { style.setShowTitle(showCompartmentName); } } } dummyEP = null; } } }
/** @generated */ public Node createRequirementsGroup_2007( 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(RdalVisualIDRegistry.getType(RequirementsGroupEditPart.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 label5013 = createLabel(node, RdalVisualIDRegistry.getType(RequirementsGroupNameEditPart.VISUAL_ID)); createCompartment( node, RdalVisualIDRegistry.getType(RequirementsGroupRequirementsCompartmentEditPart.VISUAL_ID), true, false, false, false); return node; }