Search in sources :

Example 1 with ExchangeEditorInput

use of org.talend.designer.components.exchange.ui.views.ExchangeEditorInput in project tdi-studio-se by Talend.

the class ExchangeService method openExchangeEditor.

@Override
public void openExchangeEditor() {
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (activePage != null) {
        Project proj = ProjectManager.getInstance().getCurrentProject();
        if (proj.getExchangeUser() == null || checkUserAndPass(proj.getExchangeUser().getUsername(), proj.getExchangeUser().getPassword()) != null) {
            if (proj != null) {
                if (proj.getExchangeUser().getUsername() == "" && proj.getExchangeUser().getPassword() == "") {
                    String userEmail = null;
                    if (proj.getAuthor() != null) {
                        userEmail = proj.getAuthor().getLogin();
                    }
                    TalendForgeDialog tfDialog = new TalendForgeDialog(DisplayUtils.getDefaultShell(), userEmail);
                    tfDialog.open();
                }
                // MessageDialog.openError(null, "Exchange", Messages.getString("Exchange.logon.error"));
                return;
            }
        }
        try {
            ExchangeEditorInput input = new ExchangeEditorInput();
            IEditorPart findEditor = activePage.findEditor(input);
            if (findEditor == null) {
                activePage.openEditor(input, "org.talend.designer.components.exchange.ui.views.ExchangeView");
            } else {
                activePage.activate(findEditor);
            }
        } catch (PartInitException e) {
            ExceptionHandler.process(e);
        }
    }
}
Also used : Project(org.talend.core.model.general.Project) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ExchangeEditorInput(org.talend.designer.components.exchange.ui.views.ExchangeEditorInput) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) TalendForgeDialog(org.talend.registration.wizards.register.TalendForgeDialog)

Aggregations

IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 PartInitException (org.eclipse.ui.PartInitException)1 Project (org.talend.core.model.general.Project)1 ExchangeEditorInput (org.talend.designer.components.exchange.ui.views.ExchangeEditorInput)1 TalendForgeDialog (org.talend.registration.wizards.register.TalendForgeDialog)1