Search in sources :

Example 11 with GitModelCommit

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit in project egit by eclipse.

the class GitChangeSetLabelProvider method getStyledText.

@Override
public StyledString getStyledText(Object element) {
    // need to compare classes as everything is 'instanceof GitModelCommit'
    if (element.getClass().equals(GitModelCommit.class)) {
        String formattedName = createChangeSetLabel((GitModelCommit) element);
        StyledString string = new StyledString(formattedName);
        GitModelCommit commit = (GitModelCommit) element;
        // $NON-NLS-1$//$NON-NLS-2$
        String format = " [" + getAbbreviatedId(commit) + "]";
        string.append(format, StyledString.DECORATIONS_STYLER);
        return string;
    }
    if (element instanceof GitChangeSetModelProvider)
        return new StyledString(UIText.GitChangeSetModelProviderLabel);
    return getDelegateLabelProvider().getStyledText(element);
}
Also used : GitModelCommit(org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit) GitChangeSetModelProvider(org.eclipse.egit.ui.internal.synchronize.GitChangeSetModelProvider) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString)

Aggregations

GitModelCommit (org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit)11 Viewer (org.eclipse.jface.viewers.Viewer)8 CommonViewer (org.eclipse.ui.navigator.CommonViewer)8 Test (org.junit.Test)8 Commit (org.eclipse.egit.core.synchronize.GitCommitsModelCache.Commit)3 GitModelBlob (org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob)3 GitModelCache (org.eclipse.egit.ui.internal.synchronize.model.GitModelCache)3 GitModelWorkingTree (org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingTree)3 GitModelTree (org.eclipse.egit.ui.internal.synchronize.model.GitModelTree)2 StyledString (org.eclipse.jface.viewers.StyledString)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 GitChangeSetModelProvider (org.eclipse.egit.ui.internal.synchronize.GitChangeSetModelProvider)1