mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
[code] EditorIllustration action
This commit is contained in:
parent
69939f0e8a
commit
2d63aafd52
@ -25,7 +25,10 @@
|
|||||||
</project-components>
|
</project-components>
|
||||||
|
|
||||||
<actions>
|
<actions>
|
||||||
<!-- Add your actions here -->
|
<action id="EditorBasics.EditorIllustration" class="org.jetbrains.plugins.editor.basics.EditorIllustration" text="Editor Basics"
|
||||||
|
description="Illustrates how to plug an action in">
|
||||||
|
<add-to-group group-id="EditorPopupMenu" anchor="last"/>
|
||||||
|
</action>
|
||||||
</actions>
|
</actions>
|
||||||
|
|
||||||
</idea-plugin>
|
</idea-plugin>
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.jetbrains.plugins.editor.basics;
|
||||||
|
|
||||||
|
import com.intellij.openapi.actionSystem.AnAction;
|
||||||
|
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||||
|
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||||
|
import com.intellij.openapi.editor.Editor;
|
||||||
|
import com.intellij.openapi.project.Project;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Anna Bulenkova
|
||||||
|
*/
|
||||||
|
public class EditorIllustration extends AnAction {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(AnActionEvent anActionEvent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void update(AnActionEvent e) {
|
||||||
|
final Project project = e.getData(LangDataKeys.PROJECT);
|
||||||
|
final Editor editor = e.getData(LangDataKeys.EDITOR);
|
||||||
|
e.getPresentation().setVisible((project != null && editor != null && editor.getSelectionModel().hasSelection()));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user