Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-07-26 15:15:46 +0000
committerUwe Stieber2012-07-26 15:17:03 +0000
commit8d17e7863c2784e449966305e0986b7771b3db45 (patch)
tree7f5c2a89eb0b99806d1560d53d88685efe780e1e /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards
parent966739b40ded10422b79ef2f1f3b384c45a28ca7 (diff)
downloadorg.eclipse.tcf-8d17e7863c2784e449966305e0986b7771b3db45.tar.gz
org.eclipse.tcf-8d17e7863c2784e449966305e0986b7771b3db45.tar.xz
org.eclipse.tcf-8d17e7863c2784e449966305e0986b7771b3db45.zip
Target Explorer: Assure Target Explorer model initialization if working outside of the native Target Explorer perspective and without having the System Management view open
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java61
1 files changed, 27 insertions, 34 deletions
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());

Back to the top