Search in sources :

Example 36 with PropertyChangeCommand

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

the class AdvanceSettingComposite method addLog4jListener.

private void addLog4jListener() {
    customLog4j.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            log4jLevel.setEnabled(customLog4j.getSelection());
            processContext.setUseCustomLevel(customLog4j.getSelection());
            processManager.setCustomLog4j(customLog4j.getSelection());
            if (processContext.getProcess() != null) {
                executeCommand(new PropertyChangeCommand(processContext.getProcess(), EParameterName.LOG4J_RUN_ACTIVATE.getName(), customLog4j.getSelection()));
            }
        }
    });
    log4jLevel.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            processContext.setLog4jLevel(log4jLevel.getText());
            processManager.setLog4jLevel(log4jLevel.getText());
            if (processContext.getProcess() != null) {
                executeCommand(new PropertyChangeCommand(processContext.getProcess(), EParameterName.LOG4J_RUN_LEVEL.getName(), log4jLevel.getText()));
            }
        }
    });
}
Also used : PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 37 with PropertyChangeCommand

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

the class BasicNotePropertyComposite method createFontsGroup.

/**
     * Create font tool bar group
     * 
     * @param parent - parent composite
     * @return - font tool bar
     */
protected Composite createFontsGroup(Composite parent) {
    Composite familySize = getWidgetFactory().createComposite(parent);
    GridLayout layout = new GridLayout(2, false);
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    familySize.setLayout(layout);
    fontFamilyCombo = getWidgetFactory().createCCombo(familySize, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
    fontFamilyCombo.setItems(FontHelper.getFontNames());
    fontFamilyCombo.setText((String) note.getPropertyValue(EParameterName.NOTE_FONT.getName()));
    fontFamilyCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            updateFontFamily();
        }
    });
    fontSizeCombo = getWidgetFactory().createCCombo(familySize, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
    fontSizeCombo.setItems(FontHelper.getFontSizes());
    fontSizeCombo.setText((String) note.getPropertyValue(EParameterName.FONT_SIZE.getName()));
    fontSizeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            updateFontSize();
        }
    });
    Composite toolBar = new Composite(parent, SWT.SHADOW_NONE);
    toolBar.setLayout(new GridLayout(7, false));
    toolBar.setBackground(parent.getBackground());
    fontBoldButton = new Button(toolBar, SWT.TOGGLE);
    fontBoldButton.setImage(ImageProvider.getImage(EImage.BOLD_ICON));
    fontBoldButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {

        @Override
        public void getName(AccessibleEvent e) {
            e.result = "Bold";
        }
    });
    fontItalicButton = new Button(toolBar, SWT.TOGGLE);
    fontItalicButton.setImage(ImageProvider.getImage(EImage.ITALIC_ICON));
    fontItalicButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {

        @Override
        public void getName(AccessibleEvent e) {
            e.result = "Italic";
        }
    });
    fontBoldButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            updateFontBold();
        }
    });
    fontItalicButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            updateFontItalic();
        }
    });
    new Label(toolBar, SWT.LEFT);
    fontColorButton = new Button(toolBar, SWT.PUSH);
    Image overlyedImage = new ColorOverlayImageDescriptor(ImageProvider.getImageDesc(EImage.FONT_COLOR_ICON).getImageData(), ColorUtils.stringToRGB((String) note.getPropertyValue(EParameterName.NOTETXT_COLOR.getName()))).createImage();
    fontColorButton.setImage(overlyedImage);
    fontColorButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {

        @Override
        public void getName(AccessibleEvent e) {
            e.result = "Font Color";
        }
    });
    fontColorButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            ColorPalettePopup popup = new ColorPalettePopup(fontColorButton.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT);
            Rectangle r = fontColorButton.getBounds();
            Point location = fontColorButton.getParent().toDisplay(r.x, r.y);
            popup.open(new Point(location.x, location.y + r.height));
            if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
                return;
            }
            // selectedColor should be null if we are to use the default color
            RGB selectedColor = popup.getSelectedColor();
            if (popup.useDefaultColor()) {
                selectedColor = new RGB(0, 0, 0);
            }
            if (selectedColor != null) {
                //$NON-NLS-1$ //$NON-NLS-2$
                String value = selectedColor.red + ";" + selectedColor.green + ";" + selectedColor.blue;
                Command cmd = new PropertyChangeCommand(note, EParameterName.NOTETXT_COLOR.getName(), value);
                getCommandStack().execute(cmd);
                note.refresh();
                Image overlyedImage = new ColorOverlayImageDescriptor(ImageProvider.getImageDesc(EImage.FONT_COLOR_ICON).getImageData(), selectedColor).createImage();
                fontColorButton.setImage(overlyedImage);
                text.setForeground(new Color(null, ColorUtils.stringToRGB((String) note.getPropertyValue(EParameterName.NOTETXT_COLOR.getName()))));
            }
        }
    });
    new Label(toolBar, SWT.LEFT);
    lineColorButton = new Button(toolBar, SWT.PUSH);
    overlyedImage = new ColorOverlayImageDescriptor(ImageProvider.getImageDesc(EImage.LINE_COLOR_ICON).getImageData(), ColorUtils.stringToRGB((String) note.getPropertyValue(EParameterName.NOTE_LINECOLOR.getName()))).createImage();
    lineColorButton.setImage(overlyedImage);
    lineColorButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {

        @Override
        public void getName(AccessibleEvent e) {
            e.result = "Line Color";
        }
    });
    lineColorButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            ColorPalettePopup popup = new ColorPalettePopup(lineColorButton.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT);
            Rectangle r = lineColorButton.getBounds();
            Point location = lineColorButton.getParent().toDisplay(r.x, r.y);
            popup.open(new Point(location.x, location.y + r.height));
            if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
                return;
            }
            // selectedColor should be null if we are to use the default color
            RGB selectedColor = popup.getSelectedColor();
            if (popup.useDefaultColor()) {
                selectedColor = new RGB(237, 201, 122);
            }
            if (selectedColor != null) {
                //$NON-NLS-1$ //$NON-NLS-2$
                String value = selectedColor.red + ";" + selectedColor.green + ";" + selectedColor.blue;
                Command cmd = new PropertyChangeCommand(note, EParameterName.NOTE_LINECOLOR.getName(), value);
                getCommandStack().execute(cmd);
                note.refresh();
                Image overlyedImage = new ColorOverlayImageDescriptor(ImageProvider.getImageDesc(EImage.LINE_COLOR_ICON).getImageData(), selectedColor).createImage();
                lineColorButton.setImage(overlyedImage);
            }
        }
    });
    fillColorButton = new Button(toolBar, SWT.PUSH);
    overlyedImage = new ColorOverlayImageDescriptor(ImageProvider.getImageDesc(EImage.FILL_COLOR_ICON).getImageData(), ColorUtils.stringToRGB((String) note.getPropertyValue(EParameterName.NOTE_COLOR.getName()))).createImage();
    fillColorButton.setImage(overlyedImage);
    fillColorButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {

        @Override
        public void getName(AccessibleEvent e) {
            e.result = "Fill Color";
        }
    });
    fillColorButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            ColorPalettePopup popup = new ColorPalettePopup(fillColorButton.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT);
            Rectangle r = fillColorButton.getBounds();
            Point location = fillColorButton.getParent().toDisplay(r.x, r.y);
            popup.open(new Point(location.x, location.y + r.height));
            if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
                return;
            }
            // selectedColor should be null if we are to use the default color
            RGB selectedColor = popup.getSelectedColor();
            if (popup.useDefaultColor()) {
                selectedColor = new RGB(255, 255, 203);
            }
            if (selectedColor != null) {
                //$NON-NLS-1$ //$NON-NLS-2$
                String value = selectedColor.red + ";" + selectedColor.green + ";" + selectedColor.blue;
                Command cmd = new PropertyChangeCommand(note, EParameterName.NOTE_COLOR.getName(), value);
                getCommandStack().execute(cmd);
                note.refresh();
                Image overlyedImage = new ColorOverlayImageDescriptor(ImageProvider.getImageDesc(EImage.FILL_COLOR_ICON).getImageData(), selectedColor).createImage();
                fillColorButton.setImage(overlyedImage);
            }
        }
    });
    return toolBar;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Color(org.eclipse.swt.graphics.Color) CLabel(org.eclipse.swt.custom.CLabel) Label(org.eclipse.swt.widgets.Label) Rectangle(org.eclipse.swt.graphics.Rectangle) AccessibleAdapter(org.eclipse.swt.accessibility.AccessibleAdapter) ColorPalettePopup(org.talend.commons.ui.gmf.util.ColorPalettePopup) Point(org.eclipse.swt.graphics.Point) Image(org.eclipse.swt.graphics.Image) EImage(org.talend.commons.ui.runtime.image.EImage) RGB(org.eclipse.swt.graphics.RGB) GridLayout(org.eclipse.swt.layout.GridLayout) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) Button(org.eclipse.swt.widgets.Button) ChangeNoteOpacityCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand) ChangeNoteTextCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteTextCommand) Command(org.eclipse.gef.commands.Command) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) SelectionEvent(org.eclipse.swt.events.SelectionEvent) AccessibleEvent(org.eclipse.swt.accessibility.AccessibleEvent)

Example 38 with PropertyChangeCommand

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

the class BasicNotePropertyComposite method updateFontItalic.

private void updateFontItalic() {
    Boolean value = fontItalicButton.getSelection();
    Command cmd = new PropertyChangeCommand(note, EParameterName.FONT_ITALIC.getName(), value);
    getCommandStack().execute(cmd);
    note.refresh();
    textChanged();
}
Also used : PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) ChangeNoteOpacityCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand) ChangeNoteTextCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteTextCommand) Command(org.eclipse.gef.commands.Command) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand)

Example 39 with PropertyChangeCommand

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

the class BasicNotePropertyComposite method updateFontSize.

private void updateFontSize() {
    if (fontSizeCombo.getText() != null || !fontSizeCombo.getText().equals("")) {
        //$NON-NLS-1$
        String value = fontSizeCombo.getText();
        Command cmd = new PropertyChangeCommand(note, EParameterName.FONT_SIZE.getName(), value);
        getCommandStack().execute(cmd);
        note.refresh();
        textChanged();
    }
}
Also used : PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) ChangeNoteOpacityCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteOpacityCommand) ChangeNoteTextCommand(org.talend.designer.core.ui.editor.cmd.ChangeNoteTextCommand) Command(org.eclipse.gef.commands.Command) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand)

Example 40 with PropertyChangeCommand

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

the class ParallelExecutionAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    boolean hasFlowConnection = false;
    for (IConnection connection : node.getOutgoingConnections()) {
        if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
            hasFlowConnection = true;
            break;
        }
    }
    if (hasFlowConnection) {
        MessageDialog.openError(getWorkbenchPart().getSite().getShell(), Messages.getString(//$NON-NLS-1$
        "ParallelExecutionAction.gotLink"), //$NON-NLS-1$
        Messages.getString("ParallelExecutionAction.noOutputLink"));
        return;
    }
    IElementParameter enableParallelizeParameter = node.getElementParameter(EParameterName.PARALLELIZE.getName());
    if (enableParallelizeParameter != null) {
        parallelEnable = (Boolean) enableParallelizeParameter.getValue();
    }
    IElementParameter numberParallelizeParameter = node.getElementParameter(EParameterName.PARALLELIZE_NUMBER.getName());
    if (numberParallelizeParameter != null) {
        numberParallel = (String) numberParallelizeParameter.getValue();
    }
    Dialog dialog = new ParallelDialog(getWorkbenchPart().getSite().getShell());
    if (dialog.open() == Dialog.OK) {
        Command command = new PropertyChangeCommand(node, EParameterName.PARALLELIZE.getName(), parallelEnable);
        execute(command);
    }
}
Also used : PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) Command(org.eclipse.gef.commands.Command) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) Dialog(org.eclipse.jface.dialogs.Dialog) IElementParameter(org.talend.core.model.process.IElementParameter) IConnection(org.talend.core.model.process.IConnection)

Aggregations

PropertyChangeCommand (org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand)69 IElementParameter (org.talend.core.model.process.IElementParameter)34 Command (org.eclipse.gef.commands.Command)24 Point (org.eclipse.swt.graphics.Point)18 INode (org.talend.core.model.process.INode)18 Node (org.talend.designer.core.ui.editor.nodes.Node)18 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)16 Control (org.eclipse.swt.widgets.Control)14 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)13 RepositoryNode (org.talend.repository.model.RepositoryNode)12 CCombo (org.eclipse.swt.custom.CCombo)11 IConnection (org.talend.core.model.process.IConnection)11 ConnectionItem (org.talend.core.model.properties.ConnectionItem)11 ArrayList (java.util.ArrayList)10 List (java.util.List)10 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)10 Item (org.talend.core.model.properties.Item)10 Button (org.eclipse.swt.widgets.Button)9 Text (org.eclipse.swt.widgets.Text)8 MetadataTable (org.talend.core.model.metadata.MetadataTable)8