命令处理程序不响应 EditorSelectionDialog
Command Handler not responding for EditorSelectionDialog
我正在构建我的自定义编辑器。但是当我右键单击我想要的文件并尝试通过 "Open With" 选项使用自定义编辑器打开它时,我的命令处理程序不起作用。我必须在 menuContribution 标签下使用 locationURI 在 [=26 中使用 commandId =]为了这个?如果是那么怎么办?请查看我当前的 plugin.xml 以便更好地理解。
Plugin.xml
<extension point="org.eclipse.ui.editors">
<editor
class="launcher.ChartEditor"
default="false"
id="launcher.ChartEditor"
name="ChartEditor">
</editor>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
id="launcher.openChartEditor"
name="OpenChartEditor">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="launcher.ChartEditorHandler"
commandId="launcher.openChartEditor">
</handler>
</extension>
'Open With...'菜单直接打开编辑器。它不使用任何命令或处理程序。没有其他方法可以为 'Open With' 菜单做贡献。 EditorSelectionDialog
也是一样。
要使用您的命令和处理程序,您确实需要使用 menuContribution(或工具栏贡献),但这必须使用 Open With 以外的其他地方。
标准 'Open With' 操作打开选定的编辑器,将当前选择的 IEditorInput
传递给它。这通常是一个 IFileEditorInput
,您可以从中获取文件。
我正在构建我的自定义编辑器。但是当我右键单击我想要的文件并尝试通过 "Open With" 选项使用自定义编辑器打开它时,我的命令处理程序不起作用。我必须在 menuContribution 标签下使用 locationURI 在 [=26 中使用 commandId =]为了这个?如果是那么怎么办?请查看我当前的 plugin.xml 以便更好地理解。
Plugin.xml
<extension point="org.eclipse.ui.editors">
<editor
class="launcher.ChartEditor"
default="false"
id="launcher.ChartEditor"
name="ChartEditor">
</editor>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
id="launcher.openChartEditor"
name="OpenChartEditor">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="launcher.ChartEditorHandler"
commandId="launcher.openChartEditor">
</handler>
</extension>
'Open With...'菜单直接打开编辑器。它不使用任何命令或处理程序。没有其他方法可以为 'Open With' 菜单做贡献。 EditorSelectionDialog
也是一样。
要使用您的命令和处理程序,您确实需要使用 menuContribution(或工具栏贡献),但这必须使用 Open With 以外的其他地方。
标准 'Open With' 操作打开选定的编辑器,将当前选择的 IEditorInput
传递给它。这通常是一个 IFileEditorInput
,您可以从中获取文件。