use of org.eclipse.jface.viewers.IContentProvider in project tdi-studio-se by Talend.
the class AbstractVersionManagementProjectSettingPage method processItems.
protected void processItems(List<ItemVersionObject> objects, RepositoryNode node) {
if (node == null) {
return;
}
// if the root node of type is not init, force init.
IProjectRepositoryNode root = node.getRoot();
if (root instanceof ProjectRepositoryNode) {
((ProjectRepositoryNode) root).initNode(node);
}
if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
if (node.getObject() != null) {
Property property = node.getObject().getProperty();
Item item = property.getItem();
if (item != null && filterRepositoryNode(node)) {
// must be item
ItemVersionObject object = createItemVersionObject(node, property);
objects.add(object);
}
}
} else {
IContentProvider contentProvider = treeViewer.getContentProvider();
if (contentProvider instanceof NavigatorContentServiceContentProvider) {
NavigatorContentServiceContentProvider navigatorProvider = (NavigatorContentServiceContentProvider) contentProvider;
Object[] children = navigatorProvider.getChildren(node);
for (Object child : children) {
if (child instanceof RepositoryNode) {
processItems(objects, (RepositoryNode) child);
}
}
} else {
for (IRepositoryNode child : node.getChildren()) {
processItems(objects, (RepositoryNode) child);
}
}
}
}
use of org.eclipse.jface.viewers.IContentProvider in project tdi-studio-se by Talend.
the class JobScriptsExportWizardPage method collectNodes.
private void collectNodes(Map<String, Item> items, RepositoryNode repositoryNode) {
IRepositoryViewObject repositoryObject = repositoryNode.getObject();
if (repositoryObject != null) {
if (repositoryObject.getRepositoryObjectType().isResourceItem()) {
Item item = repositoryObject.getProperty().getItem();
items.put(item.getProperty().getId(), item);
}
} else {
if (repositoryNode.getParent() != null && repositoryNode.getParent().getObject() != null) {
Item item = repositoryNode.getParent().getObject().getProperty().getItem();
items.put(item.getProperty().getId(), item);
}
}
if (this.treeViewer != null) {
IContentProvider contentProvider = this.treeViewer.getFilteredCheckboxTree().getViewer().getContentProvider();
if (contentProvider instanceof ITreeContentProvider) {
Object[] children = ((ITreeContentProvider) contentProvider).getChildren(repositoryNode);
collectNodes(items, children);
}
}
}
use of org.eclipse.jface.viewers.IContentProvider in project tdi-studio-se by Talend.
the class NotificationDetailsDialog method refreshWidgets.
/**
* Refreshes the widgets.
*/
protected void refreshWidgets() {
final Notification notification = (Notification) ((StructuredSelection) tree.getViewer().getSelection()).getFirstElement();
if (notification == null) {
return;
}
dateLabel.setText(new SimpleDateFormat(DATE_FORMAT).format(new Date(notification.getTimeStamp())));
sequenceNumberText.setText(String.valueOf(notification.getSequenceNumber()));
sourceLabel.setText(notification.getSource().toString());
typeLabel.setText(notification.getType());
messageText.setText(notification.getMessage());
Object userData = notification.getUserData();
if (userData != null) {
IContentProvider contentProvider = detailsViewer.getContentProvider();
if (contentProvider != null) {
((DetailsContentProvider) contentProvider).refresh(userData);
}
}
if (prevButton != null && !prevButton.isDisposed()) {
prevButton.setEnabled(tree.getPrevItem() != null);
}
if (nextButton != null && !nextButton.isDisposed()) {
nextButton.setEnabled(tree.getNextItem() != null);
}
}
use of org.eclipse.jface.viewers.IContentProvider 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.eclipse.jface.viewers.IContentProvider in project tdi-studio-se by Talend.
the class DynamicComposite method getConnectionItems.
/**
* DOC qzhang Comment method "getConnectionItems".
*
* @return
* @throws PersistenceException
*/
private List<ConnectionItem> getConnectionItems() throws PersistenceException {
List<ConnectionItem> list = new ArrayList<ConnectionItem>();
IRepositoryView repositoryView = RepositoryManagerHelper.findRepositoryView();
if (repositoryView != null) {
TreeViewer viewer = (TreeViewer) repositoryView.getViewer();
IContentProvider contentProvider = viewer.getContentProvider();
if (contentProvider instanceof RepositoryContentProvider) {
RepositoryContentProvider provider = (RepositoryContentProvider) contentProvider;
RepositoryNode metadataConNode = provider.getRootRepositoryNode(ERepositoryObjectType.METADATA);
for (IRepositoryNode connectionItem : metadataConNode.getChildren()) {
if (viewer.isExpandable(connectionItem)) {
provider.getChildren(connectionItem);
}
for (IRepositoryNode node : connectionItem.getChildren()) {
addConnectionItem(viewer, provider, list, (RepositoryNode) node);
}
}
}
}
return list;
}
Aggregations