Search in sources :

Example 1 with StyledTextControl

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

the class HintContentSection method createControls.

@Override
protected void createControls(Composite parent) {
    createLabel(parent, Messages.HintContentSection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
    Text text = createSingleTextControl(parent, SWT.NONE);
    fTextTitleControl = new PropertySectionTextControl(text, ICanvasPackage.Literals.HINT_PROVIDER__HINT_TITLE) {

        @Override
        protected void textChanged(String oldText, String newText) {
            CompoundCommand result = new CompoundCommand();
            for (EObject provider : getEObjects()) {
                if (isAlive(provider)) {
                    Command cmd = new EObjectFeatureCommand(Messages.HintContentSection_1, provider, ICanvasPackage.Literals.HINT_PROVIDER__HINT_TITLE, newText);
                    if (cmd.canExecute()) {
                        result.add(cmd);
                    }
                }
            }
            executeCommand(result.unwrap());
        }
    };
    fTextTitleControl.setHint(Messages.HintContentSection_2);
    createLabel(parent, Messages.HintContentSection_3, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.NONE);
    StyledTextControl styledTextControl = createStyledTextControl(parent, SWT.NONE);
    fTextContentControl = new PropertySectionTextControl(styledTextControl.getControl(), ICanvasPackage.Literals.HINT_PROVIDER__HINT_CONTENT) {

        @Override
        protected void textChanged(String oldText, String newText) {
            CompoundCommand result = new CompoundCommand();
            for (EObject provider : getEObjects()) {
                if (isAlive(provider)) {
                    Command cmd = new EObjectFeatureCommand(Messages.HintContentSection_4, provider, ICanvasPackage.Literals.HINT_PROVIDER__HINT_CONTENT, newText);
                    if (cmd.canExecute()) {
                        result.add(cmd);
                    }
                }
            }
            executeCommand(result.unwrap());
        }
    };
    fTextContentControl.setHint(Messages.HintContentSection_5);
    // Help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(fTextContentControl.getTextControl(), HELP_ID);
}
Also used : CompoundCommand(org.eclipse.gef.commands.CompoundCommand) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) Command(org.eclipse.gef.commands.Command) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) StyledTextControl(com.archimatetool.editor.ui.components.StyledTextControl) EObject(org.eclipse.emf.ecore.EObject) Text(org.eclipse.swt.widgets.Text) PropertySectionTextControl(com.archimatetool.editor.propertysections.PropertySectionTextControl) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Example 2 with StyledTextControl

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

the class NotesSection method createControls.

@Override
protected void createControls(Composite parent) {
    createLabel(parent, Messages.NotesSection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.NONE);
    StyledTextControl styledTextControl = createStyledTextControl(parent, SWT.NONE);
    fTextNotesControl = new PropertySectionTextControl(styledTextControl.getControl(), ICanvasPackage.Literals.NOTES_CONTENT__NOTES) {

        @Override
        protected void textChanged(String oldText, String newText) {
            CompoundCommand result = new CompoundCommand();
            for (EObject notesContent : getEObjects()) {
                if (isAlive(notesContent)) {
                    Command cmd = new EObjectFeatureCommand(Messages.NotesSection_1, notesContent, ICanvasPackage.Literals.NOTES_CONTENT__NOTES, newText);
                    if (cmd.canExecute()) {
                        result.add(cmd);
                    }
                }
            }
            executeCommand(result.unwrap());
        }
    };
    fTextNotesControl.setHint(Messages.NotesSection_2);
    // Help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(fTextNotesControl.getTextControl(), HELP_ID);
}
Also used : StyledTextControl(com.archimatetool.editor.ui.components.StyledTextControl) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) Command(org.eclipse.gef.commands.Command) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) EObject(org.eclipse.emf.ecore.EObject) PropertySectionTextControl(com.archimatetool.editor.propertysections.PropertySectionTextControl) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Example 3 with StyledTextControl

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

the class TextContentSection method createControls.

@Override
protected void createControls(Composite parent) {
    createLabel(parent, Messages.TextContentSection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.NONE);
    StyledTextControl styledTextControl = createStyledTextControl(parent, SWT.NONE);
    fTextContentControl = new PropertySectionTextControl(styledTextControl.getControl(), IArchimatePackage.Literals.TEXT_CONTENT__CONTENT) {

        @Override
        protected void textChanged(String oldText, String newText) {
            CompoundCommand result = new CompoundCommand();
            for (EObject textContent : getEObjects()) {
                if (isAlive(textContent)) {
                    Command cmd = new EObjectFeatureCommand(Messages.TextContentSection_1, textContent, IArchimatePackage.Literals.TEXT_CONTENT__CONTENT, newText);
                    if (cmd.canExecute()) {
                        result.add(cmd);
                    }
                }
            }
            executeCommand(result.unwrap());
        }
    };
    fTextContentControl.setHint(Messages.TextContentSection_2);
    // Help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(fTextContentControl.getTextControl(), HELP_ID);
}
Also used : StyledTextControl(com.archimatetool.editor.ui.components.StyledTextControl) Command(org.eclipse.gef.commands.Command) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) EObject(org.eclipse.emf.ecore.EObject) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Example 4 with StyledTextControl

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

the class AbstractArchiPropertySection method createStyledTextControl.

/**
 * @param parent
 * @return A StyledTextControl
 */
protected StyledTextControl createStyledTextControl(Composite parent, int style) {
    StyledTextControl styledTextControl = new StyledTextControl(parent, style | SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
    // Text textControl = getWidgetFactory().createText(parent, null, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    // This stops excess size if the control contains a lot of text
    gd.widthHint = 100;
    gd.heightHint = 100;
    styledTextControl.getControl().setLayoutData(gd);
    return styledTextControl;
}
Also used : StyledTextControl(com.archimatetool.editor.ui.components.StyledTextControl) GridData(org.eclipse.swt.layout.GridData)

Example 5 with StyledTextControl

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

the class AbstractECorePropertySection method createDocumentationControl.

/**
 * Create a Documentation control
 */
protected PropertySectionTextControl createDocumentationControl(Composite parent, String hint) {
    // Label
    Label label = createLabel(parent, Messages.AbstractECorePropertySection_2, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.NONE);
    // CSS
    // $NON-NLS-1$ //$NON-NLS-2$
    label.setData("org.eclipse.e4.ui.css.CssClassName", "PropertiesDocumentationLabel");
    // Text
    StyledTextControl styledTextControl = createStyledTextControl(parent, SWT.NONE);
    // CSS
    // $NON-NLS-1$ //$NON-NLS-2$
    styledTextControl.getControl().setData("org.eclipse.e4.ui.css.CssClassName", "PropertiesDocumentationText");
    PropertySectionTextControl textDoc = new PropertySectionTextControl(styledTextControl.getControl(), IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION) {

        @Override
        protected void textChanged(String oldText, String newText) {
            if (fObjects != null) {
                CompoundCommand result = new CompoundCommand(Messages.AbstractECorePropertySection_3);
                for (EObject eObject : fObjects) {
                    if (isAlive(eObject)) {
                        Command cmd = new EObjectFeatureCommand(Messages.AbstractECorePropertySection_3, eObject, IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION, newText);
                        if (cmd.canExecute()) {
                            result.add(cmd);
                        }
                    }
                }
                executeCommand(result.unwrap());
            }
        }
    };
    textDoc.setHint(hint);
    return textDoc;
}
Also used : StyledTextControl(com.archimatetool.editor.ui.components.StyledTextControl) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) Command(org.eclipse.gef.commands.Command) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) EObject(org.eclipse.emf.ecore.EObject) Label(org.eclipse.swt.widgets.Label) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

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