1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-01-15 18:17:44 -08:00
parent 93619fcb12
commit 0835b4737d
7 changed files with 25 additions and 165 deletions

View file

@ -770,7 +770,7 @@ final public class Lexer implements ITokenSequence {
break;
}
if (fInput.get(delimEndOffset) == '(') {
offset= delimEndOffset+1;
offset= delimEndOffset + 1;
break;
}
}
@ -784,17 +784,17 @@ final public class Lexer implements ITokenSequence {
final char c= fInput.get(offset);
if (c == ')') {
final int endingDoubleQuoteOffset= offset+delimLength+1;
final int endingDoubleQuoteOffset= offset + delimLength + 1;
if (fInput.isValidOffset(endingDoubleQuoteOffset) && fInput.get(endingDoubleQuoteOffset) == '"') {
boolean prefixMatches= true;
for (int i = 0; i < delimLength; i++) {
if (fInput.get(offset + i + 1) != fInput.get(delimOffset+i)) {
if (fInput.get(offset + i + 1) != fInput.get(delimOffset + i)) {
prefixMatches= false;
break;
}
}
if (prefixMatches) {
offset= endingDoubleQuoteOffset+1;
offset= endingDoubleQuoteOffset + 1;
break;
}
}

View file

@ -28,26 +28,21 @@ import org.eclipse.cdt.ui.text.ICPartitions;
import org.eclipse.cdt.internal.ui.text.CTextTools;
/**
* Tests to verify the C partitioning.
* Derived from JavaPartitionerTest.
*/
public class CPartitionerTest extends TestCase {
private CTextTools fTextTools;
private Document fDocument;
protected boolean fDocumentPartitioningChanged;
public CPartitionerTest(String name) {
super(name);
}
@Override
protected void setUp() {
fTextTools= new CTextTools();
fDocument= new Document();
@ -84,7 +79,6 @@ public class CPartitionerTest extends TestCase {
}
protected void checkPartitioning(ITypedRegion[] expectation, ITypedRegion[] result) {
assertEquals("invalid number of partitions", expectation.length, result.length);
for (int i= 0; i < expectation.length; i++) {
@ -92,12 +86,10 @@ public class CPartitionerTest extends TestCase {
ITypedRegion r= result[i];
assertTrue(print(r) + " != " + print(e), r.equals(e));
}
}
public void testInitialPartitioning() {
try {
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -121,7 +113,6 @@ public class CPartitionerTest extends TestCase {
public void testIntraPartitionChange() {
try {
fDocument.replace(34, 3, "y");
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\ny\n/***/\nxxx");
@ -148,7 +139,6 @@ public class CPartitionerTest extends TestCase {
public void testIntraPartitionChange2() {
try {
fDocument.replace(41, 0, "yyy");
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/**yyy*/\nxxx");
@ -172,9 +162,9 @@ public class CPartitionerTest extends TestCase {
assertTrue(false);
}
}
public void testInsertNewPartition() {
try {
fDocument.replace(35, 1, "/***/");
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx/***/x\n/***/\nxxx");
@ -200,9 +190,9 @@ public class CPartitionerTest extends TestCase {
assertTrue(false);
}
}
public void testInsertStringPartition() {
try {
fDocument.replace(35, 1, "\"yyy\"");
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
@ -228,9 +218,9 @@ public class CPartitionerTest extends TestCase {
assertTrue(false);
}
}
public void testInsertCharacterPartition() {
try {
fDocument.replace(35, 1, "'y'");
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
@ -256,9 +246,9 @@ public class CPartitionerTest extends TestCase {
assertTrue(false);
}
}
public void testInsertPreprocessorPartition() {
try {
fDocument.replace(4, 0, " # include <x.h>\n");
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
// "xxx\n # include <x.h>\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
@ -287,13 +277,11 @@ public class CPartitionerTest extends TestCase {
public void testRemovePartition1() {
try {
fDocument.replace(13, 16, null);
// "xxx\n/*xxx*/\nx/**/\nxxx\n/***/\nxxx");
assertTrue(fDocumentPartitioningChanged);
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
new TypedRegion(0, 4, IDocument.DEFAULT_CONTENT_TYPE),
@ -312,12 +300,10 @@ public class CPartitionerTest extends TestCase {
}
public void testRemovePartition2() {
testJoinPartition3();
fDocumentPartitioningChanged= false;
try {
fDocument.replace(5, 2, null);
// "xxx\nxxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
@ -340,10 +326,8 @@ public class CPartitionerTest extends TestCase {
}
}
public void testJoinPartitions1() {
try {
fDocument.replace(31, 1, null);
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
@ -368,7 +352,6 @@ public class CPartitionerTest extends TestCase {
public void testJoinPartitions2() {
try {
fDocument.replace(32, 1, null);
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
@ -393,7 +376,6 @@ public class CPartitionerTest extends TestCase {
public void testJoinPartition3() {
try {
fDocument.replace(9, 2, null);
// "xxx\n/*xxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
@ -416,22 +398,16 @@ public class CPartitionerTest extends TestCase {
}
}
public void testSplitPartition1() {
testJoinPartitions1();
fDocumentPartitioningChanged= false;
try {
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
fDocument.replace(31, 0, "*");
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
assertTrue(fDocumentPartitioningChanged);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -440,18 +416,15 @@ public class CPartitionerTest extends TestCase {
}
public void testSplitPartition2() {
testJoinPartitions2();
fDocumentPartitioningChanged= false;
try {
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
fDocument.replace(32, 0, "/");
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
assertTrue(fDocumentPartitioningChanged);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -460,11 +433,9 @@ public class CPartitionerTest extends TestCase {
}
public void testSplitPartition3() {
fDocumentPartitioningChanged= false;
try {
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
fDocument.replace(12, 9, "");
// "xxx\n/*xxx*/\nx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
@ -490,7 +461,6 @@ public class CPartitionerTest extends TestCase {
public void testCorruptPartitioning1() {
try {
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -513,7 +483,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(14, 1, IDocument.DEFAULT_CONTENT_TYPE),
new TypedRegion(15, 7, ICPartitions.C_MULTI_LINE_COMMENT)
};
} catch (BadLocationException x) {
assertTrue(false);
}
@ -521,7 +490,6 @@ public class CPartitionerTest extends TestCase {
public void testCorruptPartitioning2() {
try {
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/\n/***/");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -548,7 +516,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(22, 1, IDocument.DEFAULT_CONTENT_TYPE),
new TypedRegion(23, 5, ICPartitions.C_MULTI_LINE_COMMENT)
};
} catch (BadLocationException x) {
assertTrue(false);
}
@ -556,7 +523,6 @@ public class CPartitionerTest extends TestCase {
public void testCorruptPartitioning3() {
try {
fDocument.replace(0, fDocument.getLength(), "/***/\n/**/");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -581,7 +547,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(17, 1, IDocument.DEFAULT_CONTENT_TYPE),
new TypedRegion(18, 5, ICPartitions.C_MULTI_LINE_COMMENT)
};
} catch (BadLocationException x) {
assertTrue(false);
}
@ -589,7 +554,6 @@ public class CPartitionerTest extends TestCase {
public void testOpenPartition1() {
try {
fDocument.replace(42, 1, null);
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***\nxxx"
@ -616,7 +580,6 @@ public class CPartitionerTest extends TestCase {
public void testOpenPartition2() {
try {
fDocument.replace(47, 0, "/*");
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx/*"
@ -646,7 +609,6 @@ public class CPartitionerTest extends TestCase {
public void testPartitionFinder() {
try {
ITypedRegion[] partitioning= fDocument.computePartitioning(0, fDocument.getLength());
for (int i= 0; i < partitioning.length; i++) {
@ -656,7 +618,6 @@ public class CPartitionerTest extends TestCase {
assertTrue(expected.equals(result));
}
}
} catch (BadLocationException x) {
assertTrue(false);
}
@ -664,7 +625,6 @@ public class CPartitionerTest extends TestCase {
public void testExtendPartition() {
try {
fDocument.replace(0, fDocument.getLength(), "/*");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -681,7 +641,6 @@ public class CPartitionerTest extends TestCase {
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -689,7 +648,6 @@ public class CPartitionerTest extends TestCase {
public void testTogglePartition() {
try {
fDocument.replace(0, fDocument.getLength(), "\t/*\n\tx\n\t/*/\n\ty\n//\t*/");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -712,7 +670,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(10, 12, ICPartitions.C_MULTI_LINE_COMMENT)
};
checkPartitioning(expectation2, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -720,7 +677,6 @@ public class CPartitionerTest extends TestCase {
public void testEditing1() {
try {
fDocument.replace(0, fDocument.getLength(), "");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -749,7 +705,6 @@ public class CPartitionerTest extends TestCase {
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -757,7 +712,6 @@ public class CPartitionerTest extends TestCase {
public void testEditing2() {
try {
fDocument.replace(0, fDocument.getLength(), "");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -794,7 +748,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_MULTI_LINE_COMMENT)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -802,7 +755,6 @@ public class CPartitionerTest extends TestCase {
public void testEditing3() {
try {
fDocument.replace(0, fDocument.getLength(), "");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -831,7 +783,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(8, 1, IDocument.DEFAULT_CONTENT_TYPE)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -839,7 +790,6 @@ public class CPartitionerTest extends TestCase {
public void testEditingString() {
try {
fDocument.replace(0, fDocument.getLength(), "");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -904,7 +854,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(5, 2, ICPartitions.C_STRING)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -912,7 +861,6 @@ public class CPartitionerTest extends TestCase {
public void testEditingCharacter() {
try {
fDocument.replace(0, fDocument.getLength(), "");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -977,7 +925,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(5, 2, ICPartitions.C_CHARACTER)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -985,7 +932,6 @@ public class CPartitionerTest extends TestCase {
public void testEditingPreprocessor() {
try {
fDocument.replace(0, fDocument.getLength(), "");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -1096,7 +1042,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(33, 1, IDocument.DEFAULT_CONTENT_TYPE)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1104,7 +1049,6 @@ public class CPartitionerTest extends TestCase {
public void testLineSplicing_Bug124113() {
try {
fDocument.replace(0, fDocument.getLength(), "// comment... \\\\\ncontinued");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -1136,7 +1080,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_CHARACTER)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1144,7 +1087,6 @@ public class CPartitionerTest extends TestCase {
public void testCommentInPreprocessorString() {
try {
fDocument.replace(0, fDocument.getLength(), "#define S \"http://www.foo.bar\"");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
@ -1160,7 +1102,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_PREPROCESSOR)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1168,7 +1109,6 @@ public class CPartitionerTest extends TestCase {
public void testString1() {
try {
fDocument.replace(0, fDocument.getLength(), "\"[string]\"");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
@ -1184,7 +1124,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(10, 9, ICPartitions.C_STRING)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1192,7 +1131,6 @@ public class CPartitionerTest extends TestCase {
public void testString2() {
try {
fDocument.replace(0, fDocument.getLength(), "\"string\"RRRRRRRR\"string\"nostring");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
@ -1202,7 +1140,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(24, 8, IDocument.DEFAULT_CONTENT_TYPE)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1210,7 +1147,6 @@ public class CPartitionerTest extends TestCase {
public void testRawString1() {
try {
fDocument.replace(0, fDocument.getLength(), "R\"(line 1\n/*line 2*/\nline 3\n)\"");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
@ -1235,7 +1171,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(1, fDocument.getLength() - 1, ICPartitions.C_STRING)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1243,7 +1178,6 @@ public class CPartitionerTest extends TestCase {
public void testRawString2() {
try {
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\"");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
@ -1261,7 +1195,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(13, fDocument.getLength() - 13, ICPartitions.C_STRING)
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1269,7 +1202,6 @@ public class CPartitionerTest extends TestCase {
public void testRawString3() {
try {
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
@ -1291,7 +1223,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1299,7 +1230,6 @@ public class CPartitionerTest extends TestCase {
public void testRawString_Bug352544() {
try {
fDocument.replace(0, fDocument.getLength(), "BAR\"(\";");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
@ -1308,7 +1238,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(6, 1, IDocument.DEFAULT_CONTENT_TYPE),
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1316,7 +1245,6 @@ public class CPartitionerTest extends TestCase {
public void testEditingRawString1() {
try {
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
@ -1351,7 +1279,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1359,7 +1286,6 @@ public class CPartitionerTest extends TestCase {
public void testEditingRawString2() {
try {
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
@ -1402,7 +1328,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(6, fDocument.getLength() - 6, ICPartitions.C_STRING),
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}
@ -1410,7 +1335,6 @@ public class CPartitionerTest extends TestCase {
public void testEditingRawString3() {
try {
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
TypedRegion[] expectation= {
@ -1433,7 +1357,6 @@ public class CPartitionerTest extends TestCase {
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
};
checkPartitioning(expectation, result);
} catch (BadLocationException x) {
assertTrue(false);
}

View file

@ -10,7 +10,6 @@
* Anton Leherbauer (Wind River Systems
* Andrew Ferguson (Symbian)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.preferences;
import java.io.BufferedReader;
@ -81,7 +80,6 @@ import org.eclipse.cdt.internal.ui.text.util.CColorManager;
* @since 4.0
*/
class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
/**
* Item in the highlighting color list.
*/
@ -161,7 +159,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
}
private static class SemanticHighlightingColorListItem extends HighlightingColorListItem {
/** Enablement preference key */
private final String fEnableKey;
@ -175,7 +172,8 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
* @param underlineKey the underlineKey preference key
* @param enableKey the enable preference key
*/
public SemanticHighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey, String enableKey) {
public SemanticHighlightingColorListItem(String displayName, String colorKey, String boldKey,
String italicKey, String strikethroughKey, String underlineKey, String enableKey) {
super(displayName, colorKey, boldKey, italicKey, strikethroughKey, underlineKey);
fEnableKey= enableKey;
}
@ -192,9 +190,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
* Color list label provider.
*/
private class ColorListLabelProvider extends LabelProvider implements IColorProvider {
/*
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
*/
@Override
public String getText(Object element) {
if (element instanceof String)
@ -202,17 +197,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
return ((HighlightingColorListItem)element).getDisplayName();
}
/*
* @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
*/
@Override
public Color getBackground(Object element) {
return null;
}
/*
* @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
*/
@Override
public Color getForeground(Object element) {
if (element instanceof SemanticHighlightingColorListItem) {
@ -228,25 +217,15 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
* Color list content provider.
*/
private class ColorListContentProvider implements ITreeContentProvider {
/*
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
@Override
public Object[] getElements(Object inputElement) {
return new String[] {fCodeCategory, fAssemblyCategory, fCommentsCategory, fPreprocessorCategory, fDoxygenCategory};
}
/*
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override
public void dispose() {
}
/*
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@ -564,7 +543,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
}
private Control createSyntaxPage(final Composite parent) {
Composite colorComposite= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout();
layout.marginHeight= 0;

View file

@ -9,7 +9,6 @@
* IBM Corporation - initial API and implementation
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.preferences;
import org.eclipse.swt.widgets.Composite;
@ -19,8 +18,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
/**
* Code coloring preference page.
* <p>
@ -30,41 +27,27 @@ import org.eclipse.cdt.internal.ui.ICHelpContextIds;
* @since 4.0
*/
public class CEditorColoringPreferencePage extends AbstractConfigurationBlockPreferencePage {
/*
* @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
*/
@Override
protected String getHelpId() {
return ICHelpContextIds.C_EDITOR_COLORS_PREF_PAGE;
}
/*
* @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
*/
@Override
protected void setDescription() {
String description= PreferencesMessages.CEditorPreferencePage_colors;
setDescription(description);
}
@Override
protected Label createDescriptionLabel(Composite parent) {
return null;
}
/*
* @see org.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setPreferenceStore()
*/
@Override
protected void setPreferenceStore() {
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
}
/*
* @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
*/
@Override
protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) {
return new CEditorColoringConfigurationBlock(overlayPreferenceStore);

View file

@ -32,7 +32,6 @@ import org.eclipse.cdt.internal.ui.text.util.CWordDetector;
* @since 4.0
*/
public class CPreprocessorScanner extends AbstractCScanner {
/** Properties for tokens. */
private static String[] fgTokenProperties= {
ICColorConstants.C_KEYWORD,

View file

@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.rules.ICharacterScanner;
@ -24,13 +23,11 @@ import org.eclipse.jface.text.rules.Token;
import org.eclipse.cdt.ui.text.ICPartitions;
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
/**
* This scanner recognizes the C multi line comments, C single line comments,
* C strings, C characters and C preprocessor directives.
*/
public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitions {
// states
private static final int CCODE= 0;
private static final int SINGLE_LINE_COMMENT= 1;
@ -115,7 +112,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
*/
@Override
public IToken nextToken() {
fTokenOffset += fTokenLength;
fTokenLength= fPrefixLength;
@ -135,7 +131,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
fLast= NONE; // ignore last
if (fTokenLength > 0) {
return preFix(fState, CCODE, NONE, 0);
} else {
fPrefixLength= 0;
return Token.EOF;
@ -165,7 +160,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
fState= CCODE;
return token;
} else {
consume();
continue;
@ -220,7 +214,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
case STRING:
case PREPROCESSOR:
case PREPROCESSOR_STRING:
int last;
int newState;
switch (ch) {
@ -304,7 +297,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
fTokenLength= fPrefixLength;
break;
}
} else {
fTokenLength++;
fLast= SLASH;
@ -321,7 +313,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
fTokenLength= fPrefixLength;
break;
}
} else {
consume();
break;
@ -603,7 +594,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
case BACKSLASH_CR:
case BACKSLASH_BACKSLASH:
return 2;
}
}
@ -624,7 +614,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
return fTokens[interceptTokenState(state)];
}
private final IToken preFix(int state, int newState, int last, int prefixLength) {
fTokenLength -= getLastLength(fLast);
fLast= last;
@ -634,33 +623,25 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
}
private static int getState(String contentType) {
if (contentType == null)
if (contentType == null) {
return CCODE;
else if (contentType.equals(C_SINGLE_LINE_COMMENT))
} else if (contentType.equals(C_SINGLE_LINE_COMMENT)) {
return SINGLE_LINE_COMMENT;
else if (contentType.equals(C_MULTI_LINE_COMMENT))
} else if (contentType.equals(C_MULTI_LINE_COMMENT)) {
return MULTI_LINE_COMMENT;
else if (contentType.equals(C_STRING))
} else if (contentType.equals(C_STRING)) {
return STRING;
else if (contentType.equals(C_CHARACTER))
} else if (contentType.equals(C_CHARACTER)) {
return CHARACTER;
else if (contentType.equals(C_PREPROCESSOR))
} else if (contentType.equals(C_PREPROCESSOR)) {
return PREPROCESSOR;
else if (contentType.equals(C_SINGLE_LINE_DOC_COMMENT))
} else if (contentType.equals(C_SINGLE_LINE_DOC_COMMENT)) {
return SINGLE_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
else if (contentType.equals(C_MULTI_LINE_DOC_COMMENT))
} else if (contentType.equals(C_MULTI_LINE_DOC_COMMENT)) {
return MULTI_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
else
} else {
return CCODE;
}
}
/*
@ -705,9 +686,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
}
}
/*
* @see ITokenScanner#setRange(IDocument, int, int)
*/
@Override
public void setRange(IDocument document, int offset, int length) {
fDocument= document;
@ -743,15 +721,15 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
}
private int interceptTokenState(int proposedTokenState) {
if(fOwner!=null) {
switch(proposedTokenState) {
if (fOwner != null) {
switch (proposedTokenState) {
case MULTI_LINE_COMMENT:
if(fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
if (fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
return MULTI_LINE_DOC_COMMENT;
break;
case SINGLE_LINE_COMMENT:
if(fOwner.getSinglelineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
if (fOwner.getSinglelineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
return SINGLE_LINE_DOC_COMMENT;
break;

View file

@ -23,7 +23,6 @@ import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
* A slightly adapted FastPartitioner.
*/
public class FastCPartitioner extends FastPartitioner {
/**
* Creates a new partitioner for the given content types.
*
@ -72,7 +71,7 @@ public class FastCPartitioner extends FastPartitioner {
* @since 5.0
*/
public IDocCommentOwner getDocCommentOwner() {
if(fScanner instanceof FastCPartitionScanner) {
if (fScanner instanceof FastCPartitionScanner) {
return ((FastCPartitionScanner)fScanner).getDocCommentOwner();
}
return null;