1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 03:53:21 +02:00

Fixed NLS warnings

Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
Change-Id: If8b41e8f60acfde26e65285a9dad221159f2f4ef
This commit is contained in:
Torbjörn Svensson 2020-06-29 18:46:21 +02:00 committed by Alexander Fedorov
parent 6aa232bd23
commit 718156aa6b
31 changed files with 144 additions and 134 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.qt.core;singleton:=true
Bundle-Version: 2.2.300.qualifier
Bundle-Version: 2.2.400.qualifier
Bundle-Activator: org.eclipse.cdt.internal.qt.core.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,

View file

@ -94,7 +94,7 @@ public class ASTUtil {
}
String ownerName = getFullyQualifiedName(binding.getOwner());
return (ownerName == null ? "" : ownerName) + "::" + binding.getName();
return (ownerName == null ? "" : ownerName) + "::" + binding.getName(); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@ -108,7 +108,7 @@ public class ASTUtil {
if (first)
first = false;
else
str.append("::");
str.append("::"); //$NON-NLS-1$
str.append(name);
}
return str.toString();
@ -122,7 +122,7 @@ public class ASTUtil {
// The regex trims leading and trailing whitespace within the expansion parameter. This is needed
// so that the start of the capture group provides the proper offset into the expansion.
public static final Pattern Regex_MacroExpansion = Pattern
.compile("(?s)([_a-zA-Z]\\w*)\\s*\\(\\s*(.*?)\\s*\\)\\s*");
.compile("(?s)([_a-zA-Z]\\w*)\\s*\\(\\s*(.*?)\\s*\\)\\s*"); //$NON-NLS-1$
public static IType getBaseType(IType type) {
while (type instanceof ITypeContainer)

View file

@ -60,9 +60,9 @@ import org.eclipse.cdt.core.dom.ast.IType;
*/
public class QtFunctionCallUtil {
private static final Pattern SignalRegex = Pattern.compile("^\\s*" + QtKeywords.SIGNAL + ".*");
private static final Pattern SignalRegex = Pattern.compile("^\\s*" + QtKeywords.SIGNAL + ".*"); //$NON-NLS-1$ //$NON-NLS-2$
private static final Pattern MethodRegex = Pattern
.compile("^\\s*(?:" + QtKeywords.SIGNAL + '|' + QtKeywords.SLOT + ").*");
.compile("^\\s*(?:" + QtKeywords.SIGNAL + '|' + QtKeywords.SLOT + ").*"); //$NON-NLS-1$ //$NON-NLS-2$
/**
* Return true if the specified name is a QObject::connect or QObject::disconnect function

View file

@ -66,10 +66,10 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
*/
private long qtInstallHeadersModTime;
private static final String ATTR_QMAKE = "qmake";
private static final String ATTR_QMAKE_MOD = "qmakeModification";
private static final String ATTR_QT_INSTALL_HEADERS = "QT_INSTALL_HEADERS";
private static final String ATTR_QT_INSTALL_HEADERS_MOD = "qtInstallHeadersModification";
private static final String ATTR_QMAKE = "qmake"; //$NON-NLS-1$
private static final String ATTR_QMAKE_MOD = "qmakeModification"; //$NON-NLS-1$
private static final String ATTR_QT_INSTALL_HEADERS = "QT_INSTALL_HEADERS"; //$NON-NLS-1$
private static final String ATTR_QT_INSTALL_HEADERS_MOD = "qtInstallHeadersModification"; //$NON-NLS-1$
/**
* Create a new instance of the include path wrapper for the Qt installation for
@ -198,7 +198,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
try {
return Long.parseLong(value);
} catch (NumberFormatException e) {
Activator.log("attribute name:" + attr + " value:" + value, e);
Activator.log("attribute name:" + attr + " value:" + value, e); //$NON-NLS-1$ //$NON-NLS-2$
return 0;
}
}
@ -223,7 +223,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
BufferedReader reader = null;
Process process = null;
try {
process = ProcessFactory.getFactory().exec(new String[] { qmakePath, "-query", "QT_INSTALL_HEADERS" });
process = ProcessFactory.getFactory().exec(new String[] { qmakePath, "-query", "QT_INSTALL_HEADERS" }); //$NON-NLS-1$ //$NON-NLS-2$
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
qtInstallHeadersPath = reader.readLine();
} catch (IOException e) {

View file

@ -44,9 +44,9 @@ public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider
/**
* The build configuration stores the path to the qmake binary as an environment variable.
*/
private static final String ENVVAR_QMAKE = "QMAKE";
private static final String ENVVAR_QMAKE = "QMAKE"; //$NON-NLS-1$
private static final String ELEMENT_QMAKE = "qmake";
private static final String ELEMENT_QMAKE = "qmake"; //$NON-NLS-1$
@Override
public boolean equals(Object obj) {

View file

@ -21,30 +21,30 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
* Declares constants related to tokens that are special in Qt applications.
*/
public class QtKeywords {
public static final String CONNECT = "connect";
public static final String DISCONNECT = "disconnect";
public static final String Q_CLASSINFO = "Q_CLASSINFO";
public static final String Q_DECLARE_FLAGS = "Q_DECLARE_FLAGS";
public static final String Q_ENUMS = "Q_ENUMS";
public static final String Q_FLAGS = "Q_FLAGS";
public static final String Q_GADGET = "Q_GADGET";
public static final String Q_INVOKABLE = "Q_INVOKABLE";
public static final String Q_OBJECT = "Q_OBJECT";
public static final String Q_PROPERTY = "Q_PROPERTY";
public static final String Q_REVISION = "Q_REVISION";
public static final String Q_SIGNAL = "Q_SIGNAL";
public static final String Q_SIGNALS = "Q_SIGNALS";
public static final String Q_SLOT = "Q_SLOT";
public static final String Q_SLOTS = "Q_SLOTS";
public static final String QMETAMETHOD = "QMetaMethod";
public static final String QML_ATTACHED_PROPERTIES = "qmlAttachedProperties";
public static final String QML_REGISTER_TYPE = "qmlRegisterType";
public static final String QML_REGISTER_UNCREATABLE_TYPE = "qmlRegisterUncreatableType";
public static final String QOBJECT = "QObject";
public static final String SIGNAL = "SIGNAL";
public static final String SIGNALS = "signals";
public static final String SLOT = "SLOT";
public static final String SLOTS = "slots";
public static final String CONNECT = "connect"; //$NON-NLS-1$
public static final String DISCONNECT = "disconnect"; //$NON-NLS-1$
public static final String Q_CLASSINFO = "Q_CLASSINFO"; //$NON-NLS-1$
public static final String Q_DECLARE_FLAGS = "Q_DECLARE_FLAGS"; //$NON-NLS-1$
public static final String Q_ENUMS = "Q_ENUMS"; //$NON-NLS-1$
public static final String Q_FLAGS = "Q_FLAGS"; //$NON-NLS-1$
public static final String Q_GADGET = "Q_GADGET"; //$NON-NLS-1$
public static final String Q_INVOKABLE = "Q_INVOKABLE"; //$NON-NLS-1$
public static final String Q_OBJECT = "Q_OBJECT"; //$NON-NLS-1$
public static final String Q_PROPERTY = "Q_PROPERTY"; //$NON-NLS-1$
public static final String Q_REVISION = "Q_REVISION"; //$NON-NLS-1$
public static final String Q_SIGNAL = "Q_SIGNAL"; //$NON-NLS-1$
public static final String Q_SIGNALS = "Q_SIGNALS"; //$NON-NLS-1$
public static final String Q_SLOT = "Q_SLOT"; //$NON-NLS-1$
public static final String Q_SLOTS = "Q_SLOTS"; //$NON-NLS-1$
public static final String QMETAMETHOD = "QMetaMethod"; //$NON-NLS-1$
public static final String QML_ATTACHED_PROPERTIES = "qmlAttachedProperties"; //$NON-NLS-1$
public static final String QML_REGISTER_TYPE = "qmlRegisterType"; //$NON-NLS-1$
public static final String QML_REGISTER_UNCREATABLE_TYPE = "qmlRegisterUncreatableType"; //$NON-NLS-1$
public static final String QOBJECT = "QObject"; //$NON-NLS-1$
public static final String SIGNAL = "SIGNAL"; //$NON-NLS-1$
public static final String SIGNALS = "signals"; //$NON-NLS-1$
public static final String SLOT = "SLOT"; //$NON-NLS-1$
public static final String SLOTS = "slots"; //$NON-NLS-1$
/**
* Returns true if the argument type is for Qt's QObject class and false otherwise.

View file

@ -41,7 +41,8 @@ import org.eclipse.core.resources.IProject;
public class QtMethodReference extends ASTNameReference {
public static enum Type {
Signal("sender", "SIGNAL", "signal"), Slot("receiver", "SLOT", "member");
Signal("sender", "SIGNAL", "signal"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Slot("receiver", "SLOT", "member"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public final String roleName;
public final String macroName;

View file

@ -116,7 +116,7 @@ public class QtMethodUtil {
boolean first = true;
List<String> signatures = new ArrayList<>();
qtEncSignatures = qtEncSignatures.substring(i + 1);
Pattern p = Pattern.compile("^([a-zA-Z0-9+/=]*)(@?).*$");
Pattern p = Pattern.compile("^([a-zA-Z0-9+/=]*)(@?).*$"); //$NON-NLS-1$
while (!qtEncSignatures.isEmpty()) {
Matcher m = p.matcher(qtEncSignatures);
if (!m.matches())
@ -193,21 +193,22 @@ public class QtMethodUtil {
}
private static String stripWS(String str) {
return str.trim().replaceAll("\\s+", " ").replaceAll(" ([\\*&,()<>]+)", "$1").replaceAll("([\\*&,()<>]+) ",
"$1");
return str.trim().replaceAll("\\s+", " "). //$NON-NLS-1$ //$NON-NLS-2$
replaceAll(" ([\\*&,()<>]+)", "$1"). //$NON-NLS-1$ //$NON-NLS-2$
replaceAll("([\\*&,()<>]+) ", "$1"); //$NON-NLS-1$ //$NON-NLS-2$
}
private static String asString(IASTPointerOperator ptr) {
if (ptr instanceof ICPPASTReferenceOperator)
return "&";
return "&"; //$NON-NLS-1$
if (ptr instanceof IASTPointer) {
StringBuilder str = new StringBuilder();
IASTPointer astPtr = (IASTPointer) ptr;
str.append('*');
if (astPtr.isConst())
str.append(" const");
str.append(" const"); //$NON-NLS-1$
if (astPtr.isVolatile())
str.append(" volatile");
str.append(" volatile"); //$NON-NLS-1$
return str.toString();
}
@ -239,7 +240,7 @@ public class QtMethodUtil {
if (isConst || stripLastPtrConst) {
if (!pruneConst)
result.append("const ");
result.append("const "); //$NON-NLS-1$
else {
// Qt signature generation converts const value and const reference types
// into simple value types. E.g.,
@ -255,14 +256,14 @@ public class QtMethodUtil {
if (lastPtr instanceof ICPPASTReferenceOperator)
ptrs = Arrays.copyOf(ptrs, ptrs.length - 1);
else if (!(lastPtr instanceof IASTPointer) || !((IASTPointer) lastPtr).isConst())
result.append("const ");
result.append("const "); //$NON-NLS-1$
}
}
}
// Qt does no special handling for volatile. This is likely an oversight.
if (cppSpec.isVolatile())
result.append("volatile ");
result.append("volatile "); //$NON-NLS-1$
IASTNode[] children = cppSpec.getChildren();
if (children == null || children.length <= 0) {
@ -270,8 +271,8 @@ public class QtMethodUtil {
// type (without following typedefs, etc.), and then strip out all const
// which has already been handled.
String raw = cppSpec.toString();
raw = raw.replaceAll("const\\s", "");
raw = raw.replaceAll("\\sconst", "");
raw = raw.replaceAll("const\\s", ""); //$NON-NLS-1$ //$NON-NLS-2$
raw = raw.replaceAll("\\sconst", ""); //$NON-NLS-1$ //$NON-NLS-2$
result.append(raw);
} else {
for (IASTNode child : children) {
@ -294,7 +295,7 @@ public class QtMethodUtil {
if (!stripLastPtrConst || i < ptrs.length - 1)
result.append(asString(ptrs[i]));
else
result.append(asString(ptrs[i]).replaceAll("const", ""));
result.append(asString(ptrs[i]).replaceAll("const", "")); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@ -332,7 +333,7 @@ public class QtMethodUtil {
if (first)
first = false;
else
result.append(", ");
result.append(", "); //$NON-NLS-1$
append(result, child);
}
result.append('>');

View file

@ -97,7 +97,7 @@ public class QtNature implements IProjectNature {
// this doesn't happen then the PDOM could have the current version (so
// nothing would trigger
// an update) but no Qt content.
CCorePlugin.log(IStatus.INFO, "Reindexing " + project.getName() + " because Qt nature has been added");
CCorePlugin.log(IStatus.INFO, "Reindexing " + project.getName() + " because Qt nature has been added"); //$NON-NLS-1$ //$NON-NLS-2$
CCorePlugin.getIndexManager().reindex(cProject);
}

View file

@ -39,8 +39,16 @@ public interface IQProperty extends IQObject.IMember {
// This enum is used when scanning Q_PROPERTY expansions, only attributes listed here
// will be extracted from the expansion. This enum should be expanded with new values
// as needed (based on the version of Qt). See QProperty#scanAttributes.
READ("getFunction"), WRITE("setFunction"), RESET("resetFunction"), NOTIFY("notifySignal"), REVISION("int"),
DESIGNABLE("bool"), SCRIPTABLE("bool"), STORED("bool"), USER("bool"), CONSTANT(null), FINAL(null);
READ("getFunction"), //$NON-NLS-1$
WRITE("setFunction"), //$NON-NLS-1$
RESET("resetFunction"), //$NON-NLS-1$
NOTIFY("notifySignal"), //$NON-NLS-1$
REVISION("int"), //$NON-NLS-1$
DESIGNABLE("bool"), //$NON-NLS-1$
SCRIPTABLE("bool"), //$NON-NLS-1$
STORED("bool"), //$NON-NLS-1$
USER("bool"), //$NON-NLS-1$
CONSTANT(null), FINAL(null);
/**
* A string containing the C++ identifier for this attribute.

View file

@ -29,9 +29,9 @@ import org.eclipse.cdt.utils.spawner.ProcessFactory;
public final class QMakeInfo implements IQMakeInfo {
// reg. exp. for parsing output of "qmake -query" command
public static final Pattern PATTERN_QUERY_LINE = Pattern.compile("^(\\w+):(.*)$");
public static final Pattern PATTERN_QUERY_LINE = Pattern.compile("^(\\w+):(.*)$"); //$NON-NLS-1$
// reg. exp. for parsing output of "qmake -E file.pro" command (for QMake 3.0 only)
public static final Pattern PATTERN_EVAL_LINE = Pattern.compile("^([a-zA-Z0-9_\\.]+)\\s*=\\s*(.*)$");
public static final Pattern PATTERN_EVAL_LINE = Pattern.compile("^([a-zA-Z0-9_\\.]+)\\s*=\\s*(.*)$"); //$NON-NLS-1$
/**
* Instance that is used to present an invalid IQMakeInfo.
@ -88,7 +88,7 @@ public final class QMakeInfo implements IQMakeInfo {
}
// run "qmake -query"
Map<String, String> qmake1 = exec(PATTERN_QUERY_LINE, extraEnv, qmakePath, "-query");
Map<String, String> qmake1 = exec(PATTERN_QUERY_LINE, extraEnv, qmakePath, "-query"); //$NON-NLS-1$
if (qmake1 == null) {
return INVALID;
}
@ -99,7 +99,7 @@ public final class QMakeInfo implements IQMakeInfo {
// TODO - no support for pre-3.0
// for QMake version 3.0 or newer, run "qmake -E file.pro"
Map<String, String> qmake2 = version != null && version.getMajor() >= 3
? exec(PATTERN_EVAL_LINE, extraEnv, qmakePath, "-E", proPath)
? exec(PATTERN_EVAL_LINE, extraEnv, qmakePath, "-E", proPath) //$NON-NLS-1$
: Collections.<String, String>emptyMap();
return new QMakeInfo(true, qmake1, qmake2);
}
@ -184,7 +184,7 @@ public final class QMakeInfo implements IQMakeInfo {
*/
private static Map<String, String> exec(Pattern regex, String[] extraEnv, String... command) {
if (command.length < 1 || !new File(command[0]).exists()) {
Activator.log("qmake: cannot run command: " + (command.length > 0 ? command[0] : ""));
Activator.log("qmake: cannot run command: " + (command.length > 0 ? command[0] : "")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
BufferedReader reader = null;

View file

@ -27,20 +27,20 @@ import org.eclipse.cdt.internal.qt.core.Activator;
*/
public final class QMakeParser {
public static final String KEY_QMAKE_VERSION = "QMAKE_VERSION";
public static final String KEY_QT_VERSION = "QT_VERSION";
public static final String KEY_QT_INSTALL_IMPORTS = "QT_INSTALL_IMPORTS";
public static final String KEY_QT_INSTALL_QML = "QT_INSTALL_QML";
public static final String KEY_QT_INSTALL_DOCS = "QT_INSTALL_DOCS";
public static final String KEY_QMAKE_INTERNAL_INCLUDED_FILES = "QMAKE_INTERNAL_INCLUDED_FILES";
public static final String KEY_SOURCES = "SOURCES";
public static final String KEY_HEADERS = "HEADERS";
public static final String KEY_INCLUDEPATH = "INCLUDEPATH";
public static final String KEY_DEFINES = "DEFINES";
public static final String KEY_RESOURCES = "RESOURCES";
public static final String KEY_FORMS = "FORMS";
public static final String KEY_OTHER_FILES = "OTHER_FILES";
public static final String KEY_QML_IMPORT_PATH = "QML_IMPORT_PATH";
public static final String KEY_QMAKE_VERSION = "QMAKE_VERSION"; //$NON-NLS-1$
public static final String KEY_QT_VERSION = "QT_VERSION"; //$NON-NLS-1$
public static final String KEY_QT_INSTALL_IMPORTS = "QT_INSTALL_IMPORTS"; //$NON-NLS-1$
public static final String KEY_QT_INSTALL_QML = "QT_INSTALL_QML"; //$NON-NLS-1$
public static final String KEY_QT_INSTALL_DOCS = "QT_INSTALL_DOCS"; //$NON-NLS-1$
public static final String KEY_QMAKE_INTERNAL_INCLUDED_FILES = "QMAKE_INTERNAL_INCLUDED_FILES"; //$NON-NLS-1$
public static final String KEY_SOURCES = "SOURCES"; //$NON-NLS-1$
public static final String KEY_HEADERS = "HEADERS"; //$NON-NLS-1$
public static final String KEY_INCLUDEPATH = "INCLUDEPATH"; //$NON-NLS-1$
public static final String KEY_DEFINES = "DEFINES"; //$NON-NLS-1$
public static final String KEY_RESOURCES = "RESOURCES"; //$NON-NLS-1$
public static final String KEY_FORMS = "FORMS"; //$NON-NLS-1$
public static final String KEY_OTHER_FILES = "OTHER_FILES"; //$NON-NLS-1$
public static final String KEY_QML_IMPORT_PATH = "QML_IMPORT_PATH"; //$NON-NLS-1$
/**
* Parses QMake output via a specified reg. exp.
@ -57,13 +57,13 @@ public final class QMakeParser {
while ((line = reader.readLine()) != null) {
Matcher m = regex.matcher(line);
if (!m.matches() || m.groupCount() != 2) {
Activator.log("qmake: cannot decode query line '" + line + '\'');
Activator.log("qmake: cannot decode query line '" + line + '\''); //$NON-NLS-1$
} else {
String key = m.group(1);
String value = m.group(2);
String oldValue = result.put(key, value);
if (oldValue != null)
Activator.log("qmake: duplicate keys in query info '" + line + "' was '" + oldValue + '\'');
Activator.log("qmake: duplicate keys in query info '" + line + "' was '" + oldValue + '\''); //$NON-NLS-1$ //$NON-NLS-2$
}
}

View file

@ -194,7 +194,7 @@ public final class QMakeProjectInfo implements IQMakeProjectInfo {
Map<String, String> envMap = qmakeEnvInfo != null ? qmakeEnvInfo.getEnvironment()
: Collections.<String, String>emptyMap();
for (Map.Entry<String, String> entry : envMap.entrySet()) {
envList.add(entry.getKey() + "=" + entry.getValue());
envList.add(entry.getKey() + "=" + entry.getValue()); //$NON-NLS-1$
}
// calculates actual QMake info

View file

@ -21,7 +21,7 @@ import org.eclipse.cdt.internal.qt.core.Activator;
public final class QMakeVersion implements IQtVersion {
// QMAKE_VERSION looks like 2.01a or 3.0
private static final Pattern REGEXP = Pattern.compile("([\\d]+)\\.([\\d]+).*");
private static final Pattern REGEXP = Pattern.compile("([\\d]+)\\.([\\d]+).*"); //$NON-NLS-1$
// parses major and minor version numbers only
public static QMakeVersion create(String version) {

View file

@ -22,7 +22,7 @@ public class QProperty extends AbstractQField implements IQProperty {
}
public void setAttribute(IQProperty.Attribute attr, String value) {
values[attr.ordinal()] = (value == null ? "" : value);
values[attr.ordinal()] = (value == null ? "" : value); //$NON-NLS-1$
}
@Override

View file

@ -42,7 +42,7 @@ public class QmlRegistration implements IQmlRegistration {
this.kind = IQmlRegistration.Kind.Type;
String qobjName = pdom.getQObjectName();
this.ownerName = qobjName == null ? null : qobjName.split("::");
this.ownerName = qobjName == null ? null : qobjName.split("::"); //$NON-NLS-1$
this.version = pdom.getVersion();
this.uri = pdom.getUri();
@ -57,7 +57,7 @@ public class QmlRegistration implements IQmlRegistration {
this.kind = IQmlRegistration.Kind.Uncreatable;
String qobjName = pdom.getQObjectName();
this.ownerName = qobjName == null ? null : qobjName.split("::");
this.ownerName = qobjName == null ? null : qobjName.split("::"); //$NON-NLS-1$
this.version = pdom.getVersion();
this.uri = pdom.getUri();

View file

@ -27,18 +27,18 @@ import org.eclipse.core.runtime.CoreException;
public class QtFactory {
private static final char[] QT_VERSION = "QT_VERSION".toCharArray();
private static final char[] QT_VERSION = "QT_VERSION".toCharArray(); //$NON-NLS-1$
public static QtIndex create(IProject project) {
CDTIndex cdtIndex = getCDTIndex(project);
if (cdtIndex == null) {
Activator.log("could not get CDT index from project " + project.getName());
Activator.log("could not get CDT index from project " + project.getName()); //$NON-NLS-1$
return null;
}
QtVersion qtVersion = cdtIndex.get(QtVersionAccessor);
if (qtVersion == null) {
Activator.log("could not find Qt version in CDT index from project " + project.getName());
Activator.log("could not find Qt version in CDT index from project " + project.getName()); //$NON-NLS-1$
return null;
}
@ -79,7 +79,7 @@ public class QtFactory {
// QT_VERSION looks like 0x040805
private static final Pattern Version_regex = Pattern
.compile("0x([a-fA-F\\d]{1,2})([a-fA-F\\d]{2})([a-fA-F\\d]{2})");
.compile("0x([a-fA-F\\d]{1,2})([a-fA-F\\d]{2})([a-fA-F\\d]{2})"); //$NON-NLS-1$
public static QtVersion create(String version) {
Matcher m = Version_regex.matcher(version);

View file

@ -31,7 +31,7 @@ public class QtIndexImpl extends QtIndex {
private final CDTIndex cdtIndex;
private static final Pattern QmlTypeNameRegex = Pattern.compile(
"^(?:" + QtKeywords.QML_REGISTER_TYPE + '|' + QtKeywords.QML_REGISTER_UNCREATABLE_TYPE + ")<.*>\0(.*)$");
"^(?:" + QtKeywords.QML_REGISTER_TYPE + '|' + QtKeywords.QML_REGISTER_UNCREATABLE_TYPE + ")<.*>\0(.*)$"); //$NON-NLS-1$ //$NON-NLS-2$
private static final IndexFilter QtLinkageFilter = new IndexFilter() {
@Override

View file

@ -47,7 +47,7 @@ public class QtParser extends GNUCPPSourceParser {
public static ICPPASTFunctionDeclarator parseQtMethodReference(String str) {
// Reject strings that have embedded line terminators. This is needed to properly check that
// one that is about to be added.
if (str == null || str.contains(";"))
if (str == null || str.contains(";")) //$NON-NLS-1$
return null;
QtParser parser = new QtParser(str + ';');

View file

@ -49,7 +49,7 @@ public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName
if (simpleID == null) {
IASTInitializerClause[] args = fnCall.getArguments();
simpleID = (functionInstanceBinding.getName()
+ ASTTypeUtil.getArgumentListString(functionInstanceBinding.getTemplateArguments(), true) + "\0("
+ ASTTypeUtil.getArgumentListString(functionInstanceBinding.getTemplateArguments(), true) + "\0(" //$NON-NLS-1$
+ asStringForName(args, 0) + ',' + asStringForName(args, 1) + ',' + asStringForName(args, 2) + ','
+ asStringForName(args, 3) + ')').toCharArray();
}
@ -108,7 +108,7 @@ public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName
private String asStringForName(IASTInitializerClause[] args, int index) {
String arg = args.length <= index ? null : asString(args[index]);
return arg == null ? "" : arg;
return arg == null ? "" : arg; //$NON-NLS-1$
}
private String getArgAsStringOrNull(int index) {

View file

@ -320,7 +320,7 @@ public class QtASTClass {
// and long suffixes are allowed but are excluded from the capture group. The matcher's
// input string should be trimmed and have all newlines replaced.
private static final Pattern QREVISION_REGEX = Pattern
.compile("^Q_REVISION\\s*\\(\\s*((?:0x)?[\\da-fA-F]+)[ulUL]*\\s*\\)$");
.compile("^Q_REVISION\\s*\\(\\s*((?:0x)?[\\da-fA-F]+)[ulUL]*\\s*\\)$"); //$NON-NLS-1$
public Revision(int offset, Long revision) {
this.offset = offset;
@ -351,7 +351,7 @@ public class QtASTClass {
return null;
// Trim leading and trailing whitespace and remove all newlines.
Matcher m = QREVISION_REGEX.matcher(raw.trim().replaceAll("\\s+", ""));
Matcher m = QREVISION_REGEX.matcher(raw.trim().replaceAll("\\s+", "")); //$NON-NLS-1$ //$NON-NLS-2$
if (m.matches()) {
try {
return new Revision(offset, Long.parseLong(m.group(1)));

View file

@ -57,12 +57,12 @@ public class QtASTVisitor extends ASTVisitor {
private final IIndexSymbols symbols;
private final LocationMap locationMap;
private static final Pattern expansionParamRegex = Pattern.compile("^(?:Q_ENUMS|Q_FLAGS)\\s*\\((.*)\\)$",
private static final Pattern expansionParamRegex = Pattern.compile("^(?:Q_ENUMS|Q_FLAGS)\\s*\\((.*)\\)$", //$NON-NLS-1$
Pattern.DOTALL);
private static final Pattern qualNameRegex = Pattern.compile("\\s*((?:[^\\s:]+\\s*::\\s*)*[^\\s:]+).*");
private static final Pattern qualNameRegex = Pattern.compile("\\s*((?:[^\\s:]+\\s*::\\s*)*[^\\s:]+).*"); //$NON-NLS-1$
private static final Pattern declareFlagsRegex = Pattern
.compile("^Q_DECLARE_FLAGS\\s*\\(\\s*([^\\s]+),\\s*([^\\s]+)\\s*\\)$", Pattern.DOTALL);
.compile("^Q_DECLARE_FLAGS\\s*\\(\\s*([^\\s]+),\\s*([^\\s]+)\\s*\\)$", Pattern.DOTALL); //$NON-NLS-1$
/**
* A regular expression for scanning the Q_CLASSINFO expansion and extracting the
@ -73,12 +73,12 @@ public class QtASTVisitor extends ASTVisitor {
* The key must not have embedded quotes.
*/
private static final Pattern classInfoRegex = Pattern
.compile("^Q_CLASSINFO\\s*\\(\\s*\"([^\"]+)\"\\s*,\\s*\"(.*)\"\\s*\\)$", Pattern.DOTALL);
.compile("^Q_CLASSINFO\\s*\\(\\s*\"([^\"]+)\"\\s*,\\s*\"(.*)\"\\s*\\)$", Pattern.DOTALL); //$NON-NLS-1$
private static final Pattern leadingWhitespaceRegex = Pattern.compile("^\\s*([^\\s].*)$");
private static final Pattern leadingWhitespaceRegex = Pattern.compile("^\\s*([^\\s].*)$"); //$NON-NLS-1$
private static final Pattern qPropertyRegex = Pattern.compile(
"^Q_PROPERTY\\s*\\(\\s*(.+?)\\s*([a-zA-Z_][\\w]*+)(?:(?:\\s+(READ\\s+.*))|\\s*)\\s*\\)$", Pattern.DOTALL);
"^Q_PROPERTY\\s*\\(\\s*(.+?)\\s*([a-zA-Z_][\\w]*+)(?:(?:\\s+(READ\\s+.*))|\\s*)\\s*\\)$", Pattern.DOTALL); //$NON-NLS-1$
/**
* A regular expression for scanning Q_PROPERTY attributes. The regular expression is built
@ -97,9 +97,9 @@ public class QtASTVisitor extends ASTVisitor {
for (IQProperty.Attribute attr : IQProperty.Attribute.values()) {
if (attr.ordinal() > 0)
regexBuilder.append('|');
regexBuilder.append("(:?");
regexBuilder.append("(:?"); //$NON-NLS-1$
regexBuilder.append(attr.identifier);
regexBuilder.append(")");
regexBuilder.append(")"); //$NON-NLS-1$
}
qPropertyAttributeRegex = Pattern.compile(regexBuilder.toString());
}

View file

@ -151,7 +151,7 @@ public class QtPDOMProperty extends QtPDOMBinding {
IQProperty.Attribute attr = IQProperty.Attribute.values()[attrId];
String val = valRec == 0 ? "" : linkage.getDB().getString(valRec).getString();
String val = valRec == 0 ? "" : linkage.getDB().getString(valRec).getString(); //$NON-NLS-1$
return new Attribute(attr, val, cppRec);
}

View file

@ -34,7 +34,7 @@ public class LinuxQtInstallProvider implements IQtInstallProvider {
Path qmakePath = Paths.get("/usr/bin/qmake"); //$NON-NLS-1$
if (Files.exists(qmakePath)) {
QtInstall install = new QtInstall(qmakePath);
install.setProperty(IToolChain.ATTR_PACKAGE, "system");
install.setProperty(IToolChain.ATTR_PACKAGE, "system"); //$NON-NLS-1$
return Arrays.asList(install);
}
}

View file

@ -42,7 +42,7 @@ public class QtInstallProvider implements IQtInstallProvider {
return Files.walk(root, 2).filter((path) -> Files.exists(path.resolve(qmake))).map((path) -> {
QtInstall install = new QtInstall(path.resolve(qmake));
if (isWin32 && "win32-g++".equals(install.getSpec())) { //$NON-NLS-1$
install.setProperty(IToolChain.ATTR_PACKAGE, "qt"); //$NON-NLS-1$ //$NON-NLS-2$
install.setProperty(IToolChain.ATTR_PACKAGE, "qt"); //$NON-NLS-1$
}
return install;
}).collect(Collectors.toList());

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.qt.ui;singleton:=true
Bundle-Version: 2.0.200.qualifier
Bundle-Version: 2.0.300.qualifier
Bundle-Activator: org.eclipse.cdt.internal.qt.ui.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -81,8 +81,8 @@ public class QObjectConnectCompletion {
public final String display;
public final int cursorOffset;
public static final Data SIGNAL = new Data("SIGNAL()", "SIGNAL(a)", -1);
public static final Data SLOT = new Data("SLOT()", "SLOT(a)", -1);
public static final Data SIGNAL = new Data("SIGNAL()", "SIGNAL(a)", -1); //$NON-NLS-1$ //$NON-NLS-2$
public static final Data SLOT = new Data("SLOT()", "SLOT(a)", -1); //$NON-NLS-1$ //$NON-NLS-2$
public Data(String replacement) {
this(replacement, replacement, 0);
@ -228,7 +228,7 @@ public class QObjectConnectCompletion {
int parseOffset = context.getParseOffset();
int invocationOffset = context.getInvocationOffset();
String unparsed = "";
String unparsed = ""; //$NON-NLS-1$
try {
unparsed = context.getDocument().get(parseOffset, invocationOffset - parseOffset);
} catch (BadLocationException e) {

View file

@ -32,7 +32,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
@SuppressWarnings("restriction")
public class QObjectDeclarationCompletion {
private static final String TEMPLATE = "class ${name} : public ${QObject}\n{\nQ_OBJECT\n\n${cursor}\n};";
private static final String TEMPLATE = "class ${name} : public ${QObject}\n{\nQ_OBJECT\n\n${cursor}\n};"; //$NON-NLS-1$
private final static TranslationUnitContextType context;
static {
@ -44,7 +44,7 @@ public class QObjectDeclarationCompletion {
IASTName name) {
String token = name.getLastName().toString();
if (token.isEmpty() || !"class".startsWith(token))
if (token.isEmpty() || !"class".startsWith(token)) //$NON-NLS-1$
return null;
Position position = getPosition(ctx);

View file

@ -30,10 +30,10 @@ import org.eclipse.jface.text.templates.TemplateContextType;
@SuppressWarnings("restriction")
public class QPropertyCompletion {
private static final String CONTEXT_ID = Activator.PLUGIN_ID + ".proposal.Q_PROPERTY";
private static final String CONTEXT_ID = Activator.PLUGIN_ID + ".proposal.Q_PROPERTY"; //$NON-NLS-1$
private static final Template QPropertyTemplate = new Template("Q_PROPERTY", "Q_PROPERTY declaration", CONTEXT_ID,
"Q_PROPERTY( ${type} ${name} READ ${accessor} ${cursor} )", true);
private static final Template QPropertyTemplate = new Template("Q_PROPERTY", "Q_PROPERTY declaration", CONTEXT_ID, //$NON-NLS-1$ //$NON-NLS-2$
"Q_PROPERTY( ${type} ${name} READ ${accessor} ${cursor} )", true); //$NON-NLS-1$
public static Collection<ICompletionProposal> getAttributeProposals(
ICEditorContentAssistInvocationContext context) {

View file

@ -89,8 +89,8 @@ public class QPropertyAttributeProposal {
case SCRIPTABLE:
case STORED:
case USER:
return Arrays.asList(new QPropertyAttributeProposal("true", IMethodAttribute.BaseRelevance + 11),
new QPropertyAttributeProposal("false", IMethodAttribute.BaseRelevance + 10));
return Arrays.asList(new QPropertyAttributeProposal("true", IMethodAttribute.BaseRelevance + 11), //$NON-NLS-1$
new QPropertyAttributeProposal("false", IMethodAttribute.BaseRelevance + 10)); //$NON-NLS-1$
// propose appropriate methods for method-based attributes
case READ:
@ -200,7 +200,7 @@ public class QPropertyAttributeProposal {
sig.append(' ');
if (includeClassname) {
sig.append(method.getOwner().getName());
sig.append("::");
sig.append("::"); //$NON-NLS-1$
}
sig.append(method.getName());
sig.append('(');
@ -209,7 +209,7 @@ public class QPropertyAttributeProposal {
if (first)
first = false;
else
sig.append(", ");
sig.append(", "); //$NON-NLS-1$
String defValue = null;
if (param instanceof CPPParameter) {
@ -299,12 +299,12 @@ public class QPropertyAttributeProposal {
return BaseRelevance + 20;
// accessor with "get" prefix is the 2nd highest rank
if (methodName.equalsIgnoreCase("get" + propertyName))
if (methodName.equalsIgnoreCase("get" + propertyName)) //$NON-NLS-1$
return BaseRelevance + 19;
// method names that include the property name anywhere are the next
// most relevant
if (methodName.matches(".*(?i)" + propertyName + ".*"))
if (methodName.matches(".*(?i)" + propertyName + ".*")) //$NON-NLS-1$ //$NON-NLS-2$
return BaseRelevance + 18;
// otherwise return default relevance
@ -357,12 +357,12 @@ public class QPropertyAttributeProposal {
return BaseRelevance + 20;
// accessor with "get" prefix is the 2nd highest rank
if (methodName.equalsIgnoreCase("set" + propertyName))
if (methodName.equalsIgnoreCase("set" + propertyName)) //$NON-NLS-1$
return BaseRelevance + 19;
// method names that include the property name anywhere are the next
// most relevant
if (methodName.matches(".*(?i)" + propertyName + ".*"))
if (methodName.matches(".*(?i)" + propertyName + ".*")) //$NON-NLS-1$ //$NON-NLS-2$
return BaseRelevance + 18;
// otherwise return default relevance
@ -408,12 +408,12 @@ public class QPropertyAttributeProposal {
return 0;
// accessor with "reet" prefix is the most relevant
if (methodName.equalsIgnoreCase("reset" + propertyName))
if (methodName.equalsIgnoreCase("reset" + propertyName)) //$NON-NLS-1$
return BaseRelevance + 20;
// method names that include the property name anywhere are the next
// most relevant
if (methodName.matches(".*(?i)" + propertyName + ".*"))
if (methodName.matches(".*(?i)" + propertyName + ".*")) //$NON-NLS-1$ //$NON-NLS-2$
return BaseRelevance + 18;
// otherwise return default relevance

View file

@ -73,15 +73,15 @@ public class QPropertyExpansion {
private static final Pattern TYPENAME_REGEX;
static {
StringBuilder regexBuilder = new StringBuilder();
regexBuilder.append("^(?:Q_PROPERTY\\s*\\()?\\s*(.*?)(\\s+)(?:");
regexBuilder.append("^(?:Q_PROPERTY\\s*\\()?\\s*(.*?)(\\s+)(?:"); //$NON-NLS-1$
for (IQProperty.Attribute attr : IQProperty.Attribute.values()) {
if (attr.ordinal() > 0)
regexBuilder.append('|');
regexBuilder.append("(?:");
regexBuilder.append("(?:"); //$NON-NLS-1$
regexBuilder.append(attr.identifier);
regexBuilder.append(")");
regexBuilder.append(")"); //$NON-NLS-1$
}
regexBuilder.append(").*$");
regexBuilder.append(").*$"); //$NON-NLS-1$
TYPENAME_REGEX = Pattern.compile(regexBuilder.toString());
}
@ -295,12 +295,12 @@ public class QPropertyExpansion {
// Otherwise create a template where the content depends on the type of the attribute's parameter.
String display = attribute.identifier + ' ' + attribute.paramName;
String replacement = attribute.identifier;
if ("bool".equals(attribute.paramName))
replacement += " ${true}";
else if ("int".equals(attribute.paramName))
replacement += " ${0}";
if ("bool".equals(attribute.paramName)) //$NON-NLS-1$
replacement += " ${true}"; //$NON-NLS-1$
else if ("int".equals(attribute.paramName)) //$NON-NLS-1$
replacement += " ${0}"; //$NON-NLS-1$
else if (attribute.paramName != null)
replacement += " ${" + attribute.paramName + '}';
replacement += " ${" + attribute.paramName + '}'; //$NON-NLS-1$
return templateProposal(contextId, context, display, replacement, relevance);
}
@ -308,7 +308,7 @@ public class QPropertyExpansion {
private static ICompletionProposal templateProposal(String contextId,
ICEditorContentAssistInvocationContext context, String display, String replacement, int relevance) {
Template template = new Template(display, "Q_PROPERTY declaration parameter", contextId, replacement, true);
Template template = new Template(display, "Q_PROPERTY declaration parameter", contextId, replacement, true); //$NON-NLS-1$
TemplateContextType ctxType = new CContextType();
ctxType.setId(contextId);
@ -366,10 +366,10 @@ public class QPropertyExpansion {
}
if (prefix != null) {
if (attr.identifier.startsWith(prefix) && (!expansion.matches(".*\\s+" + attr.identifier + "\\s+.*")
if (attr.identifier.startsWith(prefix) && (!expansion.matches(".*\\s+" + attr.identifier + "\\s+.*") //$NON-NLS-1$ //$NON-NLS-2$
|| attr.identifier.equals(currIdentifier.ident)))
unspecifiedAttributes.add(new Attribute(attr));
} else if (!expansion.matches(".*\\s+" + attr.identifier + "\\s+.*"))
} else if (!expansion.matches(".*\\s+" + attr.identifier + "\\s+.*")) //$NON-NLS-1$ //$NON-NLS-2$
unspecifiedAttributes.add(new Attribute(attr));
}
@ -417,7 +417,7 @@ public class QPropertyExpansion {
if (cursor >= expansion.length())
return expansion + '|';
if (cursor < 0)
return "|" + expansion;
return "|" + expansion; //$NON-NLS-1$
return expansion.substring(0, cursor) + '|' + expansion.substring(cursor);
}