本文整理汇总了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);
}
}
示例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;
}
}
示例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();
}
}
}
}
}
示例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();
}
}
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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();
}
示例9: isAccepted
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
@Override
protected boolean isAccepted(@NotNull Content c, @NotNull Content[] selectedContents) {
return !c.isPinned();
}
示例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);
}
});
}
示例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);
}
示例12: mustOpenInNewTab
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
private boolean mustOpenInNewTab() {
Content selectedContent = UsageViewManager.getInstance(myProject).getSelectedContent(true);
return selectedContent != null && selectedContent.isPinned();
}
示例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);
}