use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.
the class TalendJavaSourceViewer method isRouteProcess.
/**
* if the current process is a route process or not
*
* @return
*/
private static boolean isRouteProcess() {
try {
IRunProcessService runProcessService = getRunProcessService();
if (runProcessService == null) {
return false;
}
IProcess activeProcess = runProcessService.getActiveProcess();
boolean isRouteProcess = (activeProcess != null && "org.talend.camel.designer.ui.editor.RouteProcess".equals(activeProcess.getClass().getName()));
return isRouteProcess;
} catch (Throwable e) {
return false;
}
}
use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.
the class TalendJavaSourceViewer method updateContents.
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.viewer.ReconcilerViewer#setContents(org.eclipse.jface.text.IDocument)
*/
@Override
public void updateContents() {
if (getDocument() == null) {
return;
}
InputStream codeStream = new ByteArrayInputStream(getDocument().get().getBytes());
try {
IRunProcessService runProcessService = getRunProcessService();
if (file == null && runProcessService != null) {
ITalendProcessJavaProject talendProcessJavaProject = runProcessService.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return;
}
file = talendProcessJavaProject.getSrcFolder().getFile(JavaUtils.JAVA_INTERNAL_DIRECTORY + '/' + filename);
file.setContents(codeStream, true, false, null);
initializeModel();
} else {
// only happen sometimes with a "fast click" (file don't exist yet).
if (getViewerRegion().getLength() == 0) {
return;
} else {
file.setContents(codeStream, true, false, null);
}
}
} catch (CoreException e) {
// don't display any error.
}
}
use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.
the class JavaSQLPatternSynchronizer method getSQLPatternFile.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.codegen.ISQLPatternSynchronizer#getSQLPattern(org.talend.core.model.properties.SQLPatternItem
* )
*/
@Override
public IFile getSQLPatternFile(SQLPatternItem item) throws SystemException {
IRunProcessService service = CodeGeneratorActivator.getDefault().getRunProcessService();
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return null;
}
String basePath = JavaUtils.JAVA_SQLPATTERNS_DIRECTORY + '/' + item.getEltName();
// init user defined folder
talendProcessJavaProject.getResourceSubFolder(null, basePath + '/' + JavaUtils.JAVA_USER_DEFINED);
IFolder systemFolder = talendProcessJavaProject.getResourceSubFolder(null, basePath + '/' + JavaUtils.JAVA_SYSTEM_DIRECTORY);
IFile file = systemFolder.getFile(item.getProperty().getLabel() + JavaUtils.JAVA_SQLPATTERN_EXTENSION);
return file;
}
use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.
the class JavaRoutineSynchronizer method getTestContainerFile.
private IFile getTestContainerFile(ProcessItem item, String projectFolderName, String folderName, String jobName) {
IRunProcessService service = CodeGeneratorActivator.getDefault().getRunProcessService();
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return null;
}
IFolder srcFolder = talendProcessJavaProject.getTestSrcFolder();
String packageName = JavaResourcesHelper.getJobClassPackageFolder(item, true);
IFile file = srcFolder.getFile(packageName + '/' + jobName + "Test" + JavaUtils.JAVA_EXTENSION);
return file;
}
use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.
the class JavaRoutineSynchronizer method syncModule.
/*
* (non-Javadoc)
*
* @see org.talend.designer.codegen.IRoutineSynchronizer#syncRoutine(org.talend .core.model.properties.RoutineItem)
*/
private static void syncModule(File[] modules) throws SystemException {
IRunProcessService service = CodeGeneratorActivator.getDefault().getRunProcessService();
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return;
}
final IFolder systemFolder = talendProcessJavaProject.getSrcSubFolder(null, JavaUtils.JAVA_ROUTINES_DIRECTORY + '/' + JavaUtils.JAVA_SYSTEM_DIRECTORY);
syncModules(modules, systemFolder);
}
Aggregations