mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Bug 549697: Extract standard colour names
The inconsistency of lower case and upper case in the internal representation of the colour names made it harder than it should be to find where colours are used in the code. Note that the SytleMap creates lower and uppercase entries for each colour. Change-Id: I16b4ebe4a97adecd01f835319aa0f0d175ae3bb6
This commit is contained in:
parent
0a3e5721d4
commit
963ce943ba
3 changed files with 63 additions and 26 deletions
|
@ -29,6 +29,16 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.emulator;
|
||||
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.BLACK;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.BLUE;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.CYAN;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.GREEN;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.MAGENTA;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.RED;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.WHITE;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.WHITE_FOREGROUND;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.YELLOW;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
|
@ -894,35 +904,35 @@ public class VT100Emulator implements ControlListener {
|
|||
break;
|
||||
|
||||
case 30:
|
||||
style = style.setForground("BLACK"); //$NON-NLS-1$
|
||||
style = style.setForground(BLACK);
|
||||
break;
|
||||
|
||||
case 31:
|
||||
style = style.setForground("RED"); //$NON-NLS-1$
|
||||
style = style.setForground(RED);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
style = style.setForground("GREEN"); //$NON-NLS-1$
|
||||
style = style.setForground(GREEN);
|
||||
break;
|
||||
|
||||
case 33:
|
||||
style = style.setForground("YELLOW"); //$NON-NLS-1$
|
||||
style = style.setForground(YELLOW);
|
||||
break;
|
||||
|
||||
case 34:
|
||||
style = style.setForground("BLUE"); //$NON-NLS-1$
|
||||
style = style.setForground(BLUE);
|
||||
break;
|
||||
|
||||
case 35:
|
||||
style = style.setForground("MAGENTA"); //$NON-NLS-1$
|
||||
style = style.setForground(MAGENTA);
|
||||
break;
|
||||
|
||||
case 36:
|
||||
style = style.setForground("CYAN"); //$NON-NLS-1$
|
||||
style = style.setForground(CYAN);
|
||||
break;
|
||||
|
||||
case 37:
|
||||
style = style.setForground("WHITE_FOREGROUND"); //$NON-NLS-1$
|
||||
style = style.setForground(WHITE_FOREGROUND);
|
||||
break;
|
||||
|
||||
case 39: //Foreground: Default
|
||||
|
@ -930,35 +940,35 @@ public class VT100Emulator implements ControlListener {
|
|||
break;
|
||||
|
||||
case 40:
|
||||
style = style.setBackground("BLACK"); //$NON-NLS-1$
|
||||
style = style.setBackground(BLACK);
|
||||
break;
|
||||
|
||||
case 41:
|
||||
style = style.setBackground("RED"); //$NON-NLS-1$
|
||||
style = style.setBackground(RED);
|
||||
break;
|
||||
|
||||
case 42:
|
||||
style = style.setBackground("GREEN"); //$NON-NLS-1$
|
||||
style = style.setBackground(GREEN);
|
||||
break;
|
||||
|
||||
case 43:
|
||||
style = style.setBackground("YELLOW"); //$NON-NLS-1$
|
||||
style = style.setBackground(YELLOW);
|
||||
break;
|
||||
|
||||
case 44:
|
||||
style = style.setBackground("BLUE"); //$NON-NLS-1$
|
||||
style = style.setBackground(BLUE);
|
||||
break;
|
||||
|
||||
case 45:
|
||||
style = style.setBackground("MAGENTA"); //$NON-NLS-1$
|
||||
style = style.setBackground(MAGENTA);
|
||||
break;
|
||||
|
||||
case 46:
|
||||
style = style.setBackground("CYAN"); //$NON-NLS-1$
|
||||
style = style.setBackground(CYAN);
|
||||
break;
|
||||
|
||||
case 47:
|
||||
style = style.setBackground("WHITE"); //$NON-NLS-1$
|
||||
style = style.setBackground(WHITE);
|
||||
break;
|
||||
|
||||
case 49: //Background: Default
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2020 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License 2.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Jonah Graham - extracted colour names from StyleMap to be reused and cross referenced in VT100Emulator
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.textcanvas;
|
||||
|
||||
public class AnsiColorNames {
|
||||
public static final String BLACK = "black"; //$NON-NLS-1$
|
||||
public static final String WHITE = "white"; //$NON-NLS-1$
|
||||
public static final String WHITE_FOREGROUND = "white_foreground"; //$NON-NLS-1$
|
||||
public static final String GRAY = "gray"; //$NON-NLS-1$
|
||||
public static final String MAGENTA = "magenta"; //$NON-NLS-1$
|
||||
public static final String CYAN = "cyan"; //$NON-NLS-1$
|
||||
public static final String YELLOW = "yellow"; //$NON-NLS-1$
|
||||
public static final String BLUE = "blue"; //$NON-NLS-1$
|
||||
public static final String GREEN = "green"; //$NON-NLS-1$
|
||||
public static final String RED = "red"; //$NON-NLS-1$
|
||||
}
|
|
@ -19,6 +19,17 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.textcanvas;
|
||||
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.BLACK;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.BLUE;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.CYAN;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.GRAY;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.GREEN;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.MAGENTA;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.RED;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.WHITE;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.WHITE_FOREGROUND;
|
||||
import static org.eclipse.tm.internal.terminal.textcanvas.AnsiColorNames.YELLOW;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -35,16 +46,6 @@ import org.eclipse.tm.terminal.model.Style;
|
|||
import org.eclipse.tm.terminal.model.StyleColor;
|
||||
|
||||
public class StyleMap {
|
||||
private static final String BLACK = "black"; //$NON-NLS-1$
|
||||
private static final String WHITE = "white"; //$NON-NLS-1$
|
||||
private static final String WHITE_FOREGROUND = "white_foreground"; //$NON-NLS-1$
|
||||
private static final String GRAY = "gray"; //$NON-NLS-1$
|
||||
private static final String MAGENTA = "magenta"; //$NON-NLS-1$
|
||||
private static final String CYAN = "cyan"; //$NON-NLS-1$
|
||||
private static final String YELLOW = "yellow"; //$NON-NLS-1$
|
||||
private static final String BLUE = "blue"; //$NON-NLS-1$
|
||||
private static final String GREEN = "green"; //$NON-NLS-1$
|
||||
private static final String RED = "red"; //$NON-NLS-1$
|
||||
|
||||
private static final String PREFIX = "org.eclipse.tm.internal."; //$NON-NLS-1$
|
||||
String fFontName = ITerminalConstants.FONT_DEFINITION;
|
||||
|
|
Loading…
Add table
Reference in a new issue