Search in sources :

Example 1 with PropertySectionTextControl

use of com.archimatetool.editor.propertysections.PropertySectionTextControl 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);
    text.setMessage(Messages.HintContentSection_2);
    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());
        }
    };
    createLabel(parent, Messages.HintContentSection_3, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.NONE);
    StyledTextControl styledTextControl = createStyledTextControl(parent, SWT.NONE);
    styledTextControl.setMessage(Messages.HintContentSection_5);
    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());
        }
    };
    // 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 PropertySectionTextControl

use of com.archimatetool.editor.propertysections.PropertySectionTextControl 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);
    styledTextControl.setMessage(Messages.NotesSection_2);
    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());
        }
    };
    // 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)

Aggregations

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