Search in sources :

Example 46 with IRunProcessService

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

the class JobJavaScriptsManager method addLog4jSetting.

protected void addLog4jSetting(ExportFileResource resource) {
    try {
        if (Log4jPrefsSettingManager.getInstance().isLog4jEnable() && GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
            IRunProcessService processService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
            ITalendProcessJavaProject talendProcessJavaProject = processService.getTalendProcessJavaProject();
            if (talendProcessJavaProject != null) {
                IFolder resourcesFolder = talendProcessJavaProject.getResourcesFolder();
                IFile log4jFile = resourcesFolder.getFile(Log4jPrefsConstants.LOG4J_FILE_NAME);
                if (log4jFile.exists()) {
                    List<URL> log4jFileUrls = new ArrayList<URL>();
                    log4jFileUrls.add(FileLocator.toFileURL(log4jFile.getLocationURI().toURL()));
                    resource.addResources(PATH_SEPARATOR, log4jFileUrls);
                }
            }
        }
    } catch (Exception e) {
        ExceptionHandler.process(e);
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) ArrayList(java.util.ArrayList) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) URL(java.net.URL) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) DocumentException(org.dom4j.DocumentException) ProcessorException(org.talend.designer.runprocess.ProcessorException) MalformedURLException(java.net.MalformedURLException) PersistenceException(org.talend.commons.exception.PersistenceException) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

IRunProcessService (org.talend.designer.runprocess.IRunProcessService)46 ITalendProcessJavaProject (org.talend.core.runtime.process.ITalendProcessJavaProject)27 IFolder (org.eclipse.core.resources.IFolder)17 IFile (org.eclipse.core.resources.IFile)14 IOException (java.io.IOException)11 ArrayList (java.util.ArrayList)11 CoreException (org.eclipse.core.runtime.CoreException)11 File (java.io.File)10 URL (java.net.URL)9 MalformedURLException (java.net.MalformedURLException)7 IPath (org.eclipse.core.runtime.IPath)7 PersistenceException (org.talend.commons.exception.PersistenceException)7 ProcessorException (org.talend.designer.runprocess.ProcessorException)6 DocumentException (org.dom4j.DocumentException)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 IResource (org.eclipse.core.resources.IResource)3 Path (org.eclipse.core.runtime.Path)3 IEditorPart (org.eclipse.ui.IEditorPart)3