Bug 401090 - Allow bulk reset of manually associated file editor
Summary: Allow bulk reset of manually associated file editor
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2013-02-18 09:40 EST by rgra Missing name CLA
Modified: 2014-03-19 22:22 EDT (History)
3 users (show)

See Also:


Attachments
First idea for implementation (21.82 KB, patch)
2013-03-03 13:57 EST, rgra Missing name CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rgra Missing name CLA 2013-02-18 09:40:01 EST
It should be possible to bulk-reset the default editor for a specific file which can be chosen manually via the Open With context menu actions.

For example, I might have opened a couple of Java Files with the Text Editor instead of the Java Editor. Finding and resetting them manually is a cumbersome process.

It would be nice to have a reset option on the File Association Preference Page (Prefs->General->Editors->File Assoc) to be able to remove the setting for all files of a certain type. The action should iterate over all the resources in the workspace, and call IDE.setDefaultEditor(file, null) for all matching files.
Comment 1 Paul Webster CLA 2013-02-19 19:24:00 EST
If anybody's interested in looking at this, http://wiki.eclipse.org/Platform_UI/How_to_Contribute

PW
-
Comment 2 rgra Missing name CLA 2013-02-23 15:16:46 EST
Hi, I can take it.

I would like to discuss which location would be best for the user to find the reset operation.

Putting it in the FileEditorsPreferencePage would only allow to reset the whole workspace.

If somebody likes to reset it for one project or folder only a context menu is a better option. It may also be easier to find, if it's located in the same group or if it's even a submenu action of the 'Open With' context menu.

In addition the org.eclipse.ui.workbench where the FileEditorsPreferencePage is located, currently doesn't have access to the IDE.setDefaultEditor method in the org.eclipse.ui.ide plugin. Introducing a dependency is not possible, because it would create a cycle.

Any opinions on this?
Comment 3 Paul Webster CLA 2013-02-23 15:26:21 EST
OK, try for a general context menu, the same segment that has Open With and Show In.

You want to use org.eclipse.ui.menus/menuContribution/@locationURI="popup:org.eclipse.ui.popup.any?after=<needToFindOut>"

You would use a visibleWhen on the o.e.ui.menus command contribution, so it was only visible on something that adapts to an IResource.

Then you can write a handler that processes the selection, and resets the IResources attribute on it (for an IFile) or on its children (for an IFolder/IProject).

PW
Comment 4 rgra Missing name CLA 2013-02-24 07:07:16 EST
Finding out how to contribute to the menu in this area is the difficult part.

As far as I can see it's all hard wired action groups.

Any hints?
Comment 5 Paul Webster CLA 2013-02-25 07:35:07 EST
(In reply to comment #4)
> Finding out how to contribute to the menu in this area is the difficult part.

Start with popup:org.eclipse.ui.popup.any?after=additions and we'll go from there.

PW
Comment 6 rgra Missing name CLA 2013-03-03 13:57:32 EST
Created attachment 227852 [details]
First idea for implementation
Comment 7 rgra Missing name CLA 2013-03-03 13:57:41 EST
Here's a patch with a first shot of an implementation using the context menu.

When 'Reset Editors' is selected from the context menu, a dialog pops up which asks the user to select the extensions of files which should be reset.

Please add your comments.
Comment 8 Paul Webster CLA 2013-03-04 09:36:06 EST
(In reply to comment #6)
> Created attachment 227852 [details]
> First idea for implementation

Thanks for the patch.

It looks like it was created against a local commit in your repo (it doesn't apply), as it has sections like:

diff --git a/bundles/org.eclipse.ui.ide/plugin.xml b/bundles/org.eclipse.ui.ide/plugin.xml
index 66f3bc0..1822aaf 100644
--- a/bundles/org.eclipse.ui.ide/plugin.xml
+++ b/bundles/org.eclipse.ui.ide/plugin.xml
@@ -1001,10 +1001,9 @@
       </command>
       <command
             categoryId="org.eclipse.ui.category.project"
-            defaultHandler="org.eclipse.ui.commands.ResetEditorHandler"
-            description="Reset Editor description"
-            id="org.eclipse.ui.editor.reset"
-            name="Reset Editor">
+            description="%command.editorReset.description"
+            id="org.eclipse.ui.ide.editorReset"
+            name="%command.editorReset.name">
       </command>
    </extension>


where the removed section here looks like your original test code.

One way to get into a good state would be to rebase your fix onto origin/master and then squash your commit, or in EGit use 'git reset --soft origin/master' and then create a new commit (which will contain only the changes to get to your final state from master).

Also, when you get your new commit consider using Gerrit on eclipse.platform.ui.  http://wiki.eclipse.org/Gerrit#Doing_Code_Reviews_with_Gerrit is a good link to get started.

PW
Comment 9 rgra Missing name CLA 2013-03-04 10:03:44 EST
Oh I'm sorry. I'm still struggling with GIT... Didn't even know I ever did a commit.

Seems like there are some explanations for Gerrit in the Wiki and they are all a bit different. Have to give it a closer look.
Comment 10 Paul Webster CLA 2013-03-04 19:26:25 EST
I like to config these 2 properties (I've configured SSH keys, so that's what I use for my review.url)

git config remote.review.url ssh://pwebster@git.eclipse.org:29418/platform/eclipse.platform.ui

git config remote.review.push HEAD:refs/for/master

Then if you're using EGit, you would do your work against master, and when you create your commit use the Git Staging view toolbar to add a Change-Id footer.  Then you use 'Push...' and select the "review" remote to push.  When you push, it will create a changeset on gerrit and return a URL in the dialog (like https://git.eclipse.org/r/#/c/10749/ ) that you can paste into the bug.

You can use Show In>History on your git repository to make sure your history only includes one commit against master.

PW
Comment 11 Lars Vogel CLA 2014-03-19 22:22:30 EDT
We have not received any update here in a while. I mark that as WONTFIX, please reopen if you intend to work on this with a Gerrit review.