void updateFatalErrorsIcon() { final IdeFatalErrorsIcon.State state = computeState(); updateState(state); if (state == IdeFatalErrorsIcon.State.NoErrors) { myNotificationPopupAlreadyShown = false; } else if (state == IdeFatalErrorsIcon.State.UnreadErrors && !myNotificationPopupAlreadyShown) { SwingUtilities.invokeLater(new Runnable() { public void run() { String notificationText = tryGetFromMessages(myMessagePool.getFatalErrors(false, false)); if (notificationText == null) { notificationText = INTERNAL_ERROR_NOTICE; } final JLabel label = new JLabel(notificationText); label.setIcon(AllIcons.Ide.FatalError); new NotificationPopup(IdeMessagePanel.this, label, LightColors.RED, false, new ActionListener() { public void actionPerformed(ActionEvent e) { _openFatals(null); } }, true); } }); myNotificationPopupAlreadyShown = true; } }
@Override protected int getRightMargin() { String text = myRightMarginField.getText(); int rightMargin; myRightMarginField.setBackground(myInitialRightMarginFieldColor); try { rightMargin = Integer.parseInt(text); if (rightMargin < 1 || rightMargin > CodeStyleSettings.MAX_RIGHT_MARGIN) { rightMargin = myDefaultRightMargin; myRightMarginField.setBackground(LightColors.RED); } } catch (NumberFormatException nfe) { myRightMarginField.setBackground(LightColors.RED); rightMargin = myDefaultRightMargin; } return rightMargin; }
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { if (value instanceof VirtualFile) { VirtualFile virtualFile = (VirtualFile)value; String name = virtualFile.getPresentableName(); setIcon(IconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, myProject)); FileStatus fileStatus = FileStatusManager.getInstance(myProject).getStatus(virtualFile); TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null , null, EffectType.LINE_UNDERSCORE, Font.PLAIN); append(name, SimpleTextAttributes.fromTextAttributes(attributes)); if (!selected && FileEditorManager.getInstance(myProject).isFileOpen(virtualFile)) { setBackground(LightColors.SLIGHTLY_GREEN); } } }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { x++; g.setColor(new JBColor(LightColors.YELLOW, new Color(103, 81, 51))); g.fillRect(x, y, getIconWidth() - 2, getIconHeight()); g.setColor(JBColor.GRAY); g.drawRect(x, y, getIconWidth() - 2, getIconHeight()); g.setColor(JBColor.foreground()); final Font oldFont = g.getFont(); g.setFont(MNEMONIC_FONT); g.drawString(Character.toString(myMnemonic), x + 2, y + getIconHeight() - 2); g.setFont(oldFont); }
private Color getCaptionColor(final int i) { if(mySelectionModel.isSelectedIndex(i)) { return LightColors.BLUE; } if(mySelectedContainer != null) { if(i >= 0 && i < mySelectedContainer.getGridCellCount(myIsRow)) { final GridChangeUtil.CellStatus status = GridChangeUtil.canDeleteCell(mySelectedContainer, i, myIsRow); if(status == GridChangeUtil.CellStatus.Empty || status == GridChangeUtil.CellStatus.Redundant) { return Color.PINK; } } } return LightColors.GREEN; }
@Nonnull private static DocumentContent createFromBytesImpl(@javax.annotation.Nullable Project project, @Nonnull byte[] content, @Nonnull FileType fileType, @Nonnull String fileName, @javax.annotation.Nullable VirtualFile highlightFile, @Nonnull Charset charset) { Charset bomCharset = CharsetToolkit.guessFromBOM(content); boolean isBOM = bomCharset != null; if (isBOM) charset = bomCharset; boolean malformedContent = false; String text = CharsetToolkit.tryDecodeString(content, charset); LineSeparator separator = StringUtil.detectSeparators(text); String correctedContent = StringUtil.convertLineSeparators(text); DocumentContent documentContent = createImpl(project, correctedContent, fileType, fileName, highlightFile, charset, isBOM, true, true); if (malformedContent) { String notificationText = "Content was decoded with errors (using " + "'" + charset.name() + "' charset)"; DiffUtil.addNotification(DiffNotifications.createNotification(notificationText, LightColors.RED), documentContent); } return documentContent; }
private static JComponent createWarningPanel() { VerticalLayoutPanel panel = JBUI.Panels.verticalPanel(); panel.setBackground(LightColors.RED); panel.setBorder(new CompoundBorder(JBUI.Borders.customLine(JBColor.GRAY), JBUI.Borders.empty(5))); JBLabel warnLabel = new JBLabel("WARNING", AllIcons.General.BalloonWarning, SwingConstants.LEFT); warnLabel.setFont(UIUtil.getFont(UIUtil.FontSize.BIGGER, warnLabel.getFont()).deriveFont(Font.BOLD)); panel.addComponent(warnLabel); JTextArea textArea = new JTextArea(IdeBundle.message("eap.configurable.warning.text")); textArea.setLineWrap(true); textArea.setFont(JBUI.Fonts.label()); textArea.setOpaque(false); textArea.setEditable(false); panel.addComponent(textArea); return panel; }
@Nullable @Override public Color getRendererBackground(PsiFile file) { if (file == null) return null; if (isEnabled()) { final Color fileColor = getFileColor(file); if (fileColor != null) return fileColor; } final VirtualFile vFile = file.getVirtualFile(); if (vFile == null) return null; //todo[kb] slightly_green for darcula return FileEditorManager.getInstance(myProject).isFileOpen(vFile) && !UIUtil.isUnderDarcula() ? LightColors.SLIGHTLY_GREEN : null; }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(LightColors.SLIGHTLY_GREEN); g.fillRoundRect(x + 4, y + 4, 32 - 8, 32 - 8, 8, 8); g.setColor(JBColor.GRAY); g.drawRoundRect(x + 4, y + 4, 32 - 8, 32 - 8, 8, 8); }
private ContentWrapper() { setLayout(new BorderLayout()); myErrorLabel = new JLabel(); myErrorLabel.setOpaque(true); myErrorLabel.setBackground(LightColors.RED); myLeft = new JPanel(new BorderLayout()); mySplitter.addPropertyChangeListener(Splitter.PROP_PROPORTION, new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { myLastSplitterProportion = ((Float)evt.getNewValue()).floatValue(); } }); }
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component orig = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); final Color bg = orig.getBackground(); final Color grayedFg = isSelected ? orig.getForeground() : Color.GRAY; myLabel.setForeground(grayedFg); myLabel.setBackground(bg); myLabel.setOpaque(true); if (column == COLUMN_DATE) { long date = myPluginDescriptor.getDate(); myLabel.setText(date != 0 && date != Long.MAX_VALUE ? DateFormatUtil.formatDate(date) : "n/a"); myLabel.setHorizontalAlignment(SwingConstants.RIGHT); } else if (column == COLUMN_DOWNLOADS) { String downloads = myPluginDescriptor.getDownloads(); myLabel.setText(!StringUtil.isEmpty(downloads) ? downloads : "n/a"); myLabel.setHorizontalAlignment(SwingConstants.RIGHT); } else if (column == COLUMN_CATEGORY) { String category = myPluginDescriptor.getCategory(); if (StringUtil.isEmpty(category)) { category = myPluginDescriptor.getRepositoryName(); } myLabel.setText(!StringUtil.isEmpty(category) ? category : "n/a"); } if (myPluginDescriptor.getStatus() == PluginNode.STATUS_INSTALLED) { PluginId pluginId = myPluginDescriptor.getPluginId(); final boolean hasNewerVersion = ourState.hasNewerVersion(pluginId); if (hasNewerVersion) { if (!isSelected) myLabel.setBackground(LightColors.BLUE); } } return myLabel; }
private Color getColor(HighlightSeverity severity) { if (SeverityRegistrar.getSeverityRegistrar(myProject).compare(severity, HighlightSeverity.ERROR) >= 0) { return LightColors.RED; } if (SeverityRegistrar.getSeverityRegistrar(myProject).compare(severity, HighlightSeverity.WARNING) >= 0) { return LightColors.YELLOW; } return LightColors.GREEN; }
@Nullable @Override public Color getRendererBackground(VirtualFile vFile) { if (vFile == null) return null; if (isEnabled()) { final Color fileColor = getFileColor(vFile); if (fileColor != null) return fileColor; } //todo[kb] slightly_green for darcula return FileEditorManager.getInstance(myProject).isFileOpen(vFile) && !UIUtil.isUnderDarcula() ? LightColors.SLIGHTLY_GREEN : null; }
@Override public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull final FileEditor fileEditor) { if (!(fileEditor instanceof TextEditor)) return null; final Project project = ((TextEditor)fileEditor).getEditor().getProject(); final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings(); if (!Utils.isEnabled(settings) || PropertiesComponent.getInstance(project).getBoolean(EDITOR_CONFIG_ACCEPTED)) return null; final List<EditorConfig.OutPair> pairs = SettingsProviderComponent.getInstance().getOutPairs(project, Utils.getFilePath(project, file)); if (!pairs.isEmpty()) { final EditorNotificationPanel panel = new EditorNotificationPanel() { @Override public Color getBackground() { return LightColors.GREEN; } }.text("EditorConfig is overriding Code Style settings for this file"). icon(EditorconfigIcons.Editorconfig); panel.createActionLabel("OK", new Runnable() { @Override public void run() { PropertiesComponent.getInstance(project).setValue(EDITOR_CONFIG_ACCEPTED, true); EditorNotifications.getInstance(project).updateAllNotifications(); } }); panel.createActionLabel("Disable EditorConfig support", new Runnable() { @Override public void run() { settings.getCustomSettings(EditorConfigSettings.class).ENABLED = false; EditorNotifications.getInstance(project).updateAllNotifications(); } }); return panel; } return null; }
private Color getCaptionColor(final int i) { if (mySelectionModel.isSelectedIndex(i)) { return LightColors.BLUE; } if (mySelectedContainer != null) { if (i >= 0 && i < mySelectedContainer.getGridCellCount(myIsRow)) { final GridChangeUtil.CellStatus status = GridChangeUtil.canDeleteCell(mySelectedContainer, i, myIsRow); if (status == GridChangeUtil.CellStatus.Empty || status == GridChangeUtil.CellStatus.Redundant) { return Color.PINK; } } } return LightColors.GREEN; }
public void paintFeedback(Graphics2D g, Rectangle rc) { g.setColor(LightColors.YELLOW); if (rc.width == 1) { g.drawLine(rc.x, rc.y, rc.x, rc.y+rc.height); } else { g.drawLine(rc.x, rc.y, rc.x+rc.width, rc.y); } }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(LightColors.SLIGHTLY_GREEN); g.fillRoundRect(x + 4, y + 4, 32 - 8, 32 - 8, 8, 8); g.setColor(Color.GRAY); g.drawRoundRect(x + 4, y + 4, 32 - 8, 32 - 8, 8, 8); }
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component orig = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); final Color bg = orig.getBackground(); final Color grayedFg = isSelected ? orig.getForeground() : Color.GRAY; myLabel.setForeground(grayedFg); myLabel.setBackground(bg); myLabel.setOpaque(true); if (column == COLUMN_DATE) { long date = myPluginDescriptor.getDate(); myLabel.setText(date != 0 && date != Long.MAX_VALUE ? DateFormatUtil.formatDate(date) : "n/a"); myLabel.setHorizontalAlignment(SwingConstants.RIGHT); } else if (column == COLUMN_DOWNLOADS) { String downloads = myPluginDescriptor.getDownloads(); myLabel.setText(!StringUtil.isEmpty(downloads) ? downloads : "n/a"); myLabel.setHorizontalAlignment(SwingConstants.RIGHT); } else if (column == COLUMN_CATEGORY) { String category = myPluginDescriptor.getCategory(); if (StringUtil.isEmpty(category)) { category = myPluginDescriptor.getRepositoryName(); } myLabel.setText(!StringUtil.isEmpty(category) ? category : "n/a"); } if (myPluginDescriptor.getStatus() == PluginNode.STATUS_INSTALLED) { PluginId pluginId = myPluginDescriptor.getPluginId(); final boolean hasNewerVersion = InstalledPluginsTableModel.hasNewerVersion(pluginId); if (hasNewerVersion) { if (!isSelected) myLabel.setBackground(LightColors.BLUE); } } return myLabel; }
private Color getColor(HighlightSeverity severity) { if (SeverityUtil.getSeverityRegistrar(myProject).compare(severity, HighlightSeverity.ERROR) >= 0) { return LightColors.RED; } if (SeverityUtil.getSeverityRegistrar(myProject).compare(severity, HighlightSeverity.WARNING) >= 0) { return LightColors.YELLOW; } return LightColors.GREEN; }
public ByteCodeViewerComponent(Project project, AnAction[] additionalActions) { super(new BorderLayout()); final EditorFactory factory = EditorFactory.getInstance(); final Document doc = factory.createDocument(""); doc.setReadOnly(true); myEditor = factory.createEditor(doc, project); EditorHighlighterFactory editorHighlighterFactory = EditorHighlighterFactory.getInstance(); final SyntaxHighlighter syntaxHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(StdFileTypes.JAVA, project, null); ((EditorEx)myEditor).setHighlighter(editorHighlighterFactory.createEditorHighlighter(syntaxHighlighter, EditorColorsManager.getInstance().getGlobalScheme())); ((EditorEx)myEditor).setBackgroundColor(EditorFragmentComponent.getBackgroundColor(myEditor)); myEditor.getColorsScheme().setColor(EditorColors.CARET_ROW_COLOR, LightColors.SLIGHTLY_GRAY); ((EditorEx)myEditor).setCaretVisible(true); final EditorSettings settings = myEditor.getSettings(); settings.setLineMarkerAreaShown(false); settings.setIndentGuidesShown(false); settings.setLineNumbersShown(false); settings.setFoldingOutlineShown(false); myEditor.setBorder(null); add(myEditor.getComponent(), BorderLayout.CENTER); final ActionManager actionManager = ActionManager.getInstance(); final DefaultActionGroup actions = new DefaultActionGroup(); if (additionalActions != null) { for (final AnAction action : additionalActions) { actions.add(action); } } add(actionManager.createActionToolbar(ActionPlaces.JAVADOC_TOOLBAR, actions, true).getComponent(), BorderLayout.NORTH); }
public void paintFeedback(Graphics2D g, Rectangle rc) { g.setColor(LightColors.YELLOW); if(rc.width == 1) { g.drawLine(rc.x, rc.y, rc.x, rc.y + rc.height); } else { g.drawLine(rc.x, rc.y, rc.x + rc.width, rc.y); } }
@Override protected void paintTrack(Graphics g, JComponent c, Rectangle bounds) { g.setColor(new JBColor(LightColors.SLIGHTLY_GRAY, UIUtil.getListBackground())); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); RegionPainter<Object> painter = UIUtil.getClientProperty(c, ScrollBarUIConstants.TRACK); if (painter != null) { painter.paint((Graphics2D)g, bounds.x, bounds.y, bounds.width, bounds.height, null); } }
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component orig = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); final Color bg = orig.getBackground(); final Color grayedFg = isSelected ? orig.getForeground() : Color.GRAY; myLabel.setForeground(grayedFg); myLabel.setBackground(bg); myLabel.setOpaque(true); if (column == COLUMN_DATE) { long date = myPluginDescriptor.getDate(); myLabel.setText(date != 0 && date != Long.MAX_VALUE ? DateFormatUtil.formatDate(date) : "n/a"); myLabel.setHorizontalAlignment(SwingConstants.RIGHT); } else if (column == COLUMN_DOWNLOADS) { String downloads = myPluginDescriptor.getDownloads(); myLabel.setText(!StringUtil.isEmpty(downloads) ? downloads : "n/a"); myLabel.setHorizontalAlignment(SwingConstants.RIGHT); } else if (column == COLUMN_CATEGORY) { String category = myPluginDescriptor.getCategory(); myLabel.setText(!StringUtil.isEmpty(category) ? category : "n/a"); } if (myPluginDescriptor.getStatus() == PluginNode.STATUS_INSTALLED) { PluginId pluginId = myPluginDescriptor.getPluginId(); final boolean hasNewerVersion = InstalledPluginsTableModel.hasNewerVersion(pluginId); if (hasNewerVersion) { if (!isSelected) myLabel.setBackground(LightColors.BLUE); } } return myLabel; }
public MyEditorNotificationPanel(@Nonnull Editor editor, @Nonnull AbstractVcs vcs, @Nonnull Runnable doShowAnnotations) { super(LightColors.RED); myEditor = editor; myShowAnnotations = doShowAnnotations; setText(VcsBundle.message("annotation.wrong.line.number.notification.text", vcs.getDisplayName())); createActionLabel("Display anyway", () -> { showAnnotations(); }); createActionLabel("Hide", () -> { hideNotification(); }).setToolTipText("Hide this notification"); }
@Nonnull private static Color getColor(@Nonnull Project project, @Nonnull HighlightSeverity severity) { if (SeverityRegistrar.getSeverityRegistrar(project).compare(severity, HighlightSeverity.ERROR) >= 0) { return LightColors.RED; } if (SeverityRegistrar.getSeverityRegistrar(project).compare(severity, HighlightSeverity.WARNING) >= 0) { return LightColors.YELLOW; } return LightColors.GREEN; }
public ByteCodeViewerComponent(Project project, AnAction[] additionalActions) { super(new BorderLayout()); final EditorFactory factory = EditorFactory.getInstance(); final Document doc = factory.createDocument(""); doc.setReadOnly(true); myEditor = factory.createEditor(doc, project); EditorHighlighterFactory editorHighlighterFactory = EditorHighlighterFactory.getInstance(); final SyntaxHighlighter syntaxHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(PlainTextFileType.INSTANCE, project, null); ((EditorEx) myEditor).setHighlighter(editorHighlighterFactory.createEditorHighlighter(syntaxHighlighter, EditorColorsManager.getInstance().getGlobalScheme())); ((EditorEx) myEditor).setBackgroundColor(EditorFragmentComponent.getBackgroundColor(myEditor)); myEditor.getColorsScheme().setColor(EditorColors.CARET_ROW_COLOR, LightColors.SLIGHTLY_GRAY); ((EditorEx) myEditor).setCaretVisible(true); final EditorSettings settings = myEditor.getSettings(); settings.setLineMarkerAreaShown(false); settings.setIndentGuidesShown(false); settings.setLineNumbersShown(false); settings.setFoldingOutlineShown(false); myEditor.setBorder(null); add(myEditor.getComponent(), BorderLayout.CENTER); final ActionManager actionManager = ActionManager.getInstance(); final DefaultActionGroup actions = new DefaultActionGroup(); if(additionalActions != null) { for(final AnAction action : additionalActions) { actions.add(action); } } add(actionManager.createActionToolbar(ActionPlaces.JAVADOC_TOOLBAR, actions, true).getComponent(), BorderLayout.NORTH); }
protected void customizeCellRenderer(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) { ThreadState threadState = (ThreadState) value; setIcon(getThreadStateIcon(threadState)); if (!selected) { ThreadState selectedThread = (ThreadState)list.getSelectedValue(); if (threadState.isDeadlocked()) { setBackground(LightColors.RED); } else if (selectedThread != null && threadState.isAwaitedBy(selectedThread)) { setBackground(JBColor.YELLOW); } else { setBackground(UIUtil.getListBackground()); } } SimpleTextAttributes attrs = getAttributes(threadState); append(threadState.getName() + " (", attrs); String detail = threadState.getThreadStateDetail(); if (detail == null) { detail = threadState.getState(); } if (detail.length() > 30) { detail = detail.substring(0, 30) + "..."; } append(detail, attrs); append(")", attrs); if (threadState.getExtraState() != null) { append(" [" + threadState.getExtraState() + "]", attrs); } }
public static JBColor getTrackBackgroundDefault() { return new JBColor(LightColors.SLIGHTLY_GRAY, UIUtil.getListBackground()); }
private JBColor getTrackBackground() { return jbColor(LightColors.SLIGHTLY_GRAY, UIUtil.getListBackground()); }
private ActionCallback update(DocumentEvent.EventType type, boolean adjustSelection, boolean now) { if (myUpdateRejected) { return ActionCallback.REJECTED; } String text = getFilterText(); if (text.isEmpty()) { myContext.setHoldingFilter(false); myFiltered = null; } else { myContext.setHoldingFilter(true); myHits = myRegistrar.getConfigurables(myGroups, type, myFiltered, text, myProject); myFiltered = myHits.getAll(); } mySearch.getTextEditor().setBackground(myFiltered != null && myFiltered.isEmpty() ? LightColors.RED : UIUtil.getTextFieldBackground()); Configurable current = myContext.getCurrentConfigurable(); boolean shouldMoveSelection = myHits == null || ( !myHits.getNameFullHits().contains(current) && !myHits.getContentHits().contains(current)); if (shouldMoveSelection && type != DocumentEvent.EventType.INSERT && (myFiltered == null || myFiltered.contains(current))) { shouldMoveSelection = false; } Configurable candidate = adjustSelection ? current : null; if (shouldMoveSelection && myHits != null) { if (!myHits.getNameHits().isEmpty()) { candidate = findConfigurable(myHits.getNameHits(), myHits.getNameFullHits()); } else if (!myHits.getContentHits().isEmpty()) { candidate = findConfigurable(myHits.getContentHits(), null); } } updateSpotlight(false); if ((myFiltered == null || !myFiltered.isEmpty()) && candidate == null && myLastSelected != null) { candidate = myLastSelected; myLastSelected = null; } if (candidate == null && current != null) { myLastSelected = current; } SimpleNode node = !adjustSelection ? null : findNode(candidate); ActionCallback callback = fireUpdate(node, adjustSelection, now); myDocumentWasChanged = true; return callback; }
private void setNotFoundFilterBackground() { myFilterComponent.getTextEditor().setBackground(LightColors.RED); }
public void setNotFoundBackground() { mySearchTextComponent.setBackground(LightColors.RED); }
public TextFeedback() { setBackground(LightColors.YELLOW); }
public CaptionStaticDecorator(RadComponent component) { this(component, LightColors.GREEN); }