blob: e6755e9d912ee04d04b0858b7020f3aed6d74c16 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.actions.RemoveSynchronizeParticipantAction;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
import org.eclipse.team.ui.synchronize.subscriber.SynchronizeViewerAdvisor;
import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider;
import org.eclipse.ui.IActionBars;
public class CompareParticipantPage extends CVSSynchronizeViewPage {
private RemoveSynchronizeParticipantAction removeAction;
private Action groupByCommentAction;
private boolean groupByComment = false;
private class CompareAdvisor extends CVSSynchronizeViewerAdvisor {
public CompareAdvisor(ISynchronizeView view, SubscriberParticipant participant) {
super(view, participant);
}
protected SynchronizeModelProvider getModelProvider() {
if (groupByComment) {
return new ChangeLogModelProvider(getSyncInfoSet());
}
return super.getModelProvider();
}
public void refreshModel() {
setInput(getViewer());
}
}
public CompareParticipantPage(SubscriberParticipant participant, ISynchronizeView view) {
super(participant, view);
removeAction = new RemoveSynchronizeParticipantAction(getParticipant());
groupByCommentAction = new Action("Group by comments", Action.AS_CHECK_BOX) { //$NON-NLS-1$
public void run() {
groupByComment = ! groupByComment;
setChecked(groupByComment);
CompareAdvisor advisor = ((CompareAdvisor)CompareParticipantPage.this.getViewerConfiguration());
try {
advisor.prepareInput(new NullProgressMonitor());
} catch (TeamException e) {
Utils.handle(e);
}
advisor.refreshModel();
}
};
}
/* (non-Javadoc)
* @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
*/
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
if (actionBars != null) {
IToolBarManager toolbar = actionBars.getToolBarManager();
toolbar.add(new Separator());
toolbar.add(removeAction);
IMenuManager mgr = actionBars.getMenuManager();
//mgr.add(new Separator());
mgr.add(groupByCommentAction);
}
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSynchronizeViewPage#createSynchronizeViewerAdvisor()
*/
protected SynchronizeViewerAdvisor createSynchronizeViewerAdvisor() {
return new CompareAdvisor(getSynchronizeView(), getParticipant());
}
}
|