@Override protected Object run(final Presentation context) { final FormComponentPresentation p = (FormComponentPresentation) context; final SapphirePart part = (SapphirePart) getPart(); final Set<Property> properties = new LinkedHashSet<Property>(); collectProperties(part, properties); for (Iterator<Property> itr = properties.iterator(); itr.hasNext(); ) { if (itr.next().empty()) { itr.remove(); } } if (properties.isEmpty()) { MessageDialog.openInformation(p.shell(), dialogTitle.text(), nothingToDoMessage.text()); } else { final Set<Property> selectedProperties = PromptDialog.open(p.shell(), properties); for (Property property : selectedProperties) { property.clear(); } } return null; }
private static Set<Property> open(final Shell shell, final Set<Property> properties) { final PromptDialog dialog = new PromptDialog(shell, properties); if (dialog.open() == Window.OK) { return dialog.selectedProperties; } else { return Collections.emptySet(); } }
public static boolean promptConfirmLauch(Shell shell, IContext context, IProcess process) { boolean continueLaunch = true; int nbValues = 0; if (context == null) { throw new IllegalArgumentException("Context is null"); // $NON-NLS-1$ } // Prompt for context values ? for (IContextParameter parameter : context.getContextParameterList()) { if (parameter.isPromptNeeded()) { nbValues++; } } if (nbValues > 0) { IContext contextCopy = context.clone(); PromptDialog promptDialog = new PromptDialog(shell, contextCopy); if (promptDialog.open() == PromptDialog.OK) { for (IContextParameter param : context.getContextParameterList()) { boolean found = false; IContextParameter paramCopy = null; for (int i = 0; i < contextCopy.getContextParameterList().size() & !found; i++) { paramCopy = contextCopy.getContextParameterList().get(i); if (param.getName().equals(paramCopy.getName())) { // param.setValueList(paramCopy.getValueList()); param.setInternalValue(paramCopy.getValue()); found = true; } } } contextComboViewer.refresh(); contextTableViewer.refresh(); processNeedGenCode(process); } else { continueLaunch = false; } } else { if (context.isConfirmationNeeded()) { continueLaunch = MessageDialog.openQuestion( shell, Messages.getString("ProcessComposite.confirmTitle"), // $NON-NLS-1$ Messages.getString( "ProcessComposite.confirmText", context.getName())); // $NON-NLS-1$ } updateDefaultValueForListTypeParameter(context.getContextParameterList()); } return continueLaunch; }