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

The following examples show how to use org.eclipse.jface.viewers.TreeViewer#getTree() . 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: Trees.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
public static TreeViewer createViewer(
		Composite parent, String[] headers, IBaseLabelProvider label) {
	TreeViewer viewer = new TreeViewer(parent,
			SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.MULTI);
	Tree tree = viewer.getTree();
	boolean hasColumns = headers != null && headers.length > 0;
	tree.setLinesVisible(hasColumns);
	tree.setHeaderVisible(hasColumns);
	if (hasColumns) {
		createColumns(viewer, headers, label);
	}
	if (label != null) {
		viewer.setLabelProvider(label);
	}
	GridData data = UI.gridData(tree, true, true);
	data.minimumHeight = 120;
	Point p = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	data.heightHint = p.y < 120 ? 120 : p.y;
	return viewer;
}
 
Example 2
Source File: ElementTreeSelectionDialog.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    Label messageLabel = createMessageArea(composite);
    TreeViewer treeViewer = createTreeViewer(composite);

    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = convertWidthInCharsToPixels(fWidth);
    data.heightHint = convertHeightInCharsToPixels(fHeight);

    Tree treeWidget = treeViewer.getTree();
    treeWidget.setLayoutData(data);
    treeWidget.setFont(parent.getFont());

    if (fIsEmpty) {
        messageLabel.setEnabled(false);
        treeWidget.setEnabled(false);
    }

    return composite;
}
 
Example 3
Source File: ChangeTypeWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Tree-viewer that shows the allowable types in a tree view.
 * @param parent the parent
 */
private void addTreeComponent(Composite parent) {
	fTreeViewer= new TreeViewer(parent, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	
	GridData gd= new GridData(GridData.FILL_BOTH);
	gd.grabExcessHorizontalSpace= true;
	gd.grabExcessVerticalSpace= true;
	Tree tree= fTreeViewer.getTree();
	Dialog.applyDialogFont(tree);
	gd.heightHint= tree.getItemHeight() * 12;
	tree.setLayoutData(gd);

	fTreeViewer.setContentProvider(new ChangeTypeContentProvider(((ChangeTypeRefactoring)getRefactoring())));
	fLabelProvider= new ChangeTypeLabelProvider();
	fTreeViewer.setLabelProvider(fLabelProvider);
	ISelectionChangedListener listener= new ISelectionChangedListener(){
		public void selectionChanged(SelectionChangedEvent event) {
			IStructuredSelection selection= (IStructuredSelection)event.getSelection();
			typeSelected((ITypeBinding)selection.getFirstElement());
		}
	};
	fTreeViewer.addSelectionChangedListener(listener);
	fTreeViewer.setInput(new ChangeTypeContentProvider.RootType(getGeneralizeTypeRefactoring().getOriginalType()));
	fTreeViewer.expandToLevel(10);
}
 
Example 4
Source File: TreeViewerBuilder.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected TreeViewer createViewer(final Composite parent, final AbstractColumnLayout columnLayout,
		final int style) {
	final TreeViewer viewer = new TreeViewer(parent, virual ? (style | VIRTUAL) : style);
	final Tree tree = viewer.getTree();
	tree.setLinesVisible(linesVisible);
	tree.setHeaderVisible(headerVisible);

	int columnIndex = 0;
	for (final String columnLabel : columnLabels) {

		final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, NONE);
		final TreeColumn column = viewerColumn.getColumn();
		columnLayout.setColumnData(column, createColumnLayoutData(columnIndex));
		column.setText(columnLabel);
		column.setMoveable(moveable);

		columnIndex++;
	}

	return viewer;
}
 
Example 5
Source File: M2DocTypeSelectionDialog.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createCustomArea(Composite parent) {
    final Composite container = new Composite(parent, parent.getStyle());
    container.setLayout(new GridLayout(1, false));
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    final FilteredTree filteredTree = new FilteredTree(container, SWT.BORDER, new PatternFilter(), true);
    final TreeViewer treeViewer = filteredTree.getViewer();
    final Tree tree = treeViewer.getTree();
    final GridData gdTable = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gdTable.minimumWidth = TABLE_MINIMUM_WIDTH;
    gdTable.minimumHeight = TABLE_MINIMUM_HEIGHT;
    tree.setLayoutData(gdTable);
    treeViewer.setContentProvider(new CollectionContentProvider());
    treeViewer.setLabelProvider(new LabelProvider());
    treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            final Object selected = ((IStructuredSelection) event.getSelection()).getFirstElement();
            selectedType = (String) selected;
        }
    });
    treeViewer.setInput(getAvailableTypes(nsURIs));
    if (defaultType != null) {
        treeViewer.setSelection(new StructuredSelection(defaultType));
    }

    return container;
}
 
Example 6
Source File: CubeGroupContent.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createDataField( )
{
	Composite dataField = new Composite( this, SWT.NONE );
	dataField.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	dataField.setLayout( new GridLayout( ) );

	Label dataLabel = new Label( dataField, SWT.NONE );
	dataLabel.setText( Messages.getString( "GroupsPage.Label.DataField" ) ); //$NON-NLS-1$
	dataFieldsViewer = new TreeViewer( dataField, SWT.SINGLE
			| SWT.H_SCROLL
			| SWT.V_SCROLL
			| SWT.BORDER );
	cubeLabelProvider = getCubeLabelProvider( );
	cubeLabelProvider.setProivderViewer( true );
	dataFieldsViewer.setLabelProvider( cubeLabelProvider );
	dataFieldsViewer.setContentProvider( dataContentProvider );
	dataFieldsViewer.setAutoExpandLevel( 3 );
	GridData gd = new GridData( GridData.FILL_BOTH );
	dataFieldsViewer.getTree( ).setLayoutData( gd );
	( (GridData) dataFieldsViewer.getTree( ).getLayoutData( ) ).heightHint = 250;
	( (GridData) dataFieldsViewer.getTree( ).getLayoutData( ) ).widthHint = 200;
	dataFieldsViewer.addSelectionChangedListener( new ISelectionChangedListener( ) {

		public void selectionChanged( SelectionChangedEvent event )
		{
			updateButtons( );
		}

	} );

	final DragSource fieldsSource = new DragSource( dataFieldsViewer.getTree( ),
			operations );
	fieldsSource.setTransfer( types );
	fieldsSource.addDragListener( new CustomDragListener( dataFieldsViewer ) );

}
 
Example 7
Source File: TreeValueDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates and initializes the tree viewer.
 * 
 * @param parent
 *            the parent composite
 * @return the tree viewer
 * @see #doCreateTreeViewer(Composite, int)
 */
protected TreeViewer createTreeViewer( Composite parent )
{
	TreeViewer treeViewer = super.createTreeViewer( parent );
	Tree tree = treeViewer.getTree( );
	assert ( tree != null );
	for ( int i = 0; i < listeners.size( ); i++ )
	{
		int type = listeners.get( i ).type;
		Listener listener = listeners.get( i ).listener;
		tree.addListener( type, listener );
	}
	return treeViewer;
}
 
Example 8
Source File: JsonTreeViewer.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected TreeViewer createViewer(Composite parent) {
	TreeViewer viewer = new TreeViewer(parent, SWT.MULTI | SWT.NO_FOCUS | SWT.HIDE_SELECTION | SWT.BORDER);
	viewer.setContentProvider(new ContentProvider());
	Tree tree = viewer.getTree();
	if (viewerParameters[0] == Site.LOCAL)
		tree.getVerticalBar().setVisible(false);
	UI.gridData(tree, true, true);
	viewer.addDoubleClickListener((e) -> onDoubleClick(e));
	return viewer;
}
 
Example 9
Source File: Trees.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
/** Add an event handler for double clicks on the given tree viewer. */
public static void onDoubleClick(TreeViewer viewer,
		Consumer<MouseEvent> handler) {
	if (viewer == null || viewer.getTree() == null || handler == null)
		return;
	viewer.getTree().addMouseListener(new MouseAdapter() {
		@Override
		public void mouseDoubleClick(MouseEvent e) {
			handler.accept(e);
		}
	});
}
 
Example 10
Source File: Actions.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Creates a context menu with the given actions on the tree viewer.
 */
public static void bind(TreeViewer viewer, Action... actions) {
	Tree tree = viewer.getTree();
	if (tree == null)
		return;
	MenuManager menu = new MenuManager();
	for (Action action : actions)
		menu.add(action);
	tree.setMenu(menu.createContextMenu(tree));
}
 
Example 11
Source File: NodeDisplayTableControl.java    From depan with Apache License 2.0 5 votes vote down vote up
@Override
protected TreeViewer createTreeViewer(Composite parent) {
  TreeViewer result = super.createTreeViewer(parent);

  // Initialize the table.
  Tree tree = result.getTree();
  tree.setHeaderVisible(true);
  tree.setToolTipText("Node Display Properties");
  EditColTableDef.setupTree(TABLE_DEF, tree);

  // Configure cell editing.
  CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length];
  cellEditors[INDEX_NAME] = null;
  cellEditors[INDEX_SELECTED] = new CheckboxCellEditor(tree);
  cellEditors[INDEX_XPOS] = new TextCellEditor(tree);
  cellEditors[INDEX_YPOS] = new TextCellEditor(tree);
  cellEditors[INDEX_VISIBLE] = new CheckboxCellEditor(tree);
  cellEditors[INDEX_SIZE] = new ComboBoxCellEditor(
      tree, buildSizeOptions());
  cellEditors[INDEX_COLOR] = new ColorCellEditor(tree);

  result.setCellEditors(cellEditors);
  result.setLabelProvider(new PartLabelProvider());
  result.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF));
  result.setCellModifier(new PartCellModifier());

  return result;
}
 
Example 12
Source File: NodeStatsTableControl.java    From depan with Apache License 2.0 5 votes vote down vote up
@Override
protected TreeViewer createTreeViewer(Composite parent) {
  TreeViewer result = super.createTreeViewer(parent);

  // Initialize the table.
  Tree tree = result.getTree();
  tree.setHeaderVisible(true);
  tree.setToolTipText("Node Display Properties");
  EditColTableDef.setupTree(TABLE_DEF, tree);

  result.setLabelProvider(new PartLabelProvider());
  result.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF));

  return result;
}
 
Example 13
Source File: TreeSelectionDialog.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
protected void setFilter(String text, IProgressMonitor monitor, boolean updateFilterMatcher) {
    synchronized (lock) {
        if (monitor.isCanceled()) {
            return;
        }

        if (updateFilterMatcher) {
            //just so that subclasses may already treat it.
            if (fFilterMatcher.lastPattern.equals(text)) {
                //no actual change...
                return;
            }
            fFilterMatcher.setFilter(text);
            if (monitor.isCanceled()) {
                return;
            }
        }

        TreeViewer treeViewer = getTreeViewer();
        Tree tree = treeViewer.getTree();
        tree.setRedraw(false);
        tree.getParent().setRedraw(false);
        try {
            if (monitor.isCanceled()) {
                return;
            }
            treeViewer.refresh();
            if (monitor.isCanceled()) {
                return;
            }
            treeViewer.expandAll();
        } finally {
            tree.setRedraw(true);
            tree.getParent().setRedraw(true);
        }
    }
}
 
Example 14
Source File: TreeThemer.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public TreeThemer(TreeViewer treeViewer)
{
	super(treeViewer.getTree());
	this.fTreeViewer = treeViewer;
}
 
Example 15
Source File: TreeConflictsView.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void createPartControl(Composite parent) {
	GridLayout layout = new GridLayout();
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	layout.numColumns = 1;
	parent.setLayout(layout);		

	treeViewer = new TreeViewer(parent, SWT.FULL_SELECTION);
	treeViewer.setLabelProvider(new ConflictsLabelProvider());
	treeViewer.setContentProvider(new ConflictsContentProvider());
	treeViewer.setUseHashlookup(true);
	GridData layoutData = new GridData();
	layoutData.grabExcessHorizontalSpace = true;
	layoutData.grabExcessVerticalSpace = true;
	layoutData.horizontalAlignment = GridData.FILL;
	layoutData.verticalAlignment = GridData.FILL;
	treeViewer.getControl().setLayoutData(layoutData);
	TableLayout tableLayout = new TableLayout();
	treeViewer.getTree().setLayout(tableLayout);

	DisposeListener disposeListener = new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {
			TreeColumn col = (TreeColumn)e.getSource();
			if (col.getWidth() > 0) settings.put("TreeConflictsView.col." + col.getText(), col.getWidth()); //$NON-NLS-1$
		}			
	};
	for (int i = 0; i < columnHeaders.length; i++) {
		TreeColumn tc = new TreeColumn(treeViewer.getTree(), SWT.NONE,i);
		tc.setResizable(columnLayouts[i].resizable);
		tc.setText(columnHeaders[i]);
		setColumnWidth(tableLayout, disposeListener, tc, i);
	}
	
	treeViewer.getTree().setHeaderVisible(true);
	treeViewer.getTree().setLinesVisible(false);
	
	treeViewer.setInput(this);

	treeViewer.addOpenListener(new IOpenListener() {
		public void open(OpenEvent evt) {
			openAction.run();
		}	
	});
	
	createMenus();
	createToolbar();
	
	String path = settings.get("TreeConflictsView.resource"); //$NON-NLS-1$
	if (path != null) {
		boolean container = settings.getBoolean("TreeConflictsView.container"); //$NON-NLS-1$
		if (container) resource = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(path));
		else resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));
	}
	if (resource == null)
		setContentDescription(Policy.bind("TreeConflictsView.noResource")); //$NON-NLS-1$
	else
		setContentDescription(resource.getFullPath().toString());
}
 
Example 16
Source File: TreeDialogBubble.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create contents of the dialog.
 */
private void createContents() {
	shlTerms = new Shell(getParent(), getStyle());
	shlTerms.setSize(309, 441);
	shlTerms.setText("Terms");
	shlTerms.setLayout(new GridLayout(1, false));
	
	Composite composite = new Composite(shlTerms, SWT.NONE);
	composite.setLayout(new GridLayout(1, false));
	
	
	Label lblPleaseSelect = new Label(composite, SWT.NONE);
	lblPleaseSelect.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	lblPleaseSelect.setText("Please select a term:");
	
	Composite composite_1 = new Composite(shlTerms, SWT.NONE);
	GridData gd_composite_1 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	gd_composite_1.widthHint = 107;
	composite_1.setLayoutData(gd_composite_1);
	composite_1.setLayout(new GridLayout(1, false));
	
	treeViewer = new TreeViewer(composite_1, SWT.BORDER);
	tree = treeViewer.getTree();
	tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	tree.addSelectionListener(this);
	buildTree(treeViewer);
	
	Composite composite_2 = new Composite(shlTerms, SWT.NONE);
	composite_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	composite_2.setLayout(new GridLayout(2, false));
	
	Label lblNewLabel = new Label(composite_2, SWT.NONE);
	lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
	lblNewLabel.setSize(92, 15);
	lblNewLabel.setText("Group Series Per: ");
	
	Button btnSubclasses = new Button(composite_2, SWT.NONE);
	btnSubclasses.setText("Subclasses");
	btnSubclasses.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			shlTerms.dispose();
		}
	});

}
 
Example 17
Source File: CodeRecommendationResultsView.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public CodeRecommendationResultsView() {
	super(SWT.NONE);
	setBackgroundMode(SWT.INHERIT_FORCE);
	setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	setLayout(new FillLayout(SWT.HORIZONTAL));

	treeViewer = new TreeViewer(this, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	treeViewer.setAutoExpandLevel(3);
	Tree tree = treeViewer.getTree();
	tree.setHeaderVisible(true);

	TreeViewerColumn treeViewerColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
	TreeColumn trclmnCodeRecommendations = treeViewerColumn.getColumn();
	trclmnCodeRecommendations.setResizable(false);
	trclmnCodeRecommendations.setText("Code recommendations");

	treeViewer.setContentProvider(contentProvider = new TreeContentProvider());
	treeViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider = new TreeLabelProvider()));

	tree.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			TreeItem item = (TreeItem) e.item;
			Object data = item.getData();

			if (data instanceof ICodeRecommendationElement) {
				ICodeRecommendationElement element = (ICodeRecommendationElement) data;
				eventManager.invoke(l -> l.onCodeRecommendationSelected(element));
			}
		}
	});

	treeViewer.addDoubleClickListener(new IDoubleClickListener() {
		@Override
		public void doubleClick(DoubleClickEvent event) {
			TreeViewer viewer = (TreeViewer) event.getViewer();
			IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection();
			Object selectedNode = thisSelection.getFirstElement();
			if (selectedNode instanceof CodeRecommendationTarget) {
				CodeRecommendationTarget target = (CodeRecommendationTarget) selectedNode;

				eventManager.invoke(l -> l.onTargetDoubleClicked(target));
			}
		}
	});

	createContextMenu(treeViewer);
}
 
Example 18
Source File: FilterViewer.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
public FilterViewer(Composite parent, int style, boolean isDialog) {
    super(parent, style);

    this.fIsDialog = isDialog;

    setLayout(new FillLayout());
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    setLayoutData(gd);

    final SashForm sash = new SashForm(this, SWT.HORIZONTAL);

    // Create the tree viewer to display the filter tree
    fViewer = new TreeViewer(sash, SWT.NONE);
    fViewer.setContentProvider(new FilterTreeContentProvider());
    fViewer.setLabelProvider(new FilterTreeLabelProvider());

    // Create the empty filter node properties panel
    fComposite = new Composite(sash, SWT.NONE);
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    fComposite.setLayout(gl);

    createContextMenu();

    fViewer.addSelectionChangedListener(event -> {
        if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {
            // Update the filter node properties panel to the selection
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            ITmfFilterTreeNode node = (ITmfFilterTreeNode) selection.getFirstElement();
            updateFilterNodeComposite(node);
        } else {
            updateFilterNodeComposite(null);
        }
    });

    fViewer.getTree().addPaintListener(e -> {
        TmfFilterTreeNode root = (TmfFilterTreeNode) fViewer.getInput();
        if (root == null || root.getChildrenCount() == 0) {
            e.gc.setForeground(FOREGROUND_COLOR);
            e.gc.drawText(Messages.FilterViewer_EmptyTreeHintText, 5, 0);
        }
    });

    int operations = DND.DROP_MOVE | DND.DROP_COPY;
    DragSource dragSource = new org.eclipse.swt.dnd.DragSource(fViewer.getTree(), operations);
    dragSource.setTransfer(new Transfer[] { LocalSelectionTransfer.getTransfer() });
    dragSource.addDragListener(new FilterDragSourceAdapter(this));
    DropTarget dropTarget = new DropTarget(fViewer.getTree(), operations);
    dropTarget.setTransfer(new Transfer[] { LocalSelectionTransfer.getTransfer() });
    dropTarget.addDropListener(new FilterDropTargetAdapter(this));
}
 
Example 19
Source File: UpdateWizardPage.java    From translationstudio8 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( );
}