Search in sources :

Example 1 with NewProcessWizard

use of org.talend.designer.core.ui.wizards.NewProcessWizard in project tesb-studio-se by Talend.

the class CreateNewJobAction method getNewProcessWizard.

private NewProcessWizard getNewProcessWizard(RepositoryNode node) {
    NewProcessWizard processWizard = null;
    if (isToolbar()) {
        processWizard = new NewProcessWizard(null);
    } else {
        ItemCacheManager.clearCache();
        String operationName = ((OperationRepositoryObject) node.getObject()).getName();
        String portName = "defaultPort";
        String servicesName = "Services";
        if (node.getParent() != null) {
            portName = node.getParent().getObject().getLabel();
            if (node.getParent().getParent() != null) {
                servicesName = node.getParent().getParent().getObject().getLabel();
            }
        }
        IPath path = new Path(servicesName).append(portName).append(operationName);
        if (RepositoryConstants.isSystemFolder(path.toString())) {
            // Not allowed to create in system folder.
            return null;
        }
        processWizard = new NewProcessWizard(path, initLabel(node));
    }
    return processWizard;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) NewProcessWizard(org.talend.designer.core.ui.wizards.NewProcessWizard) OperationRepositoryObject(org.talend.repository.services.utils.OperationRepositoryObject)

Example 2 with NewProcessWizard

use of org.talend.designer.core.ui.wizards.NewProcessWizard in project tesb-studio-se by Talend.

the class CreateNewJobAction method doRun.

@Override
protected void doRun() {
    RepositoryNode node = getSelectedRepositoryNode();
    if (node == null) {
        return;
    }
    NewProcessWizard processWizard = getNewProcessWizard(node);
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), processWizard);
    if (dlg.open() == Window.OK) {
        createNewProcess(node, processWizard.getProcess());
    }
}
Also used : NewProcessWizard(org.talend.designer.core.ui.wizards.NewProcessWizard) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 3 with NewProcessWizard

use of org.talend.designer.core.ui.wizards.NewProcessWizard in project tdi-studio-se by Talend.

the class CreateProcess method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    final NewProcessWizard processWizard;
    if (isToolbar()) {
        processWizard = new NewProcessWizard(null);
    } else {
        ISelection selection = getSelection();
        if (selection == null) {
            return;
        }
        Object obj = ((IStructuredSelection) selection).getFirstElement();
        IRepositoryService service = DesignerPlugin.getDefault().getRepositoryService();
        IPath path = service.getRepositoryPath((IRepositoryNode) obj);
        if (RepositoryConstants.isSystemFolder(path.toString())) {
            // Not allowed to create in system folder.
            return;
        }
        processWizard = new NewProcessWizard(path);
    }
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), processWizard);
    if (dlg.open() == Window.OK) {
        if (processWizard.getProcess() == null) {
            return;
        }
        ProcessEditorInput fileEditorInput;
        try {
            // Set readonly to false since created job will always be editable.
            fileEditorInput = new ProcessEditorInput(processWizard.getProcess(), false, true, false);
            IRepositoryNode repositoryNode = RepositorySeekerManager.getInstance().searchRepoViewNode(fileEditorInput.getItem().getProperty().getId(), false);
            fileEditorInput.setRepositoryNode(repositoryNode);
            IWorkbenchPage page = getActivePage();
            page.openEditor(fileEditorInput, MultiPageTalendEditor.ID, true);
        // // use project setting true
        // ProjectSettingManager.defaultUseProjectSetting(fileEditorInput.getLoadedProcess());
        } catch (PartInitException e) {
            // TODO Auto-generated catch block
            ExceptionHandler.process(e);
        } catch (PersistenceException e) {
            MessageBoxExceptionHandler.process(e);
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) IRepositoryNode(org.talend.repository.model.IRepositoryNode) NewProcessWizard(org.talend.designer.core.ui.wizards.NewProcessWizard) ISelection(org.eclipse.jface.viewers.ISelection) PersistenceException(org.talend.commons.exception.PersistenceException) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) PartInitException(org.eclipse.ui.PartInitException) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IRepositoryService(org.talend.repository.model.IRepositoryService) ProcessEditorInput(org.talend.designer.core.ui.editor.ProcessEditorInput)

Aggregations

NewProcessWizard (org.talend.designer.core.ui.wizards.NewProcessWizard)3 IPath (org.eclipse.core.runtime.IPath)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 Path (org.eclipse.core.runtime.Path)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 PartInitException (org.eclipse.ui.PartInitException)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 ProcessEditorInput (org.talend.designer.core.ui.editor.ProcessEditorInput)1 IRepositoryService (org.talend.repository.model.IRepositoryService)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1 OperationRepositoryObject (org.talend.repository.services.utils.OperationRepositoryObject)1