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();
}
}
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);
}
}
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
}
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);
}
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;
}
Aggregations