use of org.eclipse.egit.ui.internal.GitLabelProvider in project egit by eclipse.
the class UnmergedBranchDialog method createCustomArea.
@Override
protected Control createCustomArea(Composite parent) {
Composite area = new Composite(parent, SWT.NONE);
area.setLayoutData(new GridData(GridData.FILL_BOTH));
area.setLayout(new FillLayout());
TableViewer branchesList = new TableViewer(area);
branchesList.setContentProvider(ArrayContentProvider.getInstance());
branchesList.setLabelProvider(new GitLabelProvider());
branchesList.setInput(nodes);
return area;
}
use of org.eclipse.egit.ui.internal.GitLabelProvider in project egit by eclipse.
the class CommitEditorPage method createBranchesArea.
private void createBranchesArea(Composite parent, FormToolkit toolkit, int span) {
branchSection = createSection(parent, toolkit, UIText.CommitEditorPage_SectionBranchesEmpty, span, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
((GridData) branchSection.getLayoutData()).grabExcessVerticalSpace = false;
Composite branchesArea = createSectionClient(branchSection, toolkit);
branchViewer = new TableViewer(toolkit.createTable(branchesArea, SWT.V_SCROLL | SWT.H_SCROLL));
Control control = branchViewer.getControl();
control.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 50).applyTo(control);
addToFocusTracking(control);
branchViewer.setComparator(new ViewerComparator());
branchViewer.setLabelProvider(new GitLabelProvider() {
@Override
public String getText(Object element) {
return Repository.shortenRefName(super.getText(element));
}
});
branchViewer.setContentProvider(ArrayContentProvider.getInstance());
updateSectionClient(branchSection, branchesArea, toolkit);
}
use of org.eclipse.egit.ui.internal.GitLabelProvider in project egit by eclipse.
the class BranchSelectionDialog method createCustomArea.
@Override
protected Control createCustomArea(Composite parent) {
Composite area = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(area);
area.setLayout(new GridLayout(1, false));
if (multiMode) {
fTree = new FilteredCheckboxTree(area, null, SWT.NONE, new PatternFilter()) {
/*
* Overridden to check page when refreshing is done.
*/
@Override
protected WorkbenchJob doCreateRefreshJob() {
WorkbenchJob refreshJob = super.doCreateRefreshJob();
refreshJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (event.getResult().isOK()) {
getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
checkPage();
}
});
}
}
});
return refreshJob;
}
};
CachedCheckboxTreeViewer viewer = fTree.getCheckboxTreeViewer();
GridDataFactory.fillDefaults().grab(true, true).applyTo(fTree);
viewer.setContentProvider(new ITreeContentProvider() {
@Override
public void inputChanged(Viewer actViewer, Object oldInput, Object newInput) {
// nothing
}
@Override
public void dispose() {
// nothing
}
@Override
public boolean hasChildren(Object element) {
return false;
}
@Override
public Object getParent(Object element) {
return null;
}
@Override
public Object[] getElements(Object inputElement) {
return ((List) inputElement).toArray();
}
@Override
public Object[] getChildren(Object parentElement) {
return null;
}
});
viewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
checkPage();
}
});
viewer.setLabelProvider(new GitLabelProvider());
viewer.setComparator(new ViewerComparator(CommonUtils.STRING_ASCENDING_COMPARATOR));
viewer.setInput(nodes);
preselectBranchMultiMode(nodes, fTree);
} else {
branchesList = new TableViewer(area, this.style | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, true).applyTo(branchesList.getControl());
branchesList.setContentProvider(ArrayContentProvider.getInstance());
branchesList.setLabelProvider(new GitLabelProvider());
branchesList.setComparator(new ViewerComparator(CommonUtils.STRING_ASCENDING_COMPARATOR));
branchesList.setInput(nodes);
preselectBranchSingleMode(nodes, branchesList);
branchesList.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
checkPage();
}
});
branchesList.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
buttonPressed(OK);
}
});
}
return area;
}
Aggregations