本文整理汇总了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);
}
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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);
}
});
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例12: createComponent
import com.intellij.ui.FileColorManager; //导入依赖的package包/类
@Override
public JComponent createComponent() {
if (myPanel == null) {
myPanel = new FileColorsConfigurablePanel((FileColorManagerImpl) FileColorManager.getInstance(myProject));
}
return myPanel;
}
示例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);
}
示例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));
}
示例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);
}