View | Details | Raw Unified | Return to bug 207960
Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditorMessages.properties (+2 lines)
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
AddImportOnSelection_label=A&dd Import
13
AddImportOnSelection_label=A&dd Import
Lines 140-145 Link Here
140
SemanticHighlighting_interfaces= Interfaces
141
SemanticHighlighting_interfaces= Interfaces
141
SemanticHighlighting_annotations= Annotations
142
SemanticHighlighting_annotations= Annotations
142
SemanticHighlighting_typeArguments= Type arguments
143
SemanticHighlighting_typeArguments= Type arguments
144
SemanticHighlighting_numbers= Numbers
143
145
144
JavaEditor_markOccurrences_job_name= Occurrences Marker
146
JavaEditor_markOccurrences_job_name= Occurrences Marker
145
147
(-)ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditorMessages.java (+2 lines)
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
package org.eclipse.jdt.internal.ui.javaeditor;
12
package org.eclipse.jdt.internal.ui.javaeditor;
12
13
Lines 145-150 Link Here
145
	public static String SemanticHighlighting_interfaces;
146
	public static String SemanticHighlighting_interfaces;
146
	public static String SemanticHighlighting_annotations;
147
	public static String SemanticHighlighting_annotations;
147
	public static String SemanticHighlighting_typeArguments;
148
	public static String SemanticHighlighting_typeArguments;
149
	public static String SemanticHighlighting_numbers;
148
	public static String JavaEditor_markOccurrences_job_name;
150
	public static String JavaEditor_markOccurrences_job_name;
149
	public static String Editor_OpenPropertiesFile_error_keyNotFound;
151
	public static String Editor_OpenPropertiesFile_error_keyNotFound;
150
	public static String Editor_OpenPropertiesFile_error_fileNotFound_dialogMessage;
152
	public static String Editor_OpenPropertiesFile_error_fileNotFound_dialogMessage;
(-)ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java (+73 lines)
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
	}
(-)plugin.xml (-1 / +11 lines)
Lines 5818-5823 Link Here
5818
         value="100,70,50">
5818
         value="100,70,50">
5819
      </colorDefinition>
5819
      </colorDefinition>
5820
      <colorDefinition
5820
      <colorDefinition
5821
         id="org.eclipse.jdt.ui.numberHighlighting"
5822
         isEditable="false"
5823
         label="%Dummy.label"
5824
         value="42,0,255">
5825
      </colorDefinition>
5826
      <colorDefinition
5821
         id="org.eclipse.jdt.ui.interfaceHighlighting"
5827
         id="org.eclipse.jdt.ui.interfaceHighlighting"
5822
         isEditable="false"
5828
         isEditable="false"
5823
         label="%Dummy.label"
5829
         label="%Dummy.label"
Lines 5834-5840 Link Here
5834
         isEditable="false"
5840
         isEditable="false"
5835
         label="%Dummy.label"
5841
         label="%Dummy.label"
5836
         value="13,100,0">
5842
         value="13,100,0">
5837
      </colorDefinition>
5843
      </colorDefinition>    
5838
      <colorDefinition
5844
      <colorDefinition
5839
         id="org.eclipse.jdt.ui.typeParameterHighlighting"
5845
         id="org.eclipse.jdt.ui.typeParameterHighlighting"
5840
         isEditable="false"
5846
         isEditable="false"
Lines 6025-6030 Link Here
6025
            value="COLOR_WIDGET_DARK_SHADOW">
6031
            value="COLOR_WIDGET_DARK_SHADOW">
6026
         </colorOverride>
6032
         </colorOverride>
6027
         <colorOverride
6033
         <colorOverride
6034
            id="org.eclipse.jdt.ui.numberHighlighting"
6035
            value="COLOR_LIST_FOREGROUND">
6036
         </colorOverride>
6037
         <colorOverride
6028
            id="org.eclipse.jdt.ui.interfaceHighlighting"
6038
            id="org.eclipse.jdt.ui.interfaceHighlighting"
6029
            value="COLOR_LIST_SELECTION">
6039
            value="COLOR_LIST_SELECTION">
6030
         </colorOverride>
6040
         </colorOverride>
(-)ui/org/eclipse/jdt/internal/ui/preferences/JavaEditorColoringConfigurationBlock.java (+2 lines)
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.preferences;
13
package org.eclipse.jdt.internal.ui.preferences;
Lines 884-889 Link Here
884
			{ createHighlightedRange(18, 9,  3, SemanticHighlightings.METHOD) },
885
			{ createHighlightedRange(18, 9,  3, SemanticHighlightings.METHOD) },
885
			{ createHighlightedRange(18, 13,  5, SemanticHighlightings.LOCAL_VARIABLE) },
886
			{ createHighlightedRange(18, 13,  5, SemanticHighlightings.LOCAL_VARIABLE) },
886
			{ createHighlightedRange(18, 22,  9, SemanticHighlightings.AUTOBOXING) },
887
			{ createHighlightedRange(18, 22,  9, SemanticHighlightings.AUTOBOXING) },
888
			{ createHighlightedRange(16, 13, 2, SemanticHighlightings.NUMBER) },
887
		};
889
		};
888
	}
890
	}
889
891

Return to bug 207960