Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/691151cc-3da4-800f-9b7c-81b0e0d10369
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== ### ==== まず最初に確認すべきポイントです。 存在場所: <syntaxhighlight>src/ └ com/example/aiassist/handlers/AISuggestHandler.java </syntaxhighlight> クラス宣言: <syntaxhighlight lang="java">package com.example.aiassist.handlers; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.handlers.HandlerUtil; public class AISuggestHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); MessageDialog.openInformation( window.getShell(), "AI Suggest", "ショートカットキーが押されました!" ); return null; } } </syntaxhighlight> このクラスが存在していない/パッケージ名が異なると、Eclipseがハンドラを読み込めません。 ===== 開発中のハンドラでは UI 関連(org.eclipse.ui)を使うため、 ===== MANIFEST.MF の Require-Bundle: に <code>org.eclipse.ui</code> が必要です。 例: <syntaxhighlight lang="text">Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime </syntaxhighlight> もし抜けている場合は追加して保存してください。 ===== すでに話したように build.properties に以下の行があるか再確認してください。 ===== <syntaxhighlight lang="properties">bin.includes = META-INF/,\ plugin.xml,\ . </syntaxhighlight> ===== 「AI補完プラグイン」を実行する際は、 ===== 通常の Java アプリとしてではなく、Eclipse Application として起動します。 ====== 1. メニュー → [Run] → [Run Configurations…] ====== # 左ペインから Eclipse Application を選択 # 新しい構成を作成 # [Run] を押す これで「別の Eclipse(テスト用)」が立ち上がります。 その中でショートカットキー(Ctrl+Shift+Z)を押して確認してください。 ===== Ctrl+Shift+Z は「Redo(やり直し)」に割り当てられています。 ===== 競合しているため、あなたのプラグインが呼ばれていない可能性が高いです。 別のキー(未使用)に変えましょう。 例えば: <syntaxhighlight lang="xml"><key commandId="com.example.aiassist.commands.request" contextId="org.eclipse.ui.contexts.window" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" sequence="M1+M2+Y"> </key> </syntaxhighlight> → これで Ctrl+Shift+Y になります。 ===== contextId によって「どの場面でショートカットが有効か」が決まります。 ===== 今の設定: <syntaxhighlight lang="xml">contextId="org.eclipse.ui.contexts.window" </syntaxhighlight> は「Eclipse 全体」で有効な設定なので通常OKですが、 もしエディタ内だけに限定したい場合は: <syntaxhighlight lang="xml">contextId="org.eclipse.ui.textEditorScope" </syntaxhighlight> に変更できます。
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)