public Rectangle getBounds() { View view = this.getNotationView(); int width = ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Width())) .intValue(); int height = ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Height())) .intValue(); int x = ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_X())) .intValue(); int y = ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_Y())) .intValue(); String prefElementId = ViewUtil.resolveSemanticElement(view).eClass().getName(); IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey( view, prefElementId, PreferencesConstantsHelper.WIDTH); String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey( view, prefElementId, PreferencesConstantsHelper.HEIGHT); if (width <= 0) { width = store.getInt(preferenceConstantWitdh); } if (height <= 0) { height = store.getInt(preferenceConstantHeight); } return new Rectangle(x, y, width, height); }
/** @generated */ protected NodeFigure createNodePlate() { String prefElementId = "InstanceSpecification"; IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey( getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH); String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey( getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT); DefaultSizeNodeFigure result = new DefaultSizeNodeFigure( store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); return result; }
/** @generated */ protected NodeFigure createNodePlate() { String prefElementId = "OutputPin"; IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey( getNotationView(), prefElementId, PreferencesConstantsHelper.WIDTH); String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey( getNotationView(), prefElementId, PreferencesConstantsHelper.HEIGHT); DefaultSizeNodeFigure result = new DefaultSizeNodeFigure( store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); // FIXME: workaround for #154536 result.getBounds().setSize(result.getPreferredSize()); return result; }
@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)); }