use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method dispose.
/**
* The <code>MultiPageEditorPart</code> implementation of this <code>IWorkbenchPart</code> method disposes all
* nested editors. Subclasses may extend.
*/
@Override
public void dispose() {
getSite().setSelectionProvider(null);
getSite().getWorkbenchWindow().getSelectionService().removeSelectionListener(this);
/* after the release of eclipse3.6,this parameter can't be null */
// setInput(null);
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
getSite().getWorkbenchWindow().getPartService().removePartListener(partListener);
if (this.lockService != null) {
this.lockService.unregister();
}
super.dispose();
if (getProcess() != null && !getProcess().isReadOnly()) {
if (isKeepPropertyLocked()) {
return;
}
// Unlock the process :
IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
IProxyRepositoryFactory repFactory = service.getProxyRepositoryFactory();
try {
getProcess().getProperty().eAdapters().remove(dirtyListener);
Property property = getProcess().getProperty();
if (property.eResource() == null || property.getItem().eResource() == null) {
property = repFactory.getUptodateProperty(property);
}
// fix for bug 12524 for db repository
// property = repFactory.reload(property);
JobletUtil jUtil = new JobletUtil();
jUtil.makeSureUnlockJoblet(getProcess());
Item item = getProcess().getProperty().getItem();
boolean keep = jUtil.keepLockJoblet(item);
if (keep) {
repFactory.unlock(property.getItem());
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (LoginException e) {
ExceptionHandler.process(e);
}
}
if (processEditorInput != null) {
processEditorInput.dispose();
processEditorInput = null;
}
designerEditor = null;
codeEditor = null;
if (processor instanceof IJavaBreakpointListener) {
JDIDebugModel.removeJavaBreakpointListener((IJavaBreakpointListener) processor);
}
processor = null;
dirtyListener = null;
NodeTransferDragSourceListener.getInstance().setEditPart(null);
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class AbstractJobSettingsPage method saveProcess.
protected void saveProcess(IRepositoryViewObject object, boolean addContextModel, Map<String, Set<String>> contextVars, IProgressMonitor monitor) {
Property property = object.getProperty();
ProcessItem pItem = (ProcessItem) property.getItem();
if (isOpenProcess(object)) {
Process process = getProcess(openedProcessList, object);
LoadProjectSettingsCommand command = new LoadProjectSettingsCommand(process, getParameterName().getName(), Boolean.TRUE);
exeCommand(process, command);
//
IElementParameter ptParam = elem.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
if (ptParam != null) {
IElementParameter propertyElem = ptParam.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName());
Object proValue = propertyElem.getValue();
if (proValue instanceof String && ((String) proValue).equalsIgnoreCase(EmfComponent.REPOSITORY)) {
IElementParameter repositoryElem = ptParam.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
String value = (String) repositoryElem.getValue();
ConnectionItem connectionItem = UpdateRepositoryUtils.getConnectionItemByItemId(value);
if (connectionItem != null) {
Connection connection = connectionItem.getConnection();
ChangeValuesFromRepository cmd = new ChangeValuesFromRepository(process, connection, addContextModel ? getRepositoryPropertyName() : getPropertyTypeName(), value);
cmd.ignoreContextMode(true);
exeCommand(process, cmd);
}
}
}
monitor.worked(100);
} else {
try {
reloadFromProjectSetings(pItem, addContextModel, contextVars);
factory.save(pItem);
monitor.worked(100);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class AbstractJavaProcessor method run.
@Override
public Process run(String[] optionsParam, int statisticsPort, int tracePort, IProgressMonitor monitor, IProcessMessageManager processMessageManager) throws ProcessorException {
if (isStandardJob()) {
Property property = this.getProperty();
if (property != null) {
// use the same function with ExportModelJavaProcessor, but will do for maven
ProcessItem processItem = (ProcessItem) property.getItem();
if (isRunAsExport()) {
// Step 1: Export job
archive = buildExportZip(processItem, monitor);
// Step 2: Deploy in local(Maybe just unpack)
unzipFolder = unzipAndDeploy(process, archive);
// Step 3: Run job from given folder.
return execFrom(unzipFolder + File.separatorChar + process.getName(), Level.INFO, statisticsPort, tracePort, optionsParam);
} else {
// If we are not in an export mode, we still have to check whether jobs need to be re-archived or
// not.
String version = processItem.getProperty().getVersion();
if (//$NON-NLS-1$
!RelationshipItemBuilder.LATEST_VERSION.equals(version) && version != null && !"".equals(version) && !version.equals(processItem.getProperty().getVersion())) {
processItem = ItemCacheManager.getProcessItem(processItem.getProperty().getId(), version);
}
Set<ProcessItem> processItems = new HashSet<>();
processItems.add(processItem);
// We get the father job childs.
Set<JobInfo> infos = ProcessorUtilities.getChildrenJobInfo(processItem);
Iterator<JobInfo> infoIterator = infos.iterator();
while (infoIterator.hasNext()) {
processItems.add(infoIterator.next().getProcessItem());
}
// We iterate over the job and its childs in order to re-archive them if needed.
for (ProcessItem pi : processItems) {
BDJobReArchieveCreator bdRecreator = new BDJobReArchieveCreator(pi, processItem);
bdRecreator.create(new File(this.getTalendJavaProject().getTargetFolder().getLocation().toPortableString()), false);
}
}
}
}
return super.run(optionsParam, statisticsPort, tracePort, monitor, processMessageManager);
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class JavaCompilationParticipant method updateProblems.
/**
* yzhang Comment method "updateProblems".
*/
private void updateProblems(List<IRepositoryViewObject> routineObjectList, String filePath) {
IRunProcessService runProcessService = CorePlugin.getDefault().getRunProcessService();
try {
ITalendProcessJavaProject talendProcessJavaProject = runProcessService.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return;
}
final ITalendSynchronizer synchronizer = CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
IProject javaProject = talendProcessJavaProject.getProject();
IFile file = javaProject.getFile(filePath);
String fileName = file.getName();
for (IRepositoryViewObject repositoryObject : routineObjectList) {
Property property = repositoryObject.getProperty();
Item item = property.getItem();
IFile currentFile = synchronizer.getFile(item);
if (currentFile != null && fileName.equals(currentFile.getName()) && currentFile.exists()) {
Problems.addRoutineFile(currentFile, property);
break;
}
}
} catch (SystemException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class JobTemplateViewsAndProcessUtil method getNewMockProperty.
private Property getNewMockProperty() {
Property property = PropertiesFactory.eINSTANCE.createProperty();
property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
property.setVersion(VersionUtils.DEFAULT_VERSION);
//$NON-NLS-1$
property.setStatusCode("");
//$NON-NLS-1$
property.setId("ID");
property.setLabel(DEFAULT_JOB_NAME);
return property;
}
Aggregations