Search in sources :

Example 61 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 62 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)

Example 63 with PropertyChangeCommand

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

the class ContextParameterExtractor method saveContext.

/**
     * qzhang Comment method "saveContext".
     * 
     * @param parameterName
     * @param elem
     * @param replaceCode
     */
public static void saveContext(final String parameterName, final IElement elem, String replaceCode, IProcess2 process) {
    PropertyChangeCommand cmd = new PropertyChangeCommand(elem, parameterName, replaceCode);
    boolean executed = false;
    if (process != null && process instanceof IGEFProcess) {
        IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
        if (designerCoreUIService != null) {
            executed = designerCoreUIService.executeCommand((IGEFProcess) process, cmd);
        }
    }
    if (!executed) {
        cmd.execute();
    }
// note that no undo will be available
}
Also used : PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) IDesignerCoreUIService(org.talend.core.ui.services.IDesignerCoreUIService) IGEFProcess(org.talend.core.ui.process.IGEFProcess)

Example 64 with PropertyChangeCommand

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

the class OpenSQLBuilderDialogJob method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
     */
@Override
protected IStatus run(IProgressMonitor monitor) {
    loginProgress = new OpenSQLBuilderDialogProgress(connectionParameters, manager, composite);
    Object obj = controller.getDynamicProperty().getPart();
    Process p = null;
    if (obj instanceof IMultiPageTalendEditor) {
        p = (Process) ((IMultiPageTalendEditor) obj).getProcess();
    } else {
        //$NON-NLS-1$
        throw new RuntimeException(Messages.getString("OpenSQLBuilderDialogJob.typeRequried"));
    }
    final Process process = p;
    try {
        loginProgress.run(monitor);
        if (EDatabaseTypeName.ACCESS.getDisplayName().equals(connectionParameters.getDbType()) || connectionParameters.isStatus()) {
            Display.getDefault().asyncExec(new Runnable() {

                public void run() {
                    Shell parentShell = new Shell(composite.getShell().getDisplay());
                    if (elem instanceof Node) {
                        TextUtil.setDialogTitle(process.getName(), (String) //$NON-NLS-1$
                        ((Node) elem).getElementParameter("LABEL").getValue(), elem.getElementName());
                    } else {
                        TextUtil.setDialogTitle(process.getName(), null, null);
                    }
                    SQLBuilderDialog dial = new SQLBuilderDialog(parentShell);
                    UIUtils.addSqlBuilderDialog(process.getName(), dial);
                    dial.setConnParameters(connectionParameters);
                    if (Window.OK == dial.open()) {
                        if (!composite.isDisposed() && !connectionParameters.isNodeReadOnly()) {
                            if (EParameterFieldType.DBTABLE.equals(connectionParameters.getFieldType())) {
                            // final String selectDBTable = connectionParameters.getSelectDBTable();
                            // if (selectDBTable != null) {
                            // Command cmd = new PropertyChangeCommand(elem, propertyName, TalendTextUtils
                            // .addSQLQuotes(selectDBTable));
                            // commandStack.execute(cmd);
                            // }
                            } else {
                                String sql = connectionParameters.getQuery();
                                sql = QueryUtil.checkAndAddQuotes(sql);
                                PropertyChangeCommand cmd = new PropertyChangeCommand(elem, propertyName, sql);
                                cmd.setUpdate(true);
                                commandStack.execute(cmd);
                            }
                        }
                    }
                }
            });
        } else {
            Display.getDefault().asyncExec(new Runnable() {

                public void run() {
                    String pid = SqlBuilderPlugin.PLUGIN_ID;
                    //$NON-NLS-1$
                    String mainMsg = Messages.getString("ConnectionError.Message");
                    if (new ErrorDialogWithDetailAreaAndContinueButton(composite.getShell(), pid, mainMsg, connectionParameters.getConnectionComment()).getCodeOfButton() == Dialog.OK) {
                        ConfigureConnParamDialog paramDialog = new ConfigureConnParamDialog(composite.getShell(), connectionParameters, process.getContextManager(), elem);
                        if (paramDialog.open() == Window.OK) {
                            controller.openSqlBuilderBuildIn(connectionParameters, propertyName);
                        }
                    }
                }
            });
        }
    } catch (InterruptedException ie) {
        loginProgress.cleanUp();
        //$NON-NLS-1$
        return new Status(IStatus.CANCEL, id, IStatus.CANCEL, "Progress.OpenSqlBuilderDialog.Cancelled", null);
    } catch (Exception e) {
        loginProgress.cleanUp();
        //$NON-NLS-1$
        return new Status(IStatus.ERROR, id, IStatus.CANCEL, "Progress.OpenSqlBuilderDialog.Error", e);
    }
    //$NON-NLS-1$
    return new Status(IStatus.OK, id, IStatus.OK, "tested ok ", null);
}
Also used : ErrorDialogWithDetailAreaAndContinueButton(org.talend.commons.ui.swt.dialogs.ErrorDialogWithDetailAreaAndContinueButton) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) IMultiPageTalendEditor(org.talend.designer.core.IMultiPageTalendEditor) Shell(org.eclipse.swt.widgets.Shell) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) ConfigureConnParamDialog(org.talend.designer.core.ui.editor.properties.ConfigureConnParamDialog) OpenSQLBuilderDialogProgress(org.talend.sqlbuilder.ui.progress.OpenSQLBuilderDialogProgress)

Example 65 with PropertyChangeCommand

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

the class RouteInputProcessTypeController method createButtonCommand.

protected Command createButtonCommand(Button button) {
    AssignJobWizard assignJobWizard = new AssignJobWizard();
    WizardDialog wizardDialog = new AssignJobWizardDialog(button.getShell(), assignJobWizard);
    if (wizardDialog.open() == WizardDialog.OK) {
        String id = assignJobWizard.getSelectedProcessId();
        if (id != null) {
            String paramName = (String) button.getData(PARAMETER_NAME);
            return new PropertyChangeCommand(elem, paramName, id);
        }
    }
    return null;
}
Also used : PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) AssignJobWizardDialog(org.talend.camel.designer.ui.wizards.AssignJobWizardDialog) AssignJobWizardDialog(org.talend.camel.designer.ui.wizards.AssignJobWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) AssignJobWizard(org.talend.camel.designer.ui.wizards.AssignJobWizard)

Aggregations

PropertyChangeCommand (org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand)68 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)8 MetadataTable (org.talend.core.model.metadata.MetadataTable)8 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)8