当前位置: 首页>>代码示例>>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;未经允许,请勿转载。