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 164599 Details for
Bug 308894
[EditorMgmt] NPE in PlatformUIPreferenceListener#preferenceChange(..) when changing file editor associations
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]
PlatformUIPreferenceListener patch
bug308894-patch-v1.txt (text/plain), 3.32 KB, created by
Remy Suen
on 2010-04-12 13:50:16 EDT
(
hide
)
Description:
PlatformUIPreferenceListener patch
Filename:
MIME Type:
Creator:
Remy Suen
Created:
2010-04-12 13:50:16 EDT
Size:
3.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorRegistryTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorRegistryTest.java,v >retrieving revision 1.30 >diff -u -r1.30 IEditorRegistryTest.java >--- Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorRegistryTest.java 12 Apr 2010 14:56:44 -0000 1.30 >+++ Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorRegistryTest.java 12 Apr 2010 17:49:38 -0000 >@@ -15,6 +15,8 @@ > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.ILogListener; >+import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.content.IContentType; > import org.eclipse.jface.resource.ImageDescriptor; >@@ -454,4 +456,45 @@ > } > } > >+ public void testBug308894() throws Throwable { >+ FileEditorMapping newMapping = new FileEditorMapping("*.abc"); >+ assertNull(newMapping.getDefaultEditor()); >+ >+ FileEditorMapping[] src = (FileEditorMapping[]) fReg.getFileEditorMappings(); >+ FileEditorMapping[] maps = new FileEditorMapping[src.length + 1]; >+ System.arraycopy(src, 0, maps, 0, src.length); >+ maps[maps.length - 1] = newMapping; >+ >+ final Throwable[] thrownException = new Throwable[1]; >+ ILogListener listener = new ILogListener() { >+ public void logging(IStatus status, String plugin) { >+ Throwable throwable = status.getException(); >+ if (throwable == null) { >+ thrownException[0] = new CoreException(status); >+ } else { >+ thrownException[0] = throwable; >+ } >+ } >+ }; >+ Platform.addLogListener(listener); >+ >+ try { >+ // invoke the same code that FileEditorsPreferencePage does >+ ((EditorRegistry) fReg).setFileEditorMappings(maps); >+ ((EditorRegistry) fReg).saveAssociations(); >+ PrefUtil.savePrefs(); >+ } finally { >+ // undo the change >+ ((EditorRegistry) fReg).setFileEditorMappings(src); >+ ((EditorRegistry) fReg).saveAssociations(); >+ PrefUtil.savePrefs(); >+ >+ Platform.removeLogListener(listener); >+ >+ if (thrownException[0] != null) { >+ throw thrownException[0]; >+ } >+ } >+ } >+ > } >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java,v >retrieving revision 1.27 >diff -u -r1.27 PlatformUIPreferenceListener.java >--- Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java 20 Jan 2010 17:28:54 -0000 1.27 >+++ Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java 12 Apr 2010 17:49:40 -0000 >@@ -153,7 +153,7 @@ > for (int j = 0; j < maps.length; j++) { > IFileEditorMapping fileEditorMapping = maps[j]; > IEditorDescriptor descriptor = fileEditorMapping.getDefaultEditor(); >- if (!editorMap.containsKey(descriptor.getId())) { >+ if (descriptor != null && !editorMap.containsKey(descriptor.getId())) { > editorMap.put(descriptor.getId(), descriptor); > } > }
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 308894
: 164599