Bug 110481 - Ability for Apply Patch wizard to work with multiple-project patches
Summary: Ability for Apply Patch wizard to work with multiple-project patches
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.2 M3   Edit
Assignee: Andre Weinand CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-23 14:44 EDT by Bogdan Gheorghe CLA
Modified: 2005-12-13 05:22 EST (History)
2 users (show)

See Also:


Attachments
Apply Patch zip (28.27 KB, application/zip)
2005-09-23 14:47 EDT, Bogdan Gheorghe CLA
no flags Details
existing layout (70.49 KB, image/jpeg)
2005-10-06 05:00 EDT, Andre Weinand CLA
no flags Details
Apply Patch Fixes (29.26 KB, patch)
2005-10-21 10:40 EDT, Bogdan Gheorghe CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bogdan Gheorghe CLA 2005-09-23 14:44:54 EDT
Here is a patch that's a companion to the Create Patch enchancements attached to
Bug# 41340.

It modifies the Apply Patch mechanism to allow it to apply workspace patches
that are created by the Create Patch wizard while preserving the ability to
still apply single selection patches.

Summary of what changes have been made

- Rearranged the Patch Wizard page ordering:

    a) InputPatchPage: Used by the user to select the location of the patch.
Depending on the type of patch that is being applied, the wizard either directs
the user to the PatchTargetPage (for single selection patches) or the
PreviewPatchPage (for workspace patches)

    b) PatchTargetPage: This page is displayed to allow the user to select the
root of the patch they wish to apply. (Single selection patch only)

    c) PreviewPatchPage: This page summarizes all of the changes that are to be
applied. For single patches everything looks like it did before. For workspace
patches, the Diffs are now contained by projects. There is also the ability to
change the projects targeted by the patch in case the projects in the patch
don't match up to the current workspace or if the user wishes to target another
project. 


- Extracted the model from the PreviewPatchPage and put it into DiffProjects,
Diffs and Hunks. Also changed some of the UI to use a JFace tree viewer. 

- Added WorkspacePatcher as a subclass of Patcher 

- Added some code to CompareUI to allow users to create own workspace patch (not
sure if there's a better place for this).

- Contributed some tests for new functionality.
Comment 1 Bogdan Gheorghe CLA 2005-09-23 14:47:55 EDT
Created attachment 27460 [details]
Apply Patch zip
Comment 2 Bogdan Gheorghe CLA 2005-09-23 16:36:30 EDT
BTW, the Create Patch portion of this has already been commited to head. So to
try this out, apply the attached patch and then start up Eclipse with the VM flag:

-DworkspacePatch=true


This enables workspace patch creation in Create Patch. To try it out, you can
select multiple projects, resources etc and create a patch (the wizard will only
allow you to create a workspace format patch if you have multiple selections).
Comment 3 Andre Weinand CLA 2005-10-06 04:59:48 EDT
I've applied the patch and it works for me. Cool stuff, thanks!

Here are some remarks:

- the layout of the first page is slightly confusing. At least on MacOS X it is not obvious that the
   workspace radio button and the workspace tree underneath it, belongs together (see attached
   screenshot). One way to fix this would be to indent the tree so that it looks "grouped" under the
   workspace button.

- I'm reluctant to add the two new API methods to CompareUI (it is already a kitchen sink :-).
   Why not create a new package org.eclipse.compare.patch for the public API of patch?
   (There are other requests to make the patcher available as API, so we could use the new package
   anyway)

- I would rename method Utilities.getResource(ISelection) to getFirstResource and keep it in
   internal.patch package by creating a local Utilities class there.

How should we proceed? Should  I release your code and you'll create new patches based on that,
or should I wait for a new patch from you?
Comment 4 Andre Weinand CLA 2005-10-06 05:00:36 EDT
Created attachment 27925 [details]
existing layout
Comment 5 Michael Valenta CLA 2005-10-06 08:45:14 EDT
I think it will be easier if you release the patch and we send you an 
additional patch with the requested modifications. That way, we can have it 
available in the next integration build and will have time to get comments 
from others before M3.
Comment 6 Andre Weinand CLA 2005-10-06 13:18:36 EDT
patch released to HEAD.
Comment 7 Bogdan Gheorghe CLA 2005-10-21 10:39:23 EDT
Here are some changes for Apply Patch relating to Bugs 110481, Bug 112169 and
Bug 112661. Changes are as follows:

From Bug 110481:
1) The workspace tree on the first page of the wizard has been indented to fall
under the Workspace selection button.

2) Created new org.eclipse.compare.patch package that has
WorkspacePatcherUI.java which contains the API needed to write out workspace
format patches.

3) Renamed Utilities.getResource(ISelection) to getFirstResource

From Bug 112169:
4) Added a check to PreviewPatchPage to make sure that users can't select Diffs
or Hunks that have problems

From Bug 112661 
5) Changed the error reporting so that no errors are shown when the dialog first
starts up (the user can't continue unless a patch is selected)

6) Changed the initial patch selection mechanism as follows:
    i) See if the resource that the user has selected to run Apply Patch on is a
patch file. If it is, select it in the workspace tree and choose the workspace
button. If not go on.

   ii) See if the clipboard contains a valid patch. If so select the clipboard
button. If not go on.

  iii) Load the persisted setting from the last time apply patch was run. (If it
has never been run, the default setting is file). If the previous option no
longer exists (ie. junk on the clipboard or workspace file has been deleted)
default to file.

7) Changed title on first page to "Select the patch location."

8) Added mnemonics to workspace trees on both the first and second pages.

9) Changed sorter in workspace trees to ResourceSorter(ResourceSorter.Name)

10) Save dialog resize settings.

Andre, if you could release this patch to HEAD sometime next week, it would give
us a chance to exercise the code before M3. Thanks!
Comment 8 Bogdan Gheorghe CLA 2005-10-21 10:40:02 EDT
Created attachment 28602 [details]
Apply Patch Fixes
Comment 9 Andre Weinand CLA 2005-10-21 16:08:09 EDT
Thanks for the patch. Looks good and works great!

Since I'll be on vacation for the next two weeks, I've already applied the patch and tagged the project for 
the next build input.

In addition I've updated component.xml for the new package and the new public type.
Comment 10 Tobias Widmer CLA 2005-12-13 05:22:48 EST
Verified using I20051213-0010

Filed additional bug 120531