Search in sources :

Example 36 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.

the class ActiveProcessTracker method setContextsView.

/**
     * qzhang Comment method "setProblemsView".
     * 
     * @param process
     */
private void setContextsView(IProcess2 process, IWorkbenchPart part) {
    IRunProcessService service = DesignerPlugin.getDefault().getRunProcessService();
    service.setActiveProcess(process, true);
    // Contexts.setTitle("Job " + process.getProperty().getLabel()); //$NON-NLS-1$
    Contexts.switchToCurContextsView(part);
}
Also used : IRunProcessService(org.talend.designer.runprocess.IRunProcessService)

Example 37 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.

the class ActiveProcessTracker method addJobInProblemView.

/**
     * ftang Comment method "setStatsAndLogsView".
     * 
     * @param process
     */
// private void setStatsAndLogsView(IProcess process) {
// StatsAndLogs.setTitle("Job " + process.getProperty().getLabel()); //$NON-NLS-1$
// StatsAndLogs.switchToCurStatsAndLogsView();
// }
/**
     * qzhang Comment method "setProblemsView".
     * 
     * @param process
     */
private void addJobInProblemView(IProcess2 process) {
    Problems.addProcess(process);
    IRunProcessService service = DesignerPlugin.getDefault().getRunProcessService();
    service.setActiveProcess(process);
}
Also used : IRunProcessService(org.talend.designer.runprocess.IRunProcessService)

Example 38 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.

the class JavaCompilationParticipant method updateProblems.

/**
     * yzhang Comment method "updateProblems".
     */
private void updateProblems(List<IRepositoryViewObject> routineObjectList, String filePath) {
    IRunProcessService runProcessService = CorePlugin.getDefault().getRunProcessService();
    try {
        ITalendProcessJavaProject talendProcessJavaProject = runProcessService.getTalendProcessJavaProject();
        if (talendProcessJavaProject == null) {
            return;
        }
        final ITalendSynchronizer synchronizer = CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
        IProject javaProject = talendProcessJavaProject.getProject();
        IFile file = javaProject.getFile(filePath);
        String fileName = file.getName();
        for (IRepositoryViewObject repositoryObject : routineObjectList) {
            Property property = repositoryObject.getProperty();
            Item item = property.getItem();
            IFile currentFile = synchronizer.getFile(item);
            if (currentFile != null && fileName.equals(currentFile.getName()) && currentFile.exists()) {
                Problems.addRoutineFile(currentFile, property);
                break;
            }
        }
    } catch (SystemException e) {
        ExceptionHandler.process(e);
    }
}
Also used : ITalendSynchronizer(org.talend.designer.codegen.ITalendSynchronizer) Item(org.talend.core.model.properties.Item) IFile(org.eclipse.core.resources.IFile) SystemException(org.talend.commons.exception.SystemException) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Property(org.talend.core.model.properties.Property) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) IProject(org.eclipse.core.resources.IProject)

Example 39 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.

the class EditPropertiesAction method doRun.

@Override
protected void doRun() {
    ISelection selection = getSelection();
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    IRepositoryNode node = (IRepositoryNode) obj;
    // try {
    // ProxyRepositoryFactory.getInstance().initialize();
    // } catch (PersistenceException e1) {
    // ExceptionHandler.process(e1);
    // }
    IRepositoryViewObject object = node.getObject();
    IPath path = RepositoryNodeUtilities.getPath(node);
    String originalName = object.getLabel();
    final PropertiesWizard wizard;
    if (ERepositoryObjectType.ROUTINES == object.getRepositoryObjectType() || isInstanceofCamelBeans(object.getRepositoryObjectType())) {
        wizard = new EditRoutinePropertiesWizard(object, path, true);
    } else if (ERepositoryObjectType.PROCESS == object.getRepositoryObjectType()) {
        wizard = new EditProcessPropertiesWizard(object, path, true);
    } else {
        wizard = getPropertiesWizard(object, path);
    }
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    if (dlg.open() == Window.OK) {
        refresh(node);
        // refresh the corresponding editor's name
        IEditorPart part = getCorrespondingEditor(node);
        if (part != null && part instanceof IUIRefresher) {
            ((IUIRefresher) part).refreshName();
        } else {
            processRoutineRenameOperation(originalName, node, path);
        }
        // rename the job launch, for bug 8878
        IDesignerCoreService designerCoreService = RepositoryPlugin.getDefault().getDesignerCoreService();
        if (designerCoreService != null) {
            designerCoreService.renameJobLaunch(node.getObject(), originalName);
            // TDI-24863:reset the job problem list if rename the job item
            designerCoreService.resetJobProblemList(node.getObject(), originalName);
        }
        // refresh ...
        IViewPart jobSettingView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IJobSettingsView.ID);
        if (jobSettingView != null && jobSettingView instanceof IJobSettingsView) {
            ((IJobSettingsView) jobSettingView).refreshCurrentViewTab();
        }
        if (node.getObjectType() == ERepositoryObjectType.ROUTINES) {
            RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
                IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
                ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
                if (talendProcessJavaProject != null) {
                    talendProcessJavaProject.updateRoutinesPom(true, true);
                }
            }
        }
        if (node.getObjectType().getType().equals("SERVICES")) {
            //$NON-NLS-1$
            ConnectionItem connectionItem = (ConnectionItem) node.getObject().getProperty().getItem();
            RepositoryUpdateManager.updateServices(connectionItem);
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
                if (service != null) {
                    service.refreshComponentView(connectionItem);
                }
            }
        }
    }
}
Also used : IJobSettingsView(org.talend.repository.ui.views.IJobSettingsView) IViewPart(org.eclipse.ui.IViewPart) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IPath(org.eclipse.core.runtime.IPath) EditRoutinePropertiesWizard(org.talend.repository.ui.wizards.routines.EditRoutinePropertiesWizard) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) EditProcessPropertiesWizard(org.talend.metadata.managment.ui.wizard.process.EditProcessPropertiesWizard) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) EditProcessPropertiesWizard(org.talend.metadata.managment.ui.wizard.process.EditProcessPropertiesWizard) EditRoutinePropertiesWizard(org.talend.repository.ui.wizards.routines.EditRoutinePropertiesWizard) PropertiesWizard(org.talend.metadata.managment.ui.wizard.PropertiesWizard) IESBService(org.talend.core.IESBService) ISelection(org.eclipse.jface.viewers.ISelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IUIRefresher(org.talend.core.services.IUIRefresher)

Example 40 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.

the class JobJavaScriptOSGIForESBManager method getNeededModuleURLs.

protected List<URL> getNeededModuleURLs(Set<String> neededModules) {
    List<URL> list = new ArrayList<URL>();
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
        IRunProcessService processService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
        ITalendProcessJavaProject talendProcessJavaProject = processService.getTalendProcessJavaProject();
        if (talendProcessJavaProject != null) {
            IFolder libFolder = talendProcessJavaProject.getLibFolder();
            File file = libFolder.getLocation().toFile();
            File[] files = file.listFiles(FilesUtils.getAcceptModuleFilesFilter());
            for (File tempFile : files) {
                try {
                    if (neededModules.contains(tempFile.getName())) {
                        list.add(tempFile.toURI().toURL());
                    }
                } catch (MalformedURLException e) {
                    ExceptionHandler.process(e);
                }
            }
        }
    }
    return list;
}
Also used : MalformedURLException(java.net.MalformedURLException) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) ArrayList(java.util.ArrayList) File(java.io.File) URL(java.net.URL) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

IRunProcessService (org.talend.designer.runprocess.IRunProcessService)51 ITalendProcessJavaProject (org.talend.core.runtime.process.ITalendProcessJavaProject)30 IFolder (org.eclipse.core.resources.IFolder)17 IFile (org.eclipse.core.resources.IFile)15 File (java.io.File)14 IOException (java.io.IOException)13 ArrayList (java.util.ArrayList)12 CoreException (org.eclipse.core.runtime.CoreException)11 URL (java.net.URL)9 PersistenceException (org.talend.commons.exception.PersistenceException)9 MalformedURLException (java.net.MalformedURLException)7 IPath (org.eclipse.core.runtime.IPath)7 IProcess (org.talend.core.model.process.IProcess)7 ProcessorException (org.talend.designer.runprocess.ProcessorException)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 DocumentException (org.dom4j.DocumentException)5 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 HashSet (java.util.HashSet)4 ProcessItem (org.talend.core.model.properties.ProcessItem)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3