Example usage for org.eclipse.jface.viewers AbstractTreeViewer expandAll

List of usage examples for org.eclipse.jface.viewers AbstractTreeViewer expandAll

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers AbstractTreeViewer expandAll.

Prototype

public void expandAll() 

Source Link

Document

Expands all nodes of the viewer's tree, starting with the root.

Usage

From source file:com.vectrace.MercurialEclipse.synchronize.actions.MercurialSynchronizePageActionGroup.java

License:Open Source License

public MercurialSynchronizePageActionGroup() {
    super();//from  w  ww .j  ava2 s. co  m
    expandAction = new Action(Messages.getString("MercurialSynchronizePageActionGroup.ExpandAll"), //$NON-NLS-1$
            MercurialEclipsePlugin.getImageDescriptor("elcl16/expandall.gif")) { //$NON-NLS-1$
        @Override
        public void run() {
            Viewer viewer = getConfiguration().getPage().getViewer();
            if (viewer instanceof AbstractTreeViewer) {
                AbstractTreeViewer treeViewer = (AbstractTreeViewer) viewer;
                treeViewer.expandAll();
            }
        }
    };

    prefStore = MercurialEclipsePlugin.getDefault().getPreferenceStore();

    presentationModeActions = new ArrayList<PresentationModeAction>();

    for (PresentationMode mode : PresentationMode.values()) {
        presentationModeActions.add(new PresentationModeAction(mode, prefStore));
    }

    localChangeSetEnableAction = new LocalChangeSetEnableAction(prefStore);

    allBranchesAction = new PreferenceAction(
            Messages.getString("MercurialSynchronizePageActionGroup.SynchronizeAllBranches"), //$NON-NLS-1$
            IAction.AS_CHECK_BOX, prefStore, MercurialPreferenceConstants.PREF_SYNC_ONLY_CURRENT_BRANCH) {
        @Override
        public void run() {
            prefStore.setValue(prefKey, !isChecked());
            MercurialSynchronizeParticipant participant = (MercurialSynchronizeParticipant) getConfiguration()
                    .getParticipant();

            participant.refresh(getConfiguration().getSite().getWorkbenchSite(),
                    participant.getContext().getScope().getMappings());
        }

        @Override
        protected void update() {
            setChecked(!prefStore.getBoolean(prefKey));
        }
    };
    allBranchesAction.setImageDescriptor(MercurialEclipsePlugin.getImageDescriptor("actions/branch.gif")); //$NON-NLS-1$
    allBranchesAction.update();
}

From source file:de.walware.ecommons.ui.actions.ExpandAllHandler.java

License:Open Source License

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final AbstractTreeViewer viewer = fViewer;
    if (UIAccess.isOkToUse(viewer)) {
        viewer.expandAll();
    }/*ww  w .j a v a2  s  .  c om*/
    return null;
}

From source file:org.eclipse.search.tests.filesearch.SearchResultPageTest.java

License:Open Source License

public void atestRemoveTreeMatches() throws Exception {
    NewSearchUI.runQueryInForeground(null, fQuery1);
    ISearchResultViewPart view = NewSearchUI.getSearchResultView();
    FileSearchPage page = (FileSearchPage) view.getActivePage();
    page.setLayout(AbstractTextSearchViewPage.FLAG_LAYOUT_TREE);
    AbstractTreeViewer viewer = (AbstractTreeViewer) page.getViewer();
    AbstractTextSearchResult result = (AbstractTextSearchResult) fQuery1.getSearchResult();
    // make sure all elements have items.
    viewer.expandAll();
    Object[] elements = result.getElements();
    //page.setUpdateTracing(true);
    for (int i = 0; i < elements.length; i++) {
        Match[] matches = result.getMatches(elements[i]);
        viewer.reveal(elements[i]);/*from   w  w w .  j  av a2  s  . c o  m*/
        for (int j = 0; j < matches.length; j++) {
            checkElementDisplay(viewer, result, elements[i]);
            result.removeMatch(matches[j]);
            consumeEvents(page);
        }
    }
    //page.setUpdateTracing(false);
}