use of org.eclipse.debug.core.model.IDebugTarget in project liferay-ide by liferay.
the class RemoteLaunchConfigDelegate method debugLaunch.
@SuppressWarnings({ "rawtypes", "unchecked", "deprecation" })
protected void debugLaunch(IServer server, ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
// setup the run launch so we get console monitor
runLaunch(server, configuration, launch, monitor);
String connectorId = getVMConnectorId(configuration);
IVMConnector connector = null;
if (connectorId == null) {
connector = JavaRuntime.getDefaultVMConnector();
} else {
connector = JavaRuntime.getVMConnector(connectorId);
}
if (connector == null) {
abort(// $NON-NLS-1$
"Debugging connector not specified.", // $NON-NLS-1$
null, IJavaLaunchConfigurationConstants.ERR_CONNECTOR_NOT_AVAILABLE);
}
Map connectMap = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map) null);
int connectTimeout = JavaRuntime.getPreferences().getInt(JavaRuntime.PREF_CONNECT_TIMEOUT);
// $NON-NLS-1$
connectMap.put("timeout", StringPool.EMPTY + connectTimeout);
// check for cancellation
if (monitor.isCanceled()) {
return;
}
if (!launch.isTerminated()) {
// connect to remote VM
connector.connect(connectMap, monitor, launch);
}
// check for cancellation
if (monitor.isCanceled() || launch.isTerminated()) {
IDebugTarget[] debugTargets = launch.getDebugTargets();
for (int i = 0; i < debugTargets.length; i++) {
IDebugTarget target = debugTargets[i];
if (target.canDisconnect()) {
target.disconnect();
}
}
return;
}
monitor.done();
}
use of org.eclipse.debug.core.model.IDebugTarget in project statecharts by Yakindu.
the class AbstractDebugTargetView method setActiveSession.
protected void setActiveSession() {
// if a simulation session is running, we should initialize with its
// content
IAdaptable debugContext = DebugUITools.getDebugContext();
if (debugContext != null) {
IDebugTarget debugTarget = (IDebugTarget) debugContext.getAdapter(IDebugTarget.class);
if (debugTarget != null) {
if (!debugTarget.isTerminated()) {
this.debugTarget = (IDebugTarget) debugTarget;
activeTargetChanged(this.debugTarget);
}
}
}
}
use of org.eclipse.debug.core.model.IDebugTarget in project statecharts by Yakindu.
the class AbstractDebugTargetView method debugContextChanged.
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
PlatformObject object = (PlatformObject) ((IStructuredSelection) event.getContext()).getFirstElement();
if (object == null)
return;
IDebugTarget newTarget = null;
if (object instanceof Launch) {
newTarget = ((Launch) object).getDebugTarget();
} else {
newTarget = (IDebugTarget) object.getAdapter(IDebugTarget.class);
}
changeTarget(newTarget);
}
}
use of org.eclipse.debug.core.model.IDebugTarget in project statecharts by Yakindu.
the class SimulationView method createSessionSelectorComponent.
protected ComboViewer createSessionSelectorComponent(Composite top) {
Combo combo = new Combo(top, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
this.sessionDropdown = new ComboViewer(combo);
this.sessionDropdown.setContentProvider(new ArrayContentProvider());
this.sessionDropdown.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
IDebugTarget target = ((IDebugTarget) element);
boolean isTerminated = target.isTerminated();
boolean isSuspended = target.isSuspended();
if (target.getLaunch().getDebugTarget() != null)
try {
return target.getLaunch().getDebugTarget().getName() + " [" + (isTerminated ? "terminated" : isSuspended ? "suspended" : "active") + "]";
} catch (DebugException e) {
return "unkown state";
}
else
return "No simulation running";
}
});
this.sessionDropdown.addPostSelectionChangedListener(new SessionSelectionChangedListener());
targets.clear();
for (ILaunch iLaunch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
for (IDebugTarget iDebugTarget : iLaunch.getDebugTargets()) {
if (!iDebugTarget.isTerminated())
targets.add(iDebugTarget);
}
}
sessionDropdown.setInput(targets);
if (!targets.isEmpty()) {
IDebugTarget dt = targets.iterator().next();
sessionDropdown.setSelection(new StructuredSelection(dt), true);
activeTargetChanged(dt);
}
return this.sessionDropdown;
}
use of org.eclipse.debug.core.model.IDebugTarget in project statecharts by Yakindu.
the class SCTHotModelReplacementManager method handleHotModelReplacement.
private void handleHotModelReplacement() {
// first implementation: If the underlying model does not change
// semantically, no notification is required...
List<IDebugTarget> targets = getAffectedTargets();
List<IDebugTarget> modelReplacementFailedTargets = new ArrayList<IDebugTarget>();
for (IDebugTarget sctDebugTarget : targets) {
// Reload the Statechart form the changes resource
Statechart newStatechart = ResourceUtil.loadStatechart(((SCTDebugElement) sctDebugTarget).getResourceString());
if (!EcoreUtil.equals(newStatechart, (EObject) sctDebugTarget.getAdapter(EObject.class))) {
// The model semantically changed, we have to create a
// notificiation for that....
modelReplacementFailedTargets.add(sctDebugTarget);
}
}
if (modelReplacementFailedTargets.size() > 0) {
notifyHotModelReplacementFailed(targets);
}
}
Aggregations