本文整理汇总了Java中com.intellij.openapi.actionSystem.Presentation.setEnabledAndVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Presentation.setEnabledAndVisible方法的具体用法?Java Presentation.setEnabledAndVisible怎么用?Java Presentation.setEnabledAndVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.actionSystem.Presentation
的用法示例。
在下文中一共展示了Presentation.setEnabledAndVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
presentation.setEnabledAndVisible(false);
Project project = e.getProject();
if (project == null) {
return;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
if (!EduNames.STUDY.equals(course.getCourseMode())) {
presentation.setVisible(true);
return;
}
if (getAnswerPlaceholder(e) == null) {
presentation.setEnabledAndVisible(false);
return;
}
presentation.setEnabledAndVisible(true);
}
示例2: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
presentation.setEnabledAndVisible(false);
Project project = e.getProject();
if (project == null) {
return;
}
if (!CCUtils.isCourseCreator(project)) {
return;
}
final PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
if (file != null && StudyUtils.getTaskFile(project, file.getVirtualFile()) != null) {
presentation.setEnabledAndVisible(true);
}
}
示例3: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
presentation.setEnabledAndVisible(false);
CCState state = getState(e);
if (state == null) {
return;
}
TaskFile taskFile = state.getTaskFile();
if (taskFile.getTask() instanceof TaskWithSubtasks) {
int offset = state.getEditor().getCaretModel().getOffset();
if (isAvailable(taskFile, offset)) {
presentation.setEnabledAndVisible(true);
}
}
}
示例4: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
presentation.setEnabledAndVisible(false);
CCState state = getState(e);
if (state == null) {
return;
}
AnswerPlaceholder placeholder = state.getAnswerPlaceholder();
if (placeholder == null) {
return;
}
Task task = state.getTaskFile().getTask();
if ((task instanceof TaskWithSubtasks)) {
Integer minSubtaskIndex = Collections.min(placeholder.getSubtaskInfos().keySet());
if (canChangeState(placeholder, (TaskWithSubtasks)task, minSubtaskIndex)) {
presentation.setEnabledAndVisible(true);
}
}
}
示例5: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(@NotNull AnActionEvent event) {
final Project project = event.getProject();
final Presentation presentation = event.getPresentation();
if (project == null) {
return;
}
presentation.setEnabledAndVisible(false);
if (!CCUtils.isCourseCreator(project)) {
return;
}
final IdeView view = event.getData(LangDataKeys.IDE_VIEW);
if (view == null) {
return;
}
final PsiDirectory[] directories = view.getDirectories();
if (directories.length == 0) {
return;
}
presentation.setEnabledAndVisible(true);
}
示例6: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(AnActionEvent event)
{
super.update(event);
if (event.getProject() == null) {
event.getPresentation().setEnabled(false);
return;
}
RemoteHost remoteHost = this.container().preferences(event.getProject()).getRemoteHost();
Presentation presentation = event.getPresentation();
presentation.setText(this.displayName(remoteHost));
presentation.setIcon(remoteHost.icon());
presentation.setEnabledAndVisible(this.shouldActionBeEnabled(event));
}
示例7: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(AnActionEvent event) {
super.update(event);
Presentation presentation = event.getPresentation();
if (SystemInfo.isMac) {
presentation.setEnabledAndVisible(false);
return;
}
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
presentation.setEnabled(false);
return;
}
ToolWindowManager mgr = ToolWindowManager.getInstance(project);
String id = mgr.getActiveToolWindowId();
presentation.setEnabled(id != null && mgr.getToolWindow(id).isAvailable());
}
示例8: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(final AnActionEvent event) {
Presentation presentation = event.getPresentation();
boolean hidden = isHidden(event);
if (hidden) {
presentation.setEnabledAndVisible(false);
return;
}
boolean enabled = isEnabled(event);
if (myHideDisabledInPopup && ActionPlaces.isPopupPlace(event.getPlace())) {
presentation.setVisible(enabled);
}
else {
presentation.setVisible(true);
}
presentation.setEnabled(enabled);
}
示例9: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
Project project = e.getProject();
Presentation presentation = e.getPresentation();
if (project == null) {
presentation.setEnabledAndVisible(false);
return;
}
VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
if (file == null || file.isDirectory() || CCProjectService.getInstance(project).isAnswerFile(file)) {
presentation.setEnabledAndVisible(false);
return;
}
Task task = CCProjectService.getInstance(project).getTask(file);
if (task == null) {
presentation.setEnabledAndVisible(false);
}
}
示例10: updateForBlazeProject
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
protected void updateForBlazeProject(Project project, AnActionEvent e) {
Presentation presentation = e.getPresentation();
DataContext dataContext = e.getDataContext();
VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
BlazePackage blazePackage = getBuildFile(project, virtualFile);
if (blazePackage != null && virtualFile.equals(blazePackage.buildFile.getVirtualFile())) {
presentation.setEnabledAndVisible(false);
return;
}
boolean visible = virtualFile != null;
boolean enabled = blazePackage != null;
presentation.setVisible(visible || ActionPlaces.isMainMenuOrActionSearch(e.getPlace()));
presentation.setEnabled(enabled);
}
示例11: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
super.update(e);
VirtualFile currentFile = DataKeys.VIRTUAL_FILE.getData(e.getDataContext());
final Presentation presentation = e.getPresentation();
if (currentFile != null && currentFile.getName().endsWith(".ecore")) {
presentation.setEnabledAndVisible(true);
} else {
presentation.setEnabledAndVisible(false);
}
}
示例12: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(
final Editor editor, final Presentation presentation, final DataContext dataContext
) {
super.update(editor, presentation, dataContext);
final VirtualFile file = dataContext.getData(CommonDataKeys.VIRTUAL_FILE);
final boolean enabled = file != null && file.getName().endsWith(".impex");
presentation.setEnabledAndVisible(enabled);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:10,代码来源:AbstractImpexTableFormatAction.java
示例13: updateAction
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public static void updateAction(@NotNull final AnActionEvent e) {
final Presentation presentation = e.getPresentation();
presentation.setEnabled(false);
final Project project = e.getProject();
if (project != null) {
final StudyEditor studyEditor = getSelectedStudyEditor(project);
if (studyEditor != null) {
presentation.setEnabledAndVisible(true);
}
}
}
示例14: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
Project project = e.getProject();
Presentation presentation = e.getPresentation();
if (project == null || !CCUtils.isCourseCreator(project)) {
presentation.setEnabledAndVisible(false);
return;
}
final VirtualFile[] virtualFiles = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(e.getDataContext());
if (virtualFiles == null || virtualFiles.length == 0) {
presentation.setEnabledAndVisible(false);
}
}
示例15: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
presentation.setEnabledAndVisible(false);
Task task = getTask(e);
if (task != null) {
presentation.setEnabledAndVisible(true);
}
}