diff options
author | Darin Wright | 2006-10-16 18:47:27 +0000 |
---|---|---|
committer | Darin Wright | 2006-10-16 18:47:27 +0000 |
commit | 4fe8f08266ae4b63ac800d5af4c1c274fba9e8d4 (patch) | |
tree | 33bd47021ca5dd820eb613f6047370c4e280ee1e /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java | |
parent | adab4b6fdaa1dd4ef8cca75eb6deacb581ca9e1f (diff) | |
download | eclipse.platform.debug-4fe8f08266ae4b63ac800d5af4c1c274fba9e8d4.tar.gz eclipse.platform.debug-4fe8f08266ae4b63ac800d5af4c1c274fba9e8d4.tar.xz eclipse.platform.debug-4fe8f08266ae4b63ac800d5af4c1c274fba9e8d4.zip |
Bug 160932 API for debug context and debug commands
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java new file mode 100644 index 000000000..cf01524ff --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.debug.core.model.IDisconnect; +import org.eclipse.debug.internal.ui.commands.provisional.IDisconnectCommand; +import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; + +/** + * Default disconnect command for the standard debug model. + * + * @since 3.3 + */ +public class DisconnectCommand extends DebugCommand implements IDisconnectCommand { + + protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException { + return ((IDisconnect)target).canDisconnect(); + } + + protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException { + ((IDisconnect)target).disconnect(); + } + + protected Object getTarget(Object element) { + if (element instanceof IDisconnect) { + return element; + } else if (element instanceof IAdaptable) { + return ((IAdaptable) element).getAdapter(IDisconnect.class); + } + return null; + } +} |