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


Java Content.isPinned方法代碼示例

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


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

示例1: addOrReplaceContent

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
public static void addOrReplaceContent(ContentManager manager, Content content, boolean select) {
  final String contentName = content.getDisplayName();

  Content[] contents = manager.getContents();
  Content oldContentFound = null;
  for(Content oldContent: contents) {
    if (!oldContent.isPinned() && oldContent.getDisplayName().equals(contentName)) {
      oldContentFound = oldContent;
      break;
    }
  }

  manager.addContent(content);
  if (oldContentFound != null) {
    manager.removeContent(oldContentFound, true);
  }
  if (select) {
    manager.setSelectedContent(content);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:ContentsUtil.java

示例2: isSelected

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
@Override
public boolean isSelected(AnActionEvent e) {
  DataContext context = e.getDataContext();
  VirtualFile file = getFile(context);
  if(file != null){
    // 1. Check editor
    EditorWindow editorWindow = getEditorWindow(context);
    if (editorWindow != null) {
      if (!editorWindow.isFileOpen(file)) {
        file = editorWindow.getSelectedFile();
        if (file == null) return false;
      }

      return editorWindow.isFilePinned(file);
    }
  }
  // 2. Check content
  final Content content = getContent(context);
  if(content != null){
    return content.isPinned();
  }
  else{
    return false;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:PinActiveTabAction.java

示例3: removeContents

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
protected void removeContents(Content notToRemove, final String tabDisplayName) {
  MessageView messageView = MessageView.SERVICE.getInstance(myProject);
  Content[] contents = messageView.getContentManager().getContents();
  for (Content content : contents) {
    LOG.assertTrue(content != null);
    if (content.isPinned()) continue;
    if (tabDisplayName.equals(content.getDisplayName()) && content != notToRemove) {
      ErrorTreeView listErrorView = (ErrorTreeView)content.getComponent();
      if (listErrorView != null) {
        if (messageView.getContentManager().removeContent(content, true)) {
          content.release();
        }
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:AbstractVcsHelperImpl.java

示例4: removeContents

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
private static void removeContents(@Nullable final Content notToRemove,
                                   @NotNull final Project myProject,
                                   @NotNull final String tabDisplayName) {
  MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
  Content[] contents = messageView.getContentManager().getContents();
  for (Content content : contents) {
    LOG.assertTrue(content != null);
    if (content.isPinned()) continue;
    if (tabDisplayName.equals(content.getDisplayName()) && content != notToRemove) {
      ErrorTreeView listErrorView = (ErrorTreeView)content.getComponent();
      if (listErrorView != null) {
        if (messageView.getContentManager().removeContent(content, true)) {
          content.release();
        }
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:ExecutionHelper.java

示例5: findContent

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
@Nullable
private Content findContent(@NotNull Pair<NotificationSource, ProjectSystemId> contentIdPair, @NotNull String contentDisplayName) {
  Content targetContent = null;
  final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
  for (Content content : messageView.getContentManager().getContents()) {
    if (contentIdPair.equals(content.getUserData(CONTENT_ID_KEY))
        && StringUtil.equals(content.getDisplayName(), contentDisplayName) && !content.isPinned()) {
      targetContent = content;
    }
  }
  return targetContent;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:ExternalSystemNotificationManager.java

示例6: isEnabled

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
@Override
public boolean isEnabled(ViewContext context, Content[] selectedContents, String place) {
  for (Content content : context.getContentManager().getContents()) {
    if (content.isPinned()) return super.isEnabled(context, selectedContents, place);
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:CloseAllUnpinnedViewsAction.java

示例7: addTab

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
public void addTab(String title,
                   JComponent component,
                   boolean selectTab,
                   boolean replaceContent,
                   boolean lockable,
                   boolean addDefaultToolbar,
                   @Nullable final ActionGroup toolbarActions,
                   @NonNls String helpId) {
  final ContentManager contentManager = getToolWindow().getContentManager();
  final Content existingContent = contentManager.findContent(title);
  if (existingContent != null) {
    final JComponent existingComponent = existingContent.getComponent();
    if (existingComponent instanceof DeactivateListener) {
      ((DeactivateListener) existingComponent).deactivated();
    }
    if (!replaceContent) {
      contentManager.setSelectedContent(existingContent);
      return;
    }
    else if (!existingContent.isPinned()) {
      contentManager.removeContent(existingContent, true);
      existingContent.release();
    }
  }
  final CvsTabbedWindowComponent newComponent =
    new CvsTabbedWindowComponent(component, addDefaultToolbar, toolbarActions, contentManager, helpId);
  final Content content = contentManager.getFactory().createContent(newComponent.getShownComponent(), title, lockable);
  newComponent.setContent(content);
  contentManager.addContent(content);
  if (selectTab) {
    getToolWindow().activate(null, false);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:CvsTabbedWindow.java

示例8: isSelected

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
@Override
public boolean isSelected(AnActionEvent event) {
  final Content content = getContextContent(event);
  return content != null && content.isPinned();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:PinToolwindowTabAction.java

示例9: isAccepted

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
@Override
protected boolean isAccepted(@NotNull Content c, @NotNull Content[] selectedContents) {
  return !c.isPinned();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:CloseAllUnpinnedViewsAction.java

示例10: replaceInProject

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
public void replaceInProject(@NotNull DataContext dataContext) {
  final boolean isOpenInNewTabEnabled;
  final boolean toOpenInNewTab;
  final Content selectedContent = com.intellij.usageView.UsageViewManager.getInstance(myProject).getSelectedContent(true);
  if (selectedContent != null && selectedContent.isPinned()) {
    toOpenInNewTab = true;
    isOpenInNewTabEnabled = false;
  }
  else {
    toOpenInNewTab = FindSettings.getInstance().isShowResultsInSeparateView();
    isOpenInNewTabEnabled = com.intellij.usageView.UsageViewManager.getInstance(myProject).getReusableContentsCount() > 0;
  }
  final FindManager findManager = FindManager.getInstance(myProject);
  final FindModel findModel = findManager.getFindInProjectModel().clone();
  findModel.setReplaceState(true);
  findModel.setOpenInNewTabVisible(true);
  findModel.setOpenInNewTabEnabled(isOpenInNewTabEnabled);
  findModel.setOpenInNewTab(toOpenInNewTab);
  FindInProjectUtil.setDirectoryName(findModel, dataContext);

  Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
  FindUtil.initStringToFindWithSelection(findModel, editor);

  findManager.showFindDialog(findModel, new Runnable() {
    @Override
    public void run() {
      if (!findModel.isProjectScope() &&
          FindInProjectUtil.getDirectory(findModel) == null &&
          findModel.getModuleName() == null &&
          findModel.getCustomScope() == null) {
        return;
      }

      UsageViewManager manager = UsageViewManager.getInstance(myProject);

      if (manager == null) return;
      findManager.getFindInProjectModel().copyFrom(findModel);
      final FindModel findModelCopy = findModel.clone();

      final UsageViewPresentation presentation = FindInProjectUtil.setupViewPresentation(findModel.isOpenInNewTab(), findModelCopy);
      final FindUsagesProcessPresentation processPresentation = FindInProjectUtil.setupProcessPresentation(myProject, true, presentation);

      UsageSearcherFactory factory = new UsageSearcherFactory(findModelCopy, processPresentation);
      searchAndShowUsages(manager, factory, findModelCopy, presentation, processPresentation, findManager);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:48,代碼來源:ReplaceInProjectManager.java

示例11: findInProject

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
public void findInProject(@NotNull DataContext dataContext) {
  final boolean isOpenInNewTabEnabled;
  final boolean toOpenInNewTab;
  Content selectedContent = UsageViewManager.getInstance(myProject).getSelectedContent(true);
  if (selectedContent != null && selectedContent.isPinned()) {
    toOpenInNewTab = true;
    isOpenInNewTabEnabled = false;
  }
  else {
    toOpenInNewTab = FindSettings.getInstance().isShowResultsInSeparateView();
    isOpenInNewTabEnabled = UsageViewManager.getInstance(myProject).getReusableContentsCount() > 0;
  }

  final FindManager findManager = FindManager.getInstance(myProject);
  final FindModel findModel = findManager.getFindInProjectModel().clone();
  findModel.setReplaceState(false);
  findModel.setOpenInNewTabVisible(true);
  findModel.setOpenInNewTabEnabled(isOpenInNewTabEnabled);
  findModel.setOpenInNewTab(toOpenInNewTab);
  FindInProjectUtil.setDirectoryName(findModel, dataContext);

  String text = PlatformDataKeys.PREDEFINED_TEXT.getData(dataContext);
  if (text != null) {
    FindModel.initStringToFindNoMultiline(findModel, text);
  }
  else {
    Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
    FindUtil.initStringToFindWithSelection(findModel, editor);
  }

  findManager.showFindDialog(findModel, new Runnable() {
    @Override
    public void run() {
      findModel.setOpenInNewTabVisible(false);
      if (isOpenInNewTabEnabled) {
        FindSettings.getInstance().setShowResultsInSeparateView(findModel.isOpenInNewTab());
      }

      startFindInProject(findModel);
    }

  });
  findModel.setOpenInNewTabVisible(false);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:45,代碼來源:FindInProjectManager.java

示例12: mustOpenInNewTab

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
private boolean mustOpenInNewTab() {
  Content selectedContent = UsageViewManager.getInstance(myProject).getSelectedContent(true);
  return selectedContent != null && selectedContent.isPinned();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:FindUsagesManager.java

示例13: actionPerformed

import com.intellij.ui.content.Content; //導入方法依賴的package包/類
@Override
public final void actionPerformed(final AnActionEvent e) {
  final DataContext dataContext = e.getDataContext();
  final Project project = e.getProject();
  if (project == null) return;

  PsiDocumentManager.getInstance(project).commitAllDocuments(); // prevents problems with smart pointers creation

  final HierarchyProvider provider = getProvider(e);
  if (provider == null) return;
  final PsiElement target = provider.getTarget(dataContext);
  if (target == null) return;
  final HierarchyBrowser hierarchyBrowser = provider.createHierarchyBrowser(target);

  final Content content;

  final HierarchyBrowserManager hierarchyBrowserManager = HierarchyBrowserManager.getInstance(project);

  final ContentManager contentManager = hierarchyBrowserManager.getContentManager();
  final Content selectedContent = contentManager.getSelectedContent();
  if (selectedContent != null && !selectedContent.isPinned()) {
    content = selectedContent;
    final Component component = content.getComponent();
    if (component instanceof Disposable) {
      Disposer.dispose((Disposable)component);
    }
    content.setComponent(hierarchyBrowser.getComponent());
  }
  else {
    content = ContentFactory.SERVICE.getInstance().createContent(hierarchyBrowser.getComponent(), null, true);
    contentManager.addContent(content);
  }
  contentManager.setSelectedContent(content);
  hierarchyBrowser.setContent(content);

  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      provider.browserActivated(hierarchyBrowser);
    }
  };
  ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.HIERARCHY).activate(runnable);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:44,代碼來源:BrowseHierarchyActionBase.java


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