diff options
13 files changed, 440 insertions, 500 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/Startup.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/Startup.java index 0cae997dc..4160f069b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/Startup.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/Startup.java @@ -28,20 +28,7 @@ public class Startup { /* default */ final static AtomicBoolean STARTED = new AtomicBoolean(false); static { - // We might get here on shutdown as well, and if TCF has not - // been loaded, than we will run into an NPE. Lets double check. - if (Protocol.getEventQueue() != null) { - // Initialize the framework status by scheduling a simple - // runnable to execute and be invoked once the framework - // is fully up and usable. - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - // Core framework is scheduling the runnables, means it is started. - setStarted(true); - } - }); - } + setStarted(true); } /** @@ -56,12 +43,15 @@ public class Startup { if (Protocol.getEventQueue() != null) { // Catch IllegalStateException: TCF event dispatcher has shut down try { - Protocol.invokeLater(new Runnable() { + Runnable runnable = new Runnable() { @Override public void run() { if (STARTED.get()) Tcf.start(); else Tcf.stop(); } - }); + }; + + if (Protocol.isDispatchThread()) runnable.run(); + else Protocol.invokeAndWait(runnable); } catch (IllegalStateException e) { if (!STARTED.get() && "TCF event dispatcher has shut down".equals(e.getLocalizedMessage())) { //$NON-NLS-1$ // ignore the exception on shutdown diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java index dbcc1d574..d4dd8b2aa 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java @@ -1,213 +1,211 @@ -/*******************************************************************************
- * 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.tcf.filesystem.core.internal.operations;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.te.runtime.utils.Host;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.testers.TargetPropertyTester;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
-
-/**
- * The operation to parse a platform specific path to a target's node.
- */
-public class OpParsePath extends Operation {
- // The peer on which the file is located.
- IPeerModel peer;
- // The path on the target.
- String path;
- // The parsing result.
- FSTreeNode result;
-
- /**
- * Create an instance with a path on a specified target.
- *
- * @param peer The target peer.
- * @param path The path to be parsed.
- */
- public OpParsePath(IPeerModel peer, String path) {
- this.peer = peer;
- this.path = path;
- }
-
- /**
- * The path of the cache file to be parsed.
- *
- * @param filePath The local cache's file.
- */
- @SuppressWarnings("unchecked")
- public OpParsePath(String filePath) {
- String cache_root = CacheManager.getCacheRoot().getAbsolutePath();
- if (filePath.startsWith(cache_root)) {
- filePath = filePath.substring(cache_root.length() + 1);
- int slash = filePath.indexOf(File.separator);
- if (slash != -1) {
- String peerId = filePath.substring(0, slash);
- peerId = peerId.replace(CacheManager.PATH_ESCAPE_CHAR, ':');
- Map<String, IPeerModel> peers = (Map<String, IPeerModel>) Model.getModel().getAdapter(Map.class);
- peer = peers.get(peerId);
- if (peer != null) {
- boolean hostWindows = Host.isWindowsHost();
- boolean windows = TargetPropertyTester.isWindows(peer);
- filePath = filePath.substring(slash + 1);
- if (hostWindows) {
- if (windows) {
- slash = filePath.indexOf(File.separator);
- if (slash != -1) {
- String disk = filePath.substring(0, slash);
- filePath = filePath.substring(slash + 1);
- disk = disk.replace(CacheManager.PATH_ESCAPE_CHAR, ':');
- filePath = disk + File.separator + filePath;
- }
- }
- else {
- filePath = "/" + filePath.replace('\\', '/'); //$NON-NLS-1$
- }
- }
- else {
- if (windows) {
- slash = filePath.indexOf(File.separator);
- if (slash != -1) {
- String disk = filePath.substring(0, slash);
- filePath = filePath.substring(slash + 1);
- disk = disk.replace(CacheManager.PATH_ESCAPE_CHAR, ':');
- filePath = disk + File.separator + filePath;
- }
- filePath = filePath.replace(File.separatorChar, '\\');
- }
- else {
- filePath = "/" + filePath; //$NON-NLS-1$
- }
- }
- path = filePath;
- }
- }
- }
- }
-
- /**
- * Get the parsing result, which is a node that representing
- * a file on the target system.
- *
- * @return The file system node.
- */
- public FSTreeNode getResult() {
- return result;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (peer != null && path != null) {
- final FSTreeNode root = FSModel.getFSModel(peer).getRoot();
- if (!root.childrenQueried) {
- new NullOpExecutor().execute(new OpRefreshRoots(root));
- }
- Object[] elements = root.getChildren().toArray();
- if (elements != null && elements.length != 0 && path.length() != 0) {
- final FSTreeNode[] children = new FSTreeNode[elements.length];
- System.arraycopy(elements, 0, children, 0, elements.length);
- SafeRunner.run(new ISafeRunnable() {
- @Override
- public void handleException(Throwable e) {
- // Ignore exception
- }
-
- @Override
- public void run() throws Exception {
- result = findPath(peer.getPeer(), children, path);
- }
- });
- }
- }
- }
-
-
- /**
- * Search the path in the children list. If it exists, then search the children of the found
- * node recursively until the whole path is found. Or else return null.
- *
- * @param children The children nodes to search the path.
- * @param path The path to be searched.
- * @return The leaf node that has the searched path.
- * @throws TCFException Thrown during searching.
- */
- FSTreeNode findPath(IPeer peer, FSTreeNode[] children, String path) throws TCFException, InterruptedException {
- Assert.isTrue(children != null && children.length != 0);
- Assert.isTrue(path != null && path.length() != 0);
- FSTreeNode node = children[0];
- String osPathSep = node.isWindowsNode() ? "\\" : "/"; //$NON-NLS-1$ //$NON-NLS-2$
- int delim = path.indexOf(osPathSep);
- String segment = null;
- if (delim != -1) {
- segment = path.substring(0, delim);
- path = path.substring(delim + 1);
- if (node.isRoot()) {
- // If it is root directory, the name ends with the path separator.
- segment += osPathSep;
- }
- }
- else {
- segment = path;
- path = null;
- }
- node = findPathSeg(children, segment);
- if (path == null || path.trim().length() == 0) {
- // The end of the path.
- return node;
- }
- else if (node != null) {
- if (node.isDirectory()) {
- List<FSTreeNode> nodes= new Operation().getChildren(node);
- children = nodes.toArray(new FSTreeNode[nodes.size()]);
- }
- else {
- children = null;
- }
- if (children != null && children.length != 0) {
- return findPath(peer, children, path);
- }
- }
- return null;
- }
-
- /**
- * Find in the children array the node that has the specified name.
- *
- * @param children The children array in which to find the node.
- * @param name The name of the node to be searched.
- * @return The node that has the specified name.
- */
- private FSTreeNode findPathSeg(FSTreeNode[] children, String name) {
- for (FSTreeNode child : children) {
- if (child.isWindowsNode()) {
- if (child.name.equalsIgnoreCase(name)) return child;
- }
- else if (child.name.equals(name)) return child;
- }
- return null;
- }
-}
+/******************************************************************************* + * 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.tcf.filesystem.core.internal.operations; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.tcf.protocol.IPeer; +import org.eclipse.tcf.te.runtime.utils.Host; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.testers.TargetPropertyTester; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager; +import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel; +import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; +import org.eclipse.tcf.te.tcf.locator.model.Model; + +/** + * The operation to parse a platform specific path to a target's node. + */ +public class OpParsePath extends Operation { + // The peer on which the file is located. + IPeerModel peer; + // The path on the target. + String path; + // The parsing result. + FSTreeNode result; + + /** + * Create an instance with a path on a specified target. + * + * @param peer The target peer. + * @param path The path to be parsed. + */ + public OpParsePath(IPeerModel peer, String path) { + this.peer = peer; + this.path = path; + } + + /** + * The path of the cache file to be parsed. + * + * @param filePath The local cache's file. + */ + public OpParsePath(String filePath) { + String cache_root = CacheManager.getCacheRoot().getAbsolutePath(); + if (filePath.startsWith(cache_root)) { + filePath = filePath.substring(cache_root.length() + 1); + int slash = filePath.indexOf(File.separator); + if (slash != -1) { + String peerId = filePath.substring(0, slash); + peerId = peerId.replace(CacheManager.PATH_ESCAPE_CHAR, ':'); + peer = Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId); + if (peer != null) { + boolean hostWindows = Host.isWindowsHost(); + boolean windows = TargetPropertyTester.isWindows(peer); + filePath = filePath.substring(slash + 1); + if (hostWindows) { + if (windows) { + slash = filePath.indexOf(File.separator); + if (slash != -1) { + String disk = filePath.substring(0, slash); + filePath = filePath.substring(slash + 1); + disk = disk.replace(CacheManager.PATH_ESCAPE_CHAR, ':'); + filePath = disk + File.separator + filePath; + } + } + else { + filePath = "/" + filePath.replace('\\', '/'); //$NON-NLS-1$ + } + } + else { + if (windows) { + slash = filePath.indexOf(File.separator); + if (slash != -1) { + String disk = filePath.substring(0, slash); + filePath = filePath.substring(slash + 1); + disk = disk.replace(CacheManager.PATH_ESCAPE_CHAR, ':'); + filePath = disk + File.separator + filePath; + } + filePath = filePath.replace(File.separatorChar, '\\'); + } + else { + filePath = "/" + filePath; //$NON-NLS-1$ + } + } + path = filePath; + } + } + } + } + + /** + * Get the parsing result, which is a node that representing + * a file on the target system. + * + * @return The file system node. + */ + public FSTreeNode getResult() { + return result; + } + + /* + * (non-Javadoc) + * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + if (peer != null && path != null) { + final FSTreeNode root = FSModel.getFSModel(peer).getRoot(); + if (!root.childrenQueried) { + new NullOpExecutor().execute(new OpRefreshRoots(root)); + } + Object[] elements = root.getChildren().toArray(); + if (elements != null && elements.length != 0 && path.length() != 0) { + final FSTreeNode[] children = new FSTreeNode[elements.length]; + System.arraycopy(elements, 0, children, 0, elements.length); + SafeRunner.run(new ISafeRunnable() { + @Override + public void handleException(Throwable e) { + // Ignore exception + } + + @Override + public void run() throws Exception { + result = findPath(peer.getPeer(), children, path); + } + }); + } + } + } + + + /** + * Search the path in the children list. If it exists, then search the children of the found + * node recursively until the whole path is found. Or else return null. + * + * @param children The children nodes to search the path. + * @param path The path to be searched. + * @return The leaf node that has the searched path. + * @throws TCFException Thrown during searching. + */ + FSTreeNode findPath(IPeer peer, FSTreeNode[] children, String path) throws TCFException, InterruptedException { + Assert.isTrue(children != null && children.length != 0); + Assert.isTrue(path != null && path.length() != 0); + FSTreeNode node = children[0]; + String osPathSep = node.isWindowsNode() ? "\\" : "/"; //$NON-NLS-1$ //$NON-NLS-2$ + int delim = path.indexOf(osPathSep); + String segment = null; + if (delim != -1) { + segment = path.substring(0, delim); + path = path.substring(delim + 1); + if (node.isRoot()) { + // If it is root directory, the name ends with the path separator. + segment += osPathSep; + } + } + else { + segment = path; + path = null; + } + node = findPathSeg(children, segment); + if (path == null || path.trim().length() == 0) { + // The end of the path. + return node; + } + else if (node != null) { + if (node.isDirectory()) { + List<FSTreeNode> nodes= new Operation().getChildren(node); + children = nodes.toArray(new FSTreeNode[nodes.size()]); + } + else { + children = null; + } + if (children != null && children.length != 0) { + return findPath(peer, children, path); + } + } + return null; + } + + /** + * Find in the children array the node that has the specified name. + * + * @param children The children array in which to find the node. + * @param name The name of the node to be searched. + * @return The node that has the specified name. + */ + private FSTreeNode findPathSeg(FSTreeNode[] children, String name) { + for (FSTreeNode child : children) { + if (child.isWindowsNode()) { + if (child.name.equalsIgnoreCase(name)) return child; + } + else if (child.name.equals(name)) return child; + } + return null; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java index 33fac5041..667bbf492 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java @@ -15,7 +15,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; -import java.util.Map; import org.eclipse.core.runtime.Assert; import org.eclipse.osgi.util.NLS; @@ -33,6 +32,7 @@ import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFChannelExce import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; import org.eclipse.tcf.te.tcf.locator.model.Model; /** @@ -98,19 +98,17 @@ public class TcfURLConnection extends URLConnection { setReadTimeout(DEFAULT_READ_TIMEOUT); setCloseTimeout(DEFAULT_CLOSE_TIMEOUT); } - + /** * Find the TCF peer with the specified ID. - * + * * @param peerId The target peer's ID. * @return The peer with this ID or null if not found. */ - @SuppressWarnings("unchecked") private IPeer findPeer(String peerId) { IPeer peer = Protocol.getLocator().getPeers().get(peerId); if(peer == null) { - Map<String, IPeerModel> map = (Map<String, IPeerModel>) Model.getModel().getAdapter(Map.class); - IPeerModel peerNode = map.get(peerId); + IPeerModel peerNode = Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId); if(peerNode != null) peer = peerNode.getPeer(); } return peer; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java index 2786d555d..41b2ff90d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java @@ -1,53 +1,51 @@ -/*******************************************************************************
- * 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.tcf.filesystem.ui.internal.adapters;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-
-/**
- * The element factory for FSTreeNode used to restore FSTreeNodes persisted
- * for expanded states.
- */
-public class FSTreeNodeFactory implements IElementFactory {
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento)
- */
- @Override
- public IAdaptable createElement(IMemento memento) {
- String peerId = memento.getString("peerId"); //$NON-NLS-1$
- Map<String, IPeerModel> peerMap = (Map<String, IPeerModel>) Model.getModel().getAdapter(Map.class);
- IPeerModel peerModel = peerMap.get(peerId);
- if(peerModel != null) {
- String path = memento.getString("path"); //$NON-NLS-1$
- if(path == null) {
- return FSModel.getFSModel(peerModel).getRoot();
- }
- OpParsePath op = new OpParsePath(peerModel, path);
- IOpExecutor executor = new NullOpExecutor();
- IStatus status = executor.execute(op);
- if(status.isOK()) {
- return op.getResult();
- }
- }
- return null;
- }
-}
+/******************************************************************************* + * 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.tcf.filesystem.ui.internal.adapters; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath; +import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; +import org.eclipse.tcf.te.tcf.locator.model.Model; +import org.eclipse.ui.IElementFactory; +import org.eclipse.ui.IMemento; + +/** + * The element factory for FSTreeNode used to restore FSTreeNodes persisted + * for expanded states. + */ +public class FSTreeNodeFactory implements IElementFactory { + /* + * (non-Javadoc) + * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento) + */ + @Override + public IAdaptable createElement(IMemento memento) { + String peerId = memento.getString("peerId"); //$NON-NLS-1$ + IPeerModel peerModel = Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId); + if(peerModel != null) { + String path = memento.getString("path"); //$NON-NLS-1$ + if(path == null) { + return FSModel.getFSModel(peerModel).getRoot(); + } + OpParsePath op = new OpParsePath(peerModel, path); + IOpExecutor executor = new NullOpExecutor(); + IStatus status = executor.execute(op); + if(status.isOK()) { + return op.getResult(); + } + } + return null; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java index 11503b842..490326966 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java @@ -9,6 +9,7 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards; +import org.eclipse.core.runtime.Assert; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.IMessageProvider; @@ -99,8 +100,9 @@ public class TargetSelectionPage extends AbstractValidatingWizardPage { private void initialize() { // Refresh the information of remote services. ILocatorModel model = Model.getModel(); + Assert.isNotNull(model); IPeerModel[] peers = model.getPeers(); - if(peers != null) { + if (peers != null) { ILocatorModelPeerNodeQueryService service = model.getService(ILocatorModelPeerNodeQueryService.class); for (IPeerModel peer : peers) { service.queryRemoteServices(peer); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java index 23dcb71df..2fb8a344a 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java @@ -1,89 +1,88 @@ -/*******************************************************************************
- * Copyright (c) 2011, 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.tcf.locator.internal.adapters;
-
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.model.factory.Factory;
-import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableURIProvider;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
-import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
-
-/**
- * Static peers adapter factory implementation.
- */
-public class AdapterFactory implements IAdapterFactory {
- // The single instance adapter references
- private final IPersistableURIProvider peerModelPersistableURIProvider = new PeerPersistableURIProvider();
-
- private static final Class<?>[] CLASSES = new Class[] {
- IPersistableURIProvider.class
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- @Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof Map) {
- if (IPersistableURIProvider.class.equals(adapterType)) {
- Assert.isTrue(false);
- }
- }
- if (adaptableObject instanceof IPeerModel || adaptableObject instanceof IPeer || adaptableObject instanceof IPeerModelProvider) {
- if (IPersistableURIProvider.class.equals(adapterType)) {
- return peerModelPersistableURIProvider;
- }
- if (IPeerModel.class.equals(adapterType) && adaptableObject instanceof IPeer) {
- final ILocatorModel model = Model.getModel();
- if (model != null) {
- final AtomicReference<IPeerModel> node = new AtomicReference<IPeerModel>();
- final IPeer peer = (IPeer)adaptableObject;
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- String id = peer.getID();
- IPeerModel candidate = model.getService(ILocatorModelLookupService.class).lkupPeerModelById(id);
- if (candidate != null) node.set(candidate);
- else {
- candidate = Factory.getInstance().newInstance(IPeerModel.class, new Object[] { model, peer });
- if (candidate != null) node.set(candidate);
- }
- }
- };
-
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
-
- return node.get();
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- @Override
- public Class[] getAdapterList() {
- return CLASSES;
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2011, 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.tcf.locator.internal.adapters; + +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.tcf.protocol.IPeer; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.runtime.model.factory.Factory; +import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableURIProvider; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider; +import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; +import org.eclipse.tcf.te.tcf.locator.model.Model; + +/** + * Static peers adapter factory implementation. + */ +public class AdapterFactory implements IAdapterFactory { + // The single instance adapter references + private final IPersistableURIProvider peerModelPersistableURIProvider = new PeerPersistableURIProvider(); + + private static final Class<?>[] CLASSES = new Class[] { + IPersistableURIProvider.class + }; + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) + */ + @Override + public Object getAdapter(Object adaptableObject, Class adapterType) { + if (adaptableObject instanceof Map) { + if (IPersistableURIProvider.class.equals(adapterType)) { + Assert.isTrue(false); + } + } + if (adaptableObject instanceof IPeerModel || adaptableObject instanceof IPeer || adaptableObject instanceof IPeerModelProvider) { + if (IPersistableURIProvider.class.equals(adapterType)) { + return peerModelPersistableURIProvider; + } + if (IPeerModel.class.equals(adapterType) && adaptableObject instanceof IPeer) { + final AtomicReference<IPeerModel> node = new AtomicReference<IPeerModel>(); + final IPeer peer = (IPeer)adaptableObject; + + Runnable runnable = new Runnable() { + @Override + public void run() { + String id = peer.getID(); + ILocatorModel model = Model.getModel(); + Assert.isNotNull(model); + IPeerModel candidate = model.getService(ILocatorModelLookupService.class).lkupPeerModelById(id); + if (candidate != null) node.set(candidate); + else { + candidate = Factory.getInstance().newInstance(IPeerModel.class, new Object[] { model, peer }); + if (candidate != null) node.set(candidate); + } + } + }; + + if (Protocol.isDispatchThread()) runnable.run(); + else Protocol.invokeAndWait(runnable); + + return node.get(); + } + } + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() + */ + @Override + public Class[] getAdapterList() { + return CLASSES; + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/model/Model.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/model/Model.java index 7e271e0ad..936f52722 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/model/Model.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/model/Model.java @@ -12,6 +12,7 @@ package org.eclipse.tcf.te.tcf.locator.model; import org.eclipse.core.runtime.Assert; import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; import org.eclipse.tcf.te.tcf.locator.nodes.LocatorModel; @@ -68,7 +69,7 @@ public final class Model { * Initialize the root node. Must be called within the TCF dispatch thread. */ protected static void initialize() { - Assert.isTrue(Protocol.isDispatchThread()); + Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ // If locator model is set in the mean while, initialize got // called twice. Return immediately in this case. @@ -76,6 +77,8 @@ public final class Model { // Create the model instance locatorModel = new LocatorModel(); + // Refresh the model right away + locatorModel.getService(ILocatorModelRefreshService.class).refresh(); // Start the scanner locatorModel.startScanner(5000, 120000); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java index a2b0b0530..ad8049a7a 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java @@ -40,7 +40,6 @@ import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager; import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler; import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; import org.eclipse.tcf.te.tcf.locator.model.Model; @@ -349,25 +348,18 @@ public class DeleteHandler extends AbstractHandler { } if (refreshModel) { - // Get the locator model - final ILocatorModel model = Model.getModel(); - if (model != null) { - // Trigger a refresh of the model - final ILocatorModelRefreshService service = model.getService(ILocatorModelRefreshService.class); - if (service != null) { - // Invoke the callback after the refresh - invokeCallback = false; - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - // Refresh the model now (must be executed within the TCF dispatch thread) - service.refresh(); - // Invoke the callback - callback.done(DeleteHandler.this, Status.OK_STATUS); - } - }); + // Trigger a refresh of the model + invokeCallback = false; + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); + // Refresh the model now (must be executed within the TCF dispatch thread) + if (service != null) service.refresh(); + // Invoke the callback + callback.done(DeleteHandler.this, Status.OK_STATUS); } - } + }); } } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/OfflineCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/OfflineCommandHandler.java index 742192f38..485d7756e 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/OfflineCommandHandler.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/OfflineCommandHandler.java @@ -37,7 +37,6 @@ import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager; import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler; import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; import org.eclipse.tcf.te.tcf.locator.model.Model; @@ -80,21 +79,15 @@ public class OfflineCommandHandler extends AbstractHandler { } } - // Get the locator model - final ILocatorModel model = Model.getModel(); - if (model != null) { - // Trigger a refresh of the model - final ILocatorModelRefreshService service = model.getService(ILocatorModelRefreshService.class); - if (service != null) { - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - // Refresh the model now (must be executed within the TCF dispatch thread) - service.refresh(); - } - }); + // Trigger a refresh of the model + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); + // Refresh the model now (must be executed within the TCF dispatch thread) + if (service != null) service.refresh(); } - } + }); } }); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java index 8ea5bae34..559c7e2a3 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java @@ -181,25 +181,18 @@ public class RenameHandler extends AbstractHandler { if (Protocol.isDispatchThread()) runnable.run(); else Protocol.invokeAndWait(runnable); - // Get the locator model - final ILocatorModel model = Model.getModel(); - if (model != null) { - // Trigger a refresh of the model - final ILocatorModelRefreshService service = model.getService(ILocatorModelRefreshService.class); - if (service != null) { - // Invoke the callback after the refresh - invokeCallback = false; - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - // Refresh the model now (must be executed within the TCF dispatch thread) - service.refresh(); - // Invoke the callback - callback.done(RenameHandler.this, Status.OK_STATUS); - } - }); + // Trigger a refresh of the model + invokeCallback = false; + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + final ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); + // Refresh the model now (must be executed within the TCF dispatch thread) + if (service != null) service.refresh(); + // Invoke the callback + callback.done(RenameHandler.this, Status.OK_STATUS); } - } + }); } } } @@ -229,6 +222,7 @@ public class RenameHandler extends AbstractHandler { name.set(node.getPeer().getName()); ILocatorModel model = Model.getModel(); + Assert.isNotNull(model); IPeerModel[] peers = model.getPeers(); for (IPeerModel peer : peers) { if (peer.equals(node)) continue; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerModelFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerModelFactory.java index 830d4ff32..777462a78 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerModelFactory.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerModelFactory.java @@ -10,11 +10,10 @@ package org.eclipse.tcf.te.tcf.ui.internal.adapters; import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelPeerNodeQueryService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; import org.eclipse.tcf.te.tcf.locator.model.Model; import org.eclipse.tcf.te.ui.views.editor.EditorInput; import org.eclipse.ui.IElementFactory; @@ -26,44 +25,21 @@ import org.eclipse.ui.IMemento; */ public class PeerModelFactory implements IElementFactory { - protected boolean isModelRefreshed = false; - - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento) */ @Override public IAdaptable createElement(IMemento memento) { - String peerId = memento.getString("peerId"); //$NON-NLS-1$ - // refresh the model - if (!isModelRefreshed) { - Protocol.invokeAndWait(new Runnable() { - @Override - public void run() { - ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); - if (service != null) { - service.refresh(); - service.refreshStaticPeers(); - } - isModelRefreshed = true; - } - }); - } - // search the peerId in the models peers - IPeerModel[] peerModels = Model.getModel().getPeers(); IPeerModel node = null; - for (IPeerModel peerModel : peerModels) { - if (peerModel.getPeer().getID().equals(peerId)) { - node = peerModel; - break; + String peerId = memento.getString("peerId"); //$NON-NLS-1$ + if (peerId != null) { + node = Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId); + if (node != null) { + ILocatorModel model = node.getModel(); + ILocatorModelPeerNodeQueryService queryService = model.getService(ILocatorModelPeerNodeQueryService.class); + queryService.queryRemoteServices(node); } } - - if (node != null) { - ILocatorModel model = node.getModel(); - ILocatorModelPeerNodeQueryService queryService = model.getService(ILocatorModelPeerNodeQueryService.class); - queryService.queryRemoteServices(node); - } return node != null ? new EditorInput(node) : null; } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java index d1a9b017b..b209d4a5b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java @@ -31,7 +31,6 @@ import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; @@ -121,41 +120,35 @@ public class NewTargetWizard extends AbstractWizard implements INewWizard { } persistenceService.write(new Peer(attrs), null); - // Get the locator model - final ILocatorModel model = Model.getModel(); - if (model != null) { - // Trigger a refresh of the model to read in the newly created static peer - final ILocatorModelRefreshService service = model.getService(ILocatorModelRefreshService.class); - if (service != null) { - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - // Refresh the model now (must be executed within the TCF dispatch thread) - service.refresh(); - - // Get the peer model node from the model and select it in the tree - final IPeerModel peerNode = model.getService(ILocatorModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID)); - if (peerNode != null) { - // Refresh the viewer - ViewsUtil.refresh(IUIConstants.ID_EXPLORER); - // Create the selection - ISelection selection = new StructuredSelection(peerNode); - // Set the selection - ViewsUtil.setSelection(IUIConstants.ID_EXPLORER, selection); - // And open the properties on the selection - if (isOpenPropertiesOnPerformFinish()) ViewsUtil.openProperties(selection); - // Allow subclasses to add logic to the performFinish(). - DisplayUtil.safeAsyncExec(new Runnable() { - @Override - public void run() { - postPerformFinish(peerNode); - } - }); + // Trigger a refresh of the model to read in the newly created static peer + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); + // Refresh the model now (must be executed within the TCF dispatch thread) + if (service != null) service.refresh(); + + // Get the peer model node from the model and select it in the tree + final IPeerModel peerNode = Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID)); + if (peerNode != null) { + // Refresh the viewer + ViewsUtil.refresh(IUIConstants.ID_EXPLORER); + // Create the selection + ISelection selection = new StructuredSelection(peerNode); + // Set the selection + ViewsUtil.setSelection(IUIConstants.ID_EXPLORER, selection); + // And open the properties on the selection + if (isOpenPropertiesOnPerformFinish()) ViewsUtil.openProperties(selection); + // Allow subclasses to add logic to the performFinish(). + DisplayUtil.safeAsyncExec(new Runnable() { + @Override + public void run() { + postPerformFinish(peerNode); } - } - }); + }); + } } - } + }); } catch (IOException e) { if (getContainer().getCurrentPage() instanceof WizardPage) { String message = NLS.bind(Messages.NewTargetWizard_error_savePeer, e.getLocalizedMessage()); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml index e23e8317e..5319721dd 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml @@ -188,14 +188,18 @@ <perspectiveExtension targetID="org.eclipse.tcf.te.ui.perspective"> <!-- Run/Debug actions should be available --> <actionSet id="org.eclipse.debug.ui.launchActionSet"/> - <!-- Register the view shortcuts --> + <!-- Register the view shortcuts --> <viewShortcut id="org.eclipse.tcf.te.ui.views.View"/> <viewShortcut id="org.eclipse.debug.ui.DebugView"/> </perspectiveExtension> <perspectiveExtension targetID="org.eclipse.ui.resourcePerspective"> - <!-- Register the view shortcuts --> + <!-- Run/Debug actions should be available --> + <actionSet id="org.eclipse.debug.ui.launchActionSet"/> + <!-- Register the view shortcuts --> <viewShortcut id="org.eclipse.tcf.te.ui.views.View"/> + <!-- Register the perspective shortcuts --> + <perspectiveShortcut id="org.eclipse.tcf.te.ui.perspective"/> <!-- System management view is placed relative to the Project Explorer --> <view id="org.eclipse.tcf.te.ui.views.View" |