Java Code Examples for org.eclipse.jface.viewers.TreeViewer#setInput()

The following examples show how to use org.eclipse.jface.viewers.TreeViewer#setInput() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BusinessObjectList.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void createViewer(Composite parent, AbstractBdmFormPage formPage) {
    viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    viewer.getTree().setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).create());
    formPage.getToolkit().adapt(viewer.getTree());
    viewer.getTree().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, BUSINESS_OBJECT_LIST_VIEWER_ID);
    viewer.addFilter(createSearchFilter());
    viewer.addDoubleClickListener(e -> {
        viewer.setExpandedState(selectionObservable.getValue(),
                !viewer.getExpandedState(selectionObservable.getValue()));
    });

    ColumnViewerToolTipSupport.enableFor(viewer);
    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    viewer.getTree().setLayout(layout);
    viewer.setUseHashlookup(true);
    createBusinessObjectColumn(viewer, formPage);
    viewer.setContentProvider(new BusinessObjectTreeContentProvider());
    viewer.setComparator(new BusinessObjectViewerComparator());
    viewer.setInput(input);
    addDNDSupport(formPage);
    selectionObservable = ViewerProperties.singleSelection(Object.class).observe(viewer);
}
 
Example 2
Source File: BibOutlinePage.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
public void createControl(Composite parent) {
        
        super.createControl(parent);
        
//      create the context actions
        createActions();
        
        TreeViewer viewer = getTreeViewer();        
        viewer.setContentProvider(new BibContentProvider(editor.getDocumentProvider().getDocument(editor.getEditorInput())));
        viewer.setLabelProvider(new BibLabelProvider());
        viewer.addSelectionChangedListener(this);
        
        createToolbar();
        createContextMenu();
        
        if (this.content != null) {
            viewer.setInput(this.content);
        }
//        if (this.sortIndex != null) {
//            viewer.setInput(this.sortIndex);
//        }
    }
 
Example 3
Source File: AbstractInformationControl.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * Creates tree viewer to manage content
 * 
 * @param parent
 *            parent control
 */
private void createTreeViewer(Composite parent) {
	int style = SWT.H_SCROLL | SWT.V_SCROLL;
	// Create the tree
	Tree widget = new Tree(parent, style);
	// Configure the layout
	GridData data = new GridData(GridData.FILL_BOTH);
	data.heightHint = widget.getItemHeight() * 12;
	widget.setLayoutData(data);

	treeViewer = new TreeViewer(widget);
	namePatternFilter = new QuickOutlineNamePatternFilter();
	treeViewer.addFilter(namePatternFilter);
	treeContentProvider = getContentProvider();
	treeViewer.setContentProvider(treeContentProvider);
	treeLabelProvider = getLabelProvider();
	treeViewer.setLabelProvider(treeLabelProvider);
	treeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
	treeViewer.setUseHashlookup(true);
	treeViewer.setInput(getInitialInput());
}
 
Example 4
Source File: ModulaOutlinePage.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * The editor is saved, so we should refresh representation
 * 
 * @param tableNamePositions
 */
public void update()
{
	//set the input so that the outlines parse can be called
	//update the tree viewer state
	TreeViewer viewer = getTreeViewer();

	if (viewer != null)
	{
		Control control = viewer.getControl();
		if (control != null && !control.isDisposed())
		{
			try{
				control.setRedraw(false);
				viewer.setInput(input);
			}
			finally{
				control.setRedraw(true);
			}
		}
	}
}
 
Example 5
Source File: ReorgUserInputPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private TreeViewer createViewer(Composite parent) {
	TreeViewer treeViewer= new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	GridData gd= new GridData(GridData.FILL_BOTH);
	gd.widthHint= convertWidthInCharsToPixels(40);
	gd.heightHint= convertHeightInCharsToPixels(15);
	treeViewer.getTree().setLayoutData(gd);
	treeViewer.setLabelProvider(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_SMALL_ICONS));
	treeViewer.setContentProvider(new DestinationContentProvider(getDestinationValidator()));
	treeViewer.setComparator(new JavaElementComparator());
	treeViewer.setInput(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
	return treeViewer;
}
 
Example 6
Source File: SelectLanguageConfigurationWizardPage.java    From tm4e with Eclipse Public License 1.0 5 votes vote down vote up
private void createContentTypeTreeViewer(Composite composite) {
	TreeViewer contentTypesViewer = new TreeViewer(composite,
			SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	contentTypesViewer.getControl().setFont(composite.getFont());
	contentTypesViewer.setContentProvider(new ContentTypesContentProvider());
	contentTypesViewer.setLabelProvider(new ContentTypesLabelProvider());
	contentTypesViewer.setComparator(new ViewerComparator());
	contentTypesViewer.setInput(Platform.getContentTypeManager());
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.horizontalSpan = 2;
	contentTypesViewer.getControl().setLayoutData(data);

	contentTypesViewer.addSelectionChangedListener(event -> contentTypeText
			.setText(((IContentType) event.getStructuredSelection().getFirstElement()).toString()));
}
 
Example 7
Source File: TreeDialogBar.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildTree(TreeViewer treeViewer) {	
	
	Optional<Model> m = ModelRegistryPlugin.getModelRegistry().getActiveTaxonomy();
	TreeContentProvider contentProvider = new TreeContentProvider(treeViewer);		
	treeViewer.setContentProvider(contentProvider);
	treeViewer.setLabelProvider(new DefaultEObjectLabelProvider());
	treeViewer.setSorter(null);
	if(m.isPresent()) {
		treeViewer.setInput(m.get());
	}
	
}
 
Example 8
Source File: SVNDecoratorPreferencesPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public Preview(Composite composite) {
          SWTUtils.createLabel(composite, Policy.bind("SVNDecoratorPreferencesPage.preview"));  //$NON-NLS-1$
	fImageCache= new LocalResourceManager(JFaceResources.getResources());
	fViewer = new TreeViewer(composite);
	GridData data = SWTUtils.createHVFillGridData();
	data.heightHint = 225;
	fViewer.getControl().setLayoutData(data);
	fViewer.setContentProvider(this);
	fViewer.setLabelProvider(this);
	fViewer.setInput(ROOT);
	fViewer.expandAll();
}
 
Example 9
Source File: OutlinePage.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.8
 */
protected void showBusyStatus() {
	TreeViewer treeViewer = getTreeViewer();
	treeViewer.setLabelProvider(busyLabelProvider);
	treeViewer.setContentProvider(new TreeNodeContentProvider());
	treeViewer.setInput(new TreeNode[] { new TreeNode("Loading...") });
}
 
Example 10
Source File: TreeDialogBubble.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildTree(TreeViewer treeViewer) {	
	
	Optional<Model> m = ModelRegistryPlugin.getModelRegistry().getActiveTaxonomy();
	TreeContentProvider contentProvider = new TreeContentProvider(treeViewer);		
	treeViewer.setContentProvider(contentProvider);
	treeViewer.setLabelProvider(new DefaultEObjectLabelProvider());
	treeViewer.setSorter(null);
	if(m.isPresent())
		treeViewer.setInput(m.get());	
	
}
 
Example 11
Source File: TsfTraceAnalysisView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * This is a callback that will allow us to create the viewer and initialize
 * it.
 */
@Override
public void createPartControl(Composite parent) {
    final SashForm sashForm = new SashForm(parent, SWT.NONE);
    final SashForm sashForm2 = new SashForm(sashForm, SWT.NONE);

    tsfviewer = new TimeGraphViewer(sashForm2, SWT.NONE);
    tsfviewer.setTimeGraphProvider(new TsfImplProvider());
    tsfviewer2 = new TimeGraphViewer(sashForm2, SWT.NONE);
    tsfviewer2.setTimeGraphProvider(new TsfImplProvider());

    viewer = new TreeViewer(sashForm, SWT.MULTI | SWT.H_SCROLL
            | SWT.V_SCROLL);
    drillDownAdapter = new DrillDownAdapter(viewer);
    viewer.setContentProvider(new ViewContentProvider());
    viewer.setLabelProvider(new ViewLabelProvider());
    viewer.setComparator(new ViewerComparator());
    viewer.setInput(getViewSite());

    sashForm.setWeights(new int[] { 5, 1 });
    sashForm2.setWeights(new int[] { 1, 1 });

    fact = new TraceModelImplFactory();
    ITimeGraphEntry[] traceArr = fact.createTraces();
    tsfviewer.setInput(traceArr);
    tsfviewer.addSelectionListener(this);
    tsfviewer.addRangeListener(this);
    tsfviewer.setTimeFormat(TimeFormat.CALENDAR);

    tsfviewer2.setInput(traceArr);
    tsfviewer2.addSelectionListener(this);
    tsfviewer2.addRangeListener(this);
    // tsfviewer2.setTimeFormat(TimeGraphViewer.timeFormat.epoch);

    makeActions();
    hookContextMenu();
    hookDoubleClickAction();
    contributeToActionBars();
}
 
Example 12
Source File: JsonContentOutlinePage.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
protected void update() {
    final IDocument document = documentProvider.getDocument(currentInput);

    if (document instanceof JsonDocument) {
        final Model model = ((JsonDocument) document).getModel();
        if (model == null) {
            return;
        }

        final TreeViewer viewer = getTreeViewer();

        if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
            // we keep all elements that have been previously expanded
            // so the tree stay in the same state between updates.
            final Object[] expandedElements = viewer.getExpandedElements();
            final List<Object> elements = expandedElements != null ? Arrays.asList(expandedElements) : null;

            viewer.setInput(model);

            if (elements != null && !elements.isEmpty()) {
                List<AbstractNode> newElements = new ArrayList<>();
                model.allNodes().forEach(node -> {
                    if (elements.contains(node))
                        newElements.add(node);
                });
                viewer.setExpandedElements(newElements.toArray());
            }
        }
    }
}
 
Example 13
Source File: XPathExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private void createXPathChooser(final Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    final GridLayout gl = new GridLayout(1, false);
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    composite.setLayout(gl);
    final Label label = new Label(composite, SWT.WRAP);
    label.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 30).create());
    label.setText(Messages.selectElementLabel);

    xsdViewer = new TreeViewer(composite);
    provider = new XSDContentProvider(true);
    xsdViewer.setComparer(new IElementComparer() {

        @Override
        public int hashCode(final Object element) {
            return element.hashCode();
        }

        @Override
        public boolean equals(final Object a, final Object b) {
            if (a instanceof XSDFeature && b instanceof XSDFeature) {
                final String aName = ((XSDFeature) a).getName();
                final String bName = ((XSDFeature) b).getName();
                if (aName.equals(bName)) {
                    return EcoreUtil.equals(((XSDFeature) a).getType(), ((XSDFeature) b).getType());
                }
            }
            return a.equals(b);
        }
    });
    xsdViewer.setContentProvider(provider);
    final XSDLabelProvider labelProvider = new XSDLabelProvider();
    xsdViewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, labelProvider));
    final GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
    layoutData.minimumHeight = 100;
    xsdViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 150).create());
    xsdViewer.setInput(new Object());

    text = new Text(composite, SWT.WRAP | SWT.BORDER);
    text.setLayoutData(GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 40).create());

    xsdViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            final ITreeSelection selection = (ITreeSelection) xsdViewer.getSelection();
            //                final String xpath = computeXPath(selection, false);
            //                if (dataName != null) {
            //                    if (xpath == null || xpath.isEmpty()) {
            //                        text.setText(dataName);
            //                    } else {
            //                        text.setText(xpath);
            //                    }
            //                }
            text.redraw();
            //                typeCombo.setSelection(new StructuredSelection(XPathReturnType.getType(selection.getFirstElement())));
            XPathExpressionEditor.this.fireSelectionChanged();
        }
    });

}
 
Example 14
Source File: N4IDEXpectView.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(Composite parent) {

	FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
	fillLayout.marginHeight = 5;
	fillLayout.marginWidth = 5;
	parent.setLayout(fillLayout);

	// main container
	container = new Composite(parent, SWT.BORDER);
	container.setLayout(new FillLayout());

	// create container for stack trace data
	Composite stacktraceDataContainer = new Composite(parent, SWT.BORDER);

	FormLayout formLayout = new FormLayout();
	formLayout.marginHeight = 5;
	formLayout.marginWidth = 5;
	formLayout.spacing = 5;
	stacktraceDataContainer.setLayout(formLayout);

	Composite stackLabelContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackLabelContainer.setLayout(new GridLayout());

	FormData stackLabelFormData = new FormData();
	stackLabelFormData.top = new FormAttachment(0);
	stackLabelFormData.left = new FormAttachment(0);
	stackLabelFormData.right = new FormAttachment(100);
	stackLabelFormData.bottom = new FormAttachment(20);
	stackLabelContainer.setLayoutData(stackLabelFormData);

	Composite stackTraceContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackTraceContainer.setLayout(new FillLayout());

	FormData stackTraceFormData = new FormData();
	stackTraceFormData.top = new FormAttachment(stackLabelContainer);
	stackTraceFormData.left = new FormAttachment(0);
	stackTraceFormData.right = new FormAttachment(100);
	stackTraceFormData.bottom = new FormAttachment(100);
	stackTraceContainer.setLayoutData(stackTraceFormData);

	// Create viewer for test tree in main container
	testTreeViewer = new TreeViewer(container);
	testTreeViewer.setContentProvider(new XpectContentProvider());
	testTreeViewer.setLabelProvider(new XpectLabelProvider(this.testsExecutionStatus));
	testTreeViewer.setInput(null);

	// create stack trace label
	stacktraceLabel = new Label(stackLabelContainer, SWT.SHADOW_OUT);
	FontData fontData = stacktraceLabel.getFont().getFontData()[0];
	Display display = Display.getCurrent();
	// may be null if outside the UI thread
	if (display == null)
		display = Display.getDefault();
	Font font = new Font(display, new FontData(fontData.getName(), fontData
			.getHeight(), SWT.BOLD));
	// Make stack trace label bold
	stacktraceLabel.setFont(font);

	stacktraceLabel.setText(NO_TRACE_MSG);

	// create stack trace console
	MessageConsole messageConsole = new MessageConsole("trace", null);
	stacktraceConsole = new TraceConsole(messageConsole);
	stacktraceConsoleViewer = new TextConsoleViewer(stackTraceContainer, messageConsole);

	// context menu
	getSite().setSelectionProvider(testTreeViewer);
	MenuManager contextMenu = new MenuManager();
	contextMenu.setRemoveAllWhenShown(true);
	getSite().registerContextMenu(contextMenu, testTreeViewer);
	Control control = testTreeViewer.getControl();
	Menu menu = contextMenu.createContextMenu(control);
	control.setMenu(menu);
	activateContext();

	createSelectionActions();

}
 
Example 15
Source File: BrowseWriteToJavaDialog.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Control createDialogArea(Composite parent) {
	Composite res = (Composite) super.createDialogArea(parent);
	
	if (type == null) {
		try {
			type = RepositoryManager.getInstance().getCurrentRepository().getJavaProject().findType(className);
		} catch (JavaModelException e1) {
			BonitaStudioLog.error(e1) ;
		}
	}
	
	Label label = new Label(res, SWT.NONE);
	label.setText(Messages.browseJava);
	viewer = new TreeViewer(res, SWT.SINGLE | SWT.BORDER);
	viewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 300).create());
	//provider = new PojoWriteBrowserContentProvider();
//	viewer.setContentProvider(provider);
	viewer.setLabelProvider(new JavaUILabelProvider() {
		@Override
		public String getText(Object item) {
			if (item instanceof String) {
				return (String)item;
			} else {
				return super.getText(item);
			}
		}
	});
	viewer.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			selection = (ITreeSelection) event.getSelection();
			if (getButton(OK) != null) {
				getButton(OK).setEnabled(isSetterOrDataSelected());
			}
		}

	});
	viewer.setInput(new Object());
//	viewer.setSelection(new StructuredSelection(provider.getElements(new Object()))) ;
	return res;
}
 
Example 16
Source File: NavigationTree.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
/**
 * Creates a tree viewer for the selection of single models of the given
 * type. The input of the respective navigation element is already done in
 * this method.
 */
public static TreeViewer forSingleSelection(Composite parent, ModelType type) {
	TreeViewer viewer = createViewer(parent, false);
	viewer.setInput(Navigator.findElement(type));
	return viewer;
}
 
Example 17
Source File: MoveRemoteResourceWizardMainPage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates the UI part of the page.
 *
 * @param parent  the parent of the created widgets
 */
public void createControl(Composite parent) {
	Composite composite = createComposite(parent, 1);
	// set F1 help
	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.MOVE_RENAME_REMOTE_RESOURCE_PAGE);

	Listener listener = new Listener() {
		public void handleEvent(Event event) {
               resourceName = resourceNameText.getText();
			validateFields();
		}
	};

       // the text field for the parent folder
	createLabel(composite, Policy.bind("MoveRemoteResourceWizardMainPage.selectParentUrl")); //$NON-NLS-1$

       urlParentText = createTextField(composite);
       urlParentText.addListener(SWT.Selection, listener);
       urlParentText.addListener(SWT.Modify, listener);
       urlParentText.setEditable(false);


       // Create drill down.
       DrillDownComposite drillDown = new DrillDownComposite(composite, SWT.BORDER);
       GridData spec = new GridData(GridData.FILL_BOTH);
       spec.widthHint = LIST_WIDTH;
       spec.heightHint = LIST_HEIGHT;
       drillDown.setLayoutData(spec);

       // Create tree viewer inside drill down.
       viewer = new TreeViewer(drillDown, SWT.H_SCROLL | SWT.V_SCROLL);
       drillDown.setChildTree(viewer);
       viewer.setLabelProvider(new WorkbenchLabelProvider());
       viewer.setContentProvider(new RemoteContentProvider());
       viewer.setInput(new AllRootsElement());
       viewer.addFilter(RepositoryFilters.FOLDERS_ONLY);
       viewer.addSelectionChangedListener(treeSelectionChangedListener);

       // the text field for the resource name
       createLabel(composite, Policy.bind("MoveRemoteResourceWizardMainPage.resourceName")); //$NON-NLS-1$

       resourceNameText = createTextField(composite);
       resourceNameText.addListener(SWT.Selection, listener);
       resourceNameText.addListener(SWT.Modify, listener);
       resourceNameText.setText(resourceName);

	validateFields();
       resourceNameText.setFocus();

	setControl(composite);

       // set the initial selection in the tree
       if (parentFolder != null) {
           Object toSelect = null;
           if (parentFolder.getParent() == null) {
               // the root folder : select the repository
               toSelect = parentFolder.getRepository();
           }
           else
               toSelect = parentFolder;
           viewer.expandToLevel(toSelect,0);
           viewer.setSelection(new StructuredSelection(toSelect),true);
       }

}
 
Example 18
Source File: ServerView.java    From RDFS with Apache License 2.0 4 votes vote down vote up
/**
 * Creates the columns for the view
 */
@Override
public void createPartControl(Composite parent) {
  Tree main =
      new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL
          | SWT.V_SCROLL);
  main.setHeaderVisible(true);
  main.setLinesVisible(false);
  main.setLayoutData(new GridData(GridData.FILL_BOTH));

  TreeColumn serverCol = new TreeColumn(main, SWT.SINGLE);
  serverCol.setText("Location");
  serverCol.setWidth(300);
  serverCol.setResizable(true);

  TreeColumn locationCol = new TreeColumn(main, SWT.SINGLE);
  locationCol.setText("Master node");
  locationCol.setWidth(185);
  locationCol.setResizable(true);

  TreeColumn stateCol = new TreeColumn(main, SWT.SINGLE);
  stateCol.setText("State");
  stateCol.setWidth(95);
  stateCol.setResizable(true);

  TreeColumn statusCol = new TreeColumn(main, SWT.SINGLE);
  statusCol.setText("Status");
  statusCol.setWidth(300);
  statusCol.setResizable(true);

  viewer = new TreeViewer(main);
  viewer.setContentProvider(this);
  viewer.setLabelProvider(this);
  viewer.setInput(CONTENT_ROOT); // don't care

  getViewSite().setSelectionProvider(viewer);
  
  getViewSite().getActionBars().setGlobalActionHandler(
      ActionFactory.DELETE.getId(), deleteAction);
  getViewSite().getActionBars().getToolBarManager().add(editServerAction);
  getViewSite().getActionBars().getToolBarManager().add(newLocationAction);

  createActions();
  createContextMenu();
}
 
Example 19
Source File: UpdateWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public void createControl(final Composite parent) {
		Composite composite = new Composite(parent, SWT.NONE);
		GridLayout gridLayout = new GridLayout();
		gridLayout.marginWidth = 0;
		gridLayout.marginHeight = 0;
		composite.setLayout(gridLayout);
		
		treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
		GridData data = new GridData(GridData.FILL_BOTH);
		Tree tree = treeViewer.getTree();
		tree.setLayoutData(data);
		tree.setHeaderVisible(true);
		
		IUColumnConfig[] columns = getColumnConfig();		
		for (int i = 0; i < columns.length; i++) {
			TreeColumn tc = new TreeColumn(tree, SWT.LEFT, i);
			tc.setResizable(true);
			tc.setText(columns[i].getColumnTitle());
			tc.setWidth(columns[i].getWidthInPixels(tree));
		}
		
		contentProvider = new ProvElementContentProvider();
		treeViewer.setContentProvider(contentProvider);
		labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell());
		treeViewer.setLabelProvider(labelProvider);
		
		setControl(composite);
		
		final Runnable runnable = new Runnable() {
			public void run() {				
//				updateStatus(input, operation);
				setDrilldownElements(input, operation);
				treeViewer.setInput(input);
			}
		};
		
		if (operation != null && !operation.hasResolved()) {
			try {
				getContainer().run(true, false, new IRunnableWithProgress() {
					public void run(IProgressMonitor monitor) {
						operation.resolveModal(monitor);
						parent.getDisplay().asyncExec(runnable);
					}
				});
			} catch (Exception e) {
				StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e));
			}
		} else {
			runnable.run();
		}
	}
 
Example 20
Source File: PromptParameterDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void createParameterGroup( Composite composite )
{
	final Group group2 = new Group( composite, SWT.NONE );
	group2.setLayout( new GridLayout( ) );
	group2.setLayoutData( new GridData( SWT.FILL,
			SWT.FILL,
			true,
			true,
			1,
			8 ) );// GridData.FILL_BOTH));

	group2.setText( Messages.getString( "PromptParameterDialog.parameterGroup.title" ) );

	Label label1 = new Label( group2, SWT.NONE );
	label1.setText( Messages.getString( "PromptParameterDialog.parameterGroup.label" ) );

	TreeViewer viewer2 = new TreeViewer( group2, SWT.FULL_SELECTION );

	Tree tableTree2 = viewer2.getTree( );
	GridData gd = new GridData( GridData.FILL_BOTH );
	tableTree2.setLayoutData( gd );
	tableTree2.setHeaderVisible( true );
	tableTree2.setLinesVisible( true );

	TreeViewerColumn tvc21 = new TreeViewerColumn( viewer2, SWT.NONE );
	tvc21.getColumn( )
			.setText( Messages.getString( "PromptParameterDialog.parameterGroup.nameColumn" ) ); //$NON-NLS-1$
	tvc21.getColumn( ).setWidth( 200 );
	tvc21.setLabelProvider( new NameLabelProvider( selectedStatusMap ) );
	tvc21.setEditingSupport( new ParameterEditingSupport( viewer2,
			selectedStatusMap ) );

	TreeViewerColumn tvc22 = new TreeViewerColumn( viewer2, SWT.NONE );
	tvc22.getColumn( )
			.setText( Messages.getString( "PromptParameterDialog.parameterGroup.previousValue" ) ); //$NON-NLS-1$
	tvc22.getColumn( ).setWidth( 200 );
	tvc22.setLabelProvider( new PreviousValueLabelProvider( ) );

	TreeViewerColumn tvc23 = new TreeViewerColumn( viewer2, SWT.NONE );
	tvc23.getColumn( )
			.setText( Messages.getString( "PromptParameterDialog.parameterGroup.revisedValue" ) ); //$NON-NLS-1$
	tvc23.getColumn( ).setWidth( 200 );
	tvc23.setLabelProvider( new RevisedValueLabelProvider( ) );

	viewer2.setContentProvider( new ParameterContentProvider( ) );
	viewer2.setInput( ( (IAmbiguousOption) input ).getAmbiguousParameters( ) );
	viewer2.expandAll( );
}