• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FileColorManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.ui.FileColorManager的典型用法代码示例。如果您正苦于以下问题:Java FileColorManager类的具体用法?Java FileColorManager怎么用?Java FileColorManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FileColorManager类属于com.intellij.ui包,在下文中一共展示了FileColorManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: selectionChanged

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent fileEditorManagerEvent) {
    final Project project = fileEditorManagerEvent.getManager().getProject();
    final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
    final FileColorManager fileColorManager = FileColorManager.getInstance(project);
    final HighlighterSettingsConfig highlighterSettingsConfig = HighlighterSettingsConfig.getInstance(project);

    final VirtualFile oldFile = fileEditorManagerEvent.getOldFile();
    final VirtualFile newFile = fileEditorManagerEvent.getNewFile();

    for (EditorWindow editorWindow : manager.getWindows()) {
        setUnfocusedTabWithColorManagerDefaultColor(fileColorManager, oldFile, editorWindow);

        setFocusedTabHighlighterColor(highlighterSettingsConfig, newFile, editorWindow);
    }
}
 
开发者ID:tobszarny,项目名称:ActiveTabHighlighterPlugin,代码行数:17,代码来源:TabHighlighterFileEditorListener.java


示例2: getEditorTabColor

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
@Nullable
@Override
public Color getEditorTabColor(@NotNull Project project, @NotNull VirtualFile virtualFile) {
    final FileEditorManagerEx fileEditorManagerEx = FileEditorManagerEx.getInstanceEx(project);
    FileColorManager fileColorManager = FileColorManager.getInstance(project);
    HighlighterSettingsConfig highlighterSettingsConfig = HighlighterSettingsConfig.getInstance(project);

    EditorWindow activeWindow = fileEditorManagerEx.getCurrentWindow();
    if (activeWindow != null) {
        final EditorWithProviderComposite selectedEditor = activeWindow.getSelectedEditor();

        if (selectedEditor != null && selectedEditor.getFile() != null && selectedEditor.getFile().equals(virtualFile)) {
            return highlighterSettingsConfig.buildHighlightColor();
        }
    }

    return fileColorManager.getFileColor(virtualFile);
}
 
开发者ID:tobszarny,项目名称:ActiveTabHighlighterPlugin,代码行数:19,代码来源:CustomEditorTabColorProvider.java


示例3: getOptions

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
  if (project != null) {
    FileColorManager manager = FileColorManager.getInstance(project);
    if (manager != null) {
      BooleanOptionDescription enabled = new Option(manager, "File Colors enabled", "isEnabled", "setEnabled");
      return !enabled.isOptionEnabled()
             ? Collections.singletonList(enabled)
             : Collections.unmodifiableCollection(Arrays.asList(
               enabled,
               new Option(manager, "Use File Colors in Editor Tabs", "isEnabledForTabs", "setEnabledForTabs"),
               new Option(manager, "Use File Colors in Project View", "isEnabledForProjectView", "setEnabledForProjectView")));
    }
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FileColorsOptionsTopHitProvider.java


示例4: FileColorConfigurationEditDialog

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
public FileColorConfigurationEditDialog(@NotNull final FileColorManager manager, @Nullable final FileColorConfiguration configuration) {
  super(true);

  setTitle(configuration == null ? "Add Color Label" : "Edit Color Label");
  setResizable(false);

  myManager = manager;
  myConfiguration = configuration;
  myColorSelectionComponent = new ColorSelectionComponent();
  myColorSelectionComponent.initDefault(manager, configuration == null ? null : configuration.getColorName());
  myColorSelectionComponent.setChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      updateOKButton();
    }
  });

  init();
  updateCustomButton();
  if (myConfiguration != null && !StringUtil.isEmpty(myConfiguration.getScopeName())) {
    myScopeComboBox.setSelectedItem(myConfiguration.getScopeName());
  }
  updateOKButton();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:FileColorConfigurationEditDialog.java


示例5: getBackgroundColor

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
private Color getBackgroundColor(boolean isSelected, Usage usage) {
  Color fileBgColor = null;
  if (isSelected) {
    fileBgColor = UIUtil.getListSelectionBackground();
  }
  else {
    VirtualFile virtualFile = usage instanceof UsageInFile ? ((UsageInFile)usage).getFile() : null;
    if (virtualFile != null) {
      Project project = myUsageView.getProject();
      PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
      if (psiFile != null && psiFile.isValid()) {
        final Color color = FileColorManager.getInstance(project).getRendererBackground(psiFile);
        if (color != null) fileBgColor = color;
      }
    }
  }
  return fileBgColor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ShowUsagesTableCellRenderer.java


示例6: getBackgroundColor

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
protected static Color getBackgroundColor(@Nullable Object value) {
  if (value instanceof PsiElement || value instanceof DataProvider) {
    final PsiElement psiElement = value instanceof PsiElement
                                  ? (PsiElement)value
                                  : CommonDataKeys.PSI_ELEMENT.getData((DataProvider) value);
    if (psiElement != null && psiElement.isValid()) {
      final FileColorManager fileColorManager = FileColorManager.getInstance(psiElement.getProject());
      final Color fileColor = fileColorManager.getRendererBackground(psiElement.getContainingFile());
      if (fileColor != null) {
        return fileColor;
      }
    }
  }

  return UIUtil.getListBackground();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:NavigationItemListCellRenderer.java


示例7: addDisabledFileColors

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
private void addDisabledFileColors(Project project) {
  final FileColorManager manager = FileColorManager.getInstance(project);
  manager.addScopeColor(NonProjectFilesScope.NAME, MTOceanicTheme.DISABLED, false);
  manager.addScopeColor(NonProjectFilesScope.NAME, MTDarkerTheme.DISABLED, false);
  manager.addScopeColor(NonProjectFilesScope.NAME, MTLighterTheme.DISABLED, false);
  manager.addScopeColor(NonProjectFilesScope.NAME, MTPalenightTheme.DISABLED, false);

  Notify.show(project,
              "",
              MaterialThemeBundle.message("mt.fileColorsInstalled"),
              NotificationType.INFORMATION,
              new NotificationListener.Adapter() {
                @Override
                protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
                  ApplicationManager.getApplication().invokeLater(() -> ShowSettingsUtil.getInstance().showSettingsDialog(
                      project,
                      "File Colors"), ModalityState.NON_MODAL);
                }
              });
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:21,代码来源:MTAddFileColorsAction.java


示例8: FileColorConfigurationEditDialog

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
public FileColorConfigurationEditDialog(@NotNull final FileColorManager manager, @Nullable final FileColorConfiguration configuration) {
  super(true);

  setTitle(configuration == null ? "Add color label" : "Edit color label");
  setResizable(false);

  myManager = manager;
  myConfiguration = configuration;
  myColorSelectionComponent = new ColorSelectionComponent();
  myColorSelectionComponent.initDefault(manager, configuration == null ? null : configuration.getColorName());
  myColorSelectionComponent.setChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      updateOKButton();
    }
  });

  init();
  updateCustomButton();
  if (myConfiguration != null && !StringUtil.isEmpty(myConfiguration.getScopeName())) {
    myScopeComboBox.setSelectedItem(myConfiguration.getScopeName());
  }
  updateOKButton();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:FileColorConfigurationEditDialog.java


示例9: getBackgroundColor

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
protected static Color getBackgroundColor(@Nullable Object value) {
  if (value instanceof PsiElement || value instanceof DataProvider) {
    final PsiElement psiElement = value instanceof PsiElement
                                  ? (PsiElement)value
                                  : LangDataKeys.PSI_ELEMENT.getData((DataProvider) value);
    if (psiElement != null) {
      final FileColorManager fileColorManager = FileColorManager.getInstance(psiElement.getProject());
      final Color fileColor = fileColorManager.getRendererBackground(psiElement.getContainingFile());
      if (fileColor != null) {
        return fileColor;
      }
    }
  }

  return UIUtil.getListBackground();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:NavigationItemListCellRenderer.java


示例10: getBackgroundColor

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
private Color getBackgroundColor(boolean isSelected, Usage usage) {
  Color fileBgColor = null;
  if (isSelected) {
    fileBgColor = UIUtil.getListSelectionBackground();
  } else {
    VirtualFile virtualFile =
        usage instanceof UsageInFile ? ((UsageInFile) usage).getFile() : null;
    if (virtualFile != null) {
      Project project = myUsageView.getProject();
      PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
      if (psiFile != null && psiFile.isValid()) {
        final Color color = FileColorManager.getInstance(project).getRendererBackground(psiFile);
        if (color != null) fileBgColor = color;
      }
    }
  }
  return fileBgColor;
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:19,代码来源:ShowUsagesTableCellRenderer.java


示例11: FileColorConfigurationEditDialog

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
public FileColorConfigurationEditDialog(@Nonnull final FileColorManager manager, @Nullable final FileColorConfiguration configuration) {
  super(true);

  setTitle(configuration == null ? "Add color label" : "Edit color label");
  setResizable(false);

  myManager = manager;
  myConfiguration = configuration;

  init();
  updateCustomButton();
  if (myConfiguration != null && !StringUtil.isEmpty(myConfiguration.getScopeName())) {
    myScopeComboBox.setSelectedItem(myConfiguration.getScopeName());
  }
  updateOKButton();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:FileColorConfigurationEditDialog.java


示例12: createComponent

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
@Override
public JComponent createComponent() {
  if (myPanel == null) {
    myPanel = new FileColorsConfigurablePanel((FileColorManagerImpl) FileColorManager.getInstance(myProject));
  }

  return myPanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FileColorsConfigurable.java


示例13: initDefault

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
public void initDefault(@NotNull FileColorManager manager, @Nullable String selectedColorName) {
  for (String name : manager.getColorNames()) {
    addColorButton(name, ObjectUtils.assertNotNull(manager.getColor(name)));
  }
  addCustomColorButton();
  setSelectedColor(selectedColorName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ColorSelectionComponent.java


示例14: FileColorSettingsTable

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
public FileColorSettingsTable(@NotNull final FileColorManager manager, @NotNull final List<FileColorConfiguration> configurations) {
  super(new ModelAdapter(manager, copy(configurations)));
  myManager = manager;
  setStriped(true);
  myOriginal = configurations;

  setAutoResizeMode(AUTO_RESIZE_LAST_COLUMN);

  final TableColumnModel columnModel = getColumnModel();
  final TableColumn nameColumn = columnModel.getColumn(NAME_COLUMN);
  nameColumn.setCellRenderer(new ScopeNameRenderer());

  final TableColumn colorColumn = columnModel.getColumn(COLOR_COLUMN);
  colorColumn.setCellRenderer(new ColorCellRenderer(manager));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:FileColorSettingsTable.java


示例15: getColorForObject

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
@Nullable
public static <T> Color getColorForObject(T object, Project project, @NotNull Function<T, PsiElement> converter) {
  Color color = null;
  final PsiElement psi = converter.fun(object);
  if (psi != null) {
    if (!psi.isValid()) return null;

    final VirtualFile file = PsiUtilCore.getVirtualFile(psi);

    if (file != null) {
      color = FileColorManager.getInstance(project).getFileColor(file);
    } else if (psi instanceof PsiDirectory) {
      color = FileColorManager.getInstance(project).getFileColor(((PsiDirectory)psi).getVirtualFile());
    } else if (psi instanceof PsiDirectoryContainer) {
      final PsiDirectory[] dirs = ((PsiDirectoryContainer)psi).getDirectories();
      for (PsiDirectory dir : dirs) {
        Color c = FileColorManager.getInstance(project).getFileColor(dir.getVirtualFile());
        if (c != null && color == null) {
          color = c;
        } else if (c != null) {
          color = null;
          break;
        }
      }
    }
  }
  return color == null ? null : ColorUtil.softer(color);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ProjectViewTree.java


示例16: getEditorTabColor

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
@Nullable
@Override
public Color getEditorTabColor(@NotNull Project project, @NotNull VirtualFile file) {
    if (JSGraphQLSchemaLanguageProjectService.isProjectSchemaFile(file)) {
        FileColorManager colorManager = FileColorManager.getInstance(project);
        if (colorManager.isEnabledForTabs()) {
            return colorManager.getScopeColor(NonProjectFilesScope.NAME);
        }
    }
    return null;
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:12,代码来源:JSGraphQLSchemaEditorTabColorProvider.java


示例17: getEditorTabColor

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
@Override
public Color getEditorTabColor(@NotNull final Project project, @NotNull final VirtualFile virtualFile) {
  final FileColorManager colorManager = FileColorManager.getInstance(project);
  if (colorManager.isEnabledForTabs()) {
    final Color fileColor = colorManager.getFileColor(virtualFile);
    return fileColor != null ? fileColor : getDefaultTabColor();
  }
  return getDefaultTabColor();
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:10,代码来源:MTEditorTabColor.java


示例18: addDisabledFileColors

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
/**
 * At start, check if Material Theme File Colors are added, otherwise add them
 * Note: If the scope has changed somehow (by changing the name or the color), it will add a duplicate.
 */
private void addDisabledFileColors() {
  final FileColorManager manager = FileColorManager.getInstance(myProject);
  manager.addScopeColor(NonProjectFilesScope.NAME, MTOceanicTheme.DISABLED, false);
  manager.addScopeColor(NonProjectFilesScope.NAME, MTDarkerTheme.DISABLED, false);
  manager.addScopeColor(NonProjectFilesScope.NAME, MTLighterTheme.DISABLED, false);
  manager.addScopeColor(NonProjectFilesScope.NAME, MTPalenightTheme.DISABLED, false);
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:12,代码来源:MTScopeComponent.java


示例19: getEditorTabColor

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
@Override
@Nullable
public Color getEditorTabColor(Project project, VirtualFile file) {
  final FileColorManager colorManager = FileColorManagerImpl.getInstance(project);
  final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
  return psiFile != null && colorManager.isEnabledForTabs() ? colorManager.getFileColor(psiFile) : null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:EditorTabColorProviderImpl.java


示例20: FileColorSettingsTable

import com.intellij.ui.FileColorManager; //导入依赖的package包/类
public FileColorSettingsTable(@Nonnull final FileColorManager manager, @Nonnull final List<FileColorConfiguration> configurations) {
  super(new ModelAdapter(manager, copy(configurations)));
  myManager = manager;
  setStriped(true);
  myOriginal = configurations;

  setAutoResizeMode(AUTO_RESIZE_LAST_COLUMN);

  final TableColumnModel columnModel = getColumnModel();
  final TableColumn nameColumn = columnModel.getColumn(NAME_COLUMN);
  nameColumn.setCellRenderer(new ScopeNameRenderer());

  final TableColumn colorColumn = columnModel.getColumn(COLOR_COLUMN);
  colorColumn.setCellRenderer(new ColorCellRenderer(manager));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:FileColorSettingsTable.java



注:本文中的com.intellij.ui.FileColorManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RpcFactoryProvider类代码示例发布时间:2022-05-22
下一篇:
Java IObservableMap类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap