mardi 21 avril 2015

Intelij Plugin Development add eventListener so when i press esc all line highlighters disappear

Vote count: 0

I have this code

private static void highlightElement(int lineNum,Project project,VirtualFile virtualFile) {

    final FileEditorManager editorManager =
            FileEditorManager.getInstance(project);
    final Editor editor = editorManager.getSelectedTextEditor();
    final TextAttributes textattributes = new TextAttributes(null, new Color(239, 43, 18), null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
    editor.getMarkupModel().addLineHighlighter(lineNum, HighlighterLayer.CARET_ROW, textattributes);
    editor.getMarkupModel().
    final WindowManager windowManager = WindowManager.getInstance();
    final StatusBar statusBar = windowManager.getStatusBar(project);
    statusBar.setInfo("Press Esc to remove highlighting");
}

The code works as intended but what i want is to attach an event listener so when i press esc the function editor.getMarkupModel().removeAllHighlighters(); will be called.Thank you in advance!

asked 27 secs ago



Intelij Plugin Development add eventListener so when i press esc all line highlighters disappear

Aucun commentaire:

Enregistrer un commentaire