/** * This is a callback that will allow us to create the viewer and initialize * it. */ @Override public void createPartControl(Composite parent) { Optional<Model> m = ModelRegistryPlugin.getModelRegistry().getActiveTaxonomy(); contentProvider = new ViewContentProvider(viewer); viewer = new ContainerCheckedTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(new DefaultEObjectLabelProvider()); viewer.addCheckStateListener(this); viewer.setSorter(null); if(m.isPresent()){ viewer.setInput(m.get()); } viewer.expandAll(); getSite().setSelectionProvider(viewer); // Create the help context id for the viewer's control PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "de.tudresden.slr.model.taxonomy.ui.viewer"); getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(this); }
/** * @return Returns the tree viewer for the tree items, the viewer is set in the root item of the * tree viewer. */ ContainerCheckedTreeViewer getTreeItemViewer() { int endlessCounter = 0; while (true) { final TreeViewerItem parent = getParentItem(); if (parent instanceof TVIMap3Root) { final TVIMap3Root map3Root = (TVIMap3Root) parent; return map3Root.getTreeViewer(); } if (endlessCounter++ > 10) { return null; } } }
public void setCheckState() { if (_checkStateNotSet.size() == 0) { // nothing to do return; } final ContainerCheckedTreeViewer layerViewer = getTreeItemViewer(); if (layerViewer != null) { // set check state in the viewer for (final TVIMap3Layer layerItem : _checkStateNotSet) { layerViewer.setChecked(layerItem, layerItem.isLayerVisible); } // reset _checkStateNotSet.clear(); } }
public DialogLayerViewerToolTip(final ContainerCheckedTreeViewer propViewer) { super(propViewer.getTree()); _propViewer = propViewer; _tree = propViewer.getTree(); _tree.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(final DisposeEvent e) { onDispose(); } }); final Device display = _tree.getDisplay(); _bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); _fgColor = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND); }
private void createTreeViewer(Composite treeComp) { treeViewer = new ContainerCheckedTreeViewer(treeComp); treeViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { processSelectionChange(); } }); treeViewer.setContentProvider(classProvider); treeViewer.setLabelProvider(labelProvider); treeViewer.setAutoExpandLevel(2); // treeViewer.addFilter(new MethodViewerFilter()); treeViewer.setUseHashlookup(true); treeViewer.setInput(""); treeViewer.setSelection(new StructuredSelection(treeViewer.getExpandedElements()[0])); }
private void createTreeViewer(Composite treeComp) { treeViewer = new ContainerCheckedTreeViewer(treeComp); treeViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { getRequestProcsseor().setCheckedElements(treeViewer.getCheckedElements()); GeneratePropertiesPage.this.getWizard().getContainer().updateButtons(); } }); treeViewer.setContentProvider(classProvider); treeViewer.setLabelProvider(labelProvider); treeViewer.setAutoExpandLevel(2); treeViewer.setInput(""); treeViewer.setSelection(new StructuredSelection(treeViewer.getExpandedElements()[0])); }
private void createTreeViewer(Composite treeComp) { treeViewer = new ContainerCheckedTreeViewer(treeComp); treeViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { getRequestProcessor().setCheckedElements(treeViewer.getCheckedElements()); ConstructorFieldPage.this.getWizard().getContainer().updateButtons(); } }); treeViewer.setContentProvider(classProvider); treeViewer.setLabelProvider(labelProvider); treeViewer.setAutoExpandLevel(2); treeViewer.setInput(""); treeViewer.setSelection(new StructuredSelection(treeViewer.getExpandedElements()[0])); }
public static ContainerCheckedTreeViewer createCheckedTreeViewer(final AbstractDialog dialog, final Composite parent, final int height, final int span) { final GridData gridData = new GridData(); gridData.heightHint = height; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = span; final ContainerCheckedTreeViewer viewer = new ContainerCheckedTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); final Tree tree = viewer.getTree(); tree.setLayoutData(gridData); viewer.setContentProvider(new TreeNodeContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); if (dialog != null) { viewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(final CheckStateChangedEvent event) { dialog.validate(); } }); } return viewer; }
public static ContainerCheckedTreeViewer createCheckedTreeViewer( final AbstractDialog dialog, Composite parent, int height, int span) { GridData gridData = new GridData(); gridData.heightHint = height; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = span; ContainerCheckedTreeViewer viewer = new ContainerCheckedTreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Tree tree = viewer.getTree(); tree.setLayoutData(gridData); viewer.setContentProvider(new TreeNodeContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); if (dialog != null) { viewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { dialog.validate(); } }); } return viewer; }
/** * Returns this field editor's list control. * * @param parent * the parent control * @return the list control */ public Tree createListControl(Composite parent) { Tree table = (Tree) getTreeControl(); if (table == null) { listParent = parent; treeViewer = new ContainerCheckedTreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); table = treeViewer.getTree(); table.setFont(parent.getFont()); treeViewer.addCheckStateListener(this); } else { checkParent(table, parent); } return table; }
private CheckboxTreeViewer createTreeViewer(Composite parent) { checkboxTreeViewer = new ContainerCheckedTreeViewer(parent, SWT.CHECK); ITreeContentProvider contentProvider = new StandardJavaElementContentProvider( true); checkboxTreeViewer.setContentProvider(contentProvider); // label provider ILabelProvider labelProvider = new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_DEFAULT | JavaElementLabelProvider.SHOW_RETURN_TYPE); checkboxTreeViewer.setLabelProvider(labelProvider); return checkboxTreeViewer; }
private void createAllObjectGroup(Composite composite) { final GridData gridData = new GridData(); gridData.heightHint = 300; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); final Tree tree = viewer.getTree(); tree.setLayoutData(gridData); viewer.setContentProvider(new TreeNodeContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); }
private void createAllSchemaGroup(Composite composite) { final GridData gridData = new GridData(); gridData.heightHint = 300; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); final Tree tree = viewer.getTree(); tree.setLayoutData(gridData); viewer.setContentProvider(new TreeNodeContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); }
private ContainerCheckedTreeViewer createTree(Composite parent, int style) { final ContainerCheckedTreeViewer viewer = new ContainerCheckedTreeViewer(parent, style | SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.RESIZE) { /** * Overriden to re-set checked state of elements after filter change */ @Override public void refresh(boolean updateLabels) { super.refresh(updateLabels); setCheckedElements(checkedElements); } }; viewer.setContentProvider(contentProvider); viewer.setLabelProvider(labelProvider); viewer.setInput(allowedTypes); Object[] preselected = getPreselected(); viewer.setCheckedElements(preselected); viewer.addPostSelectionChangedListener(new TreeSelectionChangedListener()); viewer.getTree().addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { updateDescription((IStructuredSelection) viewer.getSelection()); } }); viewer.addCheckStateListener(new TreeCheckStateListener()); return viewer; }
protected ContainerCheckedTreeViewer getTreeViewer() { return _treeViewer; }
public void setTreeViewer(final ContainerCheckedTreeViewer treeViewer) { _treeViewer = treeViewer; }
private void precheckElements(final ContainerCheckedTreeViewer treeViewer) { final IMember[] members= fProcessor.getMembersToMove(); for (int i= 0; i < members.length; i++) { treeViewer.setChecked(members[i], true); } }
public ContainerCheckedTreeViewer getViewer() { return fViewer; }
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { fViewer= (ContainerCheckedTreeViewer) viewer; }
ProfileDropAdapter(final DialogMPProfile dialogMPProfile, final ContainerCheckedTreeViewer treeViewer) { super(treeViewer); fDialogMPProfile = dialogMPProfile; fMpViewer = treeViewer; }
public TVIMapProviderRoot( final ContainerCheckedTreeViewer mapProviderViewer, final ArrayList<MPWrapper> mpWrapperList) { super(mapProviderViewer); _mpWrapperList = mpWrapperList; }
public SlideoutMap3LayerTooltip(final ContainerCheckedTreeViewer layerViewer) { super(layerViewer.getTree()); _layerViewer = layerViewer; _tree = _layerViewer.getTree(); final Device display = _tree.getDisplay(); _bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); _fgColor = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND); _cursorHand = new Cursor(display, SWT.CURSOR_HAND); }