當前位置: 首頁>>代碼示例>>Java>>正文


Java Presentation.isVisible方法代碼示例

本文整理匯總了Java中com.intellij.openapi.actionSystem.Presentation.isVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java Presentation.isVisible方法的具體用法?Java Presentation.isVisible怎麽用?Java Presentation.isVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.actionSystem.Presentation的用法示例。


在下文中一共展示了Presentation.isVisible方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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;
        }
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:AbstractCommitChangesAction.java

示例2: updatePresentation

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
private void updatePresentation(Presentation presentation) {
  Configuration configuration = myRenderContext.getConfiguration();
  boolean visible = configuration != null;
  if (visible) {
    // TEMPORARY WORKAROUND:
    // We don't properly sync the project locale to layouts yet, so in the mean time
    // show the actual locale being used rather than the intended locale, so as not
    // to be totally confusing:
    //Locale locale = configuration.isLocaleSpecificLayout()
    //                ? configuration.getLocale() : configuration.getConfigurationManager().getLocale();
    Locale locale = configuration.getLocale();
    if (locale == Locale.ANY) {
      presentation.setIcon(AndroidIcons.Globe);
    } else {
      presentation.setIcon(locale.getFlagImage());
    }
    String brief = getLocaleLabel(locale, true);
    presentation.setText(brief);
  } else {
    presentation.setIcon(AndroidIcons.Globe);
  }
  if (visible != presentation.isVisible()) {
    presentation.setVisible(visible);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:LocaleMenuAction.java

示例3: 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) {
  // avoid evaluating isValidFor several times unnecessary
  
  CodeInsightActionHandler handler = getValidHandler(editor, file);
  presentation.setEnabled(handler != null);
  if (handler instanceof ContextAwareActionHandler && !ActionPlaces.isMainMenuOrActionSearch(actionPlace)) {
    presentation.setVisible(((ContextAwareActionHandler)handler).isAvailableForQuickList(editor, file, dataContext));
  }

  if (presentation.isVisible() && handler instanceof PresentableCodeInsightActionHandler) {
    ((PresentableCodeInsightActionHandler)handler).update(editor, file, presentation);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:PresentableActionHandlerBasedAction.java

示例4: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
  myWrappee.update(e);
  final Presentation p = e.getPresentation();
  if (!p.isVisible()) {
    p.setEnabled(false);
    p.setVisible(true);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:AndroidRefactoringActionWrapper.java

示例5: updatePresentation

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
private void updatePresentation(Presentation presentation) {
  Configuration configuration = myRenderContext.getConfiguration();
  boolean visible = configuration != null;
  if (visible) {
    String activity = configuration.getActivity();
    String label = getActivityLabel(activity, true);
    presentation.setText(label);
  }
  if (visible != presentation.isVisible()) {
    presentation.setVisible(visible);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:ActivityMenuAction.java

示例6: updatePresentation

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
private void updatePresentation(Presentation presentation) {
  Configuration configuration = myRenderContext.getConfiguration();
  boolean visible = configuration != null;
  if (visible) {
    String label = getDeviceLabel(configuration.getDevice(), true);
    presentation.setText(label);
  }
  if (visible != presentation.isVisible()) {
    presentation.setVisible(visible);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:DeviceMenuAction.java

示例7: updatePresentation

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
private void updatePresentation(Presentation presentation) {
  Configuration configuration = myRenderContext.getConfiguration();
  boolean visible = configuration != null;
  if (visible) {
    IAndroidTarget target = configuration.getTarget();
    String brief = getRenderingTargetLabel(target, true);
    presentation.setText(brief);
  }
  if (visible != presentation.isVisible()) {
    presentation.setVisible(visible);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:TargetMenuAction.java

示例8: updatePresentation

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
private void updatePresentation(Presentation presentation) {
  Configuration configuration = myRenderContext.getConfiguration();
  boolean visible = configuration != null;
  if (visible) {
    String brief = getThemeLabel(configuration.getTheme(), true);
    presentation.setText(brief, false);
    presentation.setDescription(getThemeLabel(configuration.getTheme(), false));
  }
  if (visible != presentation.isVisible()) {
    presentation.setVisible(visible);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:ThemeMenuAction.java

示例9: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
 protected void update(VcsContext vcsContext, Presentation presentation) {
   Project project = vcsContext.getProject();

   if (project != null) {
     final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
     final boolean underVcs = vcsManager.hasActiveVcss();
     if (! underVcs) {
       presentation.setVisible(false);
       return;
     }

     String actionName = getCompleteActionName(vcsContext);
     if (myActionInfo.showOptions(project) || OptionsDialog.shiftIsPressed(vcsContext.getModifiers())) {
       actionName += "...";
     }

     presentation.setText(actionName);

     presentation.setVisible(true);
     presentation.setEnabled(true);

     if (supportingVcsesAreEmpty(vcsManager, myActionInfo)) {
       presentation.setVisible(myAlwaysVisible);
       presentation.setEnabled(false);
       return;
     }

     if (filterRootsBeforeAction()) {
       FilePath[] roots = filterRoots(myScopeInfo.getRoots(vcsContext, myActionInfo), vcsContext);
       if (roots.length == 0) {
         presentation.setVisible(myAlwaysVisible);
         presentation.setEnabled(false);
         return;
       }
     }

     if (presentation.isVisible() && presentation.isEnabled() &&
         vcsManager.isBackgroundVcsOperationRunning()) {
       presentation.setEnabled(false);
     }
   } else {
     presentation.setVisible(false);
     presentation.setEnabled(false);
   }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:47,代碼來源:AbstractCommonUpdateAction.java


注:本文中的com.intellij.openapi.actionSystem.Presentation.isVisible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。