diff options
author | Mike Rennie | 2012-02-15 22:11:10 +0000 |
---|---|---|
committer | Mike Rennie | 2012-02-15 22:11:10 +0000 |
commit | d1d5476fcc2cadd0ee6ff5e5f235f0a8df842287 (patch) | |
tree | a36ba70f1198b786626ef0b6c4c5f55a81974173 /org.eclipse.debug.ui/ui/org | |
parent | ed185483add935843273bb087d1782e4497effc3 (diff) | |
download | eclipse.platform.debug-d1d5476fcc2cadd0ee6ff5e5f235f0a8df842287.tar.gz eclipse.platform.debug-d1d5476fcc2cadd0ee6ff5e5f235f0a8df842287.tar.xz eclipse.platform.debug-d1d5476fcc2cadd0ee6ff5e5f235f0a8df842287.zip |
Bug 370604 - Use new dynamic tracing optionsv20120215-2211
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
12 files changed, 184 insertions, 186 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java index bbcfc2ef7..7129afc04 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java @@ -16,6 +16,7 @@ package org.eclipse.debug.internal.ui; import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.util.HashSet; +import java.util.Hashtable; import java.util.Iterator; import java.util.Set; @@ -28,10 +29,13 @@ import com.ibm.icu.text.MessageFormat; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.service.packageadmin.PackageAdmin; +import org.osgi.service.prefs.BackingStoreException; import org.osgi.util.tracker.ServiceTracker; import org.w3c.dom.Document; +import org.eclipse.osgi.service.debug.DebugOptions; +import org.eclipse.osgi.service.debug.DebugOptionsListener; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display; @@ -53,6 +57,8 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.IJobChangeListener; import org.eclipse.core.runtime.jobs.IJobManager; import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.core.resources.ISaveContext; import org.eclipse.core.resources.ISaveParticipant; @@ -108,6 +114,7 @@ import org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager; import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility; import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupManager; import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointOrganizerManager; import org.eclipse.debug.internal.ui.views.console.ProcessConsoleManager; import org.eclipse.debug.internal.ui.views.launch.DebugElementHelper; @@ -128,8 +135,31 @@ import org.eclipse.debug.ui.ILaunchGroup; * @see LaunchConfigurationManager * @see PerspectiveManager */ -public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { +public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener, DebugOptionsListener { + public static boolean DEBUG = false; + public static boolean DEBUG_BREAKPOINT_DELTAS = false; + public static boolean DEBUG_MODEL = false; + public static boolean DEBUG_VIEWER = false; + public static boolean DEBUG_BREADCRUMB = false; + public static boolean DEBUG_TREE_VIEWER_DROPDOWN = false; + public static boolean DEBUG_CONTENT_PROVIDER = false; + public static boolean DEBUG_UPDATE_SEQUENCE = false; + public static boolean DEBUG_DELTAS = false; + public static boolean DEBUG_STATE_SAVE_RESTORE = false; + public static String DEBUG_PRESENTATION_ID = null; + + static final String DEBUG_FLAG = "org.eclipse.debug.ui/debug"; + static final String DEBUG_BREAKPOINT_DELTAS_FLAG = "org.eclipse.debug.ui/debug/viewers/breakpointDeltas"; + static final String DEBUG_MODEL_FLAG = "org.eclipse.debug.ui/debug/viewers/model"; + static final String DEBUG_VIEWER_FLAG = "org.eclipse.debug.ui/debug/viewers/viewer"; + static final String DEBUG_BREADCRUMB_FLAG = "org.eclipse.debug.ui/debug/breadcrumb"; + static final String DEBUG_TREE_VIEWER_DROPDOWN_FLAG = "org.eclipse.debug.ui/debug/breadcrumb"; + static final String DEBUG_CONTENT_PROVIDER_FLAG ="org.eclipse.debug.ui/debug/viewers/contentProvider"; + static final String DEBUG_UPDATE_SEQUENCE_FLAG = "org.eclipse.debug.ui/debug/viewers/updateSequence"; + static final String DEBUG_DELTAS_FLAG ="org.eclipse.debug.ui/debug/viewers/deltas"; + static final String DEBUG_STATE_SAVE_RESTORE_FLAG = "org.eclipse.debug.ui/debug/viewers/stateSaveRestore"; + static final String DEBUG_PRESENTATION_ID_FLAG ="org.eclipse.debug.ui/debug/viewers/presentationId"; /** * The singleton debug plug-in instance @@ -202,9 +232,6 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { */ private IPropertyChangeListener fThemeListener; - - public static boolean DEBUG = false; - /** * Dummy launch node representing a launch that is waiting * for a build to finish before proceeding. This node exists @@ -444,7 +471,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { fSaveParticipants.clear(); - ResourcesPlugin.getWorkspace().removeSaveParticipant(this); + ResourcesPlugin.getWorkspace().removeSaveParticipant(getUniqueIdentifier()); if (fThemeListener != null) { if (PlatformUI.isWorkbenchRunning()) @@ -485,10 +512,20 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { */ public void start(BundleContext context) throws Exception { super.start(context); - ResourcesPlugin.getWorkspace().addSaveParticipant(this, + Hashtable props = new Hashtable(2); + props.put(org.eclipse.osgi.service.debug.DebugOptions.LISTENER_SYMBOLICNAME, getUniqueIdentifier()); + context.registerService(DebugOptionsListener.class.getName(), this, props); + ResourcesPlugin.getWorkspace().addSaveParticipant(getUniqueIdentifier(), new ISaveParticipant() { public void saving(ISaveContext saveContext) throws CoreException { - savePluginPreferences(); + IEclipsePreferences node = InstanceScope.INSTANCE.getNode(getUniqueIdentifier()); + if(node != null) { + try { + node.flush(); + } catch (BackingStoreException e) { + log(e); + } + } for(Iterator iter = fSaveParticipants.iterator(); iter.hasNext();) { ((ISaveParticipant)iter.next()).saving(saveContext); } @@ -509,7 +546,6 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { } } }); - DEBUG = "true".equals(Platform.getDebugOption("org.eclipse.debug.ui/debug")); //$NON-NLS-1$//$NON-NLS-2$ // make sure the perspective manager is created // and be the first debug event listener @@ -561,6 +597,28 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { }); } + /* (non-Javadoc) + * @see org.eclipse.osgi.service.debug.DebugOptionsListener#optionsChanged(org.eclipse.osgi.service.debug.DebugOptions) + */ + public void optionsChanged(DebugOptions options) { + DEBUG = options.getBooleanOption(DEBUG_FLAG, false); + DEBUG_BREAKPOINT_DELTAS = DEBUG & options.getBooleanOption(DEBUG_BREAKPOINT_DELTAS_FLAG, false); + DEBUG_MODEL = DEBUG & options.getBooleanOption(DEBUG_MODEL_FLAG, false); + DEBUG_VIEWER = DEBUG & options.getBooleanOption(DEBUG_VIEWER_FLAG, false); + DEBUG_BREADCRUMB = DEBUG & options.getBooleanOption(DEBUG_BREADCRUMB_FLAG, false); + DEBUG_TREE_VIEWER_DROPDOWN = DEBUG & options.getBooleanOption(DEBUG_TREE_VIEWER_DROPDOWN_FLAG, false); + DEBUG_CONTENT_PROVIDER = DEBUG & options.getBooleanOption(DEBUG_CONTENT_PROVIDER_FLAG, false); + DEBUG_UPDATE_SEQUENCE = DEBUG & options.getBooleanOption(DEBUG_UPDATE_SEQUENCE_FLAG, false); + DEBUG_DELTAS = DEBUG & options.getBooleanOption(DEBUG_DELTAS_FLAG, false); + DEBUG_STATE_SAVE_RESTORE = DEBUG & options.getBooleanOption(DEBUG_STATE_SAVE_RESTORE_FLAG, false); + if(DEBUG) { + DEBUG_PRESENTATION_ID = options.getOption(DEBUG_PRESENTATION_ID_FLAG, IInternalDebugCoreConstants.EMPTY_STRING); + if(IInternalDebugCoreConstants.EMPTY_STRING.equals(DEBUG_PRESENTATION_ID)) { + DEBUG_PRESENTATION_ID = null; + } + } + } + /** * Utility method with conventions * @param shell the shell to open the dialog on @@ -891,6 +949,13 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { */ public void launchRemoved(ILaunch launch) {} + public static boolean DEBUG_TEST_PRESENTATION_ID(IPresentationContext context) { + if (context == null) { + return true; + } + return DEBUG_PRESENTATION_ID == null || DEBUG_PRESENTATION_ID.equals(context.getId()); + } + /** * Return the ILaunch associated with a model element, or null if there is * no such association. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java index 34970f20f..24fc12d1c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java @@ -1,5 +1,5 @@ /***************************************************************** - * Copyright (c) 2009, 2011 Texas Instruments and others + * Copyright (c) 2009, 2012 Texas Instruments 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 @@ -28,7 +28,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.Job; @@ -194,7 +193,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider rootDelta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1); buildInstallDelta(rootDelta, fContainer); - if (DEBUG_BREAKPOINT_DELTAS) { + if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) { System.out.println("PROXY INSTALLED (" + proxy + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -204,7 +203,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider synchronized void proxyDisposed(BreakpointManagerProxy proxy) { fProxies.remove(proxy); - if (DEBUG_BREAKPOINT_DELTAS) { + if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) { System.out.println("PROXY DISPOSED (" + proxy + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -265,7 +264,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider if (newBreakpoint != null) { appendModelDeltaToElement(delta, newBreakpoint, IModelDelta.SELECT); } - if (DEBUG_BREAKPOINT_DELTAS) { + if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) { System.out.println("POST BREAKPOINT DELTA (setOrganizers)\n"); //$NON-NLS-1$ } postModelChanged(delta, false); @@ -362,7 +361,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider } if (changed) { - if (DEBUG_BREAKPOINT_DELTAS) { + if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) { System.out.println("POST BREAKPOINT DELTA (setFilterSelection)\n"); //$NON-NLS-1$ } postModelChanged(delta, false); @@ -399,7 +398,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE); synchronized (this) { if (buildTrackSelectionDelta(delta, fContainer, bpsSet)) { - if (DEBUG_BREAKPOINT_DELTAS) { + if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) { System.out.println("POST BREAKPOINT DELTA (trackSelection)\n"); //$NON-NLS-1$ } BreakpointManagerProxy[] proxies = getProxies(); @@ -477,7 +476,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider appendModelDeltaToElement(delta, filteredBreakpoints[0], IModelDelta.SELECT); } - if (DEBUG_BREAKPOINT_DELTAS) { + if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) { System.out.println("POST BREAKPOINT DELTA (breakpointsAddedInput)\n"); //$NON-NLS-1$ } postModelChanged(delta, false); @@ -499,7 +498,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider } if (removed) { - if (DEBUG_BREAKPOINT_DELTAS) { + if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) { System.out.println("POST BREAKPOINT DELTA (breakpointsRemovedInput)\n"); //$NON-NLS-1$ } postModelChanged(delta, false); @@ -539,7 +538,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider for (int i = 0; i < filteredBreakpoints.length; ++i) appendModelDelta(fContainer, delta, IModelDelta.STATE | IModelDelta.CONTENT, filteredBreakpoints[i]); // content flag triggers detail refresh - if (DEBUG_BREAKPOINT_DELTAS) { + if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) { System.out.println("POST BREAKPOINT DELTA (breakpointsChanged)\n"); //$NON-NLS-1$ } postModelChanged(delta, false); @@ -733,14 +732,6 @@ public class BreakpointManagerContentProvider extends ElementContentProvider } }; - // debug flags - public static boolean DEBUG_BREAKPOINT_DELTAS = false; - - static { - DEBUG_BREAKPOINT_DELTAS = DebugUIPlugin.DEBUG && "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.debug.ui/debug/viewers/breakpointDeltas")); //$NON-NLS-1$ - } - /** * A map of input to info data cache */ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java index e99a1829f..6513c5719 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 2012 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 @@ -20,7 +20,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.debug.internal.ui.DebugUIPlugin; @@ -50,14 +49,6 @@ public abstract class AsynchronousModel { private AsynchronousViewer fViewer; // viewer this model works for private boolean fDisposed = false; // whether disposed - // debug flags - public static boolean DEBUG_MODEL = false; - - static { - DEBUG_MODEL = DebugUIPlugin.DEBUG && "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.debug.ui/debug/viewers/model")); //$NON-NLS-1$ - } - class EmptyContentAdapter extends AsynchronousContentAdapter { /* (non-Javadoc) @@ -101,7 +92,7 @@ public abstract class AsynchronousModel { */ public AsynchronousModel(AsynchronousViewer viewer) { fViewer = viewer; - if (DEBUG_MODEL) { + if (DebugUIPlugin.DEBUG_MODEL) { StringBuffer buffer = new StringBuffer(); buffer.append("MODEL CREATED for: "); //$NON-NLS-1$ buffer.append(fViewer); @@ -132,7 +123,7 @@ public abstract class AsynchronousModel { * Disposes this model */ public synchronized void dispose() { - if (DEBUG_MODEL) { + if (DebugUIPlugin.DEBUG_MODEL) { StringBuffer buffer = new StringBuffer(); buffer.append("MODEL DISPOSED for: "); //$NON-NLS-1$ buffer.append(fViewer); @@ -593,7 +584,7 @@ public abstract class AsynchronousModel { } parentNode.setChildren(newChildren); } - if (DEBUG_MODEL) { + if (DebugUIPlugin.DEBUG_MODEL) { DebugUIPlugin.debug("CHILDREN CHANGED: " + parentNode); //$NON-NLS-1$ DebugUIPlugin.debug(toString()); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java index 269faa292..5a7888b48 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2011 IBM Corporation and others. + * Copyright (c) 2005, 2012 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 @@ -19,7 +19,6 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener; @@ -127,14 +126,6 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis protected static final String OLD_LABEL = "old_label"; //$NON-NLS-1$ protected static final String OLD_IMAGE = "old_image"; //$NON-NLS-1$ - // debug flags - public static boolean DEBUG_VIEWER = false; - - static { - DEBUG_VIEWER = DebugUIPlugin.DEBUG && "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.debug.ui/debug/viewers/viewer")); //$NON-NLS-1$ - } - /** * Creates a new viewer */ @@ -1065,7 +1056,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis int level = 0; Widget parentItem = getParentWidget(item); - if (DEBUG_VIEWER) { + if (DebugUIPlugin.DEBUG_VIEWER) { DebugUIPlugin.debug("SET DATA [" + index + "]: " + parentItem); //$NON-NLS-1$//$NON-NLS-2$ } ModelNode node = null; @@ -1103,7 +1094,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis node = getModel().getRootNode(); if (node == null) { - if (DEBUG_VIEWER) { + if (DebugUIPlugin.DEBUG_VIEWER) { DebugUIPlugin.debug("\tFAILED - root model node is null"); //$NON-NLS-1$ } return; @@ -1111,7 +1102,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis for (int i = level; i >= 0; i--) { ModelNode[] childrenNodes = node.getChildrenNodes(); if (childrenNodes == null) { - if (DEBUG_VIEWER) { + if (DebugUIPlugin.DEBUG_VIEWER) { DebugUIPlugin.debug("\tFAILED - no children nodes for " + node); //$NON-NLS-1$ } return; @@ -1120,7 +1111,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis if (pindex < childrenNodes.length) { node = childrenNodes[pindex]; } else { - if (DEBUG_VIEWER) { + if (DebugUIPlugin.DEBUG_VIEWER) { DebugUIPlugin.debug("\tFAILED - no children nodes for " + node); //$NON-NLS-1$ } return; @@ -1133,12 +1124,12 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis if (node != null) { mapElement(node, item); item.setData(node.getElement()); - if (DEBUG_VIEWER) { + if (DebugUIPlugin.DEBUG_VIEWER) { DebugUIPlugin.debug("\titem mapped: " + node); //$NON-NLS-1$ } internalRefresh(node); } else { - if (DEBUG_VIEWER) { + if (DebugUIPlugin.DEBUG_VIEWER) { DebugUIPlugin.debug("\tFAILED - unable to find corresponding node"); //$NON-NLS-1$ } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java index 7f149d0e4..3fbe3410a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 2012 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 @@ -12,7 +12,6 @@ package org.eclipse.debug.internal.ui.viewers.breadcrumb; import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.Platform; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ToolBarManager; @@ -60,11 +59,6 @@ import org.eclipse.swt.widgets.Widget; */ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { - /** - * Tells whether this class is in debug mode. - */ - private static boolean DEBUG= DebugUIPlugin.DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.debug.ui/debug/breadcrumb")); //$NON-NLS-1$//$NON-NLS-2$ - private static final boolean IS_MAC_WORKAROUND= "carbon".equals(SWT.getPlatform()); //$NON-NLS-1$ /** @@ -264,7 +258,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { * Opens the drop down menu. */ public void showMenu() { - if (DEBUG) + if (DebugUIPlugin.DEBUG_BREADCRUMB) System.out.println("BreadcrumbItemDropDown.showMenu()"); //$NON-NLS-1$ if (!fEnabled || fMenuIsShown) @@ -273,7 +267,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { fMenuIsShown= true; fShell= new Shell(fToolBar.getShell(), SWT.RESIZE | SWT.TOOL | SWT.ON_TOP); - if (DEBUG) + if (DebugUIPlugin.DEBUG_BREADCRUMB) System.out.println(" creating new shell"); //$NON-NLS-1$ @@ -327,22 +321,22 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { switch (event.type) { case SWT.FocusIn: - if (DEBUG) + if (DebugUIPlugin.DEBUG_BREADCRUMB) System.out.println("focusIn - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$ if (!isFocusBreadcrumbTreeFocusWidget && !isFocusWidgetParentShell) { - if (DEBUG) + if (DebugUIPlugin.DEBUG_BREADCRUMB) System.out.println("==> closing shell since focus in other widget"); //$NON-NLS-1$ shell.close(); } break; case SWT.FocusOut: - if (DEBUG) + if (DebugUIPlugin.DEBUG_BREADCRUMB) System.out.println("focusOut - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$ if (event.display.getActiveShell() == null) { - if (DEBUG) + if (DebugUIPlugin.DEBUG_BREADCRUMB) System.out.println("==> closing shell since event.display.getActiveShell() != shell"); //$NON-NLS-1$ shell.close(); } @@ -375,7 +369,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { shell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { - if (DEBUG) + if (DebugUIPlugin.DEBUG_BREADCRUMB) System.out.println("==> shell disposed"); //$NON-NLS-1$ display.removeFilter(SWT.FocusIn, focusListener); @@ -391,7 +385,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { } public void shellClosed(ShellEvent e) { - if (DEBUG) + if (DebugUIPlugin.DEBUG_BREADCRUMB) System.out.println("==> shellClosed"); //$NON-NLS-1$ if (!fMenuIsShown) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java index bb4231a3c..792ebacf7 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java @@ -16,7 +16,6 @@ import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; import org.eclipse.debug.internal.ui.DebugUIPlugin; @@ -56,11 +55,6 @@ import org.eclipse.ui.progress.UIJob; public abstract class TreeViewerDropDown { /** - * Tells whether this class is in debug mode. - */ - private static boolean DEBUG= DebugUIPlugin.DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.debug.ui/debug/breadcrumb")); //$NON-NLS-1$//$NON-NLS-2$ - - /** * Delay to control scrolling when the mouse pointer reaches the edge of * the tree viewer. */ @@ -91,7 +85,7 @@ public abstract class TreeViewerDropDown { fDropDownViewer.addOpenListener(new IOpenListener() { public void open(OpenEvent event) { - if (DEBUG) + if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) System.out.println("BreadcrumbItemDropDown.showMenu()$treeViewer>open"); //$NON-NLS-1$ openElement(event.getSelection()); @@ -102,7 +96,7 @@ public abstract class TreeViewerDropDown { tree.addMouseListener(new MouseListener() { public void mouseUp(MouseEvent e) { - if (DEBUG) + if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) System.out.println("BreadcrumbItemDropDown.showMenu()$treeViewer>mouseUp"); //$NON-NLS-1$ if (e.button != 1) @@ -276,7 +270,7 @@ public abstract class TreeViewerDropDown { boolean treeHasFocus= !tree.isDisposed() && tree.isFocusControl(); - if (DEBUG) { + if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) { System.out.println(" isDisposed: " + tree.isDisposed()); //$NON-NLS-1$ System.out.println(" shell hasFocus: " + (!tree.isDisposed() && tree.isFocusControl())); //$NON-NLS-1$ System.out.println(" tree hasFocus: " + treeHasFocus); //$NON-NLS-1$ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java index 561697522..ea8021b16 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 2012 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 @@ -15,6 +15,7 @@ package org.eclipse.debug.internal.ui.viewers.model; import java.util.ArrayList; import java.util.List; +import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; import org.eclipse.jface.viewers.TreePath; @@ -131,7 +132,7 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU getContentProvider().setModelChildCount(elementPath, fCount); viewCount = getContentProvider().modelToViewChildCount(elementPath, fCount); } - if (TreeModelContentProvider.DEBUG_CONTENT_PROVIDER && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("setChildCount(" + getElement() + ", modelCount: " + fCount + " viewCount: " + viewCount + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } // Special case for element 0 in a set of filtered elements: diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java index 766c7601f..5cd5eecc7 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 2012 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 @@ -12,6 +12,7 @@ *******************************************************************************/ package org.eclipse.debug.internal.ui.viewers.model; +import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; import org.eclipse.jface.viewers.TreePath; @@ -63,7 +64,7 @@ public class ChildrenUpdate extends ViewerUpdateMonitor implements IChildrenUpda if (provider.shouldFilter(elementPath, element)) { if (provider.addFilteredIndex(elementPath, modelIndex, element)) { if (!updateFilterOnly) { - if (TreeModelContentProvider.DEBUG_CONTENT_PROVIDER && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("REMOVE(" + getElement() + ", modelIndex: " + modelIndex + " viewIndex: " + viewIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } viewer.remove(elementPath, viewIndex); @@ -74,13 +75,13 @@ public class ChildrenUpdate extends ViewerUpdateMonitor implements IChildrenUpda provider.clearFilteredChild(elementPath, modelIndex); if (!updateFilterOnly) { int insertIndex = provider.modelToViewIndex(elementPath, modelIndex); - if (TreeModelContentProvider.DEBUG_CONTENT_PROVIDER) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER) { System.out.println("insert(" + getElement() + ", modelIndex: " + modelIndex + " insertIndex: " + insertIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } viewer.insert(elementPath, element, insertIndex); } } else if (!updateFilterOnly){ - if (TreeModelContentProvider.DEBUG_CONTENT_PROVIDER && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("replace(" + getElement() + ", modelIndex: " + modelIndex + " viewIndex: " + viewIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } viewer.replace(elementPath, viewIndex, element); @@ -140,7 +141,7 @@ public class ChildrenUpdate extends ViewerUpdateMonitor implements IChildrenUpda fIndex = Math.min(fIndex, otherStart); end = Math.max(end, otherEnd); fLength = end - fIndex; - if (TreeModelContentProvider.DEBUG_CONTENT_PROVIDER && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("coalesced: " + this.toString()); //$NON-NLS-1$ } return true; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java index a237a90b4..c16a16bcd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 IBM Corporation and others. + * Copyright (c) 2006, 2012 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 @@ -15,6 +15,7 @@ package org.eclipse.debug.internal.ui.viewers.model; import java.util.ArrayList; import java.util.List; +import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; import org.eclipse.jface.viewers.TreePath; @@ -50,7 +51,7 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat if (!fHasChildren) { contentProvider.clearFilters(elementPath); } - if (TreeModelContentProvider.DEBUG_CONTENT_PROVIDER && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("setHasChildren(" + getElement() + " >> " + fHasChildren); //$NON-NLS-1$ //$NON-NLS-2$ } contentProvider.getViewer().setHasChildren(elementPath, fHasChildren); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java index 01d2f67bb..67b708c58 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 2012 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 @@ -26,7 +26,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.ListenerList; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.SafeRunner; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; @@ -138,33 +137,6 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon */ static final TreePath EMPTY_TREE_PATH = new TreePath(new Object[] {}); - // debug flags - public static String DEBUG_PRESENTATION_ID = null; - public static boolean DEBUG_CONTENT_PROVIDER = false; - public static boolean DEBUG_UPDATE_SEQUENCE = false; - public static boolean DEBUG_DELTAS = false; - public static boolean DEBUG_TEST_PRESENTATION_ID(IPresentationContext context) { - if (context == null) { - return true; - } - return DEBUG_PRESENTATION_ID == null || DEBUG_PRESENTATION_ID.equals(context.getId()); - } - - static { - DEBUG_PRESENTATION_ID = Platform.getDebugOption("org.eclipse.debug.ui/debug/viewers/presentationId"); //$NON-NLS-1$ - if (!DebugUIPlugin.DEBUG || "".equals(DEBUG_PRESENTATION_ID)) { //$NON-NLS-1$ - DEBUG_PRESENTATION_ID = null; - } - DEBUG_CONTENT_PROVIDER = DebugUIPlugin.DEBUG && "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.debug.ui/debug/viewers/contentProvider")); //$NON-NLS-1$ - DEBUG_UPDATE_SEQUENCE = DebugUIPlugin.DEBUG && "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.debug.ui/debug/viewers/updateSequence")); //$NON-NLS-1$ - ViewerStateTracker.DEBUG_STATE_SAVE_RESTORE = DebugUIPlugin.DEBUG && "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.debug.ui/debug/viewers/stateSaveRestore")); //$NON-NLS-1$ - DEBUG_DELTAS = DebugUIPlugin.DEBUG && "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.debug.ui/debug/viewers/deltas")); //$NON-NLS-1$ - } - public void dispose() { if (fViewer == null) return; @@ -420,7 +392,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon */ private void doModelChanged(IModelDelta delta, IModelProxy proxy) { if (!proxy.isDisposed()) { - if (DEBUG_DELTAS && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_DELTAS && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { DebugUIPlugin.debug("RECEIVED DELTA: " + delta.toString()); //$NON-NLS-1$ } @@ -615,12 +587,12 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } requests.add(update); if (begin) { - if (DEBUG_UPDATE_SEQUENCE && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("MODEL SEQUENCE BEGINS"); //$NON-NLS-1$ } notifyUpdate(UPDATE_SEQUENCE_BEGINS, null); } - if (DEBUG_UPDATE_SEQUENCE && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("\tBEGIN - " + update); //$NON-NLS-1$ } notifyUpdate(UPDATE_BEGINS, update); @@ -635,7 +607,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon for (int i = 0; i < updates.size(); i++) { ViewerUpdateMonitor update = (ViewerUpdateMonitor)updates.get(i); notifyUpdate(UPDATE_COMPLETE, update); - if (DEBUG_UPDATE_SEQUENCE && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("\tEND - " + update); //$NON-NLS-1$ } } @@ -676,7 +648,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } } if (fRequestsInProgress.isEmpty() && fWaitingRequests.isEmpty()) { - if (DEBUG_UPDATE_SEQUENCE && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("MODEL SEQUENCE ENDS"); //$NON-NLS-1$ } notifyUpdate(UPDATE_SEQUENCE_COMPLETE, null); @@ -1002,7 +974,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon reCreate = new ArrayList(); } reCreate.add(childrenUpdate); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("canceled update in progress handling REMOVE: " + childrenUpdate); //$NON-NLS-1$ } } @@ -1018,7 +990,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon IChildrenUpdate childrenUpdate = (IChildrenUpdate) update; if (childrenUpdate.getOffset() > modelIndex) { ((ChildrenUpdate) childrenUpdate).setOffset(childrenUpdate.getOffset() - 1); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("modified waiting update handling REMOVE: " + childrenUpdate); //$NON-NLS-1$ } } @@ -1210,7 +1182,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } if (shouldFilter(parentPath, element)) { addFilteredIndex(parentPath, modelIndex, element); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("[filtered] handleAdd(" + delta.getElement() + ") > modelIndex: " + modelIndex); //$NON-NLS-1$ //$NON-NLS-2$ } // it was filtered so the child count does not change @@ -1220,7 +1192,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } int viewIndex = modelToViewIndex(parentPath, modelIndex); int viewCount = modelToViewChildCount(parentPath, count); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("handleAdd(" + delta.getElement() + ") viewIndex: " + viewIndex + " modelIndex: " + modelIndex + " viewCount: " + viewCount + " modelCount: " + count); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } getViewer().setChildCount(parentPath, viewCount); @@ -1231,7 +1203,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon fStateTracker.restorePendingStateOnUpdate(childPath, modelIndex, false, false, false); } } else { - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("handleAdd(" + delta.getElement() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } doUpdateChildCount(getViewerTreePath(delta.getParentDelta())); @@ -1278,7 +1250,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon TreePath elementPath = getViewerTreePath(delta); if (childCount > 0) { int viewCount = modelToViewChildCount(elementPath, childCount); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("[expand] setChildCount(" + delta.getElement() + ", (model) " + childCount + " (view) " + viewCount); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } getViewer().setChildCount(elementPath, viewCount); @@ -1302,7 +1274,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } int viewIndex = modelToViewIndex(parentPath, modelIndex); if (viewIndex >= 0) { - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("[expand] replace(" + delta.getParentDelta().getElement() + ", (model) " + modelIndex + " (view) " + viewIndex + ", " + delta.getElement()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } treeViewer.replace(parentPath, viewIndex, delta.getElement()); @@ -1317,7 +1289,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } if (childCount > 0) { int viewCount = modelToViewChildCount(elementPath, childCount); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("[expand] setChildCount(" + delta.getElement() + ", (model) " + childCount + " (view) " + viewCount); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } treeViewer.setChildCount(elementPath, viewCount); @@ -1342,7 +1314,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon private int unfilterElement(TreePath parentPath, Object element, int modelIndex) { // Element is filtered - if no longer filtered, insert the element if (shouldFilter(parentPath, element)) { - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("[unfilter] abort unfilter element: " + element + ", (model) " + modelIndex); //$NON-NLS-1$ //$NON-NLS-2$ } // still filtered, stop @@ -1352,7 +1324,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon clearFilteredChild(parentPath, modelIndex); int viewIndex = modelToViewIndex(parentPath, modelIndex); if (viewIndex >= 0) { - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("[unfilter] insert(" + parentPath.getLastSegment() + ", (model) " + modelIndex + " (view) " + viewIndex + ", " + element); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } getViewer().insert(parentPath, element, viewIndex); @@ -1369,7 +1341,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } protected void handleRemove(IModelDelta delta) { - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("handleRemove(" + delta.getElement() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } IModelDelta parentDelta = delta.getParentDelta(); @@ -1400,7 +1372,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } if (modelIndex >= 0) { // found the element - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println(" - (found) remove(" + parentPath.getLastSegment() + ", viewIndex: " + viewIndex + " modelIndex: " + modelIndex); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } rescheduleUpdates(parentPath, modelIndex); @@ -1411,7 +1383,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon if (unmappedIndex >= 0) { // did not find the element, but found an unmapped item. // remove the unmapped item in it's place and update filters - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println(" - (not found) remove(" + parentPath.getLastSegment() + ", viewIndex: " + viewIndex + " modelIndex: " + modelIndex + " unmapped index: " + unmappedIndex); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } modelIndex = viewToModelIndex(parentPath, unmappedIndex); @@ -1429,7 +1401,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } // failing that, refresh the parent to properly update for non-visible/unmapped children // and update filtered indexes - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println(" - (not found) remove/refresh(" + delta.getElement()); //$NON-NLS-1$ } getViewer().remove(getViewerTreePath(delta)); @@ -1492,12 +1464,12 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon int modelCount = parentDelta.getChildCount(); if (modelCount > 0) { int viewCount = modelToViewChildCount(parentPath, modelCount); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("[select] setChildCount(" + parentDelta.getElement() + ", (model) " + parentDelta.getChildCount() + " (view) " + viewCount ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } treeViewer.setChildCount(parentPath, viewCount); } - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("[select] replace(" + parentDelta.getElement() + ", (model) " + modelIndex + " (view) " + viewIndex + ", " + delta.getElement()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } treeViewer.replace(parentPath, viewIndex, delta.getElement()); @@ -1537,7 +1509,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon } int viewIndex = modelToViewIndex(parentPath, modelIndex); if (viewIndex >= 0) { - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("[reveal] replace(" + delta.getParentDelta().getElement() + ", (model) " + modelIndex + " (view) " + viewIndex + ", " + delta.getElement()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } treeViewer.replace(parentPath, viewIndex, delta.getElement()); @@ -1573,7 +1545,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon public void updateChildCount(TreePath treePath, int currentChildCount) { Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() ); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("updateChildCount(" + getElement(treePath) + ", " + currentChildCount + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } doUpdateChildCount(treePath); @@ -1586,7 +1558,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() ); int modelIndex = viewToModelIndex(parentPath, viewIndex); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("updateElement("+ getElement(parentPath) + ", " + viewIndex + ") > modelIndex = " + modelIndex); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } doUpdateElement(parentPath, modelIndex); @@ -1598,7 +1570,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon public void updateHasChildren(TreePath path) { Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() ); - if (DEBUG_CONTENT_PROVIDER && DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("updateHasChildren(" + getElement(path)); //$NON-NLS-1$ } doUpdateHasChildren(path); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java index 513c2dc07..b81f135f0 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 IBM Corporation and others. + * Copyright (c) 2006, 2012 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 @@ -451,12 +451,12 @@ public class TreeModelLabelProvider extends ColumnLabelProvider fUpdatesInProgress.add(update); if (begin) { - if (TreeModelContentProvider.DEBUG_UPDATE_SEQUENCE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("LABEL SEQUENCE BEGINS"); //$NON-NLS-1$ } notifyUpdate(TreeModelContentProvider.UPDATE_SEQUENCE_BEGINS, null); } - if (TreeModelContentProvider.DEBUG_UPDATE_SEQUENCE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("\tBEGIN - " + update); //$NON-NLS-1$ } notifyUpdate(TreeModelContentProvider.UPDATE_BEGINS, update); @@ -470,12 +470,12 @@ public class TreeModelLabelProvider extends ColumnLabelProvider void updateComplete(ILabelUpdate update) { fUpdatesInProgress.remove(update); - if (TreeModelContentProvider.DEBUG_UPDATE_SEQUENCE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("\tEND - " + update); //$NON-NLS-1$ } notifyUpdate(TreeModelContentProvider.UPDATE_COMPLETE, update); if (fUpdatesInProgress.isEmpty()) { - if (TreeModelContentProvider.DEBUG_UPDATE_SEQUENCE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { + if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) { System.out.println("LABEL SEQUENCE ENDS"); //$NON-NLS-1$ } notifyUpdate(TreeModelContentProvider.UPDATE_SEQUENCE_COMPLETE, null); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java index a116ca77a..3f582c23d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Wind River Systems and others. + * Copyright (c) 2011, 2012 Wind River 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 @@ -73,9 +73,6 @@ import org.eclipse.ui.XMLMemento; */ class ViewerStateTracker { - // Debugging flag. - static boolean DEBUG_STATE_SAVE_RESTORE = false; - // State update type constants used in notifying listeners static final int STATE_SAVE_SEQUENCE_BEGINS = 4; static final int STATE_SAVE_SEQUENCE_COMPLETE = 5; @@ -277,7 +274,7 @@ class ViewerStateTracker { final String keyMementoString = writer.toString(); ModelDelta stateDelta = (ModelDelta) fViewerStates.get(keyMementoString); if (stateDelta != null) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE RESTORE INPUT COMARE ENDED : " + fRequest + " - MATCHING STATE FOUND"); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -288,7 +285,7 @@ class ViewerStateTracker { if (!fContentProvider.isDisposed() && input.equals(fContentProvider.getViewer().getInput())) { ModelDelta stateDelta2 = (ModelDelta) fViewerStates.remove(keyMementoString); if (stateDelta2 != null) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE RESTORE BEGINS"); //$NON-NLS-1$ System.out.println("\tRESTORE: " + stateDelta2.toString()); //$NON-NLS-1$ notifyStateUpdate(input, STATE_RESTORE_SEQUENCE_BEGINS, null); @@ -298,14 +295,14 @@ class ViewerStateTracker { doInitialRestore(fPendingState); } } else { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE RESTORE CANCELED."); //$NON-NLS-1$ } } } }); } else { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE RESTORE INPUT COMARE ENDED : " + fRequest + " - NO MATCHING STATE"); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -326,7 +323,7 @@ class ViewerStateTracker { */ public void processReqeusts() { notifyStateUpdate(input, STATE_RESTORE_SEQUENCE_BEGINS, null); - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE RESTORE INPUT COMARE BEGIN : " + fRequest); //$NON-NLS-1$ } notifyStateUpdate(input, TreeModelContentProvider.UPDATE_BEGINS, fRequest); @@ -356,7 +353,7 @@ class ViewerStateTracker { delta.getElement(), fContentProvider.getViewerTreePath(delta), inputMemento, delta)); manager.processReqeusts(); } else { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE RESTORE: No input memento provider"); //$NON-NLS-1$ } } @@ -369,7 +366,7 @@ class ViewerStateTracker { void appendToPendingStateDelta(final TreePath path) { if (fContentProvider.getViewer() == null) return; // Not initialized yet. - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE APPEND BEGIN: " + path.getLastSegment()); //$NON-NLS-1$ } @@ -383,7 +380,7 @@ class ViewerStateTracker { if (!fContentProvider.getViewer().saveElementState(path, delta, IModelDelta.COLLAPSE | IModelDelta.EXPAND | IModelDelta.SELECT)) { // Path to save the state was not found or there was no // (expansion) state to save! Abort. - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE APPEND CANCEL: Element " + path.getLastSegment() + " not found."); //$NON-NLS-1$ //$NON-NLS-2$ } return; @@ -402,7 +399,7 @@ class ViewerStateTracker { } }); - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tAPPEND DELTA: " + appendDeltaRoot); //$NON-NLS-1$ } @@ -410,7 +407,7 @@ class ViewerStateTracker { // If the restore for the current input was never completed, // preserve // that restore along with the restore that was completed. - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tAPPEND OUTSTANDING RESTORE: " + fPendingState); //$NON-NLS-1$ } @@ -458,7 +455,7 @@ class ViewerStateTracker { saveDeltaNode.setChildCount(pendingDeltaNode.getParentDelta().getChildCount()); copyIntoDelta(pendingDeltaNode, saveDeltaNode); } else { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tSKIPPED: " + pendingDeltaNode.getElement()); //$NON-NLS-1$ } } @@ -483,11 +480,11 @@ class ViewerStateTracker { notifyStateUpdate(appendDeltaRoot.getElement(), STATE_RESTORE_SEQUENCE_BEGINS, null); } fPendingState = appendDeltaRoot; - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE APPEND COMPLETE " + fPendingState); //$NON-NLS-1$ } } else { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE APPEND CANCELED: No Data"); //$NON-NLS-1$ } } @@ -505,14 +502,14 @@ class ViewerStateTracker { IElementMementoProvider stateProvider = ViewerAdapterService.getMementoProvider(input); if (stateProvider != null) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE SAVE BEGIN: " + input); //$NON-NLS-1$ } // build a model delta representing expansion and selection state final ModelDelta saveDeltaRoot = new ModelDelta(input, IModelDelta.NO_CHANGE); buildViewerState(saveDeltaRoot); - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tSAVE DELTA FROM VIEW:\n" + saveDeltaRoot); //$NON-NLS-1$ } @@ -543,7 +540,7 @@ class ViewerStateTracker { copyIntoDelta(revealDelta, saveDeltaNode); } } else { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tSKIPPED: " + revealDelta.getElement()); //$NON-NLS-1$ } } @@ -553,7 +550,7 @@ class ViewerStateTracker { // If the restore for the current input was never completed, // preserve // that restore along with the restore that was completed. - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tSAVE OUTSTANDING RESTORE: " + fPendingState); //$NON-NLS-1$ } @@ -589,7 +586,7 @@ class ViewerStateTracker { saveDeltaNode.setChildCount(pendingDeltaNode.getParentDelta().getChildCount()); copyIntoDelta(pendingDeltaNode, saveDeltaNode); } else { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tSKIPPED: " + pendingDeltaNode.getElement()); //$NON-NLS-1$ } } @@ -613,7 +610,7 @@ class ViewerStateTracker { // thread encodeDelta(saveDeltaRoot, stateProvider); } else { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE SAVE CANCELED, NO DATA"); //$NON-NLS-1$ } } @@ -729,7 +726,7 @@ class ViewerStateTracker { Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() ); notifyStateUpdate(input, TreeModelContentProvider.UPDATE_COMPLETE, request); - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tSTATE END: " + request); //$NON-NLS-1$ } @@ -748,7 +745,7 @@ class ViewerStateTracker { } catch (IOException e) { DebugUIPlugin.log(e); } - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE SAVE COMPLETED: " + rootDelta); //$NON-NLS-1$ } stateSaveComplete(input, this); @@ -772,7 +769,7 @@ class ViewerStateTracker { req.cancel(); } fRequests.clear(); - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE SAVE ABORTED: " + rootDelta.getElement()); //$NON-NLS-1$ } stateSaveComplete(input, this); @@ -948,7 +945,7 @@ class ViewerStateTracker { public boolean visit(IModelDelta delta, int depth) { int deltaFlags = delta.getFlags(); int newFlags = deltaFlags & ~mask; - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { if (deltaFlags != newFlags) { System.out.println("\tCANCEL: " + delta.getElement() + "(" + Integer.toHexString(deltaFlags & mask) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } @@ -977,7 +974,7 @@ class ViewerStateTracker { if (deltaPath.equals(path)) { int deltaFlags = delta.getFlags(); int newFlags = deltaFlags & ~mask; - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { if (deltaFlags != newFlags) { System.out.println("\tCANCEL: " + delta.getElement() + "(" + Integer.toHexString(deltaFlags & mask) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } @@ -993,7 +990,7 @@ class ViewerStateTracker { // We're clearing out flags of a matching sub-tree // assert (flags & IModelDelta.EXPAND) != 0; - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { if (delta.getFlags() != IModelDelta.NO_CHANGE) { System.out.println("\tCANCEL: " + delta.getElement() + "(" + Integer.toHexString(delta.getFlags()) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } @@ -1058,7 +1055,7 @@ class ViewerStateTracker { (IMemento) element, (ModelDelta) delta, modelIndex, knowsHasChildren, knowsChildCount, checkChildrenRealized); fCompareRequestsInProgress.put(key, compareRequest); - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tSTATE BEGIN: " + compareRequest); //$NON-NLS-1$ } notifyStateUpdate(element, TreeModelContentProvider.UPDATE_BEGINS, compareRequest); @@ -1158,7 +1155,7 @@ class ViewerStateTracker { } private void removeDelta(IModelDelta delta) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tRESTORE REMOVED: " + delta.getElement()); //$NON-NLS-1$ } @@ -1180,7 +1177,7 @@ class ViewerStateTracker { // notify restore complete if REVEAL was restored also, otherwise // postpone until then. if (fPendingSetTopItem == null) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE RESTORE COMPELTE: " + fPendingState); //$NON-NLS-1$ } @@ -1207,14 +1204,14 @@ class ViewerStateTracker { // Attempt to expand the node only if the children are known. if (knowsHasChildren) { if ((delta.getFlags() & IModelDelta.EXPAND) != 0) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tRESTORE EXPAND: " + treePath.getLastSegment()); //$NON-NLS-1$ } viewer.expandToLevel(treePath, 1); delta.setFlags(delta.getFlags() & ~IModelDelta.EXPAND); } if ((delta.getFlags() & IModelDelta.COLLAPSE) != 0) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tRESTORE COLLAPSE: " + treePath.getLastSegment()); //$NON-NLS-1$ } // Check auto-expand before collapsing an element (bug 335734) @@ -1228,7 +1225,7 @@ class ViewerStateTracker { if ((delta.getFlags() & IModelDelta.SELECT) != 0) { delta.setFlags(delta.getFlags() & ~IModelDelta.SELECT); - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tRESTORE SELECT: " + treePath.getLastSegment()); //$NON-NLS-1$ } ITreeSelection currentSelection = (ITreeSelection)viewer.getSelection(); @@ -1309,7 +1306,7 @@ class ViewerStateTracker { fContentProvider.getViewer().getElementChildrenRealized(treePath)) || (knowsHasChildren && !viewer.getHasChildren(treePath)) ) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tRESTORE CONTENT: " + treePath.getLastSegment()); //$NON-NLS-1$ } delta.setFlags(delta.getFlags() & ~IModelDelta.CONTENT); @@ -1355,7 +1352,7 @@ class ViewerStateTracker { TreePath parentPath = fPathToReveal.getParentPath(); int index = viewer.findElementIndex(parentPath, fPathToReveal.getLastSegment()); if (index >= 0) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tRESTORE REVEAL: " + fPathToReveal.getLastSegment()); //$NON-NLS-1$ } viewer.reveal(parentPath, index); @@ -1398,7 +1395,7 @@ class ViewerStateTracker { viewer.removeViewerUpdateListener(this); if (fPendingState == null) { - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("STATE RESTORE COMPELTE: " + fPendingState); //$NON-NLS-1$ } notifyStateUpdate(fModelInput, STATE_RESTORE_SEQUENCE_COMPLETE, null); @@ -1514,7 +1511,7 @@ class ViewerStateTracker { void compareFinished(ElementCompareRequest request, ModelDelta delta) { notifyStateUpdate(request.getViewerInput(), TreeModelContentProvider.UPDATE_COMPLETE, request); - if (DEBUG_STATE_SAVE_RESTORE && TreeModelContentProvider.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { + if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) { System.out.println("\tSTATE END: " + request + " = " + false); //$NON-NLS-1$ //$NON-NLS-2$ } |