Search in sources :

Example 6 with RepositoriesViewLabelProvider

use of org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider in project egit by eclipse.

the class CommitSearchPage method addRepositoryControl.

private void addRepositoryControl(Composite parent) {
    repositoryGroup = new Group(parent, SWT.NONE);
    repositoryGroup.setBackgroundMode(SWT.INHERIT_DEFAULT);
    GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(repositoryGroup);
    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(repositoryGroup);
    this.repositoryViewer = CheckboxTableViewer.newCheckList(repositoryGroup, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    this.repositoryViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new RepositoriesViewLabelProvider()));
    this.repositoryViewer.setContentProvider(new RepositoriesViewContentProvider());
    this.repositoryViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
    this.repositoryViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateOKStatus();
            repositoryGroup.setText(getRepositoryText());
        }
    });
    GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 40).applyTo(this.repositoryViewer.getControl());
    ToolBar checkBar = new ToolBar(repositoryGroup, SWT.FLAT | SWT.VERTICAL);
    GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.TOP).grab(false, true).applyTo(checkBar);
    ToolItem checkItem = new ToolItem(checkBar, SWT.PUSH);
    checkItem.setToolTipText(UIText.CommitSearchPage_CheckAll);
    Image checkImage = UIIcons.CHECK_ALL.createImage();
    UIUtils.hookDisposal(checkItem, checkImage);
    checkItem.setImage(checkImage);
    checkItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            repositoryViewer.setAllChecked(true);
            repositoryGroup.setText(getRepositoryText());
            updateOKStatus();
        }
    });
    ToolItem uncheckItem = new ToolItem(checkBar, SWT.PUSH);
    uncheckItem.setToolTipText(UIText.CommitSearchPage_UncheckAll);
    Image uncheckImage = UIIcons.UNCHECK_ALL.createImage();
    UIUtils.hookDisposal(uncheckItem, uncheckImage);
    uncheckItem.setImage(uncheckImage);
    uncheckItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            repositoryViewer.setAllChecked(false);
            repositoryGroup.setText(getRepositoryText());
            updateOKStatus();
        }
    });
    this.searchAllBranchesButton = new Button(repositoryGroup, SWT.CHECK);
    this.searchAllBranchesButton.setText(UIText.CommitSearchPage_SearchAllBranches);
    GridDataFactory.swtDefaults().grab(true, false).span(2, 1).applyTo(this.searchAllBranchesButton);
    repositoryGroup.setText(getRepositoryText());
}
Also used : Group(org.eclipse.swt.widgets.Group) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) RepositoriesViewLabelProvider(org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider) RepositoriesViewContentProvider(org.eclipse.egit.ui.internal.repository.RepositoriesViewContentProvider) Image(org.eclipse.swt.graphics.Image) Button(org.eclipse.swt.widgets.Button) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DelegatingStyledCellLabelProvider(org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

RepositoriesViewLabelProvider (org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider)6 RepositoriesViewContentProvider (org.eclipse.egit.ui.internal.repository.RepositoriesViewContentProvider)3 RepositoryNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)3 Repository (org.eclipse.jgit.lib.Repository)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 Button (org.eclipse.swt.widgets.Button)3 Before (org.junit.Before)3 ArrayList (java.util.ArrayList)2 TagOperation (org.eclipse.egit.core.op.TagOperation)2 LocalNode (org.eclipse.egit.ui.internal.repository.tree.LocalNode)2 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)2 TagsNode (org.eclipse.egit.ui.internal.repository.tree.TagsNode)2 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2 TagBuilder (org.eclipse.jgit.lib.TagBuilder)2 Composite (org.eclipse.swt.widgets.Composite)2 File (java.io.File)1 List (java.util.List)1 Set (java.util.Set)1