mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 03:55:22 +02:00
Propagating bug fixes to branch.
This commit is contained in:
parent
32ee20f338
commit
aa79b7dfa8
5 changed files with 84 additions and 64 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-07-05 Hoda Amer
|
||||
Patch for Keith Campbell, a small fix in CConventions.
|
||||
|
||||
2004-06-29 Alain Magloire
|
||||
|
||||
Possible fix for 68665
|
||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core;
|
|||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.cdt.core.parser.CodeReader;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.IScanner;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
|
@ -24,47 +25,48 @@ import org.eclipse.cdt.internal.core.Util;
|
|||
import org.eclipse.cdt.internal.core.model.CModelStatus;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
|
||||
public class CConventions {
|
||||
private final static String scopeResolutionOperator= "::"; //$NON-NLS-1$
|
||||
private final static char fgDot= '.';
|
||||
//private final static char fgColon= ':';
|
||||
|
||||
private static boolean isLegalIdentifier(String name) {
|
||||
if (name == null) {
|
||||
return false;
|
||||
}
|
||||
String trimmed = name.trim();
|
||||
if ((!name.equals(trimmed)) || (name.indexOf(" ") != -1) ){ //$NON-NLS-1$
|
||||
|
||||
if (name.indexOf(' ') != -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int length = name.length();
|
||||
if (length > 0) {
|
||||
char first = name.charAt(0);
|
||||
if( (! Character.isLetter(first) ) && (first != '_')){
|
||||
char c;
|
||||
|
||||
if (length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 1; i < length; i++) {
|
||||
char c = name.charAt(i);
|
||||
c = name.charAt(0);
|
||||
if ((!Character.isLetter(c)) && (c != '_')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 1; i < length; ++i) {
|
||||
c = name.charAt(i);
|
||||
if ((!Character.isLetterOrDigit(c)) && (c != '_')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the given CPP class name, either simple or qualified.
|
||||
* For example, <code>"A::B::C"</code>, or <code>"C"</code>.
|
||||
* Validate the given CPP class name, either simple or qualified. For
|
||||
* example, <code>"A::B::C"</code>, or <code>"C"</code>.
|
||||
* <p>
|
||||
*
|
||||
* @param name the name of a class
|
||||
|
@ -187,15 +189,15 @@ public class CConventions {
|
|||
* object indicating what is wrong with the identifier
|
||||
*/
|
||||
public static IStatus validateIdentifier(String id) {
|
||||
if (isLegalIdentifier(id)) {
|
||||
if(!isValidIdentifier(id)){
|
||||
return CModelStatus.VERIFIED_OK;
|
||||
} else {
|
||||
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.invalid", id), null); //$NON-NLS-1$
|
||||
}
|
||||
} else {
|
||||
if (!isLegalIdentifier(id)) {
|
||||
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", id), null); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (!isValidIdentifier(id)) {
|
||||
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.invalid", id), null); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return CModelStatus.VERIFIED_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,8 +213,8 @@ public class CConventions {
|
|||
* object indicating what is wrong with the name
|
||||
*/
|
||||
public static IStatus validateMethodName(String name) {
|
||||
if(name.startsWith("~"))
|
||||
return validateIdentifier(name.substring(1, name.length()));
|
||||
if(name.startsWith("~")) //$NON-NLS-1$
|
||||
return validateIdentifier(name.substring(1));
|
||||
else
|
||||
return validateIdentifier(name);
|
||||
}
|
||||
|
@ -230,13 +232,21 @@ public class CConventions {
|
|||
null,
|
||||
null
|
||||
);
|
||||
|
||||
try {
|
||||
token = scanner.nextToken();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if((token != null) && (token.getType() != IToken.tIDENTIFIER))
|
||||
|
||||
if ((token != null) && (token.getType() == IToken.tIDENTIFIER)) {
|
||||
try {
|
||||
scanner.nextToken();
|
||||
} catch (EndOfFileException e) {
|
||||
return true;
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,3 +1,11 @@
|
|||
2004-07-06 Hoda Amer
|
||||
Fix for PR 69330 : Outline is flickering.
|
||||
|
||||
2004-07-06 Chris Wiebe
|
||||
This patch fixes a problem when using the class wizard, where the system
|
||||
include separator '<' was used for project-relative include path instead
|
||||
of '"'.
|
||||
|
||||
2004-06-29 Alain Magloire
|
||||
|
||||
Fix for PR 68820.
|
||||
|
|
|
@ -93,10 +93,8 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
|
|||
public void run() {
|
||||
if (!treeViewer.getControl().isDisposed()) {
|
||||
ISelection sel= treeViewer.getSelection();
|
||||
treeViewer.getControl().setRedraw(false);
|
||||
treeViewer.refresh();
|
||||
treeViewer.setSelection(updateSelection(sel));
|
||||
treeViewer.getControl().setRedraw(true);
|
||||
treeViewer.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -908,6 +908,7 @@ public class NewClassWizardPage extends WizardPage implements Listener {
|
|||
IPath projectPath = fSelectedProject.getFullPath();
|
||||
IPath relativePath = location.getRelativeIncludePath(fSelectedProject);
|
||||
if (!relativePath.equals(location.getLocation())) {
|
||||
if (!projectPath.isPrefixOf(location.getPath()))
|
||||
systemIncludePath = true;
|
||||
} else {
|
||||
if (projectPath.isPrefixOf(location.getPath()) && projectPath.isPrefixOf(header.getPath()))
|
||||
|
|
Loading…
Add table
Reference in a new issue