use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class RemoveRoutineJarDependencyTask method execute.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
*/
@Override
public ExecutionResult execute(Item item) {
if (getProject().getLanguage() == ECodeLanguage.JAVA) {
RoutineItem routineItem = (RoutineItem) item;
if (routineItem.isBuiltIn()) {
return ExecutionResult.NOTHING_TO_DO;
}
try {
EList<IMPORTType> imports = routineItem.getImports();
List<Object> toRemove = new ArrayList<Object>();
for (IMPORTType importElement : imports) {
if ("org.talend.dataquality.parser.jar".equals(importElement.getMODULE())) {
//$NON-NLS-1$
toRemove.add(importElement);
}
}
if (toRemove.size() > 0) {
imports.removeAll(toRemove);
ProxyRepositoryFactory.getInstance().save(routineItem);
}
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
} else {
return ExecutionResult.NOTHING_TO_DO;
}
}
use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class ExportProjectsAsAction method getLinksFromProject.
/**
* DOC zwang Comment method "getLinksFromProject".
*
* @param project
* @return
*/
private List<LinkTargetStore> getLinksFromProject(Project project) {
List<IMPORTType> imports = null;
String linkTarget = null;
RootContainer<String, IRepositoryViewObject> routines = getRoutineFromProject(project);
List<LinkTargetStore> paths = new ArrayList<LinkTargetStore>();
String language = project.getLanguage().getName().trim();
for (IRepositoryViewObject obj : routines.getMembers()) {
RoutineItem routine = (RoutineItem) obj.getProperty().getItem();
imports = routine.getImports();
if (language != null) {
if (project != null && ECodeLanguage.JAVA.getName().equals(language)) {
IPath containerPath = getContainerFullPath(project.getTechnicalLabel());
for (IMPORTType importType : imports) {
try {
LinkTargetStore store = new LinkTargetStore();
IPath newFilePath = containerPath.append(ExportProjectsAsAction.LIB + java.io.File.separatorChar + ECodeLanguage.JAVA.getName() + java.io.File.separatorChar + importType.getMODULE());
linkTarget = EXTERNAL_LIB_JAVA_PATH + java.io.File.separatorChar + importType.getMODULE();
URI path = new URI(linkTarget.replace(java.io.File.separatorChar, '/'));
store.file = ResourcesPlugin.getWorkspace().getRoot().getFile(newFilePath);
store.uri = path;
paths.add(store);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
}
}
return paths;
}
use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class EditRoutineAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
if (repositoryNode == null) {
repositoryNode = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
}
RoutineItem routineItem = (RoutineItem) repositoryNode.getObject().getProperty().getItem();
try {
openRoutineEditor(routineItem, false);
refresh(repositoryNode);
// CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
CorePlugin.getDefault().getRunProcessService().updateLibraries(new HashSet<ModuleNeeded>(), null);
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class ReadRoutineAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
protected void doRun() {
if (repositoryNode == null && getSelection() != null) {
repositoryNode = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
}
RoutineItem routineItem = (RoutineItem) repositoryNode.getObject().getProperty().getItem();
Property updatedProperty = null;
try {
updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(routineItem)), routineItem.getProperty().getId()).getProperty();
// repositoryNode.getObject().setProperty(updatedProperty);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
routineItem = (RoutineItem) repositoryNode.getObject().getProperty().getItem();
try {
openRoutineEditor(routineItem, true);
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
use of org.talend.core.model.properties.RoutineItem in project tdi-studio-se by Talend.
the class ConfigExternalLibPage method getSelectedRoutine.
public RoutineItem getSelectedRoutine() {
RepositoryNode node = getSelectedRepositoryNode();
Item item = node.getObject().getProperty().getItem();
return (RoutineItem) item;
}
Aggregations