本文整理汇总了Java中com.intellij.openapi.actionSystem.Presentation.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Presentation.isEnabled方法的具体用法?Java Presentation.isEnabled怎么用?Java Presentation.isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.actionSystem.Presentation
的用法示例。
在下文中一共展示了Presentation.isEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(final AnActionEvent e) {
super.update(e);
Presentation presentation = e.getPresentation();
boolean enabled = presentation.isEnabled();
boolean selected = false;
if (enabled) {
final EditorEx editor = (EditorEx) CommonDataKeys.EDITOR.getData(e.getDataContext());
if (editor != null) {
LineSelectionManager manager = LineSelectionManager.getInstance(editor);
RangeLimitedCaretSpawningHandler spawningHandler = manager.getCaretSpawningHandler();
if (spawningHandler != null && !spawningHandler.isBackwards()) {
selected = true;
}
}
}
presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);
e.getPresentation().setVisible(!ApplicationSettings.getInstance().isHideDisabledButtons() || e.getPresentation().isEnabled());
}
示例2: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(final AnActionEvent e) {
super.update(e);
Presentation presentation = e.getPresentation();
boolean enabled = presentation.isEnabled();
boolean selected = false;
if (enabled) {
final EditorEx editor = (EditorEx) CommonDataKeys.EDITOR.getData(e.getDataContext());
if (editor != null) {
LineSelectionManager manager = LineSelectionManager.getInstance(editor);
RangeLimitedCaretSpawningHandler spawningHandler = manager.getCaretSpawningHandler();
if (spawningHandler != null && spawningHandler.isBackwards()) {
selected = true;
}
}
}
presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);
e.getPresentation().setVisible(!ApplicationSettings.getInstance().isHideDisabledButtons() || e.getPresentation().isEnabled());
}
示例3: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
super.update(e);
final Presentation presentation = e.getPresentation();
if(presentation.isEnabled()) {
final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
final Project project = e.getProject();
if (view != null && project != null) {
ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
PsiDirectory[] dirs = view.getDirectories();
for (PsiDirectory dir : dirs) {
if (projectFileIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) &&
JavaDirectoryService.getInstance().getPackage(dir) != null && isValidForClass(project,dir)) {
return;
}
}
}
presentation.setEnabled(false);
presentation.setVisible(false);
}
}
示例4: setEnabledForNode
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
/**
* Sets the enabled/disabled action property depending on the node type and whether the node is executable.
*
* @param selectedNodes Selected nodes in the repository view tree.
* @param presentation {@link Presentation} The specific place in the user interface of the action.
* @param executableCondition True for nodes that can be executed. False otherwise.
* @see NodeType
* @see DefaultMutableTreeNode
*/
private static void setEnabledForNode(final DefaultMutableTreeNode[] selectedNodes, final Presentation presentation,
final boolean executableCondition) {
if (ArrayUtils.isEmpty(selectedNodes)) {
presentation.setEnabled(false);
return;
}
boolean currentEnabled = presentation.isEnabled();
for (DefaultMutableTreeNode selectedNode : selectedNodes) {
Object userObject = selectedNode.getUserObject();
currentEnabled = ((Node) userObject).getType() == NodeType.SPECIFICATION;
if (!currentEnabled || (executableCondition && !((SpecificationNode) userObject).isExecutable())) {
currentEnabled = false;
break;
}
}
presentation.setEnabled(currentEnabled);
}
示例5: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
protected void update(final VcsContext vcsContext, final Presentation presentation) {
super.update(vcsContext, presentation);
if (presentation.isVisible() && presentation.isEnabled()) {
final ChangeList[] selectedChangeLists = vcsContext.getSelectedChangeLists();
final Change[] selectedChanges = vcsContext.getSelectedChanges();
if (vcsContext.getPlace().equals(ActionPlaces.CHANGES_VIEW_POPUP)) {
if (selectedChangeLists != null && selectedChangeLists.length > 0) {
presentation.setEnabled(selectedChangeLists.length == 1 && !ContainerUtil.isEmpty(selectedChangeLists[0].getChanges()));
}
else {
presentation.setEnabled (selectedChanges != null && selectedChanges.length > 0);
}
}
if (presentation.isEnabled() && selectedChanges != null) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(vcsContext.getProject());
for(Change c: selectedChanges) {
if (c.getFileStatus() == FileStatus.HIJACKED && changeListManager.getChangeList(c) == null) {
presentation.setEnabled(false);
break;
}
}
}
}
}
示例6: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(final AnActionEvent e) {
super.update(e);
final Project project = e.getData(CommonDataKeys.PROJECT);
final Presentation presentation = e.getPresentation();
if (presentation.isEnabled()) {
final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
if (view != null) {
final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
final PsiDirectory[] dirs = view.getDirectories();
for (final PsiDirectory dir : dirs) {
if (projectFileIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) && JavaDirectoryService.getInstance().getPackage(dir) != null) {
return;
}
}
}
presentation.setEnabled(false);
presentation.setVisible(false);
}
}
示例7: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
StudyUtils.updateAction(e);
if (presentation.isEnabled()) {
updateDescription(e);
presentation.setEnabled(!myCheckInProgress.get());
}
}
示例8: executeAction
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public static void executeAction(String actionId, InputEvent e) {
ActionManager actionManager = ActionManager.getInstance();
AnAction action = actionManager.getAction(actionId);
if (action != null) {
Presentation presentation = new Presentation();
AnActionEvent event = new AnActionEvent(e, DataManager.getInstance().getDataContext(e.getComponent()), "", presentation, actionManager, 0);
action.update(event);
if (presentation.isEnabled()) {
action.actionPerformed(event);
}
}
}
示例9: setEnabledForNodeVersion
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
/**
* Sets the enabled/disabled action property for the executable nodes that can change their version.
*
* @param selectedNodes Selected nodes in the repository view tree.
* @param presentation The specific place in the user interface of the action.
* @param toCurrentVersion True whether the action changes to current version. False for implemented version.
*/
public static void setEnabledForNodeVersion(final DefaultMutableTreeNode[] selectedNodes,
final Presentation presentation, final boolean toCurrentVersion) {
setEnabledForExecutableNode(selectedNodes, presentation);
boolean currentEnabled = presentation.isEnabled();
if (!currentEnabled) {
return;
}
for (DefaultMutableTreeNode selectedNode : selectedNodes) {
Object userObject = selectedNode.getUserObject();
if (userObject instanceof SpecificationNode) {
SpecificationNode specificationNode = (SpecificationNode) userObject;
if (!(specificationNode.isCanBeImplemented()
&& (specificationNode.isUsingCurrentVersion() ^ toCurrentVersion))) {
currentEnabled = false;
break;
}
}
}
presentation.setEnabled(currentEnabled);
}
示例10: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
protected void update(@NotNull Presentation presentation,
@NotNull Project project,
@NotNull Editor editor,
@NotNull PsiFile file,
@NotNull DataContext dataContext,
@Nullable String actionPlace) {
super.update(presentation, project, editor, file, dataContext, actionPlace);
if (myHandler instanceof ContextAwareActionHandler && presentation.isEnabled()) {
presentation.setEnabled(((ContextAwareActionHandler)myHandler).isAvailableForQuickList(editor, file, dataContext));
}
}
示例11: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(AnActionEvent event){
super.update(event);
Presentation presentation = event.getPresentation();
if (!presentation.isEnabled()) {
return;
}
presentation.setEnabled(CommonDataKeys.PROJECT.getData(event.getDataContext()) != null);
}
示例12: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(AnActionEvent event) {
super.update(event);
Presentation presentation = event.getPresentation();
if (!presentation.isEnabled()) {
return;
}
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
presentation.setEnabled(project != null);
}
示例13: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
protected void update(final FileSystemTree fileSystemTree, final AnActionEvent e) {
final Presentation presentation = e.getPresentation();
if (!presentation.isEnabled()) return;
final VirtualFile userHomeDir = VfsUtil.getUserHomeDir();
presentation.setEnabled(userHomeDir != null && fileSystemTree.isUnderRoots(userHomeDir));
}
示例14: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
StudyUtils.updateAction(e);
if (presentation.isEnabled()) {
presentation.setEnabled(!checkInProgress);
}
}
示例15: setEnabled
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
/**
* Enable or disable current action from event.
*
* @param e Action event
* @return Enabled value
*/
public static boolean setEnabled(AnActionEvent e) {
ThumbnailView thumbnailView = getVisibleThumbnailView(e);
Presentation presentation = e.getPresentation();
presentation.setEnabled(thumbnailView != null);
return presentation.isEnabled();
}