diff options
author | Szymon Ptaszkiewicz | 2014-11-17 15:29:45 +0000 |
---|---|---|
committer | Jayaprakash Arthanareeswaran | 2014-11-28 11:06:42 +0000 |
commit | 7c614d1e063fcf9f7927d45e5d481818530396ac (patch) | |
tree | 0229d234630e503ae1dc76d7a8040da9ae677c43 | |
parent | 67568cf7908374a12b930ce4d634e4a484a346ae (diff) | |
download | eclipse.jdt.core-7c614d1e063fcf9f7927d45e5d481818530396ac.tar.gz eclipse.jdt.core-7c614d1e063fcf9f7927d45e5d481818530396ac.tar.xz eclipse.jdt.core-7c614d1e063fcf9f7927d45e5d481818530396ac.zip |
Bug 451902 - Add org.eclipse.jdt.apt.core plugin to General > Tracing preference page
Change-Id: I9c713f54b7649d44fdcd1f65c176ac3872e58a4d
Signed-off-by: Szymon Ptaszkiewicz <szymon.ptaszkiewicz@pl.ibm.com>
-rw-r--r-- | org.eclipse.jdt.apt.core/plugin.properties | 5 | ||||
-rw-r--r-- | org.eclipse.jdt.apt.core/plugin.xml | 14 | ||||
-rw-r--r-- | org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/AptPlugin.java | 33 |
3 files changed, 39 insertions, 13 deletions
diff --git a/org.eclipse.jdt.apt.core/plugin.properties b/org.eclipse.jdt.apt.core/plugin.properties index 7f38659034..39292f9b14 100644 --- a/org.eclipse.jdt.apt.core/plugin.properties +++ b/org.eclipse.jdt.apt.core/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2005, 2007 BEA Systems Inc. and others. +# Copyright (c) 2005, 2014 BEA 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 @@ -15,4 +15,5 @@ annotationProcessingName=Annotation Processing aptBatchMarkerName=Annotation Problem aptNonreconcileBatchMarkerName=Annotation Problem (build-only processor) aptBuildMarkerName=APT Build Problem -aptConfigurationMarkerName=APT Configuration Problem
\ No newline at end of file +aptConfigurationMarkerName=APT Configuration Problem +traceComponentLabel=JDT APT Core diff --git a/org.eclipse.jdt.apt.core/plugin.xml b/org.eclipse.jdt.apt.core/plugin.xml index 413c9f050e..7ba2f9d6ef 100644 --- a/org.eclipse.jdt.apt.core/plugin.xml +++ b/org.eclipse.jdt.apt.core/plugin.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <!-- - Copyright (c) 2005, 2010 IBM Corporation and others. + Copyright (c) 2005, 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 @@ -88,4 +88,16 @@ point="org.eclipse.core.runtime.preferences"> <initializer class="org.eclipse.jdt.apt.core.internal.util.AptCorePreferenceInitializer"/> </extension> + +<extension + point="org.eclipse.ui.trace.traceComponents"> + <component + id="org.eclipse.jdt.apt.core.trace" + label="%traceComponentLabel"> + <bundle + consumed="false" + name="org.eclipse.jdt.apt.core"> + </bundle> + </component> +</extension> </plugin> diff --git a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/AptPlugin.java b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/AptPlugin.java index eef6c6c663..1aec2908c9 100644 --- a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/AptPlugin.java +++ b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/AptPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 BEA Systems, Inc. + * Copyright (c) 2005, 2014 BEA 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 @@ -14,6 +14,7 @@ package org.eclipse.jdt.apt.core.internal; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; +import java.util.Hashtable; import java.util.Map; import org.eclipse.core.resources.IResourceChangeEvent; @@ -25,9 +26,12 @@ import org.eclipse.jdt.apt.core.internal.generatedfile.GeneratedResourceChangeLi import org.eclipse.jdt.apt.core.util.AptConfig; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; +import org.eclipse.osgi.service.debug.DebugOptions; +import org.eclipse.osgi.service.debug.DebugOptionsListener; import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; -public class AptPlugin extends Plugin { +public class AptPlugin extends Plugin implements DebugOptionsListener { public static final String PLUGIN_ID = "org.eclipse.jdt.apt.core"; //$NON-NLS-1$ // Tracing options @@ -67,6 +71,8 @@ public class AptPlugin extends Plugin { private static AptPlugin thePlugin = null; // singleton object + private ServiceRegistration<DebugOptionsListener> debugRegistration; + /** * The javax.annotation.processing.Processor class, which is only available on Java 6 and higher. */ @@ -84,7 +90,12 @@ public class AptPlugin extends Plugin { public void start(BundleContext context) throws Exception { thePlugin = this; super.start(context); - initDebugTracing(); + + // register debug options listener + Hashtable<String, String> properties = new Hashtable<String, String>(2); + properties.put(DebugOptions.LISTENER_SYMBOLICNAME, PLUGIN_ID); + debugRegistration = context.registerService(DebugOptionsListener.class, this, properties); + // Do we have access to try { @@ -112,6 +123,10 @@ public class AptPlugin extends Plugin { public void stop(BundleContext context) throws Exception { super.stop(context); + + // unregister debug options listener + debugRegistration.unregister(); + debugRegistration = null; } public static AptPlugin getPlugin() { @@ -166,13 +181,11 @@ public class AptPlugin extends Plugin { return new Status(IStatus.INFO, PLUGIN_ID, STATUS_EXCEPTION, message, e); } - private void initDebugTracing() { - String option = Platform.getDebugOption(APT_DEBUG_OPTION); - if(option != null) DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ - option = Platform.getDebugOption(APT_DEBUG_GFM_OPTION); - if(option != null) DEBUG_GFM = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ - option = Platform.getDebugOption(APT_DEBUG_GFM_MAPS_OPTION); - if(option != null) DEBUG_GFM_MAPS = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ + public void optionsChanged(DebugOptions options) { + DEBUG = options.getBooleanOption(APT_DEBUG_OPTION, false); + DEBUG_GFM = options.getBooleanOption(APT_DEBUG_GFM_OPTION, false); + DEBUG_GFM_MAPS = options.getBooleanOption(APT_DEBUG_GFM_MAPS_OPTION, false); + DEBUG_COMPILATION_ENV = options.getBooleanOption(APT_COMPILATION_ENV_OPTION, false); } public static void trace(final String msg){ |