Search in sources :

Example 16 with EObjectAdapter

use of org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter in project tdi-studio-se by Talend.

the class GearBusinessItemNameEditPart method getEditTextValidator.

/**
     * @generated
     */
public ICellEditorValidator getEditTextValidator() {
    return new ICellEditorValidator() {

        public String isValid(final Object value) {
            if (value instanceof String) {
                final EObject element = getParserElement();
                final IParser parser = getParser();
                try {
                    IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {

                        public void run() {
                            setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
                        }
                    });
                    return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
                } catch (InterruptedException ie) {
                    // ie.printStackTrace();
                    ExceptionHandler.process(ie);
                }
            }
            // shouldn't get here
            return null;
        }
    };
}
Also used : ICellEditorValidator(org.eclipse.jface.viewers.ICellEditorValidator) EObject(org.eclipse.emf.ecore.EObject) EObject(org.eclipse.emf.ecore.EObject) IParserEditStatus(org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) EObjectAdapter(org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter) IParser(org.eclipse.gmf.runtime.common.ui.services.parser.IParser)

Example 17 with EObjectAdapter

use of org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter in project tdi-studio-se by Talend.

the class DirectionalBusinessItemRelationshipNameEditPart method getEditTextValidator.

/**
     * @generated
     */
public ICellEditorValidator getEditTextValidator() {
    return new ICellEditorValidator() {

        public String isValid(final Object value) {
            if (value instanceof String) {
                final EObject element = getParserElement();
                final IParser parser = getParser();
                try {
                    IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {

                        public void run() {
                            setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
                        }
                    });
                    return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
                } catch (InterruptedException e) {
                    // ie.printStackTrace();
                    ExceptionHandler.process(e);
                }
            }
            // shouldn't get here
            return null;
        }
    };
}
Also used : ICellEditorValidator(org.eclipse.jface.viewers.ICellEditorValidator) EObject(org.eclipse.emf.ecore.EObject) EObject(org.eclipse.emf.ecore.EObject) IParserEditStatus(org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) EObjectAdapter(org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter) IParser(org.eclipse.gmf.runtime.common.ui.services.parser.IParser)

Example 18 with EObjectAdapter

use of org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter in project tdi-studio-se by Talend.

the class InputBusinessItemNameEditPart method getEditTextValidator.

/**
     * @generated
     */
public ICellEditorValidator getEditTextValidator() {
    return new ICellEditorValidator() {

        public String isValid(final Object value) {
            if (value instanceof String) {
                final EObject element = getParserElement();
                final IParser parser = getParser();
                try {
                    IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {

                        public void run() {
                            setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
                        }
                    });
                    return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
                } catch (InterruptedException ie) {
                    // ie.printStackTrace();
                    ExceptionHandler.process(ie);
                }
            }
            // shouldn't get here
            return null;
        }
    };
}
Also used : ICellEditorValidator(org.eclipse.jface.viewers.ICellEditorValidator) EObject(org.eclipse.emf.ecore.EObject) EObject(org.eclipse.emf.ecore.EObject) IParserEditStatus(org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) EObjectAdapter(org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter) IParser(org.eclipse.gmf.runtime.common.ui.services.parser.IParser)

Example 19 with EObjectAdapter

use of org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter in project statecharts by Yakindu.

the class StateTextCompartmentViewFactory method decorateView.

@Override
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
    super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
    IAdaptable eObjectAdapter = null;
    EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
    if (eObject != null) {
        eObjectAdapter = new EObjectAdapter(eObject);
    }
    getViewService().createNode(eObjectAdapter, view, SemanticHints.STATE_TEXT_COMPARTMENT_EXPRESSION, ViewUtil.APPEND, true, getPreferencesHint());
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) EObject(org.eclipse.emf.ecore.EObject) EObjectAdapter(org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter)

Example 20 with EObjectAdapter

use of org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter in project statecharts by Yakindu.

the class CompartmentLayoutEditPolicy method createAddCommand.

@Override
protected Command createAddCommand(EditPart child, EditPart after) {
    int index = getHost().getChildren().indexOf(after);
    TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
    AddCommand command = new CompartmentAddCommand(editingDomain, new EObjectAdapter((View) getHost().getModel()), new EObjectAdapter((View) child.getModel()), index);
    return new ICommandProxy(command);
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) ICommandProxy(org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) EObjectAdapter(org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter) View(org.eclipse.gmf.runtime.notation.View) AddCommand(org.eclipse.gmf.runtime.diagram.core.commands.AddCommand)

Aggregations

EObjectAdapter (org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter)22 EObject (org.eclipse.emf.ecore.EObject)19 IParser (org.eclipse.gmf.runtime.common.ui.services.parser.IParser)14 IParserEditStatus (org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus)14 ICellEditorValidator (org.eclipse.jface.viewers.ICellEditorValidator)14 IAdaptable (org.eclipse.core.runtime.IAdaptable)5 ICommandProxy (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy)3 IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)3 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)2 ShapeStyle (org.eclipse.gmf.runtime.notation.ShapeStyle)2 IFigure (org.eclipse.draw2d.IFigure)1 Point (org.eclipse.draw2d.geometry.Point)1 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)1 ChangeBoundsRequest (org.eclipse.gef.requests.ChangeBoundsRequest)1 AddCommand (org.eclipse.gmf.runtime.diagram.core.commands.AddCommand)1 SetBoundsCommand (org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand)1 BooleanValueStyle (org.eclipse.gmf.runtime.notation.BooleanValueStyle)1 Node (org.eclipse.gmf.runtime.notation.Node)1 View (org.eclipse.gmf.runtime.notation.View)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1