Search in sources :

Example 1 with ChangeNoteOpacityCommand

use of org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand in project tdi-studio-se by Talend.

the class NoteEditPart method performRequest.

@Override
public void performRequest(Request request) {
    Note note = (Note) getModel();
    if (note.isReadOnly()) {
        return;
    }
    if (request.getType() == RequestConstants.REQ_OPEN) {
        IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (part instanceof AbstractMultiPageTalendEditor) {
            CommandStack commandStack = (CommandStack) part.getAdapter(CommandStack.class);
            Command command = new ChangeNoteOpacityCommand(note, !note.isOpaque());
            commandStack.execute(command);
        }
    }
    if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) {
        if (directEditManager == null) {
            NoteFigure noteFigure = (NoteFigure) getFigure();
            directEditManager = new NoteDirectEditManager(this, TextCellEditor.class, new NoteCellEditorLocator(noteFigure));
        }
        directEditManager.show();
    }
}
Also used : CommandStack(org.eclipse.gef.commands.CommandStack) ChangeNoteOpacityCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) ChangeNoteOpacityCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand) Command(org.eclipse.gef.commands.Command) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor)

Example 2 with ChangeNoteOpacityCommand

use of org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand in project tdi-studio-se by Talend.

the class BasicNotePropertyComposite method createControl.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.designer.core.ui.editor.properties.notes.AbstractNotePropertyComposite#createControl(org.eclipse.swt
     * .widgets.Composite)
     */
@Override
public void createControl(Composite parent) {
    composite = getWidgetFactory().createFlatFormComposite(parent);
    if (composite.getLayout() instanceof FormLayout) {
        FormLayout formLayout = (FormLayout) composite.getLayout();
        formLayout.spacing = 0;
    }
    FormData data;
    //$NON-NLS-1$
    check = getWidgetFactory().createButton(composite, "", SWT.CHECK);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    check.setLayoutData(data);
    //$NON-NLS-1$
    CLabel labelLabel = getWidgetFactory().createCLabel(composite, Messages.getString("OpaqueNoteSection.Label"));
    data = new FormData();
    data.left = new FormAttachment(check);
    data.top = new FormAttachment(check, 0, SWT.TOP);
    labelLabel.setLayoutData(data);
    check.setSelection(note.isOpaque());
    check.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (check.getSelection() != (note.isOpaque())) {
                ChangeNoteOpacityCommand command = new ChangeNoteOpacityCommand(note, check.getSelection());
                getCommandStack().execute(command);
            }
        }
    });
    createFontsAndColorsGroups(composite);
    createAlignGroups(composite);
    createTextControl(composite);
    refresh();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) ChangeNoteOpacityCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 3 with ChangeNoteOpacityCommand

use of org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand in project tdi-studio-se by Talend.

the class OpaqueNotePropertySection method createControls.

@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    if (composite.getLayout() instanceof FormLayout) {
        FormLayout formLayout = (FormLayout) composite.getLayout();
        formLayout.spacing = 0;
    }
    FormData data;
    //$NON-NLS-1$
    check = getWidgetFactory().createButton(composite, "", SWT.CHECK);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    check.setLayoutData(data);
    //$NON-NLS-1$
    CLabel labelLabel = getWidgetFactory().createCLabel(composite, Messages.getString("OpaqueNoteSection.Label"));
    data = new FormData();
    data.left = new FormAttachment(check);
    data.top = new FormAttachment(check, 0, SWT.TOP);
    labelLabel.setLayoutData(data);
    check.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (check.getSelection() != (note.isOpaque())) {
                ChangeNoteOpacityCommand command = new ChangeNoteOpacityCommand(note, check.getSelection());
                getCommandStack().execute(command);
            }
        }
    });
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) ChangeNoteOpacityCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

ChangeNoteOpacityCommand (org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand)3 CLabel (org.eclipse.swt.custom.CLabel)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 FormAttachment (org.eclipse.swt.layout.FormAttachment)2 FormData (org.eclipse.swt.layout.FormData)2 FormLayout (org.eclipse.swt.layout.FormLayout)2 Command (org.eclipse.gef.commands.Command)1 CommandStack (org.eclipse.gef.commands.CommandStack)1 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)1 Composite (org.eclipse.swt.widgets.Composite)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 AbstractMultiPageTalendEditor (org.talend.designer.core.ui.AbstractMultiPageTalendEditor)1