Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-12-18 03:47:23 -0500
committerTobias Schwarz2013-12-18 03:47:23 -0500
commit4751095ec2a12ccd82098553141bae0d91a5e1f7 (patch)
tree28a3c6f9c2bf2eb0a0c9976983a716b102c853cf /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf
parent8384bf58f9acf5778d1f88ffee9764f7c3622ad1 (diff)
downloadorg.eclipse.tcf-4751095ec2a12ccd82098553141bae0d91a5e1f7.tar.gz
org.eclipse.tcf-4751095ec2a12ccd82098553141bae0d91a5e1f7.tar.xz
org.eclipse.tcf-4751095ec2a12ccd82098553141bae0d91a5e1f7.zip
Target Explorer: add locator model listeners
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java27
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/EditorHandlerDelegate.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/AbstractPeerNodeEditorHandlerDelegate.java)12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/EditorSaveAsAdapter.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerNodeFactory.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/UIService.java37
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProvider.java116
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/LocatorModelListener.java70
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerModelListener.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ModelListener.java)20
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/dnd/CommonDnD.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerImportWizardPage.java4
24 files changed, 243 insertions, 166 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java
index 4f6e2bda3..f8535aa55 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java
@@ -43,7 +43,7 @@ import org.eclipse.tcf.te.runtime.persistence.history.HistoryManager;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog;
import org.eclipse.tcf.te.ui.views.editor.EditorInput;
import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants;
@@ -207,7 +207,7 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA
Runnable runnable = new Runnable() {
@Override
public void run() {
- IPeerModel model = Model.getPeerModel();
+ IPeerModel model = ModelManager.getPeerModel();
Assert.isNotNull(model);
peerNode.set(model.getService(IPeerModelLookupService.class).lkupPeerModelById(peerId));
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java
index e7a3ae1f7..1eb08cc9f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java
@@ -32,7 +32,7 @@ import org.eclipse.tcf.te.tcf.core.Tcf;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IStepperServiceOperations;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
import org.eclipse.ui.IWorkbench;
@@ -104,7 +104,7 @@ public class UIPlugin extends AbstractUIPlugin {
if (proceedShutdown || forced) {
// Terminate the scanner
- final IPeerModel model = Model.getPeerModel(true);
+ final IPeerModel model = ModelManager.getPeerModel(true);
// Disconnect all connected connections via the stepper service
if (model != null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java
index d68aa1a31..0128965e0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ContextSelectorSectionControl.java
@@ -14,7 +14,7 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.navigator.ContentProvider;
import org.eclipse.tcf.te.ui.views.controls.AbstractContextSelectorControl;
import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider;
@@ -45,7 +45,7 @@ public class ContextSelectorSectionControl extends AbstractContextSelectorContro
*/
@Override
protected Object getInitialViewerInput() {
- return Model.getPeerModel();
+ return ModelManager.getPeerModel();
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java
index 9f210081c..9898b03a7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java
@@ -9,9 +9,6 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.ui.dialogs;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
@@ -32,11 +29,8 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.ILocator;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog;
@@ -147,22 +141,7 @@ public class PeerSelectionDialog extends CustomTitleAreaDialog {
// Subclasses may customize the viewer before setting the input
configureTableViewer(viewer);
- final AtomicReference<IPeer[]> peers = new AtomicReference<IPeer[]>(null);
-
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- // Get the locator service
- ILocator locatorService = Protocol.getLocator();
- if (locatorService != null) {
- // Get the map of peers known to the locator service.
- Map<String, IPeer> peerMap = locatorService.getPeers();
- peers.set(peerMap.values().toArray(new IPeer[peerMap.size()]));
- }
- }
- });
-
- viewer.setInput(peers.get());
+ viewer.setInput(ModelManager.getLocatorModel().getPeers());
viewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
@@ -254,7 +233,7 @@ public class PeerSelectionDialog extends CustomTitleAreaDialog {
* @return The locator model instance.
*/
protected IPeerModel getModel() {
- return Model.getPeerModel();
+ return ModelManager.getPeerModel();
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
index fc92ccb17..ac388f209 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
@@ -40,7 +40,7 @@ import org.eclipse.tcf.te.runtime.utils.StatusHelper;
import org.eclipse.tcf.te.tcf.core.peers.Peer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector;
import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.ui.editor.controls.InfoSectionPeerNameControl;
@@ -456,7 +456,7 @@ public class GeneralInformationSection extends AbstractSection {
@Override
public void run() {
// Get all peer model objects
- IPeerNode[] peers = Model.getPeerModel().getPeerNodes();
+ IPeerNode[] peers = ModelManager.getPeerModel().getPeerNodes();
// Loop them and find the ones which are of our handled types
for (IPeerNode peerNode : peers) {
if (!peerNode.equals(od)) {
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 3f5483c9c..387bef28d 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
@@ -41,7 +41,7 @@ import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil;
import org.eclipse.tcf.te.runtime.utils.StatusHelper;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.interfaces.handler.IDeleteHandlerDelegate;
@@ -269,7 +269,7 @@ public class DeleteHandler extends AbstractHandler {
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- IPeerModelRefreshService service = Model.getPeerModel().getService(IPeerModelRefreshService.class);
+ IPeerModelRefreshService service = ModelManager.getPeerModel().getService(IPeerModelRefreshService.class);
// Refresh the model now (must be executed within the TCF dispatch thread)
if (service != null) service.refresh(new Callback() {
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/AbstractPeerNodeEditorHandlerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/EditorHandlerDelegate.java
index 963f34125..fe1a3b789 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/AbstractPeerNodeEditorHandlerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/EditorHandlerDelegate.java
@@ -16,11 +16,12 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.ui.interfaces.handler.IEditorHandlerDelegate;
import org.eclipse.tcf.te.ui.views.editor.EditorInput;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
/**
- * AbstractPeerNodeEditorHandlerDelegate
+ * EditorHandlerDelegate
*/
-public abstract class AbstractPeerNodeEditorHandlerDelegate implements IEditorHandlerDelegate {
+public class EditorHandlerDelegate implements IEditorHandlerDelegate {
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.interfaces.handler.IEditorHandlerDelegate#getEditorInput(java.lang.Object)
@@ -33,4 +34,11 @@ public abstract class AbstractPeerNodeEditorHandlerDelegate implements IEditorHa
}
return new EditorInput(model != null ? model : element);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.handler.IEditorHandlerDelegate#postOpenEditor(org.eclipse.ui.IEditorPart, java.lang.Object)
+ */
+ @Override
+ public void postOpenEditor(IEditorPart editor, Object element) {
+ }
}
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 e7b34928d..9d736be66 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
@@ -42,7 +42,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector;
import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
@@ -174,7 +174,7 @@ public class RenameHandler extends AbstractHandler {
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- final IPeerModelRefreshService service = Model.getPeerModel().getService(IPeerModelRefreshService.class);
+ final IPeerModelRefreshService service = ModelManager.getPeerModel().getService(IPeerModelRefreshService.class);
// Refresh the model now (must be executed within the TCF dispatch thread)
if (service != null) {
service.refresh(new Callback() {
@@ -215,7 +215,7 @@ public class RenameHandler extends AbstractHandler {
public void run() {
name.set(node.getPeer().getName());
- IPeerModel model = Model.getPeerModel();
+ IPeerModel model = ModelManager.getPeerModel();
Assert.isNotNull(model);
IPeerNode[] peers = model.getPeerNodes();
for (IPeerNode peer : peers) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/EditorSaveAsAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/EditorSaveAsAdapter.java
index 8b577cf08..3982e6517 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/EditorSaveAsAdapter.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/EditorSaveAsAdapter.java
@@ -35,7 +35,7 @@ import org.eclipse.tcf.te.tcf.core.peers.Peer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.dialogs.RenameDialog;
import org.eclipse.tcf.te.ui.views.ViewsUtil;
@@ -108,7 +108,7 @@ public class EditorSaveAsAdapter implements IEditorSaveAsAdapter {
@Override
protected void internalDone(Object caller, IStatus status) {
// Get the peer model node from the model and select it in the tree
- IPeerNode peerNode = Model.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID));
+ IPeerNode peerNode = ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID));
newPeer.set(peerNode);
if (peerNode != null) {
// Refresh the viewer
@@ -125,7 +125,7 @@ public class EditorSaveAsAdapter implements IEditorSaveAsAdapter {
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- IPeerModelRefreshService service = Model.getPeerModel().getService(IPeerModelRefreshService.class);
+ IPeerModelRefreshService service = ModelManager.getPeerModel().getService(IPeerModelRefreshService.class);
// Refresh the model now (must be executed within the TCF dispatch thread)
if (service != null) {
service.refresh(cb);
@@ -150,7 +150,7 @@ public class EditorSaveAsAdapter implements IEditorSaveAsAdapter {
@Override
public void run() {
// Get all peer model objects
- IPeerNode[] peers = Model.getPeerModel().getPeerNodes();
+ IPeerNode[] peers = ModelManager.getPeerModel().getPeerNodes();
// Loop them and find the ones which are of our handled types
for (IPeerNode peerNode : peers) {
String name = peerNode.getPeer().getName();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerNodeFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerNodeFactory.java
index 5bf7547d2..2b4d30bb5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerNodeFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerNodeFactory.java
@@ -19,7 +19,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelQueryService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.ui.views.editor.EditorInput;
import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IMemento;
@@ -43,7 +43,7 @@ public class PeerNodeFactory implements IElementFactory {
Runnable runnable = new Runnable() {
@Override
public void run() {
- node.set(Model.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId));
+ node.set(ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId));
}
};
@@ -60,8 +60,8 @@ public class PeerNodeFactory implements IElementFactory {
Runnable runnable2 = new Runnable() {
@Override
public void run() {
- Model.getPeerModel().getService(IPeerModelRefreshService.class).refresh(null);
- node.set(Model.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId));
+ ModelManager.getPeerModel().getService(IPeerModelRefreshService.class).refresh(null);
+ node.set(ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId));
}
};
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java
index 1310fc1cc..d3953e411 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java
@@ -30,7 +30,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
@@ -157,7 +157,7 @@ public class DefaultContextService extends AbstractService implements IDefaultCo
Runnable runnable = new Runnable() {
@Override
public void run() {
- IPeerModel model = Model.getPeerModel();
+ IPeerModel model = ModelManager.getPeerModel();
Assert.isNotNull(model);
peerNode.set(model.getService(IPeerModelLookupService.class).lkupPeerModelById(peerId));
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/UIService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/UIService.java
new file mode 100644
index 000000000..ed0d67163
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/UIService.java
@@ -0,0 +1,37 @@
+/**
+ * UIService.java
+ * Created on Feb 25, 2013
+ *
+ * Copyright (c) 2013 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.tcf.ui.internal.services;
+
+import org.eclipse.tcf.te.runtime.services.AbstractService;
+import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.tcf.ui.handler.EditorHandlerDelegate;
+import org.eclipse.tcf.te.ui.interfaces.handler.IEditorHandlerDelegate;
+
+/**
+ * UI service implementation.
+ */
+public class UIService extends AbstractService implements IUIService {
+ final IEditorHandlerDelegate editorHandlerDelegate = new EditorHandlerDelegate();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.services.interfaces.IUIService#getDelegate(java.lang.Object, java.lang.Class)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public <V> V getDelegate(Object context, Class<? extends V> clazz) {
+
+ if (IEditorHandlerDelegate.class.isAssignableFrom(clazz)) {
+ return (V) editorHandlerDelegate;
+ }
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProvider.java
index be1ba09b4..ef83fcc20 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProvider.java
@@ -26,13 +26,15 @@ import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
import org.eclipse.tcf.te.tcf.locator.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.locator.interfaces.IModelListener;
+import org.eclipse.tcf.te.tcf.locator.interfaces.ILocatorModelListener;
+import org.eclipse.tcf.te.tcf.locator.interfaces.IPeerModelListener;
+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.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerRedirector;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.ui.internal.preferences.IPreferenceKeys;
import org.eclipse.tcf.te.tcf.ui.navigator.nodes.PeerRedirectorGroupNode;
@@ -66,8 +68,10 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent
private final static String CURRENT_USER_FILTER_ID = "org.eclipse.tcf.te.tcf.ui.navigator.PeersByCurrentUserFilter"; //$NON-NLS-1$
+ // The peer model listener instance
+ /* default */ IPeerModelListener peerModelListener = null;
// The locator model listener instance
- /* default */ IModelListener modelListener = null;
+ /* default */ ILocatorModelListener locatorModelListener = null;
// Internal map of PeerRedirectorGroupNodes per peer id
private final Map<String, PeerRedirectorGroupNode> roots = new HashMap<String, PeerRedirectorGroupNode>();
@@ -119,9 +123,9 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent
/* default */ final boolean isFiltered(IPeerNode peerNode) {
Assert.isNotNull(peerNode);
- boolean filtered = isFiltered(peerNode.getPeer());
+ boolean filtered = false;
- if (!filtered && !showInvisible) {
+ if (!showInvisible) {
filtered |= !peerNode.isVisible();
}
@@ -171,12 +175,12 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent
// If the parent element is a category, than we assume
// the locator model as parent element.
if (parentElement instanceof ICategory) {
- parentElement = Model.getPeerModel();
+ parentElement = ModelManager.getPeerModel();
}
// If the parent element is the root element and "all"
// categories are hidden, assume the locator model as parent element
if (parentElement instanceof IRoot && allHidden) {
- parentElement = Model.getPeerModel();
+ parentElement = ModelManager.getPeerModel();
}
// If it is the locator model, get the peers
@@ -186,55 +190,45 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent
final List<Object> candidates = new ArrayList<Object>();
if (IUIConstants.ID_CAT_FAVORITES.equals(catID)) {
- for (IPeerNode peer : peerNodes) {
- ICategorizable categorizable = (ICategorizable)peer.getAdapter(ICategorizable.class);
+ for (IPeerNode peerNode : peerNodes) {
+ ICategorizable categorizable = (ICategorizable)peerNode.getAdapter(ICategorizable.class);
if (categorizable == null) {
- categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peer, ICategorizable.class);
+ categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peerNode, ICategorizable.class);
}
Assert.isNotNull(categorizable);
boolean isFavorite = Managers.getCategoryManager().belongsTo(catID, categorizable.getId());
- if (isFavorite && !candidates.contains(peer)) {
- candidates.add(peer);
+ if (isFavorite && !candidates.contains(peerNode)) {
+ candidates.add(peerNode);
}
}
}
else if (IUIConstants.ID_CAT_MY_TARGETS.equals(catID)) {
- for (IPeerNode peer : peerNodes) {
+ for (IPeerNode peerNode : peerNodes) {
// Check for filtered nodes (Value-add's and Proxies)
- if (isFiltered(peer)) {
+ if (isFiltered(peerNode)) {
continue;
}
- ICategorizable categorizable = (ICategorizable)peer.getAdapter(ICategorizable.class);
+ ICategorizable categorizable = (ICategorizable)peerNode.getAdapter(ICategorizable.class);
if (categorizable == null) {
- categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peer, ICategorizable.class);
+ categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peerNode, ICategorizable.class);
}
Assert.isNotNull(categorizable);
- // Static peers, or if launched by current user -> add automatically to "My Targets"
- boolean startedByCurrentUser = System.getProperty("user.name").equals(peer.getPeer().getUserName()); //$NON-NLS-1$
- if (!startedByCurrentUser) {
- // If the "Neighborhood" category is not visible, ignore the startedByCurrentUser flag
- if (neighborhoodCat != null && !neighborhoodCat.isEnabled()) {
- startedByCurrentUser = true;
- }
- }
-
boolean isMyTargets = Managers.getCategoryManager().belongsTo(catID, categorizable.getId());
- if (!isMyTargets && startedByCurrentUser) {
- // "Value-add's" are not saved to the category persistence automatically
+ if (!isMyTargets) {
Managers.getCategoryManager().addTransient(catID, categorizable.getId());
isMyTargets = true;
}
- if (isMyTargets && !candidates.contains(peer)) {
- candidates.add(peer);
+ if (isMyTargets && !candidates.contains(peerNode)) {
+ candidates.add(peerNode);
}
}
}
else if (IUIConstants.ID_CAT_NEIGHBORHOOD.equals(catID)) {
- for (IPeer peer : Model.getLocatorModel().getPeers()) {
+ for (IPeer peer : ModelManager.getLocatorModel().getPeers()) {
// Check for filtered nodes (Value-add's and Proxies)
if (isFiltered(peer)) {
continue;
@@ -246,28 +240,28 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent
}
}
else if (catID != null) {
- for (IPeerNode peer : peerNodes) {
- ICategorizable categorizable = (ICategorizable)peer.getAdapter(ICategorizable.class);
+ for (IPeerNode peerNode : peerNodes) {
+ ICategorizable categorizable = (ICategorizable)peerNode.getAdapter(ICategorizable.class);
if (categorizable == null) {
- categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peer, ICategorizable.class);
+ categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peerNode, ICategorizable.class);
}
Assert.isNotNull(categorizable);
- boolean belongsTo = category.belongsTo(peer);
- if (belongsTo && !candidates.contains(peer)) {
+ boolean belongsTo = category.belongsTo(peerNode);
+ if (belongsTo && !candidates.contains(peerNode)) {
Managers.getCategoryManager().addTransient(catID, categorizable.getId());
- candidates.add(peer);
+ candidates.add(peerNode);
}
}
}
else {
- for (IPeerNode peer : peerNodes) {
+ for (IPeerNode peerNode : peerNodes) {
// Check for filtered nodes (Value-add's and Proxies)
- if (isFiltered(peer)) {
+ if (isFiltered(peerNode)) {
continue;
}
- if (!candidates.contains(peer)) {
- candidates.add(peer);
+ if (!candidates.contains(peerNode)) {
+ candidates.add(peerNode);
}
}
}
@@ -320,7 +314,7 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent
final Runnable runnable = new Runnable() {
@Override
public void run() {
- parent.set(Model.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(((PeerRedirectorGroupNode)element).peerId));
+ parent.set(ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(((PeerRedirectorGroupNode)element).peerId));
}
};
@@ -408,16 +402,27 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent
*/
@Override
public void dispose() {
- if (modelListener != null) {
+ if (peerModelListener != null) {
Runnable runnable = new Runnable() {
@Override
public void run() {
- Model.getPeerModel().removeListener(modelListener);
+ ModelManager.getPeerModel().removeListener(peerModelListener);
}
};
if (Protocol.isDispatchThread()) runnable.run();
else Protocol.invokeAndWait(runnable);
- modelListener = null;
+ peerModelListener = null;
+ }
+ if (locatorModelListener != null) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ ModelManager.getLocatorModel().removeListener(locatorModelListener);
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ locatorModelListener = null;
}
roots.clear();
@@ -428,25 +433,36 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent
*/
@Override
public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) {
- final IPeerModel model = Model.getPeerModel();
+ final IPeerModel peerModel = ModelManager.getPeerModel();
+ final ILocatorModel locatorModel = ModelManager.getLocatorModel();
// Create and attach the model listener if not yet done
- if (modelListener == null && model != null && viewer instanceof CommonViewer) {
- modelListener = new ModelListener(model, (CommonViewer)viewer);
+ if (peerModelListener == null && peerModel != null && viewer instanceof CommonViewer) {
+ peerModelListener = new PeerModelListener(peerModel, (CommonViewer)viewer);
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ peerModel.addListener(peerModelListener);
+ }
+ });
+ }
+ // Create and attach the model listener if not yet done
+ if (locatorModelListener == null && locatorModel != null && viewer instanceof CommonViewer) {
+ locatorModelListener = new LocatorModelListener(locatorModel, (CommonViewer)viewer);
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- model.addListener(modelListener);
+ locatorModel.addListener(locatorModelListener);
}
});
}
- if (model != null && newInput instanceof IRoot) {
+ if (peerModel != null && newInput instanceof IRoot) {
// Refresh the model asynchronously
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- model.getService(IPeerModelRefreshService.class).refresh(null);
+ peerModel.getService(IPeerModelRefreshService.class).refresh(null);
}
});
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/LocatorModelListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/LocatorModelListener.java
new file mode 100644
index 000000000..7b9570112
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/LocatorModelListener.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.ui.navigator;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.te.tcf.locator.interfaces.ILocatorModelListener;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel;
+import org.eclipse.ui.navigator.CommonViewer;
+
+
+/**
+ * Locator model listener implementation.
+ */
+public class LocatorModelListener implements ILocatorModelListener {
+ private final ILocatorModel parentModel;
+ /* default */ final CommonViewer viewer;
+
+ /**
+ * Constructor.
+ *
+ * @param parent The parent locator model. Must not be <code>null</code>.
+ * @param viewer The common viewer instance. Must not be <code>null</code>.
+ */
+ public LocatorModelListener(ILocatorModel parent, CommonViewer viewer) {
+ Assert.isNotNull(parent);
+ Assert.isNotNull(viewer);
+
+ this.parentModel = parent;
+ this.viewer = viewer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.ILocatorModelListener#modelChanged(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel, org.eclipse.tcf.protocol.IPeer, boolean)
+ */
+ @Override
+ public void modelChanged(ILocatorModel model, IPeer peer, boolean added) {
+ if (parentModel.equals(model)) {
+ // Locator model changed -> refresh the tree
+ Tree tree = viewer.getTree();
+ if (tree != null && !tree.isDisposed()) {
+ Display display = tree.getDisplay();
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (viewer.getTree() != null && !viewer.getTree().isDisposed()) {
+ viewer.refresh();
+ }
+ }
+ });
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.ILocatorModelListener#modelDisposed(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel)
+ */
+ @Override
+ public void modelDisposed(ILocatorModel model) {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java
index 5da180b9b..9de72d744 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java
@@ -23,7 +23,7 @@ import org.eclipse.tcf.te.runtime.services.interfaces.delegates.ILabelProviderDe
import org.eclipse.tcf.te.runtime.utils.net.IPAddressUtil;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
import org.eclipse.tcf.te.tcf.ui.navigator.images.PeerImageDescriptor;
@@ -122,7 +122,7 @@ public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDe
Runnable runnable = new Runnable() {
@Override
public void run() {
- count.set(Model.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelByName(label).length);
+ count.set(ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelByName(label).length);
}
};
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ModelListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerModelListener.java
index 269bcc313..070d7d6a9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ModelListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerModelListener.java
@@ -14,7 +14,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IAdapterService;
-import org.eclipse.tcf.te.tcf.locator.interfaces.IModelListener;
+import org.eclipse.tcf.te.tcf.locator.interfaces.IPeerModelListener;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.listener.ModelAdapter;
@@ -29,19 +29,19 @@ import org.eclipse.ui.navigator.CommonViewer;
/**
- * TCF locator model listener implementation.
+ * Peer model listener implementation.
*/
-public class ModelListener extends ModelAdapter {
+public class PeerModelListener extends ModelAdapter {
private final IPeerModel parentModel;
/* default */ final CommonViewer viewer;
/**
* Constructor.
*
- * @param parent The parent locator model. Must not be <code>null</code>.
+ * @param parent The parent peer model. Must not be <code>null</code>.
* @param viewer The common viewer instance. Must not be <code>null</code>.
*/
- public ModelListener(IPeerModel parent, CommonViewer viewer) {
+ public PeerModelListener(IPeerModel parent, CommonViewer viewer) {
Assert.isNotNull(parent);
Assert.isNotNull(viewer);
@@ -50,10 +50,10 @@ public class ModelListener extends ModelAdapter {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.locator.listener.ModelAdapter#locatorModelChanged(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel, org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode, boolean)
+ * @see org.eclipse.tcf.te.tcf.locator.listener.ModelAdapter#modelChanged(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel, org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode, boolean)
*/
@Override
- public void locatorModelChanged(final IPeerModel model, final IPeerNode peerNode, final boolean added) {
+ public void modelChanged(final IPeerModel model, final IPeerNode peerNode, final boolean added) {
if (parentModel.equals(model)) {
// Locator model changed -> refresh the tree
Tree tree = viewer.getTree();
@@ -70,12 +70,12 @@ public class ModelListener extends ModelAdapter {
}
if (peerNode != null) {
- // Check if the peer model node can be adapted to IModelListener.
+ // Check if the peer model node can be adapted to IPeerModelListener.
IAdapterService service = ServiceManager.getInstance().getService(peerNode, IAdapterService.class);
- IModelListener listener = service != null ? service.getAdapter(peerNode, IModelListener.class) : null;
+ IPeerModelListener listener = service != null ? service.getAdapter(peerNode, IPeerModelListener.class) : null;
// If yes -> Invoke the adapted model listener instance
if (listener != null) {
- listener.locatorModelChanged(model, peerNode, added);
+ listener.modelChanged(model, peerNode, added);
}
// If no -> Default behavior for dynamic discovered peers is to close the editor (if any).
// For static peers, leave the editor untouched.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/dnd/CommonDnD.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/dnd/CommonDnD.java
index 5b631653a..056790fac 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/dnd/CommonDnD.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/dnd/CommonDnD.java
@@ -38,7 +38,7 @@ import org.eclipse.tcf.te.tcf.core.peers.Peer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.ui.views.Managers;
import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
import org.eclipse.tcf.te.ui.views.interfaces.IRoot;
@@ -178,7 +178,7 @@ public class CommonDnD {
final Object finalElement = elementToSelect;
final IPeer finalNewPeer = (elementToSelect instanceof IPeer) ? (IPeer)elementToSelect : null;
// Trigger a refresh of the model to read in the newly created static peer
- final IPeerModelRefreshService service = Model.getPeerModel().getService(IPeerModelRefreshService.class);
+ final IPeerModelRefreshService service = ModelManager.getPeerModel().getService(IPeerModelRefreshService.class);
if (service != null) {
Runnable runnable = new Runnable() {
@Override
@@ -188,7 +188,7 @@ public class CommonDnD {
protected void internalDone(Object caller, org.eclipse.core.runtime.IStatus status) {
IPeerNode peerNode = null;
if (finalNewPeer != null) {
- IPeerModelLookupService service = Model.getPeerModel().getService(IPeerModelLookupService.class);
+ IPeerModelLookupService service = ModelManager.getPeerModel().getService(IPeerModelLookupService.class);
if (service != null) {
peerNode = service.lkupPeerModelById(finalNewPeer.getID());
}
@@ -380,7 +380,7 @@ public class CommonDnD {
@Override
public void run() {
// Get all peer model objects
- IPeerNode[] peers = Model.getPeerModel().getPeerNodes();
+ IPeerNode[] peers = ModelManager.getPeerModel().getPeerNodes();
// Loop them and find the ones which are of our handled types
for (IPeerNode peerNode : peers) {
String name = peerNode.getPeer().getName();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java
index 31adead8a..0bf2c4960 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java
@@ -26,10 +26,10 @@ import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.persistence.PersistenceManager;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.tcf.locator.interfaces.IModelListener;
+import org.eclipse.tcf.te.tcf.locator.interfaces.IPeerModelListener;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
@@ -44,13 +44,13 @@ public abstract class AbstractContextSelectorSection extends org.eclipse.tcf.te.
private boolean disposed = false;
- final IModelListener modelListener = new IModelListener() {
+ final IPeerModelListener modelListener = new IPeerModelListener() {
@Override
- public void locatorModelDisposed(IPeerModel model) {
+ public void modelDisposed(IPeerModel model) {
refreshSelectorControl();
}
@Override
- public void locatorModelChanged(IPeerModel model, IPeerNode peerNode, boolean added) {
+ public void modelChanged(final IPeerModel model, final IPeerNode peerNode, final boolean added) {
refreshSelectorControl();
}
};
@@ -103,7 +103,7 @@ public abstract class AbstractContextSelectorSection extends org.eclipse.tcf.te.
Protocol.invokeAndWait(new Runnable() {
@Override
public void run() {
- Model.getPeerModel().removeListener(modelListener);
+ ModelManager.getPeerModel().removeListener(modelListener);
}
});
}
@@ -117,7 +117,7 @@ public abstract class AbstractContextSelectorSection extends org.eclipse.tcf.te.
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- Model.getPeerModel().addListener(modelListener);
+ ModelManager.getPeerModel().addListener(modelListener);
}
});
EventManager.getInstance().addEventListener(eventListener, ChangeEvent.class);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java
index fdfdc6a79..bcc6713f9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java
@@ -11,14 +11,10 @@ package org.eclipse.tcf.te.tcf.ui.sections;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -45,7 +41,6 @@ import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
import org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage;
-import org.eclipse.tcf.te.ui.views.navigator.ViewerSorter;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
@@ -164,34 +159,6 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID
protected boolean supportsMultiSelection() {
return false;
}
- @Override
- protected void configureTableViewer(TableViewer viewer) {
- viewer.addFilter(new ViewerFilter() {
- @Override
- public boolean select(Viewer viewer, Object parentElement, final Object element) {
- if (element instanceof IPeer) {
- final IPeer peer = (IPeer)element;
- final AtomicBoolean isValueAdd = new AtomicBoolean();
- final AtomicBoolean isCLI = new AtomicBoolean();
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- String value = peer.getAttributes().get("ValueAdd"); //$NON-NLS-1$
- isValueAdd.set(value != null && ("1".equals(value.trim()) || Boolean.parseBoolean(value.trim()))); //$NON-NLS-1$
- isCLI.set(peer.getName() != null
- && (peer.getName().startsWith("Eclipse CLI") //$NON-NLS-1$
- || peer.getName().startsWith("Eclipse Command Server") //$NON-NLS-1$
- || peer.getName().endsWith("CLI Server") //$NON-NLS-1$
- || peer.getName().endsWith("CLI Client"))); //$NON-NLS-1$
- }
- });
- return !isValueAdd.get() && !isCLI.get();
- }
- return false;
- }
- });
- viewer.setSorter(new ViewerSorter());
- }
};
// Open the dialog
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 b4adf44f4..378d4ab75 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
@@ -36,7 +36,7 @@ import org.eclipse.tcf.te.tcf.core.peers.Peer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.tcf.ui.wizards.pages.NewTargetWizardPage;
import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
@@ -128,13 +128,13 @@ public class NewTargetWizard extends AbstractWizard implements INewWizard {
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- IPeerModelRefreshService service = Model.getPeerModel().getService(IPeerModelRefreshService.class);
+ IPeerModelRefreshService service = ModelManager.getPeerModel().getService(IPeerModelRefreshService.class);
// Refresh the model now (must be executed within the TCF dispatch thread)
if (service != null) service.refresh(new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
// Get the peer model node from the model and select it in the tree
- final IPeerNode peerNode = Model.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID));
+ final IPeerNode peerNode = ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID));
if (peerNode != null) {
// Refresh the viewer
ViewsUtil.refresh(IUIConstants.ID_EXPLORER);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java
index df2ce0236..7be4de044 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/AbstractConfigWizardPage.java
@@ -28,7 +28,7 @@ import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.controls.PeerNameControl;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.controls.validator.RegexValidator;
@@ -310,7 +310,7 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i
@Override
public void run() {
// Get all peer model objects
- IPeerNode[] peers = Model.getPeerModel().getPeerNodes();
+ IPeerNode[] peers = ModelManager.getPeerModel().getPeerNodes();
// Loop them and find the ones which are of our handled types
for (IPeerNode peerNode : peers) {
String name = peerNode.getPeer().getName();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
index ea2308879..dde95c4bb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
@@ -29,7 +29,7 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.tcf.core.interfaces.ITransportTypes;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.controls.CustomTransportPanel;
import org.eclipse.tcf.te.tcf.ui.controls.PeerAttributesTablePart;
import org.eclipse.tcf.te.tcf.ui.controls.PeerNameControl;
@@ -454,7 +454,7 @@ public class NewTargetWizardPage extends AbstractValidatingWizardPage implements
@Override
public void run() {
// Get all peer model objects
- IPeerNode[] peers = Model.getPeerModel().getPeerNodes();
+ IPeerNode[] peers = ModelManager.getPeerModel().getPeerNodes();
// Loop them and find the ones which are of our handled types
for (IPeerNode peerNode : peers) {
String name = peerNode.getPeer().getName();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java
index 21d53115b..3f23063c5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java
@@ -53,7 +53,7 @@ import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.tcf.core.interfaces.IExportPersistenceService;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider;
import org.eclipse.ui.progress.UIJob;
@@ -167,7 +167,7 @@ public class PeerExportWizardPage extends WizardPage {
}
};
fViewer.addCheckStateListener(checkListener);
- fViewer.setInput(Model.getPeerModel());
+ fViewer.setInput(ModelManager.getPeerModel());
// top level group
Composite buttonComposite = new Composite(resourcesGroup, SWT.NONE);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerImportWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerImportWizardPage.java
index e4dfdfc6b..94cec5bf7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerImportWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerImportWizardPage.java
@@ -60,7 +60,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider;
import org.eclipse.ui.progress.UIJob;
@@ -336,7 +336,7 @@ public class PeerImportWizardPage extends WizardPage {
UIJob importjob = new UIJob(getContainer().getShell().getDisplay(), Messages.PeerImportWizard_title) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- final IPeerModel model = Model.getPeerModel();
+ final IPeerModel model = ModelManager.getPeerModel();
final IProgressMonitor finalMonitor;
if (monitor == null) {
finalMonitor = new NullProgressMonitor();

Back to the top