use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.
the class JavaProcessorUtilities method computeLibrariesPath.
/**
* DOC nrousseau Comment method "computeLibrariesPath".
*
* @param hashSet
* @param process
* @param alreadyRetrievedModules
* @throws BusinessException
*/
public static void computeLibrariesPath(Set<ModuleNeeded> jobModuleList, IProcess process, Set<ModuleNeeded> alreadyRetrievedModules) throws ProcessorException {
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
Project project = repositoryContext.getProject();
if (projectSetup == null || !projectSetup.equals(project.getTechnicalLabel())) {
projectSetup = project.getTechnicalLabel();
}
// use maven to update the class path.
try {
sortClasspath(jobModuleList, process, alreadyRetrievedModules);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
if (alreadyRetrievedModules.isEmpty()) {
// to update this only one time in one build of full job/subjobs
checkAndUpdateLog4jFile();
}
}
use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.
the class JavaProcessor method generateContextCode.
/*
* (non-Javadoc)
*
* @see org.talend.designer.runprocess.Processor#generateContextCode()
*/
@Override
public void generateContextCode() throws ProcessorException {
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
Project project = repositoryContext.getProject();
ICodeGenerator codeGen;
ICodeGeneratorService service = RunProcessPlugin.getDefault().getCodeGeneratorService();
//$NON-NLS-1$
String javaInterpreter = "";
//$NON-NLS-1$
String javaLib = "";
String currentJavaProject = project.getTechnicalLabel();
String javaContext = getContextPath().toPortableString();
codeGen = service.createCodeGenerator(process, false, false, javaInterpreter, javaLib, javaContext, currentJavaProject);
updateContextCode(codeGen);
}
use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.
the class LoginProjectPage method revertUpdateStatus.
private void revertUpdateStatus() {
Context ctx = CoreRuntimePlugin.getInstance().getContext();
RepositoryContext repositoryContext = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
repositoryContext.setNoUpdateWhenLogon(false);
}
use of org.talend.core.context.RepositoryContext in project tesb-studio-se by Talend.
the class ProcessUtil method getCodeLanguage.
public static ECodeLanguage getCodeLanguage() {
RepositoryContext context = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
Project project = context.getProject();
return project.getLanguage();
}
use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.
the class TestComponentsAction method initialize.
public void initialize() {
Job job = new //$NON-NLS-1$
Job(//$NON-NLS-1$
"Component Test") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
// IProgressMonitor monitorWrap = new CodeGeneratorProgressMonitor(monitor);
//$NON-NLS-1$
monitor.beginTask("Component Test Running", 1100);
IComponentsFactory componentsFactory = ComponentsFactoryProvider.getInstance();
Set<IComponent> components = componentsFactory.getComponents();
monitor.worked(100);
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
ECodeLanguage codeLanguage = repositoryContext.getProject().getLanguage();
String path = getPath();
// TODO
int taskTotal = components.size();
for (IComponent component : components) {
String templateURI = path + File.separatorChar + component.getName() + File.separatorChar + TestParameter.GENERATE_TEST;
File templateFile = new File(templateURI);
// System.out.println(templateFile + " " + templateFile.exists());
if (templateFile.exists()) {
File[] fileArray = getFile(templateFile, codeLanguage);
//$NON-NLS-1$ //$NON-NLS-2$
generateCode(fileArray, templateURI.replace("\\", "/"));
}
monitor.worked(1 * 1000 / taskTotal);
}
} catch (Exception e) {
//$NON-NLS-1$
log.error("Exception during test Initialization", e);
}
monitor.done();
return Status.OK_STATUS;
}
};
job.schedule();
}
Aggregations