use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class JobLaunchShortcutManager method resetJobProblemList.
/**
*
* ldong Comment method "resetJobProblemList".
*/
public static void resetJobProblemList(IRepositoryViewObject obj, String oldLabel) {
if (obj == null) {
return;
}
Property property = obj.getProperty();
if (property == null || !(property.getItem() instanceof ProcessItem)) {
return;
}
String newLabel = property.getLabel();
if (!newLabel.equals(oldLabel)) {
for (Iterator<Problem> iter = Problems.getProblemList().getProblemList().iterator(); iter.hasNext(); ) {
Problem problem = iter.next();
if (problem instanceof TalendProblem) {
TalendProblem routineProblem = (TalendProblem) problem;
if (routineProblem.getJavaUnitName() != null && (routineProblem.getJavaUnitName().equals(oldLabel))) {
// TDI-24683:if rename the jobItem,need clear the problem view to avoid use the old
// problem list
iter.remove();
}
}
}
}
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class StandardJobStandaloneBuildProvider method createPomCreator.
@Override
public IMavenPomCreator createPomCreator(Map<String, Object> parameters) {
if (parameters == null || parameters.isEmpty()) {
return null;
}
final Object processor = parameters.get(PROCESSOR);
if (processor == null || !(processor instanceof IProcessor)) {
return null;
}
final Object pomFile = parameters.get(FILE_POM);
if (pomFile == null || !(pomFile instanceof IFile)) {
return null;
}
final Object item = parameters.get(ITEM);
if (item == null || !(item instanceof Item)) {
return null;
}
Object argumentsMap = parameters.get(ARGUMENTS_MAP);
if (argumentsMap == null) {
argumentsMap = Collections.emptyMap();
}
if (!(argumentsMap instanceof Map)) {
return null;
}
Object overwrite = parameters.get(OVERWRITE_POM);
if (overwrite == null) {
overwrite = Boolean.FALSE;
}
final Object assemblyFile = parameters.get(FILE_ASSEMBLY);
if (assemblyFile == null || !(assemblyFile instanceof IFile)) {
return null;
}
final Object winClassPath = parameters.get(CP_WIN);
if (winClassPath == null) {
return null;
}
final Object linuxClassPath = parameters.get(CP_LINUX);
if (linuxClassPath == null) {
return null;
}
CreateMavenJobPom creator = new CreateMavenJobPom((IProcessor) processor, (IFile) pomFile);
creator.setUnixClasspath(linuxClassPath.toString());
creator.setWindowsClasspath(winClassPath.toString());
creator.setAssemblyFile((IFile) assemblyFile);
creator.setArgumentsMap((Map<String, Object>) argumentsMap);
creator.setOverwrite(Boolean.parseBoolean(overwrite.toString()));
final Property itemProperty = ((Item) item).getProperty();
IPath itemLocationPath = ItemResourceUtil.getItemLocationPath(itemProperty);
IFolder objectTypeFolder = ItemResourceUtil.getObjectTypeFolder(itemProperty);
if (itemLocationPath != null && objectTypeFolder != null) {
IPath itemRelativePath = itemLocationPath.removeLastSegments(1).makeRelativeTo(objectTypeFolder.getLocation());
creator.setObjectTypeFolder(objectTypeFolder);
creator.setItemRelativePath(itemRelativePath);
}
return creator;
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method createPage2.
// create jobscript editor
protected void createPage2() {
if (!GlobalServiceRegister.getDefault().isServiceRegistered(ICreateXtextProcessService.class)) {
return;
}
String scriptValue = "";
try {
IProject currentProject = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
String jobScriptVersion = "";
if (getEditorInput() != null && getEditorInput() instanceof RepositoryEditorInput) {
Item item = ((RepositoryEditorInput) getEditorInput()).getItem();
if (item != null) {
Property property = item.getProperty();
if (property != null) {
jobScriptVersion = "_" + property.getVersion();
}
}
}
IFile file = currentProject.getFolder("temp").getFile(getEditorInput().getName() + jobScriptVersion + "_job" + ".jobscript");
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(scriptValue.getBytes());
if (file.exists()) {
file.delete(true, null);
file.create(byteArrayInputStream, true, null);
file.setContents(byteArrayInputStream, 0, null);
} else {
file.create(byteArrayInputStream, true, null);
}
String pointId = "org.talend.metalanguage.jobscript.JobScriptForMultipage";
// the way to get the xtextEditor programmly
IEditorInput editorInput = new FileEditorInput(file);
IExtensionPoint ep = RegistryFactory.getRegistry().getExtensionPoint("org.eclipse.ui.editors");
IExtension[] extensions = ep.getExtensions();
IExtension ex;
IConfigurationElement confElem = null;
for (IExtension extension : extensions) {
ex = extension;
if (ex.getContributor().getName().equals("org.talend.metalanguage.jobscript.ui")) {
for (IConfigurationElement c : ex.getConfigurationElements()) {
if (c.getName().equals("editor") && c.getAttribute("id").equals(pointId)) {
confElem = c;
break;
}
}
}
}
if (confElem != null) {
jobletEditor = (AbstractDecoratedTextEditor) confElem.createExecutableExtension("class");
if (jobletEditor != null) {
int index = addPage(jobletEditor, editorInput);
setPageText(index, "Jobscript");
}
}
} catch (PartInitException e) {
ExceptionHandler.process(e);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class MultiPageTalendEditor method setName.
/**
* DOC smallet Comment method "setName".
*
* @param label
*/
@Override
public void setName() {
if (getEditorInput() == null) {
return;
}
super.setName();
IProcess2 process2 = this.getProcess();
if (process2 == null) {
return;
}
Property property = process2.getProperty();
if (property == null) {
return;
}
String label = property.getDisplayName();
//$NON-NLS-1$
String jobVersion = "0.1";
if (process2 != null) {
jobVersion = process2.getVersion();
}
// if (getActivePage() == 1) {
ISVNProviderService service = null;
if (PluginChecker.isSVNProviderPluginLoaded()) {
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
if (revisionChanged && service.isProjectInSvnMode()) {
revisionNumStr = service.getCurrentSVNRevision(process2);
revisionChanged = false;
if (revisionNumStr != null) {
//$NON-NLS-1$
revisionNumStr = ".r" + revisionNumStr;
}
}
}
//$NON-NLS-1$
String title = "MultiPageTalendEditor.Job";
if (process2 != null) {
Item item = process2.getProperty().getItem();
if (item instanceof JobletProcessItem) {
//$NON-NLS-1$
title = "MultiPageTalendEditor.Joblet";
}
}
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
if (allowVerchange) {
if (revisionNumStr != null) {
setPartName(Messages.getString(title, label, jobVersion) + revisionNumStr);
} else {
setPartName(Messages.getString(title, label, jobVersion));
}
} else {
if (revisionNumStr != null) {
//$NON-NLS-1$
setPartName(Messages.getString(title, label, "") + revisionNumStr);
} else {
//$NON-NLS-1$
setPartName(Messages.getString(title, label, ""));
}
}
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method updateTitleImage.
protected void updateTitleImage() {
if (getProcess() == null) {
return;
}
Property property = getProcess().getProperty();
updateTitleImage(property);
}
Aggregations