From e8c0bd4d43a600e545927fc635aaf191e8eeb82b Mon Sep 17 00:00:00 2001
From: Sergey Prigogin
Date: Tue, 16 Oct 2012 14:17:26 -0700
Subject: [PATCH 01/25] Cosmetics
---
.../core/pdom/dom/cpp/PDOMCPPField.java | 30 +++++++------------
1 file changed, 11 insertions(+), 19 deletions(-)
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java
index 9e09aeb0c02..05df01ad089 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java
@@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * QNX - Initial API and implementation
- * IBM Corporation
- * Markus Schorn (Wind River Systems)
+ * QNX - Initial API and implementation
+ * IBM Corporation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@@ -22,31 +22,28 @@ import org.eclipse.core.runtime.CoreException;
/**
* @author Doug Schaefer
- *
*/
class PDOMCPPField extends PDOMCPPVariable implements ICPPField {
-
+
public PDOMCPPField(PDOMLinkage linkage, PDOMNode parent, ICPPField field)
throws CoreException {
super(linkage, parent, field);
- }
+ }
public PDOMCPPField(PDOMLinkage linkage, long bindingRecord) {
super(linkage, bindingRecord);
}
- // @Override
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
-
- // @Override
+
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPFIELD;
}
-
+
@Override
public ICPPClassType getClassOwner() {
return (ICPPClassType) getOwner();
@@ -57,37 +54,32 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField {
return PDOMCPPAnnotation.getVisibility(getByte(record + ANNOTATIONS));
}
- // @Override
@Override
public boolean isMutable() {
return getBit(getByte(record + ANNOTATIONS), PDOMCPPAnnotation.MUTABLE_OFFSET);
}
- // @Override
@Override
public boolean isAuto() {
// ISO/IEC 14882:2003 9.2.6
- return false;
+ return false;
}
- // @Override
@Override
public boolean isExtern() {
// ISO/IEC 14882:2003 9.2.6
- return false;
+ return false;
}
- // @Override
@Override
public boolean isExternC() {
- return false;
+ return false;
}
- // @Override
@Override
public boolean isRegister() {
// ISO/IEC 14882:2003 9.2.6
- return false;
+ return false;
}
@Override
From d5f793f01d4816bed2aa493c2fc1399fc3aa652e Mon Sep 17 00:00:00 2001
From: Sergey Prigogin
Date: Tue, 16 Oct 2012 14:46:15 -0700
Subject: [PATCH 02/25] Similar preference API between cdt.core and cdt.ui
---
.../cdt/core/CCorePreferenceConstants.java | 135 ++++++++++--
.../eclipse/cdt/ui/PreferenceConstants.java | 207 +++++++++---------
2 files changed, 226 insertions(+), 116 deletions(-)
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java
index ccd22d28084..2f5760fe1f1 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java
@@ -1,25 +1,33 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 QNX Software Systems and others.
+ * Copyright (c) 2000, 2012 QNX Software Systems 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:
* QNX Software Systems - Initial API and implementation
* Markus Schorn (Wind River Systems)
- * Sergey Prigogin (Google)
+ * Sergey Prigogin (Google)
* IBM Corporation
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
*******************************************************************************/
package org.eclipse.cdt.core;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+
/**
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class CCorePreferenceConstants {
-
/**
*
* RECOGNIZED OPTIONS:
@@ -33,9 +41,9 @@ public class CCorePreferenceConstants {
* by a letter or digit to be recognized ("ToDofoo" will not be recognized as a task for tag "ToDo", but "ToDo:foo" will
* be detected either for tag "ToDo" or "ToDo:").
* - option id: "org.eclipse.cdt.core.taskTags"
- * - possible values: { "[,]*" } where is a String without any wild-card or leading/trailing spaces
+ * - possible values: { "[,]*" } where is a String without any wild-card or leading/trailing spaces
* - default: ""
- *
+ *
* Define the Automatic Task Priorities
* In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
* of the task markers issued by the translation.
@@ -54,17 +62,17 @@ public class CCorePreferenceConstants {
* Default task tag
*/
public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$
-
+
/**
* List of tags provided by default
* @since 5.1
*/
public static final String DEFAULT_TASK_TAGS = DEFAULT_TASK_TAG + ",FIXME,XXX"; //$NON-NLS-1$
-
+
/**
* Possible configurable option value for TODO_TASK_PRIORITIES.
*/
- public static final String TASK_PRIORITY_NORMAL = "normal"; //$NON-NLS-1$
+ public static final String TASK_PRIORITY_NORMAL = "normal"; //$NON-NLS-1$
/**
* Possible configurable option value for TODO_TASK_PRIORITIES.
*/
@@ -97,7 +105,7 @@ public class CCorePreferenceConstants {
* Active code formatter ID.
*/
public static final String CODE_FORMATTER = CCorePlugin.PLUGIN_ID + ".code_formatter"; //$NON-NLS-1$
-
+
/**
* Default code formatter
*/
@@ -117,7 +125,7 @@ public class CCorePreferenceConstants {
* Absolute maximum size of the index-db in megabytes.
*/
public static final String MAX_INDEX_DB_CACHE_SIZE_MB = CCorePlugin.PLUGIN_ID + ".maxIndexDBCacheSizeMB"; //$NON-NLS-1$
-
+
/**
* Default absolute maximum size of the index-db in megabytes.
*/
@@ -131,7 +139,7 @@ public class CCorePreferenceConstants {
public static final String FILE_PATH_CANONICALIZATION = CCorePlugin.PLUGIN_ID + ".path_canonicalization"; //$NON-NLS-1$
/**
- * Workspace-wide language mappings.
+ * Workspace-wide language mappings.
*/
public static final String WORKSPACE_LANGUAGE_MAPPINGS = CCorePlugin.PLUGIN_ID + ".workspaceLanguageMappings"; //$NON-NLS-1$
@@ -144,7 +152,7 @@ public class CCorePreferenceConstants {
* Attempt to show source files for executable binaries.
*/
public static final String SHOW_SOURCE_FILES_IN_BINARIES = CCorePlugin.PLUGIN_ID + ".showSourceFilesInBinaries"; //$NON-NLS-1$
-
+
/**
* Show source roots at the top level of projects.
* @since 5.2
@@ -153,17 +161,110 @@ public class CCorePreferenceConstants {
/**
* "Build All Configurations" preference key.
- *
+ *
* @since 5.3
*/
public static final String PREF_BUILD_ALL_CONFIGS = "build.all.configs.enabled"; //$NON-NLS-1$
/**
* Preference key for "build only if resources in (related) projects are modified".
- *
+ *
* @since 5.3
*/
public static final String PREF_BUILD_CONFIGS_RESOURCE_CHANGES = "build.proj.ref.configs.enabled"; //$NON-NLS-1$
-
-
+
+
+ /**
+ * Returns the node in the preference in the given context.
+ * @param key The preference key.
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should
+ * be avoided.
+ * @return Returns the node matching the given context.
+ */
+ private static IEclipsePreferences getPreferenceNode(String key, ICProject project) {
+ IEclipsePreferences node = null;
+
+ if (project != null) {
+ node = new ProjectScope(project.getProject()).getNode(CCorePlugin.PLUGIN_ID);
+ if (node.get(key, null) != null) {
+ return node;
+ }
+ }
+ node = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
+ if (node.get(key, null) != null) {
+ return node;
+ }
+
+ node = ConfigurationScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
+ if (node.get(key, null) != null) {
+ return node;
+ }
+
+ return DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
+ }
+
+ /**
+ * Returns the string value for the given key in the given context.
+ * @param key The preference key
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
+ * @return Returns the current value for the string.
+ * @since 5.5
+ */
+ public static String getPreference(String key, ICProject project) {
+ return getPreference(key, project, null);
+ }
+
+ /**
+ * Returns the string value for the given key in the given context.
+ * @param key The preference key
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
+ * @param defaultValue The default value if not specified in the preferences.
+ * @return Returns the current value of the preference.
+ * @since 5.5
+ */
+ public static String getPreference(String key, ICProject project, String defaultValue) {
+ return getPreferenceNode(key, project).get(key, defaultValue);
+ }
+
+ /**
+ * Returns the integer value for the given key in the given context.
+ * @param key The preference key
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
+ * @param defaultValue The default value if not specified in the preferences.
+ * @return Returns the current value of the preference.
+ * @since 5.5
+ */
+ public static int getPreference(String key, ICProject project, int defaultValue) {
+ return getPreferenceNode(key, project).getInt(key, defaultValue);
+ }
+
+ /**
+ * Returns the boolean value for the given key in the given context.
+ * @param key The preference key
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
+ * @param defaultValue The default value if not specified in the preferences.
+ * @return Returns the current value of the preference.
+ * @since 5.5
+ */
+ public static boolean getPreference(String key, ICProject project, boolean defaultValue) {
+ return getPreferenceNode(key, project).getBoolean(key, defaultValue);
+ }
+
+ /**
+ * Returns the scopes for preference lookup.
+ *
+ * @param project a project or {@code null}
+ * @return the scopes for preference lookup.
+ * @since 5.5
+ */
+ public static IScopeContext[] getPreferenceScopes(IProject project) {
+ return project != null ?
+ new IScopeContext[] { new ProjectScope(project), InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE } :
+ new IScopeContext[] { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE };
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
index f12f6a9a700..6bcaf7ba388 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
@@ -29,6 +29,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.cdt.core.CCorePreferenceConstants;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.ui.text.ICColorConstants;
@@ -39,14 +40,14 @@ import org.eclipse.cdt.internal.ui.text.spelling.SpellCheckEngine;
* Preference constants used in the CDT-UI preference store. Clients should only read the
* CDT-UI preference store using these values. Clients are not allowed to modify the
* preference store programmatically.
- *
- * The preferences defined in this file are exported in the plugin's
- * "preferenceTransfer" extension. If adding a new preference please
+ *
+ * The preferences defined in this file are exported in the plugin's
+ * "preferenceTransfer" extension. If adding a new preference please
* also add it to one of the two if applicable:
*
- *
"Editor Appearance" - Any preference related to how the editor presents
+ *
"Editor Appearance" - Any preference related to how the editor presents
* the edited code to the user.
- *
"Editor Behavior" - Any preference related to how the editor process the
+ *
"Editor Behavior" - Any preference related to how the editor process the
* edited code.
*
* @noextend This class is not intended to be subclassed by clients.
@@ -805,7 +806,7 @@ public class PreferenceConstants {
* @since 5.1
*/
public static final String OUTLINE_GROUP_MEMBERS= "org.eclipse.cdt.ui.outline.groupmembers"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether the Outline view should group macro definitions.
*
@@ -832,7 +833,7 @@ public class PreferenceConstants {
*
*/
public static final String CVIEW_GROUP_INCLUDES= "org.eclipse.cdt.ui.cview.groupincludes"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether macro definitions should be grouped in
* the C/C++ Projects view and the Project Explorer view.
@@ -849,22 +850,22 @@ public class PreferenceConstants {
*
* Value is of type Boolean.
*
- *
+ *
* @since 5.0
*/
public static final String CVIEW_SEPARATE_HEADER_AND_SOURCE= "org.eclipse.cdt.ui.cview.separateheaderandsource"; //$NON-NLS-1$
-
+
/**
- * A named preference that controls whether the sorting order of source files should be changed
+ * A named preference that controls whether the sorting order of source files should be changed
* in the C/C++ Projects view and the Project Explorer view when they are excluded from build.
*
* Value is of type Boolean.
*
- *
+ *
* @since 5.3
*/
public static final String SORT_ORDER_OF_EXCLUDED_FILES= "org.eclipse.cdt.ui.cview.sortorderofexcludedfiles"; //$NON-NLS-1$
-
+
/**
* A named preference that controls which completion proposal categories
* have been excluded from the default proposal list.
@@ -921,7 +922,7 @@ public class PreferenceConstants {
*
*/
public static final String EDITOR_FOLDING_STATEMENTS = "editor_folding_statements"; //$NON-NLS-1$
-
+
/**
* A named preference that stores the value for functions folding for the default folding provider.
*
@@ -1025,7 +1026,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public final static String REMOVE_TRAILING_WHITESPACE = "removeTrailingWhitespace"; //$NON-NLS-1$
-
+
/**
* Preference key controlling how REMOVE_TRAILING_WHITESPACE option is applied.
* If REMOVE_TRAILING_WHITESPACE is enabled, this option limits the scope of
@@ -1162,14 +1163,14 @@ public class PreferenceConstants {
* @since 5.0
*/
public final static String CODEASSIST_PROPOSALS_FOREGROUND= "content_assist_proposals_foreground"; //$NON-NLS-1$
-
+
/**
- * A named preference that holds the duration (in milli seconds) a content proposal may compute
+ * A named preference that holds the duration (in milli seconds) a content proposal may compute
* until it is assumed that the proposal computer has a problem and should be disabled.
*
* Value is of type long.
- *
- * @since 5.4
+ *
+ * @since 5.4
*/
public final static String CODEASSIST_PROPOSALS_TIMEOUT= "content_assist_proposals_timeout"; //$NON-NLS-1$
@@ -1179,7 +1180,7 @@ public class PreferenceConstants {
* Value is of type String. A RGB color value encoded as a string
* using class PreferenceConverter
*
- *
+ *
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*
@@ -1193,7 +1194,7 @@ public class PreferenceConstants {
* Value is of type String. A RGB color value encoded as a string
* using class PreferenceConverter
*
- *
+ *
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*
@@ -1438,7 +1439,7 @@ public class PreferenceConstants {
*
* Value is of type Boolean.
*
- *
+ *
* @since 5.3
*/
public static final String EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES= "markOverloadedOperatorsOccurrences"; //$NON-NLS-1$
@@ -1462,7 +1463,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_RECONCILER = "scalability.reconciler"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether syntax coloring is disabled.
*
@@ -1492,7 +1493,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_ALERT = "scalability.detect"; //$NON-NLS-1$
-
+
/**
* The size of the file that will trigger scalability mode
*
@@ -1502,7 +1503,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_NUMBER_OF_LINES = "scalability.numberOfLines"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether syntax coloring is disabled.
*
@@ -1512,7 +1513,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_SEMANTIC_HIGHLIGHT = "scalability.semanticHighlight"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether the content assist auto activation is disabled in scalability mode.
*
@@ -1522,7 +1523,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION = "scalability.contentAssistAutoActivation"; //$NON-NLS-1$
-
+
/**
* A named preference that controls how an include guard symbol is created.
*
@@ -1537,24 +1538,24 @@ public class PreferenceConstants {
* The value of CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME
* specifying that the include guard symbol is to be derived from
* the include file's name.
- *
+ *
* @since 5.1
*/
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME = 0;
-
+
/**
* The value of CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME
* specifying that the include guard symbol is to be derived from a UUID.
- *
+ *
* @since 5.1
*/
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_UUID = 1;
-
+
/**
* The value of CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME
* specifying that the include guard symbol is to be derived from
* the include file's path relative to the source folder.
- *
+ *
* @since 5.2
*/
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_PATH = 2;
@@ -1563,7 +1564,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a constant name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CONSTANT_CAPITALIZATION = "nameStyle.constant.capitalization"; //$NON-NLS-1$
@@ -1571,7 +1572,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a constant name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CONSTANT_PREFIX = "nameStyle.constant.prefix"; //$NON-NLS-1$
@@ -1579,7 +1580,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a constant name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CONSTANT_SUFFIX = "nameStyle.constant.suffix"; //$NON-NLS-1$
@@ -1588,7 +1589,7 @@ public class PreferenceConstants {
* of a constant name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CONSTANT_WORD_DELIMITER = "nameStyle.constant.wordDelimiter"; //$NON-NLS-1$
@@ -1597,7 +1598,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a variable name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_VARIABLE_CAPITALIZATION = "nameStyle.variable.capitalization"; //$NON-NLS-1$
@@ -1605,7 +1606,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a variable name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_VARIABLE_PREFIX = "nameStyle.variable.prefix"; //$NON-NLS-1$
@@ -1613,7 +1614,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a variable name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_VARIABLE_SUFFIX = "nameStyle.variable.suffix"; //$NON-NLS-1$
@@ -1622,7 +1623,7 @@ public class PreferenceConstants {
* of a variable name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_VARIABLE_WORD_DELIMITER = "nameStyle.variable.wordDelimiter"; //$NON-NLS-1$
@@ -1631,7 +1632,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a field name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_FIELD_CAPITALIZATION = "nameStyle.field.capitalization"; //$NON-NLS-1$
@@ -1639,7 +1640,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_FIELD_PREFIX = "nameStyle.field.prefix"; //$NON-NLS-1$
@@ -1647,7 +1648,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_FIELD_SUFFIX = "nameStyle.field.suffix"; //$NON-NLS-1$
@@ -1656,7 +1657,7 @@ public class PreferenceConstants {
* of a field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_FIELD_WORD_DELIMITER = "nameStyle.field.wordDelimiter"; //$NON-NLS-1$
@@ -1665,7 +1666,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a method name.
*
* Value is of type Integer.
- *
+ *
* @since 5.4
*/
public static final String NAME_STYLE_METHOD_CAPITALIZATION = "nameStyle.method.capitalization"; //$NON-NLS-1$
@@ -1673,7 +1674,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a method name.
*
* Value is of type String.
- *
+ *
* @since 5.4
*/
public static final String NAME_STYLE_METHOD_PREFIX = "nameStyle.method.prefix"; //$NON-NLS-1$
@@ -1681,7 +1682,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a method name.
*
* Value is of type String.
- *
+ *
* @since 5.4
*/
public static final String NAME_STYLE_METHOD_SUFFIX = "nameStyle.method.suffix"; //$NON-NLS-1$
@@ -1690,7 +1691,7 @@ public class PreferenceConstants {
* of a method name.
*
* Value is of type String.
- *
+ *
* @since 5.4
*/
public static final String NAME_STYLE_METHOD_WORD_DELIMITER = "nameStyle.method.wordDelimiter"; //$NON-NLS-1$
@@ -1700,7 +1701,7 @@ public class PreferenceConstants {
* depends on capitalization of the method name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_CAPITALIZATION = "nameStyle.getter.capitalization"; //$NON-NLS-1$
@@ -1708,7 +1709,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the getter name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_PREFIX = "nameStyle.getter.prefix"; //$NON-NLS-1$
@@ -1716,7 +1717,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the getter name for a boolean field.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_PREFIX_FOR_BOOLEAN = "nameStyle.getter.prefixForBoolean"; //$NON-NLS-1$
@@ -1724,7 +1725,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the getter name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_SUFFIX = "nameStyle.getter.suffix"; //$NON-NLS-1$
@@ -1733,7 +1734,7 @@ public class PreferenceConstants {
* when composing the getter name from the field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_WORD_DELIMITER = "nameStyle.getter.wordDelimiter"; //$NON-NLS-1$
@@ -1743,7 +1744,7 @@ public class PreferenceConstants {
* depends on capitalization of the field name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_SETTER_CAPITALIZATION = "nameStyle.setter.capitalization"; //$NON-NLS-1$
@@ -1751,7 +1752,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the setter name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_SETTER_PREFIX = "nameStyle.setter.prefix"; //$NON-NLS-1$
@@ -1759,7 +1760,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the setter name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_SETTER_SUFFIX = "nameStyle.setter.suffix"; //$NON-NLS-1$
@@ -1768,7 +1769,7 @@ public class PreferenceConstants {
* when composing the setter name from the field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_SETTER_WORD_DELIMITER = "nameStyle.setter.wordDelimiter"; //$NON-NLS-1$
@@ -1778,7 +1779,7 @@ public class PreferenceConstants {
* depends on capitalization of the class name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_SOURCE_CAPITALIZATION = "nameStyle.cpp.source.capitalization"; //$NON-NLS-1$
@@ -1786,7 +1787,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the C++ source file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_SOURCE_PREFIX = "nameStyle.cpp.source.prefix"; //$NON-NLS-1$
@@ -1794,7 +1795,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the C++ source file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_SOURCE_SUFFIX = "nameStyle.cpp.source.suffix"; //$NON-NLS-1$
@@ -1803,7 +1804,7 @@ public class PreferenceConstants {
* when composing the C++ source file name from the class name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_SOURCE_WORD_DELIMITER = "nameStyle.cpp.source.wordDelimiter"; //$NON-NLS-1$
@@ -1813,7 +1814,7 @@ public class PreferenceConstants {
* depends on capitalization of the class name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_HEADER_CAPITALIZATION = "nameStyle.cpp.header.capitalization"; //$NON-NLS-1$
@@ -1821,7 +1822,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the C++ header file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_HEADER_PREFIX = "nameStyle.cpp.header.prefix"; //$NON-NLS-1$
@@ -1829,7 +1830,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the C++ header file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_HEADER_SUFFIX = "nameStyle.cpp.header.suffix"; //$NON-NLS-1$
@@ -1838,7 +1839,7 @@ public class PreferenceConstants {
* when composing the C++ header file name from the class name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_HEADER_WORD_DELIMITER = "nameStyle.cpp.header.wordDelimiter"; //$NON-NLS-1$
@@ -1848,7 +1849,7 @@ public class PreferenceConstants {
* depends on capitalization of the class name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_TEST_CAPITALIZATION = "nameStyle.cpp.test.capitalization"; //$NON-NLS-1$
@@ -1856,7 +1857,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the C++ test file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_TEST_PREFIX = "nameStyle.cpp.test.prefix"; //$NON-NLS-1$
@@ -1864,7 +1865,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the C++ test file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_TEST_SUFFIX = "nameStyle.cpp.test.suffix"; //$NON-NLS-1$
@@ -1873,7 +1874,7 @@ public class PreferenceConstants {
* when composing the C++ test file name from the class name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_TEST_WORD_DELIMITER = "nameStyle.cpp.test.wordDelimiter"; //$NON-NLS-1$
@@ -1882,7 +1883,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name without changing
* capitalization.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_ORIGINAL = 0;
@@ -1890,7 +1891,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name by converting it to upper
* case.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_UPPER_CASE = 1;
@@ -1898,7 +1899,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name by converting it to lower
* case.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_LOWER_CASE = 2;
@@ -1906,7 +1907,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name by capitalizing first
* letter of every word.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_CAMEL_CASE = 3;
@@ -1914,7 +1915,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name by capitalizing first
* letter of every word except the first one.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_LOWER_CAMEL_CASE = 4;
@@ -1925,7 +1926,7 @@ public class PreferenceConstants {
*
* Value is of type Boolean. The true value means that private members
* are before public ones. The default is to put public members before private ones.
- *
+ *
* @since 5.4
*/
public static final String CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER = "class_member_ascending_visibility_order"; //$NON-NLS-1$
@@ -1936,7 +1937,7 @@ public class PreferenceConstants {
* Value is of type Boolean. The true value means that output
* parameters are before the input ones. The default is to put outputparameters after the input
* ones.
- *
+ *
* @since 5.4
*/
public static final String FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT = "function_output_parameters_before_input"; //$NON-NLS-1$
@@ -1947,7 +1948,7 @@ public class PreferenceConstants {
*
* Value is of type Boolean. The true value means that output
* parameters are passed by pointer. The default is to pass output parameters by reference.
- *
+ *
* @since 5.4
*/
public static final String FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER = "function_pass_output_parameters_by_pointer"; //$NON-NLS-1$
@@ -2057,7 +2058,7 @@ public class PreferenceConstants {
// Formatter profile
store.setDefault(PreferenceConstants.FORMATTER_PROFILE, FormatterProfileManager.DEFAULT_PROFILE);
-
+
// Content assist
store.setDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES, "org.eclipse.cdt.ui.textProposalCategory\0"); //$NON-NLS-1$
store.setDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER, "org.eclipse.cdt.ui.parserProposalCategory:65539\0org.eclipse.cdt.ui.textProposalCategory:65541\0org.eclipse.cdt.ui.templateProposalCategory:2\0org.eclipse.cdt.ui.helpProposalCategory:5\0"); //$NON-NLS-1$
@@ -2102,12 +2103,12 @@ public class PreferenceConstants {
// codegen
store.setDefault(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
-
+
// mark occurrences
store.setDefault(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
store.setDefault(PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES, false);
store.setDefault(PreferenceConstants.EDITOR_STICKY_OCCURRENCES, true);
-
+
// Scalability
store.setDefault(PreferenceConstants.SCALABILITY_ALERT, true);
store.setDefault(PreferenceConstants.SCALABILITY_NUMBER_OF_LINES, 5000);
@@ -2117,7 +2118,7 @@ public class PreferenceConstants {
store.setDefault(PreferenceConstants.SCALABILITY_SEMANTIC_HIGHLIGHT, false);
store.setDefault(PreferenceConstants.SCALABILITY_PARSER_BASED_CONTENT_ASSIST, false);
store.setDefault(PreferenceConstants.SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION, false);
-
+
// Code Templates
store.setDefault(PreferenceConstants.CODE_TEMPLATES_INCLUDE_GUARD_SCHEME,
CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME);
@@ -2173,14 +2174,13 @@ public class PreferenceConstants {
/**
* Returns the node in the preference in the given context.
* @param key The preference key.
- * @param project The current context or null if no context is available and
- * the workspace setting should be taken. Note that passing null should
- * be avoided.
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @return Returns the node matching the given context.
*/
private static IEclipsePreferences getPreferenceNode(String key, ICProject project) {
IEclipsePreferences node = null;
-
+
if (project != null) {
node = new ProjectScope(project.getProject()).getNode(CUIPlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
@@ -2191,7 +2191,7 @@ public class PreferenceConstants {
if (node.get(key, null) != null) {
return node;
}
-
+
node = ConfigurationScope.INSTANCE.getNode(CUIPlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
return node;
@@ -2203,21 +2203,33 @@ public class PreferenceConstants {
/**
* Returns the string value for the given key in the given context.
* @param key The preference key
- * @param project The current context or null if no context is available and
- * the workspace setting should be taken. Note that passing null should
- * be avoided.
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @return Returns the current value for the string.
* @since 5.0
*/
public static String getPreference(String key, ICProject project) {
- return getPreferenceNode(key, project).get(key, null);
+ return getPreference(key, project, null);
+ }
+
+ /**
+ * Returns the string value for the given key in the given context.
+ * @param key The preference key
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
+ * @param defaultValue The default value if not specified in the preferences.
+ * @return Returns the current value of the preference.
+ * @since 5.5
+ */
+ public static String getPreference(String key, ICProject project, String defaultValue) {
+ return getPreferenceNode(key, project).get(key, defaultValue);
}
/**
* Returns the integer value for the given key in the given context.
* @param key The preference key
- * @param project The current context or null if no context is available and
- * the workspace setting should be taken. Note that passing null should
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should
* be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value for the string.
@@ -2230,9 +2242,8 @@ public class PreferenceConstants {
/**
* Returns the boolean value for the given key in the given context.
* @param key The preference key
- * @param project The current context or null if no context is available and
- * the workspace setting should be taken. Note that passing null should
- * be avoided.
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value for the string.
* @since 5.1
@@ -2243,14 +2254,12 @@ public class PreferenceConstants {
/**
* Returns the scopes for preference lookup.
- *
- * @param project a project or null
+ *
+ * @param project a project or {@code null}
* @return the scopes for preference lookup.
* @since 5.4
*/
public static IScopeContext[] getPreferenceScopes(IProject project) {
- return project != null ?
- new IScopeContext[] { new ProjectScope(project), InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE } :
- new IScopeContext[] { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE };
+ return CCorePreferenceConstants.getPreferenceScopes(project);
}
}
From d76357807964c6f939870bb07f553b10ded19d00 Mon Sep 17 00:00:00 2001
From: Sergey Prigogin
Date: Tue, 16 Oct 2012 14:20:23 -0700
Subject: [PATCH 03/25] Added OneSourceMultipleHeadersTestCase class.
---
.../tests/IndexBindingResolutionTestBase.java | 42 +++----
.../core/testplugin/util/BaseTestCase.java | 4 +-
.../OneSourceMultipleHeadersTestCase.java | 113 ++++++++++++++++++
.../testplugin/util/TestSourceReader.java | 85 +++++++++----
4 files changed, 198 insertions(+), 46 deletions(-)
create mode 100644 core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/OneSourceMultipleHeadersTestCase.java
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java
index 37b10fbad55..978a6f18bd0 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java
@@ -97,7 +97,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
return name;
}
}
-
+
return null;
}
@@ -122,7 +122,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IASTName name= findName(section, len);
assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature());
-
+
IBinding binding = name.resolveBinding();
assertNotNull("No binding for " + name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
@@ -136,11 +136,11 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
protected T getBindingFromASTName(String section, int len) {
if (len <= 0)
len += section.length();
-
+
IASTName name= findName(section, len);
assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature());
-
+
IBinding binding = name.resolveBinding();
assertNotNull("No binding for " + name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
@@ -157,7 +157,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IASTName name= findName(section, len);
assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature());
-
+
IBinding binding = name.resolveBinding();
assertNotNull("No binding for " + name.getRawSignature(), binding);
assertTrue("Binding is not a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
@@ -267,13 +267,13 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
return null;
return nameList.get(idx);
}
-
+
public int size() {
return nameList.size();
}
}
- interface ITestStrategy {
+ protected interface ITestStrategy {
IIndex getIndex();
void setUp() throws Exception;
void tearDown() throws Exception;
@@ -300,7 +300,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public ICProject getCProject() {
return cproject;
}
-
+
@Override
public StringBuilder[] getTestData() {
return testData;
@@ -365,7 +365,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public IIndex getIndex() {
return index;
}
-
+
@Override
public boolean isCompositeIndex() {
return false;
@@ -426,7 +426,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IFile cppfile= TestSourceReader.createFile(cproject.getProject(), new Path("references.c" + (cpp ? "pp" : "")), testData[1].toString());
waitForIndexer(cproject);
-
+
if (DEBUG) {
System.out.println("Project PDOM: " + getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
@@ -452,7 +452,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public IIndex getIndex() {
return index;
}
-
+
@Override
public boolean isCompositeIndex() {
return false;
@@ -467,7 +467,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
* to put the contents of the section to. To request the AST of a file, put an asterisk after
* the file name.
*/
- class SinglePDOMTestNamedFilesStrategy implements ITestStrategy {
+ protected class SinglePDOMTestNamedFilesStrategy implements ITestStrategy {
private IIndex index;
private ICProject cproject;
private StringBuilder[] testData;
@@ -536,7 +536,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
}
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
waitForIndexer(cproject);
-
+
if (DEBUG) {
System.out.println("Project PDOM: " + getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
@@ -564,7 +564,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public IIndex getIndex() {
return index;
}
-
+
@Override
public boolean isCompositeIndex() {
return false;
@@ -586,7 +586,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public ICProject getCProject() {
return cproject;
}
-
+
@Override
public void tearDown() throws Exception {
if (index != null) {
@@ -620,7 +620,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
CCorePlugin.getIndexManager().reindex(cproject);
waitForIndexer(cproject);
-
+
if (DEBUG) {
System.out.println("Online: "+getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
@@ -637,17 +637,17 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
CProjectHelper.createCProject("ReferencedContent" + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
String content = testData[0].toString();
IFile file = TestSourceReader.createFile(referenced.getProject(), new Path("header.h"), content);
-
+
IndexerPreferences.set(referenced.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
CCorePlugin.getIndexManager().reindex(referenced);
-
+
waitForIndexer(referenced);
-
+
if (DEBUG) {
System.out.println("Referenced: "+getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(referenced)).accept(new PDOMPrettyPrinter());
}
-
+
return referenced;
}
@@ -679,7 +679,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public StringBuilder[] getTestData() {
return testData;
}
-
+
@Override
public boolean isCompositeIndex() {
return true;
diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java
index 6d23969e328..9c366e76317 100644
--- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java
+++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java
@@ -240,7 +240,7 @@ public class BaseTestCase extends TestCase {
* in the log should fail the test. If the logged number of non-OK status objects
* differs from the last value passed, the test is failed. If this method is not called
* at all, the expected number defaults to zero.
- * @param value
+ * @param count the expected number of logged error and warning messages
*/
public void setExpectedNumberOfLoggedNonOKStatusObjects(int count) {
fExpectedLoggedNonOK= count;
@@ -306,7 +306,7 @@ public class BaseTestCase extends TestCase {
assertTrue(indexManager.isProjectRegistered(project));
assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()));
}
-
+
public static void waitUntilFileIsIndexed(IIndex index, IFile file) throws Exception {
TestSourceReader.waitUntilFileIsIndexed(index, file, INDEXER_TIMEOUT_SEC * 1000);
}
diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/OneSourceMultipleHeadersTestCase.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/OneSourceMultipleHeadersTestCase.java
new file mode 100644
index 00000000000..eb681dc47e3
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/OneSourceMultipleHeadersTestCase.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * 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:
+ * Sergey Prigogin (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core.testplugin.util;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.dom.IPDOMManager;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.index.IIndex;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.testplugin.CProjectHelper;
+import org.eclipse.cdt.internal.core.CCoreInternals;
+import org.eclipse.cdt.internal.core.pdom.PDOM;
+import org.eclipse.cdt.internal.pdom.tests.PDOMPrettyPrinter;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Base class for tests that use AST. The files in the test project are created from the comments
+ * preceding the test case. The test project will contain a single source file called source.cpp or
+ * source.c, depending on whether the project is for C++ or C, and zero or more header files called
+ * header1.h, header2.h, etc. The AST is created for the source file only and can be obtained
+ * by calling getAst().
+ */
+public class OneSourceMultipleHeadersTestCase extends BaseTestCase {
+ private static final boolean DEBUG = false;
+
+ private final TestSourceReader testSourceReader;
+ private final boolean cpp;
+ private IIndex index;
+ private ICProject cproject;
+ private StringBuilder[] testData;
+ private IASTTranslationUnit ast;
+
+ public OneSourceMultipleHeadersTestCase(TestSourceReader testSourceReader, boolean cpp) {
+ this(null, testSourceReader, cpp);
+ }
+
+ public OneSourceMultipleHeadersTestCase(String name, TestSourceReader testSourceReader,
+ boolean cpp) {
+ super(name);
+ this.testSourceReader = testSourceReader;
+ this.cpp = cpp;
+ }
+
+ protected ICProject getCProject() {
+ return cproject;
+ }
+
+ protected IIndex getIndex() {
+ return index;
+ }
+
+ protected StringBuilder[] getTestData() {
+ return testData;
+ }
+
+ protected IASTTranslationUnit getAst() {
+ return ast;
+ }
+
+ public String getAstSource() {
+ return testData[testData.length - 1].toString();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ cproject = cpp ?
+ CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
+ CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
+ testData = testSourceReader.getContentsForTest(getName());
+
+ if (testData.length > 0) {
+ for (int i = 0; i < testData.length - 1; i++) {
+ String filename = String.format("header%d.h", i + 1);
+ IFile file = TestSourceReader.createFile(cproject.getProject(), new Path(filename), testData[i].toString());
+ CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
+ }
+ }
+
+ IFile cppfile= TestSourceReader.createFile(cproject.getProject(), new Path("source.c" + (cpp ? "pp" : "")), getAstSource());
+ waitForIndexer(cproject);
+
+ if (DEBUG) {
+ System.out.println("Project PDOM: " + getName());
+ ((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
+ }
+
+ index= CCorePlugin.getIndexManager().getIndex(cproject);
+
+ index.acquireReadLock();
+ ast = TestSourceReader.createIndexBasedAST(index, cproject, cppfile);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (index != null) {
+ index.releaseReadLock();
+ }
+ if (cproject != null) {
+ cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, new NullProgressMonitor());
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java
index c27a7e263f6..7295d0ef6c7 100644
--- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java
+++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
+ * Copyright (c) 2006, 2012 Wind River Systems, 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
@@ -8,7 +8,8 @@
* Contributors:
* Markus Schorn - initial API and implementation
* Andrew Ferguson (Symbian)
- *******************************************************************************/
+ * Sergey Prigogin (Google)
+ *******************************************************************************/
package org.eclipse.cdt.core.testplugin.util;
import java.io.BufferedReader;
@@ -57,23 +58,61 @@ import org.osgi.framework.Bundle;
* Utilities for reading test source code from plug-in .java sources
*/
public class TestSourceReader {
+ private final Bundle bundle;
+ private final String srcRoot;
+ private final Class clazz;
+ private final int numSections;
+
+ /**
+ * @param bundle the bundle containing the source, if {@code null} can try to load using
+ * classpath (source folder has to be in the classpath for this to work)
+ * @param srcRoot the directory inside the bundle containing the packages
+ * @param clazz the name of the class containing the test
+ */
+ public TestSourceReader(Bundle bundle, String srcRoot, Class clazz) {
+ this(bundle, srcRoot, clazz, 0);
+ }
+
+ /**
+ * @param bundle the bundle containing the source, if {@code null} can try to load using
+ * classpath (source folder has to be in the classpath for this to work)
+ * @param srcRoot the directory inside the bundle containing the packages
+ * @param clazz the name of the class containing the test
+ * @param numSections the number of comment sections preceding the named test to return.
+ * Pass zero to get all available sections.
+ */
+ public TestSourceReader(Bundle bundle, String srcRoot, Class clazz, int numSections) {
+ this.bundle = bundle;
+ this.srcRoot = srcRoot;
+ this.clazz = clazz;
+ this.numSections = numSections;
+ }
+
+ public StringBuilder[] getContentsForTest(final String testName) throws IOException {
+ return getContentsForTest(bundle, srcRoot, clazz, testName, numSections);
+ }
+
+ public String readTaggedComment(String tag) throws IOException {
+ return readTaggedComment(bundle, tag, clazz, tag);
+ }
+
/**
* Returns an array of StringBuilder objects for each comment section found preceding the named
* test in the source code.
*
- * @param bundle the bundle containing the source, if null can try to load using classpath
- * (source folder has to be in the classpath for this to work)
+ * @param bundle the bundle containing the source, if {@code null} can try to load using
+ * classpath (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages
* @param clazz the name of the class containing the test
* @param testName the name of the test
- * @param sections the number of comment sections preceding the named test to return. Pass zero
- * to get all available sections.
+ * @param numSections the number of comment sections preceding the named test to return.
+ * Pass zero to get all available sections.
* @return an array of StringBuilder objects for each comment section found preceding the named
- * test in the source code.
+ * test in the source code.
* @throws IOException
*/
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz,
- final String testName, int sections) throws IOException {
+ final String testName, int numSections) throws IOException {
// Walk up the class inheritance chain until we find the test method.
try {
while (clazz.getMethod(testName).getDeclaringClass() != clazz) {
@@ -91,7 +130,7 @@ public class TestSourceReader {
fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
String classFile = fqn + ".java";
IPath filePath= new Path(srcRoot + '/' + classFile);
-
+
InputStream in;
Class superclass = clazz.getSuperclass();
try {
@@ -107,7 +146,7 @@ public class TestSourceReader {
clazz = superclass;
continue;
}
-
+
BufferedReader br = new BufferedReader(new InputStreamReader(in));
try {
// Read the java file collecting comments until we encounter the test method.
@@ -120,7 +159,7 @@ public class TestSourceReader {
} else {
if (!line.startsWith("@") && content.length() > 0) {
contents.add(content);
- if (sections > 0 && contents.size() == sections + 1)
+ if (numSections > 0 && contents.size() == numSections + 1)
contents.remove(0);
content = new StringBuilder();
}
@@ -145,14 +184,14 @@ public class TestSourceReader {
clazz = superclass;
}
}
-
+
/**
* Searches for the offset of the first occurrence of a string in a workspace file.
* @param lookfor string to be searched for
* @param fullPath full path of the workspace file
* @return the offset or -1
- * @throws Exception
- * @throws UnsupportedEncodingException
+ * @throws Exception
+ * @throws UnsupportedEncodingException
* @since 4.0
*/
public static int indexOfInFile(String lookfor, Path fullPath) throws Exception {
@@ -183,7 +222,7 @@ public class TestSourceReader {
reader.close();
}
}
-
+
public static int getLineNumber(int offset, Path fullPath) throws Exception {
IFile file= ResourcesPlugin.getWorkspace().getRoot().getFile(fullPath);
Reader reader= new BufferedReader(new InputStreamReader(file.getContents(), file.getCharset()));
@@ -203,12 +242,12 @@ public class TestSourceReader {
/**
* Reads a section in comments form the source of the given class. The section
- * is started with '// {tag}' and ends with the first line not started by '//'
+ * is started with '// {tag}' and ends with the first line not started by '//'
* @since 4.0
*/
public static String readTaggedComment(Bundle bundle, String srcRoot, Class clazz, final String tag) throws IOException {
IPath filePath= new Path(srcRoot + '/' + clazz.getName().replace('.', '/') + ".java");
-
+
InputStream in= FileLocator.openStream(bundle, filePath, false);
LineNumberReader reader= new LineNumberReader(new InputStreamReader(in));
boolean found= false;
@@ -244,15 +283,15 @@ public class TestSourceReader {
}
/**
- * Creates a file with content at the given path inside the given container.
+ * Creates a file with content at the given path inside the given container.
* If the file exists its content is replaced.
* @param container a container to create the file in
* @param filePath the path relative to the container to create the file at
* @param contents the content for the file
* @return a file object.
- * @throws CoreException
+ * @throws CoreException
* @since 4.0
- */
+ */
public static IFile createFile(final IContainer container, final IPath filePath,
final CharSequence contents) throws CoreException {
final IWorkspace ws = ResourcesPlugin.getWorkspace();
@@ -295,7 +334,7 @@ public class TestSourceReader {
}
/**
- * Creates a file with content at the given path inside the given container.
+ * Creates a file with content at the given path inside the given container.
* If the file exists its content is replaced.
* @param container a container to create the file in
* @param filePath the path relative to the container to create the file at
@@ -309,7 +348,7 @@ public class TestSourceReader {
/**
* Waits until the given file is indexed. Fails if this does not happen within the
- * given time.
+ * given time.
* @param file
* @param maxmillis
* @throws Exception
@@ -338,7 +377,7 @@ public class TestSourceReader {
} finally {
index.releaseReadLock();
}
-
+
Thread.sleep(50);
timeLeft= (int) (endTime - System.currentTimeMillis());
}
From c05ea1bf76b558cb9d7c61153420315ea7213a1d Mon Sep 17 00:00:00 2001
From: Sergey Prigogin
Date: Tue, 16 Oct 2012 14:54:42 -0700
Subject: [PATCH 04/25] Cosmetics.
---
.../core/dom/parser/ITypeMarshalBuffer.java | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java
index 5198b0ac12c..8b465ba06c9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java
@@ -20,18 +20,18 @@ import org.eclipse.core.runtime.CoreException;
* Buffer for marshalling and unmarshalling types.
*/
public interface ITypeMarshalBuffer {
- final static byte BASIC_TYPE= 1;
- final static byte POINTER_TYPE= 2;
- final static byte ARRAY_TYPE= 3;
- final static byte CVQUALIFIER_TYPE= 4;
- final static byte FUNCTION_TYPE= 5;
- final static byte REFERENCE_TYPE= 6;
- final static byte POINTER_TO_MEMBER_TYPE= 7;
- final static byte PACK_EXPANSION_TYPE= 8;
- final static byte PROBLEM_TYPE= 9;
- final static byte VALUE= 10;
- final static byte DEPENDENT_EXPRESSION_TYPE= 11;
- final static byte UNKNOWN_MEMBER= 12;
+ final static byte BASIC_TYPE= 1;
+ final static byte POINTER_TYPE= 2;
+ final static byte ARRAY_TYPE= 3;
+ final static byte CVQUALIFIER_TYPE= 4;
+ final static byte FUNCTION_TYPE= 5;
+ final static byte REFERENCE_TYPE= 6;
+ final static byte POINTER_TO_MEMBER_TYPE= 7;
+ final static byte PACK_EXPANSION_TYPE= 8;
+ final static byte PROBLEM_TYPE= 9;
+ final static byte VALUE= 10;
+ final static byte DEPENDENT_EXPRESSION_TYPE= 11;
+ final static byte UNKNOWN_MEMBER= 12;
final static byte UNKNOWN_MEMBER_CLASS_INSTANCE= 13;
final static byte DEFERRED_CLASS_INSTANCE= 14;
From f2724c6bdf07dcdcf14f59fc7f8e728f114e6555 Mon Sep 17 00:00:00 2001
From: mhussein
Date: Wed, 17 Oct 2012 19:31:49 +0200
Subject: [PATCH 05/25] Bug 391390 : Updatesite url is indigo
Removed all update site urls from all feature.xml files based on
Martin's suggestion in
http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg25067.html
that refers to https://bugs.eclipse.org/bugs/show_bug.cgi?id=380633
Change-Id: Idb326ff9f1d8187088345d91d2d0c7c98c227d9e
Reviewed-on: https://git.eclipse.org/r/8092
Reviewed-by: Marc Khouzam
IP-Clean: Marc Khouzam
Tested-by: Marc Khouzam
---
build/org.eclipse.cdt.autotools-feature/feature.xml | 4 ----
build/org.eclipse.cdt.autotools-feature/p2.inf | 4 ++--
build/org.eclipse.cdt.autotools.source-feature/feature.xml | 4 ----
build/org.eclipse.cdt.gnu.build-feature/feature.xml | 4 ----
build/org.eclipse.cdt.gnu.build.source-feature/feature.xml | 4 ----
cross/org.eclipse.cdt.build.crossgcc-feature/feature.xml | 4 ----
.../sourceTemplateFeature/feature.xml | 4 ----
cross/org.eclipse.cdt.launch.remote-feature/feature.xml | 4 ----
debug/org.eclipse.cdt.gdb-feature/feature.xml | 4 ----
debug/org.eclipse.cdt.gdb.source-feature/feature.xml | 4 ----
debug/org.eclipse.cdt.gnu.debug-feature/feature.xml | 4 ----
debug/org.eclipse.cdt.gnu.debug.source-feature/feature.xml | 4 ----
dsf-gdb/org.eclipse.cdt.gnu.dsf-feature/feature.xml | 4 ----
dsf-gdb/org.eclipse.cdt.gnu.dsf.source-feature/feature.xml | 4 ----
dsf/org.eclipse.cdt.examples.dsf-feature/feature.xml | 4 ----
.../sourceTemplateFeature/feature.xml | 4 ----
jtag/org.eclipse.cdt.debug.gdbjtag-feature/feature.xml | 4 ----
lrparser/org.eclipse.cdt.core.lrparser.feature/feature.xml | 4 ----
.../org.eclipse.cdt.core.lrparser.sdk.feature/feature.xml | 4 ----
.../org.eclipse.cdt.core.lrparser.source.feature/feature.xml | 4 ----
memory/org.eclipse.cdt.debug.ui.memory-feature/feature.xml | 4 ----
.../feature.xml | 4 ----
releng/org.eclipse.cdt-feature/feature.xml | 4 ----
releng/org.eclipse.cdt.platform-feature/feature.xml | 4 ----
releng/org.eclipse.cdt.platform.source-feature/feature.xml | 4 ----
releng/org.eclipse.cdt.sdk-feature/feature.xml | 4 ----
releng/org.eclipse.cdt.testing-feature/feature.xml | 4 ----
testsrunner/org.eclipse.cdt.testsrunner.feature/feature.xml | 4 ----
.../org.eclipse.cdt.testsrunner.source.feature/feature.xml | 4 ----
upc/org.eclipse.cdt.bupc-feature/feature.xml | 4 ----
upc/org.eclipse.cdt.core.parser.upc.feature/feature.xml | 4 ----
upc/org.eclipse.cdt.core.parser.upc.sdk.feature/feature.xml | 4 ----
.../feature.xml | 4 ----
util/org.eclipse.cdt.util-feature/feature.xml | 4 ----
xlc/org.eclipse.cdt.xlc.feature/feature.xml | 4 ----
xlc/org.eclipse.cdt.xlc.sdk-feature/feature.xml | 4 ----
xlc/org.eclipse.cdt.xlc.source.feature/feature.xml | 4 ----
37 files changed, 2 insertions(+), 146 deletions(-)
diff --git a/build/org.eclipse.cdt.autotools-feature/feature.xml b/build/org.eclipse.cdt.autotools-feature/feature.xml
index 142c15f11cf..017514b9975 100644
--- a/build/org.eclipse.cdt.autotools-feature/feature.xml
+++ b/build/org.eclipse.cdt.autotools-feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
diff --git a/build/org.eclipse.cdt.autotools-feature/p2.inf b/build/org.eclipse.cdt.autotools-feature/p2.inf
index 73fc9f2d12e..720696ace2a 100644
--- a/build/org.eclipse.cdt.autotools-feature/p2.inf
+++ b/build/org.eclipse.cdt.autotools-feature/p2.inf
@@ -4,5 +4,5 @@ provides.99.namespace=org.eclipse.equinox.p2.iu
provides.99.name=org.eclipse.linuxtools.cdt.autotools.feature.group
provides.99.version=$version$
instructions.configure=\
-org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/indigo,type:0,name:CDT,enabled:false); \
-org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/indigo,type:1,name:CDT,enabled:false);
+org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/juno,type:0,name:CDT,enabled:false); \
+org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/juno,type:1,name:CDT,enabled:false);
diff --git a/build/org.eclipse.cdt.autotools.source-feature/feature.xml b/build/org.eclipse.cdt.autotools.source-feature/feature.xml
index 62f5daa388f..eb233097564 100644
--- a/build/org.eclipse.cdt.autotools.source-feature/feature.xml
+++ b/build/org.eclipse.cdt.autotools.source-feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/cross/org.eclipse.cdt.launch.remote-feature/feature.xml b/cross/org.eclipse.cdt.launch.remote-feature/feature.xml
index 293f57fb6f2..27981f690e9 100644
--- a/cross/org.eclipse.cdt.launch.remote-feature/feature.xml
+++ b/cross/org.eclipse.cdt.launch.remote-feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag-feature/feature.xml b/jtag/org.eclipse.cdt.debug.gdbjtag-feature/feature.xml
index 80882f96907..c49965e1796 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag-feature/feature.xml
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag-feature/feature.xml
@@ -18,10 +18,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lrparser/org.eclipse.cdt.core.lrparser.source.feature/feature.xml b/lrparser/org.eclipse.cdt.core.lrparser.source.feature/feature.xml
index 57aacf5d9b4..07dd84a538e 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser.source.feature/feature.xml
+++ b/lrparser/org.eclipse.cdt.core.lrparser.source.feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/releng/org.eclipse.cdt.platform-feature/feature.xml b/releng/org.eclipse.cdt.platform-feature/feature.xml
index 91b29d8fc44..06695f7fa0c 100644
--- a/releng/org.eclipse.cdt.platform-feature/feature.xml
+++ b/releng/org.eclipse.cdt.platform-feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/releng/org.eclipse.cdt.testing-feature/feature.xml b/releng/org.eclipse.cdt.testing-feature/feature.xml
index 881d23cc758..7d2161d47c3 100644
--- a/releng/org.eclipse.cdt.testing-feature/feature.xml
+++ b/releng/org.eclipse.cdt.testing-feature/feature.xml
@@ -18,10 +18,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/upc/org.eclipse.cdt.core.parser.upc.sdk.feature/feature.xml b/upc/org.eclipse.cdt.core.parser.upc.sdk.feature/feature.xml
index e43e6bf853c..cb845641752 100644
--- a/upc/org.eclipse.cdt.core.parser.upc.sdk.feature/feature.xml
+++ b/upc/org.eclipse.cdt.core.parser.upc.sdk.feature/feature.xml
@@ -18,10 +18,6 @@
%license
-
-
-
-
diff --git a/upc/org.eclipse.cdt.core.parser.upc.source.feature/feature.xml b/upc/org.eclipse.cdt.core.parser.upc.source.feature/feature.xml
index 1d31c82d452..98133b6c17a 100644
--- a/upc/org.eclipse.cdt.core.parser.upc.source.feature/feature.xml
+++ b/upc/org.eclipse.cdt.core.parser.upc.source.feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/xlc/org.eclipse.cdt.xlc.source.feature/feature.xml b/xlc/org.eclipse.cdt.xlc.source.feature/feature.xml
index 59758a0c4e1..1e4100d3711 100644
--- a/xlc/org.eclipse.cdt.xlc.source.feature/feature.xml
+++ b/xlc/org.eclipse.cdt.xlc.source.feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
Date: Thu, 18 Oct 2012 11:39:13 -0400
Subject: [PATCH 06/25] Bug 391115 - Disassembly view presents "\t" in
instruction strings
---
.../cdt/dsf/mi/service/command/output/MIInstruction.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
index cf3c3e6ae97..48ffcdbf856 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
@@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Ericsson - Adapted for DSF
+ * Dmitry Kozlov (Mentor) - Add tab symbols parsing (Bug 391115)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
@@ -111,6 +112,8 @@ public class MIInstruction extends AbstractInstruction {
translated string since the only thing we are doing is
displaying it. */
str = ((MIConst) value).getString();
+ /* to avoid improper displaying of instructions we need to translate tabs */
+ str = str.replace("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
char chars[] = str.toCharArray();
int index = 0;
From 952831f2abae95a9fb1d3ebfb15ed1093f7e922a Mon Sep 17 00:00:00 2001
From: Randy Rohrbach
Date: Tue, 16 Oct 2012 19:36:59 +0200
Subject: [PATCH 07/25] Bug 392095 The Traditional Memory Renderer does not
work properly with the TCF Memory Block.
This is an initial solution which is made up of 2 parts
1.) Changed the lower-level renderer to filter based on memory block as well as debug target.
2.) Changed the parent render to become a listener for model changed events which it translated in
to the older debug events the lower-level renderer is expecting.
Pawel has suggested a more compact implementation which I will persue. But for now this is at least
a current fix.
---
.../ui/memory/traditional/Rendering.java | 22 +--
.../traditional/TraditionalRendering.java | 151 ++++++++++++++++--
2 files changed, 148 insertions(+), 25 deletions(-)
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/Rendering.java b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/Rendering.java
index 465a58e516b..848de2b4a62 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/Rendering.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/Rendering.java
@@ -485,9 +485,9 @@ public class Rendering extends Composite implements IDebugEventSetListener
protected BigInteger getCaretAddress()
{
- // Return the caret address if it has been set, otherwise return the
- // viewport address. When the rendering is first created, the caret is
- // unset until the user clicks somewhere in the rendering. It also reset
+ // Return the caret address if it has been set, otherwise return the
+ // viewport address. When the rendering is first created, the caret is
+ // unset until the user clicks somewhere in the rendering. It also reset
// (unset) when the user gives us a new viewport address
return (fCaretAddress != null) ? fCaretAddress : fViewportAddress;
}
@@ -583,11 +583,15 @@ public class Rendering extends Composite implements IDebugEventSetListener
{
final int kind = events[i].getKind();
final int detail = events[i].getDetail();
- final IDebugElement source = (IDebugElement) events[i]
- .getSource();
-
- if(source.getDebugTarget() == getMemoryBlock()
- .getDebugTarget())
+ final IDebugElement source = (IDebugElement) events[i].getSource();
+ /*
+ * We have to make sure we are comparing memory blocks here. It pretty much is now the
+ * case that the IDebugTarget is always null. Almost no one in the Embedded Space is
+ * using anything but CDT/DSF or CDT/TCF at this point. The older CDI stuff will still
+ * be using the old Debug Model API. But this will generate the same memory block and
+ * a legitimate IDebugTarget which will match properly.
+ */
+ if(source.equals( getMemoryBlock() ) && source.getDebugTarget() == getMemoryBlock().getDebugTarget() )
{
if((detail & DebugEvent.BREAKPOINT) != 0)
isBreakpointHit = true;
@@ -620,7 +624,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
{
public void run()
{
- archiveDeltas();
+ archiveDeltas();
refresh();
}
});
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java
index de93061bdc6..f18cb2d5c7c 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java
@@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.ui.memory.traditional;
import java.lang.reflect.Method;
import java.math.BigInteger;
+import java.util.HashMap;
import org.eclipse.cdt.debug.core.model.provisional.IMemoryRenderingViewportProvider;
import org.eclipse.core.commands.AbstractHandler;
@@ -22,18 +23,26 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
import org.eclipse.debug.core.model.MemoryByte;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.memory.IMemoryBlockConnection;
+import org.eclipse.debug.internal.ui.memory.provisional.MemoryViewPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.AbstractMemoryRendering;
import org.eclipse.debug.ui.memory.AbstractTableRendering;
import org.eclipse.debug.ui.memory.IMemoryRendering;
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
+import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
import org.eclipse.debug.ui.memory.IResettableMemoryRendering;
import org.eclipse.jface.action.Action;
@@ -86,7 +95,7 @@ import org.eclipse.ui.progress.UIJob;
*/
@SuppressWarnings("restriction")
-public class TraditionalRendering extends AbstractMemoryRendering implements IRepositionableMemoryRendering, IResettableMemoryRendering, IMemoryRenderingViewportProvider
+public class TraditionalRendering extends AbstractMemoryRendering implements IRepositionableMemoryRendering, IResettableMemoryRendering, IMemoryRenderingViewportProvider, IModelChangedListener
{
protected Rendering fRendering;
protected Action displayEndianBigAction;
@@ -96,7 +105,7 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
private IMemoryBlockConnection fConnection;
private final static int MAX_MENU_COLUMN_COUNT = 8;
-
+
public TraditionalRendering(String id)
{
super(id);
@@ -188,10 +197,129 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
private int fAddressableSize;
private int fAddressSize;
+ /*
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener#modelChanged(org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta, org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy)
+ */
+ public void modelChanged(IModelDelta delta, IModelProxy proxy)
+ {
+ /*
+ * The event model in the traditional renderer is written to expect a suspend first
+ * which will cause it to save its current data set away in an archive. Then when
+ * the state change comes through it will compare and refresh showing a difference.
+ */
+ int flags = delta.getFlags();
+ if ( ( flags & IModelDelta.STATE ) != 0 ) {
+ DebugEvent debugEvent = new DebugEvent(delta.getElement(), DebugEvent.SUSPEND, DebugEvent.CONTENT);
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { debugEvent });
+ }
+
+ DebugEvent debugEvent = new DebugEvent(delta.getElement(), DebugEvent.CHANGE, DebugEvent.CONTENT);
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { debugEvent });
+ }
+
+ /*
+ * These hashes make sure we do not create a separate model proxy for the same memory block. If
+ * we did then we would get duplicate state changes which would hide the actual changes since
+ * the renderer would be notified of state change too many times and wipe out the difference
+ * calculation it does. If we create multiple renderers against the same memory block we will
+ * use the same Model Proxy for all of them. So we need to keep a count to know when the last
+ * renderer has been torn down and we can freeup the proxy for that memory block. These stores
+ * are always manipulate and tested on the UI dispatch thread for data integrity.
+ */
+ private static HashMap proxies = new HashMap(); // MemoryBlock --> Proxy
+ private static HashMap proxies_cnt = new HashMap(); // MemoryBlock --> count
+
@Override
- public void init(IMemoryRenderingContainer container, IMemoryBlock block)
+ public void dispose()
+ {
+ /*
+ * We use the UI dispatch thread to protect the proxy information. Even though I believe the
+ * dispose routine is always called in the UI dispatch thread. I am going to make sure.
+ */
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IMemoryBlock block = getMemoryBlock();
+
+ /*
+ * See if we already know about this block and already have a proxy for it.
+ */
+ if ( proxies_cnt.containsKey( block ) ) {
+ Integer cur_cnt = proxies_cnt.get( block );
+ cur_cnt -- ;
+
+ /*
+ * If the count is zero this is the last render associated with this block.
+ * We can clean out this block/proxy.
+ */
+ if ( cur_cnt == 0 ) {
+
+ proxies_cnt.remove( block );
+ IModelProxy proxy = proxies.remove( block );
+
+ /*
+ * Before disposal make sure we take down the listener so we do not get
+ * any phantom notifications.
+ */
+ proxy.removeModelChangedListener(TraditionalRendering.this);
+ proxy.dispose();
+
+ }
+ else {
+ /*
+ * Not the last so just put back the reduced count.
+ */
+ proxies_cnt.put( block, cur_cnt );
+ }
+ }
+ }});
+
+ if(this.fRendering != null)
+ this.fRendering.dispose();
+ disposeColors();
+ super.dispose();
+ }
+
+// private IModelProxy fModel;
+ @Override
+ public void init(final IMemoryRenderingContainer container, final IMemoryBlock block)
{
super.init(container, block);
+
+ if ( block instanceof IModelProxyFactory ) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+
+ if ( proxies.containsKey( block ) ) {
+ /*
+ * Increment the count and reuse the proxy again.
+ */
+ proxies_cnt.put( block, proxies_cnt.get( block ) + 1 );
+ }
+ else {
+ /*
+ * We need to create a new proxy. First generate an acceptable Presentation Context.
+ */
+ IMemoryRenderingSite site = container.getMemoryRenderingSite();
+ MemoryViewPresentationContext context = new MemoryViewPresentationContext(site, container, TraditionalRendering.this);
+
+ /*
+ * Get a new proxy and perform the initialization sequence so we are known the
+ * the model provider.
+ */
+ IModelProxyFactory factory = (IModelProxyFactory) block;
+ IModelProxy proxy = factory.createModelProxy(block, context);
+ proxy.installed(null);
+ proxy.addModelChangedListener(TraditionalRendering.this);
+
+ /*
+ * Now note this block/proxy so we can reuse it later if more renderers are create
+ * with the same block.
+ */
+ proxies.put( block , proxy );
+ proxies_cnt.put( block, new Integer(1) );
+ }
+ }});
+ }
try
{
@@ -1235,15 +1363,6 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
// user can then change display endian if desired.
fRendering.setDisplayLittleEndian(littleEndian);
}
-
- @Override
- public void dispose()
- {
- if(this.fRendering != null)
- this.fRendering.dispose();
- disposeColors();
- super.dispose();
- }
/* (non-Javadoc)
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
@@ -1251,7 +1370,7 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
@Override
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter)
- {
+ {
if(adapter == IWorkbenchAdapter.class)
{
if(this.fWorkbenchAdapter == null)
@@ -1317,7 +1436,7 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
return super.getAdapter(adapter);
}
-
+
public void resetRendering() throws DebugException {
fRendering.gotoAddress(fRendering.fBaseAddress);
}
@@ -1335,8 +1454,8 @@ class CopyBinaryAction extends CopyAction
public CopyBinaryAction(Rendering rendering) {
super(rendering, CopyType.BINARY, DND.CLIPBOARD);
- setText(TraditionalRenderingMessages.getString("TraditionalRendering.BINARY")); //$NON-NLS-1$
- setToolTipText(TraditionalRenderingMessages.getString("TraditionalRendering.COPY_SELECTED_DATA")); //$NON-NLS-1$
+ setText(TraditionalRenderingMessages.getString("TraditionalRendering.BINARY")); //$NON-NLS-1$
+ setToolTipText(TraditionalRenderingMessages.getString("TraditionalRendering.COPY_SELECTED_DATA")); //$NON-NLS-1$
}
}
From e5d456ed53102393d02e23e48fdd4fb4413469d8 Mon Sep 17 00:00:00 2001
From: Randy Rohrbach
Date: Mon, 22 Oct 2012 21:52:52 +0200
Subject: [PATCH 08/25] Bug 392095 The Traditional Memory Renderer does not
work properly with the TCF Memory Block.
This is an initial solution which is made up of 2 parts
1.) Changed the lower-level renderer to filter based on memory block as well as debug target.
2.) Changed the parent render to become a listener for model changed events which are translated
in to direct calls to the renderer to update the displayed values.
---
.../traditional/TraditionalRendering.java | 152 ++++++------------
1 file changed, 52 insertions(+), 100 deletions(-)
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java
index f18cb2d5c7c..5692f7f0e35 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java
@@ -13,7 +13,6 @@ package org.eclipse.cdt.debug.ui.memory.traditional;
import java.lang.reflect.Method;
import java.math.BigInteger;
-import java.util.HashMap;
import org.eclipse.cdt.debug.core.model.provisional.IMemoryRenderingViewportProvider;
import org.eclipse.core.commands.AbstractHandler;
@@ -23,9 +22,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
import org.eclipse.debug.core.model.MemoryByte;
@@ -200,124 +197,79 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
/*
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener#modelChanged(org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta, org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy)
*/
- public void modelChanged(IModelDelta delta, IModelProxy proxy)
- {
- /*
- * The event model in the traditional renderer is written to expect a suspend first
- * which will cause it to save its current data set away in an archive. Then when
- * the state change comes through it will compare and refresh showing a difference.
- */
- int flags = delta.getFlags();
- if ( ( flags & IModelDelta.STATE ) != 0 ) {
- DebugEvent debugEvent = new DebugEvent(delta.getElement(), DebugEvent.SUSPEND, DebugEvent.CONTENT);
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { debugEvent });
- }
+ public void modelChanged(IModelDelta delta, IModelProxy proxy)
+ {
+ /*
+ * The event model in the traditional renderer is written to expect a suspend first
+ * which will cause it to save its current data set away in an archive. Then when
+ * the state change comes through it will compare and refresh showing a difference.
+ */
+ int flags = delta.getFlags();
+ if ( ( flags & IModelDelta.STATE ) != 0 ) {
+ fRendering.handleSuspend(false);
+ }
- DebugEvent debugEvent = new DebugEvent(delta.getElement(), DebugEvent.CHANGE, DebugEvent.CONTENT);
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { debugEvent });
- }
+ fRendering.handleChange();
+ }
/*
- * These hashes make sure we do not create a separate model proxy for the same memory block. If
- * we did then we would get duplicate state changes which would hide the actual changes since
- * the renderer would be notified of state change too many times and wipe out the difference
- * calculation it does. If we create multiple renderers against the same memory block we will
- * use the same Model Proxy for all of them. So we need to keep a count to know when the last
- * renderer has been torn down and we can freeup the proxy for that memory block. These stores
- * are always manipulate and tested on the UI dispatch thread for data integrity.
+ * We use the model proxy which is supplied by the TCF implementation to provide the knowledge of memory
+ * change notifications. The older backends ( the reference model, Wind River Systems Inc. ) are written
+ * to generate the Debug Model events. TCF follows the "ModelDelta/IModelProxy" implementation that the
+ * platform renderers use. So this implementation acts as a shim. If the older Debug Events come in then
+ * fine. If the newer model deltas come in fine also.
*/
- private static HashMap proxies = new HashMap(); // MemoryBlock --> Proxy
- private static HashMap proxies_cnt = new HashMap(); // MemoryBlock --> count
-
+ private IModelProxy fModel;
+
@Override
- public void dispose()
+ public void dispose()
{
- /*
- * We use the UI dispatch thread to protect the proxy information. Even though I believe the
- * dispose routine is always called in the UI dispatch thread. I am going to make sure.
- */
+ /*
+ * We use the UI dispatch thread to protect the proxy information. Even though I believe the
+ * dispose routine is always called in the UI dispatch thread. I am going to make sure.
+ */
Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- IMemoryBlock block = getMemoryBlock();
-
- /*
- * See if we already know about this block and already have a proxy for it.
- */
- if ( proxies_cnt.containsKey( block ) ) {
- Integer cur_cnt = proxies_cnt.get( block );
- cur_cnt -- ;
-
- /*
- * If the count is zero this is the last render associated with this block.
- * We can clean out this block/proxy.
- */
- if ( cur_cnt == 0 ) {
-
- proxies_cnt.remove( block );
- IModelProxy proxy = proxies.remove( block );
-
- /*
- * Before disposal make sure we take down the listener so we do not get
- * any phantom notifications.
- */
- proxy.removeModelChangedListener(TraditionalRendering.this);
- proxy.dispose();
-
- }
- else {
- /*
- * Not the last so just put back the reduced count.
- */
- proxies_cnt.put( block, cur_cnt );
- }
- }
- }});
-
+ public void run() {
+ if ( fModel != null ) {
+ fModel.removeModelChangedListener(TraditionalRendering.this);
+ fModel.dispose();
+ }
+ }});
+
if(this.fRendering != null)
this.fRendering.dispose();
disposeColors();
super.dispose();
}
-
-// private IModelProxy fModel;
+
@Override
public void init(final IMemoryRenderingContainer container, final IMemoryBlock block)
{
super.init(container, block);
+ /*
+ * Working with the model proxy must be done on the UI dispatch thread.
+ */
if ( block instanceof IModelProxyFactory ) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
-
- if ( proxies.containsKey( block ) ) {
- /*
- * Increment the count and reuse the proxy again.
- */
- proxies_cnt.put( block, proxies_cnt.get( block ) + 1 );
- }
- else {
- /*
- * We need to create a new proxy. First generate an acceptable Presentation Context.
- */
- IMemoryRenderingSite site = container.getMemoryRenderingSite();
- MemoryViewPresentationContext context = new MemoryViewPresentationContext(site, container, TraditionalRendering.this);
- /*
- * Get a new proxy and perform the initialization sequence so we are known the
- * the model provider.
- */
- IModelProxyFactory factory = (IModelProxyFactory) block;
- IModelProxy proxy = factory.createModelProxy(block, context);
- proxy.installed(null);
- proxy.addModelChangedListener(TraditionalRendering.this);
-
- /*
- * Now note this block/proxy so we can reuse it later if more renderers are create
- * with the same block.
- */
- proxies.put( block , proxy );
- proxies_cnt.put( block, new Integer(1) );
- }
+ /*
+ * The asynchronous model assumes we have an asynchronous viewer that has an IPresentationContext
+ * to represent it. The Platform memory subsystem provides a way to create one without a viewewr.
+ */
+ IMemoryRenderingSite site = container.getMemoryRenderingSite();
+ MemoryViewPresentationContext context = new MemoryViewPresentationContext(site, container, TraditionalRendering.this);
+
+ /*
+ * Get a new proxy and perform the initialization sequence so we are known the
+ * the model provider.
+ */
+ IModelProxyFactory factory = (IModelProxyFactory) block;
+ fModel = factory.createModelProxy(block, context);
+ fModel.installed(null);
+ fModel.addModelChangedListener(TraditionalRendering.this);
+
}});
}
From 90a6c37f6b1563099ac8eccc16e47101078aef97 Mon Sep 17 00:00:00 2001
From: Randy Rohrbach
Date: Mon, 22 Oct 2012 23:03:38 +0200
Subject: [PATCH 09/25] Bug 392095 The Traditional Memory Renderer does not
work properly with the TCF Memory Block.
Tightened up obtaining the factory using an adapter ( pawel input ).
---
.../debug/ui/memory/traditional/TraditionalRendering.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java
index 5692f7f0e35..b9331ea9f69 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/TraditionalRendering.java
@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
import org.eclipse.debug.core.model.MemoryByte;
@@ -250,7 +251,8 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
/*
* Working with the model proxy must be done on the UI dispatch thread.
*/
- if ( block instanceof IModelProxyFactory ) {
+ final IModelProxyFactory factory = (IModelProxyFactory) DebugPlugin.getAdapter(block, IModelProxyFactory.class );
+ if ( factory != null ) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
@@ -265,7 +267,6 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
* Get a new proxy and perform the initialization sequence so we are known the
* the model provider.
*/
- IModelProxyFactory factory = (IModelProxyFactory) block;
fModel = factory.createModelProxy(block, context);
fModel.installed(null);
fModel.addModelChangedListener(TraditionalRendering.this);
From d514c8e8d4c78a5144a796d3afa263622f0679eb Mon Sep 17 00:00:00 2001
From: Sergey Prigogin
Date: Tue, 23 Oct 2012 12:28:01 +0200
Subject: [PATCH 10/25] Whitespace.
---
.../parser/cpp/semantics/SemanticUtil.java | 104 +++++++++---------
1 file changed, 52 insertions(+), 52 deletions(-)
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java
index 9de29a630bb..e3aa691c27c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java
@@ -78,14 +78,14 @@ public class SemanticUtil {
// Resolve typedefs.
public static final int TDEF = 0x01;
// Resolve typedefs, but only if necessary for a nested type transformation.
- public static final int COND_TDEF = 0x02;
+ public static final int COND_TDEF = 0x02;
public static final int REF = 0x04;
public static final int CVTYPE = 0x08;
public static final int ALLCVQ = 0x10;
public static final int PTR = 0x20;
public static final int MPTR = 0x40;
public static final int ARRAY = 0x80;
-
+
static {
final int OPERATOR_SPC= OPERATOR_CHARS.length + 1;
for (OverloadableOperator op : OverloadableOperator.values()) {
@@ -93,7 +93,7 @@ public class SemanticUtil {
cas.put(CharArrayUtils.subarray(name, OPERATOR_SPC, name.length));
}
}
-
+
/**
* Returns an array of ICPPMethod objects representing all conversion operators
* declared by the specified class. This does not include inherited methods. Conversion
@@ -116,7 +116,7 @@ public class SemanticUtil {
}
return methods;
}
-
+
/**
* Returns an array of ICPPMethod objects representing all conversion operators
* declared by the specified class and its ancestors. This includes inherited
@@ -132,7 +132,7 @@ public class SemanticUtil {
}
return methods;
}
-
+
/**
* @param root the class to start at
* @return the root and all its ancestor classes
@@ -147,7 +147,7 @@ public class SemanticUtil {
ObjectSet next= new ObjectSet(2);
for (int i = 0; i < current.size(); i++) {
- ICPPClassType clazz= current.keyAt(i);
+ ICPPClassType clazz= current.keyAt(i);
done.put(clazz);
for (ICPPBase base : ClassTypeHelper.getBases(clazz, point)) {
@@ -181,21 +181,21 @@ public class SemanticUtil {
}
return false;
}
-
+
public static CVQualifier getCVQualifier(IType t) {
if (t instanceof IQualifierType) {
IQualifierType qt= (IQualifierType) t;
- return qt.isConst()
+ return qt.isConst()
? qt.isVolatile() ? CONST_VOLATILE : CONST
: qt.isVolatile() ? VOLATILE : NONE;
- }
+ }
if (t instanceof IPointerType) {
IPointerType pt= (IPointerType) t;
- return pt.isConst()
- ? pt.isVolatile()
+ return pt.isConst()
+ ? pt.isVolatile()
? pt.isRestrict() ? CONST_VOLATILE_RESTRICT : CONST_VOLATILE
: pt.isRestrict() ? CONST_RESTRICT : CONST
- : pt.isVolatile()
+ : pt.isVolatile()
? pt.isRestrict() ? VOLATILE_RESTRICT : VOLATILE
: pt.isRestrict() ? RESTRICT : NONE;
}
@@ -204,7 +204,7 @@ public class SemanticUtil {
}
return NONE;
}
-
+
/**
* Descends into type containers, stopping at pointer-to-member types if
* specified.
@@ -216,7 +216,7 @@ public class SemanticUtil {
final int options = TDEF | ALLCVQ | PTR | ARRAY | REF;
return getNestedType(type, stopAtPointerToMember ? options : (options | MPTR));
}
-
+
/**
* Descends into type containers, stopping at array, pointer or
* pointer-to-member types.
@@ -273,10 +273,10 @@ public class SemanticUtil {
beforeTypedefs = null;
} else if (tdef || cond_tdef) {
t= getNestedType(qttgt, options);
- if (t == qttgt)
+ if (t == qttgt)
return qt;
return addQualifiers(t, qt.isConst(), qt.isVolatile(), false);
- }
+ }
} else if (type instanceof IArrayType) {
final IArrayType atype= (IArrayType) type;
if ((options & ARRAY) != 0) {
@@ -298,7 +298,7 @@ public class SemanticUtil {
// A typedef within the reference type can influence whether the reference is lvalue or rvalue
IType nested= rt.getType();
IType newNested = getNestedType(nested, TDEF);
- if (nested == newNested)
+ if (nested == newNested)
return type;
return replaceNestedType((ITypeContainer) rt, newNested);
}
@@ -310,7 +310,7 @@ public class SemanticUtil {
}
return type;
}
-
+
type= t;
}
}
@@ -331,7 +331,7 @@ public class SemanticUtil {
return type;
}
return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(), ft.takesVarArgs());
- }
+ }
if (type instanceof ITypedef) {
IType t= ((ITypedef) type).getType();
@@ -342,31 +342,31 @@ public class SemanticUtil {
if (type instanceof ITypeContainer) {
final ITypeContainer tc = (ITypeContainer) type;
final IType nestedType= tc.getType();
- if (nestedType == null)
+ if (nestedType == null)
return type;
-
+
IType newType= getSimplifiedType(nestedType);
if (newType != nestedType) {
return replaceNestedType(tc, newType);
- }
+ }
return type;
}
return type;
}
-
+
static boolean isSimplified(IType type) {
if (type instanceof ICPPFunctionType) {
final ICPPFunctionType ft = (ICPPFunctionType) type;
if (!isSimplified(ft.getReturnType()))
return false;
-
+
IType[] ps = ft.getParameterTypes();
for (IType p : ps) {
if (!isSimplified(p))
return false;
}
return true;
- }
+ }
if (type instanceof ITypedef) {
return false;
}
@@ -379,7 +379,7 @@ public class SemanticUtil {
public static IType replaceNestedType(ITypeContainer type, IType newNestedType) {
if (newNestedType == null)
return type;
-
+
// Bug 249085 make sure not to add unnecessary qualifications
if (type instanceof IQualifierType) {
IQualifierType qt= (IQualifierType) type;
@@ -393,9 +393,9 @@ public class SemanticUtil {
/**
* Replaces the given type or its nested type with a typedef if that type is the same as
- * the type the typedef resolves to.
- *
- * @param type the type subject to substitution
+ * the type the typedef resolves to.
+ *
+ * @param type the type subject to substitution
* @param typedefType the type possibly containing the typedef as its nested type.
* @return the given type with the nested type replaced by the typedef, or {@code null} if
* the typedefType doesn't contain a typedef or the nested type doesn't match the typedef.
@@ -439,7 +439,7 @@ public class SemanticUtil {
public static IType mapToAST(IType type, IASTNode node) {
if (node == null)
return type;
-
+
if (type instanceof IFunctionType) {
final ICPPFunctionType ft = (ICPPFunctionType) type;
final IType r = ft.getReturnType();
@@ -452,13 +452,13 @@ public class SemanticUtil {
if (type instanceof ITypeContainer) {
final ITypeContainer tc = (ITypeContainer) type;
final IType nestedType= tc.getType();
- if (nestedType == null)
+ if (nestedType == null)
return type;
-
+
IType newType= mapToAST(nestedType, node);
if (newType != nestedType) {
return replaceNestedType(tc, newType);
- }
+ }
return type;
} else if (type instanceof ICPPClassType && type instanceof IIndexBinding) {
IASTTranslationUnit tu = node.getTranslationUnit();
@@ -535,17 +535,17 @@ public class SemanticUtil {
return baseType;
} else if (baseType instanceof ICPPPointerToMemberType) {
ICPPPointerToMemberType pt= (ICPPPointerToMemberType) baseType;
- if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
+ if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
|| (restrict && !pt.isRestrict())) {
- return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(),
+ return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(),
cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict());
}
return baseType;
} else if (baseType instanceof IPointerType) {
IPointerType pt= (IPointerType) baseType;
- if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
+ if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
|| (restrict && !pt.isRestrict())) {
- return new CPPPointerType(pt.getType(),
+ return new CPPPointerType(pt.getType(),
cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict());
}
return baseType;
@@ -562,7 +562,7 @@ public class SemanticUtil {
} else if (baseType == null) {
return null;
}
-
+
return new CPPQualifierType(baseType, cnst, vol);
}
return baseType;
@@ -590,7 +590,7 @@ public class SemanticUtil {
}
} else if (owner1 instanceof ICPPNamespace) {
if (owner2 instanceof ICPPNamespace) {
- if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray()))
+ if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray()))
return false;
return isSameOwner(owner1.getOwner(), owner2.getOwner());
}
@@ -611,7 +611,7 @@ public class SemanticUtil {
public static boolean isEmptyParameterList(IType[] parameters) {
if (parameters.length == 0) {
return true;
- }
+ }
if (parameters.length == 1 && isVoidType(parameters[0])) {
return true;
}
@@ -629,28 +629,28 @@ public class SemanticUtil {
public static final int calculateInheritanceDepth(IType type, IType baseClass, IASTNode point) {
return calculateInheritanceDepth(CPPSemantics.MAX_INHERITANCE_DEPTH, new HashSet