diff --git a/codan/org.eclipse.cdt.codan.core.cxx/META-INF/MANIFEST.MF b/codan/org.eclipse.cdt.codan.core.cxx/META-INF/MANIFEST.MF index 76a25897400..b1ce271023e 100644 --- a/codan/org.eclipse.cdt.codan.core.cxx/META-INF/MANIFEST.MF +++ b/codan/org.eclipse.cdt.codan.core.cxx/META-INF/MANIFEST.MF @@ -7,15 +7,13 @@ Bundle-Activator: org.eclipse.cdt.codan.core.cxx.Activator Require-Bundle: org.eclipse.core.runtime, org.eclipse.cdt.core, org.eclipse.cdt.codan.core, - org.eclipse.core.resources + org.eclipse.core.resources, + org.eclipse.core.filesystem Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.cdt.codan.core.cxx, - org.eclipse.cdt.codan.core.cxx.internal.model; - x-friends:="org.eclipse.cdt.codan.checkers.ui, - org.eclipse.cdt.codan.ui, - org.eclipse.cdt.codan.ui.cxx", - org.eclipse.cdt.codan.core.cxx.internal.model.cfg; - x-friends:="org.eclipse.cdt.codan.core.test", + org.eclipse.cdt.codan.core.cxx.externaltool, + org.eclipse.cdt.codan.core.cxx.internal.model;x-friends:="org.eclipse.cdt.codan.checkers.ui,org.eclipse.cdt.codan.ui,org.eclipse.cdt.codan.ui.cxx", + org.eclipse.cdt.codan.core.cxx.internal.model.cfg;x-friends:="org.eclipse.cdt.codan.core.test", org.eclipse.cdt.codan.core.cxx.model Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Vendor: %Bundle-Vendor diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/Activator.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/Activator.java index 5251574a137..168bd3f2d0f 100644 --- a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/Activator.java +++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/Activator.java @@ -32,7 +32,7 @@ public class Activator extends Plugin { /* * (non-Javadoc) - * + * * @see * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) */ @@ -44,7 +44,7 @@ public class Activator extends Plugin { /* * (non-Javadoc) - * + * * @see * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) */ @@ -56,7 +56,7 @@ public class Activator extends Plugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { @@ -65,7 +65,7 @@ public class Activator extends Plugin { /** * Logs the specified status with this plug-in's log. - * + * * @param status * status to log */ @@ -74,22 +74,36 @@ public class Activator extends Plugin { } /** - * Logs an internal error with the specified throwable - * - * @param e - * the exception to be logged + * Logs an internal error with the specified {@code Throwable}. + * + * @param t + * the {@code Throwable} to be logged */ - public static void log(Throwable e) { - log(new Status(IStatus.ERROR, PLUGIN_ID, 1, "Internal Error", e)); //$NON-NLS-1$ + public static void log(Throwable t) { + log(new Status(IStatus.ERROR, PLUGIN_ID, 1, "Internal Error", t)); //$NON-NLS-1$ } /** * Logs an internal error with the specified message. - * + * * @param message * the error message to log */ public static void log(String message) { log(new Status(IStatus.ERROR, PLUGIN_ID, 1, message, null)); } + + /** + * Logs an internal error with the specified message and {@code Throwable}. + * + * @param message + * the error message to log + * @param t + * the {@code Throwable} to be logged + * + * @since 2.1 + */ + public static void log(String message, Throwable t) { + log(new Status(IStatus.ERROR, PLUGIN_ID, 1, message, t)); + } } diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java index 4f4dc1560f0..6bb0baf6241 100644 --- a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java +++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java @@ -406,6 +406,14 @@ public final class CxxAstUtils { if (!(expression instanceof IASTFunctionCallExpression)) return false; IASTExpression functionNameExpression = ((IASTFunctionCallExpression) expression).getFunctionNameExpression(); + if (functionNameExpression instanceof IASTIdExpression) { + IASTName name = ((IASTIdExpression)functionNameExpression).getName(); + + IBinding binding = name.resolveBinding(); + if (binding!=null && binding instanceof IFunction && ((IFunction)binding).isNoReturn()) { + return true; + } + } return functionNameExpression.getRawSignature().equals("exit"); //$NON-NLS-1$ } } diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/externaltool/AbstractExternalToolBasedChecker.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/externaltool/AbstractExternalToolBasedChecker.java new file mode 100644 index 00000000000..6797af3a3ca --- /dev/null +++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/externaltool/AbstractExternalToolBasedChecker.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2012 Google, Inc and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alex Ruiz (Google) - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.cxx.externaltool; + +import static org.eclipse.cdt.core.ErrorParserContext.CODAN; + +import java.net.URI; + +import org.eclipse.cdt.codan.core.CodanRuntime; +import org.eclipse.cdt.codan.core.cxx.Activator; +import org.eclipse.cdt.codan.core.cxx.internal.externaltool.ExternalToolInvoker; +import org.eclipse.cdt.codan.core.model.AbstractCheckerWithProblemPreferences; +import org.eclipse.cdt.codan.core.model.CheckerLaunchMode; +import org.eclipse.cdt.codan.core.model.IProblem; +import org.eclipse.cdt.codan.core.model.IProblemLocation; +import org.eclipse.cdt.codan.core.model.IProblemLocationFactory; +import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy; +import org.eclipse.cdt.codan.core.param.IProblemPreference; +import org.eclipse.cdt.codan.core.param.MapProblemPreference; +import org.eclipse.cdt.codan.core.param.RootProblemPreference; +import org.eclipse.cdt.codan.core.param.SharedRootProblemPreference; +import org.eclipse.cdt.core.ErrorParserManager; +import org.eclipse.cdt.core.IConsoleParser; +import org.eclipse.cdt.core.IMarkerGenerator; +import org.eclipse.cdt.core.ProblemMarkerInfo; +import org.eclipse.core.filesystem.URIUtil; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; + +/** + * Base class for checkers that invoke external command-line tools to perform code checking. + *
+ * A file, to be processed by this type of checker, must: + *
{@link #getCause()}
method.)
+ */
+ public InvocationFailure(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/externaltool/InvocationParameters.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/externaltool/InvocationParameters.java
new file mode 100644
index 00000000000..74dac3863f8
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/externaltool/InvocationParameters.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Google, Inc and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alex Ruiz (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.core.cxx.externaltool;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * Parameters to pass when invoking an external tool.
+ *
+ * @since 2.1
+ */
+public final class InvocationParameters {
+ private final IResource originalFile;
+ private final IResource actualFile;
+ private final String actualFilePath;
+ private final IPath workingDirectory;
+
+ /**
+ * Constructor.
+ * @param originalFile the original file to process.
+ * @param actualFile the actual file to process.
+ * @param actualFilePath the path of {@code actual}, in a format that the external tool can
+ * understand.
+ * @param workingDirectory the directory where the external tool should be executed.
+ * @see #getOriginalFile()
+ * @see #getActualFile()
+ */
+ public InvocationParameters(IResource originalFile, IResource actualFile, String actualFilePath,
+ IPath workingDirectory) {
+ this.originalFile = originalFile;
+ this.actualFile = actualFile;
+ this.actualFilePath = actualFilePath;
+ this.workingDirectory = workingDirectory;
+ }
+
+ /**
+ * Returns the original file to process. This is the file that triggered execution of
+ * a command-line tool when saved.
+ * @return the original file to process.
+ */
+ public IResource getOriginalFile() {
+ return originalFile;
+ }
+
+ /**
+ * Returns the actual file to process. It may not be the same as
+ * {@link #getOriginalFile()}
, depending on how the external tool works.
+ * + * A good example is an external tool that can only process C++ source files but not header + * files. If the original file is a header file, the checker could potentially find + * a C++ file that includes such header and use it as the actual file to process. + *
+ *+ * We still need to keep a reference to the actual file, in order to add markers to + * the editor in case of problems found. + *
+ * @return the actual file to process. + */ + public IResource getActualFile() { + return actualFile; + } + + /** + * Returns the path of{@link #getActualFile()}
, in a format the external tool can
+ * understand.
+ * @return the path of the actual file to process.
+ */
+ public String getActualFilePath() {
+ return actualFilePath;
+ }
+
+ /**
+ * Returns the directory where the external tool should be executed.
+ * @return the directory where the external tool should be executed.
+ */
+ public IPath getWorkingDirectory() {
+ return workingDirectory;
+ }
+}
diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/externaltool/InvocationParametersProvider.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/externaltool/InvocationParametersProvider.java
new file mode 100644
index 00000000000..486ca98d20d
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/externaltool/InvocationParametersProvider.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Google, Inc and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alex Ruiz (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.core.cxx.externaltool;
+
+import org.eclipse.core.resources.IResource;
+
+/**
+ * Default implementation of {@link InvocationParameters}
+ *
+ * @since 2.1
+ */
+public class InvocationParametersProvider implements IInvocationParametersProvider {
+ /**
+ * Creates the parameters to pass when invoking an external tool.
+ * + * In this implementation: + *
{@link ArgsSeparator}
.
+ */
+@SuppressWarnings("nls")
+public class ArgsSeparatorTest extends TestCase {
+ private ArgsSeparator separator;
+
+ @Override
+ protected void setUp() {
+ separator = new ArgsSeparator();
+ }
+
+ public void testWithSpaceAsDelimiter() {
+ String[] args = separator.splitArguments("abc def ghi");
+ assertArrayEquals(new String[] { "abc", "def", "ghi" }, args);
+ }
+
+ public void testWithSingleQuote() {
+ String[] args = separator.splitArguments("abc 'def ghi' jkl");
+ assertArrayEquals(new String[] { "abc", "def ghi", "jkl" }, args);
+ }
+
+ public void testWithDoubleQuote() {
+ String[] args = separator.splitArguments("abc \"def ghi\" jkl");
+ assertArrayEquals(new String[] { "abc", "def ghi", "jkl" }, args);
+ }
+
+ public void testWithEscapedSingleQuote() {
+ String[] args = separator.splitArguments("abc 'def \\' ghi' jkl");
+ assertArrayEquals(new String[] { "abc", "def \\' ghi", "jkl" }, args);
+ }
+
+ public void testWithEscapedDoubleQuote() {
+ String[] args = separator.splitArguments("abc 'def \\\" ghi' jkl");
+ assertArrayEquals(new String[] { "abc", "def \\\" ghi", "jkl" }, args);
+ }
+}
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
index 95519bf9fb6..75584462eb4 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
@@ -298,4 +298,16 @@ public class ReturnCheckerTest extends CheckerTestCase {
loadCodeAndRunCpp(getAboveComment());
checkNoErrors();
}
+
+
+//void f() __attribute__((noreturn));
+//
+//int test() {
+// f();
+//}
+
+ public void testNoReturn() {
+ loadCodeAndRun(getAboveComment());
+ checkNoErrors();
+ }
}
\ No newline at end of file
diff --git a/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF b/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
index 332b1beefa8..3690b87d098 100644
--- a/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
+++ b/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
@@ -19,7 +19,8 @@ Export-Package: org.eclipse.cdt.codan.core,
x-friends:="org.eclipse.cdt.codan.core,
org.eclipse.cdt.codan.core.cxx,
org.eclipse.cdt.codan.core.test,
- org.eclipse.cdt.codan.ui",
+ org.eclipse.cdt.codan.ui,
+ org.eclipse.cdt.codan.ui.cxx",
org.eclipse.cdt.codan.internal.core.cfg;x-friends:="org.eclipse.cdt.codan.core.cxx",
org.eclipse.cdt.codan.internal.core.model;
x-friends:="org.eclipse.cdt.codan.core.cxx,
diff --git a/codan/org.eclipse.cdt.codan.core/plugin.xml b/codan/org.eclipse.cdt.codan.core/plugin.xml
index a3af004ed87..27f4e1f212f 100644
--- a/codan/org.eclipse.cdt.codan.core/plugin.xml
+++ b/codan/org.eclipse.cdt.codan.core/plugin.xml
@@ -2,6 +2,7 @@
{@link ICheckerEnablementVerifier}
.
+ */
+public class CheckerEnablementVerifier implements ICheckerEnablementVerifier {
+ @Override
+ public boolean isCheckerEnabled(IChecker checker, IResource resource, CheckerLaunchMode mode) {
+ if (mode != CheckerLaunchMode.RUN_ON_FILE_SAVE) {
+ return true;
+ }
+ for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
+ IWorkbenchPage page = window.getActivePage();
+ for (IEditorReference reference : page.getEditorReferences()) {
+ IEditorPart editor = reference.getEditor(false);
+ if (!CodanEditorUtility.isResourceOpenInEditor(resource, editor)) {
+ continue;
+ }
+ if (editor instanceof TextEditor) {
+ TextEditor textEditor = (TextEditor) editor;
+ return !textEditor.isDirty();
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.java
index 0ed0f2917ce..cc8c5539b3f 100644
--- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.java
+++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.java
@@ -87,6 +87,7 @@ public class CodanUIMessages extends NLS {
public static String LaunchModesPropertyPage_RunOnDemand;
public static String LaunchModesPropertyPage_RunOnFullBuild;
public static String LaunchModesPropertyPage_RunOnIncrementalBuild;
+ public static String LaunchModesPropertyPage_RunOnFileSave;
static {
NLS.initializeMessages(CodanUIMessages.class.getName(), CodanUIMessages.class);
diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.properties b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.properties
index 2c02d8329c7..414ab1e20e3 100644
--- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.properties
+++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.properties
@@ -96,3 +96,4 @@ LaunchModesPropertyPage_RunAsYouType=Run as you type
LaunchModesPropertyPage_RunOnDemand=Run on demand
LaunchModesPropertyPage_RunOnFullBuild=Run on full build
LaunchModesPropertyPage_RunOnIncrementalBuild=Run on incremental build
+LaunchModesPropertyPage_RunOnFileSave=Run on file save or open
diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/LaunchModesPropertyPage.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/LaunchModesPropertyPage.java
index 380862d445d..733f7c191c7 100644
--- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/LaunchModesPropertyPage.java
+++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/LaunchModesPropertyPage.java
@@ -37,7 +37,11 @@ public class LaunchModesPropertyPage extends FieldEditorPreferencePage {
super(GRID);
CheckersRegistry registry = CheckersRegistry.getInstance();
IChecker checker = registry.getCheckerForProblem(problem);
- runInEditor = (checker != null) ? Checkers.canCheckerRunAsYouType(checker) : false;
+ if (checker != null) {
+ runInEditor = Checkers.canCheckerRunAsYouType(checker);
+ } else {
+ runInEditor = false;
+ }
setPreferenceStore(prefStore);
editors = new ArrayList{@link org.eclipse.cdt.core.IErrorParser}
s can be
+ * used.
+ *
+ * @since 5.4
+ */
+public class ErrorParserContext {
+ public static final int BUILD = 1 << 0;
+ public static final int CODAN = 1 << 1;
+
+ public static int getValue(String text) {
+ if ("build".equals(text)) { //$NON-NLS-1$
+ return BUILD;
+ }
+ if ("codan".equals(text)) { //$NON-NLS-1$
+ return CODAN;
+ }
+ throw new IllegalArgumentException("Unknown context value: " + text); //$NON-NLS-1$
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
index ee224f5fa4c..9f39ff8e319 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.cdt.core;
+import static org.eclipse.cdt.core.ErrorParserContext.BUILD;
+
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
@@ -73,9 +75,9 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
private final IMarkerGenerator fMarkerGenerator;
private Map{@link ErrorParserContext}
.
+ * @see ErrorParserContext
+ * @since 5.4
+ */
+ public ErrorParserManager(IProject project, URI baseDirectoryURI,
+ IMarkerGenerator markerGenerator, String[] parsersIDs, int context) {
fProject = project;
fMarkerGenerator = markerGenerator;
fDirectoryStack = new Vector{@link ErrorParserContext}
.
+ * @return cloned copy of error parser or {@code null}.
+ * Note that {@link ErrorParserNamedWrapper} returns shallow copy with the same instance
+ * of underlying error parser.
+ * @see ErrorParserContext
+ * @since 5.4
+ */
+ public static IErrorParserNamed getErrorParserCopy(String id, int context) {
+ return ErrorParserExtensionManager.getErrorParserCopy(id, false, context);
+ }
+
/**
* @param id - ID of error parser
* @return cloned copy of error parser as defined by its extension point or {@code null}.
@@ -860,5 +915,12 @@ outer:
*/
@Override
public void shutdown() {
+ for (IErrorParser[] parsers : fErrorParsers.values()) {
+ for (IErrorParser parser : parsers) {
+ if (parser instanceof IErrorParser3) {
+ ((IErrorParser3) parser).streamFinished();
+ }
+ }
+ }
}
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IErrorParser3.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IErrorParser3.java
new file mode 100644
index 00000000000..61bfda836ba
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IErrorParser3.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Google, Inc and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alex Ruiz (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core;
+
+/**
+ * @since 5.4
+ */
+public interface IErrorParser3 extends IErrorParser2 {
+ /**
+ * Notification that the stream of data to parse has ended.
+ */
+ void streamFinished();
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ProblemMarkerInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ProblemMarkerInfo.java
index b44f270c0b5..a81a635054b 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ProblemMarkerInfo.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ProblemMarkerInfo.java
@@ -35,6 +35,14 @@ public class ProblemMarkerInfo {
public IResource file;
public int lineNumber;
+ /**
+ * @since 5.4
+ */
+ public int startChar;
+ /**
+ * @since 5.4
+ */
+ public int endChar;
public String description;
public int severity;
public String variableName;
@@ -53,6 +61,24 @@ public class ProblemMarkerInfo {
* @param variableName - the name of the variable involved in the error if any.
*/
public ProblemMarkerInfo(IResource file, int lineNumber, String description, int severity, String variableName) {
+ this(file, lineNumber, -1,-1, description, severity, variableName);
+ }
+
+ /**
+ * Create a new {@link ProblemMarkerInfo} object.
+ *
+ * @param file - the file where the problem has occurred.
+ * @param lineNumber - the line number of the problem.
+ * @param startChar - start char of the problem.
+ * @param endChar - end char of the problem.
+ * @param description - a description of the problem.
+ * @param severity - the severity of the problem, see {@link IMarkerGenerator}
+ * for acceptable severity values.
+ * @param variableName - the name of the variable involved in the error if any.
+ * @since 5.4
+ */
+ public ProblemMarkerInfo(IResource file, int lineNumber, int startChar, int endChar,
+ String description, int severity, String variableName) {
this.file = (file != null) ? file : ResourcesPlugin.getWorkspace().getRoot();
this.lineNumber = lineNumber;
this.description = description;
@@ -61,6 +87,8 @@ public class ProblemMarkerInfo {
this.externalPath = null ;
this.type = null;
this.attributes = new HashMap{@link ErrorParserContext}
.
+ *
+ * @param errorParserElement represents an "errorparser" element in the extension point
+ * "org.eclipse.cdt.core.ErrorParser".
+ * @return the contexts in which an error parser can be used, or
+ * {@link ErrorParserContext#BUILD BUILD}
is none is specified.
+ * @see ErrorParserContext
+ */
+ private static int contextTypes(IConfigurationElement errorParserElement) {
+ IConfigurationElement[] contextElements = errorParserElement.getChildren(ELEM_CONTEXT);
+ if (contextElements.length == 0) {
+ return BUILD;
+ }
+ int contexts = 0;
+ for (IConfigurationElement contextElement : contextElements) {
+ String contextType = contextElement.getAttribute(ATTR_TYPE);
+ contexts = contexts | ErrorParserContext.getValue(contextType);
+ }
+ return contexts;
}
/**
@@ -581,7 +640,8 @@ public class ErrorParserExtensionManager {
* @return internal instance of error parser
*/
public static IErrorParser getErrorParserInternal(String id) {
- IErrorParserNamed errorParser = fAvailableErrorParsers.get(id);
+ Pair{@link ErrorParserContext}
.
+ * @return cloned copy of error parser. Note that {@link ErrorParserNamedWrapper} returns
+ * shallow copy with the same instance of underlying error parser.
+ * @see ErrorParserContext
+ */
+ public static IErrorParserNamed getErrorParserCopy(String id, boolean isExtension,
+ int context) {
+ Pairtrue
if this method
- * call is issued from inside a reporting sequence
+ * call is issued from inside a reporting sequence
*/
private void internalBeginReporting(boolean insideReportingSequence) {
if (fTranslationUnit != null) {
@@ -476,107 +425,105 @@ public class CDocumentProvider extends TextFileDocumentProvider {
}
}
}
-
- /*
- * @see IProblemRequestor#acceptProblem(IProblem)
- */
+
@Override
public void acceptProblem(IProblem problem) {
if (isActive()) {
ProblemRequestorState state= fProblemRequestorState.get();
- if (state != null)
+ if (state != null && isReliable(problem)) {
state.fReportedProblems.add(problem);
+ }
}
}
-
- /*
- * @see IProblemRequestor#endReporting()
+
+ /**
+ * A problem is not considered reliable if it belongs to an unreliable AST.
*/
+ private static boolean isReliable(IProblem problem) {
+ if (problem instanceof IASTNode) {
+ return !((IASTNode) problem).getTranslationUnit().isBasedOnIncompleteIndex();
+ }
+ return true;
+ }
+
@Override
public void endReporting() {
ProblemRequestorState state= fProblemRequestorState.get();
if (state != null && !state.fInsideReportingSequence)
internalEndReporting(state);
}
-
- /*
- * @see org.eclipse.cdt.internal.ui.text.java.IProblemRequestorExtension#endReportingSequence()
- */
+
@Override
public void endReportingSequence() {
ProblemRequestorState state= fProblemRequestorState.get();
if (state != null && state.fInsideReportingSequence)
internalEndReporting(state);
}
-
+
private void internalEndReporting(ProblemRequestorState state) {
int stateCount= 0;
- synchronized(getLockObject()) {
- -- fStateCount;
+ synchronized (getLockObject()) {
+ --fStateCount;
stateCount= fStateCount;
fProblemRequestorState.set(null);
}
-
+
if (stateCount == 0 && isActive())
reportProblems(state.fReportedProblems);
}
-
+
/**
* Signals the end of problem reporting.
*/
private void reportProblems(Listnull
*/
@@ -931,7 +837,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
}
/**
- * Try to synthesize an ITranslationUnit out of thin air.
+ * Tries to synthesize an ITranslationUnit out of thin air.
* @param uri the URU of the file in question
* @return a translation unit or null
*/
@@ -946,10 +852,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
return null;
}
- /*
- * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#disposeFileInfo(java.lang.Object,
- * org.eclipse.ui.editors.text.TextFileDocumentProvider.FileInfo)
- */
@Override
protected void disposeFileInfo(Object element, FileInfo info) {
if (info instanceof TranslationUnitInfo) {
@@ -1020,25 +922,17 @@ public class CDocumentProvider extends TextFileDocumentProvider {
}
}
- /*
- * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createSaveOperation(java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
- */
@Override
protected DocumentProviderOperation createSaveOperation(final Object element, final IDocument document,
final boolean overwrite) throws CoreException {
final FileInfo info= getFileInfo(element);
if (info instanceof TranslationUnitInfo) {
return new DocumentProviderOperation() {
- /*
- * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void execute(IProgressMonitor monitor) throws CoreException {
commitWorkingCopy(monitor, element, (TranslationUnitInfo) info, overwrite);
}
- /*
- * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule()
- */
+
@Override
public ISchedulingRule getSchedulingRule() {
if (info.fElement instanceof IFileEditorInput) {
@@ -1055,7 +949,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
/**
* Removes trailing whitespaces from changed lines and adds newline at the end of the file,
* if the last line of the file was changed.
- * @throws BadLocationException
+ * @throws BadLocationException
*/
private void performSaveActions(ITextFileBuffer buffer, IProgressMonitor monitor) throws CoreException {
if (shouldRemoveTrailingWhitespace() || shouldAddNewlineAtEof()) {
@@ -1099,7 +993,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
return PreferenceConstants.getPreferenceStore().getBoolean(
PreferenceConstants.REMOVE_TRAILING_WHITESPACE_LIMIT_TO_EDITED_LINES);
}
-
+
private static boolean needsChangedRegions() {
return shouldRemoveTrailingWhitespace() && isLimitedRemoveTrailingWhitespace();
}
@@ -1182,7 +1076,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
// }
// return true;
// }
-
+
/**
* Returns the preference whether handling temporary problems is enabled.
*/
@@ -1190,7 +1084,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
IPreferenceStore store= CUIPlugin.getDefault().getPreferenceStore();
return store.getBoolean(HANDLE_TEMPORARY_PROBLEMS);
}
-
+
/**
* Switches the state of problem acceptance according to the value in the preference store.
*/
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlighting.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlighting.java
index 570a59fd135..a58b7463bc6 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlighting.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlighting.java
@@ -10,7 +10,6 @@
* Anton Leherbauer (Wind River Systems) - Adapted for CDT
* Markus Schorn (Wind River Systems)
*******************************************************************************/
-
package org.eclipse.cdt.internal.ui.editor;
import org.eclipse.jface.resource.ColorRegistry;
@@ -26,7 +25,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
* @since 4.0
*/
public abstract class SemanticHighlighting {
-
/**
* @return the preference key, will be augmented by a prefix and a suffix for each preference
*/
@@ -126,5 +124,4 @@ public abstract class SemanticHighlighting {
return rgb;
return defaultRGB;
}
-
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java
index 73f17530039..1fd6bbada24 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java
@@ -9,7 +9,6 @@
* IBM Corporation - initial API and implementation
* Anton Leherbauer (Wind River Systems) - Adapted for CDT
*******************************************************************************/
-
package org.eclipse.cdt.internal.ui.editor;
import org.eclipse.core.runtime.CoreException;
@@ -74,117 +73,117 @@ public class SemanticHighlightings {
/**
* A named preference part that controls the highlighting of static fields.
*/
- public static final String STATIC_FIELD="staticField"; //$NON-NLS-1$
+ public static final String STATIC_FIELD= "staticField"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of fields.
*/
- public static final String FIELD="field"; //$NON-NLS-1$
+ public static final String FIELD= "field"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of method declarations.
*/
- public static final String METHOD_DECLARATION="methodDeclaration"; //$NON-NLS-1$
+ public static final String METHOD_DECLARATION= "methodDeclaration"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of static method invocations.
*/
- public static final String STATIC_METHOD_INVOCATION="staticMethod"; //$NON-NLS-1$
+ public static final String STATIC_METHOD_INVOCATION= "staticMethod"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of function declarations.
*/
- public static final String FUNCTION_DECLARATION="functionDeclaration"; //$NON-NLS-1$
+ public static final String FUNCTION_DECLARATION= "functionDeclaration"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of functions.
*/
- public static final String FUNCTION="function"; //$NON-NLS-1$
+ public static final String FUNCTION= "function"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of local variables.
*/
- public static final String LOCAL_VARIABLE_DECLARATION="localVariableDeclaration"; //$NON-NLS-1$
+ public static final String LOCAL_VARIABLE_DECLARATION= "localVariableDeclaration"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of local variable references.
*/
- public static final String LOCAL_VARIABLE="localVariable"; //$NON-NLS-1$
+ public static final String LOCAL_VARIABLE= "localVariable"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of global variables.
*/
- public static final String GLOBAL_VARIABLE="globalVariable"; //$NON-NLS-1$
+ public static final String GLOBAL_VARIABLE= "globalVariable"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of parameter variables.
*/
- public static final String PARAMETER_VARIABLE="parameterVariable"; //$NON-NLS-1$
+ public static final String PARAMETER_VARIABLE= "parameterVariable"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of template parameters.
*/
- public static final String TEMPLATE_PARAMETER="templateParameter"; //$NON-NLS-1$
+ public static final String TEMPLATE_PARAMETER= "templateParameter"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of methods.
*/
- public static final String METHOD="method"; //$NON-NLS-1$
+ public static final String METHOD= "method"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of classes.
*/
- public static final String CLASS="class"; //$NON-NLS-1$
+ public static final String CLASS= "class"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of enums.
*/
- public static final String ENUM="enum"; //$NON-NLS-1$
+ public static final String ENUM= "enum"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of macro references.
*/
- public static final String MACRO_REFERENCE="macroSubstitution"; //$NON-NLS-1$
+ public static final String MACRO_REFERENCE= "macroSubstitution"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of macro definitions.
*/
- public static final String MACRO_DEFINITION="macroDefinition"; //$NON-NLS-1$
+ public static final String MACRO_DEFINITION= "macroDefinition"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of typedefs.
*/
- public static final String TYPEDEF="typedef"; //$NON-NLS-1$
+ public static final String TYPEDEF= "typedef"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of namespaces.
*/
- public static final String NAMESPACE="namespace"; //$NON-NLS-1$
+ public static final String NAMESPACE= "namespace"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of labels.
*/
- public static final String LABEL="label"; //$NON-NLS-1$
+ public static final String LABEL= "label"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of enumerators.
*/
- public static final String ENUMERATOR="enumerator"; //$NON-NLS-1$
+ public static final String ENUMERATOR= "enumerator"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of problems.
*/
- public static final String PROBLEM="problem"; //$NON-NLS-1$
+ public static final String PROBLEM= "problem"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of external SDK.
*/
- public static final String EXTERNAL_SDK="externalSDK"; //$NON-NLS-1$
+ public static final String EXTERNAL_SDK= "externalSDK"; //$NON-NLS-1$
/**
* A named preference part that controls the highlighting of operators that have been overloaded.
*/
- public static final String OVERLOADED_OPERATOR="overloadedOperator"; //$NON-NLS-1$
+ public static final String OVERLOADED_OPERATOR= "overloadedOperator"; //$NON-NLS-1$
/** Init debugging mode */
@@ -199,63 +198,41 @@ public class SemanticHighlightings {
* Semantic highlighting for static fields.
*/
private static final class StaticFieldHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return STATIC_FIELD;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(0, 0, 192);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_staticField;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name instanceof ICPPASTQualifiedName && name.isReference()) {
return false;
}
@@ -272,63 +249,41 @@ public class SemanticHighlightings {
* Semantic highlighting for fields.
*/
private static final class FieldHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return FIELD;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(0, 0, 192);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_field;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name instanceof ICPPASTQualifiedName && name.isReference()) {
return false;
}
@@ -345,58 +300,36 @@ public class SemanticHighlightings {
* Semantic highlighting for method declarations.
*/
private static final class MethodDeclarationHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return METHOD_DECLARATION;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_methodDeclaration;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
@@ -404,7 +337,7 @@ public class SemanticHighlightings {
return false;
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (!name.isReference()) {
IBinding binding= token.getBinding();
if (binding instanceof ICPPMethod) {
@@ -417,7 +350,7 @@ public class SemanticHighlightings {
}
if (node instanceof ICPPASTFunctionDeclarator) {
if (name instanceof ICPPASTQualifiedName) {
- ICPPASTQualifiedName qName= (ICPPASTQualifiedName)name;
+ ICPPASTQualifiedName qName= (ICPPASTQualifiedName) name;
IASTName[] names= qName.getNames();
if (names.length > 1) {
if (names[names.length - 2].getBinding() instanceof ICPPClassType) {
@@ -444,63 +377,41 @@ public class SemanticHighlightings {
* Semantic highlighting for static method invocations.
*/
private static final class StaticMethodInvocationHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return STATIC_METHOD_INVOCATION;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_staticMethodInvocation;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name instanceof ICPPASTQualifiedName) {
return false;
}
@@ -509,7 +420,7 @@ public class SemanticHighlightings {
}
IBinding binding= token.getBinding();
if (binding instanceof ICPPMethod && !(binding instanceof IProblemBinding)) {
- return ((ICPPMethod)binding).isStatic();
+ return ((ICPPMethod) binding).isStatic();
}
}
return false;
@@ -520,65 +431,43 @@ public class SemanticHighlightings {
* Semantic highlighting for methods.
*/
private static final class MethodHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return METHOD;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_method;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTImplicitName)
return false;
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name instanceof ICPPASTQualifiedName && name.isReference()) {
return false;
}
@@ -589,65 +478,42 @@ public class SemanticHighlightings {
}
return false;
}
-
}
/**
* Semantic highlighting for function declarations.
*/
private static final class FunctionDeclarationHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return FUNCTION_DECLARATION;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_functionDeclaration;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
@@ -655,11 +521,10 @@ public class SemanticHighlightings {
return false;
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name.isDeclaration()) {
IBinding binding= token.getBinding();
- if (binding instanceof IFunction
- && !(binding instanceof ICPPMethod)) {
+ if (binding instanceof IFunction && !(binding instanceof ICPPMethod)) {
return true;
} else if (binding instanceof IProblemBinding) {
// try to derive from AST
@@ -690,65 +555,43 @@ public class SemanticHighlightings {
* Semantic highlighting for functions.
*/
private static final class FunctionHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return FUNCTION;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_function;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTImplicitName)
return false;
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name instanceof ICPPASTQualifiedName && name.isReference()) {
return false;
}
@@ -765,63 +608,41 @@ public class SemanticHighlightings {
* Semantic highlighting for local variable declarations.
*/
private static final class LocalVariableDeclarationHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return LOCAL_VARIABLE_DECLARATION;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(128, 0, 0);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_localVariableDeclaration;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name.isDeclaration()) {
IBinding binding= token.getBinding();
if (binding instanceof IVariable
@@ -841,70 +662,47 @@ public class SemanticHighlightings {
}
return false;
}
-
-}
+ }
/**
* Semantic highlighting for local variables.
*/
private static final class LocalVariableHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return LOCAL_VARIABLE;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_localVariable;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name.isReference()) {
IBinding binding= token.getBinding();
if (binding instanceof IVariable
@@ -940,69 +738,47 @@ public class SemanticHighlightings {
}
return false;
}
-}
+ }
/**
* Semantic highlighting for global variables.
*/
private static final class GlobalVariableHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return GLOBAL_VARIABLE;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_globalVariable;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name instanceof ICPPASTQualifiedName) {
return false;
}
@@ -1024,65 +800,42 @@ public class SemanticHighlightings {
}
return false;
}
-
}
/**
* Semantic highlighting for parameter variables.
*/
private static final class ParameterVariableHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return PARAMETER_VARIABLE;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_parameterVariable;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IBinding binding= token.getBinding();
@@ -1097,58 +850,36 @@ public class SemanticHighlightings {
* Semantic highlighting for template parameters.
*/
private static final class TemplateParameterHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return TEMPLATE_PARAMETER;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(100, 70, 50);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_templateParameter;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
@@ -1166,58 +897,36 @@ public class SemanticHighlightings {
* Semantic highlighting for classes.
*/
private static final class ClassHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return CLASS;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(0, 80, 50);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_classes;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
@@ -1238,58 +947,36 @@ public class SemanticHighlightings {
* Semantic highlighting for enums.
*/
private static final class EnumHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return ENUM;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(100, 70, 50);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_enums;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
@@ -1307,58 +994,36 @@ public class SemanticHighlightings {
* Semantic highlighting for macro references.
*/
private static final class MacroReferenceHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return MACRO_REFERENCE;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_macroSubstitution;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IBinding binding= token.getBinding();
@@ -1376,58 +1041,36 @@ public class SemanticHighlightings {
* Semantic highlighting for macro definitions.
*/
private static final class MacroDefinitionHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return MACRO_DEFINITION;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_macroDefintion;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IBinding binding= token.getBinding();
@@ -1445,63 +1088,41 @@ public class SemanticHighlightings {
* Semantic highlighting for typedefs.
*/
private static final class TypedefHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return TYPEDEF;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(0, 80, 50);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_typeDef;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name instanceof ICPPASTQualifiedName) {
return false;
}
@@ -1518,58 +1139,36 @@ public class SemanticHighlightings {
* Semantic highlighting for namespaces.
*/
private static final class NamespaceHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return NAMESPACE;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_namespace;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IBinding binding= token.getBinding();
@@ -1584,58 +1183,36 @@ public class SemanticHighlightings {
* Semantic highlighting for labels.
*/
private static final class LabelHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return LABEL;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return RGB_BLACK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_label;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IBinding binding= token.getBinding();
@@ -1650,63 +1227,41 @@ public class SemanticHighlightings {
* Semantic highlighting for enumerators.
*/
private static final class EnumeratorHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return ENUMERATOR;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(0, 0, 192);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_enumerator;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name instanceof ICPPASTQualifiedName) {
return false;
}
@@ -1723,69 +1278,48 @@ public class SemanticHighlightings {
* Semantic highlighting for problems.
*/
private static final class ProblemHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return PROBLEM;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(224, 0, 0);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isStrikethroughByDefault()
- */
@Override
public boolean isStrikethroughByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_problem;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
+ if (node.getTranslationUnit().isBasedOnIncompleteIndex()) {
+ // Do not highlight problems is the AST is unreliable.
+ return false;
+ }
if (node instanceof IASTProblem) {
return true;
}
@@ -1801,71 +1335,46 @@ public class SemanticHighlightings {
* Semantic highlighting for external SDK references.
*/
private static final class ExternalSDKHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return EXTERNAL_SDK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(100, 40, 128);
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isStrikethroughByDefault()
- */
@Override
public boolean isStrikethroughByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return true;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_externalSDK;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node= token.getNode();
if (node instanceof IASTName) {
- IASTName name= (IASTName)node;
+ IASTName name= (IASTName) node;
if (name instanceof ICPPASTQualifiedName) {
return false;
}
@@ -1915,69 +1424,46 @@ public class SemanticHighlightings {
* Semantic highlighting for functions.
*/
private static final class OverloadedOperatorHighlighting extends SemanticHighlighting {
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
- */
@Override
public String getPreferenceKey() {
return OVERLOADED_OPERATOR;
}
-
@Override
public boolean requiresImplicitNames() {
return true;
}
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
- */
@Override
public RGB getDefaultDefaultTextColor() {
return new RGB(200, 100, 0); // orange
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
- */
@Override
public boolean isBoldByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
- */
@Override
public boolean isItalicByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
- */
@Override
public boolean isEnabledByDefault() {
return false;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
- */
@Override
public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_overloadedOperators;
}
- /*
- * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
- */
@Override
public boolean consumes(SemanticToken token) {
IASTNode node = token.getNode();
- // so far we only have implicit names for overloaded operators and destructors, so this works
+ // So far we only have implicit names for overloaded operators and destructors,
+ // so this works.
if (node instanceof IASTImplicitName) {
IASTImplicitName name = (IASTImplicitName) node;
if (name.isReference() && name.isOperator()) {
@@ -2159,16 +1645,14 @@ public class SemanticHighlightings {
return false;
}
SemanticHighlighting[] highlightings= getSemanticHighlightings();
- boolean enable= false;
for (SemanticHighlighting highlighting : highlightings) {
String enabledKey= getEnabledPreferenceKey(highlighting);
if (store.getBoolean(enabledKey)) {
- enable= true;
- break;
+ return true;
}
}
- return enable;
+ return false;
}
/**
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/wizban/advtosettings_wiz.png b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/wizban/advtosettings_wiz.png
new file mode 100755
index 00000000000..7229ca07fd3
Binary files /dev/null and b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/wizban/advtosettings_wiz.png differ
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml
index 9e68fbd126c..62f27c7673e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml
@@ -475,4 +475,13 @@
+ "org.eclipse.cdt.dsf.gdb.ui"
).
+ */
+ public static final String PLUGIN_ID = GdbUIPlugin.PLUGIN_ID;
+
+ /** image identifier. */
+ public static final String IMG_WIZBAN_ADVANCED_TIMEOUT_SETTINGS = PLUGIN_ID + ".imageAdvancedTimeoutSettings"; //$NON-NLS-1$
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java
new file mode 100644
index 00000000000..1b8f0f53bd2
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mentor Graphics and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mentor Graphics - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.internal.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ public static String GdbStatusHandler_Error;
+
+ public static String GdbStatusHandler_Information;
+
+ public static String GdbStatusHandler_Warning;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages( Messages.class.getName(), Messages.class );
+ }
+
+ private Messages() {
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.properties
new file mode 100644
index 00000000000..765b50e87aa
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.properties
@@ -0,0 +1,14 @@
+#######################################################################################
+# Copyright (c) 2012 Mentor Graphics and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Mentor Graphics - Initial API and implementation
+#######################################################################################
+
+GdbStatusHandler_Error=Error
+GdbStatusHandler_Information=Information
+GdbStatusHandler_Warning=Warning
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
index 7277956d3f1..e6d688d2b56 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
@@ -13,25 +13,62 @@
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.cdt.dsf.debug.internal.ui.preferences.IntegerWithBooleanFieldEditor;
import org.eclipse.cdt.dsf.debug.internal.ui.preferences.StringWithBooleanFieldEditor;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
-import org.eclipse.cdt.dsf.gdb.internal.ui.launching.LaunchUIMessages;
+import org.eclipse.cdt.dsf.gdb.internal.ui.IGdbUIConstants;
+import org.eclipse.cdt.dsf.gdb.service.command.CustomTimeoutsMap;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.ICellEditorListener;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
@@ -41,6 +78,7 @@ import org.eclipse.ui.PlatformUI;
*/
@SuppressWarnings("restriction")
public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
/**
* A vehicle in order to be able to register a selection listener with
* a {@link BooleanFieldEditor}.
@@ -58,20 +96,428 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
}
}
+ class AdvancedTimeoutSettingsDialog extends TitleAreaDialog {
+
+ class CommandTimeoutEntry {
+
+ String fCommand;
+ Integer fTimeout;
+
+ CommandTimeoutEntry( String command, Integer timeout ) {
+ fCommand = command;
+ fTimeout = timeout;
+ }
+ }
+
+ class CellEditorListener implements ICellEditorListener {
+
+ CellEditor fEditor;
+
+ public CellEditorListener( CellEditor editor ) {
+ super();
+ fEditor = editor;
+ }
+
+ @Override
+ public void editorValueChanged( boolean oldValidState, boolean newValidState ) {
+ if ( newValidState ) {
+ setErrorMessage( null );
+ }
+ else {
+ setErrorMessage( fEditor.getErrorMessage() );
+ }
+ updateDialogButtons();
+ }
+
+ @Override
+ public void cancelEditor() {
+ }
+
+ @Override
+ public void applyEditorValue() {
+ validate();
+ updateDialogButtons();
+ }
+ };
+
+ abstract class AbstractEditingSupport extends EditingSupport {
+
+ public AbstractEditingSupport( ColumnViewer viewer ) {
+ super( viewer );
+ }
+
+ @Override
+ protected void setValue( Object element, Object value ) {
+ if ( element instanceof CommandTimeoutEntry && value instanceof String ) {
+ if ( processValue( (CommandTimeoutEntry)element, (String)value ) ) {
+ fViewer.refresh( element );
+ validate();
+ updateDialogButtons();
+ }
+ }
+ }
+
+ @Override
+ protected Object getValue( Object element ) {
+ if ( element instanceof CommandTimeoutEntry ) {
+ return doGetValue( (CommandTimeoutEntry)element );
+ }
+ return null;
+ }
+
+ @Override
+ protected CellEditor getCellEditor( Object element ) {
+ final CellEditor editor = new TextCellEditor( (Composite)getViewer().getControl() );
+ editor.setValidator( getValidator() );
+ editor.addListener( new CellEditorListener( editor ) );
+ return editor;
+ }
+
+ @Override
+ protected boolean canEdit( Object element ) {
+ return ( element instanceof CommandTimeoutEntry );
+ }
+
+ abstract boolean processValue( CommandTimeoutEntry entry, String value );
+
+ abstract Object doGetValue( CommandTimeoutEntry entry );
+
+ abstract ICellEditorValidator getValidator();
+ };
+
+ private TableViewer fViewer;
+ private Button fAddButton;
+ private Button fDeleteButton;
+
+ private Listtrue
.
@@ -87,8 +92,27 @@ public interface IGdbDebugPreferenceConstants {
public static final String PREF_DEFAULT_NON_STOP = "defaultNonStop"; //$NON-NLS-1$
/**
- * Help prefixes.
- */
- public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
+ * The value is an boolean specifying whether the timeout is used for GDB commands.
+ * @since 4.1
+ */
+ public static final String PREF_COMMAND_TIMEOUT = PREFIX + "commandTimeout"; //$NON-NLS-1$
+
+ /**
+ * The value is an integer specifying the timeout value (milliseconds) for GDB commands.
+ * @since 4.1
+ */
+ public static final String PREF_COMMAND_TIMEOUT_VALUE = PREFIX + "commandTimeoutValue"; //$NON-NLS-1$
+
+ /**
+ * The value is a string specifying the list of GDB/MI commands with custom timeout values.
+ * @since 4.1
+ */
+ public static final String PREF_COMMAND_CUSTOM_TIMEOUTS = PREFIX + "commandCustomTimeouts"; //$NON-NLS-1$
+
+ /**
+ * Default default value for PREF_COMMAND_TIMEOUT
;
+ * @since 4.1
+ */
+ public static final int COMMAND_TIMEOUT_VALUE_DEFAULT = 10000;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
index e9403f12ba9..92d0a08d776 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
@@ -38,5 +38,7 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false);
+ node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java
new file mode 100644
index 00000000000..ee19d3c3678
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mentor Graphics and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mentor Graphics - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ public static String CustomTimeoutsMap_Error_initializing_custom_timeouts;
+
+ public static String CustomTimeoutsMap_Invalid_custom_timeout_data;
+
+ public static String CustomTimeoutsMap_Invalid_custom_timeout_value;
+
+ public static String GDBControl_Session_is_terminated;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages( Messages.class.getName(), Messages.class );
+ }
+
+ private Messages() {
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.properties
new file mode 100644
index 00000000000..9a4e8c3dbbe
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.properties
@@ -0,0 +1,15 @@
+#######################################################################################
+# Copyright (c) 2011 Mentor Graphics and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Mentor Graphics - Initial API and implementation
+#######################################################################################
+
+CustomTimeoutsMap_Error_initializing_custom_timeouts=Error initializing custom timeouts
+CustomTimeoutsMap_Invalid_custom_timeout_data=Invalid custom timeout data.
+CustomTimeoutsMap_Invalid_custom_timeout_value=Invalid custom timeout value for '%s'.
+GDBControl_Session_is_terminated=Session is terminated.\nReason: %s
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
index 490f50e54e6..60eb549a3e8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
@@ -449,9 +449,9 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
return (threadState == null) ? false : !fTerminated && threadState.fSuspended;
}
- // Container case. The container is considered suspended as long
+ // Process case. The process is considered suspended as long
// as one of its thread is suspended
- if (context instanceof IContainerDMContext) {
+ if (context instanceof IMIContainerDMContext) {
boolean hasThread = false;
for (IMIExecutionDMContext threadContext : fThreadRunStates.keySet()) {
if (DMContexts.isAncestorOf(threadContext, context)) {
@@ -471,39 +471,34 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
@Override
public void canSuspend(IExecutionDMContext context, DataRequestMonitorfInitializationSequence
can not be used for this
+ * purpose because there is a period of time when the service is already
+ * initializing but the initialization sequence has not created yet.
+ */
+ private boolean fInitialized = false;
private boolean fTerminated;
@@ -308,6 +343,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
@Override
protected void handleCompleted() {
fInitializationSequence = null;
+ fInitialized = true;
if (!isCanceled()) {
// Only set the status if the user has not cancelled the operation already.
rm.setStatus(getStatus());
@@ -440,6 +476,33 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
}
}
+ /**
+ * @since 4.1
+ */
+ protected class CommandTimeoutStep extends InitializationShutdownStep {
+ CommandTimeoutStep( Direction direction ) {
+ super( direction );
+ }
+
+ @Override
+ public void initialize( final RequestMonitor requestMonitor ) {
+ fCommandTimeoutManager = createCommandTimeoutManager( GDBControl.this );
+ if (fCommandTimeoutManager != null) {
+ fCommandTimeoutManager.addCommandTimeoutListener(fTimeoutListener);
+ }
+ requestMonitor.done();
+ }
+
+ @Override
+ protected void shutdown( RequestMonitor requestMonitor ) {
+ if ( fCommandTimeoutManager != null ) {
+ fCommandTimeoutManager.removeCommandTimeoutListener(fTimeoutListener);
+ fCommandTimeoutManager.dispose();
+ }
+ requestMonitor.done();
+ }
+ }
+
protected class RegisterStep extends InitializationShutdownStep {
RegisterStep(Direction direction) { super(direction); }
@Override
@@ -493,6 +556,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
final Sequence.Step[] initializeSteps = new Sequence.Step[] {
new CommandMonitoringStep(InitializationShutdownStep.Direction.INITIALIZING),
new CommandProcessorsStep(InitializationShutdownStep.Direction.INITIALIZING),
+ new CommandTimeoutStep(InitializationShutdownStep.Direction.INITIALIZING),
new RegisterStep(InitializationShutdownStep.Direction.INITIALIZING),
};
@@ -507,6 +571,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
protected Sequence getShutdownSequence(RequestMonitor requestMonitor) {
final Sequence.Step[] shutdownSteps = new Sequence.Step[] {
new RegisterStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
+ new CommandTimeoutStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
new CommandProcessorsStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
new CommandMonitoringStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
};
@@ -536,4 +601,63 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
fFeatures.clear();
fFeatures.addAll(features);
}
+
+ /**
+ * @since 4.1
+ */
+ protected GdbCommandTimeoutManager createCommandTimeoutManager(ICommandControl commandControl) {
+ GdbCommandTimeoutManager manager = new GdbCommandTimeoutManager(commandControl);
+ manager.initialize();
+ return manager;
+ }
+
+ /**
+ * @since 4.1
+ */
+ @ConfinedToDsfExecutor("this.getExecutor()")
+ protected void commandTimedOut(ICommandToken token) {
+ String commandText = token.getCommand().toString();
+ if (commandText.endsWith("\n")) //$NON-NLS-1$
+ commandText = commandText.substring(0, commandText.length() - 1);
+ final String errorMessage = String.format("Command '%s' is timed out", commandText); //$NON-NLS-1$
+ commandFailed(token, STATUS_CODE_COMMAND_TIMED_OUT, errorMessage);
+
+ // If the timeout occurs while the launch sequence is running
+ // the error will be reported by the launcher's error reporting mechanism.
+ // We need to show the error message only when the session is initialized.
+ if (isInitialized()) {
+ // The session is terminated if a command is timed out.
+ terminate(new RequestMonitor(getExecutor(), null) {
+
+ @Override
+ protected void handleErrorOrWarning() {
+ GdbPlugin.getDefault().getLog().log(getStatus());
+ super.handleErrorOrWarning();
+ };
+ } );
+
+ IStatus status = new Status(
+ IStatus.ERROR,
+ GdbPlugin.PLUGIN_ID,
+ IGdbDebugConstants.STATUS_HANDLER_CODE,
+ String.format( Messages.GDBControl_Session_is_terminated, errorMessage ),
+ null);
+ IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(status);
+ if (statusHandler != null) {
+ try {
+ statusHandler.handleStatus(status, null);
+ }
+ catch(CoreException e) {
+ GdbPlugin.getDefault().getLog().log(e.getStatus());
+ }
+ }
+ }
+ }
+
+ /**
+ * @since 4.1
+ */
+ protected boolean isInitialized() {
+ return fInitialized;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java
index 3a780424602..55f4aa15860 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java
@@ -147,6 +147,7 @@ public class GDBControl_7_0 extends GDBControl {
final Sequence.Step[] initializeSteps = new Sequence.Step[] {
new GDBControl.CommandMonitoringStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
new GDBControl.CommandProcessorsStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
+ new CommandTimeoutStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
new ListFeaturesStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
new GDBControl.RegisterStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
};
@@ -161,6 +162,7 @@ public class GDBControl_7_0 extends GDBControl {
final Sequence.Step[] shutdownSteps = new Sequence.Step[] {
new GDBControl.RegisterStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
new ListFeaturesStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
+ new CommandTimeoutStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
new GDBControl.CommandProcessorsStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
new GDBControl.CommandMonitoringStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
};
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java
new file mode 100644
index 00000000000..133865c1a95
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java
@@ -0,0 +1,443 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mentor Graphics and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mentor Graphics - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.service.command;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.eclipse.cdt.dsf.debug.service.command.ICommand;
+import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
+import org.eclipse.cdt.dsf.debug.service.command.ICommandListener;
+import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
+import org.eclipse.cdt.dsf.debug.service.command.ICommandToken;
+import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
+import org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl;
+import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+
+/**
+ * The command timeout manager registers itself as a command listener and monitors
+ * the command execution time. The goal of this implementation is to gracefully
+ * handle disruptions in the communication between Eclipse and GDB.
+ *
+ * The algorithm used by this class is based on the assumption that the command
+ * execution in GDB is sequential even though DSF can send up to 3 commands at
+ * a time to GDB (see {@link AbstractMIControl}).
+ *
+ * @since 4.1
+ */
+public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceChangeListener {
+
+ public interface ICommandTimeoutListener {
+
+ void commandTimedOut( ICommandToken token );
+ }
+
+ public final static boolean DEBUG = "true".equals( Platform.getDebugOption( "org.eclipse.cdt.dsf.gdb/debug/timeouts" ) ); //$NON-NLS-1$//$NON-NLS-2$
+
+ private class QueueEntry {
+ private long fTimestamp;
+ private ICommandToken fCommandToken;
+
+ private QueueEntry( long timestamp, ICommandToken commandToken ) {
+ super();
+ fTimestamp = timestamp;
+ fCommandToken = commandToken;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if ( obj instanceof QueueEntry ) {
+ return fCommandToken.equals( ((QueueEntry)obj).fCommandToken );
+ }
+ return false;
+ }
+ }
+
+ private enum TimerThreadState {
+ INITIALIZING,
+ RUNNING,
+ HALTED,
+ SHUTDOWN
+ }
+
+ private class TimerThread extends Thread {
+
+ private BlockingQueueEclipse Public License - v 1.0 +
+ +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER +THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, +REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE +OF THIS AGREEMENT.
+ +1. DEFINITIONS
+ +"Contribution" means:
+ +a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
i) +changes to the Program, and
+ +ii) +additions to the Program;
+ +where +such changes and/or additions to the Program originate from and are distributed +by that particular Contributor. A Contribution 'originates' from a Contributor +if it was added to the Program by such Contributor itself or anyone acting on +such Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in conjunction +with the Program under their own license agreement, and (ii) are not derivative +works of the Program.
+ +"Contributor" means any person or +entity that distributes the Program.
+ +"Licensed Patents " mean patent +claims licensable by a Contributor which are necessarily infringed by the use +or sale of its Contribution alone or when combined with the Program.
+ +"Program" means the Contributions +distributed in accordance with this Agreement.
+ +"Recipient" means anyone who +receives the Program under this Agreement, including all Contributors.
+ +2. GRANT OF RIGHTS
+ +a) +Subject to the terms of this Agreement, each Contributor hereby grants Recipient +a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly +display, publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and object code +form.
+ +b) +Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free +patent license under Licensed Patents to make, use, sell, offer to sell, import +and otherwise transfer the Contribution of such Contributor, if any, in source +code and object code form. This patent license shall apply to the combination +of the Contribution and the Program if, at the time the Contribution is added +by the Contributor, such addition of the Contribution causes such combination +to be covered by the Licensed Patents. The patent license shall not apply to +any other combinations which include the Contribution. No hardware per se is +licensed hereunder.
+ +c) +Recipient understands that although each Contributor grants the licenses to its +Contributions set forth herein, no assurances are provided by any Contributor +that the Program does not infringe the patent or other intellectual property +rights of any other entity. Each Contributor disclaims any liability to Recipient +for claims brought by any other entity based on infringement of intellectual +property rights or otherwise. As a condition to exercising the rights and +licenses granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For example, +if a third party patent license is required to allow Recipient to distribute +the Program, it is Recipient's responsibility to acquire that license before +distributing the Program.
+ +d) +Each Contributor represents that to its knowledge it has sufficient copyright +rights in its Contribution, if any, to grant the copyright license set forth in +this Agreement.
+ +3. REQUIREMENTS
+ +A Contributor may choose to distribute the +Program in object code form under its own license agreement, provided that: +
+ +a) +it complies with the terms and conditions of this Agreement; and
+ +b) +its license agreement:
+ +i) +effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title +and non-infringement, and implied warranties or conditions of merchantability +and fitness for a particular purpose;
+ +ii) +effectively excludes on behalf of all Contributors all liability for damages, +including direct, indirect, special, incidental and consequential damages, such +as lost profits;
+ +iii) +states that any provisions which differ from this Agreement are offered by that +Contributor alone and not by any other party; and
+ +iv) +states that source code for the Program is available from such Contributor, and +informs licensees how to obtain it in a reasonable manner on or through a +medium customarily used for software exchange.
+ +When the Program is made available in source +code form:
+ +a) +it must be made available under this Agreement; and
+ +b) a +copy of this Agreement must be included with each copy of the Program.
+ +Contributors may not remove or alter any +copyright notices contained within the Program.
+ +Each Contributor must identify itself as the +originator of its Contribution, if any, in a manner that reasonably allows +subsequent Recipients to identify the originator of the Contribution.
+ +4. COMMERCIAL DISTRIBUTION
+ +Commercial distributors of software may +accept certain responsibilities with respect to end users, business partners +and the like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes the +Program in a commercial product offering, such Contributor ("Commercial +Contributor") hereby agrees to defend and indemnify every other +Contributor ("Indemnified Contributor") against any losses, damages and +costs (collectively "Losses") arising from claims, lawsuits and other +legal actions brought by a third party against the Indemnified Contributor to +the extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor +to control, and cooperate with the Commercial Contributor in, the defense and +any related settlement negotiations. The Indemnified Contributor may participate +in any such claim at its own expense.
+ +For example, a Contributor might include the +Program in a commercial product offering, Product X. That Contributor is then a +Commercial Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance claims and +warranties are such Commercial Contributor's responsibility alone. Under this +section, the Commercial Contributor would have to defend claims against the +other Contributors related to those performance claims and warranties, and if a +court requires any other Contributor to pay any damages as a result, the +Commercial Contributor must pay those damages.
+ +5. NO WARRANTY
+ +EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, +WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and distributing the +Program and assumes all risks associated with its exercise of rights under this +Agreement , including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations.
+ +6. DISCLAIMER OF LIABILITY
+ +EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF +THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGES.
+ +7. GENERAL
+ +If any provision of this Agreement is invalid +or unenforceable under applicable law, it shall not affect the validity or +enforceability of the remainder of the terms of this Agreement, and without +further action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable.
+ +If Recipient institutes patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Program itself (excluding combinations of the Program with +other software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the date +such litigation is filed.
+ +All Recipient's rights under this Agreement +shall terminate if it fails to comply with any of the material terms or +conditions of this Agreement and does not cure such failure in a reasonable +period of time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive.
+ +Everyone is permitted to copy and distribute +copies of this Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The Agreement +Steward reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement Steward has +the right to modify this Agreement. The Eclipse Foundation is the initial +Agreement Steward. The Eclipse Foundation may assign the responsibility to +serve as the Agreement Steward to a suitable separate entity. Each new version +of the Agreement will be given a distinguishing version number. The Program +(including Contributions) may always be distributed subject to the version of +the Agreement under which it was received. In addition, after a new version of +the Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly stated +in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to +the intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved.
+ +This Agreement is governed by the laws of the +State of New York and the intellectual property laws of the United States of +America. No party to this Agreement will bring a legal action under this +Agreement more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation.
+ +