Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-10-26 13:07:07 +0000
committerUwe Stieber2012-10-26 13:07:07 +0000
commit49469979688a580b6b5dad00d8e929c9ea1dfd0e (patch)
treeeca50b2d81e2b17ffb5659900644dc27438f91a8 /target_explorer
parent03b53d06408f140ca7471663d3f9e15cd5899f44 (diff)
downloadorg.eclipse.tcf-49469979688a580b6b5dad00d8e929c9ea1dfd0e.tar.gz
org.eclipse.tcf-49469979688a580b6b5dad00d8e929c9ea1dfd0e.tar.xz
org.eclipse.tcf-49469979688a580b6b5dad00d8e929c9ea1dfd0e.zip
Target Explorer: Fix Bug 392243 - [TERMINALS] state of the "pin" button is not restored on quit and restart
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/async/UICallbackInvocationDelegate.java33
5 files changed, 79 insertions, 2 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF
index e606f394a..c089ce6c5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.ui.ide;bundle-version="3.8.0",
org.eclipse.ui.forms;bundle-version="3.5.200",
org.eclipse.tm.terminal;bundle-version="3.2.0",
+ org.eclipse.tcf.te.core;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0",
org.eclipse.tcf.te.ui;bundle-version="1.1.0",
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java
index 50eebb2c7..02585ed2e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java
@@ -342,6 +342,14 @@ public class TabFolderToolbarHandler extends PlatformObject {
if (IToolBarManager.class.isAssignableFrom(adapter)) {
return toolbarManager;
}
+
+ // Try the toolbar actions
+ for (AbstractTerminalAction action : toolbarActions) {
+ if (adapter.isAssignableFrom(action.getClass())) {
+ return action;
+ }
+ }
+
// Try the parent view
Object adapted = getParentView().getAdapter(adapter);
if (adapted != null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java
index 4b0de2da8..a1963c0d5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java
@@ -13,13 +13,20 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.tcf.te.core.async.AsyncCallbackCollector;
+import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.ui.async.UICallbackInvocationDelegate;
+import org.eclipse.tcf.te.ui.swt.DisplayUtil;
+import org.eclipse.tcf.te.ui.terminals.actions.PinTerminalAction;
import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
+import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderToolbarHandler;
import org.eclipse.ui.IMemento;
/**
@@ -56,6 +63,9 @@ public class TerminalsViewMementoHandler {
memento = memento.createChild("terminalConnections"); //$NON-NLS-1$
Assert.isNotNull(memento);
+ // Save the pinned state
+ memento.putBoolean("pinned", view.isPinned()); //$NON-NLS-1$
+
// Loop the saveable items and store the connection data of each
// item to the memento
for (CTabItem item : saveables) {
@@ -103,13 +113,35 @@ public class TerminalsViewMementoHandler {
* @param view The terminals view. Must not be <code>null</code>.
* @param memento The memento. Must not be <code>null</code>.
*/
- protected void restoreState(TerminalsView view, IMemento memento) {
+ protected void restoreState(final TerminalsView view, IMemento memento) {
Assert.isNotNull(view);
Assert.isNotNull(memento);
// Get the "terminalConnections" memento
memento = memento.getChild("terminalConnections"); //$NON-NLS-1$
if (memento != null) {
+ final IMemento finMemento = memento;
+ // Restore the pinned state of the after all connections completed
+ AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ // Restore the pinned state
+ if (finMemento.getBoolean("pinned") != null) { //$NON-NLS-1$
+ DisplayUtil.safeAsyncExec(new Runnable() {
+ @Override
+ public void run() {
+ view.setPinned(finMemento.getBoolean("pinned").booleanValue()); //$NON-NLS-1$
+
+ TabFolderToolbarHandler toolbarHandler = (TabFolderToolbarHandler)view.getAdapter(TabFolderToolbarHandler.class);
+ if (toolbarHandler != null) {
+ PinTerminalAction action = (PinTerminalAction)toolbarHandler.getAdapter(PinTerminalAction.class);
+ if (action != null) action.setChecked(view.isPinned());
+ }
+ }
+ });
+ }
+ }
+ }, new UICallbackInvocationDelegate());
// Get all the "connection" memento's.
IMemento[] connections = memento.getChildren("connection"); //$NON-NLS-1$
for (IMemento connection : connections) {
@@ -133,9 +165,11 @@ public class TerminalsViewMementoHandler {
// Restore the terminal connection
if (delegate != null && !properties.isEmpty()) {
- delegate.execute(properties, null);
+ delegate.execute(properties, new AsyncCallbackCollector.SimpleCollectorCallback(collector));
}
}
+
+ collector.initDone();
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui/META-INF/MANIFEST.MF
index 67f00a300..6e3229a05 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/META-INF/MANIFEST.MF
@@ -23,6 +23,7 @@ Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.ui,
org.eclipse.tcf.te.ui.activator,
+ org.eclipse.tcf.te.ui.async,
org.eclipse.tcf.te.ui.dialogs,
org.eclipse.tcf.te.ui.events,
org.eclipse.tcf.te.ui.interfaces,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/async/UICallbackInvocationDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/async/UICallbackInvocationDelegate.java
new file mode 100644
index 000000000..0703d0455
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/async/UICallbackInvocationDelegate.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.async;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.core.async.AsyncCallbackCollector;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Asynchronous callback collector callback invocation delegate implementation.
+ * <p>
+ * The delegate invokes callbacks within the UI thread.
+ */
+public class UICallbackInvocationDelegate implements AsyncCallbackCollector.ICallbackInvocationDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.core.async.AsyncCallbackCollector.ICallbackInvocationDelegate#invoke(java.lang.Runnable)
+ */
+ @Override
+ public void invoke(Runnable runnable) {
+ Assert.isNotNull(runnable);
+ if (PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getDisplay() != null) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(runnable);
+ }
+ }
+}

Back to the top