use of org.eclipse.jface.wizard.WizardDialog in project tdi-studio-se by Talend.
the class CreateJSONSchemaAction method openJSONSchemaWizard.
private void openJSONSchemaWizard(final JSONFileConnectionItem item, final MetadataTable metadataTable, final boolean forceReadOnly, final boolean creation) {
FileJSONTableWizard jsonWizard = new FileJSONTableWizard(PlatformUI.getWorkbench(), creation, item, metadataTable, forceReadOnly);
jsonWizard.setRepositoryObject(repositoryNode.getObject());
WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), jsonWizard);
wizardDialog.setPageSize(WIZARD_WIDTH, WIZARD_HEIGHT);
wizardDialog.create();
wizardDialog.open();
// FileXmlTableWizard fileXmlTableWizard = new FileXmlTableWizard(PlatformUI.getWorkbench(), creation, item,
// metadataTable,
// forceReadOnly);
// fileXmlTableWizard.setRepositoryObject(node.getObject());
//
// WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), fileXmlTableWizard);
// handleWizard(node, wizardDialog);
}
use of org.eclipse.jface.wizard.WizardDialog 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;
}
use of org.eclipse.jface.wizard.WizardDialog in project tdi-studio-se by Talend.
the class TOSLoginComposite method addListener.
private void addListener() {
createButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Project project = null;
ProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
NewProjectWizard newPrjWiz = new NewProjectWizard(null);
WizardDialog newProjectDialog = new WizardDialog(getShell(), newPrjWiz);
//$NON-NLS-1$
newProjectDialog.setTitle(Messages.getString("LoginDialog.newProjectTitle"));
if (newProjectDialog.open() == Window.OK) {
project = newPrjWiz.getProject();
refresh();
ArrayList<String> allProjects = (ArrayList<String>) projectListViewer.getInput();
int index = 0;
Collections.sort(allProjects);
for (int i = 0; i < allProjects.size(); i++) {
String projectName = allProjects.get(i);
if (project.getLabel().equals(projectName)) {
index = i;
break;
}
}
projectListViewer.getList().select(index);
projectListViewer.refresh();
}
}
});
deleteButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Shell activeShell = Display.getCurrent().getActiveShell();
SelectDeleteProjectDialog dialog = new SelectDeleteProjectDialog(activeShell, true);
if (dialog.open() == Dialog.OK) {
CorePlugin.getDefault().getRepositoryLocalProviderService().resetXmiResourceSet();
java.util.List<Object> delList = dialog.getDelList();
if (delList.size() != 0) {
for (Object obj : delList) {
if (obj instanceof IProject) {
IProject p = (IProject) obj;
if (projectsMap.containsKey(p.getName())) {
projectsMap.remove(p.getName());
String name = convertorMapper.get(p.getName());
if (name != null) {
convertorMapper.remove(p.getName());
TOSLoginComposite.this.projectListViewer.getList().remove(name);
}
if (TOSLoginComposite.this.projectListViewer.getList().getItemCount() == 0) {
enableOpenAndDelete(false);
} else if (TOSLoginComposite.this.projectListViewer.getSelection().isEmpty()) {
TOSLoginComposite.this.projectListViewer.getList().select(0);
}
try {
setStatusArea();
} catch (PersistenceException e1) {
ExceptionHandler.process(e1);
}
}
}
}
}
}
refresh();
}
});
importButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ImportDemoProjectAction.getInstance().setShell(getShell());
ImportProjectAsAction.getInstance().run();
String newProject = ImportProjectAsAction.getInstance().getProjectName();
if (newProject != null) {
ProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
Project[] projects = null;
try {
projects = repositoryFactory.readProject();
} catch (PersistenceException e1) {
e1.printStackTrace();
} catch (BusinessException e1) {
e1.printStackTrace();
}
if (!projectsMap.containsKey(newProject.toUpperCase())) {
for (Project project : projects) {
if (project.getLabel().toUpperCase().equals(newProject.toUpperCase())) {
projectsMap.put(newProject.toUpperCase(), project);
convertorMapper.put(newProject.toUpperCase(), newProject);
enableOpenAndDelete(true);
try {
setStatusArea();
} catch (PersistenceException e1) {
ExceptionHandler.process(e1);
}
}
}
TOSLoginComposite.this.projectListViewer.setInput(new ArrayList(convertorMapper.values()));
}
}
try {
IRunnableWithProgress op = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
ProxyRepositoryFactory.getInstance().initialize();
} catch (PersistenceException e) {
throw new InvocationTargetException(e);
}
}
};
new ProgressMonitorDialog(getShell()).run(true, false, op);
refresh();
} catch (InvocationTargetException e1) {
e1.getTargetException();
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
});
changeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dirDialog = new DirectoryDialog(dialog.getShell());
String path = dirDialog.open();
if (path == null || "".equals(path)) {
//$NON-NLS-1$
workspaceText.setText(getRecentWorkSpace());
loginComposite.getConnection().setWorkSpace(getRecentWorkSpace());
} else {
workspaceText.setText(path);
loginComposite.getConnection().setWorkSpace(path);
if (!path.equals(oldPath)) {
oldPath = path;
restartBut.setVisible(true);
openButton.setEnabled(false);
deleteButton.setEnabled(false);
createButton.setEnabled(false);
importButton.setEnabled(false);
demoProjectButton.setEnabled(false);
changeButton.setEnabled(false);
}
}
java.util.List<ConnectionBean> list = new ArrayList<ConnectionBean>();
list.add(loginComposite.getConnection());
loginComposite.storedConnections = list;
perReader.saveConnections(loginComposite.storedConnections);
if (!loginComposite.isWorkSpaceSame()) {
try {
setStatusArea();
} catch (PersistenceException e1) {
ExceptionHandler.process(e1);
}
}
}
});
restartBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
LoginComposite.isRestart = true;
ConnectionBean connection = loginComposite.getConnection();
perReader.saveLastConnectionBean(connection);
// update the restart command line to specify the workspace to launch
// if relaunch, should delete the "disableLoginDialog" argument in eclipse data for bug TDI-19214
//$NON-NLS-1$
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand("-data", connection.getWorkSpace(), false);
// store the workspace in the eclipse history so that it is rememebered on next studio launch
//$NON-NLS-1$
ChooseWorkspaceData workspaceData = new ChooseWorkspaceData("");
workspaceData.workspaceSelected(connection.getWorkSpace());
workspaceData.writePersistedData();
dialog.okPressed();
}
});
openButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
loginComposite.setRepositoryContextInContext();
if (!TOSLoginComposite.this.projectListViewer.getSelection().isEmpty()) {
String selection = TOSLoginComposite.this.projectListViewer.getList().getSelection()[0];
if (selection != null && !selection.equals("")) {
Project project = (Project) projectsMap.get(selection.toUpperCase());
boolean flag = dialog.logIn(project);
if (flag) {
dialog.okPressed();
}
}
}
}
});
demoProjectButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ImportDemoProjectAction action = ImportDemoProjectAction.getInstance();
action.setShell(getShell());
action.run();
refresh();
}
});
}
use of org.eclipse.jface.wizard.WizardDialog in project tesb-studio-se by Talend.
the class WebServiceNode method open.
private int open(Shell shell) {
setParamValue(EParameterName.UPDATE_COMPONENTS.getName(), Boolean.TRUE);
WizardDialog wizardDialog = new WizardDialog(shell, new WebServiceDialog(this));
return (Window.OK == wizardDialog.open()) ? SWT.OK : SWT.CANCEL;
}
use of org.eclipse.jface.wizard.WizardDialog in project tdi-studio-se by Talend.
the class NewJvmConnectionAction method run.
/*
* @see Action#run()
*/
@Override
public void run() {
NewJvmConnectionWizard wizard = new NewJvmConnectionWizard(viewer);
WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
dialog.create();
dialog.open();
}
Aggregations