Task #3501
Mis à jour par Matthieu Decorde il y a presque 2 ans
h3. 1) don't produce a stacktrace if not installed
When the "XML editor" extension is not installed, calling the "File > Edit file..." command produces the following stacktrace:
<pre>
org.eclipse.ui.PartInitException: Unable to open editor, unknown editor ID: 'org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart'
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3157)
at org.eclipse.ui.internal.WorkbenchPage.lambda$9(WorkbenchPage.java:3100)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3098)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3068)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3059)
at org.txm.rcp.handlers.files.EditFile.openfile(EditFile.java:108)
at org.txm.rcp.handlers.files.EditFile.openfile(EditFile.java:122)
at org.txm.rcp.handlers.files.EditFile.execute(EditFile.java:80)
...
at org.txm.rcp.Application.startDesktop(Application.java:278)
at org.txm.rcp.Application.start(Application.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
</pre>
h3. Solution
Detect if the XML Editor is not installed and use the text editor if necessary
When the "XML editor" extension is not installed, calling the "File > Edit file..." command produces the following stacktrace:
<pre>
org.eclipse.ui.PartInitException: Unable to open editor, unknown editor ID: 'org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart'
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3157)
at org.eclipse.ui.internal.WorkbenchPage.lambda$9(WorkbenchPage.java:3100)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3098)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3068)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3059)
at org.txm.rcp.handlers.files.EditFile.openfile(EditFile.java:108)
at org.txm.rcp.handlers.files.EditFile.openfile(EditFile.java:122)
at org.txm.rcp.handlers.files.EditFile.execute(EditFile.java:80)
...
at org.txm.rcp.Application.startDesktop(Application.java:278)
at org.txm.rcp.Application.start(Application.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
</pre>
h3. Solution
Detect if the XML Editor is not installed and use the text editor if necessary