Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-09-15 02:13:40 -0400
committerTobias Schwarz2014-09-15 02:13:40 -0400
commit31f117fe6d79f482a3d39122bff60e54674c0977 (patch)
tree05fea9589020c67502f36bb1abcc73674cbb8d42
parent9cf80b30c10542abcfd3f1f3a7fcc7beff1527dc (diff)
downloadorg.eclipse.tcf-31f117fe6d79f482a3d39122bff60e54674c0977.tar.gz
org.eclipse.tcf-31f117fe6d79f482a3d39122bff60e54674c0977.tar.xz
org.eclipse.tcf-31f117fe6d79f482a3d39122bff60e54674c0977.zip
Target Explorer: unify "canAttach" handling
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextStep.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/util/ProcessDataHelper.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/ContentProvider.java2
4 files changed, 14 insertions, 18 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextStep.java
index 78452b76f..9b58efb8d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/AttachContextStep.java
@@ -24,6 +24,7 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService;
@@ -86,19 +87,19 @@ public class AttachContextStep extends AbstractPeerNodeStep {
if (processes != null) {
processContext.attach(new IProcesses.DoneCommand() {
@Override
- public void doneCommand(IToken token, Exception error) {
+ public void doneCommand(IToken token, final Exception error) {
if (processContextNode != null) {
IModel model = processContextNode.getParent(IModel.class);
Assert.isNotNull(model);
model.getService(IModelRefreshService.class).refresh(processContextNode, new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
- callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
+ callback(data, fullQualifiedId, callback, StatusHelper.getStatus(error), null);
}
});
}
else {
- callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
+ callback(data, fullQualifiedId, callback, StatusHelper.getStatus(error), null);
}
}
});
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/util/ProcessDataHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/util/ProcessDataHelper.java
index e96c2a508..cf272f480 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/util/ProcessDataHelper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/util/ProcessDataHelper.java
@@ -66,8 +66,9 @@ public class ProcessDataHelper {
Protocol.invokeAndWait(new Runnable() {
@Override
public void run() {
- if (node.getProcessContext().getProperties().containsKey("CanAttach")) { //$NON-NLS-1$
- Boolean value = (Boolean)node.getProcessContext().getProperties().get("CanAttach"); //$NON-NLS-1$
+ if (node.getProcessContext() != null) {
+ Boolean value = node.getProcessContext().getProperties().containsKey("CanAttach") ? //$NON-NLS-1$
+ (Boolean)node.getProcessContext().getProperties().get("CanAttach") : Boolean.TRUE; //$NON-NLS-1$
if (value != null && value.booleanValue()) {
IProcessContextItem item = new ProcessContextItem();
item.setProperty(IProcessContextItem.PROPERTY_ID, node.getProcessContext().getID());
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 0a7f5de76..49cec1ddb 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
@@ -133,9 +133,6 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
filterLabel.setText(Messages.AttachContextSelectionDialog_filter_label);
PatternFilter filter = new PatternFilter() {
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.PatternFilter#isElementSelectable(java.lang.Object)
- */
@Override
public boolean isElementSelectable(final Object element) {
final AtomicBoolean canAttach = new AtomicBoolean();
@@ -149,10 +146,6 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
}
return element instanceof IProcessContextNode;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.PatternFilter#isLeafMatch(org.eclipse.jface.viewers.Viewer, java.lang.Object)
- */
@Override
protected boolean isLeafMatch(Viewer viewer, final Object element) {
if (element instanceof IProcessContextNode) {
@@ -338,9 +331,12 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
protected boolean canAttach(Object selection) {
if (selection instanceof IProcessContextNode) {
IProcessContextNode node = (IProcessContextNode)selection;
- if (node.getProcessContext().getProperties().containsKey("CanAttach")) { //$NON-NLS-1$
- Boolean value = (Boolean)node.getProcessContext().getProperties().get("CanAttach"); //$NON-NLS-1$
- return value != null && value.booleanValue();
+ if (node.getProcessContext() != null) {
+ if (node.getProcessContext().getProperties().containsKey("CanAttach")) { //$NON-NLS-1$
+ Boolean value = (Boolean)node.getProcessContext().getProperties().get("CanAttach"); //$NON-NLS-1$
+ return value != null && value.booleanValue();
+ }
+ return true;
}
}
return false;
@@ -349,7 +345,7 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
protected boolean isAttached(Object selection) {
if (selection instanceof IProcessContextNode) {
IProcessContextNode node = (IProcessContextNode)selection;
- return node.getProcessContext().isAttached();
+ return node.getProcessContext() != null && node.getProcessContext().isAttached();
}
return false;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/ContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/ContentProvider.java
index 5461360e0..52711c360 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/ContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/ContentProvider.java
@@ -38,7 +38,6 @@ import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeMo
import org.eclipse.tcf.te.tcf.processes.core.model.nodes.PendingOperationNode;
import org.eclipse.tcf.te.tcf.processes.ui.navigator.events.TreeViewerListener;
-
/**
* Runtime model content provider delegate implementation.
*/
@@ -300,7 +299,6 @@ public class ContentProvider implements ITreeContentProvider {
*/
@Override
public void dispose() {
-// ModelManager.disposeAllRuntimeModels();
}
/* (non-Javadoc)

Back to the top