diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui')
26 files changed, 56 insertions, 661 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 48be9247c..4f6e2bda3 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 @@ -207,7 +207,7 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA Runnable runnable = new Runnable() { @Override public void run() { - IPeerModel model = Model.getModel(); + IPeerModel model = Model.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 2384a51e3..e7a3ae1f7 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 @@ -104,18 +104,7 @@ public class UIPlugin extends AbstractUIPlugin { if (proceedShutdown || forced) { // Terminate the scanner - final IPeerModel model = Model.getModel(true); - if (model != null) { - Runnable runnable = new Runnable() { - @Override - public void run() { - model.getScanner().terminate(); - } - }; - - Assert.isTrue(!Protocol.isDispatchThread()); - Protocol.invokeAndWait(runnable); - } + final IPeerModel model = Model.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 85fad0345..d68aa1a31 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 @@ -45,7 +45,7 @@ public class ContextSelectorSectionControl extends AbstractContextSelectorContro */ @Override protected Object getInitialViewerInput() { - return Model.getModel(); + return Model.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 aca1888fc..9f210081c 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 @@ -254,7 +254,7 @@ public class PeerSelectionDialog extends CustomTitleAreaDialog { * @return The locator model instance. */ protected IPeerModel getModel() { - return Model.getModel(); + return Model.getPeerModel(); } /** diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java index 6b368f08c..629927df1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java @@ -16,14 +16,12 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Composite; import org.eclipse.tcf.protocol.Protocol; -import org.eclipse.tcf.te.core.interfaces.IConnectable; import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.runtime.services.interfaces.ISimulatorService; 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.ui.help.IContextHelpIds; import org.eclipse.tcf.te.tcf.ui.nls.Messages; import org.eclipse.tcf.te.tcf.ui.sections.SimulatorTypeSelectionSection; @@ -148,15 +146,8 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm // Save the peer node to the new persistence storage uRIPersistenceService.write(((IPeerNode)input).getPeer(), null); - // In case the node had been dynamically discovered before, we have to trigger a refresh - // to the locator model to read in the newly created static peer - if (((IPeerNode)input).getConnectState() == IConnectable.STATE_CONNECTED) { - // Refresh the static peers - ((IPeerNode)input).getModel().getService(IPeerModelRefreshService.class).refreshStaticPeers(); - - // Reopen the editor on the current page - ViewsUtil.reopenEditor(getEditor(), getEditor().getActivePageInstance().getId(), false); - } + // Reopen the editor on the current page + ViewsUtil.reopenEditor(getEditor(), getEditor().getActivePageInstance().getId(), false); } catch (IOException e) { // Build up the message template String template = NLS.bind(Messages.AbstractConfigurationEditorPage_error_save, ((IPeerNode)input).getName(), Messages.AbstractConfigurationEditorPage_error_possibleCause); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java index d614abe14..61d4c4076 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java @@ -23,7 +23,6 @@ import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil; import org.eclipse.tcf.te.runtime.utils.StatusHelper; -import org.eclipse.tcf.te.tcf.locator.ScannerRunnable; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin; import org.eclipse.tcf.te.tcf.ui.editor.sections.AttributesSection; @@ -35,7 +34,6 @@ import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts; import org.eclipse.tcf.te.tcf.ui.nls.Messages; import org.eclipse.tcf.te.ui.forms.CustomFormToolkit; import org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage; -import org.eclipse.ui.IEditorInput; import org.eclipse.ui.forms.widgets.TableWrapData; import org.eclipse.ui.forms.widgets.TableWrapLayout; @@ -165,36 +163,6 @@ public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage { } /* (non-Javadoc) - * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#setInput(org.eclipse.ui.IEditorInput) - */ - @Override - protected void setInput(IEditorInput input) { - IEditorInput oldInput = getEditorInput(); - // do nothing when input did not change - if (oldInput != null && oldInput.equals(input)) { - return; - } - super.setInput(input); - if (getEditorInputNode() instanceof IPeerNode) { - // Invoke the scanner runnable - ScannerRunnable runnable = new ScannerRunnable(null, ((IPeerNode)getEditorInputNode())); - Protocol.invokeLater(runnable); - } - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#setInputWithNotify(org.eclipse.ui.IEditorInput) - */ - @Override - protected void setInputWithNotify(IEditorInput input) { - super.setInputWithNotify(input); - if (getEditorInputNode() instanceof IPeerNode) { - ScannerRunnable runnable = new ScannerRunnable(null, ((IPeerNode)getEditorInputNode())); - Protocol.invokeLater(runnable); - } - } - - /* (non-Javadoc) * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#postDoSave(org.eclipse.core.runtime.IProgressMonitor) */ @Override @@ -231,10 +199,6 @@ public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage { ((IPeerNode)input).fireChangeEvent("properties", null, ((IPeerNode)input).getProperties()); //$NON-NLS-1$ } }); - - // Force a scan of the peer - ScannerRunnable runnable2 = new ScannerRunnable(null, ((IPeerNode)input)); - Protocol.invokeLater(runnable2); } } } 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 fef9eca27..fc92ccb17 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 @@ -456,7 +456,7 @@ public class GeneralInformationSection extends AbstractSection { @Override public void run() { // Get all peer model objects - IPeerNode[] peers = Model.getModel().getPeerNodes(); + IPeerNode[] peers = Model.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/editor/sections/ServicesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/ServicesSection.java index 3f2296a93..9811ed6cf 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/ServicesSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/ServicesSection.java @@ -9,8 +9,6 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.ui.editor.sections; -import java.util.concurrent.atomic.AtomicBoolean; - import org.eclipse.core.runtime.Assert; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -23,10 +21,8 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; 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.IPeerModelQueryService; import org.eclipse.tcf.te.tcf.ui.nls.Messages; import org.eclipse.tcf.te.ui.forms.parts.AbstractSection; -import org.eclipse.tcf.te.ui.swt.DisplayUtil; import org.eclipse.tcf.te.ui.swt.SWTControlUtil; import org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage; import org.eclipse.ui.forms.IManagedForm; @@ -125,9 +121,6 @@ public class ServicesSection extends AbstractSection { } } - // Flag to mark that the services query had been done for the current peer model node - private boolean servicesQueryTriggered = false; - /** * Initialize the page widgets based of the data from the given peer node. * <p> @@ -137,8 +130,6 @@ public class ServicesSection extends AbstractSection { * @param node The peer node or <code>null</code>. */ public void setupData(final IPeerNode node) { - // Reset the services query triggered flag if we setup for a new peer model node - if (od != node) servicesQueryTriggered = false; // Besides the node itself, we need to look at the node data to determine // if the widgets needs to be updated. For the comparisation, keep the @@ -164,82 +155,19 @@ public class ServicesSection extends AbstractSection { } }); - boolean forceQuery = false; - - // If the original data copy does not match the previous original - // data copy, the services needs to be queried again. - if (!previousOdc.getProperties().equals(odc.getProperties())) { - servicesQueryTriggered = false; - forceQuery = true; - } - // Create the UI runnable - final AtomicBoolean fireRefreshTabs = new AtomicBoolean(); - final Runnable uiRunnable = new Runnable() { - - @Override - public void run() { - boolean fireNotification = fireRefreshTabs.get(); - - String value = odc.getStringProperty(IPeerNodeProperties.PROP_LOCAL_SERVICES); - fireNotification |= value != null && !value.equals(SWTControlUtil.getText(local)); - SWTControlUtil.setText(local, value != null ? value : ""); //$NON-NLS-1$ - value = odc.getStringProperty(IPeerNodeProperties.PROP_REMOTE_SERVICES); - fireNotification |= value != null && !value.equals(SWTControlUtil.getText(remote)); - SWTControlUtil.setText(remote, value != null ? value : ""); //$NON-NLS-1$ - - if (fireNotification) { - // Fire a change event to trigger the editor refresh - od.fireChangeEvent("editor.refreshTab", Boolean.FALSE, Boolean.TRUE); //$NON-NLS-1$ - } - } - }; - - // If not yet triggered or if forced, run the service query - if (!servicesQueryTriggered) { - // Mark the services query as triggered - servicesQueryTriggered = true; - - final boolean finForceQuery = forceQuery; - - Runnable runnable = new Runnable() { - - @Override - public void run() { - // Check if we have to run the query at all - boolean doQuery = finForceQuery || - (!node.containsKey(IPeerNodeProperties.PROP_REMOTE_SERVICES) - && !node.containsKey(IPeerNodeProperties.PROP_LOCAL_SERVICES)); - - if (doQuery) { - IPeerModelQueryService service = node.getModel().getService(IPeerModelQueryService.class); - if (service != null) { - service.queryServicesAsync(node, new IPeerModelQueryService.DoneQueryServices() { - @Override - public void doneQueryServices(Throwable error) { - // Copy over the service properties - odc.setProperty(IPeerNodeProperties.PROP_REMOTE_SERVICES, node.getProperty(IPeerNodeProperties.PROP_REMOTE_SERVICES)); - odc.setProperty(IPeerNodeProperties.PROP_LOCAL_SERVICES, node.getProperty(IPeerNodeProperties.PROP_LOCAL_SERVICES)); - - // Setup the data within the UI controls and fire the change notification - fireRefreshTabs.set(true); - DisplayUtil.safeAsyncExec(uiRunnable); - } - }); - } - } else { - // Copy over the properties - odc.setProperties(node.getProperties()); - // Setup the data within the UI controls - DisplayUtil.safeAsyncExec(uiRunnable); - } - } - }; - - Protocol.invokeLater(runnable); - } else { - // Setup the data within the UI controls - uiRunnable.run(); + boolean fireNotification = false; + + String value = odc.getStringProperty(IPeerNodeProperties.PROP_LOCAL_SERVICES); + fireNotification |= value != null && !value.equals(SWTControlUtil.getText(local)); + SWTControlUtil.setText(local, value != null ? value : ""); //$NON-NLS-1$ + value = odc.getStringProperty(IPeerNodeProperties.PROP_REMOTE_SERVICES); + fireNotification |= value != null && !value.equals(SWTControlUtil.getText(remote)); + SWTControlUtil.setText(remote, value != null ? value : ""); //$NON-NLS-1$ + + if (fireNotification) { + // Fire a change event to trigger the editor refresh + od.fireChangeEvent("editor.refreshTab", Boolean.FALSE, Boolean.TRUE); //$NON-NLS-1$ } } } 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 d85fa1d91..3f5483c9c 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 @@ -269,7 +269,7 @@ public class DeleteHandler extends AbstractHandler { Protocol.invokeLater(new Runnable() { @Override public void run() { - IPeerModelRefreshService service = Model.getModel().getService(IPeerModelRefreshService.class); + IPeerModelRefreshService service = Model.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/RedirectHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RedirectHandler.java deleted file mode 100644 index f46a4ab54..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RedirectHandler.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * 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.ui.handler; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.Assert; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -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.osgi.util.NLS; -import org.eclipse.tcf.protocol.Protocol; -import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; -import org.eclipse.tcf.te.runtime.services.ServiceManager; -import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil; -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.interfaces.services.IPeerModelRefreshService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelUpdateService; -import org.eclipse.tcf.te.tcf.locator.model.Model; -import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector; -import org.eclipse.tcf.te.tcf.ui.dialogs.RedirectPeerSelectionDialog; -import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds; -import org.eclipse.tcf.te.tcf.ui.nls.Messages; -import org.eclipse.tcf.te.ui.swt.DisplayUtil; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.handlers.HandlerUtil; -import org.eclipse.ui.navigator.CommonNavigator; - -/** - * Redirect peer command handler implementation. - */ -public class RedirectHandler extends AbstractHandler { - - /* (non-Javadoc) - * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) - */ - @Override - public Object execute(final ExecutionEvent event) throws ExecutionException { - // Determine the peer selected in Target Explorer tree - ISelection selection = HandlerUtil.getCurrentSelection(event); - if (selection instanceof IStructuredSelection && !selection.isEmpty()) { - // Redirect is supporting single selection only - Object candidate = ((IStructuredSelection)selection).getFirstElement(); - if (candidate instanceof IPeerNode) { - final IPeerNode peerNode = (IPeerNode)candidate; - - // Create the agent selection dialog - RedirectPeerSelectionDialog dialog = new RedirectPeerSelectionDialog(HandlerUtil.getActiveShell(event), null) { - @Override - protected void configureTableViewer(TableViewer viewer) { - Assert.isNotNull(viewer); - - List<ViewerFilter> filter = new ArrayList<ViewerFilter>(); - if (viewer.getFilters() != null && viewer.getFilters().length > 0) { - filter.addAll(Arrays.asList(viewer.getFilters())); - } - - filter.add(new ViewerFilter() { - @Override - public boolean select(Viewer viewer, Object parentElement, Object element) { - if (peerNode.equals(element)) { - return false; - } - return true; - } - }); - - viewer.setFilters(filter.toArray(new ViewerFilter[filter.size()])); - } - }; - - // Open the dialog - if (dialog.open() == Window.OK) { - // Get the selected proxy from the dialog - selection = dialog.getSelection(); - if (selection instanceof IStructuredSelection && !selection.isEmpty()) { - candidate = ((IStructuredSelection)selection).getFirstElement(); - if (candidate instanceof IPeerNode) { - final IPeerNode proxy = (IPeerNode)candidate; - - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - redirect(peerNode, proxy); - - DisplayUtil.safeAsyncExec(new Runnable() { - @Override - public void run() { - IWorkbenchPart part = HandlerUtil.getActivePart(event); - if (part instanceof CommonNavigator) { - CommonNavigator navigator = (CommonNavigator)part; - navigator.selectReveal(new StructuredSelection(peerNode)); - } - } - }); - } - }); - } - } - } - } - } - - - return null; - } - - /** - * Redirect the communication to the given peer through the given proxy. - * <p> - * The method must be called from within the TCF dispatch thread. - * - * @param peerNode The peer to redirect. Must not be <code>null</code>. - * @param proxy The proxy. Must not be <code>null</code> - */ - public void redirect(IPeerNode peerNode, IPeerNode proxy) { - Assert.isNotNull(peerNode); - Assert.isNotNull(proxy); - Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ - - // Get the peer attributes - Map<String, String> attributes = new HashMap<String, String>(); - attributes.putAll(peerNode.getPeer().getAttributes()); - // Set the redirection - attributes.put(IPeerNodeProperties.PROP_REDIRECT_PROXY, proxy.getPeerId()); - - try { - IURIPersistenceService uRIPersistenceService = ServiceManager.getInstance().getService(IURIPersistenceService.class); - if (uRIPersistenceService == null) { - throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$ - } - uRIPersistenceService.write(new Peer(attributes), null); - - // Create a peer redirector - PeerRedirector redirector = new PeerRedirector(proxy.getPeer(), attributes); - // And update the instance - peerNode.setProperty(IPeerNodeProperties.PROP_INSTANCE, redirector); - - // Associate proxy (parent) and peer model (child) - peerNode.setParent(proxy); - Model.getModel().getService(IPeerModelUpdateService.class).addChild(peerNode); - - // Trigger a refresh of the locator model in a later dispatch cycle - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - Model.getModel().getService(IPeerModelRefreshService.class).refresh(null); - } - }); - } catch (IOException e) { - String template = NLS.bind(Messages.RedirectHandler_error_redirectFailed, Messages.PossibleCause); - StatusHandlerUtil.handleStatus(StatusHelper.getStatus(e), peerNode, template, - Messages.RedirectHandler_error_title, IContextHelpIds.MESSAGE_REDIRECT_FAILED, this, null); - } - } -} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java index bbc12e44a..fd01beb65 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java @@ -26,7 +26,6 @@ import org.eclipse.tcf.te.runtime.callback.AsyncCallbackCollector; import org.eclipse.tcf.te.runtime.callback.Callback; import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; import org.eclipse.tcf.te.tcf.core.async.CallbackInvocationDelegate; -import org.eclipse.tcf.te.tcf.locator.ScannerRunnable; 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.IPeerModelRefreshService; @@ -115,20 +114,6 @@ public class RefreshHandler extends AbstractHandler { Protocol.invokeLater(runnable); } - for (IPeerNode model : peerToRefresh) { - final IPeerNode finModel = model; - final ICallback innerCallback = new AsyncCallbackCollector.SimpleCollectorCallback(collector); - - Runnable runnable = new Runnable() { - @Override - public void run() { - new ScannerRunnable(null, finModel).run(); - innerCallback.done(this, Status.OK_STATUS); - } - }; - Protocol.invokeLater(runnable); - } - // Mark the collector as fully initialized collector.initDone(); } else { 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 af5804276..e7b34928d 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 @@ -174,7 +174,7 @@ public class RenameHandler extends AbstractHandler { Protocol.invokeLater(new Runnable() { @Override public void run() { - final IPeerModelRefreshService service = Model.getModel().getService(IPeerModelRefreshService.class); + final IPeerModelRefreshService service = Model.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.getModel(); + IPeerModel model = Model.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/handler/ResetRedirectHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ResetRedirectHandler.java deleted file mode 100644 index c1229abf8..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ResetRedirectHandler.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * 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.ui.handler; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.Assert; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.osgi.util.NLS; -import org.eclipse.tcf.protocol.IPeer; -import org.eclipse.tcf.protocol.Protocol; -import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; -import org.eclipse.tcf.te.runtime.services.ServiceManager; -import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil; -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.interfaces.services.IPeerModelRefreshService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelUpdateService; -import org.eclipse.tcf.te.tcf.locator.model.Model; -import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds; -import org.eclipse.tcf.te.tcf.ui.nls.Messages; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Reset peer redirection command handler. - */ -public class ResetRedirectHandler extends AbstractHandler { - - /* (non-Javadoc) - * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - // Determine the peer selected in Target Explorer tree - ISelection selection = HandlerUtil.getCurrentSelection(event); - if (selection instanceof IStructuredSelection && !selection.isEmpty()) { - // Redirect is supporting single selection only - Object candidate = ((IStructuredSelection)selection).getFirstElement(); - if (candidate instanceof IPeerNode) { - final IPeerNode peerNode = (IPeerNode)candidate; - - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - resetRedirect(peerNode); - } - }); - } - } - - return null; - } - - /** - * Reset the communication redirection for the given peer. - * <p> - * The method must be called from within the TCF dispatch thread. - * - * @param peerNode The peer to reset. Must not be <code>null</code>. - */ - public void resetRedirect(IPeerNode peerNode) { - Assert.isNotNull(peerNode); - Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ - - // Get the peer attributes - Map<String, String> attributes = new HashMap<String, String>(); - attributes.putAll(peerNode.getPeer().getAttributes()); - // Redirection set? - if (attributes.get(IPeerNodeProperties.PROP_REDIRECT_PROXY) != null) { - // Remove the redirection - attributes.remove(IPeerNodeProperties.PROP_REDIRECT_PROXY); - - try { - // Save it - IURIPersistenceService uRIPersistenceService = ServiceManager.getInstance().getService(IURIPersistenceService.class); - if (uRIPersistenceService == null) { - throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$ - } - // Create a peer - IPeer peer = new Peer(attributes); - uRIPersistenceService.write(peer, null); - - // And update the instance - peerNode.setProperty(IPeerNodeProperties.PROP_INSTANCE, peer); - - // Reset proxy (parent) and peer model (child) association - Model.getModel().getService(IPeerModelUpdateService.class).removeChild(peerNode); - peerNode.setParent(null); - - // Trigger a refresh of the locator model in a later dispatch cycle - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - Model.getModel().getService(IPeerModelRefreshService.class).refresh(null); - } - }); - } catch (IOException e) { - String template = NLS.bind(Messages.ResetRedirectHandler_error_resetRedirectFailed, Messages.PossibleCause); - StatusHandlerUtil.handleStatus(StatusHelper.getStatus(e), peerNode, template, - Messages.ResetRedirectHandler_error_title, IContextHelpIds.MESSAGE_RESET_REDIRECT_FAILED, this, null); - } - } - } -} 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 385b24a0a..8b577cf08 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 @@ -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.getModel().getService(IPeerModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID)); + IPeerNode peerNode = Model.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.getModel().getService(IPeerModelRefreshService.class); + IPeerModelRefreshService service = Model.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.getModel().getPeerNodes(); + IPeerNode[] peers = Model.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 6275b7643..5bf7547d2 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 @@ -43,7 +43,7 @@ public class PeerNodeFactory implements IElementFactory { Runnable runnable = new Runnable() { @Override public void run() { - node.set(Model.getModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId)); + node.set(Model.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId)); } }; @@ -60,8 +60,8 @@ public class PeerNodeFactory implements IElementFactory { Runnable runnable2 = new Runnable() { @Override public void run() { - Model.getModel().getService(IPeerModelRefreshService.class).refresh(null); - node.set(Model.getModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId)); + Model.getPeerModel().getService(IPeerModelRefreshService.class).refresh(null); + node.set(Model.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 159847634..1310fc1cc 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 @@ -157,7 +157,7 @@ public class DefaultContextService extends AbstractService implements IDefaultCo Runnable runnable = new Runnable() { @Override public void run() { - IPeerModel model = Model.getModel(); + IPeerModel model = Model.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/navigator/ContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProvider.java index ac6414ab4..be1ba09b4 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 @@ -25,12 +25,10 @@ import org.eclipse.jface.viewers.ViewerFilter; 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.ScannerRunnable; 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.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.nodes.IPeerRedirector; import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService; import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService; @@ -70,8 +68,6 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent // The locator model listener instance /* default */ IModelListener modelListener = null; - // The tree view listener instance - /* default */ TreeViewerListener treeViewerListener = null; // Internal map of PeerRedirectorGroupNodes per peer id private final Map<String, PeerRedirectorGroupNode> roots = new HashMap<String, PeerRedirectorGroupNode>(); @@ -175,12 +171,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.getModel(); + parentElement = Model.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.getModel(); + parentElement = Model.getPeerModel(); } // If it is the locator model, get the peers @@ -238,32 +234,16 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent } } else if (IUIConstants.ID_CAT_NEIGHBORHOOD.equals(catID)) { -// 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()])); -// } -// } -// }); -// -// for (IPeer peer : peers.get()) { -// // Check for filtered nodes (Value-add's and Proxies) -// if (isFiltered(peer)) { -// continue; -// } -// -// -// if (!candidates.contains(peer)) { -// candidates.add(peer); -// } -// } + for (IPeer peer : Model.getLocatorModel().getPeers()) { + // Check for filtered nodes (Value-add's and Proxies) + if (isFiltered(peer)) { + continue; + } + + if (!candidates.contains(peer)) { + candidates.add(peer); + } + } } else if (catID != null) { for (IPeerNode peer : peerNodes) { @@ -294,43 +274,6 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent children = candidates.toArray(new Object[candidates.size()]); } - // If it is a peer model itself, get the child peers - else if (parentElement instanceof IPeerNode) { - String parentPeerId = ((IPeerNode)parentElement).getPeerId(); - List<IPeerNode> candidates = Model.getModel().getChildren(parentPeerId); - if (candidates != null && candidates.size() > 0) { - PeerRedirectorGroupNode rootNode = roots.get(parentPeerId); - if (rootNode == null) { - rootNode = new PeerRedirectorGroupNode(parentPeerId); - roots.put(parentPeerId, rootNode); - } - children = new Object[] { rootNode }; - } else { - roots.remove(parentPeerId); - } - } - // If it is a remote peer discover root node, return the children - // for the associated peer id. - else if (parentElement instanceof PeerRedirectorGroupNode) { - List<IPeerNode> candidates = Model.getModel().getChildren(((PeerRedirectorGroupNode)parentElement).peerId); - if (candidates != null && candidates.size() > 0) { - // Mark all candidates to be included in the scan process and - // schedule an scan asynchronously - for (final IPeerNode candidate: candidates) { - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - candidate.setProperty(IPeerNodeProperties.PROP_SCANNER_EXCLUDE, false); - - ScannerRunnable runnable = new ScannerRunnable(null, candidate); - runnable.run(); - } - }); - } - - children = candidates.toArray(); - } - } return children; } @@ -377,7 +320,7 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent final Runnable runnable = new Runnable() { @Override public void run() { - parent.set(Model.getModel().getService(IPeerModelLookupService.class).lkupPeerModelById(((PeerRedirectorGroupNode)element).peerId)); + parent.set(Model.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(((PeerRedirectorGroupNode)element).peerId)); } }; @@ -469,7 +412,7 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent Runnable runnable = new Runnable() { @Override public void run() { - Model.getModel().removeListener(modelListener); + Model.getPeerModel().removeListener(modelListener); } }; if (Protocol.isDispatchThread()) runnable.run(); @@ -477,11 +420,6 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent modelListener = null; } - if (treeViewerListener != null) { - treeViewerListener.dispose(); - treeViewerListener = null; - } - roots.clear(); } @@ -490,7 +428,7 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent */ @Override public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) { - final IPeerModel model = Model.getModel(); + final IPeerModel model = Model.getPeerModel(); // Create and attach the model listener if not yet done if (modelListener == null && model != null && viewer instanceof CommonViewer) { @@ -503,13 +441,6 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent }); } - // Create and attach the tree listener if not yet done - if (treeViewerListener == null && viewer instanceof CommonViewer) { - CommonViewer v = (CommonViewer)viewer; - treeViewerListener = new TreeViewerListener(v); - v.addTreeListener(treeViewerListener); - } - if (model != null && newInput instanceof IRoot) { // Refresh the model asynchronously Protocol.invokeLater(new Runnable() { 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 bac4216d5..5da180b9b 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 @@ -122,7 +122,7 @@ public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDe Runnable runnable = new Runnable() { @Override public void run() { - count.set(Model.getModel().getService(IPeerModelLookupService.class).lkupPeerModelByName(label).length); + count.set(Model.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/TreeViewerListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/TreeViewerListener.java deleted file mode 100644 index e9de64f33..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/TreeViewerListener.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jface.viewers.ITreeViewerListener; -import org.eclipse.jface.viewers.TreeExpansionEvent; -import org.eclipse.tcf.protocol.Protocol; -import org.eclipse.tcf.te.runtime.interfaces.IDisposable; -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.ui.navigator.nodes.PeerRedirectorGroupNode; -import org.eclipse.ui.navigator.CommonViewer; - -/** - * Tree viewer listener implementation. - */ -public class TreeViewerListener implements ITreeViewerListener, IDisposable { - private final CommonViewer viewer; - - /** - * Constructor - * - * @param viewer The common viewer instance. Must not be <code>null</code>. - */ - public TreeViewerListener(CommonViewer viewer) { - Assert.isNotNull(viewer); - this.viewer = viewer; - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose() - */ - @Override - public void dispose() { - viewer.removeTreeListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeViewerListener#treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent) - */ - @Override - public void treeCollapsed(TreeExpansionEvent event) { - if (event.getElement() instanceof PeerRedirectorGroupNode) { - final List<IPeerNode> candidates = Model.getModel().getChildren(((PeerRedirectorGroupNode)event.getElement()).peerId); - if (candidates != null && candidates.size() > 0) { - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - // Mark all candidates to be excluded from the scan process - for (final IPeerNode candidate: candidates) { - markExcluded(candidate); - } - } - }); - } - } - } - - /** - * Mark the given peer model node and it's child nodes to be excluded from the scanner. - * - * @param peerNode The peer model node. Must not be <code>null</code>. - */ - /* default */ void markExcluded(IPeerNode peerNode) { - Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ - Assert.isNotNull(peerNode); - - peerNode.setProperty(IPeerNodeProperties.PROP_SCANNER_EXCLUDE, true); - - List<IPeerNode> candidates = Model.getModel().getChildren(peerNode.getPeerId()); - if (candidates != null && candidates.size() > 0) { - for (final IPeerNode candidate: candidates) { - markExcluded(candidate); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeViewerListener#treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent) - */ - @Override - public void treeExpanded(TreeExpansionEvent event) { - } - -} 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 3ff41dd16..5b631653a 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 @@ -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.getModel().getService(IPeerModelRefreshService.class); + final IPeerModelRefreshService service = Model.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.getModel().getService(IPeerModelLookupService.class); + IPeerModelLookupService service = Model.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.getModel().getPeerNodes(); + IPeerNode[] peers = Model.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 95712e6a2..31adead8a 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 @@ -103,7 +103,7 @@ public abstract class AbstractContextSelectorSection extends org.eclipse.tcf.te. Protocol.invokeAndWait(new Runnable() { @Override public void run() { - Model.getModel().removeListener(modelListener); + Model.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.getModel().addListener(modelListener); + Model.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/wizards/NewTargetWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/NewTargetWizard.java index c9d4250ff..b4adf44f4 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 @@ -128,13 +128,13 @@ public class NewTargetWizard extends AbstractWizard implements INewWizard { Protocol.invokeLater(new Runnable() { @Override public void run() { - IPeerModelRefreshService service = Model.getModel().getService(IPeerModelRefreshService.class); + IPeerModelRefreshService service = Model.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.getModel().getService(IPeerModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID)); + final IPeerNode peerNode = Model.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 cdf9845f8..df2ce0236 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 @@ -310,7 +310,7 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i @Override public void run() { // Get all peer model objects - IPeerNode[] peers = Model.getModel().getPeerNodes(); + IPeerNode[] peers = Model.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 d421fa1bf..ea2308879 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 @@ -454,7 +454,7 @@ public class NewTargetWizardPage extends AbstractValidatingWizardPage implements @Override public void run() { // Get all peer model objects - IPeerNode[] peers = Model.getModel().getPeerNodes(); + IPeerNode[] peers = Model.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 abf4d7dd7..21d53115b 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 @@ -167,7 +167,7 @@ public class PeerExportWizardPage extends WizardPage { } }; fViewer.addCheckStateListener(checkListener); - fViewer.setInput(Model.getModel()); + fViewer.setInput(Model.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 1c8401e59..e4dfdfc6b 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 @@ -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.getModel(); + final IPeerModel model = Model.getPeerModel(); final IProgressMonitor finalMonitor; if (monitor == null) { finalMonitor = new NullProgressMonitor(); |