use of com.centurylink.mdw.plugin.designer.dialogs.MdwInputDialog in project mdw-designer by CenturyLinkCloud.
the class PackageConfigurationSection method createButtons.
private void createButtons(Composite parent) {
buttonComposite = new Composite(parent, SWT.NONE);
GridLayout gl = new GridLayout();
gl.numColumns = 1;
buttonComposite.setLayout(gl);
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
buttonComposite.setLayoutData(gd);
Group propBtnGroup = new Group(buttonComposite, SWT.NONE);
propBtnGroup.setText("Properties");
gl = new GridLayout();
propBtnGroup.setLayout(gl);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
gd.verticalIndent = 15;
propBtnGroup.setLayoutData(gd);
// add prop
Button addButton = new Button(propBtnGroup, SWT.PUSH | SWT.CENTER);
addButton.setText("Add");
GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
gridData.widthHint = 60;
gridData.horizontalIndent = 3;
addButton.setLayoutData(gridData);
addButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
propertyRows.add(new PropertyRow("new.property"));
if (// first property added
propertyRows.size() == 1)
propertyRows.get(0).envValues.put("", "");
tableViewer.setInput(propertyRows);
updateModel();
if (// first property added
propertyRows.size() == 1)
setSelection(workflowPackage);
}
});
// delete prop
Button deleteButton = new Button(propBtnGroup, SWT.PUSH | SWT.CENTER);
deleteButton.setText("Delete");
gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
gridData.widthHint = 60;
gridData.horizontalIndent = 3;
deleteButton.setLayoutData(gridData);
deleteButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
PropertyRow row = (PropertyRow) ((IStructuredSelection) tableViewer.getSelection()).getFirstElement();
if (row != null)
propertyRows.remove(row);
tableViewer.setInput(propertyRows);
updateModel();
}
});
if (!workflowPackage.getProject().checkRequiredVersion(6)) {
Group envBtnGroup = new Group(buttonComposite, SWT.NONE);
envBtnGroup.setText("Environments");
gl = new GridLayout();
envBtnGroup.setLayout(gl);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
gd.verticalIndent = 10;
envBtnGroup.setLayoutData(gd);
// add env
Button newEnvButton = new Button(envBtnGroup, SWT.PUSH | SWT.CENTER);
newEnvButton.setText("Add...");
gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
gridData.widthHint = 60;
gridData.horizontalIndent = 3;
newEnvButton.setLayoutData(gridData);
newEnvButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
MdwInputDialog inputDlg = new MdwInputDialog(getShell(), "Environment Name", false);
inputDlg.setTitle("New Environment");
if (inputDlg.open() == Dialog.OK) {
if (propertyRows.isEmpty())
propertyRows.add(new PropertyRow("new.property"));
propertyRows.get(0).envValues.put(inputDlg.getInput(), "");
tableViewer.setInput(propertyRows);
updateModel();
setSelection(workflowPackage);
}
}
});
// delete env
Button deleteEnvButton = new Button(envBtnGroup, SWT.PUSH | SWT.CENTER);
deleteEnvButton.setText("Delete...");
gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
gridData.widthHint = 60;
gridData.horizontalIndent = 3;
deleteEnvButton.setLayoutData(gridData);
deleteEnvButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
List<String> envs = new ArrayList<>();
for (PropertyRow propRow : propertyRows) {
for (String env : propRow.envValues.keySet()) {
if (!envs.contains(env))
envs.add(env);
}
}
MdwChoiceDialog choiceDlg = new MdwChoiceDialog(getShell(), "Environment to Remove", envs.toArray(new String[0]));
choiceDlg.setTitle("Remove Environment");
int res = choiceDlg.open();
if (res != MdwChoiceDialog.CANCEL && !envs.isEmpty()) {
String choice = envs.get(res);
for (PropertyRow propRow : propertyRows) {
propRow.envValues.remove(choice);
}
updateModel();
setSelection(workflowPackage);
}
}
});
}
// save
saveButton = new Button(buttonComposite, SWT.PUSH | SWT.CENTER);
saveButton.setText("Save");
gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
gridData.widthHint = 60;
gridData.verticalIndent = 15;
saveButton.setLayoutData(gridData);
saveButton.setEnabled(dirty);
saveButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
saveMetaContent();
}
});
}
use of com.centurylink.mdw.plugin.designer.dialogs.MdwInputDialog in project mdw-designer by CenturyLinkCloud.
the class Page method run.
public void run() {
boolean is55 = getProject().checkRequiredVersion(5, 5);
String urlPath;
if (isTaskInstancePage()) {
MdwInputDialog dlg = new MdwInputDialog(MdwPlugin.getShell(), "Task Instance ID", false);
if (dlg.open() != Dialog.OK)
return;
try {
Long taskInstanceId = new Long(dlg.getInput());
urlPath = getProject().getTaskInstancePath(taskInstanceId);
} catch (NumberFormatException ex) {
MessageDialog.openError(MdwPlugin.getShell(), "Invalid Input", "Invalid task instance ID: " + dlg.getInput());
return;
}
} else {
// TODO: why does new path format not work?
// if (is55)
// urlPath = TaskAttributeConstant.PAGE_PATH + getName();
// else
urlPath = TaskAttributeConstant.PAGE_COMPATIBILITY_PATH + getName();
}
WebApp webapp = is55 ? WebApp.MdwHub : WebApp.TaskManager;
WebLaunchAction launchAction = WebLaunchActions.getLaunchAction(getProject(), webapp);
launchAction.launch(getPackage(), urlPath);
}
use of com.centurylink.mdw.plugin.designer.dialogs.MdwInputDialog in project mdw-designer by CenturyLinkCloud.
the class ActivityImplSection method launchImplClassNameDialog.
private void launchImplClassNameDialog() {
MdwInputDialog classNameDialog = new MdwInputDialog(getShell(), "Fully-Qualified Implementor Class Name", false);
classNameDialog.setTitle("Activity Implementor");
classNameDialog.setWidth(300);
classNameDialog.setInput(activityImpl.getImplClassName());
if (classNameDialog.open() == Dialog.OK) {
final String newClassName = classNameDialog.getInput().trim();
if (newClassName.length() > 0) {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
activityImpl.setImplClassName(newClassName);
activityImpl.getProject().getDesignerProxy().saveActivityImpl(activityImpl);
activityImpl.getProject().setActivityImplClass(activityImpl.getImplClassName(), activityImpl);
setSelection(activityImpl);
}
});
}
}
}
Aggregations