Search in sources :

Example 11 with IParser

use of org.eclipse.gmf.runtime.common.ui.services.parser.IParser in project tdi-studio-se by Talend.

the class DataBusinessItemNameEditPart 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 12 with IParser

use of org.eclipse.gmf.runtime.common.ui.services.parser.IParser in project tdi-studio-se by Talend.

the class BusinessItemRelationshipNameEditPart 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 13 with IParser

use of org.eclipse.gmf.runtime.common.ui.services.parser.IParser in project tdi-studio-se by Talend.

the class DatabaseBusinessItemNameEditPart 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 14 with IParser

use of org.eclipse.gmf.runtime.common.ui.services.parser.IParser in project tdi-studio-se by Talend.

the class ActorBusinessItemNameEditPart 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)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)14 IParser (org.eclipse.gmf.runtime.common.ui.services.parser.IParser)14 IParserEditStatus (org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus)14 EObjectAdapter (org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter)14 ICellEditorValidator (org.eclipse.jface.viewers.ICellEditorValidator)14