mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 486521 - "OS Resources" - allow attaching to selected process
- Extend OSView to provide a structured selection of IResourcesInformation - Add Connect process handler in view toolbar. - Add Connect process handler in selection pop-up menu Change-Id: I9e2ca4bafc72d035f78cbbe87ee6ff0f56f6ae22 Signed-off-by: Teodor Madan <teodor.madan@nxp.com>
This commit is contained in:
parent
6b8482f866
commit
ce5ec6c178
8 changed files with 388 additions and 20 deletions
|
@ -54,3 +54,8 @@ action.fetchMoreChildren.label=Fetch More Children
|
|||
|
||||
# OS view
|
||||
view.osresources.name=OS Resources
|
||||
|
||||
command.connect.description = Connect to selected processes
|
||||
command.connect.name = Connect
|
||||
command.connect.label = Connect
|
||||
command.connect.tooltip = Connect to process
|
|
@ -321,6 +321,11 @@
|
|||
id="org.eclipse.cdt.dsf.gdb.ui.command.selectPreviousTraceRecord"
|
||||
name="%command.prevTraceRecord.name">
|
||||
</command>
|
||||
<command
|
||||
description="%command.connect.description"
|
||||
id="org.eclipse.cdt.dsf.gdb.ui.command.osview.connect"
|
||||
name="%command.connect.name">
|
||||
</command>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.handlers">
|
||||
|
@ -380,6 +385,18 @@
|
|||
</with>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
<handler
|
||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.osview.AttachProcessHandler"
|
||||
commandId="org.eclipse.cdt.dsf.gdb.ui.command.osview.connect">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="and">
|
||||
<adapt type="org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2$IResourcesInformation"/>
|
||||
</iterate>
|
||||
<count value="+"/>
|
||||
</with>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.menus">
|
||||
|
@ -416,6 +433,28 @@
|
|||
style="push">
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution
|
||||
locationURI="toolbar:org.eclipse.cdt.dsf.gdb.ui.osresources.view?after=additions">
|
||||
<command
|
||||
commandId="org.eclipse.cdt.dsf.gdb.ui.command.osview.connect"
|
||||
icon="platform:/plugin/org.eclipse.cdt.debug.ui/icons/obj16/connect.gif"
|
||||
label="%command.connect.label"
|
||||
style="push"
|
||||
tooltip="%command.connect.tooltip">
|
||||
</command>
|
||||
</menuContribution>
|
||||
|
||||
<menuContribution allPopups="true" locationURI="popup:org.eclipse.cdt.dsf.gdb.ui.osresources.view?after=additions">
|
||||
<command
|
||||
commandId="org.eclipse.cdt.dsf.gdb.ui.command.osview.connect"
|
||||
icon="platform:/plugin/org.eclipse.cdt.debug.ui/icons/obj16/connect.gif"
|
||||
label="%command.connect.label"
|
||||
style="push"
|
||||
tooltip="%command.connect.tooltip">
|
||||
<visibleWhen checkEnabled="true">
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.debug.ui.BreakpointActionPage">
|
||||
|
|
|
@ -0,0 +1,244 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 Freescale Semiconductor 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:
|
||||
* Teodor Madan (Freescale Semiconductor) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.osview;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.Query;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IProcesses;
|
||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses;
|
||||
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2.IResourcesInformation;
|
||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.commands.IHandler;
|
||||
import org.eclipse.core.expressions.IEvaluationContext;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.ICoreRunnable;
|
||||
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.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.IStatusHandler;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.ISources;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class AttachProcessHandler extends AbstractHandler implements IHandler {
|
||||
|
||||
private static final String PROCESSES_CLASS = "processes"; //$NON-NLS-1$
|
||||
private static final String THREADS_CLASS = "threads"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public void setEnabled(Object evaluationContext) {
|
||||
boolean state = false;
|
||||
if (evaluationContext instanceof IEvaluationContext) {
|
||||
Object p = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_PART_NAME);
|
||||
Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
|
||||
if (p instanceof OSResourcesView && s instanceof IStructuredSelection) {
|
||||
IStructuredSelection sel2 = (IStructuredSelection) s;
|
||||
if (!sel2.isEmpty() && sel2.getFirstElement() instanceof IResourcesInformation) {
|
||||
OSResourcesView rview = (OSResourcesView) p;
|
||||
// check that processes class resources is selected.
|
||||
ICommandControlDMContext sessionContext = rview.getSessionContext();
|
||||
if (sessionContext != null && (PROCESSES_CLASS.equals(rview.getResourceClass())
|
||||
|| THREADS_CLASS.equals(rview.getResourceClass()))) {
|
||||
// check that attach is supported"
|
||||
state = isAttachSupported(sessionContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setBaseEnabled(state);
|
||||
|
||||
}
|
||||
|
||||
private boolean isAttachSupported(final ICommandControlDMContext context) {
|
||||
DsfSession session = DsfSession.getSession(context.getSessionId());
|
||||
if (session == null) {
|
||||
// can be null while terminating
|
||||
return false;
|
||||
}
|
||||
|
||||
Query<Boolean> canConnectQuery = new Query<Boolean>() {
|
||||
@Override
|
||||
public void execute(DataRequestMonitor<Boolean> rm) {
|
||||
BundleContext c = GdbUIPlugin.getDefault().getBundle().getBundleContext();
|
||||
DsfServicesTracker tracker = new DsfServicesTracker(c, context.getSessionId());
|
||||
|
||||
IProcesses procService = tracker.getService(IProcesses.class);
|
||||
ICommandControlService commandControl = tracker.getService(ICommandControlService.class);
|
||||
|
||||
if (procService != null && commandControl != null) {
|
||||
procService.isDebuggerAttachSupported(commandControl.getContext(), rm);
|
||||
} else {
|
||||
rm.done(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
session.getExecutor().execute(canConnectQuery);
|
||||
return canConnectQuery.get();
|
||||
} catch (InterruptedException | java.util.concurrent.ExecutionException e) {
|
||||
// Can be thrown if the session is shutdown
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
|
||||
* ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
ISelection selection = HandlerUtil.getCurrentSelection(event);
|
||||
IWorkbenchPart part = HandlerUtil.getActivePart(event);
|
||||
if (selection instanceof IStructuredSelection && part instanceof OSResourcesView) {
|
||||
// get column to extract pid of the selected process/thread
|
||||
int pidColumn = -1;
|
||||
IResourcesInformation firstSelection = (IResourcesInformation) ((IStructuredSelection) selection)
|
||||
.getFirstElement();
|
||||
for (int i = 0; i < firstSelection.getColumnNames().length; i++) {
|
||||
if ("pid".equalsIgnoreCase(firstSelection.getColumnNames()[i])) { //$NON-NLS-1$
|
||||
pidColumn = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pidColumn < 0) {
|
||||
GdbUIPlugin.log(
|
||||
new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Missing 'pid' column to perform attach")); //$NON-NLS-1$
|
||||
return null;
|
||||
}
|
||||
|
||||
// Use a set of process. It is possible to have multiple entries
|
||||
// with the same pid, e.g. threads with same process id
|
||||
Set<String> process_ids = new LinkedHashSet<String>();
|
||||
for (Object sel : ((IStructuredSelection) selection).toList()) {
|
||||
IResourcesInformation ri = (IResourcesInformation) sel;
|
||||
if (pidColumn >= 0) {
|
||||
String pid = ri.getContent()[0][pidColumn];
|
||||
try {
|
||||
Integer.parseInt(pid); // test for integer value
|
||||
process_ids.add(pid);
|
||||
} catch (NumberFormatException e) {
|
||||
GdbUIPlugin.log(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Non-integer pid " + pid, e)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
final ICommandControlDMContext context = ((OSResourcesView) part).getSessionContext();
|
||||
final List<Sequence.Step> attach_steps = new ArrayList<Sequence.Step>(process_ids.size());
|
||||
for (final String p : process_ids) {
|
||||
attach_steps.add(new Sequence.Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
attachToProcess(context, p, rm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return MessageFormat.format(Messages.OSView_AttachTask, p);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!attach_steps.isEmpty()) {
|
||||
Job.create(Messages.OSView_AttachJobName, new ICoreRunnable() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
DsfSession session = DsfSession.getSession(context.getSessionId());
|
||||
Sequence sequence = new Sequence(session.getExecutor(), monitor, Messages.OSView_AttachJobName,
|
||||
"") { //$NON-NLS-1$
|
||||
@Override
|
||||
public Step[] getSteps() {
|
||||
return attach_steps.toArray(new Step[attach_steps.size()]);
|
||||
}
|
||||
};
|
||||
session.getExecutor().execute(sequence);
|
||||
try {
|
||||
sequence.get();
|
||||
} catch (InterruptedException | java.util.concurrent.ExecutionException e) {
|
||||
// ignore here.
|
||||
}
|
||||
}
|
||||
}).schedule();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void attachToProcess(final ICommandControlDMContext context, final String pid, RequestMonitor rm) {
|
||||
BundleContext c = GdbUIPlugin.getDefault().getBundle().getBundleContext();
|
||||
DsfServicesTracker tracker = new DsfServicesTracker(c, context.getSessionId());
|
||||
try {
|
||||
IGDBProcesses procService = tracker.getService(IGDBProcesses.class);
|
||||
if (procService != null) {
|
||||
// attach directly without looking for the binary
|
||||
// since GDB will figure it out by itself
|
||||
|
||||
// TODO: update with asking user for the binary for cases
|
||||
// not covered by GDB (e.g. GDB version < 7.10)
|
||||
|
||||
IProcessDMContext procDmc = procService.createProcessContext(context, pid);
|
||||
procService.attachDebuggerToProcess(procDmc, new DataRequestMonitor<IDMContext>(
|
||||
DsfSession.getSession(context.getSessionId()).getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleErrorOrWarning() {
|
||||
IStatus status = getStatus();
|
||||
if (status != null && !status.isOK()) {
|
||||
IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(status);
|
||||
if (statusHandler != null) {
|
||||
try {
|
||||
statusHandler.handleStatus(status, null);
|
||||
} catch (CoreException ex) {
|
||||
GdbUIPlugin.getDefault().getLog().log(ex.getStatus());
|
||||
}
|
||||
} else {
|
||||
GdbUIPlugin.getDefault().getLog().log(status);
|
||||
}
|
||||
}
|
||||
handleSuccess(); // mark as success even if fail.
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
rm.done();
|
||||
GdbUIPlugin.log(new Throwable("Could not retreive process service for context" + context)); //$NON-NLS-1$
|
||||
}
|
||||
} finally {
|
||||
tracker.dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,6 +30,8 @@ public class Messages extends NLS {
|
|||
public static String OSView_13;
|
||||
public static String OSView_14;
|
||||
public static String OSView_15;
|
||||
public static String OSView_AttachJobName;
|
||||
public static String OSView_AttachTask;
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(Messages.class.getName(), Messages.class);
|
||||
|
|
|
@ -21,3 +21,5 @@ OSView_12=No data has been fetched yet. Target is busy.
|
|||
OSView_13=Waiting for the debug session to initialize.
|
||||
OSView_14=Objects from different debug sessions are selected.
|
||||
OSView_15=No debug session is selected.
|
||||
OSView_AttachJobName=Connecting debug session to processes
|
||||
OSView_AttachTask=Connecting to process {0}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011, 2012 Mentor Graphics and others.
|
||||
* Copyright (c) 2011, 2016 Mentor Graphics 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
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Vladimir Prus (Mentor Graphics) - initial API and implementation
|
||||
* Teodor Madan (Freescale Semiconductor) - Bug 486521: attaching to selected process
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.osview;
|
||||
|
@ -120,7 +121,7 @@ implements ITableLabelProvider, IStructuredContentProvider
|
|||
|
||||
@Override
|
||||
public String getColumnText(Object obj, int index) {
|
||||
return ((String[]) obj)[remap.get(index)];
|
||||
return ((IResourcesInformation) obj).getContent()[0][remap.get(index)];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -143,6 +144,23 @@ implements ITableLabelProvider, IStructuredContentProvider
|
|||
|
||||
@Override
|
||||
public Object[] getElements(Object parent) {
|
||||
return data.getContent();
|
||||
// split into array of resource information for each raw
|
||||
String[][] content = data.getContent();
|
||||
IResourcesInformation[] split_ri = new IResourcesInformation[content.length];
|
||||
for (int i = 0; i< content.length; ++i) {
|
||||
final String[][] row_content = new String[1][content[i].length];
|
||||
row_content[0] = content[i];
|
||||
split_ri[i]=new IResourcesInformation() {
|
||||
@Override
|
||||
public String[] getColumnNames() {
|
||||
return data.getColumnNames();
|
||||
}
|
||||
@Override
|
||||
public String[][] getContent() {
|
||||
return row_content;
|
||||
}
|
||||
};
|
||||
}
|
||||
return split_ri;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011, 2015 Mentor Graphics and others.
|
||||
* Copyright (c) 2011, 2016 Mentor Graphics 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
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Vladimir Prus (Mentor Graphics) - initial API and implementation
|
||||
* Teodor Madan (Freescale Semiconductor) - Bug 486521: attaching to selected process
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.osview;
|
||||
|
@ -40,6 +41,10 @@ import org.eclipse.debug.ui.contexts.IDebugContextManager;
|
|||
import org.eclipse.debug.ui.contexts.IDebugContextService;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -56,9 +61,11 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Link;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.ui.IActionBars;
|
||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||
import org.eclipse.ui.part.ViewPart;
|
||||
import org.eclipse.ui.progress.UIJob;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
@ -138,8 +145,8 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
if (event.text.equals("fetch")) //$NON-NLS-1$
|
||||
if (fSessionData != null && fResourceClass != null)
|
||||
fSessionData.fetchData(fResourceClass);
|
||||
if (fSessionData != null && getResourceClass() != null)
|
||||
fSessionData.fetchData(getResourceClass());
|
||||
}
|
||||
});
|
||||
fNothingLabelContainer.setBackground(fNothingLabel.getBackground());
|
||||
|
@ -152,9 +159,9 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
|
||||
@Override
|
||||
public void resourceClassChanged(String newClass) {
|
||||
fResourceClass = newClass;
|
||||
setResourceClass(newClass);
|
||||
// Since user explicitly changed the class, initiate fetch immediately.
|
||||
fSessionData.fetchData(fResourceClass);
|
||||
fSessionData.fetchData(getResourceClass());
|
||||
// Do not call 'update()' here. fetchData call above will notify
|
||||
// us at necessary moments.
|
||||
}
|
||||
|
@ -165,8 +172,8 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
fRefreshAction = new Action() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (fSessionData != null && fResourceClass != null)
|
||||
fSessionData.fetchData(fResourceClass);
|
||||
if (fSessionData != null && getResourceClass() != null)
|
||||
fSessionData.fetchData(getResourceClass());
|
||||
}
|
||||
};
|
||||
fRefreshAction.setText(Messages.OSView_3);
|
||||
|
@ -184,10 +191,32 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
bars.getToolBarManager().add(fRefreshAction);
|
||||
bars.updateActionBars();
|
||||
|
||||
fResourceClass = fResourceClassEditor.getResourceClassId();
|
||||
createContextMenu();
|
||||
getSite().setSelectionProvider(fViewer);
|
||||
|
||||
|
||||
setResourceClass(fResourceClassEditor.getResourceClassId());
|
||||
|
||||
setupContextListener();
|
||||
DsfSession.addSessionEndedListener(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void createContextMenu() {
|
||||
MenuManager menuMgr= new MenuManager("#PopUp"); //$NON-NLS-1$
|
||||
menuMgr.setRemoveAllWhenShown(true);
|
||||
menuMgr.addMenuListener(new IMenuListener() {
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager manager) {
|
||||
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
|
||||
}
|
||||
});
|
||||
Menu menu= menuMgr.createContextMenu(fViewer.getControl());
|
||||
fViewer.getControl().setMenu(menu);
|
||||
|
||||
// register the context menu such that other plug-ins may contribute to it
|
||||
getSite().registerContextMenu(menuMgr, fViewer);
|
||||
}
|
||||
|
||||
private void setupContextListener() {
|
||||
|
@ -370,7 +399,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
|
||||
boolean enable = fSessionData.canFetchData();
|
||||
fRefreshAction.setEnabled(enable);
|
||||
fResourceClass = fResourceClassEditor.updateClasses(fSessionData.getResourceClasses());
|
||||
setResourceClass(fResourceClassEditor.updateClasses(fSessionData.getResourceClasses()));
|
||||
fResourceClassEditor.setEnabled(enable);
|
||||
|
||||
if (!fSessionData.osResourcesSupported()) {
|
||||
|
@ -394,7 +423,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
return;
|
||||
}
|
||||
|
||||
if (fResourceClass == null)
|
||||
if (getResourceClass() == null)
|
||||
{
|
||||
fRefreshAction.setEnabled(false);
|
||||
fResourceClassEditor.setEnabled(true);
|
||||
|
@ -403,7 +432,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
}
|
||||
|
||||
|
||||
final OSData data = fSessionData.existingData(fResourceClass);
|
||||
final OSData data = fSessionData.existingData(getResourceClass());
|
||||
|
||||
if (fSessionData.fetchingContent())
|
||||
{
|
||||
|
@ -419,7 +448,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
else
|
||||
{
|
||||
SimpleDateFormat format = new SimpleDateFormat(Messages.OSView_8);
|
||||
fRefreshAction.setToolTipText(format.format(fSessionData.timestamp(fResourceClass)));
|
||||
fRefreshAction.setToolTipText(format.format(fSessionData.timestamp(getResourceClass())));
|
||||
if (data != fTableShownData)
|
||||
{
|
||||
Job job = new UIJob(Messages.OSView_9) {
|
||||
|
@ -486,11 +515,11 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
while (table.getColumnCount() > 0)
|
||||
table.getColumns()[0].dispose();
|
||||
|
||||
fColumnLayout = fColumnLayouts.get(fResourceClass);
|
||||
fColumnLayout = fColumnLayouts.get(getResourceClass());
|
||||
if (fColumnLayout == null)
|
||||
{
|
||||
fColumnLayout = new ColumnLayout(fResourceClass);
|
||||
fColumnLayouts.put(fResourceClass, fColumnLayout);
|
||||
fColumnLayout = new ColumnLayout(getResourceClass());
|
||||
fColumnLayouts.put(getResourceClass(), fColumnLayout);
|
||||
}
|
||||
|
||||
for (int i = 0; i < data.getColumnCount(); ++i) {
|
||||
|
@ -667,4 +696,25 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
|
|||
public void setFocus() {
|
||||
fViewer.getControl().setFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the currently selected and displayed resource class
|
||||
*/
|
||||
public String getResourceClass() {
|
||||
return fResourceClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resourceClass the resource class to set
|
||||
*/
|
||||
private void setResourceClass(String resourceClass) {
|
||||
fResourceClass = resourceClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return currently debug context for which resources are displayed
|
||||
*/
|
||||
public ICommandControlDMContext getSessionContext() {
|
||||
return fSessionData != null ? fSessionData.getContext() : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011, 2013 Mentor Graphics and others.
|
||||
* Copyright (c) 2011, 2016 Mentor Graphics 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
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Vladimir Prus (Mentor Graphics) - initial API and implementation
|
||||
* Teodor Madan (Freescale Semiconductor) - Bug 486521: attaching to selected process
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.osview;
|
||||
|
@ -220,7 +221,7 @@ public class SessionOSData {
|
|||
}
|
||||
else
|
||||
{
|
||||
StatusManager.getManager().handle(getStatus(), StatusManager.BLOCK);
|
||||
StatusManager.getManager().handle(getStatus(), StatusManager.SHOW);
|
||||
}
|
||||
notifyUI();
|
||||
}
|
||||
|
@ -291,4 +292,11 @@ public class SessionOSData {
|
|||
notifyUI();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fContext
|
||||
*/
|
||||
public ICommandControlDMContext getContext() {
|
||||
return fContext;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue