mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics
This commit is contained in:
parent
1d28b9bce9
commit
b9d4a197f4
3 changed files with 13 additions and 31 deletions
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.make.internal.ui.text;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.text.source.ISharedTextColors;
|
||||
|
@ -21,7 +20,6 @@ import org.eclipse.swt.graphics.RGB;
|
|||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
public class ColorManager implements ISharedTextColors {
|
||||
|
||||
public static final String MAKE_COMMENT_COLOR ="org.eclipse.cdt.make.ui.editor.comment"; //$NON-NLS-1$
|
||||
public static final String MAKE_KEYWORD_COLOR = "org.eclipse.cdt.make.ui.editor.keyword"; //$NON-NLS-1$
|
||||
public static final String MAKE_FUNCTION_COLOR = "org.eclipse.cdt.make.ui.editor.function"; //$NON-NLS-1$
|
||||
|
@ -52,19 +50,13 @@ public class ColorManager implements ISharedTextColors {
|
|||
|
||||
protected Map<RGB, Color> fColorTable = new HashMap<RGB, Color>(10);
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.source.ISharedTextColors#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
Iterator<Color> e = fColorTable.values().iterator();
|
||||
while (e.hasNext())
|
||||
(e.next()).dispose();
|
||||
for (Color color : fColorTable.values()) {
|
||||
color.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.source.ISharedTextColors#getColor(org.eclipse.swt.graphics.RGB)
|
||||
*/
|
||||
@Override
|
||||
public Color getColor(RGB rgb) {
|
||||
Color color = fColorTable.get(rgb);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2010 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2013 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,22 +10,17 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.internal.ui.text;
|
||||
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||
|
||||
public class CompletionProposalComparator implements Comparator<ICompletionProposal> {
|
||||
|
||||
/**
|
||||
* Constructor for CompletionProposalComparator.
|
||||
*/
|
||||
public CompletionProposalComparator() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see Comparator#compare(Object, Object)
|
||||
*/
|
||||
@Override
|
||||
public int compare(ICompletionProposal c1, ICompletionProposal c2) {
|
||||
return c1.getDisplayString().compareToIgnoreCase(c2.getDisplayString());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2013 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,16 +8,15 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.make.internal.ui.text;
|
||||
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.jface.text.ITextViewer;
|
||||
|
||||
|
||||
/**
|
||||
* Used to scan and detect for SQL keywords
|
||||
* Used to scan and detect for SQL keywords
|
||||
*/
|
||||
public class WordPartDetector {
|
||||
String wordPart = ""; //$NON-NLS-1$
|
||||
|
@ -25,7 +24,7 @@ public class WordPartDetector {
|
|||
|
||||
/**
|
||||
* WordPartDetector.
|
||||
* @param viewer is a text viewer
|
||||
* @param viewer is a text viewer
|
||||
* @param documentOffset into the SQL document
|
||||
*/
|
||||
public WordPartDetector(ITextViewer viewer, int documentOffset) {
|
||||
|
@ -39,7 +38,7 @@ public class WordPartDetector {
|
|||
*/
|
||||
public WordPartDetector(IDocument doc, int documentOffset) {
|
||||
offset = documentOffset - 1;
|
||||
int endOffset = documentOffset;
|
||||
int endOffset = documentOffset;
|
||||
try {
|
||||
IRegion region = doc.getLineInformationOfOffset(documentOffset);
|
||||
int top = region.getOffset();
|
||||
|
@ -48,8 +47,8 @@ public class WordPartDetector {
|
|||
offset--;
|
||||
}
|
||||
while (endOffset < bottom && isMakefileLetter(doc.getChar(endOffset))) {
|
||||
endOffset++;
|
||||
}
|
||||
endOffset++;
|
||||
}
|
||||
//we've been one step too far : increase the offset
|
||||
offset++;
|
||||
wordPart = doc.get(offset, endOffset - offset);
|
||||
|
@ -61,7 +60,7 @@ public class WordPartDetector {
|
|||
public static boolean inMacro(ITextViewer viewer, int offset) {
|
||||
return inMacro(viewer.getDocument(), offset);
|
||||
}
|
||||
|
||||
|
||||
public static boolean inMacro(IDocument document, int offset) {
|
||||
boolean isMacro = false;
|
||||
// Try to figure out if we are in a Macro.
|
||||
|
@ -81,15 +80,11 @@ public class WordPartDetector {
|
|||
return isMacro;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return wordPart;
|
||||
}
|
||||
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue