Lines 7-12
Link Here
|
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Andre Soereng <andreis@fast.no> [syntax highlighting] highlight numbers - https://bugs.eclipse.org/bugs/show_bug.cgi?id=63573 |
10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
11 |
|
12 |
|
12 |
package org.eclipse.jdt.internal.ui.javaeditor; |
13 |
package org.eclipse.jdt.internal.ui.javaeditor; |
Lines 176-181
Link Here
|
176 |
public static final String TYPE_ARGUMENT="typeArgument"; //$NON-NLS-1$ |
177 |
public static final String TYPE_ARGUMENT="typeArgument"; //$NON-NLS-1$ |
177 |
|
178 |
|
178 |
/** |
179 |
/** |
|
|
180 |
* A named preference part that controls the highlighting of numbers |
181 |
* |
182 |
* @since 3.4 |
183 |
*/ |
184 |
public static final String NUMBER="number"; //$NON-NLS-1$ |
185 |
|
186 |
/** |
179 |
* Semantic highlightings |
187 |
* Semantic highlightings |
180 |
*/ |
188 |
*/ |
181 |
private static SemanticHighlighting[] fgSemanticHighlightings; |
189 |
private static SemanticHighlighting[] fgSemanticHighlightings; |
Lines 1582-1587
Link Here
|
1582 |
} |
1590 |
} |
1583 |
|
1591 |
|
1584 |
/** |
1592 |
/** |
|
|
1593 |
* Semantic highlighting for numbers |
1594 |
* @since 3.4 |
1595 |
*/ |
1596 |
private static final class NumberHighlighting extends SemanticHighlighting { |
1597 |
|
1598 |
/* |
1599 |
* @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#getPreferenceKey() |
1600 |
*/ |
1601 |
public String getPreferenceKey() { |
1602 |
return NUMBER; |
1603 |
} |
1604 |
|
1605 |
/* |
1606 |
* @see org.eclipse.jdt.internal.ui.javaeditor.ISemanticHighlighting#getDefaultTextColor() |
1607 |
*/ |
1608 |
public RGB getDefaultDefaultTextColor() { |
1609 |
return new RGB(42, 0, 255); |
1610 |
} |
1611 |
|
1612 |
/* |
1613 |
* @see org.eclipse.jdt.internal.ui.javaeditor.ISemanticHighlighting#getDefaultTextStyleBold() |
1614 |
*/ |
1615 |
public boolean isBoldByDefault() { |
1616 |
return false; |
1617 |
} |
1618 |
|
1619 |
/* |
1620 |
* @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#isItalicByDefault() |
1621 |
*/ |
1622 |
public boolean isItalicByDefault() { |
1623 |
return false; |
1624 |
} |
1625 |
|
1626 |
/* |
1627 |
* @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#isEnabledByDefault() |
1628 |
*/ |
1629 |
public boolean isEnabledByDefault() { |
1630 |
return true; |
1631 |
} |
1632 |
|
1633 |
/* |
1634 |
* @see org.eclipse.jdt.internal.ui.javaeditor.ISemanticHighlighting#getDisplayName() |
1635 |
*/ |
1636 |
public String getDisplayName() { |
1637 |
return JavaEditorMessages.SemanticHighlighting_numbers; |
1638 |
} |
1639 |
|
1640 |
/* |
1641 |
* @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#consumes(org.eclipse.jdt.internal.ui.javaeditor.SemanticToken) |
1642 |
*/ |
1643 |
public boolean consumes(SemanticToken token) { |
1644 |
return false; |
1645 |
} |
1646 |
|
1647 |
/* |
1648 |
* @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#consumesLiteral(org.eclipse.jdt.internal.ui.javaeditor.SemanticToken) |
1649 |
*/ |
1650 |
public boolean consumesLiteral(SemanticToken token) { |
1651 |
Expression expr= token.getLiteral(); |
1652 |
return expr != null && expr.getNodeType() == ASTNode.NUMBER_LITERAL; |
1653 |
} |
1654 |
} |
1655 |
|
1656 |
/** |
1585 |
* A named preference that controls the given semantic highlighting's color. |
1657 |
* A named preference that controls the given semantic highlighting's color. |
1586 |
* |
1658 |
* |
1587 |
* @param semanticHighlighting the semantic highlighting |
1659 |
* @param semanticHighlighting the semantic highlighting |
Lines 1669-1674
Link Here
|
1669 |
new EnumHighlighting(), |
1741 |
new EnumHighlighting(), |
1670 |
new AnnotationHighlighting(), // before interfaces |
1742 |
new AnnotationHighlighting(), // before interfaces |
1671 |
new InterfaceHighlighting(), |
1743 |
new InterfaceHighlighting(), |
|
|
1744 |
new NumberHighlighting(), |
1672 |
}; |
1745 |
}; |
1673 |
return fgSemanticHighlightings; |
1746 |
return fgSemanticHighlightings; |
1674 |
} |
1747 |
} |