aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Pontes2011-10-13 12:39:22 (EDT)
committerAnithra P Janakiraman2011-10-13 12:39:22 (EDT)
commitd18c50b53b0741b79b4cb2a38a5a7e2cd345eee3 (patch)
tree63b199a64c567c310717e7915beb36bac742d86c
parentbd0edf2447f510d07e7a759e8450f6275a0811cd (diff)
downloadorg.eclipse.linuxtools-d18c50b53b0741b79b4cb2a38a5a7e2cd345eee3.zip
org.eclipse.linuxtools-d18c50b53b0741b79b4cb2a38a5a7e2cd345eee3.tar.gz
org.eclipse.linuxtools-d18c50b53b0741b79b4cb2a38a5a7e2cd345eee3.tar.bz2
NPE when opening .h/.c file in SystemTap IDE
Null Pointer Exception is raised when opening a file in Kernel Source view in Systemtap IDE https://bugs.eclipse.org/bugs/show_bug.cgi?id=345010
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java9
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/systemtap/ui/ide/actions/hidden/KernelSourceAction.java14
2 files changed, 13 insertions, 10 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java
index 3be1d56..9c56b7f 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java
@@ -93,10 +93,11 @@ public class OpenFileAction extends EditorAction {
protected String getEditorId(File file) {
IWorkbench workbench= window.getWorkbench();
IEditorRegistry editorRegistry= workbench.getEditorRegistry();
- IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName());
- if (descriptor != null && descriptor.getId().startsWith("org.eclipse.linuxtools.systemtap.ui")) { //TODO: descriptor.getId().startsWith("org.eclipse.linuxtools.systemtap.ui") is a temparary fix until we find out why .txt files are opening with org.eclipse.ui.DefautTextEditor //$NON-NLS-1$
- return descriptor.getId();
- }
+ IEditorDescriptor[] descriptors= editorRegistry.getEditors(file.getName());
+ for (IEditorDescriptor d : descriptors)
+ if (d.getId().startsWith("org.eclipse.linuxtools.systemtap.ui.ide.editors")) {
+ return d.getId();
+ }
return SimpleEditor.ID;
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/systemtap/ui/ide/actions/hidden/KernelSourceAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/systemtap/ui/ide/actions/hidden/KernelSourceAction.java
index 30e610f..65c4811 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/systemtap/ui/ide/actions/hidden/KernelSourceAction.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/systemtap/ui/ide/actions/hidden/KernelSourceAction.java
@@ -17,6 +17,7 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.linuxtools.systemtap.ui.editor.PathEditorInput;
+import org.eclipse.linuxtools.systemtap.ui.editor.SimpleEditor;
import org.eclipse.linuxtools.systemtap.ui.ide.IDESessionSettings;
import org.eclipse.linuxtools.systemtap.ui.ide.editors.stp.STPEditor;
import org.eclipse.linuxtools.systemtap.ui.ide.internal.Localization;
@@ -119,13 +120,14 @@ public class KernelSourceAction extends Action implements ISelectionListener, IW
private String getEditorId(File file) {
IWorkbench workbench= window.getWorkbench();
IEditorRegistry editorRegistry= workbench.getEditorRegistry();
- IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName());
- if (descriptor != null) {
- LogManager.logDebug("getEditorId: returnVal-" + descriptor.getId(), this);
- return descriptor.getId();
- }
+ IEditorDescriptor[] descriptors= editorRegistry.getEditors(file.getName());
+ for (IEditorDescriptor d : descriptors)
+ if (d.getId().startsWith("org.eclipse.linuxtools.systemtap.ui.ide.editors")) {
+ LogManager.logDebug("getEditorId: returnVal-" + d.getId(), this);
+ return d.getId();
+ }
LogManager.logDebug("getEditorId: returnVal-...SimpleEditor", this);
- return "org.eclipse.linuxtools.systemtap.ui.editor.SimpleEditor";
+ return SimpleEditor.ID;
}
/**