use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.
the class RunProcessPreferenceInitializer method getLogTemplate.
protected String getLogTemplate(String logPath) {
IRunProcessService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
}
if (service == null) {
return EMPTY_STR;
}
File templateFile = new File(service.getResourceFilePath(logPath));
if (!templateFile.exists()) {
return EMPTY_STR;
}
return getLogTemplateString(templateFile);
}
use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.
the class RunProcessPreferencePage method performOk.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
*/
@Override
public boolean performOk() {
boolean ok = super.performOk();
// consoleFontField.store();
// update high water mark to be (about) 100 lines (100 * 80 chars) greater than low water mark
// IPreferenceStore store = RunRemoteProcessPlugin.getDefault().getPreferenceStore();
// int low = store.getInt(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK);
// int high = low + 8000;
// store.setValue(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK, high);
RunProcessPlugin.getDefault().savePluginPreferences();
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
service.refreshView();
manager.setClearBeforeExec(onClearbeforeField.getBooleanValue());
manager.setExecTime(onExecTimeField.getBooleanValue());
manager.setStat(onStatisticsField.getBooleanValue());
manager.setSaveJobBeforeRun(onSavebeforeField.getBooleanValue());
return ok;
}
use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method getExternalLibraries.
/**
* Gets required java jars.
*
* @param process
*
* @param boolean1
* @return
*/
protected List<URL> getExternalLibraries(boolean needLibraries, ExportFileResource[] process, final Set<String> neededLibraries) {
List<URL> list = new ArrayList<URL>();
if (!needLibraries) {
return list;
}
IFolder libFolder = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService processService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
ITalendProcessJavaProject talendProcessJavaProject = processService.getTalendProcessJavaProject();
if (talendProcessJavaProject != null) {
libFolder = talendProcessJavaProject.getLibFolder();
}
}
if (libFolder == null) {
return list;
}
File file = libFolder.getLocation().toFile();
File[] files = file.listFiles(FilesUtils.getAcceptModuleFilesFilter());
// Lists all the needed jar files
Set<String> listModulesReallyNeeded = new HashSet<String>();
if (neededLibraries == null) {
// in case export as been done with option "not recompile", then libraires can't be retrieved when build.
IDesignerCoreService designerService = RepositoryPlugin.getDefault().getDesignerCoreService();
for (ExportFileResource resource : process) {
ProcessItem item = (ProcessItem) resource.getItem();
String version = item.getProperty().getVersion();
if (!isMultiNodes() && this.getSelectedJobVersion() != null) {
version = this.getSelectedJobVersion();
}
ProcessItem selectedProcessItem;
if (resource.getNode() != null) {
selectedProcessItem = ItemCacheManager.getProcessItem(resource.getNode().getRoot().getProject(), item.getProperty().getId(), version);
} else {
// if no node given, take in the current project only
selectedProcessItem = ItemCacheManager.getProcessItem(item.getProperty().getId(), version);
}
IProcess iProcess = designerService.getProcessFromProcessItem(selectedProcessItem);
Set<String> processNeededLibraries = iProcess.getNeededLibraries(true);
if (processNeededLibraries != null) {
listModulesReallyNeeded.addAll(processNeededLibraries);
}
}
} else {
listModulesReallyNeeded.addAll(neededLibraries);
}
// jar from routines
List<IRepositoryViewObject> collectRoutines = new ArrayList<IRepositoryViewObject>();
boolean useBeans = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
ICamelDesignerCoreService camelService = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault().getService(ICamelDesignerCoreService.class);
if (camelService.isInstanceofCamel(process[0].getItem())) {
useBeans = true;
}
}
String include = null;
if (useBeans) {
include = USER_BEANS_PATH;
} else {
include = USER_ROUTINES_PATH;
}
collectRoutines.addAll(collectRoutines(process, include));
collectRoutines.addAll(collectRoutines(process, USER_PIGUDF_PATH));
for (IRepositoryViewObject object : collectRoutines) {
Item item = object.getProperty().getItem();
if (item instanceof RoutineItem) {
RoutineItem routine = (RoutineItem) item;
EList imports = routine.getImports();
for (Object o : imports) {
IMPORTType type = (IMPORTType) o;
listModulesReallyNeeded.add(type.getMODULE());
}
}
}
if (Log4jPrefsSettingManager.getInstance().isLog4jEnable()) {
addLog4jToJarList(listModulesReallyNeeded);
}
for (File tempFile : files) {
try {
if (listModulesReallyNeeded.contains(tempFile.getName())) {
list.add(tempFile.toURL());
}
} catch (MalformedURLException e) {
ExceptionHandler.process(e);
}
}
return list;
// List<URL> libraries = new ArrayList<URL>();
// if (needLibraries) {
// try {
// ILibrariesService service = CorePlugin.getDefault().getLibrariesService();
// libraries = service.getTalendRoutines();
// } catch (Exception e) {
// ExceptionHandler.process(e);
// }
// }
// return libraries;
}
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);
}
}
use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.
the class RepositoryService method openLoginDialog.
/*
* (non-Javadoc)
*
* @see org.talend.repository.model.IRepositoryService#openLoginDialog()
*/
@Override
public void openLoginDialog() {
if (isloginDialogDisabled()) {
return;
}
if (CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY) != null) {
return;
}
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
boolean logged = false;
LoginDialogV2 loginDialog = new LoginDialogV2(shell);
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true);
logged = loginDialog.open() == LoginDialogV2.OK;
if (logged) {
// addCommand();
new DisableLanguageActions().earlyStartup();
new BindingActions().bind();
IMigrationToolService toolService = CorePlugin.getDefault().getMigrationToolService();
toolService.executeMigration(SwitchProjectAction.PLUGIN_MODEL);
IRunProcessService runService = CorePlugin.getDefault().getRunProcessService();
runService.deleteAllJobs(SwitchProjectAction.PLUGIN_MODEL);
CorePlugin.getDefault().getCodeGeneratorService().initializeTemplates();
CorePlugin.getDefault().getDesignerCoreService().synchronizeDesignerUI(new PropertyChangeEvent(this, IComponentConstants.NORMAL, null, null));
}
}
Aggregations