mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 12:05:21 +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
|
2004-06-29 Alain Magloire
|
||||||
|
|
||||||
Possible fix for 68665
|
Possible fix for 68665
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.CodeReader;
|
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.IScanner;
|
||||||
import org.eclipse.cdt.core.parser.IToken;
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
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.cdt.internal.core.model.CModelStatus;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hamer
|
* @author hamer
|
||||||
*
|
|
||||||
* To change the template for this generated type comment go to
|
|
||||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CConventions {
|
public class CConventions {
|
||||||
private final static String scopeResolutionOperator= "::"; //$NON-NLS-1$
|
private final static String scopeResolutionOperator= "::"; //$NON-NLS-1$
|
||||||
private final static char fgDot= '.';
|
private final static char fgDot= '.';
|
||||||
//private final static char fgColon= ':';
|
|
||||||
|
|
||||||
private static boolean isLegalIdentifier(String name) {
|
private static boolean isLegalIdentifier(String name) {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String trimmed = name.trim();
|
|
||||||
if ((!name.equals(trimmed)) || (name.indexOf(" ") != -1) ){ //$NON-NLS-1$
|
if (name.indexOf(' ') != -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = name.length();
|
int length = name.length();
|
||||||
if (length > 0) {
|
char c;
|
||||||
char first = name.charAt(0);
|
|
||||||
if( (! Character.isLetter(first) ) && (first != '_')){
|
if (length == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i < length; i++) {
|
|
||||||
char c = name.charAt(i);
|
|
||||||
if((! Character.isLetterOrDigit(c)) && (c != '_') ){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate the given CPP class name, either simple or qualified.
|
* Validate the given CPP class name, either simple or qualified. For
|
||||||
* For example, <code>"A::B::C"</code>, or <code>"C"</code>.
|
* example, <code>"A::B::C"</code>, or <code>"C"</code>.
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* @param name the name of a class
|
* @param name the name of a class
|
||||||
|
@ -187,15 +189,15 @@ public class CConventions {
|
||||||
* object indicating what is wrong with the identifier
|
* object indicating what is wrong with the identifier
|
||||||
*/
|
*/
|
||||||
public static IStatus validateIdentifier(String id) {
|
public static IStatus validateIdentifier(String id) {
|
||||||
if (isLegalIdentifier(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 {
|
|
||||||
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", id), null); //$NON-NLS-1$
|
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
|
* object indicating what is wrong with the name
|
||||||
*/
|
*/
|
||||||
public static IStatus validateMethodName(String name) {
|
public static IStatus validateMethodName(String name) {
|
||||||
if(name.startsWith("~"))
|
if(name.startsWith("~")) //$NON-NLS-1$
|
||||||
return validateIdentifier(name.substring(1, name.length()));
|
return validateIdentifier(name.substring(1));
|
||||||
else
|
else
|
||||||
return validateIdentifier(name);
|
return validateIdentifier(name);
|
||||||
}
|
}
|
||||||
|
@ -230,13 +232,21 @@ public class CConventions {
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
try{
|
|
||||||
|
try {
|
||||||
token = scanner.nextToken();
|
token = scanner.nextToken();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
if((token != null) && (token.getType() != IToken.tIDENTIFIER))
|
|
||||||
return true;
|
if ((token != null) && (token.getType() == IToken.tIDENTIFIER)) {
|
||||||
|
try {
|
||||||
|
scanner.nextToken();
|
||||||
|
} catch (EndOfFileException e) {
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
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
|
2004-06-29 Alain Magloire
|
||||||
|
|
||||||
Fix for PR 68820.
|
Fix for PR 68820.
|
||||||
|
|
|
@ -93,10 +93,8 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!treeViewer.getControl().isDisposed()) {
|
if (!treeViewer.getControl().isDisposed()) {
|
||||||
ISelection sel= treeViewer.getSelection();
|
ISelection sel= treeViewer.getSelection();
|
||||||
treeViewer.getControl().setRedraw(false);
|
|
||||||
treeViewer.refresh();
|
|
||||||
treeViewer.setSelection(updateSelection(sel));
|
treeViewer.setSelection(updateSelection(sel));
|
||||||
treeViewer.getControl().setRedraw(true);
|
treeViewer.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -908,7 +908,8 @@ public class NewClassWizardPage extends WizardPage implements Listener {
|
||||||
IPath projectPath = fSelectedProject.getFullPath();
|
IPath projectPath = fSelectedProject.getFullPath();
|
||||||
IPath relativePath = location.getRelativeIncludePath(fSelectedProject);
|
IPath relativePath = location.getRelativeIncludePath(fSelectedProject);
|
||||||
if (!relativePath.equals(location.getLocation())) {
|
if (!relativePath.equals(location.getLocation())) {
|
||||||
systemIncludePath = true;
|
if (!projectPath.isPrefixOf(location.getPath()))
|
||||||
|
systemIncludePath = true;
|
||||||
} else {
|
} else {
|
||||||
if (projectPath.isPrefixOf(location.getPath()) && projectPath.isPrefixOf(header.getPath()))
|
if (projectPath.isPrefixOf(location.getPath()) && projectPath.isPrefixOf(header.getPath()))
|
||||||
relativePath = location.getRelativePath(header.getPath());
|
relativePath = location.getRelativePath(header.getPath());
|
||||||
|
|
Loading…
Add table
Reference in a new issue