Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 142407 Details for
Bug 284348
[Validation] Deterioration of performance with Eclipse Galileo due to Tracing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch and testcase
patchforthebug.patch (text/plain), 5.29 KB, created by
Boris Gruschko
on 2009-07-23 11:20:23 EDT
(
hide
)
Description:
Patch and testcase
Filename:
MIME Type:
Creator:
Boris Gruschko
Created:
2009-07-23 11:20:23 EDT
Size:
5.29 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.validation.tests >Index: src/org/eclipse/emf/validation/tests/PluginTest.java >=================================================================== >RCS file: src/org/eclipse/emf/validation/tests/PluginTest.java >diff -N src/org/eclipse/emf/validation/tests/PluginTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/validation/tests/PluginTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+/** >+ * <copyright> >+ * >+ * Copyright (c) 2009 SAP AG 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: >+ * SAP - Initial API and implementation >+ * >+ * </copyright> >+ * >+ * $Id$ >+ */ >+package org.eclipse.emf.validation.tests; >+ >+import org.eclipse.emf.validation.internal.EMFModelValidationPlugin; >+import org.osgi.framework.Bundle; >+ >+import junit.framework.TestCase; >+ >+/** >+ * Tests for the validation plugin integration. >+ * >+ * @author Boris Gruschko >+ * >+ */ >+public class PluginTest extends TestCase { >+ >+ private static final String DEBUG_OPTION = "org.eclipse.emf.validation/debug"; //$NON-NLS-1$ >+ >+ public PluginTest() { >+ super( "Validation plugin integration"); //$NON-NLS-1$ >+ } >+ >+ /** >+ * Tests the dynamic switch into debug/trace mode >+ */ >+ public void testDebugModeSetting() { >+ assertEquals(Bundle.ACTIVE, EMFModelValidationPlugin.getPlugin().getBundle().getState()); >+ assertFalse(EMFModelValidationPlugin.getPlugin().isDebugging()); >+ assertFalse(EMFModelValidationPlugin.Tracing.shouldTrace(DEBUG_OPTION)); >+ >+ EMFModelValidationPlugin.getPlugin().setDebugging(true); >+ >+ assertTrue(EMFModelValidationPlugin.getPlugin().isDebugging()); >+ assertTrue(EMFModelValidationPlugin.Tracing.shouldTrace(DEBUG_OPTION)); >+ >+ EMFModelValidationPlugin.getPlugin().setDebugging(false); >+ >+ assertFalse(EMFModelValidationPlugin.Tracing.shouldTrace(DEBUG_OPTION)); >+ } >+ >+} >#P org.eclipse.emf.validation >Index: src/org/eclipse/emf/validation/internal/EMFModelValidationPlugin.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.validation/plugins/org.eclipse.emf.validation/src/org/eclipse/emf/validation/internal/EMFModelValidationPlugin.java,v >retrieving revision 1.6 >diff -u -r1.6 EMFModelValidationPlugin.java >--- src/org/eclipse/emf/validation/internal/EMFModelValidationPlugin.java 5 Oct 2008 22:12:16 -0000 1.6 >+++ src/org/eclipse/emf/validation/internal/EMFModelValidationPlugin.java 23 Jul 2009 15:20:41 -0000 >@@ -15,7 +15,9 @@ > package org.eclipse.emf.validation.internal; > > import java.util.Collection; >+import java.util.Dictionary; > import java.util.HashMap; >+import java.util.Hashtable; > import java.util.Iterator; > import java.util.Map; > >@@ -26,6 +28,8 @@ > import org.eclipse.emf.common.EMFPlugin; > import org.eclipse.emf.common.util.ResourceLocator; > import org.eclipse.emf.validation.internal.l10n.ValidationMessages; >+import org.eclipse.osgi.service.debug.DebugOptions; >+import org.eclipse.osgi.service.debug.DebugOptionsListener; > import org.eclipse.osgi.util.NLS; > import org.osgi.framework.BundleContext; > >@@ -213,7 +217,7 @@ > * > * @author Christian W. Damus (cdamus) > */ >- public static class Implementation extends EMFPlugin.EclipsePlugin { >+ public static class Implementation extends EMFPlugin.EclipsePlugin implements DebugOptionsListener { > /** > * Track extensions for extension points defined in this bundle. > */ >@@ -237,6 +241,11 @@ > super.start(context); > > extensionTracker = new ExtensionTracker(); >+ >+ // register listener that is notified whenever debug options change >+ Dictionary<String, Object> props = new Hashtable<String, Object>(4); >+ props.put(DebugOptions.LISTENER_SYMBOLICNAME, getPluginId()); >+ context.registerService(DebugOptionsListener.class.getName(), this, props); > } > > @Override >@@ -246,6 +255,10 @@ > > super.stop(context); > } >+ >+ public void optionsChanged(DebugOptions options) { >+ Tracing.invalidateCache(); >+ } > } > > public static class Tracing { >@@ -255,13 +268,32 @@ > private static final Map<String, Boolean> cachedOptions = new HashMap<String, Boolean>(); > > /** >+ * The cached Boolean value indicating whether tracing is enabled. >+ */ >+ private static Boolean debugging = null; >+ >+ /** >+ * Invalidates the cached debug options and the cached Boolean value >+ * indicating whether tracing is enabled. >+ */ >+ protected static void invalidateCache() { >+ cachedOptions.clear(); >+ debugging = null; >+ } >+ >+ /** > * Retrieves a Boolean value indicating whether tracing is enabled. > * > * @return Whether tracing is enabled for the plug-in. > * > */ > protected static boolean shouldTrace() { >- return plugin.isDebugging(); >+ synchronized (cachedOptions) { >+ if (debugging == null) { >+ debugging = plugin.isDebugging(); >+ } >+ } >+ return debugging.booleanValue(); > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 284348
:
142352
|
142366
| 142407