/** * Set the first item of value list for the default value if this parameter does not need to * prompt. * * @param contextParameterList */ private static void updateDefaultValueForListTypeParameter( List<IContextParameter> contextParameterList) { for (IContextParameter contextParameter : contextParameterList) { String[] list = contextParameter.getValueList(); if (list == null) { continue; } if (list.length == 0) { contextParameter.setInternalValue(""); // $NON-NLS-1$ } else { contextParameter.setInternalValue(list[0]); } } }
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; }