mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
Refactoring and documentation updates complete. Still needs testing
This commit is contained in:
parent
442df758f6
commit
9f9925a2ae
@ -1,10 +0,0 @@
|
||||
package org.jetbrains.tutorials.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
|
||||
public class CustomGroupedAction extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent anActionEvent) {
|
||||
//Does nothing
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ public class DynamicActionGroup extends ActionGroup {
|
||||
* Returns an array of menu actions for the group.
|
||||
*
|
||||
* @param anActionEvent Event received when the associated group-id menu is chosen.
|
||||
* @return: AnAction[] An instance of AnAction, in this case containing a single instance of the
|
||||
* @return AnAction[] An instance of AnAction, in this case containing a single instance of the
|
||||
* SimplePopDialogAction class.
|
||||
*/
|
||||
@NotNull
|
||||
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.tutorials.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.pom.Navigatable;
|
||||
|
||||
|
||||
/**
|
||||
* Action class to demonstrate how to interact with the IntelliJ Platform when a menu entry is chosen.
|
||||
* The association between this Java class and the menu structure is declared in this module's plugin.xml file
|
||||
* @see com.intellij.openapi.actionSystem.AnAction
|
||||
* @see com.intellij.openapi.actionSystem.AnActionEvent
|
||||
*/
|
||||
public class SimpleAction extends AnAction {
|
||||
|
||||
/**
|
||||
* Takes action based on the user choosing the menu item.
|
||||
* @param anActionEvent Event received when the associated menu item is chosen.
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent anActionEvent) {
|
||||
// Using the event, get the project and navigatable objects
|
||||
Project project = anActionEvent.getProject();
|
||||
Navigatable navigatable = anActionEvent.getData(CommonDataKeys.NAVIGATABLE);
|
||||
if (project != null && navigatable != null) {
|
||||
// Pop a small dialog
|
||||
Messages.showMessageDialog(project, navigatable.toString(), "Selected Element", Messages.getInformationIcon());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this menu item is suitable for the current context.
|
||||
* @param anActionEvent Event received when the associated group-id menu is chosen.
|
||||
*/
|
||||
@Override
|
||||
public void update(AnActionEvent anActionEvent) {
|
||||
// Using the event, get the project and navigatable objects - they will be needed in actionPerformed()
|
||||
Project project = anActionEvent.getProject();
|
||||
Navigatable navigatable = anActionEvent.getData(CommonDataKeys.NAVIGATABLE);
|
||||
// Make the associated menu item both visible and enabled
|
||||
anActionEvent.getPresentation().setEnabledAndVisible(project != null && navigatable != null);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user