use of com.intellij.ui.JBColor in project intellij-community by JetBrains.
the class LessonDirectoryNode method updateImpl.
@Override
protected void updateImpl(PresentationData data) {
StudyStatus status = myLesson.getStatus();
boolean isSolved = status != StudyStatus.Solved;
JBColor color = isSolved ? JBColor.BLACK : LIGHT_GREEN;
Icon icon = isSolved ? InteractiveLearningIcons.Lesson : InteractiveLearningIcons.LessonCompl;
updatePresentation(data, myLesson.getName(), color, icon, null);
}
use of com.intellij.ui.JBColor in project intellij-community by JetBrains.
the class TaskDirectoryNode method updateImpl.
@Override
protected void updateImpl(PresentationData data) {
StudyStatus status = myTask.getStatus();
String subtaskInfo = myTask.hasSubtasks() ? getSubtaskInfo() : null;
if (status == StudyStatus.Unchecked) {
updatePresentation(data, myTask.getName(), JBColor.BLACK, InteractiveLearningIcons.Task, subtaskInfo);
return;
}
boolean isSolved = status == StudyStatus.Solved;
JBColor color = isSolved ? LIGHT_GREEN : JBColor.RED;
Icon icon = isSolved ? InteractiveLearningIcons.TaskCompl : InteractiveLearningIcons.TaskProbl;
updatePresentation(data, myTask.getName(), color, icon, subtaskInfo);
}
use of com.intellij.ui.JBColor in project intellij-community by JetBrains.
the class StudyProgressBar method paintComponent.
protected void paintComponent(Graphics g) {
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
Graphics2D g2 = (Graphics2D) g;
if (myFraction > 1) {
myFraction = 1;
}
Dimension size = getSize();
double width = size.getWidth() - 2 * myIndent;
g2.setPaint(UIUtil.getTextFieldBackground());
Rectangle2D rect = new Rectangle2D.Double(myIndent, 0, width, myHeight);
g2.fill(rect);
g2.setPaint(new JBColor(SHADOW1, JBColor.border()));
rect.setRect(myIndent, 0, width, myHeight);
int arcWidth = 5;
int arcHeight = 5;
g2.drawRoundRect(myIndent, 0, (int) width, myHeight, arcWidth, arcHeight);
g2.setPaint(SHADOW2);
int y_center = myHeight / 2;
int y_steps = myHeight / 2 - 3;
int alpha_step = y_steps > 0 ? (255 - 70) / y_steps : 255 - 70;
int x_offset = 4;
g.setClip(4 + myIndent, 3, (int) width - 6, myHeight - 4);
int bricksToDraw = myFraction == 0 ? 0 : getBricksToDraw(myFraction);
for (int i = 0; i < bricksToDraw; i++) {
g2.setPaint(myColor);
UIUtil.drawLine(g2, x_offset, y_center, x_offset + BRICK_WIDTH - 1, y_center);
for (int j = 0; j < y_steps; j++) {
Color color = ColorUtil.toAlpha(myColor, 255 - alpha_step * (j + 1));
g2.setPaint(color);
UIUtil.drawLine(g2, x_offset, y_center - 1 - j, x_offset + BRICK_WIDTH - 1, y_center - 1 - j);
if (!(y_center % 2 != 0 && j == y_steps - 1)) {
UIUtil.drawLine(g2, x_offset, y_center + 1 + j, x_offset + BRICK_WIDTH - 1, y_center + 1 + j);
}
}
g2.setColor(ColorUtil.toAlpha(myColor, 255 - alpha_step * (y_steps / 2 + 1)));
g2.drawRect(x_offset, y_center - y_steps, BRICK_WIDTH - 1, myHeight - 7);
x_offset += BRICK_WIDTH + BRICK_SPACE;
}
config.restore();
}
use of com.intellij.ui.JBColor in project intellij-community by JetBrains.
the class VariantsCompletionAction method actionPerformed.
@Override
public void actionPerformed(final AnActionEvent e) {
final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
if (editor == null)
return;
final String prefix = myTextField.getText().substring(0, myTextField.getCaretPosition());
if (StringUtil.isEmpty(prefix))
return;
final String[] array = calcWords(prefix, editor);
if (array.length == 0) {
return;
}
FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
final JList list = new JBList(array) {
@Override
protected void paintComponent(final Graphics g) {
GraphicsUtil.setupAntialiasing(g);
super.paintComponent(g);
}
};
list.setBackground(new JBColor(new Color(235, 244, 254), new Color(0x4C4F51)));
list.setFont(editor.getColorsScheme().getFont(EditorFontType.PLAIN));
Utils.showCompletionPopup(e.getInputEvent() instanceof MouseEvent ? myTextField : null, list, null, myTextField, null);
}
use of com.intellij.ui.JBColor in project intellij-community by JetBrains.
the class Bookmark method createHighlighter.
public RangeHighlighter createHighlighter(@NotNull MarkupModelEx markup) {
final RangeHighlighterEx highlighter;
int line = getLine();
if (line >= 0) {
highlighter = markup.addPersistentLineHighlighter(line, HighlighterLayer.ERROR + 1, null);
if (highlighter != null) {
highlighter.setGutterIconRenderer(new MyGutterIconRenderer(this));
TextAttributes textAttributes = ObjectUtils.notNull(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.BOOKMARKS_ATTRIBUTES), new TextAttributes());
Color stripeColor = ObjectUtils.notNull(textAttributes.getErrorStripeColor(), new JBColor(0x000000, 0xdbdbdb));
highlighter.setErrorStripeMarkColor(stripeColor);
highlighter.setErrorStripeTooltip(getBookmarkTooltip());
TextAttributes attributes = highlighter.getTextAttributes();
if (attributes == null) {
attributes = new TextAttributes();
}
attributes.setBackgroundColor(textAttributes.getBackgroundColor());
attributes.setForegroundColor(textAttributes.getForegroundColor());
highlighter.setTextAttributes(attributes);
}
} else {
highlighter = null;
}
myHighlighterRef = highlighter == null ? null : new WeakReference<>(highlighter);
return highlighter;
}
Aggregations