Bug 334566 - [multicore][Pin&Clone] Add support for icon overlay in the debug view
BIN
core/org.eclipse.cdt.ui/icons/obj16/debugt_obj_b.gif
Normal file
After Width: | Height: | Size: 261 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/debugt_obj_g.gif
Normal file
After Width: | Height: | Size: 261 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/debugt_obj_r.gif
Normal file
After Width: | Height: | Size: 261 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/debugts_obj_b.gif
Normal file
After Width: | Height: | Size: 596 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/debugts_obj_g.gif
Normal file
After Width: | Height: | Size: 596 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/debugts_obj_r.gif
Normal file
After Width: | Height: | Size: 596 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/thread_obj_b.gif
Normal file
After Width: | Height: | Size: 360 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/thread_obj_g.gif
Normal file
After Width: | Height: | Size: 360 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/thread_obj_r.gif
Normal file
After Width: | Height: | Size: 360 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/threads_obj_b.gif
Normal file
After Width: | Height: | Size: 579 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/threads_obj_g.gif
Normal file
After Width: | Height: | Size: 579 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/threads_obj_r.gif
Normal file
After Width: | Height: | Size: 579 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/toolbar_pinned.gif
Normal file
After Width: | Height: | Size: 359 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/toolbar_pinned_b.gif
Normal file
After Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/toolbar_pinned_multi.gif
Normal file
After Width: | Height: | Size: 357 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/toolbar_pinned_r.gif
Normal file
After Width: | Height: | Size: 359 B |
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui;
|
package org.eclipse.cdt.ui;
|
||||||
|
|
||||||
|
@ -183,6 +184,29 @@ public class CDTSharedImages {
|
||||||
public static final String IMG_OVR_ERROR = "icons/ovr16/error_co.gif"; //$NON-NLS-1$
|
public static final String IMG_OVR_ERROR = "icons/ovr16/error_co.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OVR_SETTING = "icons/ovr16/setting_nav.gif"; //$NON-NLS-1$
|
public static final String IMG_OVR_SETTING = "icons/ovr16/setting_nav.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OVR_INACTIVE = "icons/ovr16/inactive_co.gif"; //$NON-NLS-1$
|
public static final String IMG_OVR_INACTIVE = "icons/ovr16/inactive_co.gif"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// Pin & Clone
|
||||||
|
public static final String IMG_THREAD_SUSPENDED_R_PINNED = "icons/obj16/threads_obj_r.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_THREAD_SUSPENDED_G_PINNED = "icons/obj16/threads_obj_g.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_THREAD_SUSPENDED_B_PINNED = "icons/obj16/threads_obj_b.gif"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final String IMG_THREAD_RUNNING_R_PINNED = "icons/obj16/thread_obj_r.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_THREAD_RUNNING_G_PINNED = "icons/obj16/thread_obj_g.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_THREAD_RUNNING_B_PINNED = "icons/obj16/thread_obj_b.gif"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final String IMG_CONTAINER_SUSPENDED_R_PINNED = "icons/obj16/debugts_obj_r.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_CONTAINER_SUSPENDED_G_PINNED = "icons/obj16/debugts_obj_g.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_CONTAINER_SUSPENDED_B_PINNED = "icons/obj16/debugts_obj_b.gif"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final String IMG_CONTAINER_RUNNING_R_PINNED = "icons/obj16/debugt_obj_r.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_CONTAINER_RUNNING_G_PINNED = "icons/obj16/debugt_obj_g.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_CONTAINER_RUNNING_B_PINNED = "icons/obj16/debugt_obj_b.gif"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final String IMG_VIEW_PIN_ACTION = "icons/obj16/toolbar_pinned.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_VIEW_PIN_ACTION_R = "icons/obj16/toolbar_pinned_r.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_VIEW_PIN_ACTION_G = "icons/obj16/toolbar_pinned_g.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_VIEW_PIN_ACTION_B = "icons/obj16/toolbar_pinned_b.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_VIEW_PIN_ACTION_MULTI = "icons/obj16/toolbar_pinned_multi.gif"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The method finds URL of the image corresponding to the key which could be project-relative path
|
* The method finds URL of the image corresponding to the key which could be project-relative path
|
||||||
|
|
|
@ -20,6 +20,7 @@ Export-Package:
|
||||||
org.eclipse.cdt.debug.internal.ui.editors;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.editors;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.ui.elements.adapters;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.elements.adapters;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.ui.launch;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.launch;x-internal:=true,
|
||||||
|
org.eclipse.cdt.debug.internal.ui.pinclone;x-friends:="org.eclipse.cdt.dsf.gdb.ui",
|
||||||
org.eclipse.cdt.debug.internal.ui.preferences;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.preferences;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.ui.propertypages;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.propertypages;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.ui.sourcelookup;x-friends:="org.eclipse.cdt.dsf.ui",
|
org.eclipse.cdt.debug.internal.ui.sourcelookup;x-friends:="org.eclipse.cdt.dsf.ui",
|
||||||
|
|
BIN
debug/org.eclipse.cdt.debug.ui/icons/elcl16/toolbar_pinned.gif
Normal file
After Width: | Height: | Size: 359 B |
|
@ -1049,7 +1049,7 @@
|
||||||
targetID="org.eclipse.debug.ui.ExpressionView">
|
targetID="org.eclipse.debug.ui.ExpressionView">
|
||||||
<action
|
<action
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
||||||
icon="icons/elcl16/pin.gif"
|
icon="icons/elcl16/toolbar_pinned.gif"
|
||||||
id="org.eclipse.pinclone.expression.pinDebugContext"
|
id="org.eclipse.pinclone.expression.pinDebugContext"
|
||||||
label="%PinView.name "
|
label="%PinView.name "
|
||||||
style="toggle"
|
style="toggle"
|
||||||
|
@ -1069,7 +1069,7 @@
|
||||||
targetID="org.eclipse.debug.ui.VariableView">
|
targetID="org.eclipse.debug.ui.VariableView">
|
||||||
<action
|
<action
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
||||||
icon="icons/elcl16/pin.gif"
|
icon="icons/elcl16/toolbar_pinned.gif"
|
||||||
id="org.eclipse.pinclone.variable.pinDebugContext"
|
id="org.eclipse.pinclone.variable.pinDebugContext"
|
||||||
label="%PinView.name "
|
label="%PinView.name "
|
||||||
style="toggle"
|
style="toggle"
|
||||||
|
@ -1089,7 +1089,7 @@
|
||||||
targetID="org.eclipse.debug.ui.RegisterView">
|
targetID="org.eclipse.debug.ui.RegisterView">
|
||||||
<action
|
<action
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
||||||
icon="icons/elcl16/pin.gif"
|
icon="icons/elcl16/toolbar_pinned.gif"
|
||||||
id="org.eclipse.pinclone.register.pinDebugContext"
|
id="org.eclipse.pinclone.register.pinDebugContext"
|
||||||
label="%PinView.name "
|
label="%PinView.name "
|
||||||
style="toggle"
|
style="toggle"
|
||||||
|
|
|
@ -7,23 +7,27 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.pinclone.DebugContextPinProvider;
|
import org.eclipse.cdt.debug.internal.ui.pinclone.DebugContextPinProvider;
|
||||||
import org.eclipse.cdt.debug.internal.ui.pinclone.DebugEventFilterService;
|
import org.eclipse.cdt.debug.internal.ui.pinclone.DebugEventFilterService;
|
||||||
import org.eclipse.cdt.debug.internal.ui.pinclone.PinCloneUtils;
|
import org.eclipse.cdt.debug.internal.ui.pinclone.PinCloneUtils;
|
||||||
|
import org.eclipse.cdt.debug.ui.IPinProvider;
|
||||||
|
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementColorDescriptor;
|
||||||
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle;
|
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle;
|
||||||
import org.eclipse.cdt.debug.ui.IPinProvider.IPinHandleLabelProvider;
|
import org.eclipse.cdt.ui.CDTSharedImages;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
||||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||||
import org.eclipse.debug.ui.contexts.IDebugContextService;
|
import org.eclipse.debug.ui.contexts.IDebugContextService;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.ui.IActionDelegate2;
|
import org.eclipse.ui.IActionDelegate2;
|
||||||
|
@ -40,12 +44,13 @@ import org.eclipse.ui.PlatformUI;
|
||||||
* Pin the selected debug context for the view.
|
* Pin the selected debug context for the view.
|
||||||
*/
|
*/
|
||||||
public class PinDebugContextActionDelegate implements IViewActionDelegate, IActionDelegate2, IDebugContextListener {
|
public class PinDebugContextActionDelegate implements IViewActionDelegate, IActionDelegate2, IDebugContextListener {
|
||||||
IViewPart fPart;
|
private IViewPart fPart;
|
||||||
IAction fAction;
|
private IAction fAction;
|
||||||
IPartListener2 fPartListener;
|
private IPartListener2 fPartListener;
|
||||||
DebugContextPinProvider fProvider;
|
private DebugContextPinProvider fProvider;
|
||||||
|
|
||||||
public PinDebugContextActionDelegate() {}
|
public PinDebugContextActionDelegate() {
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
|
* @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
|
||||||
|
@ -61,13 +66,13 @@ public class PinDebugContextActionDelegate implements IViewActionDelegate, IActi
|
||||||
if (action.isChecked()) {
|
if (action.isChecked()) {
|
||||||
fProvider = DebugEventFilterService.getInstance().addDebugEventFilter(fPart, getActiveDebugContext());
|
fProvider = DebugEventFilterService.getInstance().addDebugEventFilter(fPart, getActiveDebugContext());
|
||||||
if (fProvider != null) {
|
if (fProvider != null) {
|
||||||
// TODO: set image descriptor
|
updatePinContextColor(fProvider);
|
||||||
updatePinContextLabel(fProvider);
|
updatePinContextLabel(fProvider);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fProvider = null;
|
fProvider = null;
|
||||||
DebugEventFilterService.getInstance().removeDebugEventFilter(fPart);
|
DebugEventFilterService.getInstance().removeDebugEventFilter(fPart);
|
||||||
// TODO: remove image descriptor
|
updatePinContextColor(fProvider);
|
||||||
updatePinContextLabel(fProvider);
|
updatePinContextLabel(fProvider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,8 +157,7 @@ public class PinDebugContextActionDelegate implements IViewActionDelegate, IActi
|
||||||
|
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
Set<String> labels = new HashSet<String>();
|
Set<String> labels = new HashSet<String>();
|
||||||
Set<IPinElementHandle> handles = provider.getPinHandles();
|
for (IPinElementHandle handle : provider.getPinHandles()) {
|
||||||
for (IPinElementHandle handle : handles) {
|
|
||||||
String tmp = getLabel(handle);
|
String tmp = getLabel(handle);
|
||||||
if (tmp != null && tmp.trim().length() != 0)
|
if (tmp != null && tmp.trim().length() != 0)
|
||||||
labels.add(tmp);
|
labels.add(tmp);
|
||||||
|
@ -162,7 +166,7 @@ public class PinDebugContextActionDelegate implements IViewActionDelegate, IActi
|
||||||
for (String label : labels) {
|
for (String label : labels) {
|
||||||
if (label != null) {
|
if (label != null) {
|
||||||
if (description.length() > 0) {
|
if (description.length() > 0) {
|
||||||
description += "," + label; //$NON-NLS-1$
|
description += ", " + label; //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
description = label;
|
description = label;
|
||||||
}
|
}
|
||||||
|
@ -176,16 +180,77 @@ public class PinDebugContextActionDelegate implements IViewActionDelegate, IActi
|
||||||
private String getLabel(IPinElementHandle handle) {
|
private String getLabel(IPinElementHandle handle) {
|
||||||
String label = ""; //$NON-NLS-1$
|
String label = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
if (handle instanceof IAdaptable) {
|
if (handle != null)
|
||||||
IPinHandleLabelProvider provider =
|
label = handle.getLabel();
|
||||||
(IPinHandleLabelProvider) ((IAdaptable) handle).getAdapter(IPinHandleLabelProvider.class);
|
|
||||||
if (provider != null)
|
|
||||||
label = provider.getLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean useMultiPinImage(Set<IPinElementHandle> handles) {
|
||||||
|
if (handles.size() <= 1) return false;
|
||||||
|
|
||||||
|
int overlayColor = IPinElementColorDescriptor.UNDEFINED;
|
||||||
|
ImageDescriptor imageDesc = null;
|
||||||
|
for (IPinElementHandle handle : handles) {
|
||||||
|
IPinElementColorDescriptor colorDesc = handle.getPinElementColorDescriptor();
|
||||||
|
if (colorDesc != null) {
|
||||||
|
ImageDescriptor descImageDesc = colorDesc.getToolbarIconDescriptor();
|
||||||
|
if (imageDesc != null && !imageDesc.equals(descImageDesc))
|
||||||
|
return true;
|
||||||
|
imageDesc = descImageDesc;
|
||||||
|
|
||||||
|
int descOverlayColor = colorDesc.getOverlayColor();
|
||||||
|
if (overlayColor != IPinElementColorDescriptor.UNDEFINED && descOverlayColor != overlayColor)
|
||||||
|
return true;
|
||||||
|
overlayColor = descOverlayColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePinContextColor(DebugContextPinProvider provider) {
|
||||||
|
ImageDescriptor imageDesc = null;
|
||||||
|
if (provider != null) {
|
||||||
|
Set<IPinElementHandle> handles = provider.getPinHandles();
|
||||||
|
|
||||||
|
// if handles have different toolbar icon descriptor or different pin color, than use a
|
||||||
|
// multi-pin toolbar icon
|
||||||
|
if (useMultiPinImage(handles))
|
||||||
|
imageDesc = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_VIEW_PIN_ACTION_MULTI);
|
||||||
|
|
||||||
|
if (imageDesc == null) {
|
||||||
|
Iterator<IPinElementHandle> itr = handles.iterator();
|
||||||
|
if (itr.hasNext()) {
|
||||||
|
IPinElementHandle handle = itr.next();
|
||||||
|
IPinElementColorDescriptor desc = handle.getPinElementColorDescriptor();
|
||||||
|
if (desc != null)
|
||||||
|
imageDesc = desc.getToolbarIconDescriptor();
|
||||||
|
|
||||||
|
if (imageDesc == null && desc != null) {
|
||||||
|
int overlayColor = desc.getOverlayColor() % IPinElementColorDescriptor.DEFAULT_COLOR_COUNT;
|
||||||
|
|
||||||
|
switch (overlayColor) {
|
||||||
|
case IPinProvider.IPinElementColorDescriptor.GREEN:
|
||||||
|
imageDesc = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_VIEW_PIN_ACTION_G);
|
||||||
|
break;
|
||||||
|
case IPinProvider.IPinElementColorDescriptor.RED:
|
||||||
|
imageDesc = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_VIEW_PIN_ACTION_R);
|
||||||
|
break;
|
||||||
|
case IPinProvider.IPinElementColorDescriptor.BLUE:
|
||||||
|
imageDesc = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_VIEW_PIN_ACTION_B);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (imageDesc == null)
|
||||||
|
imageDesc = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_VIEW_PIN_ACTION);
|
||||||
|
fAction.setImageDescriptor(imageDesc);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
|
* @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.pinclone;
|
package org.eclipse.cdt.debug.internal.ui.pinclone;
|
||||||
|
|
||||||
|
@ -93,20 +94,7 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
|
||||||
* @return true if the pinned handles are pinned to the debug context
|
* @return true if the pinned handles are pinned to the debug context
|
||||||
*/
|
*/
|
||||||
public boolean isPinnedTo(Object debugContext) {
|
public boolean isPinnedTo(Object debugContext) {
|
||||||
IPinProvider pinProvider = null;
|
return PinCloneUtils.isPinnedTo(fPinHandles, debugContext);
|
||||||
if (debugContext instanceof IAdaptable) {
|
|
||||||
pinProvider = (IPinProvider) ((IAdaptable)debugContext).getAdapter(IPinProvider.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IPinElementHandle handle : fPinHandles) {
|
|
||||||
if (pinProvider != null && pinProvider.isPinnedTo(debugContext, handle)) {
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if (handle.getDebugContext().equals(debugContext)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,7 +119,7 @@ public class DebugContextPinProvider extends AbstractDebugContextProvider implem
|
||||||
handles.add(handle);
|
handles.add(handle);
|
||||||
fPinProvider.put(handle, pinProvider);
|
fPinProvider.put(handle, pinProvider);
|
||||||
} else
|
} else
|
||||||
handles.add(new PinElementHandle(element, null));
|
handles.add(new PinElementHandle(element, null, PinCloneUtils.getDefaultPinElementColorDescriptor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,20 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.pinclone;
|
package org.eclipse.cdt.debug.internal.ui.pinclone;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.cdt.debug.ui.IPinProvider;
|
import org.eclipse.cdt.debug.ui.IPinProvider;
|
||||||
|
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementColorDescriptor;
|
||||||
|
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.ui.IViewPart;
|
import org.eclipse.ui.IViewPart;
|
||||||
|
@ -29,6 +34,29 @@ import org.eclipse.ui.part.WorkbenchPart;
|
||||||
public class PinCloneUtils {
|
public class PinCloneUtils {
|
||||||
public static String PIN_CLONE_VIEW_TAG = "PIN_CLONE_VIEW_"; //$NON-NLS-1$
|
public static String PIN_CLONE_VIEW_TAG = "PIN_CLONE_VIEW_"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final DefaultPinElementColorDescriptor DEFAULT_PIN_ELEMENT_COLOR_DESCRIPTOR = new DefaultPinElementColorDescriptor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default pin element color descriptor.
|
||||||
|
*/
|
||||||
|
private static class DefaultPinElementColorDescriptor implements IPinElementColorDescriptor {
|
||||||
|
public int getOverlayColor() {
|
||||||
|
return GREEN;
|
||||||
|
}
|
||||||
|
public ImageDescriptor getToolbarIconDescriptor() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default pin element color descriptor.
|
||||||
|
*
|
||||||
|
* @return the color descriptor
|
||||||
|
*/
|
||||||
|
public static IPinElementColorDescriptor getDefaultPinElementColorDescriptor() {
|
||||||
|
return DEFAULT_PIN_ELEMENT_COLOR_DESCRIPTOR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encodes cloned part secondary id.
|
* Encodes cloned part secondary id.
|
||||||
*
|
*
|
||||||
|
@ -42,10 +70,12 @@ public class PinCloneUtils {
|
||||||
/**
|
/**
|
||||||
* Decodes cloned part secondary id.
|
* Decodes cloned part secondary id.
|
||||||
*
|
*
|
||||||
* @param secondaryId the part's secondary id.
|
* @param secondaryId the part's secondary id
|
||||||
* @return a decoded part secondary id.
|
* @return a decoded part secondary id
|
||||||
*/
|
*/
|
||||||
public static String decodeClonedPartSecondaryId(String secondaryId) {
|
public static String decodeClonedPartSecondaryId(String secondaryId) {
|
||||||
|
if (secondaryId == null)
|
||||||
|
return ""; //$NON-NLS-1$
|
||||||
return secondaryId.replaceFirst(PIN_CLONE_VIEW_TAG, ""); //$NON-NLS-1$
|
return secondaryId.replaceFirst(PIN_CLONE_VIEW_TAG, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,4 +198,64 @@ public class PinCloneUtils {
|
||||||
|
|
||||||
return pinnable;
|
return pinnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pin element color descriptor for the set of handles. If there are multiple pinned handles,
|
||||||
|
* then return the default element color descriptor.
|
||||||
|
*
|
||||||
|
* @param handles the pinned debug handles
|
||||||
|
* @param debugContext the debug context to compare with against the handles
|
||||||
|
* @return the element color descriptor, can be <code>null</code>;
|
||||||
|
*/
|
||||||
|
public static IPinElementColorDescriptor getPinElementColorDescriptor(Set<IPinElementHandle> handles, Object debugContext) {
|
||||||
|
int color = IPinElementColorDescriptor.UNDEFINED;
|
||||||
|
IPinElementColorDescriptor colorDesc = null;
|
||||||
|
|
||||||
|
for (IPinElementHandle handle : handles) {
|
||||||
|
if (debugContext instanceof IAdaptable) {
|
||||||
|
|
||||||
|
IPinProvider pinProvider = (IPinProvider) ((IAdaptable) debugContext).getAdapter(IPinProvider.class);
|
||||||
|
if (pinProvider != null) {
|
||||||
|
if (pinProvider.isPinnedTo(debugContext, handle)) {
|
||||||
|
colorDesc = handle.getPinElementColorDescriptor();
|
||||||
|
if (colorDesc != null) {
|
||||||
|
int overlayColor = colorDesc.getOverlayColor();
|
||||||
|
if (color == IPinElementColorDescriptor.UNDEFINED) color = overlayColor;
|
||||||
|
if (color != overlayColor) {
|
||||||
|
colorDesc = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (colorDesc == null)
|
||||||
|
colorDesc = getDefaultPinElementColorDescriptor();
|
||||||
|
|
||||||
|
return colorDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the debug context is pinned to any one of these handles.
|
||||||
|
*
|
||||||
|
* @param handles the handles
|
||||||
|
* @param debugContext the debug context
|
||||||
|
* @return true if pinned to any one of these handles
|
||||||
|
*/
|
||||||
|
public static boolean isPinnedTo(Set<IPinElementHandle> handles, Object debugContext) {
|
||||||
|
for (IPinElementHandle handle : handles) {
|
||||||
|
if (debugContext instanceof IAdaptable) {
|
||||||
|
IPinProvider pinProvider = (IPinProvider) ((IAdaptable) debugContext).getAdapter(IPinProvider.class);
|
||||||
|
if (pinProvider != null) {
|
||||||
|
if (pinProvider.isPinnedTo(debugContext, handle)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,11 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
package org.eclipse.cdt.debug.ui;
|
package org.eclipse.cdt.debug.ui;
|
||||||
|
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,17 +31,49 @@ import org.eclipse.ui.IWorkbenchPart;
|
||||||
*/
|
*/
|
||||||
public interface IPinProvider {
|
public interface IPinProvider {
|
||||||
/**
|
/**
|
||||||
* An interface that provides label for the pinned handle. Handle that
|
* Pin element color descriptor.
|
||||||
* wish to provide custom label should implement this interface.
|
|
||||||
*/
|
*/
|
||||||
public interface IPinHandleLabelProvider {
|
public interface IPinElementColorDescriptor {
|
||||||
/**
|
/**
|
||||||
* Returns the label the label will be used to display
|
* Default number of color count.
|
||||||
* in the pinned view's descriptor.
|
|
||||||
*
|
|
||||||
* @return the handle label
|
|
||||||
*/
|
*/
|
||||||
String getLabel();
|
final int DEFAULT_COLOR_COUNT = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An undefined color
|
||||||
|
*/
|
||||||
|
int UNDEFINED = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Green color (Default)
|
||||||
|
*/
|
||||||
|
int GREEN = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Red color
|
||||||
|
*/
|
||||||
|
int RED = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blue color
|
||||||
|
*/
|
||||||
|
int BLUE = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the overlay pin color. The overlay pin will be used to decorate the debug view for element that
|
||||||
|
* is pinned to a view.
|
||||||
|
*
|
||||||
|
* @return one of the overlay color
|
||||||
|
*/
|
||||||
|
int getOverlayColor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the toolbar pin action image description to use when the view is pinned, can be <code>null</code>.
|
||||||
|
* If <code>null</code>, than the default image description will be use.
|
||||||
|
*
|
||||||
|
* @return the icon descriptor
|
||||||
|
*/
|
||||||
|
ImageDescriptor getToolbarIconDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +85,22 @@ public interface IPinProvider {
|
||||||
*
|
*
|
||||||
* @return the debug context
|
* @return the debug context
|
||||||
*/
|
*/
|
||||||
Object getDebugContext();
|
Object getDebugContext();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the label the label will be used to display
|
||||||
|
* in the pinned view's descriptor.
|
||||||
|
*
|
||||||
|
* @return the handle label
|
||||||
|
*/
|
||||||
|
String getLabel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns color descriptor for this element.
|
||||||
|
*
|
||||||
|
* @return the color descriptor, can be <code>null</code>
|
||||||
|
*/
|
||||||
|
IPinElementColorDescriptor getPinElementColorDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,11 +7,12 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
package org.eclipse.cdt.debug.ui;
|
package org.eclipse.cdt.debug.ui;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementColorDescriptor;
|
||||||
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle;
|
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle;
|
||||||
import org.eclipse.cdt.debug.ui.IPinProvider.IPinHandleLabelProvider;
|
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,23 +20,34 @@ import org.eclipse.core.runtime.PlatformObject;
|
||||||
*
|
*
|
||||||
* @since 7.1
|
* @since 7.1
|
||||||
*/
|
*/
|
||||||
public class PinElementHandle extends PlatformObject implements IPinHandleLabelProvider, IPinElementHandle {
|
public class PinElementHandle extends PlatformObject implements IPinElementHandle {
|
||||||
private final Object fDebugContext;
|
private Object fDebugContext;
|
||||||
private final String fLabel;
|
private String fLabel;
|
||||||
|
private IPinElementColorDescriptor fColorDescriptor;
|
||||||
|
|
||||||
public PinElementHandle(Object debugContext, String label) {
|
public PinElementHandle(Object debugContext, String label, IPinElementColorDescriptor colorDescriptor) {
|
||||||
fDebugContext = debugContext;
|
fDebugContext = debugContext;
|
||||||
fLabel = label;
|
fLabel = label;
|
||||||
|
fColorDescriptor = colorDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle#getDebugContext()
|
* @see org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle#getDebugContext()
|
||||||
*/
|
*/
|
||||||
public Object getDebugContext() {
|
public synchronized Object getDebugContext() {
|
||||||
return fDebugContext;
|
return fDebugContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the debug context.
|
||||||
|
*
|
||||||
|
* @param debugContext the new debug context
|
||||||
|
*/
|
||||||
|
public synchronized void setDebugContext(Object debugContext) {
|
||||||
|
fDebugContext = debugContext;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.IPinProvider.IHandleLabelProvider#getLabel()
|
* @see org.eclipse.cdt.debug.core.IPinProvider.IHandleLabelProvider#getLabel()
|
||||||
|
@ -43,7 +55,15 @@ public class PinElementHandle extends PlatformObject implements IPinHandleLabelP
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return fLabel;
|
return fLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle#getPinElementColorDescriptor()
|
||||||
|
*/
|
||||||
|
public IPinElementColorDescriptor getPinElementColorDescriptor() {
|
||||||
|
return fColorDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
* @see java.lang.Object#equals(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
* Navid Mehregani (TI) - Bug 289526 - Migrate the Restart feature to the new one, as supported by the platform
|
* Navid Mehregani (TI) - Bug 289526 - Migrate the Restart feature to the new one, as supported by the platform
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui;
|
package org.eclipse.cdt.dsf.gdb.internal.ui;
|
||||||
|
|
||||||
|
@ -172,7 +173,7 @@ public class GdbAdapterFactory
|
||||||
fSaveTraceDataTarget = new GdbSaveTraceDataCommand(session);
|
fSaveTraceDataTarget = new GdbSaveTraceDataCommand(session);
|
||||||
fSelectNextRecordTarget = new GdbSelectNextTraceRecordCommand(session);
|
fSelectNextRecordTarget = new GdbSelectNextTraceRecordCommand(session);
|
||||||
fSelectPrevRecordTarget = new GdbSelectPrevTraceRecordCommand(session);
|
fSelectPrevRecordTarget = new GdbSelectPrevTraceRecordCommand(session);
|
||||||
fPinProvider = new GdbPinProvider();
|
fPinProvider = new GdbPinProvider(session);
|
||||||
|
|
||||||
session.registerModelAdapter(ISteppingModeTarget.class, fSteppingModeTarget);
|
session.registerModelAdapter(ISteppingModeTarget.class, fSteppingModeTarget);
|
||||||
session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand);
|
session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand);
|
||||||
|
@ -285,6 +286,7 @@ public class GdbAdapterFactory
|
||||||
fSaveTraceDataTarget.dispose();
|
fSaveTraceDataTarget.dispose();
|
||||||
fSelectNextRecordTarget.dispose();
|
fSelectNextRecordTarget.dispose();
|
||||||
fSelectPrevRecordTarget.dispose();
|
fSelectPrevRecordTarget.dispose();
|
||||||
|
fPinProvider.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*****************************************************************
|
||||||
|
* Copyright (c) 2011 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
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
|
*****************************************************************/
|
||||||
|
package org.eclipse.cdt.dsf.gdb.internal.ui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementColorDescriptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class tracks the color for the pinned context.
|
||||||
|
*/
|
||||||
|
class GdbPinColorTracker {
|
||||||
|
private class Pair {
|
||||||
|
Integer refCount;
|
||||||
|
String context;
|
||||||
|
Pair(String context, Integer refCount) {
|
||||||
|
this.context = context;
|
||||||
|
this.refCount = refCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Pair> gsColorBuckets = Collections.synchronizedList( new ArrayList<Pair>() );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The static instance.
|
||||||
|
*/
|
||||||
|
static GdbPinColorTracker INSTANCE = new GdbPinColorTracker();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton object - make constructor private.
|
||||||
|
*/
|
||||||
|
private GdbPinColorTracker() {}
|
||||||
|
|
||||||
|
int addRef(String context) {
|
||||||
|
if (context == null) return IPinElementColorDescriptor.UNDEFINED;
|
||||||
|
|
||||||
|
// look in the buckets and see if it is already exist
|
||||||
|
for (int i = 0; i < gsColorBuckets.size(); ++i) {
|
||||||
|
Pair pair = gsColorBuckets.get(i);
|
||||||
|
if (pair.context.equals(context) && pair.refCount > 0) {
|
||||||
|
pair.refCount++;
|
||||||
|
return i % IPinElementColorDescriptor.DEFAULT_COLOR_COUNT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if not exist in the buckets, then add to the bucket collection
|
||||||
|
int size = gsColorBuckets.size();
|
||||||
|
int index = size;
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
|
Pair pair = gsColorBuckets.get(i);
|
||||||
|
if (pair.refCount <= 0) {
|
||||||
|
index = i;
|
||||||
|
gsColorBuckets.remove(index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gsColorBuckets.add(index, new Pair(context, 1));
|
||||||
|
return (index) % IPinElementColorDescriptor.DEFAULT_COLOR_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeRef(String context) {
|
||||||
|
if (context == null) return;
|
||||||
|
|
||||||
|
for (int i = 0; i < gsColorBuckets.size(); ++i) {
|
||||||
|
Pair pair = gsColorBuckets.get(i);
|
||||||
|
if (pair.context.equals(context)) {
|
||||||
|
pair.refCount--;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,14 +7,20 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui;
|
package org.eclipse.cdt.dsf.gdb.internal.ui;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.IPinProvider;
|
import org.eclipse.cdt.debug.ui.IPinProvider;
|
||||||
import org.eclipse.cdt.debug.ui.PinElementHandle;
|
import org.eclipse.cdt.debug.ui.PinElementHandle;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.ImmediateInDsfExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Query;
|
import org.eclipse.cdt.dsf.concurrent.Query;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
|
@ -22,59 +28,125 @@ import org.eclipse.cdt.dsf.debug.service.IProcesses;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
|
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IStartedDMEvent;
|
||||||
|
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.StateChangedEvent;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GDB pin provider implementation.
|
* GDB pin provider implementation.
|
||||||
*/
|
*/
|
||||||
public class GdbPinProvider implements IPinProvider {
|
public class GdbPinProvider implements IPinProvider {
|
||||||
|
private static class GdbPinElementColorDescriptor implements IPinElementColorDescriptor {
|
||||||
private IMIExecutionDMContext getExecutionDmc(IDMContext dmc) {
|
int fColor = GREEN;
|
||||||
return DMContexts.getAncestorOfType(dmc, IMIExecutionDMContext.class);
|
|
||||||
|
GdbPinElementColorDescriptor(int color) {
|
||||||
|
fColor = color;
|
||||||
|
}
|
||||||
|
public int getOverlayColor() {
|
||||||
|
return fColor;
|
||||||
|
}
|
||||||
|
public ImageDescriptor getToolbarIconDescriptor() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IProcessDMContext getProcessDmc(IDMContext dmc) {
|
/**
|
||||||
|
* A set of pinned element handles.
|
||||||
|
*/
|
||||||
|
static private Set<IPinElementHandle> gsPinnedHandles = Collections.synchronizedSet(new HashSet<IPinElementHandle>());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dsf session.
|
||||||
|
*/
|
||||||
|
private final DsfSession fSession;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param session
|
||||||
|
*/
|
||||||
|
public GdbPinProvider(DsfSession session) {
|
||||||
|
fSession = session;
|
||||||
|
|
||||||
|
session.getExecutor().execute(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
fSession.addServiceEventListener(GdbPinProvider.this, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispose all resources.
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
try {
|
||||||
|
fSession.getExecutor().execute(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
fSession.removeServiceEventListener(GdbPinProvider.this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (RejectedExecutionException e) {
|
||||||
|
// Session already gone.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pinned element handles.
|
||||||
|
*
|
||||||
|
* @return the element handles.
|
||||||
|
*/
|
||||||
|
public static Set<IPinElementHandle> getPinnedHandles() {
|
||||||
|
return gsPinnedHandles;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IMIExecutionDMContext getExecutionDmc(IDMContext dmc) {
|
||||||
|
return DMContexts.getAncestorOfType(dmc, IMIExecutionDMContext.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IProcessDMContext getProcessDmc(IDMContext dmc) {
|
||||||
return DMContexts.getAncestorOfType(dmc, IProcessDMContext.class);
|
return DMContexts.getAncestorOfType(dmc, IProcessDMContext.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IThreadDMData getData(final IThreadDMContext threadDmc) {
|
private IThreadDMData getData(final IThreadDMContext threadDmc) {
|
||||||
if (threadDmc == null)
|
if (threadDmc == null || !fSession.isActive())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
IThreadDMData data = null;
|
IThreadDMData data = null;
|
||||||
try {
|
final DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
|
||||||
String sessionId = threadDmc.getSessionId();
|
try {
|
||||||
DsfSession session = DsfSession.getSession(sessionId);
|
Query<IThreadDMData> query = new Query<IThreadDMData>() {
|
||||||
final DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), sessionId);
|
@Override
|
||||||
|
protected void execute(final DataRequestMonitor<IThreadDMData> rm) {
|
||||||
try {
|
final IProcesses processes = tracker.getService(IProcesses.class);
|
||||||
if (tracker != null) {
|
if (processes != null) {
|
||||||
Query<IThreadDMData> query = new Query<IThreadDMData>() {
|
processes.getExecutionData(threadDmc, rm);
|
||||||
@Override
|
} else {
|
||||||
protected void execute(DataRequestMonitor<IThreadDMData> rm) {
|
rm.setData(null);
|
||||||
final IProcesses processes = tracker.getService(IProcesses.class);
|
rm.done();
|
||||||
if (processes != null) {
|
}
|
||||||
processes.getExecutionData(threadDmc, rm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
session.getExecutor().execute(query);
|
|
||||||
data = query.get(1, TimeUnit.SECONDS);
|
|
||||||
}
|
}
|
||||||
} finally {
|
};
|
||||||
if (tracker != null)
|
|
||||||
tracker.dispose();
|
ImmediateInDsfExecutor immediateExecutor = new ImmediateInDsfExecutor(fSession.getExecutor());
|
||||||
}
|
immediateExecutor.execute(query);
|
||||||
} catch (Exception e) {
|
data = query.get(2, TimeUnit.SECONDS); // timeout in 2 seconds, in case the call to execute got stuck
|
||||||
}
|
} catch (Exception e) {
|
||||||
|
GdbUIPlugin.log(e);
|
||||||
return data;
|
} finally {
|
||||||
|
if (tracker != null)
|
||||||
|
tracker.dispose();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLabel(IThreadDMData data) {
|
private String getLabel(IThreadDMData data) {
|
||||||
|
@ -122,19 +194,38 @@ public class GdbPinProvider implements IPinProvider {
|
||||||
public IPinElementHandle pin(IWorkbenchPart part, Object debugContext) {
|
public IPinElementHandle pin(IWorkbenchPart part, Object debugContext) {
|
||||||
Object pinContext = debugContext;
|
Object pinContext = debugContext;
|
||||||
String label = ""; //$NON-NLS-1$
|
String label = ""; //$NON-NLS-1$
|
||||||
|
String sessionId = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
|
IDMContext dmc = null;
|
||||||
if (debugContext instanceof IAdaptable) {
|
if (debugContext instanceof IAdaptable) {
|
||||||
IDMContext dmc = (IDMContext) ((IAdaptable) debugContext).getAdapter(IDMContext.class);
|
dmc = (IDMContext) ((IAdaptable) debugContext).getAdapter(IDMContext.class);
|
||||||
|
sessionId = dmc.getSessionId() + "."; //$NON-NLS-1$
|
||||||
|
|
||||||
if (dmc != null) {
|
if (dmc != null) {
|
||||||
IMIExecutionDMContext execDmc = getExecutionDmc(dmc);
|
IMIExecutionDMContext execDmc = getExecutionDmc(dmc);
|
||||||
IProcessDMContext processDmc = getProcessDmc(dmc);
|
IProcessDMContext processDmc = getProcessDmc(dmc);
|
||||||
|
|
||||||
label = getCombinedLabels(processDmc, execDmc);
|
label = getCombinedLabels(processDmc, execDmc);
|
||||||
if (execDmc != null)
|
|
||||||
|
// set the pin context to a thread if it exist
|
||||||
|
if (execDmc != null) {
|
||||||
|
dmc = execDmc;
|
||||||
pinContext = execDmc;
|
pinContext = execDmc;
|
||||||
|
|
||||||
|
// otherwise, set it to the DM context
|
||||||
|
} else {
|
||||||
|
pinContext = dmc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PinElementHandle(pinContext, label);
|
|
||||||
|
IPinElementColorDescriptor colorDesc =
|
||||||
|
new GdbPinElementColorDescriptor(GdbPinColorTracker.INSTANCE.addRef(sessionId + label));
|
||||||
|
PinElementHandle handle = new PinElementHandle(pinContext, label, colorDesc);
|
||||||
|
gsPinnedHandles.add(handle);
|
||||||
|
dispatchChangedEvent(dmc);
|
||||||
|
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -142,7 +233,17 @@ public class GdbPinProvider implements IPinProvider {
|
||||||
* @see org.eclipse.cdt.debug.ui.IPinProvider#unpin(org.eclipse.ui.IWorkbenchPart, org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle)
|
* @see org.eclipse.cdt.debug.ui.IPinProvider#unpin(org.eclipse.ui.IWorkbenchPart, org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle)
|
||||||
*/
|
*/
|
||||||
public void unpin(IWorkbenchPart part, IPinElementHandle handle) {
|
public void unpin(IWorkbenchPart part, IPinElementHandle handle) {
|
||||||
// do nothing for now.
|
// remove the handle from the cache
|
||||||
|
gsPinnedHandles.remove(handle);
|
||||||
|
|
||||||
|
// dispatch the event to update the handle DM context
|
||||||
|
Object debugContext = handle.getDebugContext();
|
||||||
|
if (debugContext instanceof IAdaptable) {
|
||||||
|
IDMContext dmc = (IDMContext) ((IAdaptable) debugContext).getAdapter(IDMContext.class);
|
||||||
|
GdbPinColorTracker.INSTANCE.removeRef(dmc.getSessionId() + handle.getLabel());
|
||||||
|
dispatchChangedEvent(dmc);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -150,19 +251,82 @@ public class GdbPinProvider implements IPinProvider {
|
||||||
* @see org.eclipse.cdt.debug.ui.IPinProvider#isPinnedTo(java.lang.Object, org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle)
|
* @see org.eclipse.cdt.debug.ui.IPinProvider#isPinnedTo(java.lang.Object, org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle)
|
||||||
*/
|
*/
|
||||||
public boolean isPinnedTo(Object debugContext, IPinElementHandle handle) {
|
public boolean isPinnedTo(Object debugContext, IPinElementHandle handle) {
|
||||||
if (debugContext instanceof IAdaptable) {
|
Object handleDebugContext = handle.getDebugContext();
|
||||||
|
|
||||||
|
if (debugContext instanceof IAdaptable && handleDebugContext instanceof IAdaptable) {
|
||||||
IDMContext dmc = (IDMContext) ((IAdaptable) debugContext).getAdapter(IDMContext.class);
|
IDMContext dmc = (IDMContext) ((IAdaptable) debugContext).getAdapter(IDMContext.class);
|
||||||
if (dmc != null) {
|
IDMContext hDmc = (IDMContext) ((IAdaptable) handleDebugContext).getAdapter(IDMContext.class);
|
||||||
IMIExecutionDMContext execDmc = getExecutionDmc(dmc);
|
|
||||||
IProcessDMContext processDmc = getProcessDmc(dmc);
|
if (dmc != null && hDmc != null) {
|
||||||
|
if (dmc.getSessionId().equals(hDmc.getSessionId())) {
|
||||||
if (execDmc != null && processDmc != null ) {
|
IMIExecutionDMContext execDmc = getExecutionDmc(dmc);
|
||||||
|
IProcessDMContext processDmc = getProcessDmc(dmc);
|
||||||
|
|
||||||
String label = getCombinedLabels(processDmc, execDmc);
|
String label = getCombinedLabels(processDmc, execDmc);
|
||||||
if (handle instanceof IPinHandleLabelProvider)
|
return label.equals(handle.getLabel());
|
||||||
return label.equals( ((IPinHandleLabelProvider)handle).getLabel() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch the change event for the given DM context.
|
||||||
|
*
|
||||||
|
* @param dmc the DM context
|
||||||
|
*/
|
||||||
|
private void dispatchChangedEvent(IDMContext dmc) {
|
||||||
|
if (dmc == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
DsfSession session = DsfSession.getSession(dmc.getSessionId());
|
||||||
|
if (session != null && session.isActive())
|
||||||
|
session.dispatchEvent(new StateChangedEvent(dmc), null);
|
||||||
|
} catch (RejectedExecutionException e) {
|
||||||
|
// Session already gone.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle start event and re-attach the DM context to the pinned handles. The DM context
|
||||||
|
* is used for dispatching event to update the element label.
|
||||||
|
*/
|
||||||
|
@DsfServiceEventHandler
|
||||||
|
public void handleEvent(final IStartedDMEvent event) {
|
||||||
|
final IDMContext eventDmc = event.getDMContext();
|
||||||
|
final IMIExecutionDMContext eventExecDmc = getExecutionDmc(eventDmc);
|
||||||
|
final IProcessDMContext eventProcessDmc = getProcessDmc(eventDmc);
|
||||||
|
|
||||||
|
if (eventProcessDmc != null) {
|
||||||
|
for (final IPinElementHandle h : gsPinnedHandles) {
|
||||||
|
new Job("Updating pin handler debug context") { //$NON-NLS-1$
|
||||||
|
{setPriority(INTERACTIVE);}
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
// only attach to the same pin handle if the session is not active
|
||||||
|
PinElementHandle handle = ((PinElementHandle)h);
|
||||||
|
Object handleDebugContext = handle.getDebugContext();
|
||||||
|
if (handleDebugContext instanceof IAdaptable) {
|
||||||
|
IDMContext handleDmc = (IDMContext) ((IAdaptable) handleDebugContext).getAdapter(IDMContext.class);
|
||||||
|
if (handleDmc != null) {
|
||||||
|
DsfSession session = DsfSession.getSession(handleDmc.getSessionId());
|
||||||
|
if (session == null || !session.isActive()) {
|
||||||
|
String handleLabel = handle.getLabel();
|
||||||
|
String label = getCombinedLabels(eventProcessDmc, eventExecDmc);
|
||||||
|
|
||||||
|
if (label.equals(handleLabel)) {
|
||||||
|
IDMContext newDmc = eventExecDmc != null ? eventExecDmc : eventDmc;
|
||||||
|
handle.setDebugContext(newDmc);
|
||||||
|
dispatchChangedEvent(newDmc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
}.schedule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,17 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - Initial API and implementation
|
* Ericsson - Initial API and implementation
|
||||||
* Wind River Systems - Factored out AbstractContainerVMNode
|
* Wind River Systems - Factored out AbstractContainerVMNode
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.pinclone.PinCloneUtils;
|
||||||
|
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementColorDescriptor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||||
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||||
|
@ -29,6 +33,7 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractContainerVMNode;
|
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractContainerVMNode;
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ExecutionContextLabelText;
|
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ExecutionContextLabelText;
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
|
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbPinProvider;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
|
||||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
@ -44,6 +49,7 @@ import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
|
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
|
import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.properties.VMDelegatingPropertiesUpdate;
|
import org.eclipse.cdt.dsf.ui.viewmodel.properties.VMDelegatingPropertiesUpdate;
|
||||||
|
import org.eclipse.cdt.ui.CDTSharedImages;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
|
||||||
|
@ -86,15 +92,109 @@ public class ContainerVMNode extends AbstractContainerVMNode
|
||||||
IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN,
|
IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN,
|
||||||
IGdbLaunchVMConstants.PROP_CORES_ID }),
|
IGdbLaunchVMConstants.PROP_CORES_ID }),
|
||||||
new LabelText(MessagesForGdbLaunchVM.ContainerVMNode_No_columns__Error__label, new String[0]),
|
new LabelText(MessagesForGdbLaunchVM.ContainerVMNode_No_columns__Error__label, new String[0]),
|
||||||
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_SUSPENDED)) {
|
|
||||||
|
/* RUNNING CONTAINER - RED PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_RUNNING_R_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
ILaunchVMConstants.PROP_IS_SUSPENDED,
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
|
||||||
|
Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (prop != null && pin_prop != null && pin_color_prop != null) ?
|
||||||
|
!prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* RUNNING CONTAINER - GREEN PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_RUNNING_G_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
ILaunchVMConstants.PROP_IS_SUSPENDED,
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
|
||||||
|
Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (prop != null && pin_prop != null && pin_color_prop != null) ?
|
||||||
|
!prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* RUNNING CONTAINER - BLUE PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_RUNNING_B_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
ILaunchVMConstants.PROP_IS_SUSPENDED,
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
|
||||||
|
Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (prop != null && pin_prop != null && pin_color_prop != null) ?
|
||||||
|
!prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* RUNNING CONTAINER - NO PIN */
|
||||||
|
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET)) {
|
||||||
{ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); }
|
{ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
||||||
return Boolean.TRUE.equals(properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED));
|
return Boolean.FALSE.equals(properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED));
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET)),
|
|
||||||
|
/* SUSPENDED CONTAINER - RED PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_SUSPENDED_R_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (pin_prop != null && pin_color_prop != null) ?
|
||||||
|
pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* SUSPENDED CONTAINER - GREEN PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_SUSPENDED_G_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (pin_prop != null && pin_color_prop != null) ?
|
||||||
|
pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* SUSPENDED CONTAINER - BLUE PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_SUSPENDED_B_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (pin_prop != null && pin_color_prop != null) ?
|
||||||
|
pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* SUSPENDED CONTAINER - NO PIN */
|
||||||
|
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_SUSPENDED)),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return provider;
|
return provider;
|
||||||
|
@ -139,6 +239,14 @@ public class ContainerVMNode extends AbstractContainerVMNode
|
||||||
// standard container properties.
|
// standard container properties.
|
||||||
parentUpdates[i] = new VMDelegatingPropertiesUpdate(updates[i], countringRm);
|
parentUpdates[i] = new VMDelegatingPropertiesUpdate(updates[i], countringRm);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
// set pin properties
|
||||||
|
IDMContext dmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IDMContext.class);
|
||||||
|
IPinElementColorDescriptor colorDesc = PinCloneUtils.getPinElementColorDescriptor(GdbPinProvider.getPinnedHandles(), dmc);
|
||||||
|
updates[i].setProperty(IGdbLaunchVMConstants.PROP_PIN_COLOR,
|
||||||
|
colorDesc != null ? colorDesc.getOverlayColor() : null);
|
||||||
|
updates[i].setProperty(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
PinCloneUtils.isPinnedTo(GdbPinProvider.getPinnedHandles(), dmc));
|
||||||
|
|
||||||
if (update.getProperties().contains(PROP_NAME) ||
|
if (update.getProperties().contains(PROP_NAME) ||
|
||||||
update.getProperties().contains(ILaunchVMConstants.PROP_ID) ||
|
update.getProperties().contains(ILaunchVMConstants.PROP_ID) ||
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
|
||||||
|
|
||||||
|
@ -29,4 +30,13 @@ public interface IGdbLaunchVMConstants {
|
||||||
*/
|
*/
|
||||||
public static final String PROP_CORES_ID_KNOWN = "cores_id_known"; //$NON-NLS-1$
|
public static final String PROP_CORES_ID_KNOWN = "cores_id_known"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The context is pinned. Value <code>true</code> or <code>false</code>.
|
||||||
|
*/
|
||||||
|
public static final String PROP_PINNED_CONTEXT = "pinned_context"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pin color. One of the <code>IPinElementColorDescriptor</code> color value.
|
||||||
|
*/
|
||||||
|
public static final String PROP_PIN_COLOR = "pin_color"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,14 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
* Ericsson - Modified for multi threaded functionality
|
* Ericsson - Modified for multi threaded functionality
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.pinclone.PinCloneUtils;
|
||||||
|
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementColorDescriptor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
|
@ -20,6 +25,7 @@ import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractThreadVMNode;
|
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractThreadVMNode;
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ExecutionContextLabelText;
|
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ExecutionContextLabelText;
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
|
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbPinProvider;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
|
||||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||||
|
@ -35,6 +41,7 @@ import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
|
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
|
import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.properties.VMDelegatingPropertiesUpdate;
|
import org.eclipse.cdt.dsf.ui.viewmodel.properties.VMDelegatingPropertiesUpdate;
|
||||||
|
import org.eclipse.cdt.ui.CDTSharedImages;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
|
||||||
|
@ -61,7 +68,7 @@ public class ThreadVMNode extends AbstractThreadVMNode
|
||||||
@Override
|
@Override
|
||||||
protected IElementLabelProvider createLabelProvider() {
|
protected IElementLabelProvider createLabelProvider() {
|
||||||
PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
|
PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
|
||||||
|
|
||||||
provider.setColumnInfo(
|
provider.setColumnInfo(
|
||||||
PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
|
PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
|
||||||
new LabelColumnInfo(new LabelAttribute[] {
|
new LabelColumnInfo(new LabelAttribute[] {
|
||||||
|
@ -83,6 +90,55 @@ public class ThreadVMNode extends AbstractThreadVMNode
|
||||||
ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN,
|
ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN,
|
||||||
ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS}),
|
ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS}),
|
||||||
new LabelText(MessagesForGdbLaunchVM.ThreadVMNode_No_columns__Error__label, new String[0]),
|
new LabelText(MessagesForGdbLaunchVM.ThreadVMNode_No_columns__Error__label, new String[0]),
|
||||||
|
/* RUNNING THREAD - RED PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_R_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
ILaunchVMConstants.PROP_IS_SUSPENDED,
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
|
||||||
|
Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (prop != null && pin_prop != null && pin_color_prop != null) ?
|
||||||
|
!prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* RUNNING THREAD - GREEN PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_G_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
ILaunchVMConstants.PROP_IS_SUSPENDED,
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
|
||||||
|
Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (prop != null && pin_prop != null && pin_color_prop != null) ?
|
||||||
|
!prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* RUNNING THREAD - BLUE PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_B_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
ILaunchVMConstants.PROP_IS_SUSPENDED,
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
|
||||||
|
Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (prop != null && pin_prop != null && pin_color_prop != null) ?
|
||||||
|
!prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* RUNNING THREAD - NO PIN */
|
||||||
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)) {
|
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)) {
|
||||||
{ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); }
|
{ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); }
|
||||||
|
|
||||||
|
@ -93,6 +149,49 @@ public class ThreadVMNode extends AbstractThreadVMNode
|
||||||
return (prop != null) ? !prop.booleanValue() : false;
|
return (prop != null) ? !prop.booleanValue() : false;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/* SUSPENDED THREAD - RED PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_R_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (pin_prop != null && pin_color_prop != null) ?
|
||||||
|
pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* SUSPENDED THREAD - GREEN PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_G_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (pin_prop != null && pin_color_prop != null) ?
|
||||||
|
pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* SUSPENDED THREAD - BLUE PIN */
|
||||||
|
new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_B_PINNED)) {
|
||||||
|
{ setPropertyNames(new String[] {
|
||||||
|
IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, Map<String, Object> properties) {
|
||||||
|
Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
|
||||||
|
Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
|
||||||
|
return (pin_prop != null && pin_color_prop != null) ?
|
||||||
|
pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/* SUSPENDED THREAD - NO PIN */
|
||||||
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED)),
|
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED)),
|
||||||
}));
|
}));
|
||||||
return provider;
|
return provider;
|
||||||
|
@ -118,6 +217,13 @@ public class ThreadVMNode extends AbstractThreadVMNode
|
||||||
update.getViewerInput(), update.getElementPath(), IMIExecutionDMContext.class);
|
update.getViewerInput(), update.getElementPath(), IMIExecutionDMContext.class);
|
||||||
if (execDmc != null) {
|
if (execDmc != null) {
|
||||||
update.setProperty(ILaunchVMConstants.PROP_ID, Integer.toString(execDmc.getThreadId()));
|
update.setProperty(ILaunchVMConstants.PROP_ID, Integer.toString(execDmc.getThreadId()));
|
||||||
|
|
||||||
|
// set pin properties
|
||||||
|
IPinElementColorDescriptor colorDesc = PinCloneUtils.getPinElementColorDescriptor(GdbPinProvider.getPinnedHandles(), execDmc);
|
||||||
|
updates[i].setProperty(IGdbLaunchVMConstants.PROP_PIN_COLOR,
|
||||||
|
colorDesc != null ? colorDesc.getOverlayColor() : null);
|
||||||
|
updates[i].setProperty(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
|
||||||
|
PinCloneUtils.isPinnedTo(GdbPinProvider.getPinnedHandles(), execDmc));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update.getProperties().contains(PROP_NAME) ||
|
if (update.getProperties().contains(PROP_NAME) ||
|
||||||
|
|
Before Width: | Height: | Size: 358 B |
BIN
dsf/org.eclipse.cdt.dsf.ui/icons/toolbar_pinned.gif
Normal file
After Width: | Height: | Size: 359 B |
|
@ -68,7 +68,7 @@
|
||||||
targetID="org.eclipse.cdt.dsf.debug.ui.disassembly.view">
|
targetID="org.eclipse.cdt.dsf.debug.ui.disassembly.view">
|
||||||
<action
|
<action
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
||||||
icon="icons/pin.gif"
|
icon="icons/toolbar_pinned.gif"
|
||||||
id="org.eclipse.pinclone.disassembly.pinDebugContext"
|
id="org.eclipse.pinclone.disassembly.pinDebugContext"
|
||||||
label="%PinView.name "
|
label="%PinView.name "
|
||||||
style="toggle"
|
style="toggle"
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.ui.viewmodel.launch;
|
package org.eclipse.cdt.dsf.debug.ui.viewmodel.launch;
|
||||||
|
|
||||||
|
@ -294,6 +295,8 @@ public abstract class AbstractContainerVMNode extends AbstractDMVMNode
|
||||||
}
|
}
|
||||||
} else if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
} else if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
||||||
return IModelDelta.SELECT | IModelDelta.EXPAND;
|
return IModelDelta.SELECT | IModelDelta.EXPAND;
|
||||||
|
} else if (e instanceof StateChangedEvent) {
|
||||||
|
return IModelDelta.STATE;
|
||||||
}
|
}
|
||||||
return IModelDelta.NO_CHANGE;
|
return IModelDelta.NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
@ -376,6 +379,10 @@ public abstract class AbstractContainerVMNode extends AbstractDMVMNode
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
} else if (e instanceof StateChangedEvent) {
|
||||||
|
// If there is a state change needed on the container, update the container
|
||||||
|
if (dmc instanceof IContainerDMContext)
|
||||||
|
parentDelta.addNode(createVMContext(dmc), IModelDelta.STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
* Ericsson - Modified for multi threaded functionality
|
* Ericsson - Modified for multi threaded functionality
|
||||||
|
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.ui.viewmodel.launch;
|
package org.eclipse.cdt.dsf.debug.ui.viewmodel.launch;
|
||||||
|
|
||||||
|
@ -350,6 +351,8 @@ public abstract class AbstractThreadVMNode extends AbstractDMVMNode
|
||||||
return IModelDelta.CONTENT;
|
return IModelDelta.CONTENT;
|
||||||
} else if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
} else if (e instanceof ModelProxyInstalledEvent || e instanceof DataModelInitializedEvent) {
|
||||||
return IModelDelta.SELECT | IModelDelta.EXPAND;
|
return IModelDelta.SELECT | IModelDelta.EXPAND;
|
||||||
|
} else if (e instanceof StateChangedEvent) {
|
||||||
|
return IModelDelta.STATE;
|
||||||
}
|
}
|
||||||
return IModelDelta.NO_CHANGE;
|
return IModelDelta.NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
@ -408,8 +411,10 @@ public abstract class AbstractThreadVMNode extends AbstractDMVMNode
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else if (e instanceof StateChangedEvent) {
|
||||||
|
parentDelta.addNode(createVMContext(dmc), IModelDelta.STATE);
|
||||||
|
rm.done();
|
||||||
|
} else {
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*****************************************************************
|
||||||
|
* Copyright (c) 2011 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
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Patrick Chuong (Texas Instruments) - initial API and implementation
|
||||||
|
*****************************************************************/
|
||||||
|
package org.eclipse.cdt.dsf.debug.ui.viewmodel.launch;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generic UI state changed event.
|
||||||
|
*
|
||||||
|
* @since 2.2
|
||||||
|
*/
|
||||||
|
public class StateChangedEvent extends AbstractDMEvent<IDMContext> {
|
||||||
|
|
||||||
|
public StateChangedEvent(IDMContext context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 358 B |
After Width: | Height: | Size: 359 B |
|
@ -44,7 +44,7 @@
|
||||||
targetID="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser">
|
targetID="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser">
|
||||||
<action
|
<action
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
|
||||||
icon="icons/pin.gif"
|
icon="icons/toolbar_pinned.gif"
|
||||||
id="org.eclipse.pinclone.memoryBrowser.pinDebugContext"
|
id="org.eclipse.pinclone.memoryBrowser.pinDebugContext"
|
||||||
label="%PinView.name "
|
label="%PinView.name "
|
||||||
style="toggle"
|
style="toggle"
|
||||||
|
|