use of org.talend.core.model.properties.ProjectReference in project tdi-studio-se by Talend.
the class SQLPatternComposite method addReferencedSQLTemplate.
private void addReferencedSQLTemplate(List<IRepositoryViewObject> list, Project project) {
try {
Context ctx = CorePlugin.getContext();
if (ctx == null) {
return;
}
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(project);
List<ProjectReference> referencedProjects = project.getEmfProject().getReferencedProjects();
for (ProjectReference referenced : referencedProjects) {
if (referenced.getBranch() != null && !parentBranch.equals(referenced.getBranch())) {
continue;
}
org.talend.core.model.properties.Project referencedEmfProject = referenced.getReferencedProject();
EList refeInRef = referencedEmfProject.getReferencedProjects();
Project newProject = new Project(referencedEmfProject);
if (refeInRef != null && refeInRef.size() > 0) {
addReferencedSQLTemplate(list, newProject);
}
List<IRepositoryViewObject> refList;
refList = DesignerPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().getAll(newProject, ERepositoryObjectType.SQLPATTERNS, false);
for (IRepositoryViewObject repositoryObject : refList) {
Item item = repositoryObject.getProperty().getItem();
if (item instanceof SQLPatternItem) {
if (!((SQLPatternItem) item).isSystem()) {
list.add(repositoryObject);
sqlPatternAndProject.put((SQLPatternItem) item, project);
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.properties.ProjectReference in project tdi-studio-se by Talend.
the class LoginProjectPage method getBranch.
public String getBranch() {
Project project = getProject();
boolean isRemoteConnection = LoginHelper.isRemoteConnection(getConnection());
if (branchesViewer != null && isRemoteConnection && !branchesViewer.getSelection().isEmpty() && project != null) {
IStructuredSelection ss = (IStructuredSelection) branchesViewer.getSelection();
String branch = (String) ss.getFirstElement();
// if (branchList != null && branchList.contains(branch)) {
return branch;
// }
} else if (!isRemoteConnection && project != null) {
List<ProjectReference> referenceProjects = project.getEmfProject().getReferencedProjects();
String currentBranch = null;
if (referenceProjects != null && !referenceProjects.isEmpty()) {
boolean allBranchesAreSame = true;
for (ProjectReference referenceProject : referenceProjects) {
String branchFromReference = referenceProject.getBranch();
if (currentBranch == null) {
if (branchFromReference == null) {
//$NON-NLS-1$
branchFromReference = "";
}
currentBranch = branchFromReference;
continue;
}
if (!currentBranch.equals(branchFromReference)) {
allBranchesAreSame = false;
break;
}
}
if (!allBranchesAreSame) {
//$NON-NLS-1$
currentBranch = "";
}
} else {
//$NON-NLS-1$
currentBranch = "";
}
return currentBranch;
}
return null;
}
Aggregations