use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class UseDynamicJobSelectionDialog method setCheckingNodes.
private void setCheckingNodes() {
final IContentProvider contentProvider = getItemsTreeViewer().getContentProvider();
final Object input = getItemsTreeViewer().getInput();
if (contentProvider instanceof ITreeContentProvider && input instanceof ProjectRepositoryNode && getNeedCheckedjobs() != null && getNeedCheckedjobs().length > 0) {
ITreeContentProvider cnfContentProvider = (ITreeContentProvider) contentProvider;
List<IRepositoryNode> checkingNodes = new ArrayList<IRepositoryNode>();
List<String> needCheckedJobIds = new ArrayList(Arrays.asList(getNeedCheckedjobs()));
final ProjectRepositoryNode root = (ProjectRepositoryNode) input;
final RepositoryNode rootRepositoryNode = root.getRootRepositoryNode(getSupportType());
if (rootRepositoryNode == null) {
return;
}
withReferenceProjects(cnfContentProvider, rootRepositoryNode, needCheckedJobIds, checkingNodes);
// set check for node
getItemsTreeViewer().setCheckedElements(checkingNodes.toArray());
// select and will expand the selected node auto
getItemsTreeViewer().setSelection(new StructuredSelection(checkingNodes), true);
// let scroll bar on top
getItemsTreeViewer().setSelection(new StructuredSelection(rootRepositoryNode));
getItemsTreeViewer().setSelection(StructuredSelection.EMPTY);
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class CreateSqlpatternAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
RepositoryNode sqlPatternNode = null;
if (!isFromSqlPatternComposite) {
sqlPatternNode = getCurrentRepositoryNode();
}
if (isToolbar()) {
if (sqlPatternNode != null && sqlPatternNode.getContentType() != ERepositoryObjectType.SQLPATTERNS) {
sqlPatternNode = null;
}
if (sqlPatternNode == null) {
sqlPatternNode = getRepositoryNodeForDefault(ERepositoryObjectType.SQLPATTERNS);
}
}
RepositoryNode node = null;
IPath path;
if (this.sqlPatternPath != null) {
path = new Path(this.sqlPatternPath);
} else if (isToolbar()) {
path = RepositoryNodeUtilities.getPath(sqlPatternNode);
} else {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
node = (RepositoryNode) obj;
path = RepositoryNodeUtilities.getPath(node);
}
NewSqlpatternWizard routineWizard = new NewSqlpatternWizard(path);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), routineWizard);
if (dlg.open() == Window.OK) {
try {
openSQLPatternEditor(routineWizard.getSQLPattern(), false);
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class EditSqlpatternAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
RepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
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();
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
boolean readonly = factory.getStatus(sqlPatternItem) == ERepositoryStatus.LOCK_BY_OTHER;
try {
openSQLPatternEditor(sqlPatternItem, readonly);
// TDI-21143 : Studio repository view : remove all refresh call to repo view
// IRepositoryView view = getViewPart();
// if (view != null) {
// view.refresh(node);
// }
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class EditSqlpatternAction method init.
/*
* (non-Javadoc)
*
* @see org.talend.repository.ui.actions.ITreeContextualAction#init(org.eclipse.jface.viewers.TreeViewer,
* org.eclipse.jface.viewers.IStructuredSelection)
*/
public void init(TreeViewer viewer, IStructuredSelection selection) {
boolean canWork = !selection.isEmpty() && selection.size() == 1;
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
canWork = false;
}
RepositoryNode node = (RepositoryNode) selection.getFirstElement();
if (canWork) {
if (node.getObjectType() != ERepositoryObjectType.SQLPATTERNS || !ProjectManager.getInstance().isInCurrentMainProject(node) || !isLastVersion(node)) {
canWork = false;
} else {
Item item = node.getObject().getProperty().getItem();
if (item instanceof SQLPatternItem) {
canWork = !((SQLPatternItem) item).isSystem();
}
}
}
if (canWork) {
canWork = (factory.getStatus(node.getObject()) != ERepositoryStatus.DELETED);
}
setEnabled(canWork);
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class DatabaseTypeFilter method selectNode.
private void selectNode() {
/*
* Make sure expand all. Just notice it here, because have been expand before.
*/
// getRepositoryTreeViewer().expandAll();
RepositoryNode root = (RepositoryNode) getRepositoryTreeViewer().getInput();
selectNode(root, this.selectionType, this.selectedNodeName, this.isSelectionId);
}
Aggregations