use of org.eclipse.egit.ui.internal.repository.RepositoriesViewContentProvider 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());
}
Aggregations