本文整理匯總了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);
}
}