私はいくつかの具体的な言葉のために私自身のテキストのホバーをEclipseで表示したいですか?私にいくつかの例を教えてくださいEclipse 3.3 Europa JDT TextHover
答えて
Koder examplesから見ることができます。
など。このあなたがこのGasSourceViewerConfiguration
またはそれを超えて、このCalcSourceViewerConfiguration
package com.example.calc.ui.editors;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.reconciler.IReconciler;
import org.eclipse.jface.text.reconciler.MonoReconciler;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
/**
* @author cdaly
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class CalcSourceViewerConfiguration extends SourceViewerConfiguration {
private CalcEditor _editor;
public CalcSourceViewerConfiguration(CalcEditor editor){
_editor = editor;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
*/
public IReconciler getReconciler(ISourceViewer sourceViewer) {
return new MonoReconciler(_editor.getReconcilingStrategy(), false);
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
*/
public ITextHover getTextHover(
ISourceViewer sourceViewer,
String contentType) {
ITextHover hover;
if (_editor != null && _editor instanceof CalcEditor) {
hover = new CalcTextHover((CalcEditor)_editor);
} else {
hover = null;
}
return hover;
}
}
ようSourceViewerConfiguration
にTextHoverを設定しますCEditorTextHoverDispatcherまたはこのUCTextHover
package com.ut2003.uceditor;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point;
public class UCTextHover implements ITextHover
{
/* (non-Javadoc)
* Method declared on ITextHover
*/
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion)
{
if (hoverRegion != null)
{
try
{
if (hoverRegion.getLength() > -1)
return textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
}
catch (BadLocationException x)
{
}
}
return "Empty Selection";
}
/* (non-Javadoc)
* Method declared on ITextHover
*/
public IRegion getHoverRegion(ITextViewer textViewer, int offset)
{
Point selection = textViewer.getSelectedRange();
if (selection.x <= offset && offset < selection.x + selection.y)
return new Region(selection.x, selection.y);
return new Region(offset, 0);
}
}
、私はあまり多くの情報を持っています:私が見つけた例は宣言型(すなわち "plugin.xml
")よりプログラム的であるため、いくつかのコードが追加されました。
もう一つの良い例:Eclipse: Rich Hovers Redux(それはしかしeclipse3.4のためですが、完全な例では、カスタムITextHoverは現在のエディタに追加されたどのようにあなたに別のヒントを与えることができます)
お返事ありがとうございました。このウィザードをJavaEditorに追加するには、どのプラグイン開発環境でどのウィザードを使用する必要がありますか? JavaEditorでこれを取得するには、どの拡張ポイントをplugin.xmlに追加する必要がありますか –
最高のものが使用することですEclipseエディタと一緒にJavaエディタプラグイン。 Eclipseヘルプ - >ようこそ - >サンプル - > Java Editorプラグイン
- 1. JDT eclipse plugin
- 2. Eclipse JDTフィールド宣言
- 3. EclipseとGalileo-MTJのEuropaの違いは?
- 4. eclipse europaの実行中の問題
- 5. Eclipse(JDT) - ウィザードのperformFinishメソッド
- 6. eclipse jdt自動メソッドスタブ生成
- 7. Eclipse JDT ITypeBindingをタイプに変換する
- 8. CDTの上にEclipse JDTをインストール
- 9. Java EE用EclipseのIndigo版とEuropa版の違い
- 10. JDTコンパイラ例外
- 11. カスタムEclipse JDT新規プロジェクトウィザードを作成しますか?
- 12. eclipse jdtで "imports"コマンドハンドラを拡張するには?
- 13. Git経由でEclipse JDT Coreをソースコードからビルドするには?
- 14. eclipseのJDTのソースを取得するには?
- 15. EclipseでASTVisitorでオーバーロードされたメソッドを解決するJDT
- 16. eclipse JDTライブラリを使用したメソッドの注釈の確認
- 17. Phonegap 3.3 Eclipse:-CordovaLibプロジェクトにAndroidプロパティがありません
- 18. EclipseインディゴにJBossツール3.3をインストールする際の問題
- 19. urllib.urlretrieve file python 3.3
- 20. Farser 3.3 DebugViewXNA - フックアップ
- 21. NHibernate 3.3とSysCache
- 22. GLSL 3.3 resources
- 23. Eclipse JDTのメソッドまたはフィールドの修飾子を特定する方法は?
- 24. Eclipse JDT:新しいエディタペインを開くためのキーボードショートカットはありますか?
- 25. Eclipse JDT Coreを使用してインポートを再定義する方法
- 26. 非Eclipse環境でEclipse JDT SDKを使用してASTを生成する際の例外
- 27. Eclipse for Java -JDT(DynWeb)では、Eclipseはデフォルトのant build.xmlを使用していますか?舞台裏で?
- 28. JavaのJDT UIは:VariableDeclarationStatement
- 29. MaximizePartActionクラスがEclipseのインディゴのorg.eclipse.ui.internalにありません
- 30. Hibernate> 3.3 and c3p0
3.3 Europaを使用している特別な理由はありますか? 3.4 Ganymedeはほぼ一歳で、3.5 Galileoのリリースに近づいています。 – Powerlord