Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Ptaszkiewicz2014-11-14 17:13:53 +0000
committerJayaprakash Arthanareeswaran2014-12-01 13:17:18 +0000
commitec3141ffcff3411a0e4abbb098ed096a885f0d97 (patch)
tree81fd8382013f015072dc5137003fe562afcc214f /org.eclipse.jdt.core
parenta64919c0c4ec66879cf77662550d459f0b5a8477 (diff)
downloadeclipse.jdt.core-ec3141ffcff3411a0e4abbb098ed096a885f0d97.tar.gz
eclipse.jdt.core-ec3141ffcff3411a0e4abbb098ed096a885f0d97.tar.xz
eclipse.jdt.core-ec3141ffcff3411a0e4abbb098ed096a885f0d97.zip
Bug 451540 - Add org.eclipse.jdt.core plugin to General > Tracing
preference page Change-Id: Ib50f284f462aa490714f4f4cf71ea38cc53fc740 Signed-off-by: Szymon Ptaszkiewicz <szymon.ptaszkiewicz@pl.ibm.com>
Diffstat (limited to 'org.eclipse.jdt.core')
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java148
-rw-r--r--org.eclipse.jdt.core/plugin.properties4
-rw-r--r--org.eclipse.jdt.core/plugin.xml17
4 files changed, 75 insertions, 96 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
index 547b378072..fa02ee3956 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
@@ -5637,6 +5637,7 @@ public final class JavaCore extends Plugin {
*/
public void stop(BundleContext context) throws Exception {
try {
+ JavaModelManager.unregisterDebugOptionsListener();
JavaModelManager.getJavaModelManager().shutdown();
} finally {
// ensure we call super.stop as the last thing
@@ -5655,6 +5656,7 @@ public final class JavaCore extends Plugin {
*/
public void start(BundleContext context) throws Exception {
super.start(context);
+ JavaModelManager.registerDebugOptionsListener(context);
JavaModelManager.getJavaModelManager().startup();
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
index 30bc98a9b0..cadc79e30a 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
@@ -71,6 +71,10 @@ import org.eclipse.jdt.internal.core.util.WeakHashSet;
import org.eclipse.jdt.internal.core.util.WeakHashSetOfCharArray;
import org.eclipse.jdt.internal.core.util.LRUCache.Stats;
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter;
+import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugOptionsListener;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
import org.osgi.service.prefs.BackingStoreException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -88,7 +92,7 @@ import org.xml.sax.SAXException;
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class JavaModelManager implements ISaveParticipant, IContentTypeChangeListener {
-
+ private static ServiceRegistration<DebugOptionsListener> DEBUG_REGISTRATION;
private static final String NON_CHAINING_JARS_CACHE = "nonChainingJarsCache"; //$NON-NLS-1$
private static final String INVALID_ARCHIVES_CACHE = "invalidArchivesCache"; //$NON-NLS-1$
private static final String EXTERNAL_FILES_CACHE = "externalFilesCache"; //$NON-NLS-1$
@@ -246,6 +250,7 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
public String toString() { return getDescription(); }
};
+ private static final String DEBUG = JavaCore.PLUGIN_ID + "/debug"; //$NON-NLS-1$
private static final String BUFFER_MANAGER_DEBUG = JavaCore.PLUGIN_ID + "/debug/buffermanager" ; //$NON-NLS-1$
private static final String INDEX_MANAGER_DEBUG = JavaCore.PLUGIN_ID + "/debug/indexmanager" ; //$NON-NLS-1$
private static final String INDEX_MANAGER_ADVANCED_DEBUG = JavaCore.PLUGIN_ID + "/debug/indexmanager/advanced" ; //$NON-NLS-1$
@@ -1668,99 +1673,58 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
}
}
- /**
- * Configure the plugin with respect to option settings defined in ".options" file
- */
- public void configurePluginDebugOptions(){
- if(JavaCore.getPlugin().isDebugging()){
- String option = Platform.getDebugOption(BUFFER_MANAGER_DEBUG);
- if(option != null) BufferManager.VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(BUILDER_DEBUG);
- if(option != null) JavaBuilder.DEBUG = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(COMPILER_DEBUG);
- if(option != null) Compiler.DEBUG = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(BUILDER_STATS_DEBUG);
- if(option != null) JavaBuilder.SHOW_STATS = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(COMPLETION_DEBUG);
- if(option != null) CompletionEngine.DEBUG = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(CP_RESOLVE_DEBUG);
- if(option != null) JavaModelManager.CP_RESOLVE_VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(CP_RESOLVE_ADVANCED_DEBUG);
- if(option != null) JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(CP_RESOLVE_FAILURE_DEBUG);
- if(option != null) JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(DELTA_DEBUG);
- if(option != null) DeltaProcessor.DEBUG = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(DELTA_DEBUG_VERBOSE);
- if(option != null) DeltaProcessor.VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(DOM_AST_DEBUG);
- if(option != null) SourceRangeVerifier.DEBUG = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(DOM_AST_DEBUG_THROW);
- if(option != null) {
- SourceRangeVerifier.DEBUG_THROW = option.equalsIgnoreCase(TRUE) ;
+ public static void registerDebugOptionsListener(BundleContext context) {
+ // register debug options listener
+ Hashtable<String, String> properties = new Hashtable<String, String>(2);
+ properties.put(DebugOptions.LISTENER_SYMBOLICNAME, JavaCore.PLUGIN_ID);
+ DEBUG_REGISTRATION = context.registerService(DebugOptionsListener.class, new DebugOptionsListener() {
+ @Override
+ public void optionsChanged(DebugOptions options) {
+ boolean debug = options.getBooleanOption(DEBUG, false);
+ BufferManager.VERBOSE = debug && options.getBooleanOption(BUFFER_MANAGER_DEBUG, false);
+ JavaBuilder.DEBUG = debug && options.getBooleanOption(BUILDER_DEBUG, false);
+ Compiler.DEBUG = debug && options.getBooleanOption(COMPILER_DEBUG, false);
+ JavaBuilder.SHOW_STATS = debug && options.getBooleanOption(BUILDER_STATS_DEBUG, false);
+ CompletionEngine.DEBUG = debug && options.getBooleanOption(COMPLETION_DEBUG, false);
+ JavaModelManager.CP_RESOLVE_VERBOSE = debug && options.getBooleanOption(CP_RESOLVE_DEBUG, false);
+ JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED = debug && options.getBooleanOption(CP_RESOLVE_ADVANCED_DEBUG, false);
+ JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE = debug && options.getBooleanOption(CP_RESOLVE_FAILURE_DEBUG, false);
+ DeltaProcessor.DEBUG = debug && options.getBooleanOption(DELTA_DEBUG, false);
+ DeltaProcessor.VERBOSE = debug && options.getBooleanOption(DELTA_DEBUG_VERBOSE, false);
+ SourceRangeVerifier.DEBUG = debug && options.getBooleanOption(DOM_AST_DEBUG, false);
+ SourceRangeVerifier.DEBUG_THROW = debug && options.getBooleanOption(DOM_AST_DEBUG_THROW, false);
SourceRangeVerifier.DEBUG |= SourceRangeVerifier.DEBUG_THROW;
+ RewriteEventStore.DEBUG = debug && options.getBooleanOption(DOM_REWRITE_DEBUG, false);
+ TypeHierarchy.DEBUG = debug && options.getBooleanOption(HIERARCHY_DEBUG, false);
+ JobManager.VERBOSE = debug && options.getBooleanOption(INDEX_MANAGER_DEBUG, false);
+ IndexManager.DEBUG = debug && options.getBooleanOption(INDEX_MANAGER_ADVANCED_DEBUG, false);
+ JavaModelManager.VERBOSE = debug && options.getBooleanOption(JAVAMODEL_DEBUG, false);
+ JavaModelCache.VERBOSE = debug && options.getBooleanOption(JAVAMODELCACHE_DEBUG, false);
+ JavaModelOperation.POST_ACTION_VERBOSE = debug && options.getBooleanOption(POST_ACTION_DEBUG, false);
+ NameLookup.VERBOSE = debug && options.getBooleanOption(RESOLUTION_DEBUG, false);
+ BasicSearchEngine.VERBOSE = debug && options.getBooleanOption(SEARCH_DEBUG, false);
+ SelectionEngine.DEBUG = debug && options.getBooleanOption(SELECTION_DEBUG, false);
+ JavaModelManager.ZIP_ACCESS_VERBOSE = debug && options.getBooleanOption(ZIP_ACCESS_DEBUG, false);
+ SourceMapper.VERBOSE = debug && options.getBooleanOption(SOURCE_MAPPER_DEBUG_VERBOSE, false);
+ DefaultCodeFormatter.DEBUG = debug && options.getBooleanOption(FORMATTER_DEBUG, false);
+
+ // configure performance options
+ if(PerformanceStats.ENABLED) {
+ CompletionEngine.PERF = PerformanceStats.isEnabled(COMPLETION_PERF);
+ SelectionEngine.PERF = PerformanceStats.isEnabled(SELECTION_PERF);
+ DeltaProcessor.PERF = PerformanceStats.isEnabled(DELTA_LISTENER_PERF);
+ JavaModelManager.PERF_VARIABLE_INITIALIZER = PerformanceStats.isEnabled(VARIABLE_INITIALIZER_PERF);
+ JavaModelManager.PERF_CONTAINER_INITIALIZER = PerformanceStats.isEnabled(CONTAINER_INITIALIZER_PERF);
+ ReconcileWorkingCopyOperation.PERF = PerformanceStats.isEnabled(RECONCILE_PERF);
+ }
}
-
- option = Platform.getDebugOption(DOM_REWRITE_DEBUG);
- if(option != null) RewriteEventStore.DEBUG = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(HIERARCHY_DEBUG);
- if(option != null) TypeHierarchy.DEBUG = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(INDEX_MANAGER_DEBUG);
- if(option != null) JobManager.VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(INDEX_MANAGER_ADVANCED_DEBUG);
- if(option != null) IndexManager.DEBUG = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(JAVAMODEL_DEBUG);
- if(option != null) JavaModelManager.VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(JAVAMODELCACHE_DEBUG);
- if(option != null) JavaModelCache.VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(POST_ACTION_DEBUG);
- if(option != null) JavaModelOperation.POST_ACTION_VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(RESOLUTION_DEBUG);
- if(option != null) NameLookup.VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(SEARCH_DEBUG);
- if(option != null) BasicSearchEngine.VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(SELECTION_DEBUG);
- if(option != null) SelectionEngine.DEBUG = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(ZIP_ACCESS_DEBUG);
- if(option != null) JavaModelManager.ZIP_ACCESS_VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(SOURCE_MAPPER_DEBUG_VERBOSE);
- if(option != null) SourceMapper.VERBOSE = option.equalsIgnoreCase(TRUE) ;
-
- option = Platform.getDebugOption(FORMATTER_DEBUG);
- if(option != null) DefaultCodeFormatter.DEBUG = option.equalsIgnoreCase(TRUE) ;
- }
+ }, properties);
+ }
- // configure performance options
- if(PerformanceStats.ENABLED) {
- CompletionEngine.PERF = PerformanceStats.isEnabled(COMPLETION_PERF);
- SelectionEngine.PERF = PerformanceStats.isEnabled(SELECTION_PERF);
- DeltaProcessor.PERF = PerformanceStats.isEnabled(DELTA_LISTENER_PERF);
- JavaModelManager.PERF_VARIABLE_INITIALIZER = PerformanceStats.isEnabled(VARIABLE_INITIALIZER_PERF);
- JavaModelManager.PERF_CONTAINER_INITIALIZER = PerformanceStats.isEnabled(CONTAINER_INITIALIZER_PERF);
- ReconcileWorkingCopyOperation.PERF = PerformanceStats.isEnabled(RECONCILE_PERF);
- }
+ public static void unregisterDebugOptionsListener() {
+ // unregister debug options listener
+ DEBUG_REGISTRATION.unregister();
+ DEBUG_REGISTRATION = null;
}
/*
@@ -4989,8 +4953,6 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
public void startup() throws CoreException {
try {
- configurePluginDebugOptions();
-
// initialize Java model cache
this.cache = new JavaModelCache();
diff --git a/org.eclipse.jdt.core/plugin.properties b/org.eclipse.jdt.core/plugin.properties
index b6b29a2e78..b6804b8388 100644
--- a/org.eclipse.jdt.core/plugin.properties
+++ b/org.eclipse.jdt.core/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
+# Copyright (c) 2000, 2014 IBM Corporation 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
@@ -25,4 +25,4 @@ javaPropertiesName=Java Properties File
javaSourceName=Java Source File
javaClassName=Java Class File
jarManifestName=JAR Manifest File
-
+traceComponentLabel=JDT Core
diff --git a/org.eclipse.jdt.core/plugin.xml b/org.eclipse.jdt.core/plugin.xml
index 5d69788b9a..fb4ac26b96 100644
--- a/org.eclipse.jdt.core/plugin.xml
+++ b/org.eclipse.jdt.core/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
- Copyright (c) 2004, 2011 IBM Corporation and others.
+ Copyright (c) 2004, 2014 IBM Corporation 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
@@ -259,4 +259,19 @@
<modifier class="org.eclipse.jdt.internal.core.JavaCorePreferenceModifyListener"/>
</extension>
+<!-- =================================================================================== -->
+<!-- Extension: Eclipse tracing -->
+<!-- =================================================================================== -->
+<extension
+ point="org.eclipse.ui.trace.traceComponents">
+ <component
+ id="org.eclipse.jdt.core.trace"
+ label="%traceComponentLabel">
+ <bundle
+ consumed="false"
+ name="org.eclipse.jdt.core">
+ </bundle>
+ </component>
+</extension>
+
</plugin>

Back to the top