summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorTobias Schwarz2012-04-17 03:38:04 (EDT)
committer Uwe Stieber2012-04-17 03:38:04 (EDT)
commit54f93e68b78e4ea076522b45210a57b2809fc284 (patch)
treee980b40459ad770d838140f6cf18286e9231e1d8
parent2a17d9faed8e5e67a6e95fea04cb0fe253a80ffe (diff)
downloadorg.eclipse.tcf-54f93e68b78e4ea076522b45210a57b2809fc284.zip
org.eclipse.tcf-54f93e68b78e4ea076522b45210a57b2809fc284.tar.gz
org.eclipse.tcf-54f93e68b78e4ea076522b45210a57b2809fc284.tar.bz2
Target Explorer: FIX remote app launch manager delegate & part without buttons
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java11
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractPartWithButtons.java11
2 files changed, 18 insertions, 4 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java
index b9a0593..a31b7b3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java
@@ -33,6 +33,7 @@ import org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.services.filetransfer.FileTransferItem;
import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+import org.eclipse.tcf.te.tcf.launch.core.interfaces.IRemoteAppLaunchAttributes;
/**
* RemoteAppLaunchManagerDelegate
@@ -53,6 +54,9 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate
if (launchSpec.hasAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS)) {
wc.setAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS, (String)launchSpec.getAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS).getValue());
}
+ if (launchSpec.hasAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE)) {
+ wc.setAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, (String)launchSpec.getAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE).getValue());
+ }
if (launchSpec.hasAttribute(IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS)) {
wc.setAttribute(IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS, (String)launchSpec.getAttribute(IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS).getValue());
}
@@ -76,6 +80,7 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate
else if (selectionContext instanceof IProjectSelectionContext) {
List<IFileTransferItem> transfers = new ArrayList<IFileTransferItem>(Arrays.asList(FileTransfersPersistenceDelegate.getFileTransfers(launchSpec)));
List<IReferencedProjectItem> projects = new ArrayList<IReferencedProjectItem>(Arrays.asList(ReferencedProjectsPersistenceDelegate.getReferencedProjects(launchSpec)));
+ String processImage = null;
boolean added = false;
for (Object selection : selectionContext.getSelections()) {
@@ -85,8 +90,11 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate
transfer.setProperty(IFileTransferItem.PROPERTY_ENABLED, true);
transfer.setProperty(IFileTransferItem.PROPERTY_HOST, path.toPortableString());
transfer.setProperty(IFileTransferItem.PROPERTY_DIRECTION, IFileTransferItem.HOST_TO_TARGET);
- transfer.setProperty(IFileTransferItem.PROPERTY_HOST, new Path("/tmp/").toPortableString()); //$NON-NLS-1$
+ transfer.setProperty(IFileTransferItem.PROPERTY_TARGET, new Path("/tmp/").toPortableString()); //$NON-NLS-1$
transfers.add(transfer);
+ if (!added) {
+ processImage = "/tmp/" + path.lastSegment(); //$NON-NLS-1$
+ }
added = true;
}
}
@@ -100,6 +108,7 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate
FileTransfersPersistenceDelegate.setFileTransfers(launchSpec, transfers.toArray(new IFileTransferItem[transfers.size()]));
ReferencedProjectsPersistenceDelegate.setReferencedProjects(launchSpec, projects.toArray(new IReferencedProjectItem[projects.size()]));
+ launchSpec.addAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, processImage);
}
return launchSpec;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractPartWithButtons.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractPartWithButtons.java
index 8f1463a..527bfde 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractPartWithButtons.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractPartWithButtons.java
@@ -41,7 +41,6 @@ public abstract class AbstractPartWithButtons extends AbstractPart {
*/
public AbstractPartWithButtons(String[] labels) {
super();
- Assert.isNotNull(labels);
this.labels = labels;
}
@@ -52,7 +51,7 @@ public abstract class AbstractPartWithButtons extends AbstractPart {
public void createControl(Composite parent, int style, int span, FormToolkit toolkit) {
Assert.isNotNull(parent);
createMainLabel(parent, span, toolkit);
- createMainControl(parent, style, span - 1, toolkit);
+ createMainControl(parent, style, span - ((labels != null && labels.length > 0) ? 1 : 0), toolkit);
createButtonsPanel(parent, toolkit);
}
@@ -86,7 +85,7 @@ public abstract class AbstractPartWithButtons extends AbstractPart {
* @return The buttons panel composite or <code>null</code>.
*/
protected Composite createButtonsPanel(Composite parent, FormToolkit toolkit) {
- if (labels.length == 0) {
+ if (labels == null || labels.length == 0) {
return null;
}
@@ -176,6 +175,9 @@ public abstract class AbstractPartWithButtons extends AbstractPart {
* @throws ArrayIndexOutOfBoundsException if the label is invalid.
*/
public Button getButton(String label) {
+ if (labels == null) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
return getButton(Arrays.asList(labels).indexOf(label));
}
@@ -188,6 +190,9 @@ public abstract class AbstractPartWithButtons extends AbstractPart {
* @throws ArrayIndexOutOfBoundsException if the index is out of bounds.
*/
public Button getButton(int index) {
+ if (buttons == null) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
return buttons[index];
}
}