Search in sources :

Example 6 with StyledTextControl

use of com.archimatetool.editor.ui.components.StyledTextControl in project archi by archimatetool.

the class ArchimateModelSection method createPurposeControl.

private void createPurposeControl(Composite parent) {
    // Label
    createLabel(parent, Messages.ArchimateModelSection_2, STANDARD_LABEL_WIDTH, SWT.NONE);
    // Text
    StyledTextControl styledTextControl = createStyledTextControl(parent, SWT.NONE);
    fTextPurpose = new PropertySectionTextControl(styledTextControl.getControl(), IArchimatePackage.Literals.ARCHIMATE_MODEL__PURPOSE) {

        @Override
        protected void textChanged(String oldText, String newText) {
            EObject model = getFirstSelectedObject();
            if (isAlive(model)) {
                Command cmd = new EObjectFeatureCommand(Messages.ArchimateModelSection_3, getFirstSelectedObject(), IArchimatePackage.Literals.ARCHIMATE_MODEL__PURPOSE, newText);
                if (cmd.canExecute()) {
                    executeCommand(cmd);
                }
            }
        }
    };
    fTextPurpose.setHint(Messages.ArchimateModelSection_4);
}
Also used : StyledTextControl(com.archimatetool.editor.ui.components.StyledTextControl) Command(org.eclipse.gef.commands.Command) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) EObject(org.eclipse.emf.ecore.EObject)

Aggregations

StyledTextControl (com.archimatetool.editor.ui.components.StyledTextControl)6 EObjectFeatureCommand (com.archimatetool.editor.model.commands.EObjectFeatureCommand)5 EObject (org.eclipse.emf.ecore.EObject)5 Command (org.eclipse.gef.commands.Command)5 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)4 PropertySectionTextControl (com.archimatetool.editor.propertysections.PropertySectionTextControl)2 GridData (org.eclipse.swt.layout.GridData)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1