Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2016-04-25 03:47:49 -0400
committerAnton Leherbauer2016-04-25 03:50:11 -0400
commit9a28d878f8ce64f136805e775c7266bce00a2069 (patch)
tree19daf0d477682dfc69c0f8fe427a33a6c2fdb45f /target_explorer
parentaa44cad0038b7599d23604cfe7481d12f2cea384 (diff)
downloadorg.eclipse.tcf-9a28d878f8ce64f136805e775c7266bce00a2069.tar.gz
org.eclipse.tcf-9a28d878f8ce64f136805e775c7266bce00a2069.tar.xz
org.eclipse.tcf-9a28d878f8ce64f136805e775c7266bce00a2069.zip
Target Explorer: Allow to attach debugger without attaching new context
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextsIterator.java9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java54
2 files changed, 29 insertions, 34 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextsIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextsIterator.java
index 535a8356d..8bbae2854 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextsIterator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextsIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2014, 2016 Wind River Systems, Inc. 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
@@ -15,8 +15,6 @@ import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
@@ -26,7 +24,6 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.iterators.AbstractPeerNodeStepGroupIterator;
-import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
import org.eclipse.tcf.te.tcf.processes.core.interfaces.IProcessContextItem;
import org.eclipse.tcf.te.tcf.processes.core.interfaces.IProcessesDataProperties;
import org.eclipse.tcf.te.tcf.processes.core.interfaces.steps.IProcessesStepAttributes;
@@ -73,10 +70,6 @@ public class AttachContextsIterator extends AbstractPeerNodeStepGroupIterator {
}
}
setIterations(items.size());
-
- if (items.isEmpty()) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Cannot find contexts to attach.")); //$NON-NLS-1$
- }
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java
index 2e994cfb5..794180c0f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2014, 2016 Wind River Systems, Inc. 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
@@ -52,6 +52,7 @@ import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceUtils;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepAttributes;
import org.eclipse.tcf.te.tcf.core.interfaces.IContextDataProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.utils.PeerNodeDataHelper;
@@ -82,6 +83,7 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
protected FilteredTree filteredTree;
private boolean initDone = false;
+ protected boolean hasAttachedContexts;
IPeerNode peerNode;
IPropertiesContainer data = null;
@@ -134,15 +136,6 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
PatternFilter filter = new PatternFilter() {
@Override
public boolean isElementSelectable(final Object element) {
- final AtomicBoolean canAttach = new AtomicBoolean();
- if (element instanceof IProcessContextNode) {
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- canAttach.set(canAttach(element));
- }
- });
- }
return element instanceof IProcessContextNode;
}
@Override
@@ -301,11 +294,10 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
return;
}
- final AtomicBoolean valid = new AtomicBoolean(false);
+ final AtomicBoolean valid = new AtomicBoolean(hasAttachedContexts);
final ISelection selection = viewer.getSelection();
- if (selection instanceof IStructuredSelection &&
- ((IStructuredSelection)selection).size() > 0) {
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
valid.set(true);
Protocol.invokeAndWait(new Runnable() {
@Override
@@ -343,13 +335,15 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
protected boolean isAttached(Object selection) {
if (selection instanceof IProcessContextNode) {
IProcessContextNode node = (IProcessContextNode)selection;
- return node.getProcessContext() != null && node.getProcessContext().isAttached();
+ boolean isAttached = node.getProcessContext() != null && node.getProcessContext().isAttached();
+ if (!hasAttachedContexts) hasAttachedContexts = isAttached;
+ return isAttached;
}
return false;
}
protected boolean isValid(Object selection) {
- return canAttach(selection) && !isAttached(selection);
+ return canAttach(selection) || isAttached(selection);
}
/*
@@ -496,21 +490,29 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
data = new PropertiesContainer();
}
if (viewer != null) {
- ISelection sel = viewer.getSelection();
+ final ISelection sel = viewer.getSelection();
final List<IProcessContextItem> items = new ArrayList<IProcessContextItem>();
if (sel instanceof IStructuredSelection) {
- final Iterator<?> it = ((IStructuredSelection)sel).iterator();
- while (it.hasNext()) {
- Object obj = it.next();
- if (obj instanceof IProcessContextNode) {
- IProcessContextItem item = ProcessDataHelper.getProcessContextItem((IProcessContextNode)obj);
- if (item != null && !items.contains(item)) {
- items.add(item);
- }
- }
- }
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ final Iterator<?> it = ((IStructuredSelection)sel).iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj instanceof IProcessContextNode) {
+ IProcessContextItem item = ProcessDataHelper.getProcessContextItem((IProcessContextNode)obj);
+ if (item != null && !items.contains(item) && !isAttached(obj)) {
+ items.add(item);
+ }
+ }
+ }
+ }
+ });
}
data.setProperty(IProcessesDataProperties.PROPERTY_CONTEXT_LIST, ProcessDataHelper.encodeProcessContextItems(items.toArray(new IProcessContextItem[items.size()])));
+ if (items.size() == 0)
+ // No recent action history persistence
+ data.setProperty(IStepAttributes.PROP_SKIP_LAST_RUN_HISTORY, true);
}
super.okPressed();

Back to the top