use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class JobScriptsManager method getCorrespondingProjectRootPath.
/**
* ggu Comment method "getCorrespondingProjectRootPath".
*
* if item is null, will return currrent probject path.
*/
protected IPath getCorrespondingProjectRootPath(Item item) throws Exception {
// for bug 17685
org.talend.core.model.properties.Project p = ProjectManager.getInstance().getProject(item);
IProject project = null;
if (p != null) {
project = ResourcesPlugin.getWorkspace().getRoot().getProject(p.getTechnicalLabel().toUpperCase());
if (project != null) {
return project.getLocation();
}
}
// maybe, not used
ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
//$NON-NLS-1$
return new Path("");
}
project = talendProcessJavaProject.getProject();
IPath root = project.getParent().getLocation().append(getCorrespondingProjectName(item).toUpperCase());
return root;
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method getClassRootFileLocation.
protected File getClassRootFileLocation() {
ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return null;
}
IFolder outputFolder = talendProcessJavaProject.getOutputFolder();
return outputFolder.getLocation().toFile();
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method addContextScripts.
/**
* DOC acer Comment method "addContextScripts".
*
* @param resource
* @param boolean1
*/
protected void addContextScripts(ProcessItem processItem, String jobName, String jobVersion, ExportFileResource resource, Boolean needContext) {
if (!needContext) {
return;
}
List<URL> list = new ArrayList<URL>(1);
String projectName = getCorrespondingProjectName(processItem);
String folderName = JavaResourcesHelper.getJobFolderName(jobName, jobVersion);
try {
String jobPackagePath = projectName + PATH_SEPARATOR + folderName + PATH_SEPARATOR + JavaUtils.JAVA_CONTEXTS_DIRECTORY;
ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return;
}
IFolder outputFolder = talendProcessJavaProject.getOutputFolder();
IFolder contextsFolder = outputFolder.getFolder(jobPackagePath);
File contextDir = contextsFolder.getLocation().toFile();
if (contextDir.isDirectory()) {
list.addAll(getActiveContextFiles(contextDir.listFiles(), processItem));
}
// list.add(classRoot.toFile().toURL());
resource.addResources(jobPackagePath, list);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject 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);
}
}
Aggregations