如何将TextEditor与某个文件关联?(Eclipse插件开发)
我确实喜欢下面,但是错了,我无法弄明白。我看过docs
<!-- git -->
<extension
point="org.eclipse.ui.editors">
<editor
class="org.eclipse.ui.editors.text.TextEditor"
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
default="true"
extensions="gitignore,gitmodules,gitattributes"
icon="icons/git.ico"
id="org.eclipse.ui.DefaultTextEditor"
name="Text Editor">
</editor>
</extension>
org.eclipse.core.runtime.CoreException:插件gitaddon.core无法加载类org.eclipse.ui.editors.text.TextEditor。 在org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194) 在org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:176) 在org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905) 在org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243) 在org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55) 在org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:274) 在org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:235) 在org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:318) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPart(CompatibilityPart.java:266) at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPart(CompatibilityEditor.java:61) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:304) at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:601) 在org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:877) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857) 在org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:119) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:333) 在org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53) 在org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:949) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:633) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access $ 2(PartRenderingEngine.java:706) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 7.run(PartRenderingEngine.java:700) 在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:685) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl $ 1.handleEvent(PartServiceImpl.java:90) 在org.eclipse.e4.ui.services.internal.events.UIEventHandler $ 1.run(UIEventHandler.java:41) 在org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180) 在org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150) 在org.eclipse.swt.widgets.Display.syncExec(Display.java:4688) 在org.eclipse.e4.ui.internal.workbench.swt.E4Application $ 1.syncExec(E4Application.java:205) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38) 在org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197) 在org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) 在org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) 在org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) 在org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) 在org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) 在org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:80) 在org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:576) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:543) 在org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:605) 在org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:322) 在org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1028) 在org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3120) 在org.eclipse.ui.internal.WorkbenchPage.access $ 21(WorkbenchPage.java:3042) 在org.eclipse.ui.internal.WorkbenchPage $ 8.run(WorkbenchPage.java:3024) 在org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) 在org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3020) 在org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2984) 在org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2975) 在org.eclipse.ui.ide.IDE.openEditor(IDE.java:534) 在org.eclipse.ui.ide.IDE.openEditor(IDE.java:493) 在org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:360) 在org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:167) 在org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:268) 在org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:233) 在org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376) 在org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart $ 4.open(PackageExplorerPart.java:538) at org.eclipse.ui.OpenAndLinkWithEditorHelper $ InternalListener.open(OpenAndLinkWithEditorHelper.java:47) 在org.eclipse.jface.viewers.StructuredViewer $ 2.run(StructuredViewer.java:866) 在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) 在org.eclipse.ui.internal.JFaceUtil $ 1.run(JFaceUtil.java:49) 在org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) 在org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864) 在org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152) 在org.eclipse.jface.viewers.StructuredViewer $ 6.handleOpen(StructuredViewer.java:1256) 在org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275) 在org.eclipse.jface.util.OpenStrategy.access $ 2(OpenStrategy.java:269) 在org.eclipse.jface.util.OpenStrategy $ 1.handleEvent(OpenStrategy.java:309) 在org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 在org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) 在org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170) 在org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 9.run(PartRenderingEngine.java:1113) 在org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) 在org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) 在org.eclipse.ui.internal.Workbench $ 5.run(Workbench.java:610) 在org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 在org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) 在org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) 在org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) 在org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) 在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) 在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354) 在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:601) 在org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) 在org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) 在org.eclipse.equinox.launcher.Main.run(Main.java:1450) 引起:java.lang.ClassNotFoundException:gitaddon.core_0.1.0.qualifier找不到org.eclipse.ui.editors.text.TextEditor 在org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501) 在org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421) 在org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412) 在org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) 在org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:340) 在org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229) 在org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1212) 在org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174) ... 107更多
答案 0 :(得分:3)
检查您是否已指定所有必需的pre-req插件,特别是org.eclipse.ui.editors