当前位置: 首页>>代码示例>>Java>>正文


Java FileColorManager类代码示例

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


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


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