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 156569 Details for
Bug 193361
[EditorMgmt] Unexpected behaviour opening sample XML editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
EditorRegistry patch v1
bug193361-patch-v1.txt (text/plain), 6.20 KB, created by
Remy Suen
on 2010-01-19 16:26:35 EST
(
hide
)
Description:
EditorRegistry patch v1
Filename:
MIME Type:
Creator:
Remy Suen
Created:
2010-01-19 16:26:35 EST
Size:
6.20 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/EditorTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/EditorTests.java,v >retrieving revision 1.7 >diff -u -r1.7 EditorTests.java >--- Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/EditorTests.java 8 May 2006 20:51:33 -0000 1.7 >+++ Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/EditorTests.java 19 Jan 2010 21:23:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2006 IBM Corporation and others. >+ * Copyright (c) 2004, 2010 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 >@@ -19,6 +19,7 @@ > import org.eclipse.core.resources.IWorkspace; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.content.IContentType; > import org.eclipse.ui.IEditorDescriptor; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IEditorRegistry; >@@ -83,15 +84,23 @@ > assertEquals(0, window.getActivePage().getEditors().length); > } > >- public void testEditorProperties() { >+ public void testEditorProperties() throws Exception { > IEditorRegistry registry = WorkbenchPlugin.getDefault().getEditorRegistry(); > > assertNull(registry.findEditor(EDITOR_ID)); > getBundle(); >+ >+ IFile file = getFile("test.xml"); >+ IContentType contentType = IDE.getContentType(file); > IEditorDescriptor desc = registry.findEditor(EDITOR_ID); > assertNotNull(desc); > > testEditorProperties(desc); >+ >+ // tests bug 193361 >+ IEditorDescriptor descriptor = registry.getDefaultEditor(file.getName(), contentType); >+ assertEquals(desc, descriptor); >+ > removeBundle(); > assertNull(registry.findEditor(EDITOR_ID)); > try { >@@ -111,16 +120,20 @@ > assertNotNull(desc.getImageDescriptor()); > } > >+ private IFile getFile() throws CoreException { >+ return getFile("someFile"); >+ } >+ > /** > * > */ >- private IFile getFile() throws CoreException { >+ private IFile getFile(String fileName) throws CoreException { > IWorkspace workspace = ResourcesPlugin.getWorkspace(); > IProject testProject = workspace.getRoot().getProject(getName()); > testProject.create(null); > testProject.open(null); > >- IFile iFile = testProject.getFile("someFile"); >+ IFile iFile = testProject.getFile(fileName); > iFile.create(new ByteArrayInputStream(new byte[] { '\n' }), true, null); > return iFile; > } >Index: data/org.eclipse.newEditor1/plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/data/org.eclipse.newEditor1/plugin.xml,v >retrieving revision 1.4 >diff -u -r1.4 plugin.xml >--- data/org.eclipse.newEditor1/plugin.xml 15 Dec 2004 15:22:09 -0000 1.4 >+++ data/org.eclipse.newEditor1/plugin.xml 19 Jan 2010 21:23:37 -0000 >@@ -17,6 +17,7 @@ > id="testDynamicEditorAddition" > point="org.eclipse.ui.editors"> > <editor >+ extensions="xml" > icon="anything.gif" > class="org.eclipse.ui.dynamic.DynamicEditor" > default="false" >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java,v >retrieving revision 1.62 >diff -u -r1.62 EditorRegistry.java >--- Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java 25 May 2009 20:52:15 -0000 1.62 >+++ Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java 19 Jan 2010 21:23:39 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 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 >@@ -1522,7 +1522,15 @@ > } > } > >- if (type != null) { >+ if (type == null) { >+ // add all non-default editors to the list >+ for (Iterator i = nonDefaultFileEditors.iterator(); i.hasNext();) { >+ IEditorDescriptor editor = (IEditorDescriptor) i.next(); >+ if (!allRelated.contains(editor) && !WorkbenchActivityHelper.filterItem(editor)) { >+ allRelated.add(editor); >+ } >+ } >+ } else { > // now add any objects directly related to the content type > related = registry.getRelatedObjects(type); > for (int i = 0; i < related.length; i++) { >@@ -1535,10 +1543,16 @@ > } > } > >- } >+ // add all non-default editors to the list >+ for (Iterator i = nonDefaultFileEditors.iterator(); i.hasNext();) { >+ IEditorDescriptor editor = (IEditorDescriptor) i.next(); >+ if (!allRelated.contains(editor) && !WorkbenchActivityHelper.filterItem(editor)) { >+ allRelated.add(editor); >+ } >+ } > >- if (type != null) { >- // now add any indirectly related objects, walking up the content type hierarchy >+ // now add any indirectly related objects, walking up the >+ // content type hierarchy > while ((type = type.getBaseType()) != null) { > related = registry.getRelatedObjects(type); > for (int i = 0; i < related.length; i++) { >@@ -1552,14 +1566,6 @@ > } > } > } >- >- // add all non-default editors to the list >- for (Iterator i = nonDefaultFileEditors.iterator(); i.hasNext();) { >- IEditorDescriptor editor = (IEditorDescriptor) i.next(); >- if (!allRelated.contains(editor) && !WorkbenchActivityHelper.filterItem(editor)) { >- allRelated.add(editor); >- } >- } > > return (IEditorDescriptor []) allRelated.toArray(new IEditorDescriptor [allRelated > .size()]);
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 193361
: 156569