use of org.talend.metadata.managment.ui.wizard.context.ContextModeWizard in project tdi-studio-se by Talend.
the class JSONConnectionContextHelper method exportAsContext.
/**
*
* ggu Comment method "exportAsContext".
*
*/
public static Map<ContextItem, List<ConectionAdaptContextVariableModel>> exportAsContext(ConnectionItem connItem, Set<IConnParamName> paramSet) {
if (connItem == null) {
return null;
}
List<IContextParameter> varList = createContextParameters(connItem, paramSet);
if (varList == null || varList.isEmpty()) {
return null;
}
String contextName = convertContextLabel(connItem.getProperty().getLabel());
ISelection selection = getRepositoryContext(contextName, false);
if (selection == null) {
return null;
}
Map<ContextItem, List<ConectionAdaptContextVariableModel>> variableContextMap = new HashMap();
List<ConectionAdaptContextVariableModel> models = new ArrayList<ConectionAdaptContextVariableModel>();
Set<String> connectionVaribles = getConnVariables(connItem, paramSet);
ContextModeWizard contextWizard = new ContextModeWizard(contextName, selection.isEmpty(), selection, varList, connectionVaribles);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), contextWizard);
if (dlg.open() == Window.OK) {
ContextItem contextItem = contextWizard.getContextItem();
models = contextWizard.getAdaptModels();
if (contextItem != null) {
variableContextMap.put(contextItem, models);
}
contextManager = contextWizard.getContextManager();
if (contextItem != null) {
contextItem.getProperty().setLabel(contextName);
}
return variableContextMap;
}
return null;
}
Aggregations