mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
Cosmetics.
This commit is contained in:
parent
c6630246d9
commit
0c0523d642
3 changed files with 12 additions and 42 deletions
|
@ -1,11 +1,11 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2009 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* QNX Software System
|
* QNX Software System
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
|
@ -22,14 +22,12 @@ import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.text.IColorManager;
|
import org.eclipse.cdt.ui.text.IColorManager;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CDT color manager.
|
* CDT color manager.
|
||||||
*/
|
*/
|
||||||
public class CColorManager implements IColorManager {
|
public class CColorManager implements IColorManager {
|
||||||
|
protected Map<String, RGB> fKeyTable= new HashMap<>(10);
|
||||||
protected Map<String, RGB> fKeyTable= new HashMap<String, RGB>(10);
|
protected Map<Display, Map<RGB, Color>> fDisplayTable= new HashMap<>(2);
|
||||||
protected Map<Display, Map<RGB, Color>> fDisplayTable= new HashMap<Display, Map<RGB, Color>>(2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag which tells if the colors are automatically disposed when
|
* Flag which tells if the colors are automatically disposed when
|
||||||
|
@ -51,7 +49,8 @@ public class CColorManager implements IColorManager {
|
||||||
*
|
*
|
||||||
* @param autoDisposeOnDisplayDispose if <code>true</code> the color manager
|
* @param autoDisposeOnDisplayDispose if <code>true</code> the color manager
|
||||||
* automatically disposes all managed colors when the current display gets disposed
|
* automatically disposes all managed colors when the current display gets disposed
|
||||||
* and all calls to {@link org.eclipse.jface.text.source.ISharedTextColors#dispose()} are ignored.
|
* and all calls to {@link org.eclipse.jface.text.source.ISharedTextColors#dispose()} are
|
||||||
|
* ignored.
|
||||||
*
|
*
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
|
@ -68,19 +67,15 @@ public class CColorManager implements IColorManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IColorManager#getColor(RGB)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Color getColor(RGB rgb) {
|
public Color getColor(RGB rgb) {
|
||||||
|
|
||||||
if (rgb == null)
|
if (rgb == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
final Display display= Display.getCurrent();
|
final Display display= Display.getCurrent();
|
||||||
Map<RGB, Color> colorTable= fDisplayTable.get(display);
|
Map<RGB, Color> colorTable= fDisplayTable.get(display);
|
||||||
if (colorTable == null) {
|
if (colorTable == null) {
|
||||||
colorTable= new HashMap<RGB, Color>(10);
|
colorTable= new HashMap<>(10);
|
||||||
fDisplayTable.put(display, colorTable);
|
fDisplayTable.put(display, colorTable);
|
||||||
if (fAutoDisposeOnDisplayDispose) {
|
if (fAutoDisposeOnDisplayDispose) {
|
||||||
display.disposeExec(new Runnable() {
|
display.disposeExec(new Runnable() {
|
||||||
|
@ -101,18 +96,12 @@ public class CColorManager implements IColorManager {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IColorManager#dispose
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (!fAutoDisposeOnDisplayDispose)
|
if (!fAutoDisposeOnDisplayDispose)
|
||||||
dispose(Display.getCurrent());
|
dispose(Display.getCurrent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IColorManager#getColor(String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Color getColor(String key) {
|
public Color getColor(String key) {
|
||||||
|
|
||||||
|
@ -123,9 +112,6 @@ public class CColorManager implements IColorManager {
|
||||||
return getColor(rgb);
|
return getColor(rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IColorManager#bindColor(String, RGB)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void bindColor(String key, RGB rgb) {
|
public void bindColor(String key, RGB rgb) {
|
||||||
Object value= fKeyTable.get(key);
|
Object value= fKeyTable.get(key);
|
||||||
|
@ -135,9 +121,6 @@ public class CColorManager implements IColorManager {
|
||||||
fKeyTable.put(key, rgb);
|
fKeyTable.put(key, rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IColorManager#unbindColor(String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void unbindColor(String key) {
|
public void unbindColor(String key) {
|
||||||
fKeyTable.remove(key);
|
fKeyTable.remove(key);
|
||||||
|
|
|
@ -14,15 +14,10 @@ package org.eclipse.cdt.internal.ui.text.util;
|
||||||
|
|
||||||
import org.eclipse.jface.text.rules.IWhitespaceDetector;
|
import org.eclipse.jface.text.rules.IWhitespaceDetector;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple white space detector.
|
* A simple white space detector.
|
||||||
*/
|
*/
|
||||||
public class CWhitespaceDetector implements IWhitespaceDetector {
|
public class CWhitespaceDetector implements IWhitespaceDetector {
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IWhitespaceDetector#isWhitespace(char)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWhitespace(char c) {
|
public boolean isWhitespace(char c) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
|
|
@ -13,23 +13,15 @@ package org.eclipse.cdt.internal.ui.text.util;
|
||||||
|
|
||||||
import org.eclipse.jface.text.rules.IWordDetector;
|
import org.eclipse.jface.text.rules.IWordDetector;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A C aware word detector.
|
* A C aware word detector.
|
||||||
*/
|
*/
|
||||||
public class CWordDetector implements IWordDetector {
|
public class CWordDetector implements IWordDetector {
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWordStart(char c) {
|
public boolean isWordStart(char c) {
|
||||||
return Character.isJavaIdentifierStart(c) || c == '@';
|
return Character.isJavaIdentifierStart(c) || c == '@';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWordPart(char c) {
|
public boolean isWordPart(char c) {
|
||||||
return Character.isJavaIdentifierPart(c);
|
return Character.isJavaIdentifierPart(c);
|
||||||
|
|
Loading…
Add table
Reference in a new issue