Skip to main content
summaryrefslogtreecommitdiffstats
path: root/qt
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 11:20:42 -0500
committerJonah Graham2018-11-22 16:47:02 -0500
commit170e654b4796bad1453ae85a427b97317d67a69a (patch)
tree6ca9b8a8fedd5fd25f97eb79c408312e256ff981 /qt
parent35996a5c5ca5c254959ba48241eaada6dbf8628d (diff)
downloadorg.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.gz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.xz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.zip
Bug 540373: Cleanup: Format & Remove trailing whitespace
This was done by selecting all projects in Eclipse then Source -> Clean Up... -> choosing: - Format source code - Remove trailing white spaces on all lines and completing the wizard Change-Id: I63685372c6bcc67719bcf145123bcb72e5b00394
Diffstat (limited to 'qt')
-rw-r--r--qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java132
-rw-r--r--qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java20
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/ASTUtil.java29
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java11
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCall.java44
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCallUtil.java18
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePaths.java43
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePathsProvider.java13
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstall.java14
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstallManager.java12
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtKeywords.java21
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodReference.java25
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodUtil.java48
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java15
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java7
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/QtSyntaxChecker.java11
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/CDTIndex.java6
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeInfo.java2
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMethod.java5
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQProperty.java14
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQmlRegistration.java54
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QGadget.java2
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvInfo.java9
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderDescriptor.java2
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderManager.java12
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeInfo.java30
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeParser.java66
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfo.java22
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java16
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeVersion.java4
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMethod.java14
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObject.java16
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObjectMembers.java6
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QProperty.java4
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QmlRegistration.java3
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtFactory.java12
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndex.java6
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndexImpl.java14
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/QtParser.java29
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/StringScanner.java6
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTNameReference.java2
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQClassName.java1
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQtPDOMClass.java8
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/PDOMQtLinkageFactory.java2
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QMethodName.java3
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QmlTypeRegistration.java23
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTClass.java35
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTVisitor.java59
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtEnumName.java5
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMArray.java10
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMBinding.java1
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMLinkage.java14
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNameIndex.java4
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNodeType.java12
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMProperty.java57
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQEnum.java13
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQMethod.java13
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQObject.java44
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlRegistration.java17
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlUncreatable.java7
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMVisitor.java6
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/QtInstallProvider.java15
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java3
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java3
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java4
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstall.java2
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallManager.java18
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtInstallEvent.java6
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java16
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java3
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileModifierTest.java184
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileParserTest.java3
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/ASTUtilTests.java2
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/AutomatedIntegrationSuite.java15
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java53
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QGadgetTests.java16
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QMakeTests.java6
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QObjectTests.java222
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java90
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtContentAssistantTests.java4
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java4
-rw-r--r--qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtRegressionTests.java90
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectConnectCompletion.java52
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectDeclarationCompletion.java11
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QPropertyCompletion.java22
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtCompletionProposalComputer.java18
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtHighlighting.java32
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyAttributeProposal.java74
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyExpansion.java94
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QtProposalContext.java11
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/IQMLPartitions.java7
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLDocumentSetupParticipant.java3
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLEditor.java9
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLKeywords.java20
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLPartitionScanner.java9
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLSourceViewerConfiguration.java19
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileEditor.java6
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileSourceViewerConfiguration.java20
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/preferences/QtPreferencePage.java3
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileModifier.java7
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectVariable.java3
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtProjectFileUpdateJob.java3
102 files changed, 1089 insertions, 1246 deletions
diff --git a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java
index 5abad15b90..b8fe42efd5 100644
--- a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java
+++ b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java
@@ -26,7 +26,8 @@ import org.junit.Test;
@SuppressWarnings("nls")
public class QMLDirectoryLexerTests {
- private void assertToken(TokenType type, String text, int start, int end, Position locStart, Position locEnd, Token actual) {
+ private void assertToken(TokenType type, String text, int start, int end, Position locStart, Position locEnd,
+ Token actual) {
// Check token type and text
assertEquals("Unexpected token type", type, actual.getType());
assertEquals("Unexpected token text", text, actual.getText());
@@ -37,7 +38,8 @@ public class QMLDirectoryLexerTests {
// Check SourceLocation start
assertEquals("Unexpected location start line", locStart.getLine(), actual.getLocation().getStart().getLine());
- assertEquals("Unexpected location start column", locStart.getColumn(), actual.getLocation().getStart().getColumn());
+ assertEquals("Unexpected location start column", locStart.getColumn(),
+ actual.getLocation().getStart().getColumn());
// Check SourceLocation end
assertEquals("Unexpected location end line", locEnd.getLine(), actual.getLocation().getEnd().getLine());
@@ -52,10 +54,7 @@ public class QMLDirectoryLexerTests {
public void testCommentToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(new ByteArrayInputStream("# This is a comment".getBytes()));
- assertToken(TokenType.COMMENT,
- "# This is a comment",
- 0, 19,
- new Position(1, 0), new Position(1, 19),
+ assertToken(TokenType.COMMENT, "# This is a comment", 0, 19, new Position(1, 0), new Position(1, 19),
lexer.nextToken(false));
}
@@ -63,16 +62,10 @@ public class QMLDirectoryLexerTests {
public void testMultipleCommentTokens() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("# This is a comment\n# This is another comment\n"));
- assertToken(TokenType.COMMENT,
- "# This is a comment",
- 0, 19,
- new Position(1, 0), new Position(1, 19),
+ assertToken(TokenType.COMMENT, "# This is a comment", 0, 19, new Position(1, 0), new Position(1, 19),
lexer.nextToken(false));
assertEquals(TokenType.COMMAND_END, lexer.nextToken(false).getType());
- assertToken(TokenType.COMMENT,
- "# This is another comment",
- 20, 45,
- new Position(2, 0), new Position(2, 25),
+ assertToken(TokenType.COMMENT, "# This is another comment", 20, 45, new Position(2, 0), new Position(2, 25),
lexer.nextToken(false));
assertEquals(TokenType.COMMAND_END, lexer.nextToken(false).getType());
assertEquals(TokenType.EOF, lexer.nextToken(false).getType());
@@ -82,87 +75,56 @@ public class QMLDirectoryLexerTests {
public void testModuleToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("module"));
- assertToken(TokenType.MODULE,
- "module",
- 0, 6,
- new Position(1, 0), new Position(1, 6),
- lexer.nextToken());
+ assertToken(TokenType.MODULE, "module", 0, 6, new Position(1, 0), new Position(1, 6), lexer.nextToken());
}
@Test
public void testTypeInfoToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("typeinfo"));
- assertToken(TokenType.TYPEINFO,
- "typeinfo",
- 0, 8,
- new Position(1, 0), new Position(1, 8),
- lexer.nextToken());
+ assertToken(TokenType.TYPEINFO, "typeinfo", 0, 8, new Position(1, 0), new Position(1, 8), lexer.nextToken());
}
@Test
public void testSingletonToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("singleton"));
- assertToken(TokenType.SINGLETON,
- "singleton",
- 0, 9,
- new Position(1, 0), new Position(1, 9),
- lexer.nextToken());
+ assertToken(TokenType.SINGLETON, "singleton", 0, 9, new Position(1, 0), new Position(1, 9), lexer.nextToken());
}
@Test
public void testInternalToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("internal"));
- assertToken(TokenType.INTERNAL,
- "internal",
- 0, 8,
- new Position(1, 0), new Position(1, 8),
- lexer.nextToken());
+ assertToken(TokenType.INTERNAL, "internal", 0, 8, new Position(1, 0), new Position(1, 8), lexer.nextToken());
}
@Test
public void testPluginToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("plugin"));
- assertToken(TokenType.PLUGIN,
- "plugin",
- 0, 6,
- new Position(1, 0), new Position(1, 6),
- lexer.nextToken());
+ assertToken(TokenType.PLUGIN, "plugin", 0, 6, new Position(1, 0), new Position(1, 6), lexer.nextToken());
}
@Test
public void testClassnameToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("classname"));
- assertToken(TokenType.CLASSNAME,
- "classname",
- 0, 9,
- new Position(1, 0), new Position(1, 9),
- lexer.nextToken());
+ assertToken(TokenType.CLASSNAME, "classname", 0, 9, new Position(1, 0), new Position(1, 9), lexer.nextToken());
}
@Test
public void testDependsToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("depends"));
- assertToken(TokenType.DEPENDS,
- "depends",
- 0, 7,
- new Position(1, 0), new Position(1, 7),
- lexer.nextToken());
+ assertToken(TokenType.DEPENDS, "depends", 0, 7, new Position(1, 0), new Position(1, 7), lexer.nextToken());
}
@Test
public void testDesignerSupportedToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("designersupported"));
- assertToken(TokenType.DESIGNERSUPPORTED,
- "designersupported",
- 0, 17,
- new Position(1, 0), new Position(1, 17),
+ assertToken(TokenType.DESIGNERSUPPORTED, "designersupported", 0, 17, new Position(1, 0), new Position(1, 17),
lexer.nextToken());
}
@@ -170,10 +132,7 @@ public class QMLDirectoryLexerTests {
public void testWordToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("QtQuick.Control"));
- assertToken(TokenType.WORD,
- "QtQuick.Control",
- 0, 15,
- new Position(1, 0), new Position(1, 15),
+ assertToken(TokenType.WORD, "QtQuick.Control", 0, 15, new Position(1, 0), new Position(1, 15),
lexer.nextToken());
}
@@ -181,21 +140,14 @@ public class QMLDirectoryLexerTests {
public void testWordTokenContainsKeyword() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("plugins.test"));
- assertToken(TokenType.WORD,
- "plugins.test",
- 0, 12,
- new Position(1, 0), new Position(1, 12),
- lexer.nextToken());
+ assertToken(TokenType.WORD, "plugins.test", 0, 12, new Position(1, 0), new Position(1, 12), lexer.nextToken());
}
@Test
public void testWordTokenAsRelativePath() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("./test/something/"));
- assertToken(TokenType.WORD,
- "./test/something/",
- 0, 17,
- new Position(1, 0), new Position(1, 17),
+ assertToken(TokenType.WORD, "./test/something/", 0, 17, new Position(1, 0), new Position(1, 17),
lexer.nextToken());
}
@@ -203,21 +155,15 @@ public class QMLDirectoryLexerTests {
public void testWordTokenAsAbsoluteWindowsPath() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("C:\\Users\\someone\\test\\something\\"));
- assertToken(TokenType.WORD,
- "C:\\Users\\someone\\test\\something\\",
- 0, 32,
- new Position(1, 0), new Position(1, 32),
- lexer.nextToken());
+ assertToken(TokenType.WORD, "C:\\Users\\someone\\test\\something\\", 0, 32, new Position(1, 0),
+ new Position(1, 32), lexer.nextToken());
}
@Test
public void testWordTokenAsAbsoluteUnixPath() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("/usr/local/test/something/"));
- assertToken(TokenType.WORD,
- "/usr/local/test/something/",
- 0, 26,
- new Position(1, 0), new Position(1, 26),
+ assertToken(TokenType.WORD, "/usr/local/test/something/", 0, 26, new Position(1, 0), new Position(1, 26),
lexer.nextToken());
}
@@ -225,55 +171,35 @@ public class QMLDirectoryLexerTests {
public void testDecimalToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("2.3"));
- assertToken(TokenType.DECIMAL,
- "2.3",
- 0, 3,
- new Position(1, 0), new Position(1, 3),
- lexer.nextToken());
+ assertToken(TokenType.DECIMAL, "2.3", 0, 3, new Position(1, 0), new Position(1, 3), lexer.nextToken());
}
@Test
public void testIntegerToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("3"));
- assertToken(TokenType.INTEGER,
- "3",
- 0, 1,
- new Position(1, 0), new Position(1, 1),
- lexer.nextToken());
+ assertToken(TokenType.INTEGER, "3", 0, 1, new Position(1, 0), new Position(1, 1), lexer.nextToken());
}
@Test
public void testWhitespaceToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream(" \t\n"));
- assertToken(TokenType.WHITESPACE,
- " \t",
- 0, 2,
- new Position(1, 0), new Position(1, 2),
- lexer.nextToken(false));
+ assertToken(TokenType.WHITESPACE, " \t", 0, 2, new Position(1, 0), new Position(1, 2), lexer.nextToken(false));
}
@Test
public void testCommandEndToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("\n"));
- assertToken(TokenType.COMMAND_END,
- "\\n",
- 0, 1,
- new Position(1, 0), new Position(1, 1),
- lexer.nextToken());
+ assertToken(TokenType.COMMAND_END, "\\n", 0, 1, new Position(1, 0), new Position(1, 1), lexer.nextToken());
}
@Test
public void testEOFToken() {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream(""));
- assertToken(TokenType.EOF,
- "",
- 0, 0,
- new Position(1, 0), new Position(1, 0),
- lexer.nextToken());
+ assertToken(TokenType.EOF, "", 0, 0, new Position(1, 0), new Position(1, 0), lexer.nextToken());
}
@Test
@@ -281,10 +207,6 @@ public class QMLDirectoryLexerTests {
QMLDirectoryLexer lexer = new QMLDirectoryLexer();
lexer.setInput(createInputStream("\n"));
lexer.nextToken();
- assertToken(TokenType.EOF,
- "",
- 1, 1,
- new Position(2, 0), new Position(2, 0),
- lexer.nextToken());
+ assertToken(TokenType.EOF, "", 1, 1, new Position(2, 0), new Position(2, 0), lexer.nextToken());
}
}
diff --git a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java
index 3bdeaecf50..b0220e2f0a 100644
--- a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java
+++ b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java
@@ -48,7 +48,8 @@ public class QMLDirectoryParserTests {
// Check SourceLocation start
assertEquals("Unexpected location start line", locStart.getLine(), node.getLocation().getStart().getLine());
- assertEquals("Unexpected location start column", locStart.getColumn(), node.getLocation().getStart().getColumn());
+ assertEquals("Unexpected location start column", locStart.getColumn(),
+ node.getLocation().getStart().getColumn());
}
private InputStream createInputStream(String s) {
@@ -229,11 +230,8 @@ public class QMLDirectoryParserTests {
@Test
public void testExampleQMLDirFile() {
QMLDirectoryParser parser = new QMLDirectoryParser();
- IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" +
- "plugin qtquick2plugin\n" +
- "classname QtQuick2Plugin\n" +
- "typeinfo plugins.qmltypes\n" +
- "designersupported\n"));
+ IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" + "plugin qtquick2plugin\n"
+ + "classname QtQuick2Plugin\n" + "typeinfo plugins.qmltypes\n" + "designersupported\n"));
assertEquals("Unexpected command list size", 5, ast.getCommands().size());
// Module Command (index 0)
@@ -260,11 +258,8 @@ public class QMLDirectoryParserTests {
@Test
public void testExampleQMLDirFileWithError() {
QMLDirectoryParser parser = new QMLDirectoryParser();
- IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" +
- "plugin qtquick2plugin\n" +
- "classnames QtQuick2Plugin\n" +
- "typeinfo plugins.qmltypes\n" +
- "designersupported\n"));
+ IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" + "plugin qtquick2plugin\n"
+ + "classnames QtQuick2Plugin\n" + "typeinfo plugins.qmltypes\n" + "designersupported\n"));
assertEquals("Unexpected command list size", 5, ast.getCommands().size());
// Module Command (index 0)
@@ -279,7 +274,8 @@ public class QMLDirectoryParserTests {
// Syntax Error Command (index 2)
assertThat("Unexpected command", ast.getCommands().get(2), instanceOf(IQDirSyntaxError.class));
IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(2);
- assertEquals("Unexpected error message", "Unexpected token 'QtQuick2Plugin' (3:11)", err.getSyntaxError().getMessage());
+ assertEquals("Unexpected error message", "Unexpected token 'QtQuick2Plugin' (3:11)",
+ err.getSyntaxError().getMessage());
// Type Info Command (index 3)
assertThat("Unexpected command", ast.getCommands().get(3), instanceOf(IQDirTypeInfoCommand.class));
IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(3);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/ASTUtil.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/ASTUtil.java
index b316f7e7cf..713ed93e70 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/ASTUtil.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/ASTUtil.java
@@ -88,7 +88,7 @@ public class ASTUtil {
if (binding instanceof ICPPBinding)
try {
return getFullyQualifiedName(((ICPPBinding) binding).getQualifiedName());
- } catch(DOMException e) {
+ } catch (DOMException e) {
Activator.log(e);
return null;
}
@@ -104,7 +104,7 @@ public class ASTUtil {
public static String getFullyQualifiedName(String[] qualName) {
boolean first = true;
StringBuilder str = new StringBuilder();
- for(String name : qualName) {
+ for (String name : qualName) {
if (first)
first = false;
else
@@ -121,7 +121,8 @@ 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*");
+ public static final Pattern Regex_MacroExpansion = Pattern
+ .compile("(?s)([_a-zA-Z]\\w*)\\s*\\(\\s*(.*?)\\s*\\)\\s*");
public static IType getBaseType(IType type) {
while (type instanceof ITypeContainer)
@@ -170,7 +171,7 @@ public class ASTUtil {
// Otherwise check for a call to implicit 'this'. See details in the thread that
// starts at http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg26972.html
try {
- for(IScope scope = CPPVisitor.getContainingScope(fncall); scope != null; scope = scope.getParent())
+ for (IScope scope = CPPVisitor.getContainingScope(fncall); scope != null; scope = scope.getParent())
if (scope instanceof ICPPClassScope)
return ((ICPPClassScope) scope).getClassType();
} catch (DOMException e) {
@@ -187,8 +188,7 @@ public class ASTUtil {
Set<IQMethod> bindings = new LinkedHashSet<IQMethod>();
Iterable<IQMethod> methods = null;
- switch(ref.getType())
- {
+ switch (ref.getType()) {
case Signal:
methods = qobj.getSignals().withoutOverrides();
break;
@@ -203,7 +203,7 @@ public class ASTUtil {
return bindings;
for (IQMethod method : methods)
- for(String signature : method.getSignatures())
+ for (String signature : method.getSignatures())
if (signature.equals(qtNormalizedSig))
bindings.add(method);
}
@@ -238,16 +238,14 @@ public class ASTUtil {
// CompTypeSpec. Instead, we cheat and use the InternalBinding.
MethodSpec methodSpec = new MethodSpec(ast);
- if (methodSpec.clsSpec == null
- && method instanceof ICPPInternalBinding)
- {
+ if (methodSpec.clsSpec == null && method instanceof ICPPInternalBinding) {
ICPPInternalBinding internalBinding = (ICPPInternalBinding) method;
IASTNode[] decls = internalBinding.getDeclarations();
for (int i = 0; methodSpec.clsSpec == null && i < decls.length; ++i)
methodSpec = new MethodSpec(decls[i]);
}
- if(methodSpec.clsSpec == null)
+ if (methodSpec.clsSpec == null)
return null;
ICPPASTVisibilityLabel lastLabel = null;
@@ -261,17 +259,14 @@ public class ASTUtil {
return null;
}
- private static class MethodSpec
- {
+ private static class MethodSpec {
public final ICPPASTCompositeTypeSpecifier clsSpec;
public final IASTNode methodDecl;
- public MethodSpec( IASTNode node )
- {
+ public MethodSpec(IASTNode node) {
ICPPASTCompositeTypeSpecifier cls = null;
IASTNode mth = node;
- while( mth != null && cls == null )
- {
+ while (mth != null && cls == null) {
IASTNode parent = mth.getParent();
if (parent instanceof ICPPASTCompositeTypeSpecifier)
cls = (ICPPASTCompositeTypeSpecifier) parent;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java
index d212f403f0..7a329c8203 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java
@@ -119,8 +119,7 @@ public class QmlASTNodeHandler implements InvocationHandler {
}
}
return (IQmlASTNode) Proxy.newProxyInstance(QmlASTNodeHandler.class.getClassLoader(),
- new Class<?>[] { astClass },
- new QmlASTNodeHandler(node));
+ new Class<?>[] { astClass }, new QmlASTNodeHandler(node));
}
private final QMLAnalyzer analyzer;
@@ -140,13 +139,11 @@ public class QmlASTNodeHandler implements InvocationHandler {
// Invoke the default implementation of the method if possible
if (method.isDefault()) {
final Class<?> declaringClass = method.getDeclaringClass();
- Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class,
- int.class);
+ Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class
+ .getDeclaredConstructor(Class.class, int.class);
constructor.setAccessible(true);
methodResults.put(mName, constructor.newInstance(declaringClass, MethodHandles.Lookup.PRIVATE)
- .unreflectSpecial(method, declaringClass)
- .bindTo(proxy)
- .invokeWithArguments(args));
+ .unreflectSpecial(method, declaringClass).bindTo(proxy).invokeWithArguments(args));
} else {
// Use the return type of the method as well as its contents of the node to get the Object to return
String pName = getPropertyName(mName);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCall.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCall.java
index ef33e571ab..f1a3677be6 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCall.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCall.java
@@ -54,7 +54,8 @@ public class QtFunctionCall {
return null;
}
- private static Collection<QtMethodReference> getReferencesInConnect(ICPPFunction function, IASTFunctionCallExpression call) {
+ private static Collection<QtMethodReference> getReferencesInConnect(ICPPFunction function,
+ IASTFunctionCallExpression call) {
if (function == null)
return null;
@@ -71,9 +72,9 @@ public class QtFunctionCall {
IASTInitializerClause[] args = call.getArguments();
IType type3 = ASTUtil.getBaseType(params[3].getType());
- // static bool connect( const QObject *sender, const QMetaMethod &signal,
- // const QObject *receiver, const QMetaMethod &method,
- // Qt::ConnectionType type = Qt::AutoConnection )
+ // static bool connect( const QObject *sender, const QMetaMethod &signal,
+ // const QObject *receiver, const QMetaMethod &method,
+ // Qt::ConnectionType type = Qt::AutoConnection )
if (QtKeywords.isQMetaMethod(type3)) {
// QMetaMethod cannot be statically analyzed.
return null;
@@ -102,25 +103,26 @@ public class QtFunctionCall {
return mergeNonNull(signal, member);
}
- private static Collection<QtMethodReference> getReferencesInDisconnect(ICPPFunction function, IASTFunctionCallExpression call) {
+ private static Collection<QtMethodReference> getReferencesInDisconnect(ICPPFunction function,
+ IASTFunctionCallExpression call) {
if (function == null)
return null;
- // There are 4 overloads of QObject::disconnect (Qt 4.8.4). They can be distinguished by examining
- // the type of the second parameter. The number of parameters is used to disambiguate one conflict.
+ // There are 4 overloads of QObject::disconnect (Qt 4.8.4). They can be distinguished by examining
+ // the type of the second parameter. The number of parameters is used to disambiguate one conflict.
// disconnect( , const char *, , ) && 4 params
- // disconnect( , QMetaMethod&, , )
- // disconnect( , const QObject *, )
- // disconnect( , const char * ) && 2 params
- ICPPParameter[] params = function.getParameters();
- if (params.length < 2)
+ // disconnect( , QMetaMethod&, , )
+ // disconnect( , const QObject *, )
+ // disconnect( , const char * ) && 2 params
+ ICPPParameter[] params = function.getParameters();
+ if (params.length < 2)
return null;
IASTInitializerClause[] args = call.getArguments();
- IType type1 = ASTUtil.getBaseType(params[1].getType());
+ IType type1 = ASTUtil.getBaseType(params[1].getType());
- // static bool disconnect( const QObject *sender, const QMetaMethod &signal,
- // const QObject *receiver, const QMetaMethod &member );
+ // static bool disconnect( const QObject *sender, const QMetaMethod &signal,
+ // const QObject *receiver, const QMetaMethod &member );
if (QtKeywords.isQMetaMethod(type1)) {
// QMetaMethod cannot be statically analyzed.
return Collections.emptyList();
@@ -130,8 +132,8 @@ public class QtFunctionCall {
QtMethodReference signal = null;
QtMethodReference member = null;
- if (type1 instanceof IBasicType && ( (IBasicType)type1 ).getKind() == IBasicType.Kind.eChar ) {
- switch(params.length) {
+ if (type1 instanceof IBasicType && ((IBasicType) type1).getKind() == IBasicType.Kind.eChar) {
+ switch (params.length) {
// static bool disconnect( const QObject *sender, const char *signal,
// const QObject *receiver, const char *member );
case 4:
@@ -161,15 +163,15 @@ public class QtFunctionCall {
return args.length > index ? args[index] : null;
}
- private static <T> Collection<T> mergeNonNull(T...withNulls) {
+ private static <T> Collection<T> mergeNonNull(T... withNulls) {
T firstNonNull = null;
ArrayList<T> list = null;
- for(T t : withNulls) {
+ for (T t : withNulls) {
if (t == null)
continue;
- else if(list != null)
+ else if (list != null)
list.add(t);
- else if(firstNonNull == null)
+ else if (firstNonNull == null)
firstNonNull = t;
else {
list = new ArrayList<T>(withNulls.length);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCallUtil.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCallUtil.java
index 6c2303c374..a3d44028d6 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCallUtil.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCallUtil.java
@@ -61,24 +61,22 @@ 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 MethodRegex = Pattern.compile("^\\s*(?:" + QtKeywords.SIGNAL + '|' + QtKeywords.SLOT + ").*");
+ private static final Pattern MethodRegex = Pattern
+ .compile("^\\s*(?:" + QtKeywords.SIGNAL + '|' + QtKeywords.SLOT + ").*");
/**
* Return true if the specified name is a QObject::connect or QObject::disconnect function
* and false otherwise.
*/
public static boolean isQObjectFunctionCall(IASTCompletionContext astContext, boolean isPrefix, IASTName name) {
- if (name == null
- || name.getSimpleID() == null
- || name.getSimpleID().length <= 0)
+ if (name == null || name.getSimpleID() == null || name.getSimpleID().length <= 0)
return false;
// Bug332201: Qt content assist should always be applied to the most specific part of
// the target name.
IBinding[] funcBindings = astContext.findBindings(name.getLastName(), isPrefix);
for (IBinding funcBinding : funcBindings)
- if (QtKeywords.is_QObject_connect(funcBinding)
- || QtKeywords.is_QObject_disconnect(funcBinding))
+ if (QtKeywords.is_QObject_connect(funcBinding) || QtKeywords.is_QObject_disconnect(funcBinding))
return true;
return false;
@@ -102,13 +100,15 @@ public class QtFunctionCallUtil {
return null;
}
- private static IType getSignalTargetType(int sigExpIndex, IASTFunctionCallExpression call, IASTInitializerClause[] args) {
+ private static IType getSignalTargetType(int sigExpIndex, IASTFunctionCallExpression call,
+ IASTInitializerClause[] args) {
// When the SIGNAL expansion is first, the type is based on the receiver of
// the function call. Otherwise the type is the previous argument.
return ASTUtil.getBaseType(sigExpIndex == 0 ? call : args[sigExpIndex - 1]);
}
- private static IType getMethodTargetType(int methodExpIndex, int sigExpIndex, IASTFunctionCallExpression call, IASTInitializerClause[] args) {
+ private static IType getMethodTargetType(int methodExpIndex, int sigExpIndex, IASTFunctionCallExpression call,
+ IASTInitializerClause[] args) {
// If the method is right after the signal, then the type is based on the receiver
// of the function call. Otherwise the method type is based on the parameter right
// before the expansion.
@@ -118,7 +118,7 @@ public class QtFunctionCallUtil {
}
private static int getExpansionArgIndex(IASTInitializerClause[] args, int begin, Pattern macroNameRegex) {
- for(int i = begin; i < args.length; ++i) {
+ for (int i = begin; i < args.length; ++i) {
IASTInitializerClause arg = args[i];
String raw = arg.getRawSignature();
Matcher m = macroNameRegex.matcher(raw);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePaths.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePaths.java
index 5788723b74..4f19b78763 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePaths.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePaths.java
@@ -90,8 +90,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
Element element = (Element) node;
String qmakePath = element.getAttribute(ATTR_QMAKE);
- if (qmakePath == null
- || qmakePath.isEmpty())
+ if (qmakePath == null || qmakePath.isEmpty())
return null;
QtIncludePaths qtIncludePaths = new QtIncludePaths(qmakePath);
@@ -109,13 +108,11 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
* expected location.
*/
public boolean isValid() {
- if (qmakePath == null
- || qmakePath.isEmpty())
+ if (qmakePath == null || qmakePath.isEmpty())
return false;
File qmake = new File(qmakePath);
- return qmake.exists()
- && qmake.canExecute();
+ return qmake.exists() && qmake.canExecute();
}
@Override
@@ -142,17 +139,16 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
* will be serialized into the workspace metadata area.
*/
@Override
- public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription configDesc, IResource rc, String languageId) {
+ public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription configDesc, IResource rc,
+ String languageId) {
List<ICLanguageSettingEntry> entries = null;
File qmake = new File(qmakePath);
- if (!qmake.exists()
- || qmakeModTime != qmake.lastModified())
+ if (!qmake.exists() || qmakeModTime != qmake.lastModified())
entries = reload();
else {
File qtInstallHeadersDir = new File(qtInstallHeadersPath);
- if (!qtInstallHeadersDir.exists()
- || qtInstallHeadersModTime != qtInstallHeadersDir.lastModified())
+ if (!qtInstallHeadersDir.exists() || qtInstallHeadersModTime != qtInstallHeadersDir.lastModified())
entries = reload();
}
@@ -196,13 +192,12 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
*/
private static long getLongAttribute(Element element, String attr) {
String value = element.getAttribute(attr);
- if (value == null
- || value.isEmpty())
+ if (value == null || value.isEmpty())
return 0;
try {
return Long.parseLong(value);
- } catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
Activator.log("attribute name:" + attr + " value:" + value, e);
return 0;
}
@@ -219,8 +214,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
qtInstallHeadersModTime = 0;
File qmake = new File(qmakePath);
- if (!qmake.exists()
- || !qmake.canExecute())
+ if (!qmake.exists() || !qmake.canExecute())
return Collections.emptyList();
qmakeModTime = qmake.lastModified();
@@ -229,16 +223,16 @@ 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" });
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
qtInstallHeadersPath = reader.readLine();
- } catch(IOException e) {
+ } catch (IOException e) {
Activator.log(e);
} finally {
try {
if (reader != null)
reader.close();
- } catch(IOException e) {
+ } catch (IOException e) {
/* ignore */
} finally {
if (process != null)
@@ -252,9 +246,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
File qtInstallHeadersDir = new File(qtInstallHeadersPath);
qtInstallHeadersModTime = qtInstallHeadersDir.lastModified();
- if (!qtInstallHeadersDir.exists()
- || !qtInstallHeadersDir.canRead()
- || !qtInstallHeadersDir.isDirectory())
+ if (!qtInstallHeadersDir.exists() || !qtInstallHeadersDir.canRead() || !qtInstallHeadersDir.isDirectory())
return Collections.emptyList();
// Create an include path entry for all sub-folders in the QT_INSTALL_HEADERS location, including
@@ -268,7 +260,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>(files.length + 1);
safeAdd(entries, qtInstallHeadersDir);
- for(File file : files)
+ for (File file : files)
safeAdd(entries, file);
return entries;
@@ -276,8 +268,9 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
private static void safeAdd(List<ICLanguageSettingEntry> entries, File file) {
try {
- entries.add(new CIncludePathEntry(file.getCanonicalPath(), ICSettingEntry.READONLY | ICSettingEntry.RESOLVED));
- } catch(IOException e) {
+ entries.add(
+ new CIncludePathEntry(file.getCanonicalPath(), ICSettingEntry.READONLY | ICSettingEntry.RESOLVED));
+ } catch (IOException e) {
Activator.log(e);
}
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePathsProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePathsProvider.java
index fdd0b29674..bbb5d68fee 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePathsProvider.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePathsProvider.java
@@ -80,8 +80,7 @@ public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider
Node child = children.item(i);
if (ELEMENT_QMAKE.equals(child.getNodeName())) {
QtIncludePaths qtIncludePaths = QtIncludePaths.loadFrom(child);
- if (qtIncludePaths != null
- && qtIncludePaths.isValid())
+ if (qtIncludePaths != null && qtIncludePaths.isValid())
qtInstallHeaders.put(qtIncludePaths.getQMakePath(), qtIncludePaths);
}
}
@@ -95,8 +94,8 @@ public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider
// to the file.
// Each value is serialized into a new element in the XML document.
- Document document = parent instanceof Document ? (Document)parent : parent.getOwnerDocument();
- for(QtIncludePaths qtIncludePaths : qtInstallHeaders.values()) {
+ Document document = parent instanceof Document ? (Document) parent : parent.getOwnerDocument();
+ for (QtIncludePaths qtIncludePaths : qtInstallHeaders.values()) {
Element child = document.createElement(ELEMENT_QMAKE);
qtIncludePaths.serialize(child);
parent.appendChild(child);
@@ -109,14 +108,16 @@ public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider
* data or loaded, serialized, and returned.
*/
@Override
- public synchronized List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription configDesc, IResource rc, String languageId) {
+ public synchronized List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription configDesc,
+ IResource rc, String languageId) {
// Make sure the requested language is in scope for this provider.
if (!getLanguageScope().contains(languageId))
return null;
// The value of the build configuration's QMAKE environment variable is used to select the
// right version of qmake.
- IEnvironmentVariable qmake_var = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENVVAR_QMAKE, configDesc, true);
+ IEnvironmentVariable qmake_var = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENVVAR_QMAKE,
+ configDesc, true);
if (qmake_var == null)
return null;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstall.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstall.java
index 4da8540fb1..405e9bfc72 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstall.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstall.java
@@ -48,14 +48,14 @@ public class QtInstall implements IQtInstall {
public static String getSpec(Path qmakePath) throws IOException {
if (Files.exists(qmakePath)) {
- Process proc = new ProcessBuilder(qmakePath.toString(), "-query", "QMAKE_XSPEC").start(); //$NON-NLS-1$ //$NON-NLS-2$
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()))) {
- String line = reader.readLine();
- if (line != null) {
- return line.trim();
+ Process proc = new ProcessBuilder(qmakePath.toString(), "-query", "QMAKE_XSPEC").start(); //$NON-NLS-1$ //$NON-NLS-2$
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()))) {
+ String line = reader.readLine();
+ if (line != null) {
+ return line.trim();
+ }
}
}
- }
return null;
}
@@ -80,5 +80,5 @@ public class QtInstall implements IQtInstall {
public Map<String, String> getProperties() {
return Collections.unmodifiableMap(properties);
}
-
+
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstallManager.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstallManager.java
index fae6dcf4fc..d35c515168 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstallManager.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstallManager.java
@@ -57,9 +57,10 @@ public class QtInstallManager implements IQtInstallManager {
} catch (BackingStoreException e) {
Activator.log(e);
}
-
+
// Auto installs
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.ID, "qtInstallProvider"); //$NON-NLS-1$
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.ID,
+ "qtInstallProvider"); //$NON-NLS-1$
for (IConfigurationElement element : point.getConfigurationElements()) {
try {
IQtInstallProvider provider = (IQtInstallProvider) element.createExecutableExtension("class"); //$NON-NLS-1$
@@ -140,7 +141,8 @@ public class QtInstallManager implements IQtInstallManager {
public boolean supports(IQtInstall install, IToolChain toolChain) {
if (toolChainMap == null) {
toolChainMap = new HashMap<>();
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.ID, "qtToolChainMapper"); //$NON-NLS-1$
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.ID,
+ "qtToolChainMapper"); //$NON-NLS-1$
for (IConfigurationElement element : point.getConfigurationElements()) {
if (element.getName().equals("mapping")) { //$NON-NLS-1$
String spec = element.getAttribute("spec"); //$NON-NLS-1$
@@ -148,7 +150,7 @@ public class QtInstallManager implements IQtInstallManager {
}
}
}
-
+
IConfigurationElement element = toolChainMap.get(install.getSpec());
if (element != null) {
for (IConfigurationElement property : element.getChildren("property")) { //$NON-NLS-1$
@@ -158,7 +160,7 @@ public class QtInstallManager implements IQtInstallManager {
return false;
}
}
-
+
for (Entry<String, String> property : install.getProperties().entrySet()) {
if (!property.getValue().equals(toolChain.getProperty(property.getKey()))) {
return false;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtKeywords.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtKeywords.java
index 210d4ddc55..c9613d433b 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtKeywords.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtKeywords.java
@@ -53,7 +53,7 @@ public class QtKeywords {
if (!(type instanceof ICPPClassType))
return false;
- ICPPClassType clsType = (ICPPClassType)type;
+ ICPPClassType clsType = (ICPPClassType) type;
return QtKeywords.QOBJECT.equals(clsType.getName());
}
@@ -64,7 +64,7 @@ public class QtKeywords {
if (!(type instanceof ICPPClassType))
return false;
- ICPPClassType clsType = (ICPPClassType)type;
+ ICPPClassType clsType = (ICPPClassType) type;
return QMETAMETHOD.equals(clsType.getName());
}
@@ -74,10 +74,7 @@ public class QtKeywords {
*/
public static boolean is_QObject_connect(IBinding binding) {
String[] qualName = getFunctionQualifiedName(binding);
- return qualName != null
- && qualName.length == 2
- && QOBJECT.equals(qualName[0])
- && CONNECT.equals(qualName[1]);
+ return qualName != null && qualName.length == 2 && QOBJECT.equals(qualName[0]) && CONNECT.equals(qualName[1]);
}
/**
@@ -86,10 +83,8 @@ public class QtKeywords {
*/
public static boolean is_QObject_disconnect(IBinding binding) {
String[] qualName = getFunctionQualifiedName(binding);
- return qualName != null
- && qualName.length == 2
- && QOBJECT.equals(qualName[0])
- && DISCONNECT.equals(qualName[1]);
+ return qualName != null && qualName.length == 2 && QOBJECT.equals(qualName[0])
+ && DISCONNECT.equals(qualName[1]);
}
/**
@@ -98,10 +93,8 @@ public class QtKeywords {
*/
public static boolean is_QmlType(IBinding binding) {
String[] qualName = getFunctionQualifiedName(binding);
- return qualName != null
- && qualName.length == 1
- && (QML_REGISTER_TYPE.equals(qualName[0])
- || QML_REGISTER_UNCREATABLE_TYPE.equals(qualName[0]));
+ return qualName != null && qualName.length == 1
+ && (QML_REGISTER_TYPE.equals(qualName[0]) || QML_REGISTER_UNCREATABLE_TYPE.equals(qualName[0]));
}
private static String[] getFunctionQualifiedName(IBinding binding) {
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodReference.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodReference.java
index d29b925e1d..0bd322cd9e 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodReference.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodReference.java
@@ -41,8 +41,7 @@ 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"), Slot("receiver", "SLOT", "member");
public final String roleName;
public final String macroName;
@@ -80,7 +79,8 @@ public class QtMethodReference extends ASTNameReference {
private final ICPPClassType cls;
private final String expansionParam;
- private QtMethodReference(Type type, ICPPClassType cls, IASTName macroRefName, String expansionParam, IASTFileLocation location) {
+ private QtMethodReference(Type type, ICPPClassType cls, IASTName macroRefName, String expansionParam,
+ IASTFileLocation location) {
super(macroRefName, location);
this.type = type;
@@ -109,7 +109,7 @@ public class QtMethodReference extends ASTNameReference {
// Look for a SIGNAL or SLOT expansion as this location.
Type type = null;
IASTName macroReferenceName = null;
- for(IASTNodeLocation location : arg.getNodeLocations()) {
+ for (IASTNodeLocation location : arg.getNodeLocations()) {
if (!(location instanceof IASTMacroExpansionLocation))
continue;
@@ -138,8 +138,8 @@ public class QtMethodReference extends ASTNameReference {
// that use the SIGNAL macro. For now I've implemented the simpler check of forcing the call to
// use the SIGNAL/SLOT macro directly.
String raw = arg.getRawSignature();
- Matcher m = ASTUtil.Regex_MacroExpansion.matcher( raw );
- if( ! m.matches() )
+ Matcher m = ASTUtil.Regex_MacroExpansion.matcher(raw);
+ if (!m.matches())
return null;
// Get the argument to the SIGNAL/SLOT macro and the offset/length of that argument within the
@@ -149,11 +149,12 @@ public class QtMethodReference extends ASTNameReference {
// expansionArgs: "signal(int)"
// expansionOffset: 8
// expansionLength: 11
- String expansionArgs = m.group( 2 );
- int expansionOffset = m.start( 2 );
- int expansionLength = m.end( 2 ) - expansionOffset;
+ String expansionArgs = m.group(2);
+ int expansionOffset = m.start(2);
+ int expansionLength = m.end(2) - expansionOffset;
- IASTFileLocation location = new QtASTImageLocation(macroReferenceName.getFileLocation(), expansionOffset, expansionLength);
+ IASTFileLocation location = new QtASTImageLocation(macroReferenceName.getFileLocation(), expansionOffset,
+ expansionLength);
return new QtMethodReference(type, cls, macroReferenceName, expansionArgs, location);
}
@@ -175,7 +176,7 @@ public class QtMethodReference extends ASTNameReference {
String[] qualName = null;
try {
qualName = cls.getQualifiedName();
- } catch(DOMException e) {
+ } catch (DOMException e) {
Activator.log(e);
}
@@ -196,7 +197,7 @@ public class QtMethodReference extends ASTNameReference {
return null;
// Return the first matching method.
- for(IQMethod method : ASTUtil.findMethods(qobj, this))
+ for (IQMethod method : ASTUtil.findMethods(qobj, this))
return method;
return null;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodUtil.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodUtil.java
index d88043f656..bcecfeda00 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodUtil.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodUtil.java
@@ -61,7 +61,7 @@ public class QtMethodUtil {
// returns the wrong value, then this can be changed back to #getRawSignature. Implement the
// AST and LocationResolver to work with ASTNode#getRawSignatureChars:
// protected char[] getRawSignatureChars() {
- // final IASTFileLocation floc= getFileLocation();
+ // final IASTFileLocation floc= getFileLocation();
// final IASTTranslationUnit ast = getTranslationUnit();
// if (floc != null && ast != null) {
// ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class);
@@ -78,7 +78,7 @@ public class QtMethodUtil {
result.append('(');
boolean first = true;
- for(ICPPASTParameterDeclaration param : function.getParameters()) {
+ for (ICPPASTParameterDeclaration param : function.getParameters()) {
if (first)
first = false;
else
@@ -117,7 +117,7 @@ public class QtMethodUtil {
List<String> signatures = new ArrayList<String>();
qtEncSignatures = qtEncSignatures.substring(i + 1);
Pattern p = Pattern.compile("^([a-zA-Z0-9+/=]*)(@?).*$");
- while(!qtEncSignatures.isEmpty()) {
+ while (!qtEncSignatures.isEmpty()) {
Matcher m = p.matcher(qtEncSignatures);
if (!m.matches())
break;
@@ -158,7 +158,7 @@ public class QtMethodUtil {
result.append('(');
boolean first = true;
- for(ICPPASTParameterDeclaration param : function.getParameters()) {
+ for (ICPPASTParameterDeclaration param : function.getParameters()) {
if (first)
first = false;
else
@@ -193,11 +193,8 @@ public class QtMethodUtil {
}
private static String stripWS(String str) {
- return str
- .trim()
- .replaceAll("\\s+", " ")
- .replaceAll(" ([\\*&,()<>]+)", "$1")
- .replaceAll("([\\*&,()<>]+) ", "$1");
+ return str.trim().replaceAll("\\s+", " ").replaceAll(" ([\\*&,()<>]+)", "$1").replaceAll("([\\*&,()<>]+) ",
+ "$1");
}
private static String asString(IASTPointerOperator ptr) {
@@ -217,7 +214,8 @@ public class QtMethodUtil {
return ptr.toString();
}
- private static void append(StringBuilder result, IASTDeclSpecifier spec, IASTDeclarator declarator, boolean pruneConst) {
+ private static void append(StringBuilder result, IASTDeclSpecifier spec, IASTDeclarator declarator,
+ boolean pruneConst) {
IASTPointerOperator[] ptrs = declarator.getPointerOperators();
if (ptrs == null)
ptrs = new IASTPointerOperator[0];
@@ -234,13 +232,10 @@ public class QtMethodUtil {
// const T& -> T
// const T* const & -> T*
boolean isConst = cppSpec.isConst();
- boolean stripLastPtrConst
- = pruneConst
- && !isConst
- && (ptrs.length >= 2
- && ptrs[ptrs.length - 1] instanceof ICPPASTReferenceOperator
- && ptrs[ptrs.length - 2] instanceof IASTPointer
- && ((IASTPointer) ptrs[ptrs.length - 2]).isConst());
+ boolean stripLastPtrConst = pruneConst && !isConst
+ && (ptrs.length >= 2 && ptrs[ptrs.length - 1] instanceof ICPPASTReferenceOperator
+ && ptrs[ptrs.length - 2] instanceof IASTPointer
+ && ((IASTPointer) ptrs[ptrs.length - 2]).isConst());
if (isConst || stripLastPtrConst) {
if (!pruneConst)
@@ -259,8 +254,7 @@ public class QtMethodUtil {
IASTPointerOperator lastPtr = ptrs[ptrs.length - 1];
if (lastPtr instanceof ICPPASTReferenceOperator)
ptrs = Arrays.copyOf(ptrs, ptrs.length - 1);
- else if (!(lastPtr instanceof IASTPointer)
- || !((IASTPointer) lastPtr).isConst())
+ else if (!(lastPtr instanceof IASTPointer) || !((IASTPointer) lastPtr).isConst())
result.append("const ");
}
}
@@ -280,13 +274,13 @@ public class QtMethodUtil {
raw = raw.replaceAll("\\sconst", "");
result.append(raw);
} else {
- for(IASTNode child : children) {
- result.append( ' ' );
+ for (IASTNode child : children) {
+ result.append(' ');
if (child instanceof ICPPASTTemplateId) {
ICPPASTTemplateId templId = (ICPPASTTemplateId) child;
result.append(templId.getTemplateName());
result.append('<');
- for(IASTNode templArg : templId.getTemplateArguments()) {
+ for (IASTNode templArg : templId.getTemplateArguments()) {
append(result, templArg);
}
result.append('>');
@@ -296,24 +290,22 @@ public class QtMethodUtil {
}
// exclude param name, use '=' to indicate an initial value
- for(int i = 0; i < ptrs.length; ++i) {
- if (!stripLastPtrConst
- || i < ptrs.length - 1)
+ for (int i = 0; i < ptrs.length; ++i) {
+ if (!stripLastPtrConst || i < ptrs.length - 1)
result.append(asString(ptrs[i]));
else
result.append(asString(ptrs[i]).replaceAll("const", ""));
}
}
- private static void append(StringBuilder result, IASTNode node) {
+ private static void append(StringBuilder result, IASTNode node) {
// JI476551: When the code is parsed without full context, e.g., when parsing a Qt method ref, an
// ambiguous node could be created. Since we only need the original text, we can use
// any of the nodes that triggered the ambiguity. Arbitrarily choose the first one.
if (node instanceof ASTAmbiguousNode) {
IASTNode[] nodes = ((ASTAmbiguousNode) node).getNodes();
- if (nodes != null
- && nodes.length > 0) {
+ if (nodes != null && nodes.length > 0) {
append(result, nodes[0]);
return;
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
index 6a114f4959..c25f259afa 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
@@ -71,23 +71,23 @@ public class QtBuildConfiguration extends CBuildConfiguration
private IQtInstall qtInstall;
private Map<String, String> qtProperties;
private boolean doFullBuild;
-
+
private IEnvironmentVariable pathVar = new IEnvironmentVariable() {
@Override
public String getValue() {
return getQmakeCommand().getParent().toString();
}
-
+
@Override
public int getOperation() {
return IEnvironmentVariable.ENVVAR_PREPEND;
}
-
+
@Override
public String getName() {
return "PATH"; //$NON-NLS-1$
}
-
+
@Override
public String getDelimiter() {
return File.pathSeparator;
@@ -117,9 +117,8 @@ public class QtBuildConfiguration extends CBuildConfiguration
}
if (getQtInstall() == null) {
- throw new CoreException(
- new Status(IStatus.ERROR, Activator.ID, CCorePlugin.STATUS_BUILD_CONFIG_NOT_VALID,
- String.format(Messages.QtBuildConfiguration_ConfigNotFound, name), null));
+ throw new CoreException(new Status(IStatus.ERROR, Activator.ID, CCorePlugin.STATUS_BUILD_CONFIG_NOT_VALID,
+ String.format(Messages.QtBuildConfiguration_ConfigNotFound, name), null));
}
String oldLaunchMode = settings.get(LAUNCH_MODE, null);
@@ -457,7 +456,7 @@ public class QtBuildConfiguration extends CBuildConfiguration
public String[] getMakeCommand() {
String buildCommandStr = getProperty(BUILD_COMMAND);
if (buildCommandStr != null) {
- String[] buildCommand = buildCommandStr.split(" "); //$NON-NLS-1$
+ String[] buildCommand = buildCommandStr.split(" "); //$NON-NLS-1$
Path command = findCommand(buildCommand[0]);
if (command == null) {
command = findCommand("make"); //$NON-NLS-1$
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java
index 6d84e45f9e..dc07a563f1 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java
@@ -89,8 +89,8 @@ public class QtBuildConfigurationProvider implements ICBuildConfigurationProvide
ICBuildConfiguration cconfig = config.getAdapter(ICBuildConfiguration.class);
if (cconfig != null) {
IQtBuildConfiguration qtConfig = cconfig.getAdapter(IQtBuildConfiguration.class);
- if (qtConfig != null && launchMode.equals(qtConfig.getLaunchMode()) &&
- qtConfig.getToolChain().equals(toolChain)) {
+ if (qtConfig != null && launchMode.equals(qtConfig.getLaunchMode())
+ && qtConfig.getToolChain().equals(toolChain)) {
return qtConfig;
}
}
@@ -98,8 +98,7 @@ public class QtBuildConfigurationProvider implements ICBuildConfigurationProvide
// TODO what if multiple matches, this returns first match
String configName = "qt." + qtInstall.getSpec() + "." + launchMode; //$NON-NLS-1$ //$NON-NLS-2$
- IBuildConfiguration config = configManager.createBuildConfiguration(this, project, configName,
- monitor);
+ IBuildConfiguration config = configManager.createBuildConfiguration(this, project, configName, monitor);
QtBuildConfiguration qtConfig = new QtBuildConfiguration(config, configName, toolChain, qtInstall,
launchMode);
configManager.addBuildConfiguration(config, qtConfig);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/QtSyntaxChecker.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/QtSyntaxChecker.java
index a402538a8f..2bf198cd56 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/QtSyntaxChecker.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/QtSyntaxChecker.java
@@ -47,10 +47,8 @@ public class QtSyntaxChecker extends AbstractIndexAstChecker implements IChecker
public void initPreferences(IProblemWorkingCopy problem) {
// don't run on full or incremental builds
getTopLevelPreference(problem);
- getLaunchModePreference(problem).enableInLaunchModes(
- CheckerLaunchMode.RUN_ON_FILE_OPEN,
- CheckerLaunchMode.RUN_AS_YOU_TYPE,
- CheckerLaunchMode.RUN_ON_DEMAND );
+ getLaunchModePreference(problem).enableInLaunchModes(CheckerLaunchMode.RUN_ON_FILE_OPEN,
+ CheckerLaunchMode.RUN_AS_YOU_TYPE, CheckerLaunchMode.RUN_ON_DEMAND);
}
@Override
@@ -80,7 +78,7 @@ public class QtSyntaxChecker extends AbstractIndexAstChecker implements IChecker
Collection<QtMethodReference> refs = QtFunctionCall.getReferences(fncall);
if (refs != null)
- for(QtMethodReference ref : refs) {
+ for (QtMethodReference ref : refs) {
IQMethod method = ref.getMethod();
if (method != null)
continue;
@@ -89,7 +87,8 @@ public class QtSyntaxChecker extends AbstractIndexAstChecker implements IChecker
if (ref.getRawSignature().isEmpty())
report(ref, Messages.QtConnect_macro_without_method_1, ref.getType().macroName);
else
- report(ref, Messages.QtConnect_macro_method_not_found_3, ref.getType().paramName, ref.getContainingType().getName(), ref.getRawSignature());
+ report(ref, Messages.QtConnect_macro_method_not_found_3, ref.getType().paramName,
+ ref.getContainingType().getName(), ref.getRawSignature());
}
return PROCESS_CONTINUE;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/CDTIndex.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/CDTIndex.java
index 503be6563d..46e35f3a25 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/CDTIndex.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/CDTIndex.java
@@ -48,14 +48,14 @@ public class CDTIndex {
public <T> T get(Accessor<T> accessor) {
try {
index.acquireReadLock();
- } catch(InterruptedException e) {
+ } catch (InterruptedException e) {
return null;
}
try {
return accessor.access(index);
- } catch(CoreException e) {
- Activator.log( e );
+ } catch (CoreException e) {
+ Activator.log(e);
} finally {
index.releaseReadLock();
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeInfo.java
index 412ae8520a..4db6a0e2a7 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeInfo.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeInfo.java
@@ -34,7 +34,7 @@ public interface IQMakeInfo {
*
* @return the map
*/
- Map<String,String> getQMakeQueryMap();
+ Map<String, String> getQMakeQueryMap();
/**
* Returns a Qt version as provided by "qmake -query" command.
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMethod.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMethod.java
index b3e93455fa..643b273a35 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMethod.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMethod.java
@@ -29,10 +29,7 @@ public interface IQMethod extends IQElement, IQObject.IMember {
* Signal or Slot.
*/
public static enum Kind {
- Unspecified,
- Invokable,
- Signal,
- Slot;
+ Unspecified, Invokable, Signal, Slot;
}
/**
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQProperty.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQProperty.java
index 6d74131633..27585a937f 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQProperty.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQProperty.java
@@ -39,17 +39,8 @@ 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"), WRITE("setFunction"), RESET("resetFunction"), NOTIFY("notifySignal"), REVISION("int"),
+ DESIGNABLE("bool"), SCRIPTABLE("bool"), STORED("bool"), USER("bool"), CONSTANT(null), FINAL(null);
/**
* A string containing the C++ identifier for this attribute.
@@ -113,7 +104,6 @@ public interface IQProperty extends IQObject.IMember {
*/
public String getReadMethodName();
-
/**
* Return the value of WRITE or null if WRITE is not described in the property.
*/
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQmlRegistration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQmlRegistration.java
index 5e45b9e470..02669dd86a 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQmlRegistration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQmlRegistration.java
@@ -58,7 +58,7 @@ public interface IQmlRegistration extends IQObject.IMember {
* Returns QObject to which this registration applies. In the sample at {@link IQmlRegistration}
* this would return the IQObject for Q.
*/
- public IQObject getQObject();
+ public IQObject getQObject();
/**
* Returns the specific revision of the IQObject that was registered. Returns null if no
@@ -82,35 +82,35 @@ public interface IQmlRegistration extends IQObject.IMember {
* @see IQMethod#getRevision()
* @see IQProperty#getRevision()
*/
- public Long getVersion();
+ public Long getVersion();
- /**
- * Returns the literal value of the first argument to the function if it can be
- * resolved and null otherwise.
- */
- public String getURI();
+ /**
+ * Returns the literal value of the first argument to the function if it can be
+ * resolved and null otherwise.
+ */
+ public String getURI();
- /**
- * Returns the literal value of the second argument to the function if it can be
- * resolved and null otherwise.
- */
- public Long getMajor();
+ /**
+ * Returns the literal value of the second argument to the function if it can be
+ * resolved and null otherwise.
+ */
+ public Long getMajor();
- /**
- * Returns the literal value of the third argument to the function if it can be
- * resolved and null otherwise.
- */
- public Long getMinor();
+ /**
+ * Returns the literal value of the third argument to the function if it can be
+ * resolved and null otherwise.
+ */
+ public Long getMinor();
- /**
- * Returns the literal value of the fourth argument to the function if it can be
- * resolved and null otherwise.
- */
- public String getQmlName();
+ /**
+ * Returns the literal value of the fourth argument to the function if it can be
+ * resolved and null otherwise.
+ */
+ public String getQmlName();
- /**
- * Returns the literal value of the fifth argument to qmlRegisterUncreatableType if it
- * can be resolved and null otherwise.
- */
- public String getReason();
+ /**
+ * Returns the literal value of the fifth argument to qmlRegisterUncreatableType if it
+ * can be resolved and null otherwise.
+ */
+ public String getReason();
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QGadget.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QGadget.java
index 5a17ba501c..f046cc6dc6 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QGadget.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QGadget.java
@@ -27,7 +27,7 @@ public class QGadget implements IQGadget {
this.name = pdomQGadget.getName();
this.enums = new ArrayList<IQEnum>();
- for(QtPDOMQEnum pdom : pdomQGadget.getChildren(QtPDOMQEnum.class))
+ for (QtPDOMQEnum pdom : pdomQGadget.getChildren(QtPDOMQEnum.class))
this.enums.add(new QEnum(pdom.getName(), pdom.isFlag(), pdom.getEnumerators()));
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvInfo.java
index 211ee9b0c8..602891fab9 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvInfo.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvInfo.java
@@ -38,11 +38,14 @@ public final class QMakeEnvInfo {
* @param sensitiveFiles the list of IFile that needs to be tracked by IQMakeProjectInfo since their change might affect
* an environment for running qmake.
*/
- public QMakeEnvInfo(IFile proFile, String qmakeFilePath, Map<String,String> environment, Collection<IFile> sensitiveFiles) {
+ public QMakeEnvInfo(IFile proFile, String qmakeFilePath, Map<String, String> environment,
+ Collection<IFile> sensitiveFiles) {
this.proFile = proFile;
this.qmakeFilePath = qmakeFilePath;
- this.environment = environment != null ? new HashMap<String,String>(environment) : Collections.<String,String>emptyMap();
- this.sensitiveFiles = sensitiveFiles != null ? new HashSet<IFile>(sensitiveFiles) : Collections.<IFile>emptySet();
+ this.environment = environment != null ? new HashMap<String, String>(environment)
+ : Collections.<String, String>emptyMap();
+ this.sensitiveFiles = sensitiveFiles != null ? new HashSet<IFile>(sensitiveFiles)
+ : Collections.<IFile>emptySet();
}
/**
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderDescriptor.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderDescriptor.java
index 4eb96c017c..22e04f7fcd 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderDescriptor.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderDescriptor.java
@@ -95,7 +95,7 @@ public final class QMakeEnvProviderDescriptor implements Comparable<QMakeEnvProv
* @return the IQMakeEnv instance; or null if no instance is provided
*/
public IQMakeEnv createEnv(IController controller) {
- if (! matches(controller)) {
+ if (!matches(controller)) {
return null;
}
IQMakeEnvProvider provider;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderManager.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderManager.java
index dd33dc7c1b..69ea716b94 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderManager.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderManager.java
@@ -47,8 +47,8 @@ public final class QMakeEnvProviderManager {
*/
private static List<QMakeEnvProviderDescriptor> loadDescriptors() {
List<QMakeEnvProviderDescriptor> descriptors = new ArrayList<QMakeEnvProviderDescriptor>();
- IConfigurationElement[] elements = Platform.getExtensionRegistry()
- .getConfigurationElementsFor(Activator.ID, Activator.QMAKE_ENV_PROVIDER_EXT_POINT_NAME);
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(Activator.ID,
+ Activator.QMAKE_ENV_PROVIDER_EXT_POINT_NAME);
for (IConfigurationElement element : elements) {
descriptors.add(new QMakeEnvProviderDescriptor(element));
}
@@ -86,7 +86,7 @@ public final class QMakeEnvProviderManager {
public ConfigurationQMakeEnv(ICConfigurationDescription configuration) {
this.configuration = configuration;
- }
+ }
@Override
public void init() {
@@ -111,9 +111,11 @@ public final class QMakeEnvProviderManager {
IProject project = configuration.getProjectDescription().getProject();
IFile proFile = project != null ? project.getFile(project.getName() + PRO_FILE_SUFFIX) : null;
- IEnvironmentVariable variable = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_VAR_QMAKE, configuration, true);
+ IEnvironmentVariable variable = CCorePlugin.getDefault().getBuildEnvironmentManager()
+ .getVariable(ENV_VAR_QMAKE, configuration, true);
String qmakeFilePath = variable != null ? variable.getValue() : null;
- return new QMakeEnvInfo(proFile, qmakeFilePath, Collections.<String,String>emptyMap(), Collections.<IFile>emptyList());
+ return new QMakeEnvInfo(proFile, qmakeFilePath, Collections.<String, String>emptyMap(),
+ Collections.<IFile>emptyList());
}
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeInfo.java
index d0a0f24aa8..98a0716e19 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeInfo.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeInfo.java
@@ -36,7 +36,8 @@ public final class QMakeInfo implements IQMakeInfo {
/**
* Instance that is used to present an invalid IQMakeInfo.
*/
- public static final IQMakeInfo INVALID = new QMakeInfo(false, Collections.<String,String>emptyMap(), Collections.<String,String>emptyMap());
+ public static final IQMakeInfo INVALID = new QMakeInfo(false, Collections.<String, String>emptyMap(),
+ Collections.<String, String>emptyMap());
private final boolean valid;
private final Map<String, String> qmakeQueryMap;
@@ -53,16 +54,19 @@ public final class QMakeInfo implements IQMakeInfo {
private final List<String> formFiles;
private final List<String> otherFiles;
- public QMakeInfo(boolean valid, Map<String,String> queryMap, Map<String,String> proMap) {
+ public QMakeInfo(boolean valid, Map<String, String> queryMap, Map<String, String> proMap) {
this.valid = valid;
this.qmakeQueryMap = Collections.unmodifiableMap(queryMap);
this.qtVersion = QMakeVersion.create(queryMap.get(QMakeParser.KEY_QT_VERSION));
- List<String> tmpQtImportPaths = new ArrayList<String>(QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_IMPORTS));
- List<String> tmpQtQmlPaths = new ArrayList<String>(QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_QML));
+ List<String> tmpQtImportPaths = new ArrayList<String>(
+ QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_IMPORTS));
+ List<String> tmpQtQmlPaths = new ArrayList<String>(
+ QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_QML));
this.qtDocPath = QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_DOCS);
- this.involvedQMakeFiles = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_QMAKE_INTERNAL_INCLUDED_FILES);
+ this.involvedQMakeFiles = QMakeParser.qmake3DecodeValueList(proMap,
+ QMakeParser.KEY_QMAKE_INTERNAL_INCLUDED_FILES);
this.includePath = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_INCLUDEPATH);
this.defines = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_DEFINES);
this.sourceFiles = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_SOURCES);
@@ -95,7 +99,9 @@ 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) : Collections.<String,String>emptyMap();
+ Map<String, String> qmake2 = version != null && version.getMajor() >= 3
+ ? exec(PATTERN_EVAL_LINE, extraEnv, qmakePath, "-E", proPath)
+ : Collections.<String, String>emptyMap();
return new QMakeInfo(true, qmake1, qmake2);
}
@@ -131,7 +137,7 @@ public final class QMakeInfo implements IQMakeInfo {
@Override
public List<String> getQtDocPath() {
- return qtDocPath;
+ return qtDocPath;
}
@Override
@@ -166,7 +172,7 @@ public final class QMakeInfo implements IQMakeInfo {
@Override
public List<String> getOtherFiles() {
- return otherFiles;
+ return otherFiles;
}
/**
@@ -177,8 +183,8 @@ public final class QMakeInfo implements IQMakeInfo {
* @param cmd the command line
* @return the map of resolved key-value pairs
*/
- private static Map<String, String> exec(Pattern regex, String[] extraEnv, String...command) {
- if (command.length < 1 || ! new File(command[0]).exists()) {
+ 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] : ""));
return null;
}
@@ -192,14 +198,14 @@ public final class QMakeInfo implements IQMakeInfo {
}
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
return QMakeParser.parse(regex, reader);
- } catch(IOException e) {
+ } catch (IOException e) {
Activator.log(e);
return null;
} finally {
if (reader != null)
try {
reader.close();
- } catch(IOException e) {
+ } catch (IOException e) {
/* ignore */
}
if (process != null) {
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeParser.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeParser.java
index 12905e70ce..2b0a7d2dcc 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeParser.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeParser.java
@@ -37,9 +37,9 @@ public final class QMakeParser {
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_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";
/**
@@ -54,7 +54,7 @@ public final class QMakeParser {
Map<String, String> result = new LinkedHashMap<String, String>();
String line;
- while((line = reader.readLine()) != null) {
+ while ((line = reader.readLine()) != null) {
Matcher m = regex.matcher(line);
if (!m.matches() || m.groupCount() != 2) {
Activator.log("qmake: cannot decode query line '" + line + '\'');
@@ -115,43 +115,43 @@ public final class QMakeParser {
length = value.length();
}
StringBuilder sb = new StringBuilder(length);
- for (int i = 0; i < length; i ++) {
+ for (int i = 0; i < length; i++) {
char c = value.charAt(i);
if (c == '\\') {
- ++ i;
+ ++i;
if (i < length) {
char next = value.charAt(i);
switch (next) {
- case 'r':
- sb.append('\r');
- break;
- case 'n':
- sb.append ('\n');
- break;
- case 't':
- sb.append ('\t');
- break;
- case '\\':
- case '\'':
- case '"':
- sb.append (next);
- break;
- case 'x':
- i += 2;
- if (i < length) {
- char first = value.charAt(i - 1);
- char second = value.charAt(i);
- if (first >= '0' && first <= '9' && second >= '0' && second <= '9') {
- sb.append ((char) ((first - '0') * 16 + (second - '0')));
- }
+ case 'r':
+ sb.append('\r');
+ break;
+ case 'n':
+ sb.append('\n');
+ break;
+ case 't':
+ sb.append('\t');
+ break;
+ case '\\':
+ case '\'':
+ case '"':
+ sb.append(next);
+ break;
+ case 'x':
+ i += 2;
+ if (i < length) {
+ char first = value.charAt(i - 1);
+ char second = value.charAt(i);
+ if (first >= '0' && first <= '9' && second >= '0' && second <= '9') {
+ sb.append((char) ((first - '0') * 16 + (second - '0')));
}
+ }
}
}
} else {
- sb.append (c);
+ sb.append(c);
}
}
- return sb.toString();
+ return sb.toString();
}
/**
@@ -166,7 +166,7 @@ public final class QMakeParser {
char quote = 0;
boolean hadWord = false;
final int length = value.length();
- for (int i = 0; i < length; i ++) {
+ for (int i = 0; i < length; i++) {
char c = value.charAt(i);
if (quote == c) {
quote = 0;
@@ -198,7 +198,7 @@ public final class QMakeParser {
if (nextChar == '\'' || nextChar == '"' || nextChar == '\\') {
sb.append(c);
c = nextChar;
- ++ i;
+ ++i;
}
}
//$FALL-THROUGH$
@@ -206,7 +206,7 @@ public final class QMakeParser {
hadWord = true;
break;
}
- sb.append (c);
+ sb.append(c);
}
if (hadWord) {
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfo.java
index 62d51b11f4..d8f68fec4b 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfo.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfo.java
@@ -74,8 +74,11 @@ public final class QMakeProjectInfo implements IQMakeProjectInfo {
// this means that theoretically there might be multiple thread calculating the same results but only the last one wins
State updateState() {
// note that getProjectDescription might acquire workspace lock
- ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescriptionManager().getProjectDescription(project);
- ICConfigurationDescription configuration = projectDescription != null ? projectDescription.getActiveConfiguration() : null;
+ ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescriptionManager()
+ .getProjectDescription(project);
+ ICConfigurationDescription configuration = projectDescription != null
+ ? projectDescription.getActiveConfiguration()
+ : null;
State newState = configuration != null ? new State(configuration) : STATE_INVALID;
setState(newState);
return newState;
@@ -84,7 +87,7 @@ public final class QMakeProjectInfo implements IQMakeProjectInfo {
private void setState(State newState) {
State oldState = null;
synchronized (stateSync) {
- if (newState == null || state == newState) {
+ if (newState == null || state == newState) {
return;
}
if (state == STATE_FREEZE) {
@@ -188,8 +191,9 @@ public final class QMakeProjectInfo implements IQMakeProjectInfo {
String qmakeFilePath = qmakeEnvInfo != null ? qmakeEnvInfo.getQMakeFilePath() : null;
// retries environment
List<String> envList = new ArrayList<String>();
- Map<String, String> envMap = qmakeEnvInfo != null ? qmakeEnvInfo.getEnvironment() : Collections.<String,String>emptyMap();
- for (Map.Entry<String,String> entry : envMap.entrySet()) {
+ 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());
}
@@ -198,7 +202,8 @@ public final class QMakeProjectInfo implements IQMakeProjectInfo {
// calculates a new set of sensitive file paths
sensitiveFilePathSet = new SensitiveSet();
- Set<IFile> envSensFiles = qmakeEnvInfo != null ? qmakeEnvInfo.getSensitiveFiles() : Collections.<IFile>emptySet();
+ Set<IFile> envSensFiles = qmakeEnvInfo != null ? qmakeEnvInfo.getSensitiveFiles()
+ : Collections.<IFile>emptySet();
for (IFile sensitiveFile : envSensFiles) {
if (sensitiveFile != null) {
sensitiveFilePathSet.addSensitiveFile(sensitiveFile);
@@ -232,7 +237,7 @@ public final class QMakeProjectInfo implements IQMakeProjectInfo {
public void destroyBeforeInit() {
// see IQMakeEnv JavaDoc for details
- if (qmakeEnv != null && ! (qmakeEnv instanceof IQMakeEnv2)) {
+ if (qmakeEnv != null && !(qmakeEnv instanceof IQMakeEnv2)) {
qmakeEnv.destroy();
}
}
@@ -267,7 +272,8 @@ public final class QMakeProjectInfo implements IQMakeProjectInfo {
// adds a sensitive file in form of a specified absolute path
private void addSensitiveFile(String sensitiveFile) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IFile[] files = root.findFilesForLocationURI(URIUtil.toURI(Path.fromOSString(sensitiveFile).makeAbsolute()));
+ IFile[] files = root
+ .findFilesForLocationURI(URIUtil.toURI(Path.fromOSString(sensitiveFile).makeAbsolute()));
if (files != null && files.length > 0) {
IFile file = files[0];
addSensitiveFile(file);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java
index aa5ddf2bfe..e2d1f7ad25 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java
@@ -42,15 +42,17 @@ public class QMakeProjectInfoManager {
// sync object for CACHE field
private static final Object CACHE_SYNC = new Object();
// a list of all QMakeProjectInfo instances
- private static Map<IProject,QMakeProjectInfo> CACHE;
+ private static Map<IProject, QMakeProjectInfo> CACHE;
// called by QtPlugin activator to setup this class
public static final void start() {
synchronized (CACHE_SYNC) {
- CACHE = new HashMap<IProject,QMakeProjectInfo>();
+ CACHE = new HashMap<IProject, QMakeProjectInfo>();
}
- CoreModel.getDefault().addCProjectDescriptionListener(PD_LISTENER, CProjectDescriptionEvent.LOADED | CProjectDescriptionEvent.APPLIED);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(RC_LISTENER, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE);
+ CoreModel.getDefault().addCProjectDescriptionListener(PD_LISTENER,
+ CProjectDescriptionEvent.LOADED | CProjectDescriptionEvent.APPLIED);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(RC_LISTENER,
+ IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE);
}
// called by QtPlugin activator to clean up this class
@@ -78,7 +80,7 @@ public class QMakeProjectInfoManager {
public static QMakeProjectInfo getQMakeProjectInfoFor(IProject project) {
return getQMakeProjectInfoFor(project, true);
}
-
+
private static QMakeProjectInfo getQMakeProjectInfoFor(IProject project, boolean create) {
QMakeProjectInfo info;
synchronized (CACHE_SYNC) {
@@ -91,7 +93,7 @@ public class QMakeProjectInfoManager {
if (info != null) {
return info;
}
- if (! create) {
+ if (!create) {
// do not create, just return null
return null;
}
@@ -220,7 +222,7 @@ public class QMakeProjectInfoManager {
public void process() {
// removing projects from CACHE
- for(IResource project : projectsToDelete) {
+ for (IResource project : projectsToDelete) {
removeProjectFromCache(project);
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeVersion.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeVersion.java
index 2787c1eb19..c2c21caa00 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeVersion.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeVersion.java
@@ -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]+).*");
// parses major and minor version numbers only
public static QMakeVersion create(String version) {
@@ -38,7 +38,7 @@ public final class QMakeVersion implements IQtVersion {
int major = Integer.parseInt(m.group(1));
int minor = Integer.parseInt(m.group(2));
return new QMakeVersion(major, minor);
- } catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
Activator.log(e);
}
return null;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMethod.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMethod.java
index d10f149ac0..57076a43a5 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMethod.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMethod.java
@@ -54,13 +54,13 @@ public class QMethod implements IQMethod {
if (otherBinding == null)
return getBinding() == null;
- return false ;// TODO
-// if (!ICPPMethod.class.isAssignableFrom(otherBinding.getClass()))
-// return false;
-//
-// IType thisType = method.getType();
-// IType otherType = ((ICPPMethod) otherBinding).getType();
-// return thisType == null ? otherType == null : thisType.isSameType(otherType);
+ return false;// TODO
+ // if (!ICPPMethod.class.isAssignableFrom(otherBinding.getClass()))
+ // return false;
+ //
+ // IType thisType = method.getType();
+ // IType otherType = ((ICPPMethod) otherBinding).getType();
+ // return thisType == null ? otherType == null : thisType.isSameType(otherType);
}
@Override
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObject.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObject.java
index 7c89487248..3e61526fca 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObject.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObject.java
@@ -46,7 +46,7 @@ public class QObject implements IQObject {
List<IQProperty> baseProps = new ArrayList<IQProperty>();
this.bases = new ArrayList<IQObject>();
- for(QtPDOMQObject base : pdomQObject.findBases()) {
+ for (QtPDOMQObject base : pdomQObject.findBases()) {
QObject baseQObj = new QObject(qtIndex, cdtIndex, base);
this.bases.add(baseQObj);
baseSlots.addAll(baseQObj.getSlots().all());
@@ -60,8 +60,8 @@ public class QObject implements IQObject {
List<IQMethod> slots = new ArrayList<IQMethod>();
List<IQMethod> signals = new ArrayList<IQMethod>();
List<IQMethod> invokables = new ArrayList<IQMethod>();
- for(QtPDOMQMethod pdom : pdomQObject.getChildren(QtPDOMQMethod.class))
- switch(pdom.getKind()) {
+ for (QtPDOMQMethod pdom : pdomQObject.getChildren(QtPDOMQMethod.class))
+ switch (pdom.getKind()) {
case Slot:
slots.add(new QMethod(this, pdom));
break;
@@ -80,20 +80,20 @@ public class QObject implements IQObject {
this.invokables = QObjectMembers.create(invokables, baseInvokables);
this.enums = new ArrayList<IQEnum>();
- for(QtPDOMQEnum pdom : pdomQObject.getChildren(QtPDOMQEnum.class))
+ for (QtPDOMQEnum pdom : pdomQObject.getChildren(QtPDOMQEnum.class))
this.enums.add(new QEnum(pdom.getName(), pdom.isFlag(), pdom.getEnumerators()));
List<IQProperty> props = new ArrayList<IQProperty>();
- for(QtPDOMProperty pdom : pdomQObject.getChildren(QtPDOMProperty.class)) {
+ for (QtPDOMProperty pdom : pdomQObject.getChildren(QtPDOMProperty.class)) {
QProperty qProp = new QProperty(this, pdom.getType(), pdom.getName());
- for(QtPDOMProperty.Attribute attr : pdom.getAttributes())
+ for (QtPDOMProperty.Attribute attr : pdom.getAttributes())
qProp.setAttribute(attr.attr, attr.value);
props.add(qProp);
}
this.properties = QObjectMembers.create(props, baseProps);
this.qmlRegistrations = new ArrayList<IQmlRegistration>();
- for(QtPDOMQmlRegistration pdom : QtPDOMQmlRegistration.findFor(pdomQObject))
+ for (QtPDOMQmlRegistration pdom : QtPDOMQmlRegistration.findFor(pdomQObject))
this.qmlRegistrations.add(QmlRegistration.create(qtIndex, pdom));
}
@@ -143,7 +143,7 @@ public class QObject implements IQObject {
if (value != null)
return value;
- for(IQObject base : bases) {
+ for (IQObject base : bases) {
value = base.getClassInfo(key);
if (value != null)
return value;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObjectMembers.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObjectMembers.java
index c68591e5ef..246d855912 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObjectMembers.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObjectMembers.java
@@ -16,7 +16,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-public class QObjectMembers<T extends IQObject.IMember> implements IQObject.IMembers<T> {
+public class QObjectMembers<T extends IQObject.IMember> implements IQObject.IMembers<T> {
private final List<T> all;
private final Collection<T> locals;
@@ -70,9 +70,9 @@ public class QObjectMembers<T extends IQObject.IMember> implements IQObject.IMem
// o1 o2
ArrayList<T> filtered = new ArrayList<T>(all.size());
- for(T member : all) {
+ for (T member : all) {
boolean isOverridden = false;
- for(Iterator<T> i = filtered.iterator(); !isOverridden && i.hasNext(); )
+ for (Iterator<T> i = filtered.iterator(); !isOverridden && i.hasNext();)
isOverridden = member.isOverride(i.next());
if (!isOverridden)
filtered.add(member);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QProperty.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QProperty.java
index fa92c8c9e4..d2556b13fe 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QProperty.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QProperty.java
@@ -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);
}
@Override
@@ -66,7 +66,7 @@ public class QProperty extends AbstractQField implements IQProperty {
if (revision != null)
try {
return Long.valueOf(revision);
- } catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
// This is a problem with the user's C++ code, there is no need to log this exception,
// just ignore the value.
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QmlRegistration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QmlRegistration.java
index 26f7878731..73c8e16e6b 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QmlRegistration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QmlRegistration.java
@@ -74,8 +74,7 @@ public class QmlRegistration implements IQmlRegistration {
@Override
public IQObject getQObject() {
- if (qObject == null
- && ownerName != null)
+ if (qObject == null && ownerName != null)
qObject = qtIndex.findQObject(ownerName);
return qObject;
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtFactory.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtFactory.java
index b50c8a4fa3..e860808c22 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtFactory.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtFactory.java
@@ -60,7 +60,7 @@ public class QtFactory {
IIndex index = null;
try {
index = CCorePlugin.getIndexManager().getIndex(cProject);
- } catch( CoreException e ) {
+ } catch (CoreException e) {
Activator.log(e);
return null;
}
@@ -78,7 +78,8 @@ public class QtFactory {
public final int patch;
// 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})" );
+ 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})");
public static QtVersion create(String version) {
Matcher m = Version_regex.matcher(version);
@@ -90,7 +91,7 @@ public class QtFactory {
int minor = Integer.parseInt(m.group(2), 16);
int patch = Integer.parseInt(m.group(3), 16);
return new QtVersion(major, minor, patch);
- } catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
Activator.log(e);
}
return null;
@@ -109,9 +110,10 @@ public class QtFactory {
// Multiple macros might be found, sort the values and choose the highest version.
SortedSet<String> versions = new TreeSet<String>();
try {
- for(IIndexMacro macro : index.findMacros(QT_VERSION, IndexFilter.ALL, null))
+ for (IIndexMacro macro : index.findMacros(QT_VERSION, IndexFilter.ALL, null))
versions.add(new String(macro.getExpansion()).toLowerCase());
- } catch( CoreException e ) { }
+ } catch (CoreException e) {
+ }
// don't create the Qt index if there is no Qt information in the CDT index
if (versions.size() <= 0)
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndex.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndex.java
index 9d3b099a9f..5d0f3fedf7 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndex.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndex.java
@@ -42,8 +42,8 @@ public abstract class QtIndex {
try {
Object index = project.getSessionProperty(Activator.QTINDEX_PROP_NAME);
if (index instanceof QtIndex)
- return (QtIndex)index;
- } catch(CoreException e) {
+ return (QtIndex) index;
+ } catch (CoreException e) {
Activator.log(e);
}
@@ -54,7 +54,7 @@ public abstract class QtIndex {
try {
project.setSessionProperty(Activator.QTINDEX_PROP_NAME, index);
- } catch( CoreException e ) {
+ } catch (CoreException e) {
Activator.log(e);
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndexImpl.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndexImpl.java
index 8172d63e7f..1b3436cad1 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndexImpl.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndexImpl.java
@@ -30,10 +30,8 @@ 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(.*)$");
+ private static final Pattern QmlTypeNameRegex = Pattern.compile(
+ "^(?:" + QtKeywords.QML_REGISTER_TYPE + '|' + QtKeywords.QML_REGISTER_UNCREATABLE_TYPE + ")<.*>\0(.*)$");
private static final IndexFilter QtLinkageFilter = new IndexFilter() {
@Override
@@ -79,7 +77,7 @@ public class QtIndexImpl extends QtIndex {
public IQObject access(IIndex index) throws CoreException {
// TODO can there be more than one result?
- for(IIndexBinding binding : index.findBindings(name, QtLinkageFilter, null))
+ for (IIndexBinding binding : index.findBindings(name, QtLinkageFilter, null))
if (binding instanceof QtPDOMQObject)
return new QObject(QtIndexImpl.this, cdtIndex, (QtPDOMQObject) binding);
@@ -93,7 +91,7 @@ public class QtIndexImpl extends QtIndex {
public QGadgetImplAccessor(String[] qualName) {
name = new char[qualName.length][];
- for(int i = 0; i < name.length; ++i)
+ for (int i = 0; i < name.length; ++i)
name[i] = qualName[i].toCharArray();
}
@@ -101,7 +99,7 @@ public class QtIndexImpl extends QtIndex {
public IQGadget access(IIndex index) throws CoreException {
// TODO can there be more than one result?
- for(IIndexBinding binding : index.findBindings(name, QtLinkageFilter, null))
+ for (IIndexBinding binding : index.findBindings(name, QtLinkageFilter, null))
if (binding instanceof AbstractQtPDOMClass)
return new QGadget(QtIndexImpl.this, cdtIndex, (AbstractQtPDOMClass) binding);
@@ -114,7 +112,7 @@ public class QtIndexImpl extends QtIndex {
@Override
public Collection<IQmlRegistration> access(IIndex index) throws CoreException {
Collection<IQmlRegistration> types = null;
- for(IIndexBinding binding : index.findBindings(QmlTypeNameRegex, false, QtLinkageFilter, null)) {
+ for (IIndexBinding binding : index.findBindings(QmlTypeNameRegex, false, QtLinkageFilter, null)) {
IQmlRegistration qml = QmlRegistration.create(QtIndexImpl.this, binding);
if (qml != null) {
if (types == null)
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/QtParser.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/QtParser.java
index be95a4e481..49e3c975d7 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/QtParser.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/QtParser.java
@@ -35,7 +35,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
public class QtParser extends GNUCPPSourceParser {
private QtParser(String str) {
- super(new StringScanner(str), ParserMode.QUICK_PARSE, new NullLogService(), GPPParserExtensionConfiguration.getInstance());
+ super(new StringScanner(str), ParserMode.QUICK_PARSE, new NullLogService(),
+ GPPParserExtensionConfiguration.getInstance());
}
/**
@@ -46,34 +47,31 @@ 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(";"))
return null;
QtParser parser = new QtParser(str + ';');
try {
- IASTDeclarator declarator
- = parser.declarator(GNUCPPSourceParser.DtorStrategy.PREFER_FUNCTION, DeclarationOptions.CPP_MEMBER);
+ IASTDeclarator declarator = parser.declarator(GNUCPPSourceParser.DtorStrategy.PREFER_FUNCTION,
+ DeclarationOptions.CPP_MEMBER);
if (!(declarator instanceof ICPPASTFunctionDeclarator))
return null;
// JI 439374: Make sure the ; was the last token read to prevent errors where extra strings
// appear in the expansion parameter.
- if (parser.lastTokenFromScanner == null
- || parser.lastTokenFromScanner.getType() != IToken.tSEMI)
+ if (parser.lastTokenFromScanner == null || parser.lastTokenFromScanner.getType() != IToken.tSEMI)
return null;
// JI 439374: Make sure the ; was the last token read to prevent errors where extra strings
// appear in the expansion parameter.
- if (parser.lastTokenFromScanner == null
- || parser.lastTokenFromScanner.getType() != IToken.tSEMI)
+ if (parser.lastTokenFromScanner == null || parser.lastTokenFromScanner.getType() != IToken.tSEMI)
return null;
// make sure this is a legal declarator for a Qt method reference
ICPPASTFunctionDeclarator function = (ICPPASTFunctionDeclarator) declarator;
// 1) parameters must not have names
- for(ICPPASTParameterDeclaration param : function.getParameters()) {
+ for (ICPPASTParameterDeclaration param : function.getParameters()) {
ICPPASTDeclarator decltor = param.getDeclarator();
if (decltor == null)
continue;
@@ -83,8 +81,7 @@ public class QtParser extends GNUCPPSourceParser {
continue;
char[] name = paramName.getSimpleID();
- if (name == null
- || name.length <= 0)
+ if (name == null || name.length <= 0)
continue;
// The Qt normalization code treats a reference with a trailing const as a special case (this
@@ -99,9 +96,9 @@ public class QtParser extends GNUCPPSourceParser {
// All tests have passed, so return this declarator.
return function;
- } catch(BacktrackException e) {
+ } catch (BacktrackException e) {
return null;
- } catch(EndOfFileException e) {
+ } catch (EndOfFileException e) {
return null;
}
}
@@ -110,9 +107,9 @@ public class QtParser extends GNUCPPSourceParser {
QtParser parser = new QtParser(str);
try {
return parser.typeId(new DeclarationOptions(DeclarationOptions.NO_INITIALIZER));
- } catch(BacktrackException e) {
+ } catch (BacktrackException e) {
return null;
- } catch(EndOfFileException e) {
+ } catch (EndOfFileException e) {
return null;
}
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/StringScanner.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/StringScanner.java
index 67682efed1..225976f853 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/StringScanner.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/StringScanner.java
@@ -50,7 +50,7 @@ public class StringScanner implements IScanner {
public StringScanner(String str) {
this.lexer = new Lexer(str.toCharArray(), new LexerOptions(), ILexerLog.NULL, null);
keywords = new CharArrayIntMap(40, -1);
- Keywords.addKeywordsCpp(keywords);
+ Keywords.addKeywordsCpp(keywords);
}
@Override
@@ -59,7 +59,7 @@ public class StringScanner implements IScanner {
if (token.getType() != IToken.tIDENTIFIER)
return token;
- char[] name= token.getCharImage();
+ char[] name = token.getCharImage();
int tokenType = keywords.get(name);
if (tokenType != keywords.undefined)
token.setType(tokenType);
@@ -88,7 +88,7 @@ public class StringScanner implements IScanner {
@Override
public void setTrackIncludeExport(IncludeExportPatterns patterns) {
- }
+ }
@Override
public void setContentAssistMode(int offset) {
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTNameReference.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTNameReference.java
index dbc97505c4..a511194017 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTNameReference.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTNameReference.java
@@ -62,7 +62,7 @@ public class ASTNameReference extends ASTDelegatedName {
// Look for external references to the binding.
IPDOMIterator<PDOMName> pdomIterator = binding.getExternalReferences();
- while(pdomIterator.hasNext()) {
+ while (pdomIterator.hasNext()) {
PDOMName extRef = pdomIterator.next();
IIndexName caller = extRef.getEnclosingDefinition();
if (caller instanceof IIndexFragmentName) {
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQClassName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQClassName.java
index 3290df04bd..cdc9d3a54f 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQClassName.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQClassName.java
@@ -41,6 +41,7 @@ public abstract class AbstractQClassName extends ASTDelegatedName implements IQt
}
protected abstract QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage, IASTName name) throws CoreException;
+
protected abstract IASTName copy(CopyStyle style, ICPPASTCompositeTypeSpecifier spec);
@Override
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQtPDOMClass.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQtPDOMClass.java
index 0bf9897a09..6776497b29 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQtPDOMClass.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQtPDOMClass.java
@@ -34,9 +34,9 @@ import org.eclipse.core.runtime.CoreException;
public abstract class AbstractQtPDOMClass extends QtPDOMBinding {
private static int offsetInitializer = QtPDOMBinding.Field.Last.offset;
+
protected static enum Field {
- CppRecord(Database.PTR_SIZE),
- Children(4 /* From PDOMNodeLinkedList.RECORD_SIZE, which is protected */),
+ CppRecord(Database.PTR_SIZE), Children(4 /* From PDOMNodeLinkedList.RECORD_SIZE, which is protected */),
Last(0);
public final int offset;
@@ -66,7 +66,7 @@ public abstract class AbstractQtPDOMClass extends QtPDOMBinding {
IPDOMBinding cppPDOMBinding = (IPDOMBinding) cppBinding.getAdapter(IPDOMBinding.class);
if (cppPDOMBinding != null) {
if (cppPDOMBinding.getLinkage() != null
- && cppPDOMBinding.getLinkage().getLinkageID() == ILinkage.CPP_LINKAGE_ID)
+ && cppPDOMBinding.getLinkage().getLinkageID() == ILinkage.CPP_LINKAGE_ID)
getDB().putRecPtr(Field.CppRecord.getRecord(record), cppPDOMBinding.getRecord());
}
}
@@ -108,7 +108,7 @@ public abstract class AbstractQtPDOMClass extends QtPDOMBinding {
QtPDOMVisitor.All<T> collector = new QtPDOMVisitor.All<T>(cls);
try {
children.accept(collector);
- } catch(CoreException e) {
+ } catch (CoreException e) {
Activator.log(e);
return Collections.emptyList();
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/PDOMQtLinkageFactory.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/PDOMQtLinkageFactory.java
index 96bc2c3694..c195958dcb 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/PDOMQtLinkageFactory.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/PDOMQtLinkageFactory.java
@@ -23,7 +23,7 @@ public class PDOMQtLinkageFactory implements IPDOMLinkageFactory {
public PDOMLinkage getLinkage(PDOM pdom, long record) {
try {
return new QtPDOMLinkage(pdom, record);
- } catch(CoreException e) {
+ } catch (CoreException e) {
Activator.log(e);
}
return null;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QMethodName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QMethodName.java
index 2c6731a749..f0f6529901 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QMethodName.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QMethodName.java
@@ -20,7 +20,8 @@ public class QMethodName extends AbstractQObjectMemberName implements IQtASTName
private final String qtEncSignatures;
private final Long revision;
- public QMethodName(QObjectName qobjName, IASTName cppName, IQMethod.Kind kind, String qtEncSignatures, Long revision) {
+ public QMethodName(QObjectName qobjName, IASTName cppName, IQMethod.Kind kind, String qtEncSignatures,
+ Long revision) {
super(qobjName, cppName, cppName.getLastName().toString(), cppName.getImageLocation());
this.kind = kind;
this.qtEncSignatures = qtEncSignatures;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QmlTypeRegistration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QmlTypeRegistration.java
index 8e2ee1c8bd..a24cec1f74 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QmlTypeRegistration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QmlTypeRegistration.java
@@ -32,7 +32,8 @@ public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName
private final IQmlRegistration.Kind kind;
private char[] simpleID;
- public QmlTypeRegistration(IASTName ast, ICPPTemplateInstance functionInstanceBinding, IASTFunctionCallExpression fnCall) {
+ public QmlTypeRegistration(IASTName ast, ICPPTemplateInstance functionInstanceBinding,
+ IASTFunctionCallExpression fnCall) {
super(ast);
this.functionInstanceBinding = functionInstanceBinding;
this.fnCall = fnCall;
@@ -48,13 +49,9 @@ public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName
if (simpleID == null) {
IASTInitializerClause[] args = fnCall.getArguments();
simpleID = (functionInstanceBinding.getName()
- + ASTTypeUtil.getArgumentListString(functionInstanceBinding.getTemplateArguments(), true)
- + "\0("
- + asStringForName(args, 0) + ','
- + asStringForName(args, 1) + ','
- + asStringForName(args, 2) + ','
- + asStringForName(args, 3) + ')'
- ).toCharArray();
+ + ASTTypeUtil.getArgumentListString(functionInstanceBinding.getTemplateArguments(), true) + "\0("
+ + asStringForName(args, 0) + ',' + asStringForName(args, 1) + ',' + asStringForName(args, 2) + ','
+ + asStringForName(args, 3) + ')').toCharArray();
}
return simpleID;
@@ -62,7 +59,7 @@ public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName
@Override
public QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage) throws CoreException {
- switch(kind) {
+ switch (kind) {
case Type:
return new QtPDOMQmlRegistration(linkage, this, delegate);
case Uncreatable:
@@ -85,8 +82,8 @@ public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName
if (args.length < 2)
return null;
- IValue val = args[1].getNonTypeValue();
- return val == null ? null : val.numberValue().longValue();
+ IValue val = args[1].getNonTypeValue();
+ return val == null ? null : val.numberValue().longValue();
}
public String getUri() {
@@ -131,7 +128,7 @@ public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName
if (str != null)
try {
return Long.parseLong(str);
- } catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
// This is caused by invalid user code, do not log it
}
@@ -141,7 +138,7 @@ public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName
private static String asString(IASTInitializerClause init) {
if (init instanceof IASTLiteralExpression) {
IASTLiteralExpression literal = (IASTLiteralExpression) init;
- switch(literal.getKind()) {
+ switch (literal.getKind()) {
case IASTLiteralExpression.lk_integer_constant:
return new String(literal.getValue());
case IASTLiteralExpression.lk_string_literal:
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTClass.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTClass.java
index acf193d2df..67d6346701 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTClass.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTClass.java
@@ -73,16 +73,15 @@ public class QtASTClass {
// Q_SLOT void slot1();
// };
-
// Consume all tags since the last declaration to find the highest precedence tag.
IQMethod.Kind kind = IQMethod.Kind.Unspecified;
- while(tag != null && tag.offset < offset) {
+ while (tag != null && tag.offset < offset) {
kind = getHigherPrecedence(kind, tag.kind);
tag = tags.hasNext() ? tags.next() : null;
}
// Advance regions to find one that does not end before this offset.
- while(region != null && region.end < offset)
+ while (region != null && region.end < offset)
region = regions.hasNext() ? regions.next() : null;
// If the offset is within this region, then use its kind.
@@ -101,7 +100,7 @@ public class QtASTClass {
// Consume all revisions since the last declaration to find one (if any) that applies
// to this declaration.
Long rev = null;
- while(revision != null && revision.offset < offset) {
+ while (revision != null && revision.offset < offset) {
rev = revision.revision;
revision = revisions.hasNext() ? revisions.next() : null;
}
@@ -110,11 +109,11 @@ public class QtASTClass {
}
private static IQMethod.Kind getHigherPrecedence(IQMethod.Kind kind1, IQMethod.Kind kind2) {
- switch(kind1) {
+ switch (kind1) {
case Unspecified:
return kind2;
case Invokable:
- switch(kind2) {
+ switch (kind2) {
case Slot:
case Signal:
return kind2;
@@ -158,7 +157,7 @@ public class QtASTClass {
ArrayList<Revision> revisions = new ArrayList<Revision>();
ArrayList<Region> regions = new ArrayList<Region>();
Region currRegion = null;
- for(IASTNodeLocation location : spec.getNodeLocations()) {
+ for (IASTNodeLocation location : spec.getNodeLocations()) {
Tag tag = Tag.create(location);
if (tag != null)
@@ -192,7 +191,7 @@ public class QtASTClass {
// Otherwise terminate all regions that start before this label and advance
// to the first one that follows.
- while(region != null && region.begin < offset) {
+ while (region != null && region.begin < offset) {
region.end = offset;
region = iterator.hasNext() ? iterator.next() : null;
}
@@ -207,14 +206,14 @@ public class QtASTClass {
if (!tags.isEmpty()) {
Iterator<Tag> iterator = tags.iterator();
Tag tag = iterator.next();
- for(Region region : regions) {
+ for (Region region : regions) {
// Keep all tags that are before the start of this region.
- while(tag != null && tag.offset < region.begin)
+ while (tag != null && tag.offset < region.begin)
tag = iterator.hasNext() ? iterator.next() : null;
// Delete all tags that are within this region.
- while(tag != null && region.contains(tag.offset)) {
+ while (tag != null && region.contains(tag.offset)) {
iterator.remove();
tag = iterator.hasNext() ? iterator.next() : null;
}
@@ -249,8 +248,7 @@ public class QtASTClass {
}
public boolean contains(int offset) {
- return offset >= begin
- && offset < end;
+ return offset >= begin && offset < end;
}
/**
@@ -269,11 +267,9 @@ public class QtASTClass {
int offset = fileLocation.getNodeOffset();
IASTPreprocessorMacroExpansion expansion = macroLocation.getExpansion();
String macroName = getMacroName(expansion);
- if (QtKeywords.Q_SLOTS.equals(macroName)
- || QtKeywords.SLOTS.equals(macroName))
+ if (QtKeywords.Q_SLOTS.equals(macroName) || QtKeywords.SLOTS.equals(macroName))
return new Region(offset, IQMethod.Kind.Slot);
- if (QtKeywords.Q_SIGNALS.equals(macroName)
- || QtKeywords.SIGNALS.equals(macroName))
+ if (QtKeywords.Q_SIGNALS.equals(macroName) || QtKeywords.SIGNALS.equals(macroName))
return new Region(offset, IQMethod.Kind.Signal);
return null;
}
@@ -323,7 +319,8 @@ public class QtASTClass {
// group 1. Hexadecimal and octal prefixes are included in the capture group. Unsigned
// 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*\\)$");
+ private static final Pattern QREVISION_REGEX = Pattern
+ .compile("^Q_REVISION\\s*\\(\\s*((?:0x)?[\\da-fA-F]+)[ulUL]*\\s*\\)$");
public Revision(int offset, Long revision) {
this.offset = offset;
@@ -358,7 +355,7 @@ public class QtASTClass {
if (m.matches()) {
try {
return new Revision(offset, Long.parseLong(m.group(1)));
- } catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
// The number will be parsed incorrectly when the C++ client code does not
// contain a valid integer. We can't do anything about that, so the exception
// is ignored. A codan checker could notify the user of this problem.
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTVisitor.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTVisitor.java
index 0cea96d266..cf15b3d294 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTVisitor.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTVisitor.java
@@ -57,10 +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*\\((.*)\\)$", Pattern.DOTALL);
+ private static final Pattern expansionParamRegex = Pattern.compile("^(?:Q_ENUMS|Q_FLAGS)\\s*\\((.*)\\)$",
+ Pattern.DOTALL);
private static final Pattern qualNameRegex = Pattern.compile("\\s*((?:[^\\s:]+\\s*::\\s*)*[^\\s:]+).*");
- private static final Pattern declareFlagsRegex = Pattern.compile("^Q_DECLARE_FLAGS\\s*\\(\\s*([^\\s]+),\\s*([^\\s]+)\\s*\\)$", Pattern.DOTALL);
+ private static final Pattern declareFlagsRegex = Pattern
+ .compile("^Q_DECLARE_FLAGS\\s*\\(\\s*([^\\s]+),\\s*([^\\s]+)\\s*\\)$", Pattern.DOTALL);
/**
* A regular expression for scanning the Q_CLASSINFO expansion and extracting the
@@ -70,11 +72,13 @@ public class QtASTVisitor extends ASTVisitor {
* <p>
* The key must not have embedded quotes.
*/
- private static final Pattern classInfoRegex = Pattern.compile("^Q_CLASSINFO\\s*\\(\\s*\"([^\"]+)\"\\s*,\\s*\"(.*)\"\\s*\\)$", Pattern.DOTALL);
+ private static final Pattern classInfoRegex = Pattern
+ .compile("^Q_CLASSINFO\\s*\\(\\s*\"([^\"]+)\"\\s*,\\s*\"(.*)\"\\s*\\)$", Pattern.DOTALL);
private static final Pattern leadingWhitespaceRegex = Pattern.compile("^\\s*([^\\s].*)$");
- private static final Pattern qPropertyRegex = Pattern.compile("^Q_PROPERTY\\s*\\(\\s*(.+?)\\s*([a-zA-Z_][\\w]*+)(?:(?:\\s+(READ\\s+.*))|\\s*)\\s*\\)$", Pattern.DOTALL);
+ private static final Pattern qPropertyRegex = Pattern.compile(
+ "^Q_PROPERTY\\s*\\(\\s*(.+?)\\s*([a-zA-Z_][\\w]*+)(?:(?:\\s+(READ\\s+.*))|\\s*)\\s*\\)$", Pattern.DOTALL);
/**
* A regular expression for scanning Q_PROPERTY attributes. The regular expression is built
@@ -90,7 +94,7 @@ public class QtASTVisitor extends ASTVisitor {
private static final Pattern qPropertyAttributeRegex;
static {
StringBuilder regexBuilder = new StringBuilder();
- for(IQProperty.Attribute attr : IQProperty.Attribute.values()) {
+ for (IQProperty.Attribute attr : IQProperty.Attribute.values()) {
if (attr.ordinal() > 0)
regexBuilder.append('|');
regexBuilder.append("(:?");
@@ -205,12 +209,14 @@ public class QtASTVisitor extends ASTVisitor {
this.location = new QtASTImageLocation(refName.getFileLocation(), offset, length);
}
- public void handle(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec, IQtASTName qobjName, Map<String, String> aliases) {
+ public void handle(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec,
+ IQtASTName qobjName, Map<String, String> aliases) {
String alias = aliases.get(name);
- IBinding[] bindings = CPPSemantics.findBindingsForQualifiedName(spec.getScope(), alias == null ? name : alias);
- for(IBinding binding : bindings) {
+ IBinding[] bindings = CPPSemantics.findBindingsForQualifiedName(spec.getScope(),
+ alias == null ? name : alias);
+ for (IBinding binding : bindings) {
// Create a reference from this Qt name to the target enum's definition.
IASTName cppName = findASTName(binding);
QtEnumName astName = new QtEnumName(qobjName, refName, name, cppName, location, isFlag);
@@ -222,7 +228,8 @@ public class QtASTVisitor extends ASTVisitor {
}
}
- private void handleQObject(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec, IASTPreprocessorMacroExpansion[] expansions) {
+ private void handleQObject(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec,
+ IASTPreprocessorMacroExpansion[] expansions) {
// Put the QObject into the symbol map.
QObjectName qobjName = new QObjectName(spec);
@@ -235,14 +242,14 @@ public class QtASTVisitor extends ASTVisitor {
if (QtKeywords.Q_OBJECT.equals(macroName))
continue;
- if(QtKeywords.Q_CLASSINFO.equals(macroName)) {
+ if (QtKeywords.Q_CLASSINFO.equals(macroName)) {
Matcher m = classInfoRegex.matcher(expansion.getRawSignature());
if (m.matches()) {
String key = m.group(1);
String value = m.group(2);
qobjName.addClassInfo(key, value);
}
- } else if(QtKeywords.Q_PROPERTY.equals(macroName))
+ } else if (QtKeywords.Q_PROPERTY.equals(macroName))
handleQPropertyDefn(owner, qobjName, expansion);
}
@@ -250,7 +257,8 @@ public class QtASTVisitor extends ASTVisitor {
extractQMethods(owner, spec, qobjName);
}
- private void handleQClass(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec, IQtASTName qtName, IASTPreprocessorMacroExpansion[] expansions) {
+ private void handleQClass(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec,
+ IQtASTName qtName, IASTPreprocessorMacroExpansion[] expansions) {
// Put the Qt name into the symbol map.
symbols.add(owner, qtName, null);
@@ -287,7 +295,7 @@ public class QtASTVisitor extends ASTVisitor {
}
}
- for(EnumDecl decl : enumDecls)
+ for (EnumDecl decl : enumDecls)
decl.handle(owner, spec, qtName, flagAliases);
}
@@ -299,7 +307,8 @@ public class QtASTVisitor extends ASTVisitor {
IASTName refName = expansion.getMacroReference();
String param = m.group(1);
- for(int offset = m.start(1), end = param.length(); !param.isEmpty(); offset += end, param = param.substring(end)) {
+ for (int offset = m.start(1), end = param.length(); !param.isEmpty(); offset += end, param = param
+ .substring(end)) {
m = qualNameRegex.matcher(param);
if (!m.matches())
break;
@@ -312,7 +321,8 @@ public class QtASTVisitor extends ASTVisitor {
}
}
- private void handleQPropertyDefn(IASTPreprocessorIncludeStatement owner, QObjectName qobjName, IASTPreprocessorMacroExpansion expansion) {
+ private void handleQPropertyDefn(IASTPreprocessorIncludeStatement owner, QObjectName qobjName,
+ IASTPreprocessorMacroExpansion expansion) {
Matcher m = qPropertyRegex.matcher(expansion.getRawSignature());
if (!m.matches())
return;
@@ -341,7 +351,8 @@ public class QtASTVisitor extends ASTVisitor {
int lastEnd = 0;
IQProperty.Attribute lastAttr = null;
- for(Matcher attributeMatcher = qPropertyAttributeRegex.matcher(attributes); attributeMatcher.find(); lastEnd = attributeMatcher.end()) {
+ for (Matcher attributeMatcher = qPropertyAttributeRegex.matcher(attributes); attributeMatcher
+ .find(); lastEnd = attributeMatcher.end()) {
// set the value of attribute found in the previous iteration to the substring between
// the end of that attribute and the start of this one
if (lastAttr != null) {
@@ -383,7 +394,7 @@ public class QtASTVisitor extends ASTVisitor {
}
// Put all values into the property name.
- for(int i = 0; i < values.length; ++i) {
+ for (int i = 0; i < values.length; ++i) {
IQProperty.Attribute attr = IQProperty.Attribute.values()[i];
AttrValue value = values[i];
if (value == null)
@@ -412,12 +423,13 @@ public class QtASTVisitor extends ASTVisitor {
}
// Otherwise create a new attribute for each binding.
- for(IBinding foundBinding : bindings) {
+ for (IBinding foundBinding : bindings) {
propertyName.addAttribute(attr, value.value, foundBinding);
IASTName cppName = findASTName(foundBinding);
if (cppName != null) {
- QtASTImageLocation attrLoc = new QtASTImageLocation(refName.getFileLocation(), value.offset, value.value.length());
+ QtASTImageLocation attrLoc = new QtASTImageLocation(refName.getFileLocation(), value.offset,
+ value.value.length());
symbols.add(owner, new ASTNameReference(cppName, attrLoc), propertyName);
}
}
@@ -425,7 +437,7 @@ public class QtASTVisitor extends ASTVisitor {
}
private static boolean couldHaveBinding(IQProperty.Attribute attr) {
- switch(attr) {
+ switch (attr) {
case READ:
case WRITE:
case RESET:
@@ -468,14 +480,17 @@ public class QtASTVisitor extends ASTVisitor {
private static class AttrValue {
public final int offset;
public final String value;
+
public AttrValue(int offset, String value) {
this.offset = offset;
this.value = value;
}
+
public static final AttrValue None = new AttrValue(0, null);
}
- private void extractQMethods(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec, QObjectName qobjName) {
+ private void extractQMethods(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec,
+ QObjectName qobjName) {
QtASTClass qtASTClass = QtASTClass.create(spec);
for (IASTDeclaration decl : spec.getMembers()) {
@@ -494,7 +509,7 @@ public class QtASTVisitor extends ASTVisitor {
continue;
ICPPASTFunctionDeclarator decltor = null;
- for(IASTDeclarator d : simpleDecl.getDeclarators())
+ for (IASTDeclarator d : simpleDecl.getDeclarators())
if (d instanceof ICPPASTFunctionDeclarator) {
decltor = (ICPPASTFunctionDeclarator) d;
break;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtEnumName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtEnumName.java
index 97aa70e5a1..0f6b1b1623 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtEnumName.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtEnumName.java
@@ -13,12 +13,13 @@ package org.eclipse.cdt.internal.qt.core.pdom;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.core.runtime.CoreException;
-public class QtEnumName extends AbstractQObjectMemberName implements IQtASTName {
+public class QtEnumName extends AbstractQObjectMemberName implements IQtASTName {
private final IASTName cppEnumName;
private final boolean isFlag;
- public QtEnumName(IQtASTName qobjName, IASTName ast, String qtEnumName, IASTName cppEnumName, QtASTImageLocation location, boolean isFlag) {
+ public QtEnumName(IQtASTName qobjName, IASTName ast, String qtEnumName, IASTName cppEnumName,
+ QtASTImageLocation location, boolean isFlag) {
super(qobjName, ast, qtEnumName, location);
this.cppEnumName = cppEnumName;
this.isFlag = isFlag;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMArray.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMArray.java
index aae2221a9e..fa8ace6ae1 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMArray.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMArray.java
@@ -20,9 +20,9 @@ import org.eclipse.core.runtime.CoreException;
public class QtPDOMArray<T> {
private static int offsetInitializer = 0;
+
protected static enum Field {
- Count(Database.INT_SIZE),
- Data(0); // The size of the block is provided at runtime.
+ Count(Database.INT_SIZE), Data(0); // The size of the block is provided at runtime.
public final int offset;
@@ -68,7 +68,7 @@ public class QtPDOMArray<T> {
long elementRec = Field.Data.getRecord(record);
T[] array = codec.allocArray(count);
- for(int i = 0; i < count; ++i, elementRec += codec.getElementSize())
+ for (int i = 0; i < count; ++i, elementRec += codec.getElementSize())
array[i] = codec.decode(linkage, elementRec);
return array;
@@ -100,7 +100,7 @@ public class QtPDOMArray<T> {
// Write the new content into the database.
long elementRec = Field.Data.getRecord(record);
- for(int i = 0; i < array.length; ++i, elementRec += codec.getElementSize())
+ for (int i = 0; i < array.length; ++i, elementRec += codec.getElementSize())
codec.encode(linkage, elementRec, array[i]);
return record;
@@ -118,7 +118,7 @@ public class QtPDOMArray<T> {
int count = linkage.getDB().getInt(Field.Count.getRecord(record));
if (count > 0) {
long elementRec = Field.Data.getRecord(record);
- for(int i = 0; i < count; ++i, elementRec += codec.getElementSize())
+ for (int i = 0; i < count; ++i, elementRec += codec.getElementSize())
codec.encode(linkage, elementRec, null);
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMBinding.java
index 3e7a19c231..009b0ad581 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMBinding.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMBinding.java
@@ -24,6 +24,7 @@ public abstract class QtPDOMBinding extends PDOMBinding {
// the QtPDOMBinding record because the enum will not be initialized until it is needed.
// The record size is retrieved as the offset of the special terminal enumerator Last.
private static int offsetInitializer = RECORD_SIZE;
+
protected static enum Field {
Last(0);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMLinkage.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMLinkage.java
index 35f3d4ce19..4eb826d5ae 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMLinkage.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMLinkage.java
@@ -42,10 +42,9 @@ import org.eclipse.core.runtime.CoreException;
public class QtPDOMLinkage extends PDOMLinkage {
private static int offsetInitializer = PDOMLinkage.RECORD_SIZE;
+
private static enum Field {
- Version(Database.INT_SIZE, 0),
- QmlRegistrationIndex(Database.PTR_SIZE, 3),
- Last(0, 0);
+ Version(Database.INT_SIZE, 0), QmlRegistrationIndex(Database.PTR_SIZE, 3), Last(0, 0);
private final int offset;
public final int version;
@@ -128,8 +127,7 @@ public class QtPDOMLinkage extends PDOMLinkage {
// If a binding has already been persisted for this instance then return it now.
QtPDOMBinding pdomBinding = (QtPDOMBinding) binding.getAdapter(QtPDOMBinding.class);
- if (pdomBinding != null
- && pdomBinding.getLinkage() == this)
+ if (pdomBinding != null && pdomBinding.getLinkage() == this)
return pdomBinding;
// If a PDOMBinding was created, then add it to the linkage before returning it.
@@ -155,8 +153,7 @@ public class QtPDOMLinkage extends PDOMLinkage {
if (pdomBinding == null)
return 0;
- if (pdomBinding.getLinkage() == null
- || pdomBinding.getLinkage().getLinkageID() != ILinkage.CPP_LINKAGE_ID)
+ if (pdomBinding.getLinkage() == null || pdomBinding.getLinkage().getLinkageID() != ILinkage.CPP_LINKAGE_ID)
return 0;
return pdomBinding.getRecord();
@@ -217,8 +214,7 @@ public class QtPDOMLinkage extends PDOMLinkage {
// have a linkage with a different id.
PDOMLinkage pdomLinkage = this;
ILinkage linkage = binding.getLinkage();
- if (linkage != null
- && linkage.getLinkageID() != getLinkageID())
+ if (linkage != null && linkage.getLinkageID() != getLinkageID())
pdomLinkage = getPDOM().getLinkage(linkage.getLinkageID());
// Handle bindings in unknown linkages as though the name is to be added to this linkage.
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNameIndex.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNameIndex.java
index 6d77d7ebcb..887fb462b1 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNameIndex.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNameIndex.java
@@ -58,7 +58,7 @@ public class QtPDOMNameIndex {
return Collections.emptyList();
List<PDOMName> names = new ArrayList<PDOMName>();
- for(long node = db.getRecPtr(finder.headRec); node != 0; node = db.getRecPtr(node + Database.PTR_SIZE))
+ for (long node = db.getRecPtr(finder.headRec); node != 0; node = db.getRecPtr(node + Database.PTR_SIZE))
names.add(new PDOMName(qtLinkage, db.getRecPtr(node)));
return names;
}
@@ -104,7 +104,7 @@ public class QtPDOMNameIndex {
// Walk the list to find this record. If found then update the previous node to
// point to the one after node.
long prev = finder.headRec;
- for(long node = db.getRecPtr(prev); node != 0; node = db.getRecPtr(prev)) {
+ for (long node = db.getRecPtr(prev); node != 0; node = db.getRecPtr(prev)) {
long rec = db.getRecPtr(node);
if (rec == qmlRec) {
long next = db.getRecPtr(node + Database.PTR_SIZE);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNodeType.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNodeType.java
index 5fc35cb65d..39b7523666 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNodeType.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNodeType.java
@@ -17,13 +17,7 @@ import org.eclipse.core.runtime.CoreException;
@SuppressWarnings("restriction")
public enum QtPDOMNodeType {
- QObject,
- QEnum,
- QProperty,
- QMethod,
- QGadget,
- QmlTypeRegistration,
- QmlUncreatableRegistration;
+ QObject, QEnum, QProperty, QMethod, QGadget, QmlTypeRegistration, QmlUncreatableRegistration;
public final int Type = IIndexBindingConstants.LAST_CONSTANT + 1 + ordinal();
@@ -42,7 +36,7 @@ public enum QtPDOMNodeType {
public static QtPDOMNodeType forType(int version, int type) {
// Nothing has been deleted or replaced yet, so the version is ignored.
- for(QtPDOMNodeType node : values())
+ for (QtPDOMNodeType node : values())
if (node.Type == type)
return node;
return null;
@@ -54,7 +48,7 @@ public enum QtPDOMNodeType {
if (node == null)
return null;
- switch(node) {
+ switch (node) {
case QObject:
return new QtPDOMQObject(linkage, record);
case QEnum:
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMProperty.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMProperty.java
index e44c04d9b9..3dafe8144d 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMProperty.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMProperty.java
@@ -21,10 +21,9 @@ import org.eclipse.core.runtime.CoreException;
public class QtPDOMProperty extends QtPDOMBinding {
private static int offsetInitializer = QtPDOMBinding.Field.Last.offset;
+
protected static enum Field {
- Type(Database.PTR_SIZE),
- Attributes(Database.PTR_SIZE),
- Last(0);
+ Type(Database.PTR_SIZE), Attributes(Database.PTR_SIZE), Last(0);
public final int offset;
@@ -107,30 +106,30 @@ public class QtPDOMProperty extends QtPDOMBinding {
return pdomArray.get();
}
- public static class Attribute {
- public final IQProperty.Attribute attr;
- public final String value;
- public final long cppRecord;
-
- public Attribute(IQProperty.Attribute attr, String value) {
- this.attr = attr;
- this.value = value;
- this.cppRecord = 0;
- }
-
- public Attribute(IQProperty.Attribute attr, String value, PDOMBinding cppBinding) {
- this.attr = attr;
- this.value = value;
- this.cppRecord = cppBinding == null ? 0 : cppBinding.getRecord();
- }
-
- private Attribute(IQProperty.Attribute attr, String value, long cppRecord) {
- this.attr = attr;
- this.value = value;
- this.cppRecord = cppRecord;
- }
-
- private static final IQtPDOMCodec<Attribute> Codec = new IQtPDOMCodec<Attribute>() {
+ public static class Attribute {
+ public final IQProperty.Attribute attr;
+ public final String value;
+ public final long cppRecord;
+
+ public Attribute(IQProperty.Attribute attr, String value) {
+ this.attr = attr;
+ this.value = value;
+ this.cppRecord = 0;
+ }
+
+ public Attribute(IQProperty.Attribute attr, String value, PDOMBinding cppBinding) {
+ this.attr = attr;
+ this.value = value;
+ this.cppRecord = cppBinding == null ? 0 : cppBinding.getRecord();
+ }
+
+ private Attribute(IQProperty.Attribute attr, String value, long cppRecord) {
+ this.attr = attr;
+ this.value = value;
+ this.cppRecord = cppRecord;
+ }
+
+ private static final IQtPDOMCodec<Attribute> Codec = new IQtPDOMCodec<Attribute>() {
@Override
public int getElementSize() {
return 1 + Database.PTR_SIZE + Database.PTR_SIZE;
@@ -172,6 +171,6 @@ public class QtPDOMProperty extends QtPDOMBinding {
linkage.getDB().putRecPtr(record + 1 + Database.PTR_SIZE, element.cppRecord);
}
- };
- }
+ };
+ }
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQEnum.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQEnum.java
index e9eed7b038..de268933a6 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQEnum.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQEnum.java
@@ -27,10 +27,9 @@ import org.eclipse.core.runtime.CoreException;
public class QtPDOMQEnum extends QtPDOMBinding {
private static int offsetInitializer = QtPDOMBinding.Field.Last.offset;
+
protected static enum Field {
- Flags(1),
- CppRecord(Database.PTR_SIZE),
- Last(0);
+ Flags(1), CppRecord(Database.PTR_SIZE), Last(0);
public final int offset;
@@ -50,7 +49,8 @@ public class QtPDOMQEnum extends QtPDOMBinding {
super(linkage, record);
}
- public QtPDOMQEnum(QtPDOMLinkage linkage, PDOMBinding parent, IASTName qtName, IASTName cppName) throws CoreException {
+ public QtPDOMQEnum(QtPDOMLinkage linkage, PDOMBinding parent, IASTName qtName, IASTName cppName)
+ throws CoreException {
super(linkage, parent, qtName);
getDB().putRecPtr(Field.CppRecord.getRecord(record), linkage.getCPPRecord(cppName));
@@ -58,14 +58,13 @@ public class QtPDOMQEnum extends QtPDOMBinding {
// The flags are set in several sections, and then written to the Database in one operation.
byte flags = 0;
- if (qtName instanceof QtEnumName
- && ((QtEnumName) qtName).isFlag())
+ if (qtName instanceof QtEnumName && ((QtEnumName) qtName).isFlag())
flags |= IS_FLAG_MASK;
// Write the flags to the database.
getDB().putByte(Field.Flags.getRecord(record), flags);
- if(parent instanceof AbstractQtPDOMClass)
+ if (parent instanceof AbstractQtPDOMClass)
((AbstractQtPDOMClass) parent).addChild(this);
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQMethod.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQMethod.java
index 72f1438608..d50c87d0e3 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQMethod.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQMethod.java
@@ -20,11 +20,9 @@ import org.eclipse.core.runtime.CoreException;
public class QtPDOMQMethod extends QtPDOMBinding {
private static int offsetInitializer = QtPDOMBinding.Field.Last.offset;
+
protected static enum Field {
- Signature(Database.PTR_SIZE),
- Revision(8),
- Flags(1),
- Last(0);
+ Signature(Database.PTR_SIZE), Revision(8), Flags(1), Last(0);
public final int offset;
@@ -48,11 +46,12 @@ public class QtPDOMQMethod extends QtPDOMBinding {
super(linkage, record);
}
- public QtPDOMQMethod(QtPDOMLinkage linkage, PDOMBinding parent, IASTName qtName, IASTName cppName, IQMethod.Kind kind, String qtEncSignatures, Long revision) throws CoreException {
+ public QtPDOMQMethod(QtPDOMLinkage linkage, PDOMBinding parent, IASTName qtName, IASTName cppName,
+ IQMethod.Kind kind, String qtEncSignatures, Long revision) throws CoreException {
super(linkage, parent, qtName);
byte flag = 0;
- switch(kind) {
+ switch (kind) {
case Invokable:
flag |= KIND_IS_INVOKABLE;
break;
@@ -86,7 +85,7 @@ public class QtPDOMQMethod extends QtPDOMBinding {
}
public IQMethod.Kind getKind() throws CoreException {
- switch(getDB().getByte(Field.Flags.getRecord(record)) & KIND_MASK) {
+ switch (getDB().getByte(Field.Flags.getRecord(record)) & KIND_MASK) {
case KIND_IS_INVOKABLE:
return IQMethod.Kind.Invokable;
case KIND_IS_SIGNAL:
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQObject.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQObject.java
index 397e6e8621..3446571419 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQObject.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQObject.java
@@ -29,9 +29,9 @@ import org.eclipse.core.runtime.CoreException;
public class QtPDOMQObject extends AbstractQtPDOMClass {
private static int offsetInitializer = AbstractQtPDOMClass.Field.Last.offset;
+
protected static enum Field {
- ClassInfos(Database.PTR_SIZE),
- Last(0);
+ ClassInfos(Database.PTR_SIZE), Last(0);
public final int offset;
@@ -69,14 +69,15 @@ public class QtPDOMQObject extends AbstractQtPDOMClass {
// Create an array to be stored to the PDOM.
ClassInfo[] array = new ClassInfo[classInfos.size()];
Iterator<Map.Entry<String, String>> iterator = classInfos.entrySet().iterator();
- for(int i = 0; i < array.length && iterator.hasNext(); ++i) {
+ for (int i = 0; i < array.length && iterator.hasNext(); ++i) {
Map.Entry<String, String> entry = iterator.next();
array[i] = new ClassInfo(entry.getKey(), entry.getValue());
}
// Store the array into the Database.
long arrayRec = getDB().getRecPtr(Field.ClassInfos.getRecord(record));
- QtPDOMArray<ClassInfo> pdomArray = new QtPDOMArray<QtPDOMQObject.ClassInfo>(getQtLinkage(), ClassInfo.Codec, arrayRec);
+ QtPDOMArray<ClassInfo> pdomArray = new QtPDOMArray<QtPDOMQObject.ClassInfo>(getQtLinkage(), ClassInfo.Codec,
+ arrayRec);
arrayRec = pdomArray.set(array);
// Update the record that is stored in the receiver's field.
@@ -88,13 +89,14 @@ public class QtPDOMQObject extends AbstractQtPDOMClass {
// Read the array from the Database and insert the elements into the Map that is to be returned.
long arrayRec = getDB().getRecPtr(Field.ClassInfos.getRecord(record));
- QtPDOMArray<ClassInfo> pdomArray = new QtPDOMArray<QtPDOMQObject.ClassInfo>(getQtLinkage(), ClassInfo.Codec, arrayRec);
+ QtPDOMArray<ClassInfo> pdomArray = new QtPDOMArray<QtPDOMQObject.ClassInfo>(getQtLinkage(), ClassInfo.Codec,
+ arrayRec);
ClassInfo[] array = pdomArray.get();
if (array == null)
return classInfos;
- for(ClassInfo classInfo : array)
+ for (ClassInfo classInfo : array)
classInfos.put(classInfo.key, classInfo.value);
return classInfos;
@@ -140,15 +142,16 @@ public class QtPDOMQObject extends AbstractQtPDOMClass {
return bases;
}
- private static class ClassInfo {
- public final String key;
- public final String value;
- public ClassInfo(String key, String value) {
- this.key = key;
- this.value = value;
- }
+ private static class ClassInfo {
+ public final String key;
+ public final String value;
+
+ public ClassInfo(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
- public static final IQtPDOMCodec<ClassInfo> Codec = new IQtPDOMCodec<ClassInfo>() {
+ public static final IQtPDOMCodec<ClassInfo> Codec = new IQtPDOMCodec<ClassInfo>() {
@Override
public int getElementSize() {
return 2 * Database.PTR_SIZE;
@@ -163,7 +166,8 @@ public class QtPDOMQObject extends AbstractQtPDOMClass {
public ClassInfo decode(QtPDOMLinkage linkage, long record) throws CoreException {
long keyRec = linkage.getDB().getRecPtr(record);
long valRec = linkage.getDB().getRecPtr(record + Database.PTR_SIZE);
- return new ClassInfo(linkage.getDB().getString(keyRec).getString(), linkage.getDB().getString(valRec).getString());
+ return new ClassInfo(linkage.getDB().getString(keyRec).getString(),
+ linkage.getDB().getString(valRec).getString());
}
@Override
@@ -172,13 +176,15 @@ public class QtPDOMQObject extends AbstractQtPDOMClass {
long rec = linkage.getDB().getRecPtr(record);
if (rec != 0)
linkage.getDB().getString(rec).delete();
- linkage.getDB().putRecPtr(record, element == null ? 0 : linkage.getDB().newString(element.key).getRecord());
+ linkage.getDB().putRecPtr(record,
+ element == null ? 0 : linkage.getDB().newString(element.key).getRecord());
rec = linkage.getDB().getRecPtr(record + Database.PTR_SIZE);
if (rec != 0)
linkage.getDB().getString(rec).delete();
- linkage.getDB().putRecPtr(record + Database.PTR_SIZE, element == null ? 0 : linkage.getDB().newString(element.value).getRecord());
+ linkage.getDB().putRecPtr(record + Database.PTR_SIZE,
+ element == null ? 0 : linkage.getDB().newString(element.value).getRecord());
}
- };
- }
+ };
+ }
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlRegistration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlRegistration.java
index 0bc5578008..88d26f7c7d 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlRegistration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlRegistration.java
@@ -22,15 +22,10 @@ import org.eclipse.core.runtime.CoreException;
public class QtPDOMQmlRegistration extends QtPDOMBinding {
private static int offsetInitializer = QtPDOMBinding.Field.Last.offset;
+
protected static enum Field {
- CppRecord(Database.PTR_SIZE),
- QObjectName(Database.PTR_SIZE),
- Version(8), // Database doesn't have a LONG_SIZE
- Uri(Database.PTR_SIZE),
- Major(8),
- Minor(8),
- QmlName(Database.PTR_SIZE),
- Last(0);
+ CppRecord(Database.PTR_SIZE), QObjectName(Database.PTR_SIZE), Version(8), // Database doesn't have a LONG_SIZE
+ Uri(Database.PTR_SIZE), Major(8), Minor(8), QmlName(Database.PTR_SIZE), Last(0);
public final int offset;
@@ -44,7 +39,8 @@ public class QtPDOMQmlRegistration extends QtPDOMBinding {
super(linkage, record);
}
- public QtPDOMQmlRegistration(QtPDOMLinkage linkage, QmlTypeRegistration qmlTypeReg, IASTName cppName) throws CoreException {
+ public QtPDOMQmlRegistration(QtPDOMLinkage linkage, QmlTypeRegistration qmlTypeReg, IASTName cppName)
+ throws CoreException {
super(linkage, null, qmlTypeReg);
putStringOrNull(Field.QObjectName.offset, qmlTypeReg.getQObjectName());
@@ -57,8 +53,7 @@ public class QtPDOMQmlRegistration extends QtPDOMBinding {
public static Collection<QtPDOMQmlRegistration> findFor(QtPDOMQObject qobj) throws CoreException {
PDOMLinkage linkage = qobj.getLinkage();
- if (linkage == null
- || !(linkage instanceof QtPDOMLinkage))
+ if (linkage == null || !(linkage instanceof QtPDOMLinkage))
return Collections.emptyList();
String name = qobj.getName();
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlUncreatable.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlUncreatable.java
index f7a395a2be..e97b3e94e0 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlUncreatable.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlUncreatable.java
@@ -18,9 +18,9 @@ import org.eclipse.core.runtime.CoreException;
public class QtPDOMQmlUncreatable extends QtPDOMQmlRegistration {
private static int offsetInitializer = QtPDOMQmlRegistration.Field.Last.offset;
+
protected static enum Field {
- Reason(Database.PTR_SIZE),
- Last(0);
+ Reason(Database.PTR_SIZE), Last(0);
public final int offset;
@@ -34,7 +34,8 @@ public class QtPDOMQmlUncreatable extends QtPDOMQmlRegistration {
super(linkage, record);
}
- public QtPDOMQmlUncreatable(QtPDOMLinkage linkage, QmlTypeRegistration qmlTypeReg, IASTName cppName) throws CoreException {
+ public QtPDOMQmlUncreatable(QtPDOMLinkage linkage, QmlTypeRegistration qmlTypeReg, IASTName cppName)
+ throws CoreException {
super(linkage, qmlTypeReg, cppName);
putStringOrNull(Field.Reason.offset, qmlTypeReg.getReason());
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMVisitor.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMVisitor.java
index d06c9a03af..67b3e9c7f1 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMVisitor.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMVisitor.java
@@ -43,8 +43,7 @@ public abstract class QtPDOMVisitor implements IPDOMVisitor {
@Override
@SuppressWarnings("unchecked")
public boolean visit(IPDOMNode node) throws CoreException {
- if (node != null
- && cls.isAssignableFrom(node.getClass()))
+ if (node != null && cls.isAssignableFrom(node.getClass()))
list.add((T) node);
return true;
}
@@ -98,8 +97,7 @@ public abstract class QtPDOMVisitor implements IPDOMVisitor {
if (element != null)
return false;
- if (cls.isAssignableFrom(node.getClass())
- && filter.matches(node))
+ if (cls.isAssignableFrom(node.getClass()) && filter.matches(node))
element = (T) node;
return element == null;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/QtInstallProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/QtInstallProvider.java
index d17295c69b..5b6554d45a 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/QtInstallProvider.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/QtInstallProvider.java
@@ -39,14 +39,13 @@ public class QtInstallProvider implements IQtInstallProvider {
Path qmake = Paths.get(isWin32 ? "bin/qmake.exe" : "bin/qmake"); //$NON-NLS-1$ //$NON-NLS-2$
if (root != null && Files.exists(root)) {
try {
- 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$
- }
- return install;
- }).collect(Collectors.toList());
+ 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$
+ }
+ return install;
+ }).collect(Collectors.toList());
} catch (IOException e) {
Activator.log(e);
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java
index 45b095675d..1c93f82f79 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java
@@ -72,7 +72,8 @@ public class QMLEnumInfo {
try {
value = QMLExpressionEvaluator.evaluateConstExpr(property.getValue());
if (value instanceof Number) {
- constantList.add(new EnumConst(property.getType(), ((Number) value).intValue()));
+ constantList.add(
+ new EnumConst(property.getType(), ((Number) value).intValue()));
}
} catch (InvalidExpressionException e) {
builder.handleException(e);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java
index 13684f41a5..4d42811659 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java
@@ -70,7 +70,8 @@ public class QMLModelBuilder {
boolean ensureNode(IQmlASTNode actual, Class<? extends IQmlASTNode> expected) {
if (!expected.isInstance(actual)) {
- Activator.log("[QmlTypes] Expected node '" + expected + "', but was '" + actual.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Activator.log("[QmlTypes] Expected node '" + expected + "', but was '" //$NON-NLS-1$//$NON-NLS-2$
+ + actual.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$
return false;
}
return true;
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java
index 9463ee09af..3ff41d245b 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java
@@ -17,13 +17,13 @@ import org.eclipse.core.runtime.CoreException;
/**
* Qt specific build configuration settings.
- *
+ *
* @noimplement
*/
public interface IQtBuildConfiguration extends ICBuildConfiguration {
Path getBuildDirectory() throws CoreException;
-
+
Path getQmakeCommand();
String[] getQmakeConfig();
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstall.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstall.java
index 9f5be448b7..db243408c0 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstall.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstall.java
@@ -16,7 +16,7 @@ import java.util.Map;
/**
* Represents an installation of the Qt SDK. Qt installs are defined by the path
* to the qmake executable.
- *
+ *
* @noimplement
*/
public interface IQtInstall {
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallManager.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallManager.java
index 2f39c4fa07..d594936649 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallManager.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallManager.java
@@ -19,21 +19,21 @@ import org.eclipse.cdt.core.build.IToolChain;
* The manager for Qt Installs. Qt Installs are Qt installation trees that are produced in a Qt
* platform build. They have a spec which selects the os and cpu architecture and are managed by an
* instance of the qmake builder.
- *
+ *
* @noimplement
*/
public interface IQtInstallManager {
/**
* Returns all the registered Qt installs.
- *
+ *
* @return all Qt Installs
*/
public Collection<IQtInstall> getInstalls();
/**
* Register a new Qt Install
- *
+ *
* @param install
* new Qt Install
*/
@@ -41,7 +41,7 @@ public interface IQtInstallManager {
/**
* Return a Qt install that is managed by the given qmake.
- *
+ *
* @param qmakePath
* path to qmake
* @return QT install managed by that qmake
@@ -50,7 +50,7 @@ public interface IQtInstallManager {
/**
* Returns the Qt installs that have the matching spec.
- *
+ *
* @param spec
* spec for the Qt installs, e.g. macosx-clang
* @return all Qt installs that have that spec
@@ -59,7 +59,7 @@ public interface IQtInstallManager {
/**
* Deregister a given Qt install
- *
+ *
* @param install
* Qt install to deregister
*/
@@ -69,7 +69,7 @@ public interface IQtInstallManager {
* Check whether the given toolchain supports the given Qt Install. This is done by checking the
* OS and CPU arch of the toolchain and returning whether the Qt install supports that
* combination.
- *
+ *
* @param install
* Qt Install to check
* @param toolChain
@@ -80,7 +80,7 @@ public interface IQtInstallManager {
/**
* Add a listener for Qt install changes
- *
+ *
* @param listener
* listener to add
*/
@@ -88,7 +88,7 @@ public interface IQtInstallManager {
/**
* Remove a listener for Qt install changes
- *
+ *
* @param listener
* listener to remove
*/
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtInstallEvent.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtInstallEvent.java
index d54b733d08..e3bf448809 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtInstallEvent.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtInstallEvent.java
@@ -2,7 +2,7 @@ package org.eclipse.cdt.qt.core;
/**
* Event that a Qt install change has occured.
- *
+ *
* @since 2.1
*/
public class QtInstallEvent {
@@ -22,7 +22,7 @@ public class QtInstallEvent {
/**
* Type of the event
- *
+ *
* @return type of the event
*/
public int getType() {
@@ -31,7 +31,7 @@ public class QtInstallEvent {
/**
* Qt install involved in the event
- *
+ *
* @return Qt install for the event
*/
public IQtInstall getInstall() {
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java
index 0812c7e8c2..4101d77be1 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java
@@ -127,22 +127,18 @@ public class QMLDirectoryInfo {
}
} else if (c instanceof IQDirResourceCommand) {
IQDirResourceCommand rc = (IQDirResourceCommand) c;
- resources.add(new ResourceFile(rc.getFile().getText(),
- rc.getInitialVersion().getVersionString(),
- false, false));
+ resources.add(new ResourceFile(rc.getFile().getText(), rc.getInitialVersion().getVersionString(), false,
+ false));
} else if (c instanceof IQDirInternalCommand) {
IQDirInternalCommand rc = (IQDirInternalCommand) c;
- resources.add(new ResourceFile(rc.getFile().getText(),
- null, true, false));
+ resources.add(new ResourceFile(rc.getFile().getText(), null, true, false));
} else if (c instanceof IQDirSingletonCommand) {
IQDirSingletonCommand rc = (IQDirSingletonCommand) c;
- resources.add(new ResourceFile(rc.getFile().getText(),
- rc.getInitialVersion().getVersionString(),
- false, true));
+ resources.add(new ResourceFile(rc.getFile().getText(), rc.getInitialVersion().getVersionString(), false,
+ true));
} else if (c instanceof IQDirDependsCommand) {
IQDirDependsCommand dc = (IQDirDependsCommand) c;
- depends.add(new Module(dc.getModuleIdentifier().getText(),
- dc.getInitialVersion().getVersionString()));
+ depends.add(new Module(dc.getModuleIdentifier().getText(), dc.getInitialVersion().getVersionString()));
} else if (c instanceof IQDirClassnameCommand) {
if (classname == null) {
classname = ((IQDirClassnameCommand) c).getIdentifier().getText();
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java
index b39e88a737..b0aef38872 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java
@@ -67,8 +67,7 @@ public class QMLDirectoryLexer {
this.raw = raw;
this.start = start;
this.end = end;
- this.location = new SourceLocation(null,
- new Position(line, start - lineStart),
+ this.location = new SourceLocation(null, new Position(line, start - lineStart),
new Position(line, end - lineStart));
}
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileModifierTest.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileModifierTest.java
index cbc629c275..006e1ccd5a 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileModifierTest.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileModifierTest.java
@@ -46,16 +46,14 @@ public class QtProjectFileModifierTest extends TestCase {
@Test
public void test_ReplaceValue_HasCommentOnSubsequentLine() {
- IDocument document = new Document(
- "SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$
- + " main2.cpp # This is a comment"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$
+ + " main2.cpp # This is a comment"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
assertTrue(modifier.replaceVariableValue("SOURCES", "main2.cpp", "main3.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals(
- "SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$
- + " main3.cpp # This is a comment", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$
+ + " main3.cpp # This is a comment", //$NON-NLS-1$
document.get());
}
@@ -66,8 +64,7 @@ public class QtProjectFileModifierTest extends TestCase {
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
assertTrue(modifier.replaceVariableValue("CONFIG", "debug", "console", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals(
- "CONFIG = qt console", //$NON-NLS-1$
+ assertEquals("CONFIG = qt console", //$NON-NLS-1$
document.get());
}
@@ -78,53 +75,46 @@ public class QtProjectFileModifierTest extends TestCase {
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
assertFalse(modifier.replaceVariableValue("CONFIG", "console", "debug", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals(
- "CONFIG = qt debug", //$NON-NLS-1$
+ assertEquals("CONFIG = qt debug", //$NON-NLS-1$
document.get());
}
@Test
public void test_ReplaceMultilineValue_MatchWholeLineFalse() {
- IDocument document = new Document(
- "CONFIG = qt \\\n" //$NON-NLS-1$
- + " debug"); //$NON-NLS-1$
+ IDocument document = new Document("CONFIG = qt \\\n" //$NON-NLS-1$
+ + " debug"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
assertTrue(modifier.replaceVariableValue("CONFIG", "debug", "console", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals(
- "CONFIG = qt \\\n" //$NON-NLS-1$
- + " console", //$NON-NLS-1$
+ assertEquals("CONFIG = qt \\\n" //$NON-NLS-1$
+ + " console", //$NON-NLS-1$
document.get());
}
@Test
public void test_ReplaceMultilineValue() {
- IDocument document = new Document(
- "SOURCES += main.cpp \\\n" //$NON-NLS-1$
- + " main2.cpp"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp \\\n" //$NON-NLS-1$
+ + " main2.cpp"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
assertTrue(modifier.replaceVariableValue("SOURCES", "main2.cpp", "main3.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals(
- "SOURCES += main.cpp \\\n" //$NON-NLS-1$
- + " main3.cpp", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\\n" //$NON-NLS-1$
+ + " main3.cpp", //$NON-NLS-1$
document.get());
}
@Test
public void test_ReplaceMultilineValue_HasComment() {
- IDocument document = new Document(
- "SOURCES += main.cpp \\\n" //$NON-NLS-1$
- + " main2.cpp # This is a comment"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp \\\n" //$NON-NLS-1$
+ + " main2.cpp # This is a comment"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
assertTrue(modifier.replaceVariableValue("SOURCES", "main2.cpp", "main3.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals(
- "SOURCES += main.cpp \\\n" //$NON-NLS-1$
- + " main3.cpp # This is a comment", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\\n" //$NON-NLS-1$
+ + " main3.cpp # This is a comment", //$NON-NLS-1$
document.get());
}
@@ -135,25 +125,22 @@ public class QtProjectFileModifierTest extends TestCase {
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main.cpp \\\n" //$NON-NLS-1$
- + " main2.cpp", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\\n" //$NON-NLS-1$
+ + " main2.cpp", //$NON-NLS-1$
document.get());
}
@Test
public void test_AddValue_NoIndentation() {
- IDocument document = new Document(
- "SOURCES += main.cpp \\\n" //$NON-NLS-1$
- + "noindent.cpp"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp \\\n" //$NON-NLS-1$
+ + "noindent.cpp"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main.cpp \\\n" //$NON-NLS-1$
- + "noindent.cpp \\\n" //$NON-NLS-1$
- + "main2.cpp", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\\n" //$NON-NLS-1$
+ + "noindent.cpp \\\n" //$NON-NLS-1$
+ + "main2.cpp", //$NON-NLS-1$
document.get());
}
@@ -174,61 +161,54 @@ public class QtProjectFileModifierTest extends TestCase {
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$
- + " main2.cpp", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$
+ + " main2.cpp", //$NON-NLS-1$
document.get());
}
@Test
public void test_AddValue_HasCommentOnSubsequentLine() {
- IDocument document = new Document(
- "SOURCES += main.cpp \\ # This is a comment \n" //$NON-NLS-1$
- + " main2.cpp # this is a comment\n\n"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp \\ # This is a comment \n" //$NON-NLS-1$
+ + " main2.cpp # this is a comment\n\n"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main3.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main.cpp \\ # This is a comment \n" //$NON-NLS-1$
- + " main2.cpp \\ # this is a comment\n" //$NON-NLS-1$
- + " main3.cpp\n\n", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\ # This is a comment \n" //$NON-NLS-1$
+ + " main2.cpp \\ # this is a comment\n" //$NON-NLS-1$
+ + " main3.cpp\n\n", //$NON-NLS-1$
document.get());
}
@Test
public void test_AddValue_CommentIndentation() {
- IDocument document = new Document(
- "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
- + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
- + " main3.cpp # Test comment3"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
+ + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
+ + " main3.cpp # Test comment3"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main4.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
- + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
- + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
- + " main4.cpp", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
+ + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
+ + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
+ + " main4.cpp", //$NON-NLS-1$
document.get());
}
@Test
public void test_AddValue_MultipleVariables() {
- IDocument document = new Document(
- "SOURCES += main.cpp\n" //$NON-NLS-1$
- + "\n" //$NON-NLS-1$
- + "QT = app"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp\n" //$NON-NLS-1$
+ + "\n" //$NON-NLS-1$
+ + "QT = app"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main.cpp \\\n" + //$NON-NLS-1$
- " main2.cpp\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "QT = app", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\\n" + //$NON-NLS-1$
+ " main2.cpp\n" + //$NON-NLS-1$
+ "\n" + //$NON-NLS-1$
+ "QT = app", //$NON-NLS-1$
document.get());
}
@@ -239,8 +219,7 @@ public class QtProjectFileModifierTest extends TestCase {
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main.cpp\n", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp\n", //$NON-NLS-1$
document.get());
}
@@ -251,10 +230,9 @@ public class QtProjectFileModifierTest extends TestCase {
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "CONFIG += qt debug\n" //$NON-NLS-1$
- + "\n" //$NON-NLS-1$
- + "SOURCES += main.cpp\n", //$NON-NLS-1$
+ assertEquals("CONFIG += qt debug\n" //$NON-NLS-1$
+ + "\n" //$NON-NLS-1$
+ + "SOURCES += main.cpp\n", //$NON-NLS-1$
document.get());
}
@@ -265,10 +243,9 @@ public class QtProjectFileModifierTest extends TestCase {
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "CONFIG += qt debug\n" //$NON-NLS-1$
- + "\n" //$NON-NLS-1$
- + "SOURCES += main.cpp\n", //$NON-NLS-1$
+ assertEquals("CONFIG += qt debug\n" //$NON-NLS-1$
+ + "\n" //$NON-NLS-1$
+ + "SOURCES += main.cpp\n", //$NON-NLS-1$
document.get());
}
@@ -279,65 +256,58 @@ public class QtProjectFileModifierTest extends TestCase {
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "CONFIG += qt debug\n" //$NON-NLS-1$
- + "\n" //$NON-NLS-1$
- + "\n" //$NON-NLS-1$
- + "SOURCES += main.cpp\n", //$NON-NLS-1$
+ assertEquals("CONFIG += qt debug\n" //$NON-NLS-1$
+ + "\n" //$NON-NLS-1$
+ + "\n" //$NON-NLS-1$
+ + "SOURCES += main.cpp\n", //$NON-NLS-1$
document.get());
}
@Test
public void test_RemoveThenAddValue() {
- IDocument document = new Document(
- "SOURCES += main.cpp \\\n" //$NON-NLS-1$
- + " main2.cpp \\\n" //$NON-NLS-1$
- + " main3.cpp\n"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp \\\n" //$NON-NLS-1$
+ + " main2.cpp \\\n" //$NON-NLS-1$
+ + " main3.cpp\n"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.removeVariableValue("SOURCES", "main3.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
modifier.addVariableValue("SOURCES", "main4.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main.cpp \\\n" //$NON-NLS-1$
- + " main2.cpp \\\n" //$NON-NLS-1$
- + " main4.cpp\n", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\\n" //$NON-NLS-1$
+ + " main2.cpp \\\n" //$NON-NLS-1$
+ + " main4.cpp\n", //$NON-NLS-1$
document.get());
}
@Test
public void test_RemoveValue_FirstLine() {
- IDocument document = new Document(
- "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
- + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
- + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
- + " main4.cpp # Test comment4"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
+ + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
+ + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
+ + " main4.cpp # Test comment4"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.removeVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
- + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
- + " main4.cpp # Test comment4", //$NON-NLS-1$
+ assertEquals("SOURCES += main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
+ + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
+ + " main4.cpp # Test comment4", //$NON-NLS-1$
document.get());
}
@Test
public void test_RemoveValue_MiddleLine() {
- IDocument document = new Document(
- "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
- + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
- + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
- + " main4.cpp # Test comment4"); //$NON-NLS-1$
+ IDocument document = new Document("SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
+ + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$
+ + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
+ + " main4.cpp # Test comment4"); //$NON-NLS-1$
QtProjectFileModifier modifier = new QtProjectFileModifier(document);
modifier.removeVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(
- "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
- + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
- + " main4.cpp # Test comment4", //$NON-NLS-1$
+ assertEquals("SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$
+ + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$
+ + " main4.cpp # Test comment4", //$NON-NLS-1$
document.get());
}
}
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileParserTest.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileParserTest.java
index 44a4d820ce..ea18fd84ae 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileParserTest.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileParserTest.java
@@ -172,7 +172,8 @@ public class QtProjectFileParserTest extends TestCase {
@Test
public void test_MultilineVariable_WithComment() {
- IDocument document = new Document("SOURCES += main.cpp \\ # this is a comment \n main2.cpp # this is a comment "); //$NON-NLS-1$
+ IDocument document = new Document(
+ "SOURCES += main.cpp \\ # this is a comment \n main2.cpp # this is a comment "); //$NON-NLS-1$
QtProjectFileParser parser = new QtProjectFileParser(document);
QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/ASTUtilTests.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/ASTUtilTests.java
index e482264c64..c4a9bb4288 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/ASTUtilTests.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/ASTUtilTests.java
@@ -134,7 +134,7 @@ public class ASTUtilTests extends AST2TestBase {
if (cls.isAssignableFrom(node.getClass()))
list.add(cls.cast(node));
- for(IASTNode child : node.getChildren())
+ for (IASTNode child : node.getChildren())
collectChildren(list, child, cls);
}
}
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/AutomatedIntegrationSuite.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/AutomatedIntegrationSuite.java
index 85f72a0462..0007fddaab 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/AutomatedIntegrationSuite.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/AutomatedIntegrationSuite.java
@@ -19,17 +19,8 @@ import junit.framework.TestSuite;
public class AutomatedIntegrationSuite extends TestSuite {
public static Test suite() throws Exception {
- return
- new TestSuite(
- ASTUtilTests.class,
- QMakeTests.class,
- QGadgetTests.class,
- QObjectTests.class,
- QtContentAssistantTests.class,
- QtIndexTests.class,
- QtRegressionTests.class,
- QmlRegistrationTests.class,
- QtProjectFileModifierTest.class,
- QtProjectFileParserTest.class);
+ return new TestSuite(ASTUtilTests.class, QMakeTests.class, QGadgetTests.class, QObjectTests.class,
+ QtContentAssistantTests.class, QtIndexTests.class, QtRegressionTests.class, QmlRegistrationTests.class,
+ QtProjectFileModifierTest.class, QtProjectFileParserTest.class);
}
}
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java
index 162c710049..bc3c86e327 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java
@@ -39,7 +39,8 @@ public class BaseQtTestCase extends BaseTestCase {
if (obj != null)
return true;
- System.err.println(getClass().getSimpleName() + '.' + getName() + ": could not find " + indexName + " in the index, continuing with other tests");
+ System.err.println(getClass().getSimpleName() + '.' + getName() + ": could not find " + indexName
+ + " in the index, continuing with other tests");
return false;
}
@@ -54,7 +55,8 @@ public class BaseQtTestCase extends BaseTestCase {
ws.run(new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
- ICProject cproject = CProjectHelper.createCProject(projectName, binFolderName, IPDOMManager.ID_FAST_INDEXER);
+ ICProject cproject = CProjectHelper.createCProject(projectName, binFolderName,
+ IPDOMManager.ID_FAST_INDEXER);
if (!cproject.getProject().hasNature(CCProjectNature.CC_NATURE_ID)) {
CProjectHelper.addNatureToProject(cproject.getProject(), CCProjectNature.CC_NATURE_ID, null);
QtNature.addNature(cproject.getProject(), new NullProgressMonitor());
@@ -138,20 +140,20 @@ public class BaseQtTestCase extends BaseTestCase {
}
private static String[] getContentsForTest(Class<?> testCaseCls, int frames, int blocks) throws Exception {
- String callingMethod = Thread.currentThread().getStackTrace()[frames].getMethodName();
- CharSequence[] help= TestSourceReader.getContentsForTest(
- QtTestPlugin.getDefault().getBundle(), "src", testCaseCls, callingMethod, blocks);
- String[] result= new String[help.length];
- int i= 0;
- for (CharSequence buf : help) {
- result[i++]= buf.toString();
+ String callingMethod = Thread.currentThread().getStackTrace()[frames].getMethodName();
+ CharSequence[] help = TestSourceReader.getContentsForTest(QtTestPlugin.getDefault().getBundle(), "src",
+ testCaseCls, callingMethod, blocks);
+ String[] result = new String[help.length];
+ int i = 0;
+ for (CharSequence buf : help) {
+ result[i++] = buf.toString();
}
- return result;
+ return result;
}
private String[] getContentsForTest(int blocks) throws Exception {
return getContentsForTest(getClass(), 4, blocks);
- }
+ }
/*package*/ static String[] getContentsForTest(Class<?> testCaseCls, int blocks) throws Exception {
return getContentsForTest(testCaseCls, 4, blocks);
@@ -165,8 +167,8 @@ public class BaseQtTestCase extends BaseTestCase {
* <li>loadComment must be called from a method that does not accept parameters</li>
* </ol>
*/
- protected void loadComment(String filename) throws Exception {
- String[] contents= getContentsForTest(1);
+ protected void loadComment(String filename) throws Exception {
+ String[] contents = getContentsForTest(1);
// get the timestamp of the last change to the index
IIndexManager indexManager = CCorePlugin.getIndexManager();
@@ -179,31 +181,28 @@ public class BaseQtTestCase extends BaseTestCase {
// wait for the index to change
Thread.yield();
waitForIndexer(fCProject);
- for(long stopAt = System.currentTimeMillis() + 3000;
- System.currentTimeMillis() < stopAt && timestamp == indexManager.getIndex(fCProject).getLastWriteAccess();
- Thread.sleep(100)) {
+ for (long stopAt = System.currentTimeMillis() + 3000; System.currentTimeMillis() < stopAt
+ && timestamp == indexManager.getIndex(fCProject).getLastWriteAccess(); Thread.sleep(100)) {
waitForIndexer(fCProject);
}
assertNotSame(timestamp, indexManager.getIndex(fCProject).getLastWriteAccess());
- }
+ }
- /**
- * A utility method for pausing the JUNIT code. This is helpful when investigating the
- * CDT indexer, which runs in a different job. The idea is to use it only while debugging,
- * and to change the value of the pause variable in the loop in order to continue.
- */
+ /**
+ * A utility method for pausing the JUNIT code. This is helpful when investigating the
+ * CDT indexer, which runs in a different job. The idea is to use it only while debugging,
+ * and to change the value of the pause variable in the loop in order to continue.
+ */
protected static void pause() throws Exception {
String oldName = Thread.currentThread().getName();
Thread.currentThread().setName("*** JUNIT PAUSED ***");
- try
- {
+ try {
// pause = false
boolean pause = true;
- do
- {
+ do {
Thread.sleep(10000);
- } while( pause );
+ } while (pause);
} finally {
Thread.currentThread().setName(oldName);
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QGadgetTests.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QGadgetTests.java
index 716aca9854..cad5deeea4 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QGadgetTests.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QGadgetTests.java
@@ -29,7 +29,7 @@ public class QGadgetTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQGadget qgadget = qtIndex.findQGadget(new String[]{ "G" });
+ IQGadget qgadget = qtIndex.findQGadget(new String[] { "G" });
if (!isIndexOk("G", qgadget))
return;
assertNotNull(qgadget);
@@ -63,7 +63,7 @@ public class QGadgetTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQGadget qgadget = qtIndex.findQGadget(new String[]{ "G" });
+ IQGadget qgadget = qtIndex.findQGadget(new String[] { "G" });
if (!isIndexOk("G", qgadget))
return;
assertNotNull(qgadget);
@@ -71,7 +71,7 @@ public class QGadgetTests extends BaseQtTestCase {
Collection<IQEnum> qEnums = qgadget.getEnums();
assertNotNull(qEnums);
assertEquals(3, qEnums.size());
- for(IQEnum qEnum : qEnums) {
+ for (IQEnum qEnum : qEnums) {
String name = qEnum.getName();
assertFalse(qEnum.isFlag());
if ("E0".equals(name)) {
@@ -87,7 +87,7 @@ public class QGadgetTests extends BaseQtTestCase {
else
fail("unexpected " + name + "::" + enumerator.getName() + " = " + String.valueOf(ordinal));
}
- } else if("E1".equals(name)) {
+ } else if ("E1".equals(name)) {
Collection<IQEnum.Enumerator> enumerators = qEnum.getEnumerators();
assertNotNull(enumerators);
assertEquals(2, enumerators.size());
@@ -100,7 +100,7 @@ public class QGadgetTests extends BaseQtTestCase {
else
fail("unexpected " + name + "::" + enumerator.getName() + " = " + String.valueOf(ordinal));
}
- } else if("G0::EB".equals(name)) {
+ } else if ("G0::EB".equals(name)) {
Collection<IQEnum.Enumerator> enumerators = qEnum.getEnumerators();
assertNotNull(enumerators);
assertEquals(1, enumerators.size());
@@ -137,7 +137,7 @@ public class QGadgetTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQGadget qgadget = qtIndex.findQGadget(new String[]{ "G" });
+ IQGadget qgadget = qtIndex.findQGadget(new String[] { "G" });
if (!isIndexOk("G", qgadget))
return;
assertNotNull(qgadget);
@@ -146,7 +146,7 @@ public class QGadgetTests extends BaseQtTestCase {
assertNotNull(qEnums);
assertEquals(2, qEnums.size());
- for(IQEnum qEnum : qEnums) {
+ for (IQEnum qEnum : qEnums) {
assertNotNull(qEnum);
assertTrue(qEnum.isFlag());
if ("Flag".equals(qEnum.getName())) {
@@ -154,7 +154,7 @@ public class QGadgetTests extends BaseQtTestCase {
assertNotNull(enumerators);
assertEquals(1, enumerators.size());
assertEquals("e0", enumerators.iterator().next().getName());
- } else if("Flag2".equals(qEnum.getName())) {
+ } else if ("Flag2".equals(qEnum.getName())) {
Collection<IQEnum.Enumerator> enumerators = qEnum.getEnumerators();
assertNotNull(enumerators);
assertEquals(1, enumerators.size());
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QMakeTests.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QMakeTests.java
index 1e81dd7d2b..9f8f087a09 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QMakeTests.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QMakeTests.java
@@ -70,11 +70,13 @@ public class QMakeTests extends TestCase {
}
public void testQMakeInfo() throws Exception {
- StringReader qmake1Content = new StringReader("QMAKE_VERSION:3.0\nQT_VERSION:5.2\nQT_INSTALL_IMPORTS:QtImports\nQT_INSTALL_QML:QtQmls\nQT_INSTALL_DOCS:QtDocs\nCustomKey:CustomValue\n");
+ StringReader qmake1Content = new StringReader(
+ "QMAKE_VERSION:3.0\nQT_VERSION:5.2\nQT_INSTALL_IMPORTS:QtImports\nQT_INSTALL_QML:QtQmls\nQT_INSTALL_DOCS:QtDocs\nCustomKey:CustomValue\n");
BufferedReader qmake1Reader = new BufferedReader(qmake1Content);
Map<String, String> qmake1 = QMakeParser.parse(QMakeInfo.PATTERN_QUERY_LINE, qmake1Reader);
- StringReader qmake2Content = new StringReader("QMAKE_INTERNAL_INCLUDED_FILES=Internal1 Internal2\nSOURCES=Source1 Source2\nHEADERS=Header1 Header2\nINCLUDEPATH=Include1 Include2\nDEFINES=Def1 Def2\nRESOURCES=Resource1 Resource2\nFORMS=Form1 Form2\nOTHER_FILES=Other1 Other2\nQML_IMPORT_PATH=CustomImport\n");
+ StringReader qmake2Content = new StringReader(
+ "QMAKE_INTERNAL_INCLUDED_FILES=Internal1 Internal2\nSOURCES=Source1 Source2\nHEADERS=Header1 Header2\nINCLUDEPATH=Include1 Include2\nDEFINES=Def1 Def2\nRESOURCES=Resource1 Resource2\nFORMS=Form1 Form2\nOTHER_FILES=Other1 Other2\nQML_IMPORT_PATH=CustomImport\n");
BufferedReader qmake2Reader = new BufferedReader(qmake2Content);
Map<String, String> qmake2 = QMakeParser.parse(QMakeInfo.PATTERN_EVAL_LINE, qmake2Reader);
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QObjectTests.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QObjectTests.java
index 5f66911f7c..88b021a8d9 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QObjectTests.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QObjectTests.java
@@ -43,10 +43,10 @@ public class QObjectTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj_B1 = qtIndex.findQObject(new String[]{ "B1" });
+ IQObject qobj_B1 = qtIndex.findQObject(new String[] { "B1" });
if (!isIndexOk("B1", qobj_B1))
return;
- IQObject qobj_D1 = qtIndex.findQObject(new String[]{ "D1" });
+ IQObject qobj_D1 = qtIndex.findQObject(new String[] { "D1" });
assertNotNull(qobj_B1);
assertNotNull(qobj_D1);
@@ -58,7 +58,7 @@ public class QObjectTests extends BaseQtTestCase {
assertEquals("B2", iterator.next().getName());
// D2 is not a QObject because it doesn't expand the Q_OBJECT macro
- IQObject qobj_D2 = qtIndex.findQObject(new String[]{ "D2" });
+ IQObject qobj_D2 = qtIndex.findQObject(new String[] { "D2" });
assertNull(qobj_D2);
}
@@ -86,7 +86,7 @@ public class QObjectTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "Q" });
if (!isIndexOk("Q", qobj))
return;
assertNotNull(qobj);
@@ -94,7 +94,7 @@ public class QObjectTests extends BaseQtTestCase {
Collection<IQEnum> qEnums = qobj.getEnums();
assertNotNull(qEnums);
assertEquals(3, qEnums.size());
- for(IQEnum qEnum : qEnums) {
+ for (IQEnum qEnum : qEnums) {
String name = qEnum.getName();
assertFalse(qEnum.isFlag());
if ("E0".equals(name)) {
@@ -110,7 +110,7 @@ public class QObjectTests extends BaseQtTestCase {
else
fail("unexpected " + name + "::" + enumerator.getName() + " = " + String.valueOf(ordinal));
}
- } else if("E1".equals(name)) {
+ } else if ("E1".equals(name)) {
Collection<IQEnum.Enumerator> enumerators = qEnum.getEnumerators();
assertNotNull(enumerators);
assertEquals(2, enumerators.size());
@@ -123,7 +123,7 @@ public class QObjectTests extends BaseQtTestCase {
else
fail("unexpected " + name + "::" + enumerator.getName() + " = " + String.valueOf(ordinal));
}
- } else if("Q0::EB".equals(name)) {
+ } else if ("Q0::EB".equals(name)) {
Collection<IQEnum.Enumerator> enumerators = qEnum.getEnumerators();
assertNotNull(enumerators);
assertEquals(1, enumerators.size());
@@ -160,7 +160,7 @@ public class QObjectTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "Q" });
if (!isIndexOk("Q", qobj))
return;
assertNotNull(qobj);
@@ -169,7 +169,7 @@ public class QObjectTests extends BaseQtTestCase {
assertNotNull(qEnums);
assertEquals(2, qEnums.size());
- for(IQEnum qEnum : qEnums) {
+ for (IQEnum qEnum : qEnums) {
assertNotNull(qEnum);
assertTrue(qEnum.isFlag());
if ("Flag".equals(qEnum.getName())) {
@@ -177,7 +177,7 @@ public class QObjectTests extends BaseQtTestCase {
assertNotNull(enumerators);
assertEquals(1, enumerators.size());
assertEquals("e0", enumerators.iterator().next().getName());
- } else if("Flag2".equals(qEnum.getName())) {
+ } else if ("Flag2".equals(qEnum.getName())) {
Collection<IQEnum.Enumerator> enumerators = qEnum.getEnumerators();
assertNotNull(enumerators);
assertEquals(1, enumerators.size());
@@ -187,21 +187,21 @@ public class QObjectTests extends BaseQtTestCase {
}
}
- // #include "junit-QObject.hh"
- // class B : public QObject
- // {
- // Q_OBJECT
- // Q_PROPERTY(bool allowed READ isAllowed)
- // public:
- // bool isAllowed() const { return false; }
- // };
+ // #include "junit-QObject.hh"
+ // class B : public QObject
+ // {
+ // Q_OBJECT
+ // Q_PROPERTY(bool allowed READ isAllowed)
+ // public:
+ // bool isAllowed() const { return false; }
+ // };
public void testOwner() throws Exception {
loadComment("owner.hh");
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "B" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "B" });
if (!isIndexOk("B", qobj))
return;
assertNotNull(qobj);
@@ -252,54 +252,48 @@ public class QObjectTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "Q" });
if (!isIndexOk("Q", qobj))
return;
assertNotNull(qobj);
- assert_checkQProperties(
- qobj,
- new ExpectedQProperty("bool", "prop1", Attribute.READ, "getProp"),
- new ExpectedQProperty("T<bool>", "prop2", Attribute.READ, "getProp"),
- new ExpectedQProperty("T<bool *>", "prop3", Attribute.READ, "getProp"),
- new ExpectedQProperty("bool *", "prop4", Attribute.READ, "getProp"),
- new ExpectedQProperty("bool", "prop5"),
- new ExpectedQProperty("bool *", "prop6"),
-
- new ExpectedQProperty("bool", "read1", Attribute.READ, "readMethod"),
- new ExpectedQProperty("bool", "read2", Attribute.READ ,"readMethod2", Attribute.FINAL),
-
- new ExpectedQProperty("Namespace::Type", "allowedAreas1" ),
- new ExpectedQProperty("Qt::ToolBarAreas", "allowedAreas2",
- Attribute.READ, "allowedAreas",
- Attribute.WRITE, "setAllowedAreas",
- Attribute.DESIGNABLE, "(qobject_cast<QMainWindow *>(parentWidget()) != 0)",
- Attribute.NOTIFY, "allowedAreasChanged")
- );
+ assert_checkQProperties(qobj, new ExpectedQProperty("bool", "prop1", Attribute.READ, "getProp"),
+ new ExpectedQProperty("T<bool>", "prop2", Attribute.READ, "getProp"),
+ new ExpectedQProperty("T<bool *>", "prop3", Attribute.READ, "getProp"),
+ new ExpectedQProperty("bool *", "prop4", Attribute.READ, "getProp"),
+ new ExpectedQProperty("bool", "prop5"), new ExpectedQProperty("bool *", "prop6"),
+
+ new ExpectedQProperty("bool", "read1", Attribute.READ, "readMethod"),
+ new ExpectedQProperty("bool", "read2", Attribute.READ, "readMethod2", Attribute.FINAL),
+
+ new ExpectedQProperty("Namespace::Type", "allowedAreas1"),
+ new ExpectedQProperty("Qt::ToolBarAreas", "allowedAreas2", Attribute.READ, "allowedAreas",
+ Attribute.WRITE, "setAllowedAreas", Attribute.DESIGNABLE,
+ "(qobject_cast<QMainWindow *>(parentWidget()) != 0)", Attribute.NOTIFY, "allowedAreasChanged"));
}
- // #include "junit-QObject.hh"
- // class B : public QObject
- // {
- // Q_OBJECT
- // Q_PROPERTY(bool allowed READ isAllowed)
- // public:
- // bool isAllowed() const { return false; }
- // };
- // class D1 : public B
- // {
- // Q_OBJECT
- // Q_PROPERTY(bool allowed READ isAllowed_d)
- // public:
- // bool isAllowed_d() const { return false; }
- // };
+ // #include "junit-QObject.hh"
+ // class B : public QObject
+ // {
+ // Q_OBJECT
+ // Q_PROPERTY(bool allowed READ isAllowed)
+ // public:
+ // bool isAllowed() const { return false; }
+ // };
+ // class D1 : public B
+ // {
+ // Q_OBJECT
+ // Q_PROPERTY(bool allowed READ isAllowed_d)
+ // public:
+ // bool isAllowed_d() const { return false; }
+ // };
public void testGetOverridden() throws Exception {
loadComment("getOverridden.hh");
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject base_qobj = qtIndex.findQObject(new String[]{ "B" });
+ IQObject base_qobj = qtIndex.findQObject(new String[] { "B" });
if (!isIndexOk("B", base_qobj))
return;
assertNotNull(base_qobj);
@@ -310,7 +304,7 @@ public class QObjectTests extends BaseQtTestCase {
assertEquals(1, base_qprops.locals().size());
assertEquals(1, base_qprops.withoutOverrides().size());
- IQObject derived_qobj1 = qtIndex.findQObject(new String[]{ "D1" });
+ IQObject derived_qobj1 = qtIndex.findQObject(new String[] { "D1" });
assertNotNull(derived_qobj1);
IQObject.IMembers<IQProperty> derived_qprops1 = derived_qobj1.getProperties();
assertNotNull(derived_qprops1);
@@ -319,36 +313,36 @@ public class QObjectTests extends BaseQtTestCase {
assertEquals(1, derived_qprops1.withoutOverrides().size());
}
- // #include "junit-QObject.hh"
- // class B : public QObject
- // {
- // Q_OBJECT
- // Q_CLASSINFO( "key1", "value1" )
- // Q_CLASSINFO( "key2", "value\"2" )
- // public:
- // bool isAllowed() const { return false; }
- // };
- // class D : public B
- // {
- // Q_OBJECT
- // Q_CLASSINFO( "key2", "overridden value" )
- // public:
- // bool isAllowed() const { return false; }
- // };
+ // #include "junit-QObject.hh"
+ // class B : public QObject
+ // {
+ // Q_OBJECT
+ // Q_CLASSINFO( "key1", "value1" )
+ // Q_CLASSINFO( "key2", "value\"2" )
+ // public:
+ // bool isAllowed() const { return false; }
+ // };
+ // class D : public B
+ // {
+ // Q_OBJECT
+ // Q_CLASSINFO( "key2", "overridden value" )
+ // public:
+ // bool isAllowed() const { return false; }
+ // };
public void testClassInfos() throws Exception {
loadComment("classinfos.hh");
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj_b = qtIndex.findQObject(new String[]{ "B" });
+ IQObject qobj_b = qtIndex.findQObject(new String[] { "B" });
if (!isIndexOk("B", qobj_b))
return;
assertNotNull(qobj_b);
assertEquals("value1", qobj_b.getClassInfo("key1"));
assertEquals("value\\\"2", qobj_b.getClassInfo("key2"));
- IQObject qobj_d = qtIndex.findQObject(new String[]{ "D" });
+ IQObject qobj_d = qtIndex.findQObject(new String[] { "D" });
assertNotNull(qobj_d);
assertEquals("value1", qobj_d.getClassInfo("key1")); // inherited
assertEquals("overridden value", qobj_d.getClassInfo("key2"));
@@ -358,6 +352,7 @@ public class QObjectTests extends BaseQtTestCase {
public final String type;
public final String name;
Object[] attributes;
+
public ExpectedQProperty(String type, String name, Object... attributes) {
this.type = type;
this.name = name;
@@ -369,17 +364,18 @@ public class QObjectTests extends BaseQtTestCase {
* A utility method for testing Q_PROPERTYs. The given object is checked for the list of
* values. Only the locally declared properties are checked and the list must be complete.
*/
- private static void assert_checkQProperties(IQObject qobj, ExpectedQProperty... expectedProperties) throws Exception {
+ private static void assert_checkQProperties(IQObject qobj, ExpectedQProperty... expectedProperties)
+ throws Exception {
// this map is used to make sure that all expected attributes are found
Map<String, ExpectedQProperty> qprops = new HashMap<String, QObjectTests.ExpectedQProperty>();
- for(ExpectedQProperty qprop : expectedProperties)
+ for (ExpectedQProperty qprop : expectedProperties)
if (qprops.containsKey(qprop.name))
fail("duplicate properties in expected list " + qprop.name);
else
qprops.put(qprop.name, qprop);
- for(IQProperty qprop : qobj.getProperties().locals()) {
+ for (IQProperty qprop : qobj.getProperties().locals()) {
ExpectedQProperty expected = qprops.remove(qprop.getName());
assertNotNull("unexpected or duplicate attribute " + qprop.getName(), expected);
assertEquals("unexpected type for " + expected.name, expected.type, qprop.getType());
@@ -388,17 +384,16 @@ public class QObjectTests extends BaseQtTestCase {
// make sure that all attributes that were found were expected
Set<Attribute> allAttrs = new HashSet<Attribute>(Arrays.asList(Attribute.values()));
- for(int i = 0; i < expected.attributes.length; ++i) {
- Attribute attr = (Attribute)expected.attributes[i];
+ for (int i = 0; i < expected.attributes.length; ++i) {
+ Attribute attr = (Attribute) expected.attributes[i];
// make sure the test is valid -- search for each attribute at most once
assertTrue(allAttrs.remove(attr));
if (!attr.hasValue)
assertNotNull("missing " + attr.toString(), attr.valueIn(qprop));
- else if(i >= (expected.attributes.length - 1)
- || expected.attributes[i + 1] instanceof Attribute)
- fail("INVALID TEST CASE: " + attr + " should have a value, but one was not provided" );
+ else if (i >= (expected.attributes.length - 1) || expected.attributes[i + 1] instanceof Attribute)
+ fail("INVALID TEST CASE: " + attr + " should have a value, but one was not provided");
else {
Object exp = expected.attributes[++i];
assertEquals(attr.toString(), exp, attr.valueIn(qprop));
@@ -406,13 +401,13 @@ public class QObjectTests extends BaseQtTestCase {
}
// make sure there is no value for all other attributes
- for(Attribute attr : allAttrs)
+ for (Attribute attr : allAttrs)
assertTrue("unexpectedly found value for " + attr, attr.valueIn(qprop) == null);
}
// make sure that all expected properties were found
StringBuilder missingAttrs = new StringBuilder();
- for(String propName : qprops.keySet()) {
+ for (String propName : qprops.keySet()) {
if (missingAttrs.length() > 0)
missingAttrs.append(", ");
missingAttrs.append(propName);
@@ -421,22 +416,22 @@ public class QObjectTests extends BaseQtTestCase {
}
// #include "junit-QObject.hh"
- // class Q : public QObject
- // {
- // Q_OBJECT
+ // class Q : public QObject
+ // {
+ // Q_OBJECT
// signals:
// public: void notASignal();
// Q_SIGNALS: void signal();
// public: void notAnotherSignal();
// Q_SIGNAL void anotherSignal();
- // };
+ // };
public void testSimpleSignal() throws Exception {
loadComment("simple_signal.hh");
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "Q" });
if (!isIndexOk("Q", qobj))
return;
assertNotNull(qobj);
@@ -456,12 +451,12 @@ public class QObjectTests extends BaseQtTestCase {
}
// #include "junit-QObject.hh"
- // namespace N {
+ // namespace N {
// class Q : public QObject
- // {
- // Q_OBJECT
+ // {
+ // Q_OBJECT
// Q_SIGNAL void aSignal();
- // };
+ // };
// }
public void testQObjectInNamespace() throws Exception {
loadComment("namespace_qobj.hh");
@@ -469,7 +464,7 @@ public class QObjectTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "N", "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "N", "Q" });
if (!isIndexOk("N::Q", qobj))
return;
assertNotNull(qobj);
@@ -486,7 +481,8 @@ public class QObjectTests extends BaseQtTestCase {
assertFalse(i.hasNext());
}
- private static void assert_checkQMethod(IQMethod method, IQObject expectedOwner, String expectedName, IQMethod.Kind expectedKind, Long expectedRevision) throws Exception {
+ private static void assert_checkQMethod(IQMethod method, IQObject expectedOwner, String expectedName,
+ IQMethod.Kind expectedKind, Long expectedRevision) throws Exception {
assertEquals(expectedKind, method.getKind());
assertEquals(expectedName, method.getName());
assertSame(method.getName(), expectedOwner, method.getOwner());
@@ -494,30 +490,30 @@ public class QObjectTests extends BaseQtTestCase {
}
// #include "junit-QObject.hh"
- // class Q : public QObject
- // {
- // Q_OBJECT
+ // class Q : public QObject
+ // {
+ // Q_OBJECT
//
- // // From the QML test suite -- this is not valid C++. The Qt moc generates duplicate const,
+ // // From the QML test suite -- this is not valid C++. The Qt moc generates duplicate const,
// // but our CDT-based implementation is not able to do the same. Instead we generate what
// // would be the correct C++ signature.
- // Q_INVOKABLE void someFunc(const QList<const QString const*> const &p1, QString p2 = "Hello");
- //
- // // variations on the above
- // Q_INVOKABLE void someFunc1(const QList<const QString const*> &p1, QString p2 = "Hello");
- // Q_INVOKABLE void someFunc2(QList<const QString const*> const &p1, QString p2 = "Hello");
- // Q_INVOKABLE void someFunc3(const QList<const QString *> &p1, QString p2 = "Hello");
- // Q_INVOKABLE void someFunc4(const QList<QString const*> &p1, QString p2 = "Hello");
- // Q_INVOKABLE void someFunc5(const QList<const QString *> &p1, QString p2 = "Hello") const;
- // Q_INVOKABLE void someFunc6(const QList<QString *const> &p1, QString p2 = "Hello");
- // };
+ // Q_INVOKABLE void someFunc(const QList<const QString const*> const &p1, QString p2 = "Hello");
+ //
+ // // variations on the above
+ // Q_INVOKABLE void someFunc1(const QList<const QString const*> &p1, QString p2 = "Hello");
+ // Q_INVOKABLE void someFunc2(QList<const QString const*> const &p1, QString p2 = "Hello");
+ // Q_INVOKABLE void someFunc3(const QList<const QString *> &p1, QString p2 = "Hello");
+ // Q_INVOKABLE void someFunc4(const QList<QString const*> &p1, QString p2 = "Hello");
+ // Q_INVOKABLE void someFunc5(const QList<const QString *> &p1, QString p2 = "Hello") const;
+ // Q_INVOKABLE void someFunc6(const QList<QString *const> &p1, QString p2 = "Hello");
+ // };
public void testInvokables() throws Exception {
loadComment("invokables.hh");
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "Q" });
if (!isIndexOk("Q", qobj))
return;
assertNotNull(qobj);
@@ -526,7 +522,7 @@ public class QObjectTests extends BaseQtTestCase {
assertNotNull(invokables);
assertEquals(7, invokables.locals().size());
- for(IQMethod invokable : invokables.locals()) {
+ for (IQMethod invokable : invokables.locals()) {
assertTrue(invokable.getName(), qobj == invokable.getOwner());
assertEquals(invokable.getName(), IQMethod.Kind.Invokable, invokable.getKind());
@@ -689,14 +685,14 @@ public class QObjectTests extends BaseQtTestCase {
assertNotNull(fIndex);
fIndex.acquireReadLock();
try {
- char[][] Q_signal1_qn = new char[][]{ "Q".toCharArray(), "signal1".toCharArray() };
+ char[][] Q_signal1_qn = new char[][] { "Q".toCharArray(), "signal1".toCharArray() };
IIndexBinding[] Q_signal1s = fIndex.findBindings(Q_signal1_qn, IndexFilter.CPP_DECLARED_OR_IMPLICIT, npm());
assertNotNull(Q_signal1s);
assertEquals(1, Q_signal1s.length);
IIndexBinding Q_signal1 = Q_signal1s[0];
assertNotNull(Q_signal1);
- char[][] Q_slot1_qn = new char[][]{ "Q".toCharArray(), "slot1".toCharArray() };
+ char[][] Q_slot1_qn = new char[][] { "Q".toCharArray(), "slot1".toCharArray() };
IIndexBinding[] Q_slot1s = fIndex.findBindings(Q_slot1_qn, IndexFilter.CPP_DECLARED_OR_IMPLICIT, npm());
assertNotNull(Q_slot1s);
assertEquals(1, Q_slot1s.length);
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java
index f9f95d4eb2..714ddf2958 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java
@@ -19,15 +19,15 @@ import org.eclipse.cdt.internal.qt.core.index.QtIndex;
public class QmlRegistrationTests extends BaseQtTestCase {
// #include "junit-QObject.hh"
- // class B : public QObject
- // {
- // Q_OBJECT
- // };
+ // class B : public QObject
+ // {
+ // Q_OBJECT
+ // };
//
- // class D : public B
- // {
- // Q_OBJECT
- // };
+ // class D : public B
+ // {
+ // Q_OBJECT
+ // };
//
// static void func()
// {
@@ -45,7 +45,7 @@ public class QmlRegistrationTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject b_qobj = qtIndex.findQObject(new String[]{ "B" });
+ IQObject b_qobj = qtIndex.findQObject(new String[] { "B" });
if (!isIndexOk("B", b_qobj))
return;
assertNotNull(b_qobj);
@@ -54,7 +54,7 @@ public class QmlRegistrationTests extends BaseQtTestCase {
assertNotNull(qmlRegistrations);
assertEquals(3, qmlRegistrations.size());
- for(IQmlRegistration qmlRegistration : qmlRegistrations) {
+ for (IQmlRegistration qmlRegistration : qmlRegistrations) {
IQObject qobj = qmlRegistration.getQObject();
assertNotNull(qobj);
@@ -65,13 +65,13 @@ public class QmlRegistrationTests extends BaseQtTestCase {
assertNotNull(qmlName);
if ("B".equals(qmlName)) {
assertEquals(IQmlRegistration.Kind.Type, qmlRegistration.getKind());
- assertEquals("b-uri", qmlRegistration.getURI());
+ assertEquals("b-uri", qmlRegistration.getURI());
assertEquals(Long.valueOf(1), qmlRegistration.getMajor());
assertEquals(Long.valueOf(2), qmlRegistration.getMinor());
assertNull(qmlRegistration.getReason());
} else if ("B34".equals(qmlName)) {
assertEquals(IQmlRegistration.Kind.Type, qmlRegistration.getKind());
- assertEquals("b-uri.34", qmlRegistration.getURI());
+ assertEquals("b-uri.34", qmlRegistration.getURI());
assertEquals(Long.valueOf(3), qmlRegistration.getMajor());
assertEquals(Long.valueOf(4), qmlRegistration.getMinor());
assertNull(qmlRegistration.getReason());
@@ -79,7 +79,7 @@ public class QmlRegistrationTests extends BaseQtTestCase {
fail("unexpected uri for B " + qmlName);
}
- // the values for D are not expected to be resolved (yet), but it does have a Revision
+ // the values for D are not expected to be resolved (yet), but it does have a Revision
} else if (qobj.getName().equals("D")) {
assertEquals(IQmlRegistration.Kind.Type, qmlRegistration.getKind());
assertEquals(Long.valueOf(1), qmlRegistration.getVersion());
@@ -126,15 +126,15 @@ public class QmlRegistrationTests extends BaseQtTestCase {
}
// #include "junit-QObject.hh"
- // class B : public QObject
- // {
- // Q_OBJECT
- // };
+ // class B : public QObject
+ // {
+ // Q_OBJECT
+ // };
//
- // class D : public B
- // {
- // Q_OBJECT
- // };
+ // class D : public B
+ // {
+ // Q_OBJECT
+ // };
//
// static void func()
// {
@@ -153,7 +153,7 @@ public class QmlRegistrationTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject b_qobj = qtIndex.findQObject(new String[]{ "B" });
+ IQObject b_qobj = qtIndex.findQObject(new String[] { "B" });
if (!isIndexOk("B", b_qobj))
return;
assertNotNull(b_qobj);
@@ -162,7 +162,7 @@ public class QmlRegistrationTests extends BaseQtTestCase {
assertNotNull(qmlRegistrations);
assertEquals(3, qmlRegistrations.size());
- for(IQmlRegistration qmlRegistration : qmlRegistrations) {
+ for (IQmlRegistration qmlRegistration : qmlRegistrations) {
IQObject qobj = qmlRegistration.getQObject();
assertNotNull(qobj);
@@ -173,21 +173,21 @@ public class QmlRegistrationTests extends BaseQtTestCase {
assertNotNull(qmlName);
if ("B".equals(qmlName)) {
assertEquals(IQmlRegistration.Kind.Uncreatable, qmlRegistration.getKind());
- assertEquals("b-uri", qmlRegistration.getURI());
+ assertEquals("b-uri", qmlRegistration.getURI());
assertEquals(Long.valueOf(1), qmlRegistration.getMajor());
assertEquals(Long.valueOf(2), qmlRegistration.getMinor());
- assertEquals(null/*"msg1"*/, qmlRegistration.getReason());
+ assertEquals(null/*"msg1"*/, qmlRegistration.getReason());
} else if ("B34".equals(qmlName)) {
assertEquals(IQmlRegistration.Kind.Uncreatable, qmlRegistration.getKind());
- assertEquals("b-uri.34", qmlRegistration.getURI());
+ assertEquals("b-uri.34", qmlRegistration.getURI());
assertEquals(Long.valueOf(3), qmlRegistration.getMajor());
assertEquals(Long.valueOf(4), qmlRegistration.getMinor());
- assertEquals(null/*"msg2"*/, qmlRegistration.getReason());
+ assertEquals(null/*"msg2"*/, qmlRegistration.getReason());
} else {
fail("unexpected uri for B " + qmlName);
}
- // the values for D are not expected to be resolved (yet), but it does have a Revision
+ // the values for D are not expected to be resolved (yet), but it does have a Revision
} else if (qobj.getName().equals("D")) {
assertEquals(IQmlRegistration.Kind.Uncreatable, qmlRegistration.getKind());
assertNull(qmlRegistration.getVersion());
@@ -203,15 +203,15 @@ public class QmlRegistrationTests extends BaseQtTestCase {
}
// #include "junit-QObject.hh"
- // class B : public QObject
- // {
- // Q_OBJECT
- // };
+ // class B : public QObject
+ // {
+ // Q_OBJECT
+ // };
//
- // class D : public B
- // {
- // Q_OBJECT
- // };
+ // class D : public B
+ // {
+ // Q_OBJECT
+ // };
//
// static void func()
// {
@@ -225,7 +225,7 @@ public class QmlRegistrationTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject b_qobj = qtIndex.findQObject(new String[]{ "B" });
+ IQObject b_qobj = qtIndex.findQObject(new String[] { "B" });
if (!isIndexOk("B", b_qobj))
return;
assertNotNull(b_qobj);
@@ -233,28 +233,30 @@ public class QmlRegistrationTests extends BaseQtTestCase {
Collection<IQmlRegistration> b_qmlRegistrations = b_qobj.getQmlRegistrations();
assertNotNull(b_qmlRegistrations);
assertEquals(2, b_qmlRegistrations.size());
- for(IQmlRegistration qmlRegistration : b_qmlRegistrations)
+ for (IQmlRegistration qmlRegistration : b_qmlRegistrations)
if ("B".equals(qmlRegistration.getQmlName()))
assert_checkQmlRegistration(qmlRegistration, IQmlRegistration.Kind.Type, null, "b-uri", 1L, 2L, null);
- else if("B34".equals(qmlRegistration.getQmlName()))
- assert_checkQmlRegistration(qmlRegistration, IQmlRegistration.Kind.Type, null, "b-uri.34", 3L, 4L, null);
+ else if ("B34".equals(qmlRegistration.getQmlName()))
+ assert_checkQmlRegistration(qmlRegistration, IQmlRegistration.Kind.Type, null, "b-uri.34", 3L, 4L,
+ null);
else
fail("unexpected QmlRegistration with qmlName '" + qmlRegistration.getQmlName() + '\'');
- IQObject d_qobj = qtIndex.findQObject(new String[]{ "D" });
+ IQObject d_qobj = qtIndex.findQObject(new String[] { "D" });
assertNotNull(d_qobj);
Collection<IQmlRegistration> d_qmlRegistrations = d_qobj.getQmlRegistrations();
assertNotNull(d_qmlRegistrations);
assertEquals(1, d_qmlRegistrations.size());
- for(IQmlRegistration qmlRegistration : d_qmlRegistrations)
- if("D".equals(qmlRegistration.getQmlName()))
+ for (IQmlRegistration qmlRegistration : d_qmlRegistrations)
+ if ("D".equals(qmlRegistration.getQmlName()))
assert_checkQmlRegistration(qmlRegistration, IQmlRegistration.Kind.Type, 1L, "d-uri", 2L, 3L, null);
else
fail("unexpected QmlRegistration with qmlName '" + qmlRegistration.getQmlName() + '\'');
}
- private static void assert_checkQmlRegistration(IQmlRegistration qmlRegistration, IQmlRegistration.Kind eKind, Long eVersion, String eUri, Long eMaj, Long eMin, String reason) throws Exception {
+ private static void assert_checkQmlRegistration(IQmlRegistration qmlRegistration, IQmlRegistration.Kind eKind,
+ Long eVersion, String eUri, Long eMaj, Long eMin, String reason) throws Exception {
assertNotNull(qmlRegistration);
assertEquals(eKind, qmlRegistration.getKind());
assertEquals(eVersion, qmlRegistration.getVersion());
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtContentAssistantTests.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtContentAssistantTests.java
index 543408ed83..dca8a473c7 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtContentAssistantTests.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtContentAssistantTests.java
@@ -102,13 +102,13 @@ public class QtContentAssistantTests extends TestCase {
QPropertyExpansion inWRITE_e = QPropertyExpansion.create(new Context(doc, len - 4));
assertNotNull(inWRITE_e);
- assertEquals("WRIT", inWRITE_e.getPrefix());
+ assertEquals("WRIT", inWRITE_e.getPrefix());
assertEquals("WRITE", inWRITE_e.getCurrIdentifier());
assertEquals("accessor", inWRITE_e.getPrevIdentifier());
QPropertyExpansion inWRITE_b = QPropertyExpansion.create(new Context(doc, len - 6));
assertNotNull(inWRITE_b);
- assertEquals("WR", inWRITE_b.getPrefix());
+ assertEquals("WR", inWRITE_b.getPrefix());
assertEquals("WRITE", inWRITE_b.getCurrIdentifier());
assertEquals("accessor", inWRITE_b.getPrevIdentifier());
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java
index a0867caa6f..6dce1c2dda 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java
@@ -39,13 +39,13 @@ public class QtIndexTests extends BaseQtTestCase {
assertNotNull(qtIndex);
// make sure the instance can be found
- IQObject qobj1 = qtIndex.findQObject(new String[]{ "B" });
+ IQObject qobj1 = qtIndex.findQObject(new String[] { "B" });
assertNotNull(qobj1);
assertEquals("B", qobj1.getName());
// make sure the instance is still found after the content changes
changeBDecl();
- IQObject qobj2 = qtIndex.findQObject(new String[]{ "B" });
+ IQObject qobj2 = qtIndex.findQObject(new String[] { "B" });
assertNotNull(qobj2);
assertEquals("B", qobj2.getName());
}
diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtRegressionTests.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtRegressionTests.java
index f642186334..729ed46442 100644
--- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtRegressionTests.java
+++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/tests/QtRegressionTests.java
@@ -42,7 +42,7 @@ public class QtRegressionTests extends BaseQtTestCase {
private static Map<String, Set<String>> buildExpectedMap(String mocOutput) {
Map<String, Set<String>> expected = new HashMap<String, Set<String>>();
- for(String moc_signature : mocOutput.split("\0")) {
+ for (String moc_signature : mocOutput.split("\0")) {
String name = moc_signature.split("\\(")[0];
Set<String> set = expected.get(name);
if (set == null) {
@@ -74,7 +74,7 @@ public class QtRegressionTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "Q" });
if (!isIndexOk("Q", qobj))
return;
assertNotNull(qobj);
@@ -83,19 +83,18 @@ public class QtRegressionTests extends BaseQtTestCase {
// moc generates two signatures, sig(N::TS::M) and sig(), we just mark optional parameters
// with a trailing =. However, QMethod#getSignature is currently modified to strip the
// default value indication. So, we're only dealing with the full signature here.
- String moc = "sig_int(int)\0sig_int()\0sig_const_int(int)\0"
- + "sig_const_int()\0sig_T(T*)\0sig_T()\0"
- + "sig_const_T(T*const)\0sig_const_T()\0";
+ String moc = "sig_int(int)\0sig_int()\0sig_const_int(int)\0" + "sig_const_int()\0sig_T(T*)\0sig_T()\0"
+ + "sig_const_T(T*const)\0sig_const_T()\0";
Map<String, Set<String>> expected = buildExpectedMap(moc);
IQObject.IMembers<IQMethod> sigs = qobj.getSignals();
assertNotNull(sigs);
Collection<IQMethod> locals = sigs.locals();
assertNotNull(locals);
- for(IQMethod method : locals) {
+ for (IQMethod method : locals) {
Set<String> set = expected.get(method.getName());
assertNotNull("unexpected method " + method.getName() + " (" + method.getSignatures() + ')', set);
- for(String signature : method.getSignatures()) {
+ for (String signature : method.getSignatures()) {
assertTrue(set.remove(signature));
}
assertTrue("did not find all signatures for " + method.getName(), set.isEmpty());
@@ -124,8 +123,8 @@ public class QtRegressionTests extends BaseQtTestCase {
// }
// typedef N::E N_E;
// namespace N2 { typedef N::Ib Ic; }
- // class Q : public QObject
- // {
+ // class Q : public QObject
+ // {
// Q_OBJECT
// public:
// void func();
@@ -187,42 +186,28 @@ public class QtRegressionTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "Q" });
if (!isIndexOk("Q", qobj))
return;
assertNotNull(qobj);
// Copy and pasted moc output (signals only) to make sure we're getting an exact match.
- String moc_output
- = "sig_int(int)\0"
- + "sig_Tl1(Tl1)\0sig_Tl2(Tl2)\0sig_int_ptr(int*)\0"
- + "sig_Tl1_ptr(Tl1*)\0sig_Tl2_ptr(Tl2*)\0"
- + "sig_qual1(N::E)\0sig_qual2(N::N2::E2)\0"
- + "sig_typedef1(N_E)\0sig_typedef2(N::TEa)\0"
- + "sig_typedef3(N::TEb)\0sig_typedef4(N::N2_E2)\0"
- + "sig_typedef5(N::N2_TE2)\0"
- + "sig_typedef6(N::N2::TE2)\0sig_nested1(S::Mb)\0"
- + "sig_nested2(N::TS::M)\0sig_nested3(N::Ib)\0"
- + "sig_nested4(N::Eb)\0sig_nested5(N2::Ic)\0"
-
- + "sig_S(S)\0const_S(S)\0S_const(S)\0S_ref(S&)\0"
- + "const_S_ref(S)\0S_const_ref(S)\0S_ptr(S*)\0"
- + "S_ptr_const(S*const)\0const_S_ptr(const S*)\0"
- + "const_S_ptr_const(S*const)\0const_S_ptr_const_def(S*const)\0"
- + "const_S_ptr_const_def()\0S_ptr_ref(S*&)\0"
- + "S_ptr_const_ref(S*)\0const_S_ptr_const_ref(S*const)\0"
- + "S_ptr_ptr(S**)\0S_ptr_const_ptr(S*const*)\0"
- + "const_S_ptr_ptr(const S**)\0"
- + "const_S_ptr_const_ptr(const S*const*)\0"
- + "S_ptr_ptr_const(S**const)\0"
- + "S_ptr_const_ptr_const(S*const*const)\0"
- + "const_S_ptr_ptr_const(S**const)\0"
- + "const_S_ptr_const_ptr_const(S*const*const)\0"
- + "S_template_1(S_TEMPLATE<const S*>)\0"
- + "S_template_2(S_TEMPLATE<const S*>)\0"
- + "S_template_3(S_TEMPLATE<const S*>)\0"
- + "S_template_4(S_TEMPLATE<const S*>)\0"
- + "S_template_X(S_TEMPLATE<const S*>)";
+ String moc_output = "sig_int(int)\0" + "sig_Tl1(Tl1)\0sig_Tl2(Tl2)\0sig_int_ptr(int*)\0"
+ + "sig_Tl1_ptr(Tl1*)\0sig_Tl2_ptr(Tl2*)\0" + "sig_qual1(N::E)\0sig_qual2(N::N2::E2)\0"
+ + "sig_typedef1(N_E)\0sig_typedef2(N::TEa)\0" + "sig_typedef3(N::TEb)\0sig_typedef4(N::N2_E2)\0"
+ + "sig_typedef5(N::N2_TE2)\0" + "sig_typedef6(N::N2::TE2)\0sig_nested1(S::Mb)\0"
+ + "sig_nested2(N::TS::M)\0sig_nested3(N::Ib)\0" + "sig_nested4(N::Eb)\0sig_nested5(N2::Ic)\0"
+
+ + "sig_S(S)\0const_S(S)\0S_const(S)\0S_ref(S&)\0" + "const_S_ref(S)\0S_const_ref(S)\0S_ptr(S*)\0"
+ + "S_ptr_const(S*const)\0const_S_ptr(const S*)\0"
+ + "const_S_ptr_const(S*const)\0const_S_ptr_const_def(S*const)\0"
+ + "const_S_ptr_const_def()\0S_ptr_ref(S*&)\0" + "S_ptr_const_ref(S*)\0const_S_ptr_const_ref(S*const)\0"
+ + "S_ptr_ptr(S**)\0S_ptr_const_ptr(S*const*)\0" + "const_S_ptr_ptr(const S**)\0"
+ + "const_S_ptr_const_ptr(const S*const*)\0" + "S_ptr_ptr_const(S**const)\0"
+ + "S_ptr_const_ptr_const(S*const*const)\0" + "const_S_ptr_ptr_const(S**const)\0"
+ + "const_S_ptr_const_ptr_const(S*const*const)\0" + "S_template_1(S_TEMPLATE<const S*>)\0"
+ + "S_template_2(S_TEMPLATE<const S*>)\0" + "S_template_3(S_TEMPLATE<const S*>)\0"
+ + "S_template_4(S_TEMPLATE<const S*>)\0" + "S_template_X(S_TEMPLATE<const S*>)";
Map<String, Set<String>> expected = buildExpectedMap(moc_output);
@@ -230,10 +215,10 @@ public class QtRegressionTests extends BaseQtTestCase {
assertNotNull(sigs);
Collection<IQMethod> locals = sigs.locals();
assertNotNull(locals);
- for(IQMethod method : locals) {
+ for (IQMethod method : locals) {
Set<String> set = expected.get(method.getName());
assertNotNull("unexpected signal " + method.getName() + " (" + method.getSignatures() + ')', set);
- for(String signature : method.getSignatures())
+ for (String signature : method.getSignatures())
assertTrue(set.remove(signature));
assertTrue("did not find all signatures for " + method.getName(), set.isEmpty());
expected.remove(method.getName());
@@ -242,8 +227,8 @@ public class QtRegressionTests extends BaseQtTestCase {
}
// #include "junit-QObject.hh"
- // class Q : public QObject
- // {
+ // class Q : public QObject
+ // {
// Q_OBJECT
// Q_SLOT void const_ref(const QString &);
// Q_SLOT void const_val(const QString );
@@ -260,14 +245,14 @@ public class QtRegressionTests extends BaseQtTestCase {
// connect(this, SIGNAL(signalEnum_const_ref(E), this, SLOT(reference(QString&))));
// connect(this, SIGNAL(signalEnum_reference(E&), this, SLOT(value(QString))));
// }
- // };
+ // };
public void testBug344931() throws Exception {
loadComment("bug344931.hh");
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "Q" });
if (!isIndexOk("Q", qobj))
return;
assertNotNull(qobj);
@@ -279,7 +264,7 @@ public class QtRegressionTests extends BaseQtTestCase {
assertNotNull(slots);
assertEquals(4, slots.size());
- for(IQMethod slot : slots) {
+ for (IQMethod slot : slots) {
if ("const_ref".equals(slot.getName()))
assertTrue(slot.getSignatures().contains("const_ref(QString)"));
else if ("const_val".equals(slot.getName()))
@@ -299,7 +284,7 @@ public class QtRegressionTests extends BaseQtTestCase {
assertNotNull(signals);
assertEquals(3, signals.size());
- for(IQMethod signal : signals) {
+ for (IQMethod signal : signals) {
if ("signalEnum_const_ref".equals(signal.getName()))
assertTrue(signal.getSignatures().contains("signalEnum_const_ref(E)"));
else if ("signalEnum_reference".equals(signal.getName()))
@@ -337,7 +322,7 @@ public class QtRegressionTests extends BaseQtTestCase {
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
- IQObject qobj = qtIndex.findQObject(new String[]{ "Q" });
+ IQObject qobj = qtIndex.findQObject(new String[] { "Q" });
if (!isIndexOk("Q", qobj))
return;
assertNotNull(qobj);
@@ -350,7 +335,7 @@ public class QtRegressionTests extends BaseQtTestCase {
// make sure that the three slot functions are found, but none of the inherited or
// non-slot functions
Set<String> expected = new HashSet<String>(Arrays.asList("slot1", "slot2", "slot3"));
- for(IQMethod method : localSlots)
+ for (IQMethod method : localSlots)
assertTrue("unexpected slot " + method.getName(), expected.remove(method.getName()));
assertEquals("missing slots " + expected.toString(), 0, expected.size());
}
@@ -396,7 +381,8 @@ public class QtRegressionTests extends BaseQtTestCase {
assertTrue(sel instanceof ITextSelection);
// Now a query is created and executed.
- CSearchTextSelectionQuery query = new CSearchTextSelectionQuery(null, ceditor.getInputCElement(), (ITextSelection) sel, IIndex.FIND_REFERENCES);
+ CSearchTextSelectionQuery query = new CSearchTextSelectionQuery(null, ceditor.getInputCElement(),
+ (ITextSelection) sel, IIndex.FIND_REFERENCES);
// The query sometimes fails (with Status.CANCEL_STATUS) if the TU is not open. I
// haven't found a way to be notified when the TU gets "opened" -- the test case just
@@ -408,7 +394,7 @@ public class QtRegressionTests extends BaseQtTestCase {
if (status == Status.CANCEL_STATUS) {
Thread.sleep(100);
}
- } while(!status.isOK() && System.currentTimeMillis() < end_ms);
+ } while (!status.isOK() && System.currentTimeMillis() < end_ms);
assertTrue("query failed: " + status.getMessage(), status.isOK());
// The query should have found two references, one for the function call and another
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectConnectCompletion.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectConnectCompletion.java
index 20583933bc..a2f29cc018 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectConnectCompletion.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectConnectCompletion.java
@@ -45,10 +45,10 @@ public class QObjectConnectCompletion {
// Secondly, these suggestions should appear above generic variable and method matches, since
// have based the calculation on the exact function that is being called.
- private static final int MACRO_RELEVANCE
- = RelevanceConstants.CASE_MATCH_RELEVANCE + RelevanceConstants.LOCAL_VARIABLE_TYPE_RELEVANCE + 2;
- private static final int MACRO_PARAM_RELEVANCE
- = RelevanceConstants.CASE_MATCH_RELEVANCE + RelevanceConstants.METHOD_TYPE_RELEVANCE + 1;
+ private static final int MACRO_RELEVANCE = RelevanceConstants.CASE_MATCH_RELEVANCE
+ + RelevanceConstants.LOCAL_VARIABLE_TYPE_RELEVANCE + 2;
+ private static final int MACRO_PARAM_RELEVANCE = RelevanceConstants.CASE_MATCH_RELEVANCE
+ + RelevanceConstants.METHOD_TYPE_RELEVANCE + 1;
/**
* Different suggestions should be proposed for each parameter of the QObject::connect
@@ -56,9 +56,7 @@ public class QObjectConnectCompletion {
* either SLOT or SIGNAL.
*/
public enum Param {
- Signal,
- Member,
- Generic
+ Signal, Member, Generic
}
private final Param param;
@@ -78,8 +76,7 @@ public class QObjectConnectCompletion {
* The data used to produce the completions varies depending on the role of the
* parameter that is being completed.
*/
- private static class Data
- {
+ private static class Data {
public final String replacement;
public final String display;
public final int cursorOffset;
@@ -100,14 +97,15 @@ public class QObjectConnectCompletion {
public ICompletionProposal createProposal(ICEditorContentAssistInvocationContext context, int relevance) {
int repLength = replacement.length();
int repOffset = context.getInvocationOffset();
- CCompletionProposal p
- = new CCompletionProposal(replacement, repOffset, repLength, Activator.getQtLogo(), display, relevance, context.getViewer());
+ CCompletionProposal p = new CCompletionProposal(replacement, repOffset, repLength, Activator.getQtLogo(),
+ display, relevance, context.getViewer());
p.setCursorPosition(repLength + cursorOffset);
return p;
}
}
- private static void addProposal(Collection<ICompletionProposal> proposals, ICEditorContentAssistInvocationContext context, Data data, int relevance) {
+ private static void addProposal(Collection<ICompletionProposal> proposals,
+ ICEditorContentAssistInvocationContext context, Data data, int relevance) {
if (data == null)
return;
@@ -116,17 +114,18 @@ public class QObjectConnectCompletion {
proposals.add(proposal);
}
- private void addProposals(Collection<ICompletionProposal> proposals, ICEditorContentAssistInvocationContext context) {
+ private void addProposals(Collection<ICompletionProposal> proposals,
+ ICEditorContentAssistInvocationContext context) {
if (data != null)
addProposal(proposals, context, data, MACRO_PARAM_RELEVANCE);
else
- switch(param) {
+ switch (param) {
case Signal:
addProposal(proposals, context, Data.SIGNAL, MACRO_RELEVANCE);
break;
case Member:
- addProposal(proposals, context, Data.SLOT, MACRO_RELEVANCE);
+ addProposal(proposals, context, Data.SLOT, MACRO_RELEVANCE);
addProposal(proposals, context, Data.SIGNAL, MACRO_RELEVANCE - 1);
break;
default:
@@ -200,7 +199,7 @@ public class QObjectConnectCompletion {
IQObject qobj = null;
try {
qobj = qtIndex.findQObject(cls.getQualifiedName());
- } catch(DOMException e) {
+ } catch (DOMException e) {
CCorePlugin.log(e);
}
@@ -211,18 +210,19 @@ public class QObjectConnectCompletion {
Collection<QObjectConnectCompletion> completions = new ArrayList<QObjectConnectCompletion>();
String raw = arg.getRawSignature();
if (raw.startsWith(QtKeywords.SIGNAL))
- for(IQMethod method : qobj.getSignals().withoutOverrides())
- for(String signature : method.getSignatures())
+ for (IQMethod method : qobj.getSignals().withoutOverrides())
+ for (String signature : method.getSignatures())
completions.add(new QObjectConnectCompletion(signature));
if (raw.startsWith(QtKeywords.SLOT))
- for(IQMethod method : qobj.getSlots().withoutOverrides())
- for(String signature : method.getSignatures())
+ for (IQMethod method : qobj.getSlots().withoutOverrides())
+ for (String signature : method.getSignatures())
completions.add(new QObjectConnectCompletion(signature));
return completions;
}
public static Collection<QObjectConnectCompletion> getConnectProposals(
- ICEditorContentAssistInvocationContext context, IASTName name, IASTCompletionContext astContext, IASTNode astNode) {
+ ICEditorContentAssistInvocationContext context, IASTName name, IASTCompletionContext astContext,
+ IASTNode astNode) {
if (QtFunctionCallUtil.isQObjectFunctionCall(astContext, !context.isContextInformationStyle(), name)) {
int parseOffset = context.getParseOffset();
@@ -280,8 +280,7 @@ public class QObjectConnectCompletion {
// In a content assist context the argument that is currently being entered is
// last in the function call.
IASTInitializerClause[] args = call.getArguments();
- if (args == null
- || args.length < 0)
+ if (args == null || args.length < 0)
return null;
int argIndex = args.length - 1;
@@ -298,12 +297,11 @@ public class QObjectConnectCompletion {
return null;
}
- public static Collection<ICompletionProposal> getProposals(
- ICEditorContentAssistInvocationContext context, IASTName name, IASTCompletionContext astContext, IASTNode astNode) {
+ public static Collection<ICompletionProposal> getProposals(ICEditorContentAssistInvocationContext context,
+ IASTName name, IASTCompletionContext astContext, IASTNode astNode) {
Collection<QObjectConnectCompletion> qtProposals = getConnectProposals(context, name, astContext, astNode);
- if (qtProposals == null
- || qtProposals.isEmpty())
+ if (qtProposals == null || qtProposals.isEmpty())
return null;
Collection<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectDeclarationCompletion.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectDeclarationCompletion.java
index 1f30732831..f9d8f6e93f 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectDeclarationCompletion.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QObjectDeclarationCompletion.java
@@ -40,11 +40,11 @@ public class QObjectDeclarationCompletion {
context.setId(CContextType.ID);
}
- public static Collection<ICompletionProposal> getProposals(ICEditorContentAssistInvocationContext ctx, IASTName name) {
+ public static Collection<ICompletionProposal> getProposals(ICEditorContentAssistInvocationContext ctx,
+ IASTName name) {
String token = name.getLastName().toString();
- if (token.isEmpty()
- || !"class".startsWith(token))
+ if (token.isEmpty() || !"class".startsWith(token))
return null;
Position position = getPosition(ctx);
@@ -54,8 +54,9 @@ public class QObjectDeclarationCompletion {
TranslationUnitContext tuCtx = context.createContext(ctx.getDocument(), position, ctx.getTranslationUnit());
IRegion region = new Region(position.getOffset(), position.getLength());
- Template template = new Template( "class", "QObject declaration", CContextType.ID, TEMPLATE, true);
- return Collections.<ICompletionProposal>singletonList(new CTemplateProposal(template, tuCtx, region, Activator.getQtLogo()));
+ Template template = new Template("class", "QObject declaration", CContextType.ID, TEMPLATE, true);
+ return Collections.<ICompletionProposal>singletonList(
+ new CTemplateProposal(template, tuCtx, region, Activator.getQtLogo()));
}
private static Position getPosition(ICEditorContentAssistInvocationContext context) {
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QPropertyCompletion.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QPropertyCompletion.java
index 22a7f6bf9c..d32bb50e35 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QPropertyCompletion.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QPropertyCompletion.java
@@ -32,22 +32,21 @@ public class QPropertyCompletion {
private static final String CONTEXT_ID = Activator.PLUGIN_ID + ".proposal.Q_PROPERTY";
- 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,
+ "Q_PROPERTY( ${type} ${name} READ ${accessor} ${cursor} )", true);
- public static Collection<ICompletionProposal> getAttributeProposals(ICEditorContentAssistInvocationContext context) {
+ public static Collection<ICompletionProposal> getAttributeProposals(
+ ICEditorContentAssistInvocationContext context) {
QPropertyExpansion expansion = QPropertyExpansion.create(context);
- return expansion == null
- ? Collections.<ICompletionProposal>emptyList()
- : expansion.getProposals(CONTEXT_ID, context);
+ return expansion == null ? Collections.<ICompletionProposal>emptyList()
+ : expansion.getProposals(CONTEXT_ID, context);
}
- public static Collection<ICompletionProposal> getProposals(
- ICEditorContentAssistInvocationContext context, IASTName name, IASTCompletionContext astContext, IASTNode astNode) {
+ public static Collection<ICompletionProposal> getProposals(ICEditorContentAssistInvocationContext context,
+ IASTName name, IASTCompletionContext astContext, IASTNode astNode) {
String token = name.getLastName().toString();
- if (token.isEmpty()
- || !QtKeywords.Q_PROPERTY.startsWith(token))
+ if (token.isEmpty() || !QtKeywords.Q_PROPERTY.startsWith(token))
return Collections.emptyList();
TemplateContextType ctxType = new CContextType();
@@ -56,6 +55,7 @@ public class QPropertyCompletion {
QtProposalContext templateCtx = new QtProposalContext(context, ctxType);
Region region = new Region(templateCtx.getCompletionOffset(), templateCtx.getCompletionLength());
- return Collections.<ICompletionProposal>singletonList(new QtTemplateProposal(QPropertyTemplate, templateCtx, region));
+ return Collections
+ .<ICompletionProposal>singletonList(new QtTemplateProposal(QPropertyTemplate, templateCtx, region));
}
}
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtCompletionProposalComputer.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtCompletionProposalComputer.java
index 6f622b596e..713329a7d5 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtCompletionProposalComputer.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtCompletionProposalComputer.java
@@ -35,8 +35,8 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
public class QtCompletionProposalComputer extends ParsingBasedProposalComputer {
@Override
- public List<ICompletionProposal> computeCompletionProposals(
- ContentAssistInvocationContext context, IProgressMonitor monitor) {
+ public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context,
+ IProgressMonitor monitor) {
// this is overridden in order to find proposals when the completion node is null
try {
if (context instanceof CContentAssistInvocationContext) {
@@ -73,12 +73,12 @@ public class QtCompletionProposalComputer extends ParsingBasedProposalComputer {
if (project == null)
return false;
- return QtNature.hasNature(project);
- }
+ return QtNature.hasNature(project);
+ }
@Override
- protected List<ICompletionProposal> computeCompletionProposals(
- CContentAssistInvocationContext context, IASTCompletionNode completionNode, String prefix) throws CoreException {
+ protected List<ICompletionProposal> computeCompletionProposals(CContentAssistInvocationContext context,
+ IASTCompletionNode completionNode, String prefix) throws CoreException {
// make sure this is a Qt project
if (!isApplicable(context))
@@ -98,7 +98,8 @@ public class QtCompletionProposalComputer extends ParsingBasedProposalComputer {
continue;
IASTNode astNode = (IASTNode) astContext;
- proposals = addAll(proposals, QObjectConnectCompletion.getProposals(context, name, astContext, astNode));
+ proposals = addAll(proposals,
+ QObjectConnectCompletion.getProposals(context, name, astContext, astNode));
proposals = addAll(proposals, QObjectDeclarationCompletion.getProposals(context, name));
proposals = addAll(proposals, QPropertyCompletion.getProposals(context, name, astContext, astNode));
}
@@ -111,8 +112,7 @@ public class QtCompletionProposalComputer extends ParsingBasedProposalComputer {
}
private static <T> List<T> addAll(List<T> list, Collection<T> toAdd) {
- if (toAdd == null
- || toAdd.isEmpty())
+ if (toAdd == null || toAdd.isEmpty())
return list;
if (list == null)
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtHighlighting.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtHighlighting.java
index b2f2a40fdd..8d14b787fb 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtHighlighting.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/QtHighlighting.java
@@ -19,23 +19,19 @@ import org.eclipse.cdt.internal.qt.core.QtKeywords;
import org.eclipse.cdt.ui.text.ISemanticHighlighter;
import org.eclipse.cdt.ui.text.ISemanticToken;
-public class QtHighlighting implements ISemanticHighlighter
-{
- @Override
- public boolean consumes( ISemanticToken token )
- {
- IBinding binding = token.getBinding();
- if( binding instanceof IMacroBinding )
- {
- IASTNode node = token.getNode();
- if( node instanceof IASTName && ( (IASTName)node ).isReference() )
- {
- String n = binding.getName();
- return QtKeywords.SIGNALS.equals( n ) || QtKeywords.SLOTS.equals( n )
- || QtKeywords.Q_SIGNALS.equals( n ) || QtKeywords.Q_SLOTS.equals( n );
- }
- }
+public class QtHighlighting implements ISemanticHighlighter {
+ @Override
+ public boolean consumes(ISemanticToken token) {
+ IBinding binding = token.getBinding();
+ if (binding instanceof IMacroBinding) {
+ IASTNode node = token.getNode();
+ if (node instanceof IASTName && ((IASTName) node).isReference()) {
+ String n = binding.getName();
+ return QtKeywords.SIGNALS.equals(n) || QtKeywords.SLOTS.equals(n) || QtKeywords.Q_SIGNALS.equals(n)
+ || QtKeywords.Q_SLOTS.equals(n);
+ }
+ }
- return false;
- }
+ return false;
+ }
}
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyAttributeProposal.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyAttributeProposal.java
index 0784825122..8767bee2eb 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyAttributeProposal.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyAttributeProposal.java
@@ -66,8 +66,9 @@ public class QPropertyAttributeProposal {
public ICompletionProposal createProposal(String prefix, int offset) {
int prefixLen = prefix == null ? 0 : prefix.length();
- String disp = identifier.equals(display) ? display : ( identifier + " - " + display );
- return new CCompletionProposal(identifier.substring(prefixLen), offset, prefixLen, Activator.getQtLogo(), disp, relevance);
+ String disp = identifier.equals(display) ? display : (identifier + " - " + display);
+ return new CCompletionProposal(identifier.substring(prefixLen), offset, prefixLen, Activator.getQtLogo(), disp,
+ relevance);
}
private QPropertyAttributeProposal(String identifier, String display, int relevance) {
@@ -80,15 +81,15 @@ public class QPropertyAttributeProposal {
return identifier;
}
- public static Collection<QPropertyAttributeProposal> buildProposals(IQProperty.Attribute attr, ICEditorContentAssistInvocationContext context, IType type, String name) {
- switch(attr) {
+ public static Collection<QPropertyAttributeProposal> buildProposals(IQProperty.Attribute attr,
+ ICEditorContentAssistInvocationContext context, IType type, String name) {
+ switch (attr) {
// propose true/false for bool Attributes
case DESIGNABLE:
case SCRIPTABLE:
case STORED:
case USER:
- return Arrays.asList(
- new QPropertyAttributeProposal("true", IMethodAttribute.BaseRelevance + 11),
+ return Arrays.asList(new QPropertyAttributeProposal("true", IMethodAttribute.BaseRelevance + 11),
new QPropertyAttributeProposal("false", IMethodAttribute.BaseRelevance + 10));
// propose appropriate methods for method-based attributes
@@ -108,7 +109,8 @@ public class QPropertyAttributeProposal {
return Collections.emptyList();
}
- private static Collection<QPropertyAttributeProposal> getMethodProposals(ICEditorContentAssistInvocationContext context, IMethodAttribute methodAttribute) {
+ private static Collection<QPropertyAttributeProposal> getMethodProposals(
+ ICEditorContentAssistInvocationContext context, IMethodAttribute methodAttribute) {
ICPPClassType cls = getEnclosingClassDefinition(context);
if (cls == null)
@@ -117,7 +119,7 @@ public class QPropertyAttributeProposal {
// Return all the methods, including inherited and non-visible ones.
ICPPMethod[] methods = cls.getMethods();
List<ICPPMethod> filtered = new ArrayList<ICPPMethod>(methods.length);
- for(ICPPMethod method : methods)
+ for (ICPPMethod method : methods)
if (methodAttribute.keep(method))
filtered.add(method);
@@ -125,13 +127,15 @@ public class QPropertyAttributeProposal {
// parameters with default values.
List<QPropertyAttributeProposal> proposals = new ArrayList<QPropertyAttributeProposal>();
- for(ICPPMethod method : getMethods(context, methodAttribute))
- proposals.add(new QPropertyAttributeProposal(method.getName(), getDisplay(cls, method), methodAttribute.getRelevance(method)));
+ for (ICPPMethod method : getMethods(context, methodAttribute))
+ proposals.add(new QPropertyAttributeProposal(method.getName(), getDisplay(cls, method),
+ methodAttribute.getRelevance(method)));
return proposals;
}
- private static Collection<QPropertyAttributeProposal> getSignalProposals(ICEditorContentAssistInvocationContext context, IMethodAttribute methodAttribute) {
+ private static Collection<QPropertyAttributeProposal> getSignalProposals(
+ ICEditorContentAssistInvocationContext context, IMethodAttribute methodAttribute) {
ICPPClassType cls = getEnclosingClassDefinition(context);
if (cls == null)
return Collections.emptyList();
@@ -147,7 +151,7 @@ public class QPropertyAttributeProposal {
IQObject qobj = null;
try {
qobj = qtIndex.findQObject(cls.getQualifiedName());
- } catch(DOMException e) {
+ } catch (DOMException e) {
Activator.log(e);
}
@@ -155,7 +159,7 @@ public class QPropertyAttributeProposal {
return Collections.emptyList();
List<QPropertyAttributeProposal> proposals = new ArrayList<QPropertyAttributeProposal>();
- for(IQMethod qMethod : qobj.getSignals().all())
+ for (IQMethod qMethod : qobj.getSignals().all())
proposals.add(new QPropertyAttributeProposal(qMethod.getName(), IMethodAttribute.BaseRelevance));
return proposals;
@@ -176,11 +180,11 @@ public class QPropertyAttributeProposal {
if (qn1.length != qn2.length)
return false;
- for(int i = 0; i < qn1.length; ++i)
+ for (int i = 0; i < qn1.length; ++i)
if (!qn1[i].equals(qn2[i]))
return false;
return true;
- } catch(DOMException e) {
+ } catch (DOMException e) {
return false;
}
}
@@ -201,7 +205,7 @@ public class QPropertyAttributeProposal {
sig.append(method.getName());
sig.append('(');
boolean first = true;
- for(ICPPParameter param : method.getParameters()) {
+ for (ICPPParameter param : method.getParameters()) {
if (first)
first = false;
else
@@ -227,6 +231,7 @@ public class QPropertyAttributeProposal {
public boolean keep(ICPPMethod method);
public static final int BaseRelevance = 2000;
+
public int getRelevance(ICPPMethod method);
public static final IMethodAttribute Null = new IMethodAttribute() {
@@ -243,7 +248,7 @@ public class QPropertyAttributeProposal {
}
private static IMethodAttribute get(IQProperty.Attribute attr, IType type, String propertyName) {
- switch(attr) {
+ switch (attr) {
case READ:
return new Read(type, propertyName);
case WRITE:
@@ -272,8 +277,7 @@ public class QPropertyAttributeProposal {
@Override
public boolean keep(ICPPMethod method) {
// READ must have no params without default values
- if (method.getParameters().length > 0
- && !method.getParameters()[0].hasDefaultValue())
+ if (method.getParameters().length > 0 && !method.getParameters()[0].hasDefaultValue())
return false;
// Make sure the return type of the method can be assigned to the property's type.
@@ -331,8 +335,7 @@ public class QPropertyAttributeProposal {
// WRITE must have at least one parameter and no more than one param without default values
if (method.getParameters().length < 1
- || (method.getParameters().length > 1
- && !method.getParameters()[1].hasDefaultValue()))
+ || (method.getParameters().length > 1 && !method.getParameters()[1].hasDefaultValue()))
return false;
// Make sure the property's type can be assigned to the type of the first parameter
@@ -388,8 +391,7 @@ public class QPropertyAttributeProposal {
// RESET must have void return type
IType retType = method.getType().getReturnType();
- if (!(retType instanceof IBasicType)
- || ((IBasicType) retType).getKind() != IBasicType.Kind.eVoid)
+ if (!(retType instanceof IBasicType) || ((IBasicType) retType).getKind() != IBasicType.Kind.eVoid)
return false;
// RESET must have no parameters
@@ -427,14 +429,11 @@ public class QPropertyAttributeProposal {
return null;
// Disable all unneeded parts of the parser.
- IASTTranslationUnit astTU
- = tu.getAST(
- index,
- ITranslationUnit.AST_SKIP_FUNCTION_BODIES
- | ITranslationUnit.AST_SKIP_ALL_HEADERS
- | ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT
- | ITranslationUnit.AST_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS
- | ITranslationUnit.AST_PARSE_INACTIVE_CODE);
+ IASTTranslationUnit astTU = tu.getAST(index,
+ ITranslationUnit.AST_SKIP_FUNCTION_BODIES | ITranslationUnit.AST_SKIP_ALL_HEADERS
+ | ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT
+ | ITranslationUnit.AST_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS
+ | ITranslationUnit.AST_PARSE_INACTIVE_CODE);
if (astTU == null)
return null;
@@ -455,8 +454,7 @@ public class QPropertyAttributeProposal {
return null;
offset = location.getNodeOffset() - 1;
- } while(offset > 0
- && !(enclosing instanceof IASTCompositeTypeSpecifier));
+ } while (offset > 0 && !(enclosing instanceof IASTCompositeTypeSpecifier));
if (!(enclosing instanceof IASTCompositeTypeSpecifier))
return null;
@@ -470,7 +468,7 @@ public class QPropertyAttributeProposal {
return null;
return (ICPPClassType) binding.getAdapter(ICPPClassType.class);
- } catch(CoreException e) {
+ } catch (CoreException e) {
Activator.log(e);
}
@@ -481,7 +479,8 @@ public class QPropertyAttributeProposal {
* Find and return all methods that are accessible in the class definition that encloses the argument
* invocation context. Does not return null.
*/
- private static Collection<ICPPMethod> getMethods(ICEditorContentAssistInvocationContext context, IMethodAttribute methodAttribute) {
+ private static Collection<ICPPMethod> getMethods(ICEditorContentAssistInvocationContext context,
+ IMethodAttribute methodAttribute) {
ICPPClassType cls = getEnclosingClassDefinition(context);
if (cls == null)
@@ -490,7 +489,7 @@ public class QPropertyAttributeProposal {
// Return all the methods, including inherited and non-visible ones.
ICPPMethod[] methods = cls.getMethods();
List<ICPPMethod> filtered = new ArrayList<ICPPMethod>(methods.length);
- for(ICPPMethod method : methods)
+ for (ICPPMethod method : methods)
if (methodAttribute.keep(method))
filtered.add(method);
@@ -503,7 +502,6 @@ public class QPropertyAttributeProposal {
private static boolean isAssignable(IType lhs, IType rhs) {
// TODO This needs a real assignment check. If the types are different by implicitly convertible
// then this should return true.
- return lhs != null
- && rhs.isSameType(lhs);
+ return lhs != null && rhs.isSameType(lhs);
}
}
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyExpansion.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyExpansion.java
index 4a88b20ace..7f1ec424c8 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyExpansion.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QPropertyExpansion.java
@@ -74,7 +74,7 @@ public class QPropertyExpansion {
static {
StringBuilder regexBuilder = new StringBuilder();
regexBuilder.append("^(?:Q_PROPERTY\\s*\\()?\\s*(.*?)(\\s+)(?:");
- for(IQProperty.Attribute attr : IQProperty.Attribute.values()) {
+ for (IQProperty.Attribute attr : IQProperty.Attribute.values()) {
if (attr.ordinal() > 0)
regexBuilder.append('|');
regexBuilder.append("(?:");
@@ -92,6 +92,7 @@ public class QPropertyExpansion {
private static class Identifier {
public final int start;
public final String ident;
+
public Identifier(int start, String ident) {
this.start = start;
this.ident = ident;
@@ -159,15 +160,14 @@ public class QPropertyExpansion {
int closingParen = scanner.findClosingPeer(openingParen, upperBound, '(', ')');
// This expansion is not applicable if the assistant was invoked after the closing paren.
- if (closingParen != CHeuristicScanner.NOT_FOUND
- && context.getInvocationOffset() > scanner.getPosition())
+ if (closingParen != CHeuristicScanner.NOT_FOUND && context.getInvocationOffset() > scanner.getPosition())
return null;
try {
if (closingParen != CHeuristicScanner.NOT_FOUND)
expansion = doc.get(openingParen, closingParen - openingParen);
else
- expansion = doc.get(openingParen, context.getInvocationOffset() - openingParen );
+ expansion = doc.get(openingParen, context.getInvocationOffset() - openingParen);
} catch (BadLocationException e) {
Activator.log(e);
}
@@ -200,15 +200,15 @@ public class QPropertyExpansion {
type = CPPVisitor.createType(typeId);
IASTDeclarator declarator = typeId.getAbstractDeclarator();
- if (declarator != null
- && declarator.getName() != null)
+ if (declarator != null && declarator.getName() != null)
name = declarator.getName().toString();
}
return new QPropertyExpansion(expansion, endOfTypeName, cursor, type, name, prevIdentifier, currIdentifier);
}
- private QPropertyExpansion(String expansion, int startOfAttrs, int cursor, IType type, String name, Identifier prev, Identifier curr) {
+ private QPropertyExpansion(String expansion, int startOfAttrs, int cursor, IType type, String name, Identifier prev,
+ Identifier curr) {
this.expansion = expansion;
this.startOfAttrs = startOfAttrs;
this.cursor = cursor;
@@ -245,19 +245,43 @@ public class QPropertyExpansion {
this.attribute = attribute;
// Give attribute proposals the same order as the Qt documentation.
- switch(attribute) {
- case READ: this.relevance = 11; break;
- case WRITE: this.relevance = 10; break;
- case RESET: this.relevance = 9; break;
- case NOTIFY: this.relevance = 8; break;
- case REVISION: this.relevance = 7; break;
- case DESIGNABLE: this.relevance = 6; break;
- case SCRIPTABLE: this.relevance = 5; break;
- case STORED: this.relevance = 4; break;
- case USER: this.relevance = 3; break;
- case CONSTANT: this.relevance = 2; break;
- case FINAL: this.relevance = 1; break;
- default: this.relevance = 0; break;
+ switch (attribute) {
+ case READ:
+ this.relevance = 11;
+ break;
+ case WRITE:
+ this.relevance = 10;
+ break;
+ case RESET:
+ this.relevance = 9;
+ break;
+ case NOTIFY:
+ this.relevance = 8;
+ break;
+ case REVISION:
+ this.relevance = 7;
+ break;
+ case DESIGNABLE:
+ this.relevance = 6;
+ break;
+ case SCRIPTABLE:
+ this.relevance = 5;
+ break;
+ case STORED:
+ this.relevance = 4;
+ break;
+ case USER:
+ this.relevance = 3;
+ break;
+ case CONSTANT:
+ this.relevance = 2;
+ break;
+ case FINAL:
+ this.relevance = 1;
+ break;
+ default:
+ this.relevance = 0;
+ break;
}
}
@@ -265,7 +289,8 @@ public class QPropertyExpansion {
// Attributes without values propose only their own identifier.
if (!attribute.hasValue)
- return new CCompletionProposal(attribute.identifier, context.getInvocationOffset(), 0, Activator.getQtLogo(), attribute.identifier + " - Q_PROPERTY declaration parameter", relevance);
+ return new CCompletionProposal(attribute.identifier, context.getInvocationOffset(), 0,
+ Activator.getQtLogo(), attribute.identifier + " - Q_PROPERTY declaration parameter", relevance);
// Otherwise create a template where the content depends on the type of the attribute's parameter.
String display = attribute.identifier + ' ' + attribute.paramName;
@@ -281,7 +306,8 @@ public class QPropertyExpansion {
}
}
- private static ICompletionProposal templateProposal(String contextId, ICEditorContentAssistInvocationContext context, String display, String replacement, int relevance) {
+ 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);
TemplateContextType ctxType = new CContextType();
@@ -323,16 +349,15 @@ public class QPropertyExpansion {
// for from that unspecified list.
List<Attribute> unspecifiedAttributes = new ArrayList<Attribute>();
- for(IQProperty.Attribute attr : IQProperty.Attribute.values()) {
- if (attr.hasValue
- && (prevIdentifier != null && attr.identifier.equals(prevIdentifier.ident))) {
+ for (IQProperty.Attribute attr : IQProperty.Attribute.values()) {
+ if (attr.hasValue && (prevIdentifier != null && attr.identifier.equals(prevIdentifier.ident))) {
- Collection<QPropertyAttributeProposal> attrProposals = QPropertyAttributeProposal.buildProposals(attr, context, type, name);
+ Collection<QPropertyAttributeProposal> attrProposals = QPropertyAttributeProposal.buildProposals(attr,
+ context, type, name);
if (attrProposals != null) {
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
- for(QPropertyAttributeProposal value : attrProposals)
- if (prefix == null
- || value.getIdentifier().startsWith(prefix))
+ for (QPropertyAttributeProposal value : attrProposals)
+ if (prefix == null || value.getIdentifier().startsWith(prefix))
proposals.add(value.createProposal(prefix, context.getInvocationOffset()));
return proposals;
}
@@ -341,16 +366,15 @@ public class QPropertyExpansion {
}
if (prefix != null) {
- if (attr.identifier.startsWith(prefix)
- &&(!expansion.matches(".*\\s+" + attr.identifier + "\\s+.*")
- ||attr.identifier.equals(currIdentifier.ident)))
+ if (attr.identifier.startsWith(prefix) && (!expansion.matches(".*\\s+" + attr.identifier + "\\s+.*")
+ || attr.identifier.equals(currIdentifier.ident)))
unspecifiedAttributes.add(new Attribute(attr));
} else if (!expansion.matches(".*\\s+" + attr.identifier + "\\s+.*"))
unspecifiedAttributes.add(new Attribute(attr));
}
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
- for(Attribute attr : unspecifiedAttributes) {
+ for (Attribute attr : unspecifiedAttributes) {
ICompletionProposal proposal = attr.getProposal(contextId, context);
if (proposal != null)
proposals.add(proposal);
@@ -378,8 +402,8 @@ public class QPropertyExpansion {
return null;
int end = scanner.getPosition();
- return new Identifier(begin, doc.get(begin, end - begin));
- } catch(BadLocationException e) {
+ return new Identifier(begin, doc.get(begin, end - begin));
+ } catch (BadLocationException e) {
Activator.log(e);
}
return null;
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QtProposalContext.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QtProposalContext.java
index 387ee383fc..99e9db7d37 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QtProposalContext.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/assist/QtProposalContext.java
@@ -47,8 +47,7 @@ public class QtProposalContext extends CContext {
ITextViewer viewer = context.getViewer();
if (viewer != null) {
Point selection = viewer.getSelectedRange();
- if (selection != null
- && selection.y > 0)
+ if (selection != null && selection.y > 0)
length += selection.y;
}
@@ -71,10 +70,10 @@ public class QtProposalContext extends CContext {
// whether or not characters are selected.
try {
- IDocument document= getDocument();
+ IDocument document = getDocument();
- int start= getCompletionOffset();
- int end= getCompletionOffset() + getCompletionLength();
+ int start = getCompletionOffset();
+ int end = getCompletionOffset() + getCompletionLength();
while (start != 0 && isUnicodeIdentifierPartOrPoundSign(document.getChar(start - 1)))
start--;
@@ -83,7 +82,7 @@ public class QtProposalContext extends CContext {
start++;
if (start == end)
- start= getCompletionOffset();
+ start = getCompletionOffset();
return start;
} catch (BadLocationException e) {
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/IQMLPartitions.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/IQMLPartitions.java
index aaf39af2c4..94a3cc795c 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/IQMLPartitions.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/IQMLPartitions.java
@@ -22,9 +22,6 @@ public interface IQMLPartitions {
final String QML_MULTI_LINE_COMMENT = "__qml_multiline_comment"; //$NON-NLS-1$
final String QML_STRING = "__qml_string"; //$NON-NLS-1$
- final String[] ALL_QMLPARTITIONS = {
- IQMLPartitions.QML_SINGLE_LINE_COMMENT,
- IQMLPartitions.QML_MULTI_LINE_COMMENT,
- IQMLPartitions.QML_STRING
- };
+ final String[] ALL_QMLPARTITIONS = { IQMLPartitions.QML_SINGLE_LINE_COMMENT, IQMLPartitions.QML_MULTI_LINE_COMMENT,
+ IQMLPartitions.QML_STRING };
}
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLDocumentSetupParticipant.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLDocumentSetupParticipant.java
index 949fdf4239..2ab820fc0f 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLDocumentSetupParticipant.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLDocumentSetupParticipant.java
@@ -23,7 +23,8 @@ public class QMLDocumentSetupParticipant implements IDocumentSetupParticipant, I
@Override
public void setup(IDocument document) {
- IDocumentPartitioner partitioner = new FastPartitioner(new QMLPartitionScanner(), IQMLPartitions.ALL_QMLPARTITIONS);
+ IDocumentPartitioner partitioner = new FastPartitioner(new QMLPartitionScanner(),
+ IQMLPartitions.ALL_QMLPARTITIONS);
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 ext = (IDocumentExtension3) document;
ext.setDocumentPartitioner(IQMLPartitions.QML_PARTITIONING, partitioner);
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLEditor.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLEditor.java
index 1e932f890b..a076895130 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLEditor.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLEditor.java
@@ -54,11 +54,8 @@ public class QMLEditor extends TextEditor {
protected void initializeEditor() {
super.initializeEditor();
IPreferenceStore prefStore = new ChainedPreferenceStore(new IPreferenceStore[] {
- Activator.getDefault().getPreferenceStore(),
- CUIPlugin.getDefault().getPreferenceStore(),
- CUIPlugin.getDefault().getCorePreferenceStore(),
- EditorsUI.getPreferenceStore()
- });
+ Activator.getDefault().getPreferenceStore(), CUIPlugin.getDefault().getPreferenceStore(),
+ CUIPlugin.getDefault().getCorePreferenceStore(), EditorsUI.getPreferenceStore() });
setPreferenceStore(prefStore);
setSourceViewerConfiguration(new QMLSourceViewerConfiguration(this, prefStore));
}
@@ -68,7 +65,7 @@ public class QMLEditor extends TextEditor {
((QMLSourceViewerConfiguration) getSourceViewerConfiguration()).handlePreferenceStoreChanged(event);
super.handlePreferenceStoreChanged(event);
}
-
+
@Override
protected boolean affectsTextPresentation(PropertyChangeEvent event) {
if (((QMLSourceViewerConfiguration) getSourceViewerConfiguration()).affectsTextPresentation(event)) {
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLKeywords.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLKeywords.java
index bce5483afa..c803062883 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLKeywords.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLKeywords.java
@@ -107,16 +107,18 @@ public class QMLKeywords {
*/
public static final String[] getKeywords(boolean strictMode) {
if (!strictMode) {
- return new String[] { IMPORT, CONST, PROPERTY, READONLY, SIGNAL, AS, ON, TRUE, FALSE, TRANSIENT, SYNCHRONIZED, ABSTRACT,
- VOLATILE, NATIVE, GOTO, BYTE, LONG, CHAR, SHORT, FLOAT, BOOLEAN, DOUBLE, INT, LIST, COLOR, REAL, STRING, URL,
- VAR, BREAK, DO, INSTANCEOF, TYPEOF, CASE, ELSE, NEW, CATCH, FINALLY, RETURN, VOID, CONTINUE, FOR, SWITCH, WHILE,
- DEBUGGER, FUNCTION, THIS, WITH, DEFAULT, IF, THROW, DELETE, IN, TRY, CLASS, ENUM, EXTENDS, SUPER, EXPORT };
+ return new String[] { IMPORT, CONST, PROPERTY, READONLY, SIGNAL, AS, ON, TRUE, FALSE, TRANSIENT,
+ SYNCHRONIZED, ABSTRACT, VOLATILE, NATIVE, GOTO, BYTE, LONG, CHAR, SHORT, FLOAT, BOOLEAN, DOUBLE,
+ INT, LIST, COLOR, REAL, STRING, URL, VAR, BREAK, DO, INSTANCEOF, TYPEOF, CASE, ELSE, NEW, CATCH,
+ FINALLY, RETURN, VOID, CONTINUE, FOR, SWITCH, WHILE, DEBUGGER, FUNCTION, THIS, WITH, DEFAULT, IF,
+ THROW, DELETE, IN, TRY, CLASS, ENUM, EXTENDS, SUPER, EXPORT };
} else {
- return new String[] { IMPORT, CONST, PROPERTY, READONLY, SIGNAL, AS, ON, TRUE, FALSE, TRANSIENT, SYNCHRONIZED, ABSTRACT,
- VOLATILE, NATIVE, GOTO, BYTE, LONG, CHAR, SHORT, FLOAT, BOOLEAN, DOUBLE, INT, LIST, COLOR, REAL, STRING, URL,
- VAR, BREAK, DO, INSTANCEOF, TYPEOF, CASE, ELSE, NEW, CATCH, FINALLY, RETURN, VOID, CONTINUE, FOR, SWITCH, WHILE,
- DEBUGGER, FUNCTION, THIS, WITH, DEFAULT, IF, THROW, DELETE, IN, TRY, CLASS, ENUM, EXTENDS, SUPER, EXPORT,
- IMPLEMENTS, LET, PRIVATE, PUBLIC, YIELD, INTERFACE, PACKAGE, PROTECTED, STATIC };
+ return new String[] { IMPORT, CONST, PROPERTY, READONLY, SIGNAL, AS, ON, TRUE, FALSE, TRANSIENT,
+ SYNCHRONIZED, ABSTRACT, VOLATILE, NATIVE, GOTO, BYTE, LONG, CHAR, SHORT, FLOAT, BOOLEAN, DOUBLE,
+ INT, LIST, COLOR, REAL, STRING, URL, VAR, BREAK, DO, INSTANCEOF, TYPEOF, CASE, ELSE, NEW, CATCH,
+ FINALLY, RETURN, VOID, CONTINUE, FOR, SWITCH, WHILE, DEBUGGER, FUNCTION, THIS, WITH, DEFAULT, IF,
+ THROW, DELETE, IN, TRY, CLASS, ENUM, EXTENDS, SUPER, EXPORT, IMPLEMENTS, LET, PRIVATE, PUBLIC,
+ YIELD, INTERFACE, PACKAGE, PROTECTED, STATIC };
}
}
}
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLPartitionScanner.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLPartitionScanner.java
index 949e5bf57b..90456a9855 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLPartitionScanner.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLPartitionScanner.java
@@ -35,12 +35,11 @@ public class QMLPartitionScanner extends RuleBasedPartitionScanner implements IQ
public QMLPartitionScanner() {
super();
- IToken multiLineComment= new Token(QML_MULTI_LINE_COMMENT);
- IToken singleLineComment= new Token(QML_SINGLE_LINE_COMMENT);
- IToken string= new Token(QML_STRING);
+ IToken multiLineComment = new Token(QML_MULTI_LINE_COMMENT);
+ IToken singleLineComment = new Token(QML_SINGLE_LINE_COMMENT);
+ IToken string = new Token(QML_STRING);
- setPredicateRules(new IPredicateRule[] {
- new MultiLineRule("/*", "*/", multiLineComment, (char) 0, true), //$NON-NLS-1$ //$NON-NLS-2$
+ setPredicateRules(new IPredicateRule[] { new MultiLineRule("/*", "*/", multiLineComment, (char) 0, true), //$NON-NLS-1$ //$NON-NLS-2$
new EndOfLineRule("//", singleLineComment), //$NON-NLS-1$
new SingleLineRule("\"", "\"", string, '\\', true) //$NON-NLS-2$ //$NON-NLS-1$
});
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLSourceViewerConfiguration.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLSourceViewerConfiguration.java
index 1cfe124ba6..0472494c25 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLSourceViewerConfiguration.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLSourceViewerConfiguration.java
@@ -183,18 +183,18 @@ public class QMLSourceViewerConfiguration extends TextSourceViewerConfiguration
private TextAttribute createTextAttribute(IColorManager colorManager, String colorKey) {
Color color = colorManager.getColor(colorKey);
if (color == null) {
- RGB rgb= PreferenceConverter.getColor(fPreferenceStore, colorKey);
+ RGB rgb = PreferenceConverter.getColor(fPreferenceStore, colorKey);
colorManager.unbindColor(colorKey);
colorManager.bindColor(colorKey, rgb);
color = colorManager.getColor(colorKey);
}
- String boldKey= colorKey + PreferenceConstants.EDITOR_BOLD_SUFFIX;
- String italicKey= colorKey + PreferenceConstants.EDITOR_ITALIC_SUFFIX;
- String strikethroughKey= colorKey + PreferenceConstants.EDITOR_STRIKETHROUGH_SUFFIX;
- String underlineKey= colorKey + PreferenceConstants.EDITOR_UNDERLINE_SUFFIX;
-
- int style= fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
+ String boldKey = colorKey + PreferenceConstants.EDITOR_BOLD_SUFFIX;
+ String italicKey = colorKey + PreferenceConstants.EDITOR_ITALIC_SUFFIX;
+ String strikethroughKey = colorKey + PreferenceConstants.EDITOR_STRIKETHROUGH_SUFFIX;
+ String underlineKey = colorKey + PreferenceConstants.EDITOR_UNDERLINE_SUFFIX;
+
+ int style = fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
if (fPreferenceStore.getBoolean(italicKey))
style |= SWT.ITALIC;
@@ -231,9 +231,8 @@ public class QMLSourceViewerConfiguration extends TextSourceViewerConfiguration
String property = event.getProperty();
return property.startsWith(ICColorConstants.C_MULTI_LINE_COMMENT)
|| property.startsWith(ICColorConstants.C_SINGLE_LINE_COMMENT)
- || property.startsWith(ICColorConstants.C_KEYWORD)
- || property.startsWith(ICColorConstants.C_STRING)
+ || property.startsWith(ICColorConstants.C_KEYWORD) || property.startsWith(ICColorConstants.C_STRING)
|| property.startsWith(ICColorConstants.TASK_TAG);
}
-
+
}
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileEditor.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileEditor.java
index 74d9223dbe..2d33ae07ea 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileEditor.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileEditor.java
@@ -37,9 +37,11 @@ public class QtProjectFileEditor extends TextEditor {
super.configureSourceViewerDecorationSupport(support);
// Setup bracket matching with default color being gray
- ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(BRACKETS, IDocumentExtension3.DEFAULT_PARTITIONING);
+ ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(BRACKETS,
+ IDocumentExtension3.DEFAULT_PARTITIONING);
support.setCharacterPairMatcher(matcher);
- support.setMatchingCharacterPainterPreferenceKeys(BRACKET_MATCHING_PREFERENCE, BRACKET_MATCHING_COLOR_PREFERENCE);
+ support.setMatchingCharacterPainterPreferenceKeys(BRACKET_MATCHING_PREFERENCE,
+ BRACKET_MATCHING_COLOR_PREFERENCE);
IPreferenceStore store = getPreferenceStore();
store.setDefault(BRACKET_MATCHING_PREFERENCE, true);
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileSourceViewerConfiguration.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileSourceViewerConfiguration.java
index 33c8d27b71..c3fe8fdd8f 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileSourceViewerConfiguration.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileSourceViewerConfiguration.java
@@ -43,12 +43,10 @@ public class QtProjectFileSourceViewerConfiguration extends TextSourceViewerConf
private static int TOKEN_COMMENT = 3;
// TODO: Add preference page for syntax highlighting
- private static IToken[] allTokens = new IToken[] {
- new Token(null),
+ private static IToken[] allTokens = new IToken[] { new Token(null),
new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(140, 140, 0)))),
new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(140, 0, 100)))),
- new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(0, 140, 0))))
- };
+ new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(0, 140, 0)))) };
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) {
@@ -87,19 +85,17 @@ public class QtProjectFileSourceViewerConfiguration extends TextSourceViewerConf
wordRule.addWord(keyword.getKeyword(), allTokens[TOKEN_VARIABLE_KEYWORD]);
}
- scanner.setRules(new IRule[] {
- wordRule,
- new EndOfLineRule("#", allTokens[TOKEN_COMMENT]) //$NON-NLS-1$
+ scanner.setRules(new IRule[] { wordRule, new EndOfLineRule("#", allTokens[TOKEN_COMMENT]) //$NON-NLS-1$
});
return scanner;
}
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- ContentAssistant contentAssistant = new ContentAssistant();
- IContentAssistProcessor processor = new QtProjectFileContentAssistProcessor();
- contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
- contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
- return contentAssistant;
+ ContentAssistant contentAssistant = new ContentAssistant();
+ IContentAssistProcessor processor = new QtProjectFileContentAssistProcessor();
+ contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
+ contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
+ return contentAssistant;
}
}
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/preferences/QtPreferencePage.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/preferences/QtPreferencePage.java
index 444af579ec..c153d42b8f 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/preferences/QtPreferencePage.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/preferences/QtPreferencePage.java
@@ -158,7 +158,8 @@ public class QtPreferencePage extends PreferencePage implements IWorkbenchPrefer
private void updateTable() {
List<IQtInstall> sorted = new ArrayList<>(getInstalls().values());
- Collections.sort(sorted, (o1, o2) -> o1.getQmakePath().toString().compareToIgnoreCase(o2.getQmakePath().toString()));
+ Collections.sort(sorted,
+ (o1, o2) -> o1.getQmakePath().toString().compareToIgnoreCase(o2.getQmakePath().toString()));
installTable.removeAll();
for (IQtInstall install : sorted) {
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileModifier.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileModifier.java
index b8f848dc30..bdf7ee6a56 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileModifier.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileModifier.java
@@ -128,11 +128,8 @@ public class QtProjectFileModifier {
for (String value : var.getValues()) {
int offset = value.indexOf(oldValue);
if (offset >= 0) {
- return replaceVariableValue(var,
- line,
- var.getValueOffsetForLine(line) + offset,
- oldValue.length(),
- newValue);
+ return replaceVariableValue(var, line, var.getValueOffsetForLine(line) + offset,
+ oldValue.length(), newValue);
}
line++;
}
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectVariable.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectVariable.java
index 8625810cc1..3ad0517e73 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectVariable.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectVariable.java
@@ -36,7 +36,8 @@ import java.util.regex.Pattern;
public class QtProjectVariable {
private static final Pattern REGEX = Pattern.compile(
"(?m)^\\h*((?:[_a-zA-Z][_a-zA-Z0-9]*\\.)*[_a-zA-Z][_a-zA-Z0-9]*)\\h*(=|\\+=|-=|\\*=)\\h*([^#\\v]*?)\\h*((?:(\\\\)\\h*)?(#[^\\v]*)?$)"); //$NON-NLS-1$
- private static final Pattern LINE_ESCAPE_REGEX = Pattern.compile("(?m)^(\\h*)([^#\\v]*?)\\h*((?:(\\\\)\\h*)?(#[^\\v]*)?$)"); //$NON-NLS-1$
+ private static final Pattern LINE_ESCAPE_REGEX = Pattern
+ .compile("(?m)^(\\h*)([^#\\v]*?)\\h*((?:(\\\\)\\h*)?(#[^\\v]*)?$)"); //$NON-NLS-1$
private static final int GROUP_VAR_NAME = 1;
private static final int GROUP_VAR_ASSIGNMENT = 2;
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtProjectFileUpdateJob.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtProjectFileUpdateJob.java
index 0b1863e823..aa32de3543 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtProjectFileUpdateJob.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtProjectFileUpdateJob.java
@@ -50,8 +50,7 @@ public class QtProjectFileUpdateJob extends Job {
private IFile findQtProjectFile(IProject project) throws CoreException {
for (IResource member : project.members()) {
- if (member.getType() == IResource.FILE
- && member.getFileExtension().equals("pro")) { //$NON-NLS-1$
+ if (member.getType() == IResource.FILE && member.getFileExtension().equals("pro")) { //$NON-NLS-1$
return (IFile) member;
}
}

Back to the top