Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2011-12-23 02:17:07 -0500
committerUwe Stieber2011-12-23 02:18:05 -0500
commit0d066629501884f996b427fc7d9071a3907c8b5d (patch)
treede0306c27441affc95e605d856e4ab874cb9e8f7 /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src
parente63c875e8cb5c71f478ce5d5f0fbd3f55161f580 (diff)
downloadorg.eclipse.tcf-0d066629501884f996b427fc7d9071a3907c8b5d.tar.gz
org.eclipse.tcf-0d066629501884f996b427fc7d9071a3907c8b5d.tar.xz
org.eclipse.tcf-0d066629501884f996b427fc7d9071a3907c8b5d.zip
Target Explorer: Update script pad head line to include selected peer
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/ScriptPad.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PeerAction.java2
2 files changed, 20 insertions, 4 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/ScriptPad.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/ScriptPad.java
index 3a0379b28..2224612ba 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/ScriptPad.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/ScriptPad.java
@@ -71,6 +71,7 @@ import org.eclipse.tcf.te.tcf.ui.views.scriptpad.actions.CopyAction;
import org.eclipse.tcf.te.tcf.ui.views.scriptpad.actions.CutAction;
import org.eclipse.tcf.te.tcf.ui.views.scriptpad.actions.DeleteAction;
import org.eclipse.tcf.te.tcf.ui.views.scriptpad.actions.PasteAction;
+import org.eclipse.tcf.te.tcf.ui.views.scriptpad.actions.PeerAction;
import org.eclipse.tcf.te.tcf.ui.views.scriptpad.actions.SelectAllAction;
import org.eclipse.tcf.te.ui.swt.DisplayUtil;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
@@ -96,7 +97,7 @@ public class ScriptPad extends ViewPart implements ISelectionProvider, Selection
private final List<ISelectionChangedListener> listeners = new ArrayList<ISelectionChangedListener>();
// Reference to the selected peer model
- private IPeerModel peerModel;
+ /* default */ IPeerModel peerModel;
// References to the global action handlers
private CutAction cutHandler;
@@ -386,12 +387,25 @@ public class ScriptPad extends ViewPart implements ISelectionProvider, Selection
* Update the head label
*/
protected void updateHeadLabel() {
+ StringBuilder label = new StringBuilder();
+
if (fileLoaded == null) {
- SWTControlUtil.setText(head, ""); //$NON-NLS-1$
+ label.append("<no file>"); //$NON-NLS-1$
} else {
IPath path = new Path(fileLoaded);
- SWTControlUtil.setText(head, path.lastSegment() + " - " + path.removeLastSegments(1).toOSString()); //$NON-NLS-1$
+ label.append(path.lastSegment());
}
+
+ label.append(" - "); //$NON-NLS-1$
+
+ if (peerModel == null) {
+ label.append("<no peer>"); //$NON-NLS-1$
+ } else {
+ PeerAction action = new PeerAction(this, peerModel);
+ label.append(action.getText());
+ }
+
+ SWTControlUtil.setText(head, label.toString());
}
/* (non-Javadoc)
@@ -417,6 +431,8 @@ public class ScriptPad extends ViewPart implements ISelectionProvider, Selection
*/
public void setPeerModel(IPeerModel peerModel) {
this.peerModel = peerModel;
+ // Update the head label
+ updateHeadLabel();
// Update the action bars
getViewSite().getActionBars().updateActionBars();
// Fire a property change (in the UI Thread)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PeerAction.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PeerAction.java
index a1df3a2ae..843667a64 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PeerAction.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PeerAction.java
@@ -54,7 +54,7 @@ public class PeerAction extends Action {
*/
@Override
public void run() {
- setChecked(!isChecked());
+ setChecked(true);
// Pass on the selected peer model to the parent view
if (view instanceof ScriptPad) {

Back to the top