Search in sources :

Example 1 with WorkspaceTreeContentProvider

use of org.yakindu.sct.ui.wizards.WorkspaceTreeContentProvider in project statecharts by Yakindu.

the class SGenWizardPage2 method createObjectTree.

private void createObjectTree(Composite container) {
    lblNewLabel = new Label(container, SWT.NONE);
    lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
    lblNewLabel.setText("Choose: " + getSelectedGenerator().getContentType());
    resourceTree = new CheckboxTreeViewer(container, SWT.BORDER);
    resourceTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    resourceTree.setContentProvider(new WorkspaceTreeContentProvider());
    resourceTree.setLabelProvider(new SGenWorkspaceLabelProvider());
    TreePropagatingCheckStateListener checkStateListener = new TreePropagatingCheckStateListener(resourceTree) {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            super.checkStateChanged(event);
        }
    };
    resourceTree.addCheckStateListener(checkStateListener);
    resourceTree.addDoubleClickListener(new TreeExpandingDoubleClickListener(resourceTree, checkStateListener));
    resourceTree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
    resourceTree.setFilters(new ViewerFilter[] { new ViewerFilter() {

        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            // '.' prefixed folder
            if (element instanceof IFolder) {
                return !((IFolder) element).getName().startsWith(".");
            }
            return true;
        }
    } });
}
Also used : WorkspaceTreeContentProvider(org.yakindu.sct.ui.wizards.WorkspaceTreeContentProvider) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Label(org.eclipse.swt.widgets.Label) AbstractTreeViewer(org.eclipse.jface.viewers.AbstractTreeViewer) ComboViewer(org.eclipse.jface.viewers.ComboViewer) Viewer(org.eclipse.jface.viewers.Viewer) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) GridData(org.eclipse.swt.layout.GridData) EObject(org.eclipse.emf.ecore.EObject) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

IFolder (org.eclipse.core.resources.IFolder)1 EObject (org.eclipse.emf.ecore.EObject)1 AbstractTreeViewer (org.eclipse.jface.viewers.AbstractTreeViewer)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 CheckboxTreeViewer (org.eclipse.jface.viewers.CheckboxTreeViewer)1 ComboViewer (org.eclipse.jface.viewers.ComboViewer)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 GridData (org.eclipse.swt.layout.GridData)1 Label (org.eclipse.swt.widgets.Label)1 WorkspaceTreeContentProvider (org.yakindu.sct.ui.wizards.WorkspaceTreeContentProvider)1