Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 8368 Details for
Bug 36958
[plan item] Support workspace checkpoint and rollback
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to org.eclipse.compare
org.eclipse.compare.checkpoints (text/plain), 16.52 KB, created by
Chris Tilt
on 2004-03-05 16:19:51 EST
(
hide
)
Description:
Patch to org.eclipse.compare
Filename:
MIME Type:
Creator:
Chris Tilt
Created:
2004-03-05 16:19:51 EST
Size:
16.52 KB
patch
obsolete
>Index: .classpath >=================================================================== >RCS file: /home/eclipse/org.eclipse.compare/.classpath,v >retrieving revision 1.18 >diff -u -r1.18 .classpath >--- .classpath 1 Dec 2003 11:26:05 -0000 1.18 >+++ .classpath 5 Mar 2004 21:11:50 -0000 >@@ -1,7 +1,7 @@ > <?xml version="1.0" encoding="UTF-8"?> > <classpath> > <classpathentry kind="src" path="compare"/> >- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> > <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> >+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> > <classpathentry kind="output" path="bin"/> > </classpath> >Index: plugin.properties >=================================================================== >RCS file: /home/eclipse/org.eclipse.compare/plugin.properties,v >retrieving revision 1.59 >diff -u -r1.59 plugin.properties >--- plugin.properties 9 Feb 2004 14:50:01 -0000 1.59 >+++ plugin.properties 5 Mar 2004 21:11:50 -0000 >@@ -65,7 +65,6 @@ > Command.selectPreviousChange.name= Select Previous Change > Command.selectPreviousChange.description= Select Previous Change > >- > # > # Context menu & actions > # >@@ -153,6 +152,13 @@ > action.Previous.tooltip=Go to Previous Difference > action.Previous.image=elcl16/prev_nav.gif > >+action.CheckpointActionSet.label=Checkpoints >+action.CheckpointActionSet.description=Commands for adding and restoring from checkpoints >+action.ShowCheckpoints.label=&Show Checkpoints... >+action.ShowCheckpoints.tooltip=Rollback resource changes to selected checkpoint >+action.AddCheckpoint.label=&Create Checkpoint... >+action.AddCheckpoint.tooltip=Add a labeled Checkpoint as a future rollback target >+ > # > # Built in Structure Creators > # >@@ -197,3 +203,11 @@ > ValidateEdit.error.unable_to_perform= Operation can\'t be performed. > ValidateEdit.error.fileModified= File ''{0}'' has been modified since the beginning of the operation. > ValidateEdit.error.stillReadonly= File ''{0}'' is readonly. >+ >+# >+# Checkpoint Context Menu >+# >+CompareWithCheckpointAction.label=Checkpoint... >+CompareWithCheckpointAction.tooltip=Compare Checkpoint resources to workspace resources >+ReplaceWithCheckpointAction.label=Checkpoint... >+ReplaceWithCheckpointAction.tooltip=Replace workspace resources with checkpointed versions >Index: plugin.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.compare/plugin.xml,v >retrieving revision 1.42 >diff -u -r1.42 plugin.xml >--- plugin.xml 27 Feb 2004 11:46:55 -0000 1.42 >+++ plugin.xml 5 Mar 2004 21:11:51 -0000 >@@ -31,6 +31,36 @@ > <extension-point id="contentViewers" name="%contentViewers" schema="schema/contentViewers.exsd"/> > > <!-- Extensions --> >+ >+<!-- Project menu additions for Checkpoints --> >+<!-- invisible by default --> >+ >+ <extension >+ point="org.eclipse.ui.actionSets"> >+ <actionSet >+ label="%action.CheckpointActionSet.label" >+ description="%action.CheckpointActionSet.description" >+ visible="false" >+ id="org.eclipse.compare.CheckpointActionSet"> >+ <action >+ definitionId="org.eclipse.compare.ui.project.addcheckpoint" >+ label="%action.AddCheckpoint.label" >+ tooltip="%action.AddCheckpoint.tooltip" >+ class="org.eclipse.compare.internal.AddCheckpointAction" >+ menubarPath="project/additions" >+ retarget="true" >+ id="addCheckpointAction"> >+ </action> >+ <action >+ definitionId="org.eclipse.compare.ui.project.showcheckpoints" >+ label="%action.ShowCheckpoints.label" >+ tooltip="%action.ShowCheckpoints.tooltip" >+ class="org.eclipse.compare.internal.ShowCheckpointsAction" >+ menubarPath="project/additions" >+ id="showCheckpointsAction"> >+ </action> >+ </actionSet> >+ </extension> > <extension > point="org.eclipse.ui.fontDefinitions"> > <fontDefinition >@@ -153,11 +183,33 @@ > configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> > </keyBinding> > </extension> >+ <!-- Compare/Replace With -> Checkpoint... popup menus --> > <extension > point="org.eclipse.ui.popupMenus"> > <objectContribution > objectClass="org.eclipse.core.resources.IResource" > adaptable="true" >+ id="org.eclipse.compare.CheckpointAction"> >+ <action >+ label="%CompareWithCheckpointAction.label" >+ tooltip="%CompareWithCheckpointAction.tooltip" >+ class="org.eclipse.compare.internal.ShowCheckpointsAction" >+ menubarPath="compareWithMenu/compareWithGroup" >+ enablesFor="1" >+ id="CompareWithCheckointAction"> >+ </action> >+ <action >+ label="%ReplaceWithCheckpointAction.label" >+ tooltip="%ReplaceWithCheckpointAction.tooltip" >+ class="org.eclipse.compare.internal.ShowCheckpointsAction" >+ menubarPath="replaceWithMenu/replaceWithGroup" >+ enablesFor="1" >+ id="ReplaceWithCheckointAction"> >+ </action> >+ </objectContribution> >+ <objectContribution >+ objectClass="org.eclipse.core.resources.IResource" >+ adaptable="true" > id="org.eclipse.compare.CompareAction"> > <menu > label="%ReplaceWithMenu.label" >@@ -298,5 +350,4 @@ > id="org.eclipse.compare.TextViewerCreator"> > </viewer> > </extension> >- > </plugin> >Index: compare/org/eclipse/compare/internal/AddCheckpointAction.java >=================================================================== >RCS file: compare/org/eclipse/compare/internal/AddCheckpointAction.java >diff -N compare/org/eclipse/compare/internal/AddCheckpointAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compare/org/eclipse/compare/internal/AddCheckpointAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,73 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2004 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.compare.internal; >+ >+import java.util.Date; >+ >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.IWorkbenchWindowActionDelegate; >+ >+ >+/* >+ * The "Compare with each other" action >+ */ >+public class AddCheckpointAction implements IWorkbenchWindowActionDelegate { >+ >+ private ISelection fSelection; >+ private AddCheckpointDialog dialog; >+ >+ public void run(ISelection selection) { >+ long time = System.currentTimeMillis(); >+ Date date = new Date(time); >+ dialog = new AddCheckpointDialog(CompareUIPlugin.getShell(), >+ CompareMessages.getString("AddCheckpointAction.0"), //$NON-NLS-1$ >+ CompareMessages.getString("AddCheckpointAction.1"), //$NON-NLS-1$ >+ date.toString()); >+ >+ dialog.open(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ */ >+ final public void run(IAction action) { >+ run(fSelection); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) >+ */ >+ final public void selectionChanged(IAction action, ISelection selection) { >+ if (action != null) >+ action.setEnabled(true); >+ } >+ >+ protected boolean isEnabled(ISelection selection) { >+ return true; >+ } >+ >+ public void setActivePart(IAction action, IWorkbenchPart targetPart) { >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() >+ */ >+ public void dispose() { >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) >+ */ >+ public void init(IWorkbenchWindow window) { >+ // TODO Auto-generated method stub >+ } >+} >Index: compare/org/eclipse/compare/internal/AddCheckpointAction.properties >=================================================================== >RCS file: compare/org/eclipse/compare/internal/AddCheckpointAction.properties >diff -N compare/org/eclipse/compare/internal/AddCheckpointAction.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compare/org/eclipse/compare/internal/AddCheckpointAction.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2 @@ >+AddCheckpointAction.0=Create a Checkpoint >+AddCheckpointAction.1=Checkpoint Label >Index: compare/org/eclipse/compare/internal/AddCheckpointDialog.java >=================================================================== >RCS file: compare/org/eclipse/compare/internal/AddCheckpointDialog.java >diff -N compare/org/eclipse/compare/internal/AddCheckpointDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compare/org/eclipse/compare/internal/AddCheckpointDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,42 @@ >+/******************************************************************************* >+ * 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.compare.internal; >+ >+import org.eclipse.core.resources.Checkpoint; >+import org.eclipse.core.resources.CheckpointBridge; >+import org.eclipse.jface.dialogs.InputDialog; >+import org.eclipse.swt.widgets.Shell; >+ >+public class AddCheckpointDialog extends InputDialog { >+ >+ /** >+ * Create a checkpoint dialog with specified attributes. >+ * @param parentShell SWT parent Shell >+ * @param dialogTitle Text appearing in dialog's title bar >+ * @param dialogMessage Label for the text input >+ * @param initialValue Initial value of the user-editable field >+ */ >+ public AddCheckpointDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue) { >+ super(parentShell, dialogTitle, dialogMessage, initialValue, null); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.Dialog#okPressed() >+ */ >+ protected void okPressed() { >+ String label = getValue(); >+ long now = System.currentTimeMillis(); >+ CheckpointBridge.addCheckpoint(new Checkpoint(label, now)); >+ super.okPressed(); >+ } >+} >+ >+ >Index: compare/org/eclipse/compare/internal/ShowCheckpointsAction.java >=================================================================== >RCS file: compare/org/eclipse/compare/internal/ShowCheckpointsAction.java >diff -N compare/org/eclipse/compare/internal/ShowCheckpointsAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compare/org/eclipse/compare/internal/ShowCheckpointsAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,156 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 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.compare.internal; >+ >+import java.util.List; >+import java.util.Set; >+ >+import org.eclipse.core.resources.Checkpoint; >+import org.eclipse.core.resources.CheckpointBridge; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.viewers.ILabelProvider; >+import org.eclipse.jface.viewers.ILabelProviderListener; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.IStructuredContentProvider; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.IWorkbenchWindowActionDelegate; >+import org.eclipse.ui.dialogs.ListDialog; >+ >+ >+/* >+ * The "Rollback to Checkpoint" action >+ */ >+public class ShowCheckpointsAction implements IWorkbenchWindowActionDelegate, IStructuredContentProvider, ILabelProvider { >+ >+ private ISelection fSelection; >+ private List fCheckpoints; >+ private RollbackDialog dialog = null; >+ >+ private class RollbackDialog extends ListDialog { >+ public RollbackDialog() { >+ super(CompareUIPlugin.getShell()); >+ } >+ public void okPressed() { >+ super.okPressed(); >+ Object[] results = dialog.getResult(); >+ if (results.length > 0) { >+ Checkpoint cp = (Checkpoint)results[0]; >+ Set[] states = CheckpointBridge.getRestoreAndDeleteFallbackStates(cp.getLastModified()); >+ } >+ } >+ } >+ >+ public void run(ISelection selection) { >+ fCheckpoints = CheckpointBridge.getCheckpoints(); >+ dialog = new RollbackDialog(); >+ dialog.setTitle("Show Checkpoint"); >+ dialog.setContentProvider(this); >+ dialog.setLabelProvider(this); >+ dialog.setInput(fCheckpoints); >+ dialog.setAddCancelButton(true); >+ dialog.setMessage("Select Checkpoint"); >+ dialog.open(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ */ >+ final public void run(IAction action) { >+ run(fSelection); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) >+ */ >+ final public void selectionChanged(IAction action, ISelection selection) { >+ if (action != null) >+ action.setEnabled(true); >+ } >+ >+ protected boolean isEnabled(ISelection selection) { >+ return true; >+ } >+ >+ public void setActivePart(IAction action, IWorkbenchPart targetPart) { >+ } >+ >+ // IStructuredContentProvider Interface >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) >+ */ >+ public Object[] getElements(Object inputElement) { >+ return fCheckpoints.toArray(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IContentProvider#dispose() >+ */ >+ public void dispose() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) >+ */ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) >+ */ >+ public Image getImage(Object element) { >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) >+ */ >+ public String getText(Object element) { >+ Checkpoint cp = (Checkpoint) element; >+ //Date date = new Date(cp.getLastModified()); >+ //String dateString = date.toString(); >+ //String label = dateString.equals(cp.getLabel()) ? "" : " -- " + cp.getLabel(); >+ //return dateString + label; >+ return cp.getLabel(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) >+ */ >+ public void addListener(ILabelProviderListener listener) { >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) >+ */ >+ public boolean isLabelProperty(Object element, String property) { >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) >+ */ >+ public void removeListener(ILabelProviderListener listener) { >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) >+ */ >+ public void init(IWorkbenchWindow window) { >+ // TODO Auto-generated method stub >+ >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 36958
: 8368 |
8369