Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'qt/org.eclipse.cdt.qt.ui/src')
-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
20 files changed, 215 insertions, 208 deletions
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 20583933bc4..a2f29cc0183 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 1f30732831b..f9d8f6e93fa 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 22a7f6bf9c6..d32bb50e356 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 6f622b596e8..713329a7d50 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 b2f2a40fdd9..8d14b787fb8 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 07848251222..8767bee2eb2 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 4a88b20acec..7f1ec424c89 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 387ee383fcd..99e9db7d370 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 aaf39af2c4a..94a3cc795c0 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 949fdf4239b..2ab820fc0fe 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 1e932f890b6..a076895130b 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 bce5483afa4..c8030628837 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 949e5bf57b3..90456a98550 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 1cfe124ba65..0472494c252 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 74d9223dbe2..2d33ae07ea2 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 33c8d27b71d..c3fe8fdd8f9 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 444af579ec8..c153d42b8f2 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 b8f848dc305..bdf7ee6a56b 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 8625810cc16..3ad0517e738 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 0b1863e823c..aa32de35438 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