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

The following examples show how to use org.eclipse.jface.viewers.TreeViewer#reveal() . 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: FolderSelectionDialog.java    From typescript.java with MIT License 5 votes vote down vote up
protected void newFolderButtonPressed() {
	NewFolderDialog dialog = new NewFolderDialog(getShell(),
			fSelectedContainer);
	if (dialog.open() == Window.OK) {
		TreeViewer treeViewer = getTreeViewer();
		treeViewer.refresh(fSelectedContainer);
		Object createdFolder = dialog.getResult()[0];
		treeViewer.reveal(createdFolder);
		treeViewer.setSelection(new StructuredSelection(createdFolder));
	}
}
 
Example 2
Source File: LogContent.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Reveal all children in the model that require attention.
 */
private void revealChildrenThatNeedAttention(TreeViewer viewer,
    LogEntry<T> entry) {
  Data logData = entry.getLogData();
  if (logData != null && logData.getNeedsAttention()) {
    viewer.reveal(entry);
  }

  List<LogEntry<T>> disclosedChildren = entry.getDisclosedChildren();
  for (LogEntry<T> logEntry : disclosedChildren) {
    revealChildrenThatNeedAttention(viewer, logEntry);
  }
}
 
Example 3
Source File: FolderSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void newFolderButtonPressed() {
	NewFolderDialog dialog= new NewFolderDialog(getShell(), fSelectedContainer);
	if (dialog.open() == Window.OK) {
		TreeViewer treeViewer= getTreeViewer();
		treeViewer.refresh(fSelectedContainer);
		Object createdFolder= dialog.getResult()[0];
		treeViewer.reveal(createdFolder);
		treeViewer.setSelection(new StructuredSelection(createdFolder));
	}
}
 
Example 4
Source File: MasterSelectionDialog.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Control createDialogArea ( final Composite parent )
{
    setTitle ( "Select master server" );
    setMessage ( "Choose a master server from the world model" );

    final Composite composite = (Composite)super.createDialogArea ( parent );

    final Composite wrapper = new Composite ( composite, SWT.NONE );
    wrapper.setLayout ( new GridLayout ( 1, true ) );
    wrapper.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );

    final ObservablesManager mgr = new ObservablesManager ();

    final TreeViewer viewer = new TreeViewer ( wrapper );
    viewer.setAutoExpandLevel ( 2 );
    viewer.getControl ().setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true, 1, 1 ) );
    viewer.addDoubleClickListener ( new IDoubleClickListener () {

        @Override
        public void doubleClick ( final DoubleClickEvent event )
        {
            handleDoubleClick ();
        }
    } );

    final Button add = new Button ( wrapper, SWT.RADIO );
    add.setText ( "Add master server" );
    add.setToolTipText ( "Assign the component to the selected master server in addition" );

    this.replace = new Button ( wrapper, SWT.RADIO );
    this.replace.setText ( "Replace all master servers" );
    this.replace.setToolTipText ( "Assign the component soley to the selected master server" );
    this.replace.setSelection ( true );

    this.delete = new Button ( wrapper, SWT.RADIO );
    this.delete.setText ( "Remove master server" );
    this.delete.setToolTipText ( "Un-assign the component from the selected master server" );

    mgr.runAndCollect ( new Runnable () {

        @Override
        public void run ()
        {
            createDataModel ( viewer );
        }
    } );

    if ( this.lastSelection != null )
    {
        viewer.setSelection ( new StructuredSelection ( this.lastSelection ) );
        viewer.reveal ( this.lastSelection );
    }

    return composite;
}