use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class ExportProjectsAsAction method clearExternalLibraries.
/**
* DOC zwang Comment method "clearExternalLibraries".
*/
private void clearExternalLibraries() {
List<IResource> resourcesToDelete = new ArrayList<IResource>();
IResource[] resourceArray = null;
try {
IProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
// fix for bug 15454
Project[] projects = repositoryFactory.readProject(true);
for (Project project : projects) {
IProject fsProject = ResourceUtils.getProject(project);
IFolder libJavaFolder = fsProject.getFolder(ExportProjectsAsAction.LIB);
if (!libJavaFolder.exists()) {
continue;
}
// final DeleteResourcesOperation operation = new DeleteResourcesOperation(new IResource[] {
// libJavaFolder },
// IDEWorkbenchMessages.DeleteResourceAction_operationLabel, true);
final DeleteResourcesOperation operation = new DeleteResourcesOperation(new IResource[] { libJavaFolder }, Messages.getString("IDEWorkbenchMessages.DeleteResourceAction_operationLabel"), //$NON-NLS-1$
true);
PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(operation, null, WorkspaceUndoUtil.getUIInfoAdapter(window.getShell()));
}
} catch (Exception e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class ExportProjectsAsAction method initializeExternalLibraries.
/**
* DOC bqian Comment method "test".
*/
private void initializeExternalLibraries() {
initializeLibPath();
// final InputStream initialContents = null;
final Map<Project, List<LinkTargetStore>> map = getProjectAndRelatedLinks();
IRunnableWithProgress op = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) {
Set<Project> projects = map.keySet();
//$NON-NLS-1$
monitor.beginTask(Messages.getString("ExportProjectsAsAction.createLiberariesLink"), projects.size());
for (Project project : projects) {
//$NON-NLS-1$
monitor.setTaskName(Messages.getString("ExportProjectsAsAction.processProject") + project.getLabel());
List<LinkTargetStore> links = map.get(project);
for (LinkTargetStore store : links) {
// CreateFileOperation op = new CreateFileOperation(store.file, store.uri, null,
// IDEWorkbenchMessages.WizardNewFileCreationPage_title);
CreateFileOperation op = new CreateFileOperation(store.file, store.uri, null, //$NON-NLS-1$
Messages.getString("IDEWorkbenchMessages.WizardNewFileCreationPage_title"));
try {
PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, monitor, WorkspaceUndoUtil.getUIInfoAdapter(window.getShell()));
} catch (final ExecutionException e) {
ExceptionHandler.process(e);
}
}
monitor.worked(1);
}
monitor.done();
}
};
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, op);
} catch (Exception e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class SelectDeleteProjectDialog method getProjectItem.
private List<Project> getProjectItem() {
if (login) {
List<Project> projectList = new ArrayList<Project>();
if (projectItemList != null && !projectItemList.isEmpty()) {
Iterator<Object> iter = projectItemList.iterator();
while (iter.hasNext()) {
Object project = iter.next();
if (project instanceof Project) {
projectList.add((Project) project);
}
}
}
return projectList;
}
if (!projects.isEmpty()) {
return projects;
}
ProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
Project[] projects = null;
try {
projects = repositoryFactory.readProject();
} catch (PersistenceException e) {
CommonExceptionHandler.process(e);
} catch (BusinessException e) {
CommonExceptionHandler.process(e);
}
for (Project p : projects) {
this.projects.add(p);
}
if (projects != null) {
return this.projects;
}
return Collections.emptyList();
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class DBTreeProvider method getMetadataConnection.
/**
* @return MetadataConnection
*/
@SuppressWarnings("unchecked")
private Container getMetadataConnection() {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
ProjectManager pManager = ProjectManager.getInstance();
Container container = null;
try {
container = factory.getMetadata(pManager.getCurrentProject(), ERepositoryObjectType.METADATA_CONNECTIONS);
pManager.retrieveReferencedProjects();
for (Project p : pManager.getAllReferencedProjects()) {
RootContainer rContainer = factory.getMetadata(p, ERepositoryObjectType.METADATA_CONNECTIONS);
if (container == null) {
container = rContainer;
} else if (rContainer != null) {
Iterator iterator = rContainer.absoluteKeySet().iterator();
while (iterator.hasNext()) {
Object id = iterator.next();
container.addMember(id, rContainer.getAbsoluteMember(id));
}
}
}
} catch (PersistenceException e) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("DBTreeProvider.logMessage"), e);
} catch (BusinessException e) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("DBTreeProvider.logMessage"), e);
}
return container;
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class ReadSqlpatternAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
protected void doRun() {
RepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
Property property = (Property) node.getObject().getProperty();
Property updatedProperty = null;
try {
updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(property.getItem())), property.getId()).getProperty();
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
// update the property of the node repository object
// node.getObject().setProperty(updatedProperty);
SQLPatternItem sqlpatternItem = (SQLPatternItem) node.getObject().getProperty().getItem();
try {
openSQLPatternEditor(sqlpatternItem, true);
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
Aggregations