diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/OperationForInterfaceEditpart.java')
-rwxr-xr-x | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/OperationForInterfaceEditpart.java | 145 |
1 files changed, 81 insertions, 64 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/OperationForInterfaceEditpart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/OperationForInterfaceEditpart.java index efd822a87dc..214ca19f12f 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/OperationForInterfaceEditpart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/OperationForInterfaceEditpart.java @@ -1,13 +1,13 @@ /** * Copyright (c) 2014 CEA LIST. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * CEA LIST - Initial API and implementation */ @@ -53,6 +53,11 @@ import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.viewers.ICellEditorValidator; import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator; import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; @@ -63,11 +68,6 @@ import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditor import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper; import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil; import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.clazz.custom.figure.OperationFigure; import org.eclipse.papyrus.uml.diagram.clazz.custom.policies.AppliedStereotypeOperationDisplayEditPolicy; import org.eclipse.papyrus.uml.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy; @@ -123,12 +123,14 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * direct edition mode (default, undefined, registered editor, etc.) + * * @generated */ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; /** * configuration from a registered edit dialog + * * @generated */ protected IDirectEditorConfiguration configuration; @@ -143,6 +145,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override public DragTracker getDragTracker(Request request) { if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) { return null; @@ -153,14 +156,14 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy()); installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy()); installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(AbstractAppliedStereotypeDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, - new AppliedStereotypeOperationDisplayEditPolicy()); + installEditPolicy(AbstractAppliedStereotypeDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeOperationDisplayEditPolicy()); installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new OperationLabelEditPolicy()); } @@ -230,6 +233,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected List<?> getModelChildren() { return Collections.EMPTY_LIST; } @@ -237,6 +241,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { return null; } @@ -244,6 +249,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override public void setParser(IParser parser) { this.parser = parser; } @@ -269,7 +275,8 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart String text = null; EObject parserElement = getParserElement(); if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), + text = getParser().getPrintString( + ParserUtil.getParserAdapter(getParserElement(), this), getParserOptions().intValue()); } if (text == null || text.length() == 0) { @@ -281,6 +288,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); @@ -296,11 +304,13 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override public String getEditText() { if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } - return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), + return getParser().getEditString( + ParserUtil.getParserAdapter(getParserElement(), this), getParserOptions().intValue()); } @@ -314,6 +324,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override public ICellEditorValidator getEditTextValidator() { return new ICellEditorValidator() { @@ -323,14 +334,12 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart final EObject element = getParserElement(); final IParser parser = getParser(); try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive( + new RunnableWithResult.Impl<java.lang.Object>() { @Override public void run() { - setResult( - parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), - OperationForInterfaceEditpart.this), (String) value)); + setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), OperationForInterfaceEditpart.this), (String) value)); } }); return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); @@ -348,6 +357,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override public IContentAssistProcessor getCompletionProcessor() { if (getParserElement() == null || getParser() == null) { return null; @@ -358,6 +368,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override public ParserOptions getParserOptions() { return ParserOptions.NONE; } @@ -365,10 +376,10 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override public IParser getParser() { if (parser == null) { - parser = ParserUtil.getParser(UMLElementTypes.Operation_InterfaceOperationLabel, getParserElement(), this, - VISUAL_ID); + parser = ParserUtil.getParser(UMLElementTypes.Operation_InterfaceOperationLabel, getParserElement(), this, VISUAL_ID); } return parser; } @@ -428,6 +439,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void performDirectEditRequest(Request request) { final Request theRequest = request; @@ -455,18 +467,13 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart initializeDirectEditManager(theRequest); return; } else if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) - .createPopupEditorHelper(this); + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); helper.showEditor(); return; } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement())); + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement()), configuration); + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); } else { return; } @@ -478,8 +485,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart @Override protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), - ((ILabelEditorDialog) finalDialog).getValue()); + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); } }; @@ -505,10 +511,9 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart @Override public void run() { if (isActive() && isEditable()) { - if (request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (request.getExtendedData().get( + RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else { performDirectEdit(); @@ -524,6 +529,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void refreshVisuals() { super.refreshVisuals(); refreshLabel(); @@ -565,7 +571,8 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart * @generated */ protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); if (style != null && getFigure() instanceof WrappingLabel) { ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } @@ -582,7 +589,8 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart * @generated */ protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); if (style != null && getFigure() instanceof WrappingLabel) { ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); } @@ -591,11 +599,15 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), - (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + FontData fontData = new FontData( + style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | + (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } @@ -603,6 +615,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void setFontColor(Color color) { getFigure().setForegroundColor(color); } @@ -610,6 +623,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void addSemanticListeners() { if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); @@ -625,6 +639,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void removeSemanticListeners() { if (parserElements != null) { for (int i = 0; i < parserElements.size(); i++) { @@ -638,6 +653,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected AccessibleEditPart getAccessibleEditPart() { if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { @@ -660,7 +676,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * Returns the kind of associated editor for direct edition. - * + * * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition * @generated */ @@ -679,7 +695,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * Checks if an extended editor is present. - * + * * @return <code>true</code> if an extended editor is present. * @generated */ @@ -692,7 +708,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * Checks if a default direct edition is available - * + * * @return <code>true</code> if a default direct edition is available * @generated */ @@ -702,43 +718,42 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * Initializes the extended editor configuration + * * @generated */ protected void initExtendedEditorConfiguration() { if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, - resolveSemanticElement(), this); + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); } } } /** * Updates the preference configuration + * * @generated */ protected void updateExtendedEditorConfiguration() { String languagePreferred = Activator.getDefault().getPreferenceStore().getString( IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") - && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { configuration = null; } } /** - * Performs the direct edit usually used by GMF editors. - * @param theRequest the direct edit request that starts the direct edit system - * @generated - */ + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ protected void performDefaultDirectEditorEdit(final Request theRequest) { // initialize the direct edit manager try { @@ -747,13 +762,11 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart @Override public void run() { if (isActive() && isEditable()) { - if (theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get( + RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { @@ -770,6 +783,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void addNotationalListeners() { super.addNotationalListeners(); addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ @@ -778,6 +792,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void removeNotationalListeners() { super.removeNotationalListeners(); removeListenerFilter("PrimaryView"); //$NON-NLS-1$ @@ -786,6 +801,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { @@ -795,10 +811,10 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart refreshUnderline(); } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || + NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || + NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || + NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { refreshFont(); } else { if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { @@ -824,6 +840,7 @@ public class OperationForInterfaceEditpart extends UMLCompartmentEditPart /** * @generated */ + @Override protected IFigure createFigure() { IFigure label = createFigurePrim(); defaultText = getLabelTextHelper(label); |