Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 36958 | Differences between
and this patch

Collapse All | Expand All

(-).classpath (-1 / +1 lines)
Lines 1-7 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
2
<classpath>
3
	<classpathentry kind="src" path="compare"/>
3
	<classpathentry kind="src" path="compare"/>
4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6
	<classpathentry kind="output" path="bin"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
7
</classpath>
(-)plugin.properties (-1 / +15 lines)
Lines 65-71 Link Here
65
Command.selectPreviousChange.name= Select Previous Change
65
Command.selectPreviousChange.name= Select Previous Change
66
Command.selectPreviousChange.description= Select Previous Change
66
Command.selectPreviousChange.description= Select Previous Change
67
67
68
69
#
68
#
70
# Context menu & actions
69
# Context menu & actions
71
#
70
#
Lines 153-158 Link Here
153
action.Previous.tooltip=Go to Previous Difference
152
action.Previous.tooltip=Go to Previous Difference
154
action.Previous.image=elcl16/prev_nav.gif
153
action.Previous.image=elcl16/prev_nav.gif
155
154
155
action.CheckpointActionSet.label=Checkpoints
156
action.CheckpointActionSet.description=Commands for adding and restoring from checkpoints
157
action.ShowCheckpoints.label=&Show Checkpoints...
158
action.ShowCheckpoints.tooltip=Rollback resource changes to selected checkpoint
159
action.AddCheckpoint.label=&Create Checkpoint...
160
action.AddCheckpoint.tooltip=Add a labeled Checkpoint as a future rollback target
161
156
#
162
#
157
# Built in Structure Creators
163
# Built in Structure Creators
158
#
164
#
Lines 197-199 Link Here
197
ValidateEdit.error.unable_to_perform= Operation can\'t be performed.
203
ValidateEdit.error.unable_to_perform= Operation can\'t be performed.
198
ValidateEdit.error.fileModified= File ''{0}'' has been modified since the beginning of the operation.
204
ValidateEdit.error.fileModified= File ''{0}'' has been modified since the beginning of the operation.
199
ValidateEdit.error.stillReadonly= File ''{0}'' is readonly.
205
ValidateEdit.error.stillReadonly= File ''{0}'' is readonly.
206
207
#
208
# Checkpoint Context Menu
209
#
210
CompareWithCheckpointAction.label=Checkpoint...
211
CompareWithCheckpointAction.tooltip=Compare Checkpoint resources to workspace resources
212
ReplaceWithCheckpointAction.label=Checkpoint...
213
ReplaceWithCheckpointAction.tooltip=Replace workspace resources with checkpointed versions
(-)plugin.xml (-1 / +52 lines)
Lines 31-36 Link Here
31
   <extension-point id="contentViewers" name="%contentViewers" schema="schema/contentViewers.exsd"/>
31
   <extension-point id="contentViewers" name="%contentViewers" schema="schema/contentViewers.exsd"/>
32
32
33
<!-- Extensions -->
33
<!-- Extensions -->
34
35
<!-- Project menu additions for Checkpoints -->
36
<!--                   invisible by default -->
37
38
   <extension
39
         point="org.eclipse.ui.actionSets">
40
      <actionSet
41
            label="%action.CheckpointActionSet.label"
42
            description="%action.CheckpointActionSet.description"
43
            visible="false"
44
            id="org.eclipse.compare.CheckpointActionSet">
45
         <action
46
         	   definitionId="org.eclipse.compare.ui.project.addcheckpoint"
47
               label="%action.AddCheckpoint.label"
48
               tooltip="%action.AddCheckpoint.tooltip"
49
               class="org.eclipse.compare.internal.AddCheckpointAction"
50
               menubarPath="project/additions"
51
               retarget="true"
52
               id="addCheckpointAction">
53
         </action>
54
         <action
55
         	   definitionId="org.eclipse.compare.ui.project.showcheckpoints"
56
               label="%action.ShowCheckpoints.label"
57
               tooltip="%action.ShowCheckpoints.tooltip"
58
               class="org.eclipse.compare.internal.ShowCheckpointsAction"
59
               menubarPath="project/additions"
60
               id="showCheckpointsAction">
61
         </action>
62
      </actionSet>
63
   </extension>
34
   <extension
64
   <extension
35
         point="org.eclipse.ui.fontDefinitions">
65
         point="org.eclipse.ui.fontDefinitions">
36
      <fontDefinition
66
      <fontDefinition
Lines 153-163 Link Here
153
            configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
183
            configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
154
      </keyBinding>
184
      </keyBinding>
155
   </extension>
185
   </extension>
186
   <!-- Compare/Replace With -> Checkpoint... popup menus -->
156
   <extension
187
   <extension
157
         point="org.eclipse.ui.popupMenus">
188
         point="org.eclipse.ui.popupMenus">
158
      <objectContribution
189
      <objectContribution
159
            objectClass="org.eclipse.core.resources.IResource"
190
            objectClass="org.eclipse.core.resources.IResource"
160
            adaptable="true"
191
            adaptable="true"
192
            id="org.eclipse.compare.CheckpointAction">
193
         <action
194
               label="%CompareWithCheckpointAction.label"
195
               tooltip="%CompareWithCheckpointAction.tooltip"
196
               class="org.eclipse.compare.internal.ShowCheckpointsAction"
197
               menubarPath="compareWithMenu/compareWithGroup"
198
               enablesFor="1"
199
               id="CompareWithCheckointAction">
200
         </action>
201
         <action
202
               label="%ReplaceWithCheckpointAction.label"
203
               tooltip="%ReplaceWithCheckpointAction.tooltip"
204
               class="org.eclipse.compare.internal.ShowCheckpointsAction"
205
               menubarPath="replaceWithMenu/replaceWithGroup"
206
               enablesFor="1"
207
               id="ReplaceWithCheckointAction">
208
         </action>
209
      </objectContribution>
210
      <objectContribution
211
            objectClass="org.eclipse.core.resources.IResource"
212
            adaptable="true"
161
            id="org.eclipse.compare.CompareAction">
213
            id="org.eclipse.compare.CompareAction">
162
         <menu
214
         <menu
163
               label="%ReplaceWithMenu.label"
215
               label="%ReplaceWithMenu.label"
Lines 298-302 Link Here
298
            id="org.eclipse.compare.TextViewerCreator">
350
            id="org.eclipse.compare.TextViewerCreator">
299
      </viewer>
351
      </viewer>
300
   </extension>
352
   </extension>
301
302
</plugin>
353
</plugin>
(-)compare/org/eclipse/compare/internal/AddCheckpointAction.java (+73 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.compare.internal;
12
13
import java.util.Date;
14
15
import org.eclipse.jface.action.IAction;
16
import org.eclipse.jface.viewers.ISelection;
17
import org.eclipse.ui.IWorkbenchPart;
18
import org.eclipse.ui.IWorkbenchWindow;
19
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
20
21
22
/*
23
 * The "Compare with each other" action
24
 */
25
public class AddCheckpointAction implements IWorkbenchWindowActionDelegate {
26
27
	private ISelection fSelection;
28
	private AddCheckpointDialog dialog;
29
30
	public void run(ISelection selection) {
31
		long time = System.currentTimeMillis();
32
		Date date = new Date(time);
33
		dialog = new AddCheckpointDialog(CompareUIPlugin.getShell(),
34
										CompareMessages.getString("AddCheckpointAction.0"), //$NON-NLS-1$
35
										CompareMessages.getString("AddCheckpointAction.1"), //$NON-NLS-1$
36
										date.toString());
37
38
		dialog.open();
39
	}
40
	
41
	/* (non-Javadoc)
42
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
43
	 */
44
	final public void run(IAction action) {
45
		run(fSelection);
46
	}
47
	
48
	/* (non-Javadoc)
49
	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
50
	 */
51
	final public void selectionChanged(IAction action, ISelection selection) {
52
		if (action != null)
53
			action.setEnabled(true);
54
	}
55
	
56
	protected boolean isEnabled(ISelection selection) {
57
		return true;
58
	}
59
60
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
61
	}
62
	/* (non-Javadoc)
63
	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
64
	 */
65
	public void dispose() {
66
	}
67
	/* (non-Javadoc)
68
	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
69
	 */
70
	public void init(IWorkbenchWindow window) {
71
		// TODO Auto-generated method stub
72
	}
73
}
(-)compare/org/eclipse/compare/internal/AddCheckpointAction.properties (+2 lines)
Added Link Here
1
AddCheckpointAction.0=Create a Checkpoint
2
AddCheckpointAction.1=Checkpoint Label
(-)compare/org/eclipse/compare/internal/AddCheckpointDialog.java (+42 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2003 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.compare.internal;
12
13
import org.eclipse.core.resources.Checkpoint;
14
import org.eclipse.core.resources.CheckpointBridge;
15
import org.eclipse.jface.dialogs.InputDialog;
16
import org.eclipse.swt.widgets.Shell;
17
18
public class AddCheckpointDialog extends InputDialog {
19
	
20
	/**
21
	 * Create a checkpoint dialog with specified attributes.
22
	 * @param parentShell SWT parent Shell
23
	 * @param dialogTitle Text appearing in dialog's title bar
24
	 * @param dialogMessage Label for the text input
25
	 * @param initialValue Initial value of the user-editable field
26
	 */
27
	public AddCheckpointDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue) {
28
		super(parentShell, dialogTitle, dialogMessage, initialValue, null);
29
	}
30
31
	/* (non-Javadoc)
32
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
33
	 */
34
	protected void okPressed() {
35
		String label = getValue();
36
		long now = System.currentTimeMillis();
37
		CheckpointBridge.addCheckpoint(new Checkpoint(label, now));
38
		super.okPressed();
39
	}
40
}
41
42
(-)compare/org/eclipse/compare/internal/ShowCheckpointsAction.java (+156 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.compare.internal;
12
13
import java.util.List;
14
import java.util.Set;
15
16
import org.eclipse.core.resources.Checkpoint;
17
import org.eclipse.core.resources.CheckpointBridge;
18
import org.eclipse.jface.action.IAction;
19
import org.eclipse.jface.viewers.ILabelProvider;
20
import org.eclipse.jface.viewers.ILabelProviderListener;
21
import org.eclipse.jface.viewers.ISelection;
22
import org.eclipse.jface.viewers.IStructuredContentProvider;
23
import org.eclipse.jface.viewers.Viewer;
24
import org.eclipse.swt.graphics.Image;
25
import org.eclipse.ui.IWorkbenchPart;
26
import org.eclipse.ui.IWorkbenchWindow;
27
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
28
import org.eclipse.ui.dialogs.ListDialog;
29
30
31
/*
32
 * The "Rollback to Checkpoint" action
33
 */
34
public class ShowCheckpointsAction implements IWorkbenchWindowActionDelegate, IStructuredContentProvider, ILabelProvider {
35
36
	private ISelection fSelection;
37
	private List fCheckpoints;
38
	private RollbackDialog dialog = null;
39
	
40
	private class RollbackDialog extends ListDialog {
41
		public RollbackDialog() {
42
			super(CompareUIPlugin.getShell());
43
		}
44
		public void okPressed() {
45
			super.okPressed();
46
			Object[] results = dialog.getResult();
47
			if (results.length > 0) {
48
				Checkpoint cp = (Checkpoint)results[0];
49
				Set[] states = CheckpointBridge.getRestoreAndDeleteFallbackStates(cp.getLastModified());
50
			}
51
		}
52
	}
53
54
	public void run(ISelection selection) {
55
		fCheckpoints = CheckpointBridge.getCheckpoints();
56
		dialog = new RollbackDialog();
57
		dialog.setTitle("Show Checkpoint");
58
		dialog.setContentProvider(this);
59
		dialog.setLabelProvider(this);
60
		dialog.setInput(fCheckpoints);
61
		dialog.setAddCancelButton(true);
62
		dialog.setMessage("Select Checkpoint");
63
		dialog.open();
64
	}
65
	
66
	/* (non-Javadoc)
67
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
68
	 */
69
	final public void run(IAction action) {
70
		run(fSelection);
71
	}
72
	
73
	/* (non-Javadoc)
74
	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
75
	 */
76
	final public void selectionChanged(IAction action, ISelection selection) {
77
		if (action != null)
78
			action.setEnabled(true);
79
	}
80
	
81
	protected boolean isEnabled(ISelection selection) {
82
		return true;
83
	}
84
85
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
86
	}
87
	
88
	// IStructuredContentProvider Interface
89
90
	/* (non-Javadoc)
91
	 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
92
	 */
93
	public Object[] getElements(Object inputElement) {
94
		return fCheckpoints.toArray();
95
	}
96
97
	/* (non-Javadoc)
98
	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
99
	 */
100
	public void dispose() {
101
	}
102
103
	/* (non-Javadoc)
104
	 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
105
	 */
106
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
107
	}
108
109
	/* (non-Javadoc)
110
	 * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
111
	 */
112
	public Image getImage(Object element) {
113
		return null;
114
	}
115
116
	/* (non-Javadoc)
117
	 * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
118
	 */
119
	public String getText(Object element) {
120
		Checkpoint cp = (Checkpoint) element;
121
		//Date date = new Date(cp.getLastModified());
122
		//String dateString = date.toString();
123
		//String label = dateString.equals(cp.getLabel()) ? "" : " -- " + cp.getLabel();
124
		//return dateString + label;
125
		return cp.getLabel();
126
	}
127
128
	/* (non-Javadoc)
129
	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
130
	 */
131
	public void addListener(ILabelProviderListener listener) {
132
		
133
	}
134
135
	/* (non-Javadoc)
136
	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
137
	 */
138
	public boolean isLabelProperty(Object element, String property) {
139
		return false;
140
	}
141
142
	/* (non-Javadoc)
143
	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
144
	 */
145
	public void removeListener(ILabelProviderListener listener) {
146
		
147
	}
148
149
	/* (non-Javadoc)
150
	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
151
	 */
152
	public void init(IWorkbenchWindow window) {
153
		// TODO Auto-generated method stub
154
		
155
	}
156
}

Return to bug 36958