use of org.talend.repository.ProjectManager in project tdi-studio-se by Talend.
the class MultipleThreadDynamicComposite method getAllRepositoryMetadata.
/**
*
* cli Comment method "getAllRepositoryMetadata".
*
* fixed for 8971
*/
private List<IRepositoryViewObject> getAllRepositoryMetadata() {
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
ProjectManager pManager = ProjectManager.getInstance();
// retrieve reference project.
pManager.getReferencedProjects();
List<IRepositoryViewObject> repositoryObjects;
try {
repositoryObjects = retrieveMetadataFromProject(factory, pManager, pManager.getCurrentProject());
} catch (PersistenceException e) {
throw new RuntimeException(e);
}
return repositoryObjects;
}
use of org.talend.repository.ProjectManager in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method getChildrenJobAndContextName.
protected void getChildrenJobAndContextName(ExportFileResource[] allResources, String rootName, List<JobInfo> list, ProcessItem process, String projectName, List<ProcessItem> processedJob, List<URL> allJobScripts, ExportFileResource resource, Map<ExportChoice, Object> exportChoice, String... selectedJobVersion) {
if (processedJob.contains(process)) {
// prevent circle
return;
}
processedJob.add(process);
ProjectManager projectManager = ProjectManager.getInstance();
Project project = projectManager.getProject(process);
String childProjectName = projectName;
if (project != null) {
// hywang modify for 7932
childProjectName = project.getTechnicalLabel().toLowerCase();
}
allJobScripts.addAll(getJobScripts(childProjectName, process.getProperty().getLabel(), process.getProperty().getVersion(), isOptionChoosed(ExportChoice.needJobScript)));
addContextScripts(process, process.getProperty().getLabel(), process.getProperty().getVersion(), resource, isOptionChoosed(ExportChoice.needContext));
addJobItem(allResources, process, isOptionChoosed(ExportChoice.needJobItem), resource);
addDependencies(allResources, process, isOptionChoosed(ExportChoice.needDependencies) && isOptionChoosed(ExportChoice.needJobItem), resource);
addSourceCode(allResources, process, isOptionChoosed(ExportChoice.needSourceCode), resource);
addDependenciesSourceCode(allResources, resource, isOptionChoosed(ExportChoice.needSourceCode));
Set<JobInfo> subjobInfos = ProcessorUtilities.getChildrenJobInfo(process);
for (JobInfo subjobInfo : subjobInfos) {
if (list.contains(subjobInfo)) {
continue;
}
list.add(subjobInfo);
getChildrenJobAndContextName(allResources, rootName, list, subjobInfo.getProcessItem(), projectName, processedJob, allJobScripts, resource, exportChoice);
}
}
use of org.talend.repository.ProjectManager in project tdi-studio-se by Talend.
the class SetupProcessDependenciesRoutinesDialog method init.
@SuppressWarnings("unchecked")
private void init(ProcessType process) {
allRoutineItems.clear();
ProjectManager projectManager = ProjectManager.getInstance();
Project currentProject = projectManager.getCurrentProject();
initModels(currentProject);
Set<Project> referenceProjects = new HashSet<Project>();
this.getAllReferenceProjects(currentProject, referenceProjects);
initRefProjects(referenceProjects);
List<RoutinesParameterType> routinesDependencies = process.getParameters().getRoutinesParameter();
List<String> typeNames = new ArrayList<String>();
for (RoutinesParameterType type : routinesDependencies) {
RoutineItemRecord record = new RoutineItemRecord();
record.setName(type.getName());
Property property = findObject(type.getId(), type.getName());
if (property != null) {
// if system, id is not used
record.setId(property.getId());
record.setLabel(property.getLabel());
} else {
record.setHasProblem(true);
// use the record
record.setLabel(type.getName());
}
if (!record.hasProblem()) {
// if lost, willn't display
if (((RoutineItem) property.getItem()).isBuiltIn()) {
systemRoutines.add(record);
} else {
if (typeNames.contains(type.getName())) {
break;
} else {
typeNames.add(type.getName());
userRoutines.add(record);
}
}
}
}
}
use of org.talend.repository.ProjectManager in project tdi-studio-se by Talend.
the class GenerateDocAsHTMLAction method init.
/*
* (non-Javadoc)
*
* @see org.talend.repository.ui.actions.ITreeContextualAction#init(org.eclipse.jface.viewers.TreeViewer,
* org.eclipse.jface.viewers.IStructuredSelection)
*/
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
ProjectManager instance = ProjectManager.getInstance();
boolean canWork = false;
List<RepositoryNode> nodes = selection.toList();
for (RepositoryNode node : nodes) {
if (ERepositoryObjectType.PROCESS_MR != null) {
if (node.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.PROCESS_MR) {
if (node.getObject() != null && instance.isInCurrentMainProject(node)) {
canWork = true;
}
}
}
Object contentType = node.getProperties(EProperties.CONTENT_TYPE);
if (contentType == ERepositoryObjectType.PROCESS || contentType == ERepositoryObjectType.PROCESS_ROUTE) {
if (node.getObject() != null && instance.isInCurrentMainProject(node)) {
canWork = true;
}
}
if (canWork && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) == ERepositoryStatus.DELETED) {
canWork = false;
break;
}
}
setEnabled(canWork);
}
use of org.talend.repository.ProjectManager in project tdi-studio-se by Talend.
the class MergeTosMetadataMigrationTask method getItemURI.
private URI getItemURI(Item item) {
ProjectManager pManager = ProjectManager.getInstance();
org.talend.core.model.general.Project project = new org.talend.core.model.general.Project(pManager.getProject(item));
// referenced item
if (project != null && !project.equals(pManager.getCurrentProject())) {
String folder = ERepositoryObjectType.getFolderName(ERepositoryObjectType.getItemType(item));
if (folder != null) {
IPath path = new Path(project.getTechnicalLabel());
path = path.append(folder);
path = path.append(item.getState().getPath());
Property property = item.getProperty();
//$NON-NLS-1$ //$NON-NLS-2$
String itemStr = property.getLabel() + "_" + property.getVersion() + "." + FileConstants.PROPERTIES_EXTENSION;
path = path.append(itemStr);
return URIHelper.convert(path);
}
}
if (item.eResource() != null) {
// be null
return item.eResource().getURI();
}
return null;
}
Aggregations