Search in sources :

Example 76 with WizardDialog

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);
}
Also used : FileJSONTableWizard(org.talend.repository.json.ui.wizards.FileJSONTableWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 77 with 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;
}
Also used : ContextItem(org.talend.core.model.properties.ContextItem) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ContextModeWizard(org.talend.metadata.managment.ui.wizard.context.ContextModeWizard) ConectionAdaptContextVariableModel(org.talend.core.ui.context.model.table.ConectionAdaptContextVariableModel) IContextParameter(org.talend.core.model.process.IContextParameter) ISelection(org.eclipse.jface.viewers.ISelection) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 78 with WizardDialog

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();
        }
    });
}
Also used : ImportDemoProjectAction(org.talend.repository.ui.actions.importproject.ImportDemoProjectAction) ArrayList(java.util.ArrayList) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) Shell(org.eclipse.swt.widgets.Shell) BusinessException(org.talend.commons.exception.BusinessException) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayList(java.util.ArrayList) NewProjectWizard(org.talend.repository.ui.wizards.newproject.NewProjectWizard) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) ChooseWorkspaceData(org.talend.core.ui.workspace.ChooseWorkspaceData) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) IProject(org.eclipse.core.resources.IProject) InvocationTargetException(java.lang.reflect.InvocationTargetException) SelectDeleteProjectDialog(org.talend.repository.ui.actions.importproject.SelectDeleteProjectDialog) Project(org.talend.core.model.general.Project) IProject(org.eclipse.core.resources.IProject) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) PersistenceException(org.talend.commons.exception.PersistenceException) ConnectionBean(org.talend.core.model.general.ConnectionBean) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 79 with WizardDialog

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;
}
Also used : WizardDialog(org.eclipse.jface.wizard.WizardDialog) WebServiceDialog(org.talend.designer.esb.webservice.ui.dialog.WebServiceDialog)

Example 80 with WizardDialog

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();
}
Also used : WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

WizardDialog (org.eclipse.jface.wizard.WizardDialog)115 ISelection (org.eclipse.jface.viewers.ISelection)26 Shell (org.eclipse.swt.widgets.Shell)26 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)25 IWorkbench (org.eclipse.ui.IWorkbench)14 IRepositoryNode (org.talend.repository.model.IRepositoryNode)13 RepositoryNode (org.talend.repository.model.RepositoryNode)13 IPath (org.eclipse.core.runtime.IPath)12 IStatus (org.eclipse.core.runtime.IStatus)10 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)10 IFile (org.eclipse.core.resources.IFile)9 Status (org.eclipse.core.runtime.Status)7 PartInitException (org.eclipse.ui.PartInitException)7 ArrayList (java.util.ArrayList)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 Composite (org.eclipse.swt.widgets.Composite)6 CoreException (org.eclipse.core.runtime.CoreException)5 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)5 File (java.io.File)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4