diff options
| author | Dani Megert | 2012-02-16 12:54:30 +0000 |
|---|---|---|
| committer | Dani Megert | 2012-02-16 12:54:30 +0000 |
| commit | f7268f96eae63b59417d549ac52118debeb45065 (patch) | |
| tree | ca7cba246229e235ea64ecdcd5a056d413a8b58e | |
| parent | dfa5524ee743fc0bd7cf46f0b3941c8290bea128 (diff) | |
| download | eclipse.platform.team-R36x_v20120216.tar.gz eclipse.platform.team-R36x_v20120216.tar.xz eclipse.platform.team-R36x_v20120216.zip | |
Fixed bug 251776: [Content Type] Need a better way to arbitrate contentR36x_v20120216
types and/or editor associations
3 files changed, 21 insertions, 12 deletions
diff --git a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF index eff5a91e0..a4a734656 100644 --- a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.team.ui; singleton:=true -Bundle-Version: 3.5.102.qualifier +Bundle-Version: 3.5.103.qualifier Bundle-Activator: org.eclipse.team.internal.ui.TeamUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java index 6c035f601..81076c49a 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1113,21 +1113,28 @@ public class Utils { } public static IEditorDescriptor[] getEditors(IFileRevision revision) { + String name= revision.getName(); IEditorRegistry registry = PlatformUI.getWorkbench() .getEditorRegistry(); // so far only the revision name is used to find editors - return registry.getEditors(revision.getName()/*, getContentType(revision) */); + IEditorDescriptor[] editorDescs= registry.getEditors(name/* , getContentType(revision) */); + return IDE.overrideEditorAssociations(name, null, editorDescs); } public static IEditorDescriptor getDefaultEditor(IFileRevision revision) { + String name= revision.getName(); // so far only the revision name is used to find the default editor - IEditorRegistry registry = PlatformUI.getWorkbench() - .getEditorRegistry(); - return registry.getDefaultEditor(revision.getName()/*, getContentType(revision) */); + try { + return IDE.getEditorDescriptor(name); + } catch (PartInitException e) { + // Fallback to old way of getting the editor + IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry(); + return registry.getDefaultEditor(name); + } } private static String getEditorId(FileRevisionEditorInput editorInput) { - String id = getEditorId(editorInput.getFileRevision().getName(), getContentType(editorInput)); + String id= getEditorId(editorInput, getContentType(editorInput)); return id; } @@ -1165,9 +1172,11 @@ public class Utils { return type; } - private static String getEditorId(String fileName, IContentType type) { + private static String getEditorId(FileRevisionEditorInput editorInput, IContentType type) { + String fileName= editorInput.getFileRevision().getName(); IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry(); IEditorDescriptor descriptor = registry.getDefaultEditor(fileName, type); + IDE.overrideDefaultEditorAssociation(editorInput, type, descriptor); String id; if (descriptor == null || descriptor.isOpenExternal()) { id = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java index 948f5bd38..c9c93340e 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -297,15 +297,15 @@ public class OpenWithMenu extends ContributionItem { job.setSystem(true); job.schedule();*/ - createDefaultMenuItem(menu, fileRevision); + createDefaultMenuItem(menu, fileRevision, preferredEditor == null); // add Other... menu item createOtherMenuItem(menu); } - public void createDefaultMenuItem(Menu menu, final IFileRevision revision) { + public void createDefaultMenuItem(Menu menu, final IFileRevision revision, boolean markAsSelected) { final MenuItem menuItem = new MenuItem(menu, SWT.RADIO); - menuItem.setSelection(Utils.getDefaultEditor(revision) == null); + menuItem.setSelection(markAsSelected); menuItem .setText(TeamUIMessages.LocalHistoryPage_OpenWithMenu_DefaultEditorDescription); |
