diff options
author | Tobias Schwarz | 2013-12-13 09:22:07 +0000 |
---|---|---|
committer | Tobias Schwarz | 2013-12-13 09:22:07 +0000 |
commit | 17e2516e95a40b95a6298c7e294b0cfc9088bbf4 (patch) | |
tree | 63163f5174d02165b581d282a8e265f220d319c6 /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf | |
parent | 27e9596b045ba44cd4f5db7d4b310b9272135288 (diff) | |
download | org.eclipse.tcf-17e2516e95a40b95a6298c7e294b0cfc9088bbf4.tar.gz org.eclipse.tcf-17e2516e95a40b95a6298c7e294b0cfc9088bbf4.tar.xz org.eclipse.tcf-17e2516e95a40b95a6298c7e294b0cfc9088bbf4.zip |
Target Explorer: rework peer model
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf')
50 files changed, 779 insertions, 1111 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 e3e7256ae..48be9247c 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 @@ -40,11 +40,11 @@ import org.eclipse.tcf.te.runtime.events.ChangeEvent; import org.eclipse.tcf.te.runtime.events.EventManager; import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener; import org.eclipse.tcf.te.runtime.persistence.history.HistoryManager; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; +import org.eclipse.tcf.te.tcf.locator.interfaces.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.ui.dialogs.AgentSelectionDialog; +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; import org.eclipse.tcf.te.ui.views.navigator.ViewerSorter; @@ -134,12 +134,12 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA if (e.getSource() instanceof HistoryManager && getPeerTypeId().equals(e.getNewValue())) { recreateMenuCtlParent.set(true); recreateMenuMenuParent.set(true); - IPeerModel peerModel = getPeerModel(HistoryManager.getInstance().getFirst(getPeerTypeId())); + IPeerNode peerNode = getPeerModel(HistoryManager.getInstance().getFirst(getPeerTypeId())); if (action != null) { - if (peerModel != null) { - ILabelProvider labelProvider = getLabelProvider(peerModel); + if (peerNode != null) { + ILabelProvider labelProvider = getLabelProvider(peerNode); if (labelProvider != null) { - action.setToolTipText("Open " + labelProvider.getText(peerModel)); //$NON-NLS-1$ + action.setToolTipText("Open " + labelProvider.getText(peerNode)); //$NON-NLS-1$ return; } @@ -200,16 +200,16 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA }); } - private IPeerModel getPeerModel(final String peerId) { + private IPeerNode getPeerModel(final String peerId) { if (peerId != null) { - final AtomicReference<IPeerModel> peerModel = new AtomicReference<IPeerModel>(); + final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>(); Runnable runnable = new Runnable() { @Override public void run() { - ILocatorModel model = Model.getModel(); + IPeerModel model = Model.getModel(); Assert.isNotNull(model); - peerModel.set(model.getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId)); + peerNode.set(model.getService(IPeerModelLookupService.class).lkupPeerModelById(peerId)); } }; @@ -220,7 +220,7 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA Protocol.invokeAndWait(runnable); } - return peerModel.get(); + return peerNode.get(); } return null; @@ -234,20 +234,20 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA @SuppressWarnings("unused") protected void fillMenu(Menu menu) { int accelerator = 1; - List<IPeerModel> peerModels = new ArrayList<IPeerModel>(); + List<IPeerNode> peerNodes = new ArrayList<IPeerNode>(); for (String id : HistoryManager.getInstance().getHistory(getPeerTypeId())) { - IPeerModel peerModel = getPeerModel(id); - if (peerModel != null && !peerModels.contains(peerModel)) { - peerModels.add(peerModel); + IPeerNode peerNode = getPeerModel(id); + if (peerNode != null && !peerNodes.contains(peerNode)) { + peerNodes.add(peerNode); } } - for (final IPeerModel peerModel: peerModels) { - ILabelProvider labelProvider = getLabelProvider(peerModel); - String label = peerModel.getPeer().getName(); + for (final IPeerNode peerNode: peerNodes) { + ILabelProvider labelProvider = getLabelProvider(peerNode); + String label = peerNode.getPeer().getName(); if (labelProvider != null) { - label = labelProvider.getText(peerModel); + label = labelProvider.getText(peerNode); if (labelProvider instanceof ILabelDecorator) { - label = ((ILabelDecorator)labelProvider).decorateText(label, peerModel); + label = ((ILabelDecorator)labelProvider).decorateText(label, peerNode); } } Action action = new Action(label) { @@ -256,7 +256,7 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA // Get the active page IWorkbenchPage page = window.getActivePage(); // Create the editor input object - IEditorInput input = new EditorInput(peerModel); + IEditorInput input = new EditorInput(peerNode); try { // Opens the configuration editor page.openEditor(input, IUIConstants.ID_EDITOR); @@ -266,7 +266,7 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA } }; if (labelProvider != null) { - action.setImageDescriptor(ImageDescriptor.createFromImage(labelProvider.getImage(peerModel))); + action.setImageDescriptor(ImageDescriptor.createFromImage(labelProvider.getImage(peerNode))); } addToMenu(menu, action, accelerator); accelerator++; @@ -283,7 +283,7 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA // Get the active page IWorkbenchPage page = window.getActivePage(); // Create the agent selection dialog - AgentSelectionDialog dialog = new AgentSelectionDialog(null) { + PeerSelectionDialog dialog = new PeerSelectionDialog(null) { @Override protected String getTitle() { return getSelectExistingDialogTitle(); @@ -312,7 +312,7 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA if (dialog.open() == Window.OK) { // Get the selected proxy from the dialog ISelection selection = dialog.getSelection(); - if (selection instanceof IStructuredSelection && !selection.isEmpty() && ((IStructuredSelection)selection).getFirstElement() instanceof IPeerModel) { + if (selection instanceof IStructuredSelection && !selection.isEmpty() && ((IStructuredSelection)selection).getFirstElement() instanceof IPeerNode) { // Create the editor input object IEditorInput input = new EditorInput(((IStructuredSelection)selection).getFirstElement()); try { @@ -375,12 +375,12 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA @SuppressWarnings("restriction") @Override public void run(IAction action) { - IPeerModel peerModel = getPeerModel(HistoryManager.getInstance().getFirst(getPeerTypeId())); - if (peerModel != null) { + IPeerNode peerNode = getPeerModel(HistoryManager.getInstance().getFirst(getPeerTypeId())); + if (peerNode != null) { // Get the active page IWorkbenchPage page = window.getActivePage(); // Create the editor input object - IEditorInput input = new EditorInput(peerModel); + IEditorInput input = new EditorInput(peerNode); try { // Opens the configuration editor page.openEditor(input, IUIConstants.ID_EDITOR); @@ -404,13 +404,13 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA /** * Get the label provider for a peer model node. * - * @param peerModel The peer model node. + * @param peerNode The peer model node. * @return The label provider or <code>null</code>. */ - protected ILabelProvider getLabelProvider(IPeerModel peerModel) { - ILabelProvider labelProvider = (ILabelProvider)peerModel.getAdapter(ILabelProvider.class); + protected ILabelProvider getLabelProvider(IPeerNode peerNode) { + ILabelProvider labelProvider = (ILabelProvider)peerNode.getAdapter(ILabelProvider.class); if (labelProvider == null) { - labelProvider = (ILabelProvider)Platform.getAdapterManager().loadAdapter(peerModel, ILabelProvider.class.getName()); + labelProvider = (ILabelProvider)Platform.getAdapterManager().loadAdapter(peerNode, ILabelProvider.class.getName()); } return labelProvider; } 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 128fd7397..3d06081ad 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 @@ -29,8 +29,8 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService; import org.eclipse.tcf.te.runtime.stepper.job.StepperJob; import org.eclipse.tcf.te.runtime.utils.StatusHelper; import org.eclipse.tcf.te.tcf.core.Tcf; -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.services.IStepperServiceOperations; import org.eclipse.tcf.te.tcf.locator.model.Model; import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts; @@ -104,7 +104,7 @@ public class UIPlugin extends AbstractUIPlugin { if (proceedShutdown || forced) { // Terminate the scanner - final ILocatorModel model = Model.getModel(true); + final IPeerModel model = Model.getModel(true); if (model != null) { Runnable runnable = new Runnable() { @Override @@ -125,23 +125,23 @@ public class UIPlugin extends AbstractUIPlugin { @Override public void run() { // Get all peer model objects - IPeerModel[] peers = model.getPeers(); + IPeerNode[] peers = model.getPeers(); // Loop them and check if disconnect is available - for (IPeerModel peerModel : peers) { - IService[] services = ServiceManager.getInstance().getServices(peerModel, IStepperOperationService.class, false); + for (IPeerNode peerNode : peers) { + IService[] services = ServiceManager.getInstance().getServices(peerNode, IStepperOperationService.class, false); IStepperOperationService stepperOperationService = null; for (IService service : services) { - if (service instanceof IStepperOperationService && ((IStepperOperationService)service).isHandledOperation(peerModel, IStepperServiceOperations.DISCONNECT)) { + if (service instanceof IStepperOperationService && ((IStepperOperationService)service).isHandledOperation(peerNode, IStepperServiceOperations.DISCONNECT)) { stepperOperationService = (IStepperOperationService)service; break; } } if (stepperOperationService != null) { - String stepGroupId = stepperOperationService.getStepGroupId(peerModel, IStepperServiceOperations.DISCONNECT); - IStepContext stepContext = stepperOperationService.getStepContext(peerModel, IStepperServiceOperations.DISCONNECT); - String name = stepperOperationService.getStepGroupName(peerModel, IStepperServiceOperations.DISCONNECT); - boolean isEnabled = stepperOperationService.isEnabled(peerModel, IStepperServiceOperations.DISCONNECT); - IPropertiesContainer data = stepperOperationService.getStepData(peerModel, IStepperServiceOperations.DISCONNECT); + String stepGroupId = stepperOperationService.getStepGroupId(peerNode, IStepperServiceOperations.DISCONNECT); + IStepContext stepContext = stepperOperationService.getStepContext(peerNode, IStepperServiceOperations.DISCONNECT); + String name = stepperOperationService.getStepGroupName(peerNode, IStepperServiceOperations.DISCONNECT); + boolean isEnabled = stepperOperationService.isEnabled(peerNode, IStepperServiceOperations.DISCONNECT); + IPropertiesContainer data = stepperOperationService.getStepData(peerNode, IStepperServiceOperations.DISCONNECT); if (isEnabled && stepGroupId != null && stepContext != null) { try { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/DefaultContextStatusTrimControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/DefaultContextStatusTrimControl.java index cfe2abdc9..a54d1c42f 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/DefaultContextStatusTrimControl.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/DefaultContextStatusTrimControl.java @@ -26,7 +26,7 @@ import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.runtime.services.interfaces.IUIService; import org.eclipse.tcf.te.runtime.services.interfaces.delegates.ILabelProviderDelegate; -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.IDefaultContextService; import org.eclipse.tcf.te.tcf.ui.nls.Messages; import org.eclipse.tcf.te.ui.swt.SWTControlUtil; @@ -60,17 +60,17 @@ public class DefaultContextStatusTrimControl extends WorkbenchWindowControlContr IDefaultContextService service = ServiceManager.getInstance().getService(IDefaultContextService.class); if (service != null) { - IPeerModel peerModel = service.getDefaultContext(null); - if (peerModel != null) { - IUIService uiService = ServiceManager.getInstance().getService(peerModel, IUIService.class); - ILabelProviderDelegate delegate = uiService != null ? uiService.getDelegate(peerModel, ILabelProviderDelegate.class) : null; + IPeerNode peerNode = service.getDefaultContext(null); + if (peerNode != null) { + IUIService uiService = ServiceManager.getInstance().getService(peerNode, IUIService.class); + ILabelProviderDelegate delegate = uiService != null ? uiService.getDelegate(peerNode, ILabelProviderDelegate.class) : null; if (delegate == null) { - ILabelProvider provider = (ILabelProvider)Platform.getAdapterManager().getAdapter(peerModel, ILabelProvider.class); + ILabelProvider provider = (ILabelProvider)Platform.getAdapterManager().getAdapter(peerNode, ILabelProvider.class); if (provider instanceof ILabelProviderDelegate) { delegate = (ILabelProviderDelegate)provider; } } - selected = NLS.bind(Messages.DefaultContextStatusTrimControl_label, delegate != null ? delegate.getText(peerModel) : peerModel.getName()); + selected = NLS.bind(Messages.DefaultContextStatusTrimControl_label, delegate != null ? delegate.getText(peerNode) : peerNode.getName()); } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java index 5bae72b8c..aca1888fc 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java @@ -9,11 +9,8 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.ui.dialogs; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.ListIterator; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; import org.eclipse.core.runtime.Assert; import org.eclipse.jface.dialogs.IDialogConstants; @@ -26,12 +23,7 @@ import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; @@ -40,11 +32,10 @@ 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.te.tcf.locator.interfaces.nodes.ILocatorModel; +import org.eclipse.tcf.services.ILocator; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; 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; @@ -55,16 +46,13 @@ import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider; /** * TCF agent selection dialog implementation. */ -public class AgentSelectionDialog extends CustomTitleAreaDialog { +public class PeerSelectionDialog extends CustomTitleAreaDialog { // The list of remote services the agents must provide to be included /* default */ final String[] services; // The table viewer /* default */ TableViewer viewer; - // Button to filter non-reachable targets - /* default */ Button showOnlyReachable; - // The selection. Will be filled in if either "OK" or "Cancel" is pressed private ISelection selection; @@ -73,7 +61,7 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog { * * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>. */ - public AgentSelectionDialog(String[] services) { + public PeerSelectionDialog(String[] services) { this(null, services); } @@ -83,7 +71,7 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog { * @param parent The parent shell used to view the dialog, or <code>null</code>. * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>. */ - public AgentSelectionDialog(Shell parent, String[] services) { + public PeerSelectionDialog(Shell parent, String[] services) { super(parent, IContextHelpIds.AGENT_SELECTION_DIALOG); this.services = services != null && services.length > 0 ? services : null; @@ -156,29 +144,25 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog { }; viewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, labelProvider)); - // Create the filter buttons area - createFilterButtons(parent); - // Subclasses may customize the viewer before setting the input configureTableViewer(viewer); - // The content to show is static. Do the filtering manually so that - // we can disable the OK Button if the dialog would not show any content. - final ILocatorModelLookupService service = getModel().getService(ILocatorModelLookupService.class); - final List<IPeerModel> nodes = new ArrayList<IPeerModel>(); - if (service != null) { - nodes.addAll(Arrays.asList(service.lkupPeerModelBySupportedServices(null, services))); - ListIterator<IPeerModel> iterator = nodes.listIterator(); - while (iterator.hasNext()) { - IPeerModel node = iterator.next(); + final AtomicReference<IPeer[]> peers = new AtomicReference<IPeer[]>(null); - String value = node.getPeer().getAttributes().get("ValueAdd"); //$NON-NLS-1$ - boolean isValueAdd = value != null && ("1".equals(value.trim()) || Boolean.parseBoolean(value.trim())); //$NON-NLS-1$ + 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()])); + } + } + }); - if (isValueAdd) iterator.remove(); - } - } - viewer.setInput(nodes.size() > 0 ? nodes.toArray(new IPeerModel[nodes.size()]) : null); + viewer.setInput(peers.get()); viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { @@ -188,48 +172,8 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog { } }); - // Determine the initial state of the "show only reachable" button. If there are no - // reachable target while opening the dialog, this button should be not selected. - boolean showOnlyReachableSelected = true; - ViewerFilter[] filters = viewer.getFilters(); - if (filters != null && filters.length > 0) { - TreePath parentPath = new TreePath(new Object[0]); - Object[] result = nodes.toArray(); - for (ViewerFilter filter : filters) { - Object[] filteredResult = filter.filter(viewer, parentPath, result); - result = filteredResult; - } - showOnlyReachableSelected = result.length > 0; - } else { - showOnlyReachableSelected = nodes.size() > 0; - } - - if (showOnlyReachableSelected != SWTControlUtil.getSelection(showOnlyReachable)) { - SWTControlUtil.setSelection(showOnlyReachable, showOnlyReachableSelected); - viewer.refresh(); - updateEnablement(viewer); - } - } - - /** - * Creates a set of filter buttons in between the main dialog area - * and the button bar. - * - * @param parent The parent composite. Must not be <code>null</code>. - */ - protected void createFilterButtons(Composite parent) { - Assert.isNotNull(parent); - - showOnlyReachable = new Button(parent, SWT.CHECK); - SWTControlUtil.setText(showOnlyReachable, getShowOnlyReachableLabel()); - SWTControlUtil.setSelection(showOnlyReachable, true); - showOnlyReachable.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - viewer.refresh(); - updateEnablement(viewer); - } - }); + viewer.refresh(); + updateEnablement(viewer); } /** @@ -274,33 +218,6 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog { */ protected void configureTableViewer(TableViewer viewer) { Assert.isNotNull(viewer); - - viewer.addFilter(new ViewerFilter() { - - @Override - public boolean select(Viewer viewer, Object parentElement, final Object element) { - if (element instanceof IPeerModel) { - final AtomicInteger state = new AtomicInteger(IPeerModelProperties.STATE_UNKNOWN); - - Runnable runnable = new Runnable() { - @Override - public void run() { - state.set(((IPeerModel)element).getIntProperty(IPeerModelProperties.PROP_STATE)); - } - }; - - if (Protocol.isDispatchThread()) runnable.run(); - else Protocol.invokeAndWait(runnable); - - boolean isShowOnlyReachable = SWTControlUtil.getSelection(showOnlyReachable); - if (isShowOnlyReachable) { - return state.get() == IPeerModelProperties.STATE_CONNECTED || state.get() == IPeerModelProperties.STATE_REACHABLE || state.get() == IPeerModelProperties.STATE_WAITING_FOR_READY; - } - } - - return true; - } - }); } /** @@ -336,7 +253,7 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog { * * @return The locator model instance. */ - protected ILocatorModel getModel() { + protected IPeerModel getModel() { return Model.getModel(); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectAgentSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectPeerSelectionDialog.java index 6e0d0d12c..fb3c1125b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectAgentSelectionDialog.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectPeerSelectionDialog.java @@ -1,71 +1,71 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.dialogs;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.tcf.ui.nls.Messages;
-
-
-/**
- * Agent selection dialog implementation to choose the proxy to redirect the communication through.
- */
-public class RedirectAgentSelectionDialog extends AgentSelectionDialog {
-
- /**
- * Constructor.
- *
- * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>.
- */
- public RedirectAgentSelectionDialog(String[] services) {
- super(services);
- }
-
- /**
- * Constructor.
- *
- * @param parent The parent shell used to view the dialog, or <code>null</code>.
- * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>.
- */
- public RedirectAgentSelectionDialog(Shell parent, String[] services) {
- super(parent, services);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.dialogs.AgentSelectionDialog#getDialogTitle()
- */
- @Override
- protected String getDialogTitle() {
- return Messages.RedirectAgentSelectionDialog_dialogTitle;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.dialogs.AgentSelectionDialog#getTitle()
- */
- @Override
- protected String getTitle() {
- return Messages.RedirectAgentSelectionDialog_title;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.dialogs.AgentSelectionDialog#getDefaultMessage()
- */
- @Override
- protected String getDefaultMessage() {
- return Messages.RedirectAgentSelectionDialog_message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.dialogs.AgentSelectionDialog#supportsMultiSelection()
- */
- @Override
- protected boolean supportsMultiSelection() {
- return false;
- }
-}
+/******************************************************************************* + * Copyright (c) 2011 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.dialogs; + +import org.eclipse.swt.widgets.Shell; +import org.eclipse.tcf.te.tcf.ui.nls.Messages; + + +/** + * Agent selection dialog implementation to choose the proxy to redirect the communication through. + */ +public class RedirectPeerSelectionDialog extends PeerSelectionDialog { + + /** + * Constructor. + * + * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>. + */ + public RedirectPeerSelectionDialog(String[] services) { + super(services); + } + + /** + * Constructor. + * + * @param parent The parent shell used to view the dialog, or <code>null</code>. + * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>. + */ + public RedirectPeerSelectionDialog(Shell parent, String[] services) { + super(parent, services); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog#getDialogTitle() + */ + @Override + protected String getDialogTitle() { + return Messages.RedirectAgentSelectionDialog_dialogTitle; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog#getTitle() + */ + @Override + protected String getTitle() { + return Messages.RedirectAgentSelectionDialog_title; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog#getDefaultMessage() + */ + @Override + protected String getDefaultMessage() { + return Messages.RedirectAgentSelectionDialog_message; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog#supportsMultiSelection() + */ + @Override + protected boolean supportsMultiSelection() { + return false; + } +} 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 97de115ca..6b368f08c 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,13 +16,14 @@ 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.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +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; @@ -134,33 +135,31 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm // If necessary, write the changed peer attributes final Object input = getEditorInputNode(); - if (input instanceof IPeerModel) { + if (input instanceof IPeerNode) { Runnable runnable = new Runnable() { @Override public void run() { try { - boolean isDynamic = !((IPeerModel)input).isStatic(); - // Get the persistence service IURIPersistenceService uRIPersistenceService = ServiceManager.getInstance().getService(IURIPersistenceService.class); if (uRIPersistenceService == null) { throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$ } // Save the peer node to the new persistence storage - uRIPersistenceService.write(((IPeerModel)input).getPeer(), null); + 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 (isDynamic) { + if (((IPeerNode)input).getConnectState() == IConnectable.STATE_CONNECTED) { // Refresh the static peers - ((IPeerModel)input).getModel().getService(ILocatorModelRefreshService.class).refreshStaticPeers(); + ((IPeerNode)input).getModel().getService(IPeerModelRefreshService.class).refreshStaticPeers(); // 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, ((IPeerModel)input).getName(), Messages.AbstractConfigurationEditorPage_error_possibleCause); + String template = NLS.bind(Messages.AbstractConfigurationEditorPage_error_save, ((IPeerNode)input).getName(), Messages.AbstractConfigurationEditorPage_error_possibleCause); // Handle the status StatusHandlerUtil.handleStatus(StatusHelper.getStatus(e), input, template, null, IContextHelpIds.MESSAGE_SAVE_FAILED, AbstractConfigurationEditorPage.this, null); } @@ -173,7 +172,7 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm @Override public void run() { // Trigger a change event for the original data node - ((IPeerModel)input).fireChangeEvent("properties", null, ((IPeerModel)input).getProperties()); //$NON-NLS-1$ + ((IPeerNode)input).fireChangeEvent("properties", null, ((IPeerNode)input).getProperties()); //$NON-NLS-1$ } }); } 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 3375c572c..d614abe14 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 @@ -24,7 +24,7 @@ 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.IPeerModel; +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; import org.eclipse.tcf.te.tcf.ui.editor.sections.GeneralInformationSection; @@ -175,9 +175,9 @@ public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage { return; } super.setInput(input); - if (getEditorInputNode() instanceof IPeerModel) { + if (getEditorInputNode() instanceof IPeerNode) { // Invoke the scanner runnable - ScannerRunnable runnable = new ScannerRunnable(null, ((IPeerModel)getEditorInputNode())); + ScannerRunnable runnable = new ScannerRunnable(null, ((IPeerNode)getEditorInputNode())); Protocol.invokeLater(runnable); } } @@ -188,8 +188,8 @@ public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage { @Override protected void setInputWithNotify(IEditorInput input) { super.setInputWithNotify(input); - if (getEditorInputNode() instanceof IPeerModel) { - ScannerRunnable runnable = new ScannerRunnable(null, ((IPeerModel)getEditorInputNode())); + if (getEditorInputNode() instanceof IPeerNode) { + ScannerRunnable runnable = new ScannerRunnable(null, ((IPeerNode)getEditorInputNode())); Protocol.invokeLater(runnable); } } @@ -201,24 +201,21 @@ public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage { public void postDoSave(IProgressMonitor monitor) { // If necessary, write the changed peer attributes final Object input = getEditorInputNode(); - if (input instanceof IPeerModel) { + if (input instanceof IPeerNode) { Runnable runnable = new Runnable() { @Override public void run() { try { - boolean isStatic = ((IPeerModel)input).isStatic(); - if (isStatic) { // Get the persistence service IURIPersistenceService uRIPersistenceService = ServiceManager.getInstance().getService(IURIPersistenceService.class); if (uRIPersistenceService == null) { throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$ } // Save the peer node to the new persistence storage - uRIPersistenceService.write(((IPeerModel)input).getPeer(), null); - } + uRIPersistenceService.write(((IPeerNode)input).getPeer(), null); } catch (IOException e) { // Build up the message template - String template = NLS.bind(Messages.OverviewEditorPage_error_save, ((IPeerModel)input).getName(), Messages.PossibleCause); + String template = NLS.bind(Messages.OverviewEditorPage_error_save, ((IPeerNode)input).getName(), Messages.PossibleCause); // Handle the status StatusHandlerUtil.handleStatus(StatusHelper.getStatus(e), input, template, null, IContextHelpIds.MESSAGE_SAVE_FAILED, OverviewEditorPage.this, null); } @@ -231,12 +228,12 @@ public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage { @Override public void run() { // Trigger a change event for the original data node - ((IPeerModel)input).fireChangeEvent("properties", null, ((IPeerModel)input).getProperties()); //$NON-NLS-1$ + ((IPeerNode)input).fireChangeEvent("properties", null, ((IPeerNode)input).getProperties()); //$NON-NLS-1$ } }); // Force a scan of the peer - ScannerRunnable runnable2 = new ScannerRunnable(null, ((IPeerModel)input)); + 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/AttributesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java index db8cff7c1..cd2f9e825 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java @@ -14,7 +14,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.core.runtime.Assert; import org.eclipse.swt.SWT; @@ -24,11 +23,12 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.tcf.protocol.IPeer; import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.core.interfaces.IConnectable; import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; +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.nodes.PeerRedirector; import org.eclipse.tcf.te.tcf.ui.controls.PeerAttributesTablePart; import org.eclipse.tcf.te.tcf.ui.nls.Messages; @@ -47,7 +47,7 @@ public class AttributesSection extends AbstractSection { private PeerAttributesTablePart tablePart; // Reference to the original data object - /* default */ IPeerModel od; + /* default */ IPeerNode od; // Reference to a copy of the original data /* default */ final IPropertiesContainer odc = new PropertiesContainer(); // Reference to the properties container representing the working copy for the section @@ -62,7 +62,7 @@ public class AttributesSection extends AbstractSection { IPeer.ATTR_NAME, IPeer.ATTR_TRANSPORT_NAME, IPeer.ATTR_IP_HOST, IPeer.ATTR_IP_PORT, "PipeName", //$NON-NLS-1$ "redirect.proxy", //$NON-NLS-1$ - IPeerModelProperties.PROP_VISIBLE, "ClientID" //$NON-NLS-1$ + IPeerNodeProperties.PROP_VISIBLE, "ClientID" //$NON-NLS-1$ }; /* @@ -75,7 +75,7 @@ public class AttributesSection extends AbstractSection { IPeer.ATTR_NAME, IPeer.ATTR_TRANSPORT_NAME, IPeer.ATTR_IP_HOST, IPeer.ATTR_IP_PORT, "PipeName", //$NON-NLS-1$ "redirect.proxy", //$NON-NLS-1$ - IPeerModelProperties.PROP_VISIBLE, "ClientID" //$NON-NLS-1$ + IPeerNodeProperties.PROP_VISIBLE, "ClientID" //$NON-NLS-1$ }; /** @@ -160,8 +160,8 @@ public class AttributesSection extends AbstractSection { if (getManagedForm().getContainer() instanceof AbstractEditorPage && !((AbstractEditorPage)getManagedForm().getContainer()).isDirty()) { Object node = ((AbstractEditorPage)getManagedForm().getContainer()).getEditorInputNode(); - if (node instanceof IPeerModel) { - setupData((IPeerModel)node); + if (node instanceof IPeerNode) { + setupData((IPeerNode)node); } } } else { @@ -178,7 +178,7 @@ public class AttributesSection extends AbstractSection { * * @param node The peer node or <code>null</code>. */ - public void setupData(final IPeerModel node) { + public void setupData(final IPeerNode node) { // If the section is dirty, nothing is changed if (isDirty()) return; @@ -276,7 +276,7 @@ public class AttributesSection extends AbstractSection { * * @param node The GDB Remote configuration node or <code>null</code>. */ - public void extractData(final IPeerModel node) { + public void extractData(final IPeerNode node) { // If no data is available, we are done if (node == null) { return; @@ -330,7 +330,7 @@ public class AttributesSection extends AbstractSection { IPeer newPeer = oldPeer instanceof PeerRedirector ? new PeerRedirector(((PeerRedirector)oldPeer).getParent(), attributes) : new Peer(attributes); // Update the peer node instance (silently) boolean changed = node.setChangeEventsEnabled(false); - node.setProperty(IPeerModelProperties.PROP_INSTANCE, newPeer); + node.setProperty(IPeerNodeProperties.PROP_INSTANCE, newPeer); if (changed) { node.setChangeEventsEnabled(true); } @@ -393,30 +393,12 @@ public class AttributesSection extends AbstractSection { * Updates the control enablement. */ protected void updateEnablement() { - // Determine the input - final Object input = getManagedForm().getInput(); - - // Determine if the peer is a static peer - final AtomicBoolean isStatic = new AtomicBoolean(); - final AtomicBoolean isRemote = new AtomicBoolean(); - Runnable runnable = new Runnable() { - @Override - public void run() { - if (input instanceof IPeerModel) { - isStatic.set(((IPeerModel)input).isStatic()); - isRemote.set(((IPeerModel)input).isRemote()); - } - } - }; - if (Protocol.isDispatchThread()) { - runnable.run(); - } - else { - Protocol.invokeAndWait(runnable); - } - if (tablePart != null) { - tablePart.setReadOnly(!isStatic.get() || isRemote.get()); + // Determine the input + final Object input = getManagedForm().getInput(); + if (input instanceof IPeerNode) { + tablePart.setReadOnly(((IPeerNode)input).getConnectState() != IConnectable.STATE_DISCONNECTED); + } } } } 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 d36d42cdc..b13904a1f 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others. All rights reserved. +* 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 @@ -13,7 +13,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IStatus; @@ -30,6 +29,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.tcf.protocol.IPeer; import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.core.interfaces.IConnectable; import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableNodeProperties; import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; @@ -38,8 +38,8 @@ 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.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; +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.nodes.PeerRedirector; import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin; @@ -65,7 +65,7 @@ public class GeneralInformationSection extends AbstractSection { private Label linkStateImage = null; // Reference to the original data object - /* default */ IPeerModel od; + /* default */ IPeerNode od; // Reference to a copy of the original data /* default */ final IPropertiesContainer odc = new PropertiesContainer(); // Reference to the properties container representing the working copy for the section @@ -204,8 +204,8 @@ public class GeneralInformationSection extends AbstractSection { if (getManagedForm().getContainer() instanceof AbstractEditorPage && !((AbstractEditorPage)getManagedForm().getContainer()).isDirty()) { Object node = ((AbstractEditorPage)getManagedForm().getContainer()).getEditorInputNode(); - if (node instanceof IPeerModel) { - setupData((IPeerModel)node); + if (node instanceof IPeerNode) { + setupData((IPeerNode)node); } } } else { @@ -222,7 +222,7 @@ public class GeneralInformationSection extends AbstractSection { * * @param node The peer node or <code>null</code>. */ - public void setupData(final IPeerModel node) { + public void setupData(final IPeerNode node) { // If the section is dirty, nothing is changed if (isDirty()) return; @@ -257,7 +257,7 @@ public class GeneralInformationSection extends AbstractSection { public void run() { // The section is handling the ID, the name and // the link state. Ignore other properties. - odc.setProperty(IPeerModelProperties.PROP_STATE, node.getProperty(IPeerModelProperties.PROP_STATE)); + odc.setProperty(IPeerNodeProperties.PROP_STATE, node.getProperty(IPeerNodeProperties.PROP_STATE)); odc.setProperty(IPeer.ATTR_ID, node.getPeer().getAttributes().get(IPeer.ATTR_ID)); odc.setProperty(IPeer.ATTR_NAME, node.getPeer().getAttributes().get(IPeer.ATTR_NAME)); // Initially, the working copy is a duplicate of the original data copy @@ -282,10 +282,10 @@ public class GeneralInformationSection extends AbstractSection { } if (linkState != null && linkStateImage != null) { - String state = wc.getStringProperty(IPeerModelProperties.PROP_STATE); + String state = wc.getStringProperty(IPeerNodeProperties.PROP_STATE); linkState.setText(Messages.getString("GeneralInformationSection_state_" + (state != null ? state.replace('-', '_') : "_1"))); //$NON-NLS-1$ //$NON-NLS-2$ - switch (wc.getIntProperty(IPeerModelProperties.PROP_STATE)) { + switch (wc.getIntProperty(IPeerNodeProperties.PROP_STATE)) { case 0: linkStateImage.setImage(UIPlugin.getImage(ImageConsts.GOLD_OVR)); break; @@ -324,7 +324,7 @@ public class GeneralInformationSection extends AbstractSection { * * @param node The peer node or <code>null</code>. */ - public void extractData(final IPeerModel node) { + public void extractData(final IPeerNode node) { // If no data is available, we are done if (node == null) { return; @@ -363,7 +363,7 @@ public class GeneralInformationSection extends AbstractSection { IPeer newPeer = oldPeer instanceof PeerRedirector ? new PeerRedirector(((PeerRedirector)oldPeer).getParent(), attributes) : new Peer(attributes); // Update the peer node instance (silently) boolean changed = node.setChangeEventsEnabled(false); - node.setProperty(IPeerModelProperties.PROP_INSTANCE, newPeer); + node.setProperty(IPeerNodeProperties.PROP_INSTANCE, newPeer); if (changed) node.setChangeEventsEnabled(true); } }); @@ -465,27 +465,8 @@ public class GeneralInformationSection extends AbstractSection { // Determine the input final Object input = getManagedForm().getInput(); - // The name control is enabled for static peers - if (nameControl != null) { - final AtomicBoolean isStatic = new AtomicBoolean(); - final AtomicBoolean isRemote = new AtomicBoolean(); - Runnable runnable = new Runnable() { - @Override - public void run() { - if (input instanceof IPeerModel) { - isStatic.set(((IPeerModel)input).isStatic()); - isRemote.set(((IPeerModel)input).isRemote()); - } - } - }; - if (Protocol.isDispatchThread()) { - runnable.run(); - } - else { - Protocol.invokeAndWait(runnable); - } - - SWTControlUtil.setEnabled(nameControl.getEditFieldControl(), isStatic.get() && !isRemote.get()); + if (input instanceof IPeerNode) { + SWTControlUtil.setEnabled(nameControl.getEditFieldControl(), ((IPeerNode)input).getConnectState() == IConnectable.STATE_DISCONNECTED); } } @@ -499,11 +480,11 @@ public class GeneralInformationSection extends AbstractSection { @Override public void run() { // Get all peer model objects - IPeerModel[] peers = Model.getModel().getPeers(); + IPeerNode[] peers = Model.getModel().getPeers(); // Loop them and find the ones which are of our handled types - for (IPeerModel peerModel : peers) { - if (peerModel.isStatic() && !peerModel.equals(od)) { - String name = peerModel.getPeer().getName(); + for (IPeerNode peerNode : peers) { + if (!peerNode.equals(od)) { + String name = peerNode.getPeer().getName(); Assert.isNotNull(name); if (!"".equals(name) && !usedNames.contains(name)) { //$NON-NLS-1$ usedNames.add(name.trim().toUpperCase()); 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 b660de602..3f2296a93 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 @@ -21,9 +21,9 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.tcf.protocol.Protocol; 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.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelPeerNodeQueryService; +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; @@ -43,7 +43,7 @@ public class ServicesSection extends AbstractSection { /* default */ Text remote; // Reference to the original data object - /* default */ IPeerModel od; + /* default */ IPeerNode od; // Reference to a copy of the original data /* default */ final IPropertiesContainer odc = new PropertiesContainer(); @@ -118,8 +118,8 @@ public class ServicesSection extends AbstractSection { if (getManagedForm().getContainer() instanceof AbstractEditorPage && !((AbstractEditorPage)getManagedForm().getContainer()).isDirty()) { Object node = ((AbstractEditorPage)getManagedForm().getContainer()).getEditorInputNode(); - if (node instanceof IPeerModel) { - setupData((IPeerModel)node); + if (node instanceof IPeerNode) { + setupData((IPeerNode)node); } } } @@ -136,7 +136,7 @@ public class ServicesSection extends AbstractSection { * * @param node The peer node or <code>null</code>. */ - public void setupData(final IPeerModel node) { + 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; @@ -181,10 +181,10 @@ public class ServicesSection extends AbstractSection { public void run() { boolean fireNotification = fireRefreshTabs.get(); - String value = odc.getStringProperty(IPeerModelProperties.PROP_LOCAL_SERVICES); + 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(IPeerModelProperties.PROP_REMOTE_SERVICES); + value = odc.getStringProperty(IPeerNodeProperties.PROP_REMOTE_SERVICES); fireNotification |= value != null && !value.equals(SWTControlUtil.getText(remote)); SWTControlUtil.setText(remote, value != null ? value : ""); //$NON-NLS-1$ @@ -208,18 +208,18 @@ public class ServicesSection extends AbstractSection { public void run() { // Check if we have to run the query at all boolean doQuery = finForceQuery || - (!node.containsKey(IPeerModelProperties.PROP_REMOTE_SERVICES) - && !node.containsKey(IPeerModelProperties.PROP_LOCAL_SERVICES)); + (!node.containsKey(IPeerNodeProperties.PROP_REMOTE_SERVICES) + && !node.containsKey(IPeerNodeProperties.PROP_LOCAL_SERVICES)); if (doQuery) { - ILocatorModelPeerNodeQueryService service = node.getModel().getService(ILocatorModelPeerNodeQueryService.class); + IPeerModelQueryService service = node.getModel().getService(IPeerModelQueryService.class); if (service != null) { - service.queryServicesAsync(node, new ILocatorModelPeerNodeQueryService.DoneQueryServices() { + service.queryServicesAsync(node, new IPeerModelQueryService.DoneQueryServices() { @Override public void doneQueryServices(Throwable error) { // Copy over the service properties - odc.setProperty(IPeerModelProperties.PROP_REMOTE_SERVICES, node.getProperty(IPeerModelProperties.PROP_REMOTE_SERVICES)); - odc.setProperty(IPeerModelProperties.PROP_LOCAL_SERVICES, node.getProperty(IPeerModelProperties.PROP_LOCAL_SERVICES)); + 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); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java index 3a1963898..42bc893a7 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TcpTransportSection.java @@ -14,7 +14,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.core.runtime.Assert; import org.eclipse.jface.dialogs.IDialogSettings; @@ -27,15 +26,16 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.tcf.protocol.IChannel; import org.eclipse.tcf.protocol.IPeer; import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.core.interfaces.IConnectable; import org.eclipse.tcf.te.core.nodes.interfaces.wire.IWireTypeNetwork; import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; import org.eclipse.tcf.te.tcf.core.Tcf; import org.eclipse.tcf.te.tcf.core.interfaces.ITransportTypes; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService; +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.IPeerModelUpdateService; import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector; import org.eclipse.tcf.te.tcf.ui.nls.Messages; import org.eclipse.tcf.te.ui.controls.net.RemoteHostAddressControl; @@ -62,7 +62,7 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang private boolean isAutoPort = false; // Reference to the original data object - protected IPeerModel od; + protected IPeerNode od; // Reference to a copy of the original data /* default */final IPropertiesContainer odc = new PropertiesContainer(); // Reference to the properties container representing the working copy for the section @@ -304,8 +304,8 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang // Leave everything unchanged if the page is in dirty state if (getManagedForm().getContainer() instanceof AbstractEditorPage && !((AbstractEditorPage) getManagedForm().getContainer()).isDirty()) { Object node = ((AbstractEditorPage) getManagedForm().getContainer()).getEditorInputNode(); - if (node instanceof IPeerModel) { - setupData((IPeerModel) node); + if (node instanceof IPeerNode) { + setupData((IPeerNode) node); } } } @@ -354,7 +354,7 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang * * @param node The peer node or <code>null</code>. */ - public void setupData(final IPeerModel node) { + public void setupData(final IPeerNode node) { // If the section is dirty, nothing is changed if (isDirty()) return; @@ -460,7 +460,7 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang * * @param node The peer model node or <code>null</code>. */ - public void extractData(final IPeerModel node) { + public void extractData(final IPeerNode node) { // If no data is available, we are done if (node == null) { return; @@ -521,15 +521,15 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang IPeer newPeer = oldPeer instanceof PeerRedirector ? new PeerRedirector(((PeerRedirector) oldPeer).getParent(), attributes) : new Peer(attributes); // Update the peer node instance (silently) boolean changed = node.setChangeEventsEnabled(false); - node.setProperty(IPeerModelProperties.PROP_INSTANCE, newPeer); + node.setProperty(IPeerNodeProperties.PROP_INSTANCE, newPeer); // As the transport changed, we have to reset the state back to "unknown" // and clear out the services and DNS markers - node.setProperty(IPeerModelProperties.PROP_STATE, IPeerModelProperties.STATE_UNKNOWN); + node.setProperty(IPeerNodeProperties.PROP_STATE, IPeerNodeProperties.STATE_UNKNOWN); node.setProperty("dns.name.transient", null); //$NON-NLS-1$ node.setProperty("dns.lastIP.transient", null); //$NON-NLS-1$ node.setProperty("dns.skip.transient", null); //$NON-NLS-1$ - ILocatorModelUpdateService service = node.getModel().getService(ILocatorModelUpdateService.class); + IPeerModelUpdateService service = node.getModel().getService(IPeerModelUpdateService.class); service.updatePeerServices(node, null, null); if (changed) { @@ -656,25 +656,9 @@ public class TcpTransportSection extends AbstractSection implements IDataExchang // Determine the input final Object input = od; // getManagedForm().getInput(); - // Determine if the peer is a static peer - final AtomicBoolean isStatic = new AtomicBoolean(); - final AtomicBoolean isRemote = new AtomicBoolean(); - Runnable runnable = new Runnable() { - @Override - public void run() { - if (input instanceof IPeerModel) { - isStatic.set(((IPeerModel) input).isStatic()); - isRemote.set(((IPeerModel) input).isRemote()); - } - } - }; - - if (Protocol.isDispatchThread()) runnable.run(); - else Protocol.invokeAndWait(runnable); - - boolean enabled = !isReadOnly() && (input == null || (isStatic.get() && !isRemote.get())); - if (addressControl != null) addressControl.setEnabled(enabled); - if (portControl != null) portControl.setEnabled(enabled && !isAutoPort); + boolean enabled = !isReadOnly() && (!(input instanceof IPeerNode) || ((IPeerNode)input).getConnectState() == IConnectable.STATE_DISCONNECTED); + if (addressControl != null) addressControl.setEnabled(enabled); + if (portControl != null) portControl.setEnabled(enabled && !isAutoPort); } /* (non-Javadoc) diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java index 47972e8da..9c89a206a 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java @@ -15,7 +15,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.core.runtime.Assert; import org.eclipse.jface.dialogs.IDialogSettings; @@ -27,14 +26,15 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.tcf.protocol.IChannel; import org.eclipse.tcf.protocol.IPeer; import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.core.interfaces.IConnectable; import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; import org.eclipse.tcf.te.tcf.core.Tcf; import org.eclipse.tcf.te.tcf.core.interfaces.ITransportTypes; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService; +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.IPeerModelUpdateService; import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector; import org.eclipse.tcf.te.tcf.ui.controls.CustomTransportPanel; import org.eclipse.tcf.te.tcf.ui.controls.PipeTransportPanel; @@ -61,7 +61,7 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo /* default */TransportSectionTypePanelControl transportTypePanelControl = null; // Reference to the original data object - protected IPeerModel od; + protected IPeerNode od; // Reference to a copy of the original data /* default */final IPropertiesContainer odc = new PropertiesContainer(); // Reference to the properties container representing the working copy for the section @@ -237,8 +237,8 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo // Leave everything unchanged if the page is in dirty state if (getManagedForm().getContainer() instanceof AbstractEditorPage && !((AbstractEditorPage) getManagedForm().getContainer()).isDirty()) { Object node = ((AbstractEditorPage) getManagedForm().getContainer()).getEditorInputNode(); - if (node instanceof IPeerModel) { - setupData((IPeerModel) node); + if (node instanceof IPeerNode) { + setupData((IPeerNode) node); } } } @@ -289,7 +289,7 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo * * @param node The peer node or <code>null</code>. */ - public void setupData(final IPeerModel node) { + public void setupData(final IPeerNode node) { // If the section is dirty, nothing is changed if (isDirty()) return; @@ -402,7 +402,7 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo * * @param node The GDB Remote configuration node or <code>null</code>. */ - public void extractData(final IPeerModel node) { + public void extractData(final IPeerNode node) { // If no data is available, we are done if (node == null) { return; @@ -465,16 +465,16 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo .getParent(), attributes) : new Peer(attributes); // Update the peer node instance (silently) boolean changed = node.setChangeEventsEnabled(false); - node.setProperty(IPeerModelProperties.PROP_INSTANCE, newPeer); + node.setProperty(IPeerNodeProperties.PROP_INSTANCE, newPeer); // As the transport changed, we have to reset the state back to "unknown" // and clear out the services and DNS markers - node.setProperty(IPeerModelProperties.PROP_STATE, IPeerModelProperties.STATE_UNKNOWN); + node.setProperty(IPeerNodeProperties.PROP_STATE, IPeerNodeProperties.STATE_UNKNOWN); node.setProperty("dns.name.transient", null); //$NON-NLS-1$ node.setProperty("dns.lastIP.transient", null); //$NON-NLS-1$ node.setProperty("dns.skip.transient", null); //$NON-NLS-1$ - ILocatorModelUpdateService service = node.getModel() - .getService(ILocatorModelUpdateService.class); + IPeerModelUpdateService service = node.getModel() + .getService(IPeerModelUpdateService.class); service.updatePeerServices(node, null, null); if (changed) { @@ -605,25 +605,9 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo // Determine the input final Object input = od; // getManagedForm().getInput(); - // Determine if the peer is a static peer - final AtomicBoolean isStatic = new AtomicBoolean(); - final AtomicBoolean isRemote = new AtomicBoolean(); - Runnable runnable = new Runnable() { - @Override - public void run() { - if (input instanceof IPeerModel) { - isStatic.set(((IPeerModel) input).isStatic()); - isRemote.set(((IPeerModel) input).isRemote()); - } - } - }; - - if (Protocol.isDispatchThread()) runnable.run(); - else Protocol.invokeAndWait(runnable); - // The transport type control is enabled for static peers if (transportTypeControl != null) { - boolean enabled = !isReadOnly() && (input == null || (isStatic.get() && !isRemote.get())); + boolean enabled = !isReadOnly() && (!(input instanceof IPeerNode) || ((IPeerNode)input).getConnectState() == IConnectable.STATE_DISCONNECTED); SWTControlUtil.setEnabled(transportTypeControl.getEditFieldControl(), enabled && SWTControlUtil.getItemCount(transportTypeControl.getEditFieldControl()) > 1); if (transportTypePanelControl != null) { IWizardConfigurationPanel panel = transportTypePanelControl.getConfigurationPanel(transportTypeControl.getSelectedTransportType()); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/PeersByCurrentUserFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/PeersByCurrentUserFilter.java index ef48a1a81..62e9b4204 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/PeersByCurrentUserFilter.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/PeersByCurrentUserFilter.java @@ -15,7 +15,7 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.tcf.protocol.Protocol; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; /** * Filter implementation filtering peers not started by the current user. @@ -28,18 +28,14 @@ public class PeersByCurrentUserFilter extends ViewerFilter { */ @Override public boolean select(final Viewer viewer, final Object parentElement, final Object element) { - if (element instanceof IPeerModel) { + if (element instanceof IPeerNode) { final AtomicReference<String> user = new AtomicReference<String>(); Runnable runnable = new Runnable() { @Override public void run() { - IPeerModel peerModel = (IPeerModel)element; - if (!peerModel.isStatic()) { - user.set(peerModel.getPeer().getUserName()); - } else { - user.set(USERNAME); - } + IPeerNode peerNode = (IPeerNode)element; + user.set(peerNode.getPeer().getUserName()); } }; Assert.isTrue(!Protocol.isDispatchThread()); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/RedirectPeersFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/RedirectPeersFilter.java index 2bf6b848f..0f161ddb1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/RedirectPeersFilter.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/RedirectPeersFilter.java @@ -1,48 +1,48 @@ -/*******************************************************************************
- * 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.filter;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.ui.views.interfaces.IRoot;
-
-/**
- * Filter implementation filtering redirected peers from the root level.
- */
-public class RedirectPeersFilter extends ViewerFilter {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
- if (element instanceof IPeerModel && parentElement instanceof IRoot) {
- final AtomicReference<IPeerModel> parent = new AtomicReference<IPeerModel>();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- parent.set(((IPeerModel)element).getParent(IPeerModel.class));
- }
- };
- Assert.isTrue(!Protocol.isDispatchThread());
- Protocol.invokeAndWait(runnable);
-
- return parent.get() == null;
- }
-
- return true;
- }
-
-}
+/******************************************************************************* + * 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.filter; + +import java.util.concurrent.atomic.AtomicReference; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; +import org.eclipse.tcf.te.ui.views.interfaces.IRoot; + +/** + * Filter implementation filtering redirected peers from the root level. + */ +public class RedirectPeersFilter extends ViewerFilter { + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) + */ + @Override + public boolean select(final Viewer viewer, final Object parentElement, final Object element) { + if (element instanceof IPeerNode && parentElement instanceof IRoot) { + final AtomicReference<IPeerNode> parent = new AtomicReference<IPeerNode>(); + Runnable runnable = new Runnable() { + @Override + public void run() { + parent.set(((IPeerNode)element).getParent(IPeerNode.class)); + } + }; + Assert.isTrue(!Protocol.isDispatchThread()); + Protocol.invokeAndWait(runnable); + + return parent.get() == null; + } + + return true; + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/UnreachablePeersFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/UnreachablePeersFilter.java index fe6708ab3..d1f122400 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/UnreachablePeersFilter.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/UnreachablePeersFilter.java @@ -1,52 +1,52 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.filter;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
-
-/**
- * Filter implementation filtering unreachable peers.
- */
-public class UnreachablePeersFilter extends ViewerFilter {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
-
- // Filter only elements of simulator IPeerModel
- if (element instanceof IPeerModel) {
- final IPeerModel peerModel = (IPeerModel)element;
-
- // Determine the current action of the peer model
- final int[] state = new int[1];
- if (Protocol.isDispatchThread()) {
- state[0] = peerModel.getIntProperty(IPeerModelProperties.PROP_STATE);
- } else {
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- state[0] = peerModel.getIntProperty(IPeerModelProperties.PROP_STATE);
- }
- });
- }
-
- return state[0] != IPeerModelProperties.STATE_NOT_REACHABLE && state[0] != IPeerModelProperties.STATE_ERROR;
- }
-
- return true;
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2011 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.filter; + +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties; + +/** + * Filter implementation filtering unreachable peers. + */ +public class UnreachablePeersFilter extends ViewerFilter { + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) + */ + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + + // Filter only elements of simulator IPeerNode + if (element instanceof IPeerNode) { + final IPeerNode peerNode = (IPeerNode)element; + + // Determine the current action of the peer model + final int[] state = new int[1]; + if (Protocol.isDispatchThread()) { + state[0] = peerNode.getIntProperty(IPeerNodeProperties.PROP_STATE); + } else { + Protocol.invokeAndWait(new Runnable() { + @Override + public void run() { + state[0] = peerNode.getIntProperty(IPeerNodeProperties.PROP_STATE); + } + }); + } + + return state[0] != IPeerNodeProperties.STATE_NOT_REACHABLE && state[0] != IPeerNodeProperties.STATE_ERROR; + } + + return true; + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/AbstractPeerModelEditorHandlerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/AbstractPeerNodeEditorHandlerDelegate.java index 25b329d69..963f34125 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/AbstractPeerModelEditorHandlerDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/AbstractPeerNodeEditorHandlerDelegate.java @@ -12,24 +12,24 @@ package org.eclipse.tcf.te.tcf.ui.handler; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; -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.ui.interfaces.handler.IEditorHandlerDelegate; import org.eclipse.tcf.te.ui.views.editor.EditorInput; import org.eclipse.ui.IEditorInput; /** - * AbstractPeerModelEditorHandlerDelegate + * AbstractPeerNodeEditorHandlerDelegate */ -public abstract class AbstractPeerModelEditorHandlerDelegate implements IEditorHandlerDelegate { +public abstract class AbstractPeerNodeEditorHandlerDelegate implements IEditorHandlerDelegate { /* (non-Javadoc) * @see org.eclipse.tcf.te.ui.interfaces.handler.IEditorHandlerDelegate#getEditorInput(java.lang.Object) */ @Override public IEditorInput getEditorInput(Object element) { - IPeerModel model = (IPeerModel)Platform.getAdapterManager().getAdapter(element, IPeerModel.class); + IPeerNode model = (IPeerNode)Platform.getAdapterManager().getAdapter(element, IPeerNode.class); if (model == null && element instanceof IAdaptable) { - model = (IPeerModel)((IAdaptable)element).getAdapter(IPeerModel.class); + model = (IPeerNode)((IAdaptable)element).getAdapter(IPeerNode.class); } return new EditorInput(model != null ? model : element); } 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 2c451a72f..d85fa1d91 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 @@ -13,7 +13,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import org.eclipse.core.commands.AbstractHandler; @@ -40,8 +39,8 @@ import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.runtime.services.interfaces.IUIService; 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.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +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.ui.help.IContextHelpIds; import org.eclipse.tcf.te.tcf.ui.nls.Messages; @@ -116,12 +115,12 @@ public class DeleteHandler extends AbstractHandler { if (selection instanceof ITreeSelection && !selection.isEmpty()) { // Assume the selection to be deletable canDelete = true; - // Iterate the selection. All elements must be of type IPeerModel + // Iterate the selection. All elements must be of type IPeerNode for (TreePath treePath : ((ITreeSelection)selection).getPaths()) { // Get the element Object element = treePath.getLastSegment(); // This handler will take care of peer model nodes only - if (!(element instanceof IPeerModel)) { + if (!(element instanceof IPeerNode)) { canDelete = false; break; } @@ -131,37 +130,6 @@ public class DeleteHandler extends AbstractHandler { IDeleteHandlerDelegate delegate = service != null ? service.getDelegate(element, IDeleteHandlerDelegate.class) : null; // If a delegate is available, ask the handler first if the given element is currently deletable if (delegate != null) canDelete = delegate.canDelete(treePath); - // If the element is still marked deletable, apply the default check too - if (canDelete) { - // Determine if the selected peer model is static - boolean isStatic = isStatic((IPeerModel)element); - // Determine if the selected peer model represents an agent - // started by the current user - boolean isStartedByCurrentUser = isStartedByCurrentUser((IPeerModel)element); - // Static nodes can be handled the one way or the other. - // For dynamic nodes, "delete" means "remove from <category>", - // and this works only if the parent category is not "Neighborhood". - if (!isStatic) { - // Determine the parent category of the current tree path - ICategory category = treePath.getFirstSegment() instanceof ICategory ? (ICategory)treePath.getFirstSegment() : null; - if (category != null) { - if (IUIConstants.ID_CAT_NEIGHBORHOOD.equals(category.getId())) { - canDelete = false; - break; - } - else if (IUIConstants.ID_CAT_MY_TARGETS.equals(category.getId())) { - if (isStartedByCurrentUser) { - canDelete = false; - break; - } - } - else if (!IUIConstants.ID_CAT_FAVORITES.equals(category.getId())) { - canDelete = false; - break; - } - } - } - } if (!canDelete) { break; @@ -173,64 +141,6 @@ public class DeleteHandler extends AbstractHandler { } /** - * Determines if the given peer model node is a static node. - * - * @param node The peer model node. Must not be <code>null</code>. - * @return <code>True</code> if the node is static, <code>false</code> otherwise. - */ - private boolean isStatic(final IPeerModel node) { - Assert.isNotNull(node); - - final AtomicBoolean isStatic = new AtomicBoolean(); - - Runnable runnable = new Runnable() { - @Override - public void run() { - isStatic.set(node.isStatic()); - } - }; - - if (Protocol.isDispatchThread()) { - runnable.run(); - } - else { - Protocol.invokeAndWait(runnable); - } - - return isStatic.get(); - } - - /** - * Determines if the given peer model node represents an agent started - * by the current user. - * - * @param node The peer model node. Must not be <code>null</code>. - * @return <code>True</code> if the node represents and agent started by the current user, - * <code>false</code> otherwise. - */ - private boolean isStartedByCurrentUser(final IPeerModel node) { - Assert.isNotNull(node); - - final AtomicReference<String> username = new AtomicReference<String>(); - - Runnable runnable = new Runnable() { - @Override - public void run() { - username.set(node.getPeer().getUserName()); - } - }; - - if (Protocol.isDispatchThread()) { - runnable.run(); - } - else { - Protocol.invokeAndWait(runnable); - } - - return System.getProperty("user.name").equals(username.get()); //$NON-NLS-1$ - } - - /** * Internal helper class to describe the delete operation to perform. */ private static class Operation { @@ -238,7 +148,7 @@ public class DeleteHandler extends AbstractHandler { public enum TYPE { Remove, Unlink } // The element to operate on - public IPeerModel node; + public IPeerNode node; // The operation type to perform public TYPE type; // In case of an "unlink" operation, the parent category @@ -359,7 +269,7 @@ public class DeleteHandler extends AbstractHandler { Protocol.invokeLater(new Runnable() { @Override public void run() { - ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); + IPeerModelRefreshService service = Model.getModel().getService(IPeerModelRefreshService.class); // Refresh the model now (must be executed within the TCF dispatch thread) if (service != null) service.refresh(new Callback() { @Override @@ -391,22 +301,22 @@ public class DeleteHandler extends AbstractHandler { List<Operation> operations = new ArrayList<Operation>(); - // Iterate the selection. All elements must be of type IPeerModel + // Iterate the selection. All elements must be of type IPeerNode for (TreePath treePath : selection.getPaths()) { // Get the element Object element = treePath.getLastSegment(); - Assert.isTrue(element instanceof IPeerModel); - IPeerModel node = (IPeerModel)element; + Assert.isTrue(element instanceof IPeerNode); + IPeerNode node = (IPeerNode)element; - boolean isStatic = isStatic(node); ICategory category = treePath.getFirstSegment() instanceof ICategory ? (ICategory)treePath.getFirstSegment() : null; - if (category == null && isStatic) { + if (category == null) { Operation op = new Operation(); op.node = node; op.type = Operation.TYPE.Remove; operations.add(op); - } else if (category != null) { + } + else { // If the parent category is "Favorites", it is always // an "unlink" operation if (IUIConstants.ID_CAT_FAVORITES.equals(category.getId())) { @@ -423,11 +333,7 @@ public class DeleteHandler extends AbstractHandler { Operation op = new Operation(); op.node = node; - if (isStatic) { - op.type = Operation.TYPE.Remove; - } else { - op.type = Operation.TYPE.Unlink; - } + op.type = Operation.TYPE.Remove; op.parentCategory = category; operations.add(op); 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 index 995e87b96..f46a4ab54 100644 --- 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 @@ -34,13 +34,13 @@ 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.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService; +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.RedirectAgentSelectionDialog; +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; @@ -63,11 +63,11 @@ public class RedirectHandler extends AbstractHandler { if (selection instanceof IStructuredSelection && !selection.isEmpty()) { // Redirect is supporting single selection only Object candidate = ((IStructuredSelection)selection).getFirstElement(); - if (candidate instanceof IPeerModel) { - final IPeerModel peerModel = (IPeerModel)candidate; + if (candidate instanceof IPeerNode) { + final IPeerNode peerNode = (IPeerNode)candidate; // Create the agent selection dialog - RedirectAgentSelectionDialog dialog = new RedirectAgentSelectionDialog(HandlerUtil.getActiveShell(event), null) { + RedirectPeerSelectionDialog dialog = new RedirectPeerSelectionDialog(HandlerUtil.getActiveShell(event), null) { @Override protected void configureTableViewer(TableViewer viewer) { Assert.isNotNull(viewer); @@ -80,7 +80,7 @@ public class RedirectHandler extends AbstractHandler { filter.add(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { - if (peerModel.equals(element)) { + if (peerNode.equals(element)) { return false; } return true; @@ -97,13 +97,13 @@ public class RedirectHandler extends AbstractHandler { selection = dialog.getSelection(); if (selection instanceof IStructuredSelection && !selection.isEmpty()) { candidate = ((IStructuredSelection)selection).getFirstElement(); - if (candidate instanceof IPeerModel) { - final IPeerModel proxy = (IPeerModel)candidate; + if (candidate instanceof IPeerNode) { + final IPeerNode proxy = (IPeerNode)candidate; Protocol.invokeLater(new Runnable() { @Override public void run() { - redirect(peerModel, proxy); + redirect(peerNode, proxy); DisplayUtil.safeAsyncExec(new Runnable() { @Override @@ -111,7 +111,7 @@ public class RedirectHandler extends AbstractHandler { IWorkbenchPart part = HandlerUtil.getActivePart(event); if (part instanceof CommonNavigator) { CommonNavigator navigator = (CommonNavigator)part; - navigator.selectReveal(new StructuredSelection(peerModel)); + navigator.selectReveal(new StructuredSelection(peerNode)); } } }); @@ -132,19 +132,19 @@ public class RedirectHandler extends AbstractHandler { * <p> * The method must be called from within the TCF dispatch thread. * - * @param peerModel The peer to redirect. Must not be <code>null</code>. + * @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(IPeerModel peerModel, IPeerModel proxy) { - Assert.isNotNull(peerModel); + 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(peerModel.getPeer().getAttributes()); + attributes.putAll(peerNode.getPeer().getAttributes()); // Set the redirection - attributes.put(IPeerModelProperties.PROP_REDIRECT_PROXY, proxy.getPeerId()); + attributes.put(IPeerNodeProperties.PROP_REDIRECT_PROXY, proxy.getPeerId()); try { IURIPersistenceService uRIPersistenceService = ServiceManager.getInstance().getService(IURIPersistenceService.class); @@ -156,22 +156,22 @@ public class RedirectHandler extends AbstractHandler { // Create a peer redirector PeerRedirector redirector = new PeerRedirector(proxy.getPeer(), attributes); // And update the instance - peerModel.setProperty(IPeerModelProperties.PROP_INSTANCE, redirector); + peerNode.setProperty(IPeerNodeProperties.PROP_INSTANCE, redirector); // Associate proxy (parent) and peer model (child) - peerModel.setParent(proxy); - Model.getModel().getService(ILocatorModelUpdateService.class).addChild(peerModel); + 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(ILocatorModelRefreshService.class).refresh(null); + 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), peerModel, template, + 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 2fc20540a..bbc12e44a 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 @@ -27,9 +27,9 @@ 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.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; +import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelRefreshService; import org.eclipse.tcf.te.ui.views.ViewsUtil; import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants; import org.eclipse.ui.handlers.HandlerUtil; @@ -72,18 +72,18 @@ public class RefreshHandler extends AbstractHandler { // The selection must be a structured selection and must not be empty if (selection instanceof IStructuredSelection && !selection.isEmpty()) { // The list of locator model instances to refresh - List<ILocatorModel> locatorToRefresh = new ArrayList<ILocatorModel>(); - List<IPeerModel> peerToRefresh = new ArrayList<IPeerModel>(); + List<IPeerModel> locatorToRefresh = new ArrayList<IPeerModel>(); + List<IPeerNode> peerToRefresh = new ArrayList<IPeerNode>(); // Iterate the selection and determine the model instances Iterator<?> iterator = ((IStructuredSelection)selection).iterator(); while (iterator.hasNext()) { Object element = iterator.next(); - Assert.isTrue(element instanceof IPeerModel); - IPeerModel node = (IPeerModel)element; + Assert.isTrue(element instanceof IPeerNode); + IPeerNode node = (IPeerNode)element; // Get the associated locator model of the node - ILocatorModel model = (ILocatorModel)node.getAdapter(ILocatorModel.class); + IPeerModel model = (IPeerModel)node.getAdapter(IPeerModel.class); Assert.isNotNull(model); // If not yet in the list, add it if (!locatorToRefresh.contains(model)) { @@ -97,14 +97,14 @@ public class RefreshHandler extends AbstractHandler { // Trigger an refresh on all determined models and wait for the // refresh to complete. Once completed, fire the parent callback. AsyncCallbackCollector collector = new AsyncCallbackCollector(callback, new CallbackInvocationDelegate()); - for (ILocatorModel model : locatorToRefresh) { - final ILocatorModel finModel = model; + for (IPeerModel model : locatorToRefresh) { + final IPeerModel finModel = model; final ICallback innerCallback = new AsyncCallbackCollector.SimpleCollectorCallback(collector); Runnable runnable = new Runnable() { @Override public void run() { - finModel.getService(ILocatorModelRefreshService.class).refresh(new Callback() { + finModel.getService(IPeerModelRefreshService.class).refresh(new Callback() { @Override protected void internalDone(Object caller, IStatus status) { innerCallback.done(this, Status.OK_STATUS); @@ -115,8 +115,8 @@ public class RefreshHandler extends AbstractHandler { Protocol.invokeLater(runnable); } - for (IPeerModel model : peerToRefresh) { - final IPeerModel finModel = model; + for (IPeerNode model : peerToRefresh) { + final IPeerNode finModel = model; final ICallback innerCallback = new AsyncCallbackCollector.SimpleCollectorCallback(collector); Runnable runnable = new Runnable() { 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 cdb86621f..3a7be0ccf 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 @@ -38,10 +38,10 @@ 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.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +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.nodes.PeerRedirector; import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds; @@ -103,8 +103,8 @@ public class RenameHandler extends AbstractHandler { Iterator<?> iterator = ((IStructuredSelection)selection).iterator(); while (iterator.hasNext()) { Object element = iterator.next(); - Assert.isTrue(element instanceof IPeerModel); - final IPeerModel node = (IPeerModel)element; + Assert.isTrue(element instanceof IPeerNode); + final IPeerNode node = (IPeerNode)element; RenameDialog dialog = createRenameDialog(shell, node); int ok = dialog.open(); @@ -135,7 +135,7 @@ public class RenameHandler extends AbstractHandler { IPeer newPeer = oldPeer instanceof PeerRedirector ? new PeerRedirector(((PeerRedirector)oldPeer).getParent(), attributes) : new Peer(attributes); // Update the peer node instance (silently) boolean changed = node.setChangeEventsEnabled(false); - node.setProperty(IPeerModelProperties.PROP_INSTANCE, newPeer); + node.setProperty(IPeerNodeProperties.PROP_INSTANCE, newPeer); if (changed) { node.setChangeEventsEnabled(true); } @@ -174,7 +174,7 @@ public class RenameHandler extends AbstractHandler { Protocol.invokeLater(new Runnable() { @Override public void run() { - final ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); + final IPeerModelRefreshService service = Model.getModel().getService(IPeerModelRefreshService.class); // Refresh the model now (must be executed within the TCF dispatch thread) if (service != null) { service.refresh(new Callback() { @@ -204,7 +204,7 @@ public class RenameHandler extends AbstractHandler { * * @return The renaming dialog. */ - private RenameDialog createRenameDialog(final Shell shell, final IPeerModel node) { + private RenameDialog createRenameDialog(final Shell shell, final IPeerNode node) { Assert.isNotNull(node); final AtomicReference<String> name = new AtomicReference<String>(); @@ -215,17 +215,15 @@ public class RenameHandler extends AbstractHandler { public void run() { name.set(node.getPeer().getName()); - ILocatorModel model = Model.getModel(); + IPeerModel model = Model.getModel(); Assert.isNotNull(model); - IPeerModel[] peers = model.getPeers(); - for (IPeerModel peer : peers) { - if (peer.isStatic()) { + IPeerNode[] peers = model.getPeers(); + for (IPeerNode peer : peers) { String name = peer.getPeer().getName(); Assert.isNotNull(name); if (!"".equals(name) && !usedNames.contains(name)) { //$NON-NLS-1$ usedNames.add(name.trim().toUpperCase()); } - } } } }; 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 index 754d5d94e..c1229abf8 100644 --- 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 @@ -27,10 +27,10 @@ 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.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService; +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; @@ -51,13 +51,13 @@ public class ResetRedirectHandler extends AbstractHandler { if (selection instanceof IStructuredSelection && !selection.isEmpty()) { // Redirect is supporting single selection only Object candidate = ((IStructuredSelection)selection).getFirstElement(); - if (candidate instanceof IPeerModel) { - final IPeerModel peerModel = (IPeerModel)candidate; + if (candidate instanceof IPeerNode) { + final IPeerNode peerNode = (IPeerNode)candidate; Protocol.invokeLater(new Runnable() { @Override public void run() { - resetRedirect(peerModel); + resetRedirect(peerNode); } }); } @@ -71,19 +71,19 @@ public class ResetRedirectHandler extends AbstractHandler { * <p> * The method must be called from within the TCF dispatch thread. * - * @param peerModel The peer to reset. Must not be <code>null</code>. + * @param peerNode The peer to reset. Must not be <code>null</code>. */ - public void resetRedirect(IPeerModel peerModel) { - Assert.isNotNull(peerModel); + 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(peerModel.getPeer().getAttributes()); + attributes.putAll(peerNode.getPeer().getAttributes()); // Redirection set? - if (attributes.get(IPeerModelProperties.PROP_REDIRECT_PROXY) != null) { + if (attributes.get(IPeerNodeProperties.PROP_REDIRECT_PROXY) != null) { // Remove the redirection - attributes.remove(IPeerModelProperties.PROP_REDIRECT_PROXY); + attributes.remove(IPeerNodeProperties.PROP_REDIRECT_PROXY); try { // Save it @@ -96,22 +96,22 @@ public class ResetRedirectHandler extends AbstractHandler { uRIPersistenceService.write(peer, null); // And update the instance - peerModel.setProperty(IPeerModelProperties.PROP_INSTANCE, peer); + peerNode.setProperty(IPeerNodeProperties.PROP_INSTANCE, peer); // Reset proxy (parent) and peer model (child) association - Model.getModel().getService(ILocatorModelUpdateService.class).removeChild(peerModel); - peerModel.setParent(null); + 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(ILocatorModelRefreshService.class).refresh(null); + 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), peerModel, template, + 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/handler/StartDebugCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java index 3d62cd087..b53aaa320 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java @@ -30,7 +30,7 @@ import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService; import org.eclipse.tcf.te.runtime.services.interfaces.IDelegateService; -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.steps.StartDebuggerStep.IDelegate; import org.eclipse.tcf.te.ui.async.UICallbackInvocationDelegate; import org.eclipse.ui.IEditorInput; @@ -78,8 +78,8 @@ public class StartDebugCommandHandler extends AbstractHandler { Iterator<?> iterator = ((IStructuredSelection)selection).iterator(); while (iterator.hasNext()) { final Object element = iterator.next(); - if (element instanceof IPeerModel) { - startDebugger((IPeerModel)element, new AsyncCallbackCollector.SimpleCollectorCallback(collector)); + if (element instanceof IPeerNode) { + startDebugger((IPeerNode)element, new AsyncCallbackCollector.SimpleCollectorCallback(collector)); } } @@ -93,26 +93,26 @@ public class StartDebugCommandHandler extends AbstractHandler { /** * Starts the debugger for the given peer model node. * - * @param peerModel The peer model node. Must not be <code>null</code>. + * @param peerNode The peer model node. Must not be <code>null</code>. * @param callback The callback. Must not be <code>null</code>. */ - public void startDebugger(final IPeerModel peerModel, final ICallback callback) { - Assert.isNotNull(peerModel); + public void startDebugger(final IPeerNode peerNode, final ICallback callback) { + Assert.isNotNull(peerNode); Assert.isNotNull(callback); - IDebugService dbgService = ServiceManager.getInstance().getService(peerModel, IDebugService.class, false); + IDebugService dbgService = ServiceManager.getInstance().getService(peerNode, IDebugService.class, false); if (dbgService != null) { final IProgressMonitor monitor = new NullProgressMonitor(); IPropertiesContainer props = new PropertiesContainer(); - dbgService.attach(peerModel, props, monitor, new Callback() { + dbgService.attach(peerNode, props, monitor, new Callback() { @Override protected void internalDone(Object caller, IStatus status) { // Check if there is a delegate registered - IDelegateService service = ServiceManager.getInstance().getService(peerModel, IDelegateService.class, false); - IDelegate delegate = service != null ? service.getDelegate(peerModel, IDelegate.class) : null; + IDelegateService service = ServiceManager.getInstance().getService(peerNode, IDelegateService.class, false); + IDelegate delegate = service != null ? service.getDelegate(peerNode, IDelegate.class) : null; if (delegate != null) { - delegate.postAttachDebugger(peerModel, monitor, callback); + delegate.postAttachDebugger(peerNode, monitor, callback); } else { callback.done(caller, status); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java index ce19cfe2a..4869fb75b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java @@ -45,7 +45,7 @@ public interface IContextHelpIds { /** * TCF agent selection dialog. */ - public final static String AGENT_SELECTION_DIALOG = PREFIX + "AgentSelectionDialog"; //$NON-NLS-1$ + public final static String AGENT_SELECTION_DIALOG = PREFIX + "PeerSelectionDialog"; //$NON-NLS-1$ // ***** Message dialog boxes ***** diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/PropertyTester.java index 072d2142f..f52a2153d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/PropertyTester.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/PropertyTester.java @@ -11,7 +11,7 @@ package org.eclipse.tcf.te.tcf.ui.internal; import org.eclipse.core.runtime.Assert; import org.eclipse.jface.viewers.IStructuredSelection; -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.utils.SimulatorUtils; import org.eclipse.tcf.te.tcf.ui.handler.DeleteHandler; import org.eclipse.tcf.te.ui.views.navigator.nodes.NewWizardNode; @@ -39,8 +39,8 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester return ((NewWizardNode)receiver).getWizardId().equals(expectedValue); } - if ("isValidSimulatorConfig".equals(property) && receiver instanceof IPeerModel && expectedValue instanceof Boolean) { //$NON-NLS-1$ - SimulatorUtils.Result simulator = SimulatorUtils.getSimulatorService((IPeerModel)receiver); + if ("isValidSimulatorConfig".equals(property) && receiver instanceof IPeerNode && expectedValue instanceof Boolean) { //$NON-NLS-1$ + SimulatorUtils.Result simulator = SimulatorUtils.getSimulatorService((IPeerNode)receiver); boolean valid = simulator != null && simulator.service.isValidConfig(receiver, simulator.settings); return ((Boolean)expectedValue).booleanValue() == valid; } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java index 232c654eb..4aaea8277 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java @@ -11,7 +11,7 @@ package org.eclipse.tcf.te.tcf.ui.internal.adapters; import org.eclipse.core.runtime.IAdapterFactory; import org.eclipse.jface.viewers.ILabelProvider; -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.ui.views.editor.EditorInput; import org.eclipse.tcf.te.ui.views.interfaces.IEditorSaveAsAdapter; import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable; @@ -32,7 +32,7 @@ public class AdapterFactory implements IAdapterFactory { ILabelProvider.class, IPersistableElement.class, ICategorizable.class, - IPeerModel.class, + IPeerNode.class, IEditorSaveAsAdapter.class }; @@ -41,12 +41,12 @@ public class AdapterFactory implements IAdapterFactory { */ @Override public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adaptableObject instanceof IPeerModel) { + if (adaptableObject instanceof IPeerNode) { if (ILabelProvider.class.equals(adapterType)) { return labelProvider; } if (IPersistableElement.class.equals(adapterType)) { - return new PersistablePeerModel((IPeerModel)adaptableObject); + return new PersistablePeerNode((IPeerNode)adaptableObject); } if (ICategorizable.class.equals(adapterType)) { return new CategorizableAdapter(adaptableObject); @@ -55,7 +55,7 @@ public class AdapterFactory implements IAdapterFactory { } if (adaptableObject instanceof EditorInput) { - if (IPeerModel.class.equals(adapterType)) { + if (IPeerNode.class.equals(adapterType)) { return ((EditorInput)adaptableObject).getAdapter(adapterType); } if (IEditorSaveAsAdapter.class.equals(adapterType)) { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/CategorizableAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/CategorizableAdapter.java index 5470f8023..783e3ab78 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/CategorizableAdapter.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/CategorizableAdapter.java @@ -9,11 +9,8 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.ui.internal.adapters; -import java.util.concurrent.atomic.AtomicBoolean; - import org.eclipse.core.runtime.Assert; -import org.eclipse.tcf.protocol.Protocol; -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.ui.views.Managers; import org.eclipse.tcf.te.ui.views.interfaces.ICategory; import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants; @@ -41,8 +38,8 @@ public class CategorizableAdapter implements ICategorizable { */ @Override public String getId() { - if (element instanceof IPeerModel) { - return ((IPeerModel)element).getPeerId(); + if (element instanceof IPeerNode) { + return ((IPeerNode)element).getPeerId(); } return null; } @@ -55,7 +52,7 @@ public class CategorizableAdapter implements ICategorizable { Assert.isNotNull(operation); Assert.isNotNull(category); - if (element instanceof IPeerModel) { + if (element instanceof IPeerNode) { // ADD: Parent and destination category are the same -> not valid if (OPERATION.ADD.equals(operation) && category.equals(parentCategory)) { return false; @@ -63,26 +60,6 @@ public class CategorizableAdapter implements ICategorizable { // ALL: Static peer's cannot be removed from or added to "My Targets" if (IUIConstants.ID_CAT_MY_TARGETS.equals(category.getId())) { - final AtomicBoolean isStatic = new AtomicBoolean(); - - Runnable runnable = new Runnable() { - @Override - public void run() { - isStatic.set(((IPeerModel)element).isStatic()); - } - }; - - if (Protocol.isDispatchThread()) { - runnable.run(); - } - else { - Protocol.invokeAndWait(runnable); - } - - if (isStatic.get()) { - return false; - } - return true; } @@ -103,7 +80,7 @@ public class CategorizableAdapter implements ICategorizable { Assert.isNotNull(operation); Assert.isNotNull(category); - if (element instanceof IPeerModel) { + if (element instanceof IPeerNode) { // ADD: element belongs to category -> not enabled if (OPERATION.ADD.equals(operation) && Managers.getCategoryManager().belongsTo(category.getId(), getId())) { 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 50e5425b8..849638109 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 @@ -32,9 +32,9 @@ import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableNodePropert import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +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.ui.nls.Messages; import org.eclipse.tcf.te.ui.dialogs.RenameDialog; @@ -60,8 +60,8 @@ public class EditorSaveAsAdapter implements IEditorSaveAsAdapter { */ @Override public boolean isSaveAsAllowed(IEditorInput input) { - IPeerModel peerModel = (IPeerModel)input.getAdapter(IPeerModel.class); - if (peerModel != null) return peerModel.isStatic(); + IPeerNode peerNode = (IPeerNode)input.getAdapter(IPeerNode.class); + if (peerNode != null) return true; return false; } @@ -71,7 +71,7 @@ public class EditorSaveAsAdapter implements IEditorSaveAsAdapter { */ @Override public Object doSaveAs(IEditorInput input) { - IPeerModel model = (IPeerModel)input.getAdapter(IPeerModel.class); + IPeerNode model = (IPeerNode)input.getAdapter(IPeerNode.class); if (model != null) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); @@ -103,12 +103,12 @@ public class EditorSaveAsAdapter implements IEditorSaveAsAdapter { } persistenceService.write(new Peer(attrs), null); - final AtomicReference<IPeerModel> newPeer = new AtomicReference<IPeerModel>(); + final AtomicReference<IPeerNode> newPeer = new AtomicReference<IPeerNode>(); final Callback cb = new Callback() { @Override protected void internalDone(Object caller, IStatus status) { // Get the peer model node from the model and select it in the tree - IPeerModel peerNode = Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID)); + IPeerNode peerNode = Model.getModel().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() { - ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); + IPeerModelRefreshService service = Model.getModel().getService(IPeerModelRefreshService.class); // Refresh the model now (must be executed within the TCF dispatch thread) if (service != null) { service.refresh(cb); @@ -150,16 +150,14 @@ public class EditorSaveAsAdapter implements IEditorSaveAsAdapter { @Override public void run() { // Get all peer model objects - IPeerModel[] peers = Model.getModel().getPeers(); + IPeerNode[] peers = Model.getModel().getPeers(); // Loop them and find the ones which are of our handled types - for (IPeerModel peerModel : peers) { - if (peerModel.isStatic()) { - String name = peerModel.getPeer().getName(); + for (IPeerNode peerNode : peers) { + String name = peerNode.getPeer().getName(); Assert.isNotNull(name); if (!"".equals(name) && !usedNames.contains(name)) { //$NON-NLS-1$ usedNames.add(name.trim().toUpperCase()); } - } } } }; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerModelFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerNodeFactory.java index 64b3b90f3..6275b7643 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerModelFactory.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PeerNodeFactory.java @@ -14,11 +14,11 @@ import java.util.concurrent.atomic.AtomicReference; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.tcf.protocol.Protocol; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelPeerNodeQueryService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +import org.eclipse.tcf.te.tcf.locator.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.ui.views.editor.EditorInput; import org.eclipse.ui.IElementFactory; @@ -30,20 +30,20 @@ import org.eclipse.ui.internal.part.NullEditorInput; * from an external persistent storage and holds a peer id. */ @SuppressWarnings("restriction") -public class PeerModelFactory implements IElementFactory { +public class PeerNodeFactory implements IElementFactory { /* (non-Javadoc) * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento) */ @Override public IAdaptable createElement(IMemento memento) { - final AtomicReference<IPeerModel> node = new AtomicReference<IPeerModel>(); + final AtomicReference<IPeerNode> node = new AtomicReference<IPeerNode>(); final String peerId = memento.getString("peerId"); //$NON-NLS-1$ if (peerId != null) { Runnable runnable = new Runnable() { @Override public void run() { - node.set(Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId)); + node.set(Model.getModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId)); } }; @@ -60,8 +60,8 @@ public class PeerModelFactory implements IElementFactory { Runnable runnable2 = new Runnable() { @Override public void run() { - Model.getModel().getService(ILocatorModelRefreshService.class).refresh(null); - node.set(Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId)); + Model.getModel().getService(IPeerModelRefreshService.class).refresh(null); + node.set(Model.getModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId)); } }; @@ -69,8 +69,8 @@ public class PeerModelFactory implements IElementFactory { } if (node.get() != null) { - ILocatorModel model = node.get().getModel(); - ILocatorModelPeerNodeQueryService queryService = model.getService(ILocatorModelPeerNodeQueryService.class); + IPeerModel model = node.get().getModel(); + IPeerModelQueryService queryService = model.getService(IPeerModelQueryService.class); queryService.queryRemoteServices(node.get()); } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PersistablePeerModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PersistablePeerNode.java index 82d155f55..78749b345 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PersistablePeerModel.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/PersistablePeerNode.java @@ -9,24 +9,22 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.ui.internal.adapters; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; import org.eclipse.ui.IMemento; import org.eclipse.ui.IPersistableElement; /** - * The persistable element implementation for an IPeerModel. + * The persistable element implementation for an IPeerNode. */ -public class PersistablePeerModel implements IPersistableElement { +public class PersistablePeerNode implements IPersistableElement { // The peer model to be persisted. - private IPeerModel peerModel; - private boolean isStatic; + private IPeerNode peerNode; /** * Constructor */ - public PersistablePeerModel(IPeerModel peerModel) { - this.peerModel = peerModel; - isStatic = peerModel.isStatic(); + public PersistablePeerNode(IPeerNode peerNode) { + this.peerNode = peerNode; } /* @@ -35,9 +33,7 @@ public class PersistablePeerModel implements IPersistableElement { */ @Override public void saveState(IMemento memento) { - if (isStatic) { - memento.putString("peerId", peerModel.getPeerId()); //$NON-NLS-1$ - } + memento.putString("peerId", peerNode.getPeerId()); //$NON-NLS-1$ } /* @@ -46,9 +42,6 @@ public class PersistablePeerModel implements IPersistableElement { */ @Override public String getFactoryId() { - if (isStatic) { - return "org.eclipse.tcf.te.ui.views.peerFactory"; //$NON-NLS-1$ - } - return null; + return "org.eclipse.tcf.te.ui.views.peerFactory"; //$NON-NLS-1$ } } 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 8b22e38a3..159847634 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 @@ -25,11 +25,11 @@ import org.eclipse.tcf.te.runtime.events.EventManager; import org.eclipse.tcf.te.runtime.persistence.history.HistoryManager; import org.eclipse.tcf.te.runtime.services.AbstractService; import org.eclipse.tcf.te.tcf.core.interfaces.IPeerType; -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.IPeerModelProperties; +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.ILocatorModelLookupService; +import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService; import org.eclipse.tcf.te.tcf.locator.model.Model; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; @@ -54,8 +54,8 @@ public class DefaultContextService extends AbstractService implements IDefaultCo * @see org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService#getCandidates(java.lang.Object, org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService.IContextFilter) */ @Override - public IPeerModel[] getCandidates(Object currentSelection, IContextFilter filter) { - List<IPeerModel> candidates = new ArrayList<IPeerModel>(); + public IPeerNode[] getCandidates(Object currentSelection, IContextFilter filter) { + List<IPeerNode> candidates = new ArrayList<IPeerNode>(); // add given selection first if (currentSelection instanceof IStructuredSelection) { @@ -71,26 +71,26 @@ public class DefaultContextService extends AbstractService implements IDefaultCo // add system management selection addCandidates(getPartSelection(PART_ID_TE_VIEW), filter, candidates); - return candidates.toArray(new IPeerModel[candidates.size()]); + return candidates.toArray(new IPeerNode[candidates.size()]); } /* (non-Javadoc) - * @see org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService#setDefaultContext(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel) + * @see org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService#setDefaultContext(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode) */ @Override - public void setDefaultContext(final IPeerModel peerModel) { - if (peerModel != null) { - HistoryManager.getInstance().add(getClass().getName(), peerModel.getPeerId()); - EventManager.getInstance().fireEvent(new ChangeEvent(this, ChangeEvent.ID_ADDED, peerModel, peerModel)); + public void setDefaultContext(final IPeerNode peerNode) { + if (peerNode != null) { + HistoryManager.getInstance().add(getClass().getName(), peerNode.getPeerId()); + EventManager.getInstance().fireEvent(new ChangeEvent(this, ChangeEvent.ID_ADDED, peerNode, peerNode)); final AtomicReference<String> type = new AtomicReference<String>(); Protocol.invokeAndWait(new Runnable() { @Override public void run() { - type.set(peerModel.getPeer().getAttributes().get((IPeerModelProperties.PROP_TYPE))); + type.set(peerNode.getPeer().getAttributes().get((IPeerNodeProperties.PROP_TYPE))); } }); - HistoryManager.getInstance().add(type.get() != null ? type.get() : IPeerType.TYPE_GENERIC, peerModel.getPeerId()); + HistoryManager.getInstance().add(type.get() != null ? type.get() : IPeerType.TYPE_GENERIC, peerNode.getPeerId()); } else { HistoryManager.getInstance().clear(getClass().getName()); @@ -102,11 +102,11 @@ public class DefaultContextService extends AbstractService implements IDefaultCo * @see org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService#getDefaultContext(org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService.IContextFilter) */ @Override - public IPeerModel getDefaultContext(IContextFilter filter) { + public IPeerNode getDefaultContext(IContextFilter filter) { for (String peerId : HistoryManager.getInstance().getHistory(getClass().getName())) { - IPeerModel peerModel = addCandidate(getPeerModel(peerId), filter, null); - if (peerModel != null) { - return peerModel; + IPeerNode peerNode = addCandidate(getPeerModel(peerId), filter, null); + if (peerNode != null) { + return peerNode; } } @@ -114,52 +114,52 @@ public class DefaultContextService extends AbstractService implements IDefaultCo } - private IPeerModel addCandidate(IPeerModel peerModel, IContextFilter filter, List<IPeerModel> candidates) { - if (peerModel != null && (filter == null || filter.select(peerModel))) { - if (candidates != null && !candidates.contains(peerModel)) { - candidates.add(peerModel); + private IPeerNode addCandidate(IPeerNode peerNode, IContextFilter filter, List<IPeerNode> candidates) { + if (peerNode != null && (filter == null || filter.select(peerNode))) { + if (candidates != null && !candidates.contains(peerNode)) { + candidates.add(peerNode); } - return peerModel; + return peerNode; } return null; } - private void addCandidates(IStructuredSelection selection, IContextFilter filter, List<IPeerModel> candidates) { + private void addCandidates(IStructuredSelection selection, IContextFilter filter, List<IPeerNode> candidates) { if (selection != null) { Iterator<Object> it = selection.iterator(); while (it.hasNext()) { - addCandidate((IPeerModel)Platform.getAdapterManager().getAdapter(it.next(), IPeerModel.class), filter, candidates); + addCandidate((IPeerNode)Platform.getAdapterManager().getAdapter(it.next(), IPeerNode.class), filter, candidates); } } } - private void addCandidates(IPeerModel[] peerModels, IContextFilter filter, List<IPeerModel> candidates) { - for (IPeerModel peerModel : peerModels) { - addCandidate(peerModel, filter, candidates); + private void addCandidates(IPeerNode[] peerModels, IContextFilter filter, List<IPeerNode> candidates) { + for (IPeerNode peerNode : peerModels) { + addCandidate(peerNode, filter, candidates); } } - private IPeerModel[] getDefaultSelections(IContextFilter filter) { - List<IPeerModel> candidates = new ArrayList<IPeerModel>(); + private IPeerNode[] getDefaultSelections(IContextFilter filter) { + List<IPeerNode> candidates = new ArrayList<IPeerNode>(); for (String peerId : HistoryManager.getInstance().getHistory(getClass().getName())) { addCandidate(getPeerModel(peerId), filter, candidates); } - return candidates.toArray(new IPeerModel[candidates.size()]); + return candidates.toArray(new IPeerNode[candidates.size()]); } - private IPeerModel getPeerModel(final String peerId) { + private IPeerNode getPeerModel(final String peerId) { if (peerId != null) { - final AtomicReference<IPeerModel> peerModel = new AtomicReference<IPeerModel>(); + final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>(); Runnable runnable = new Runnable() { @Override public void run() { - ILocatorModel model = Model.getModel(); + IPeerModel model = Model.getModel(); Assert.isNotNull(model); - peerModel.set(model.getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId)); + peerNode.set(model.getService(IPeerModelLookupService.class).lkupPeerModelById(peerId)); } }; @@ -170,7 +170,7 @@ public class DefaultContextService extends AbstractService implements IDefaultCo Protocol.invokeAndWait(runnable); } - return peerModel.get(); + return peerNode.get(); } return null; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSection.java index 9c6d99210..f7d27346d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSection.java @@ -19,7 +19,7 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; -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.ui.forms.CustomFormToolkit; import org.eclipse.tcf.te.ui.tables.TableViewerComparator; import org.eclipse.tcf.te.ui.tables.properties.NodePropertiesTableControl; @@ -32,7 +32,7 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; */ public class PeerGeneralSection extends AbstractPropertySection { // The peer to be displayed. - private IPeerModel peer; + private IPeerNode peer; // The table control to display the properties. private NodePropertiesTableControl tableControl; // The form toolkit @@ -90,9 +90,9 @@ public class PeerGeneralSection extends AbstractPropertySection { super.setInput(part, selection); Assert.isTrue(selection instanceof IStructuredSelection); Object input = ((IStructuredSelection) selection).getFirstElement(); - this.peer = (IPeerModel)Platform.getAdapterManager().getAdapter(input, IPeerModel.class); - // Assert.isTrue(input instanceof IPeerModel); - // this.peer = (IPeerModel) input; + this.peer = (IPeerNode)Platform.getAdapterManager().getAdapter(input, IPeerNode.class); + // Assert.isTrue(input instanceof IPeerNode); + // this.peer = (IPeerNode) input; } /* (non-Javadoc) diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionContentProvider.java index 8d42bebd0..3f26b714b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionContentProvider.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionContentProvider.java @@ -26,7 +26,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.runtime.services.interfaces.IUIService; -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.ui.interfaces.services.INodePropertiesTableFilterUIDelegate; import org.eclipse.tcf.te.ui.tables.properties.NodePropertiesTableTableNode; import org.eclipse.tcf.te.ui.views.extensions.LabelProviderDelegateExtensionPointManager; @@ -65,7 +65,7 @@ public class PeerGeneralSectionContentProvider implements IStructuredContentProv public Object[] getElements(final Object inputElement) { List<NodePropertiesTableTableNode> nodes = new ArrayList<NodePropertiesTableTableNode>(); - if (inputElement instanceof IPeerModel) { + if (inputElement instanceof IPeerNode) { // Get the associated label provider IUIService service = ServiceManager.getInstance().getService(inputElement, IUIService.class); ILabelProvider provider = service != null ? service.getDelegate(inputElement, ILabelProvider.class) : null; @@ -74,12 +74,12 @@ public class PeerGeneralSectionContentProvider implements IStructuredContentProv final Map<String, Object> properties = new HashMap<String, Object>(); // And get all native properties of the peer if (Protocol.isDispatchThread()) { - properties.putAll(((IPeerModel)inputElement).getPeer().getAttributes()); + properties.putAll(((IPeerNode)inputElement).getPeer().getAttributes()); } else { Protocol.invokeAndWait(new Runnable() { @Override public void run() { - properties.putAll(((IPeerModel)inputElement).getPeer().getAttributes()); + properties.putAll(((IPeerNode)inputElement).getPeer().getAttributes()); } }); } @@ -145,10 +145,10 @@ public class PeerGeneralSectionContentProvider implements IStructuredContentProv } // If the input is a peer model node, set it directly - if (newInput instanceof IPeerModel) element = newInput; + if (newInput instanceof IPeerNode) element = newInput; // Determine the section header text - if (element instanceof IPeerModel) { + if (element instanceof IPeerNode) { sectionTitle = NLS.bind(org.eclipse.tcf.te.ui.nls.Messages.NodePropertiesTableControl_section_title, "Peer"); //$NON-NLS-1$ } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionFilter.java index e1709f7ee..2d0209f2d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionFilter.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionFilter.java @@ -11,7 +11,7 @@ package org.eclipse.tcf.te.tcf.ui.internal.tabbed; import org.eclipse.jface.viewers.IFilter; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; /** * Peer model node general section filter implementation. @@ -23,7 +23,7 @@ public class PeerGeneralSectionFilter implements IFilter { */ @Override public boolean select(Object element) { - return element instanceof IPeerModel; + return element instanceof IPeerNode; } } 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 0aea57a77..4690431d8 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 @@ -28,12 +28,12 @@ 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.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; +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.ILocatorModelLookupService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +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.ui.activator.UIPlugin; import org.eclipse.tcf.te.tcf.ui.internal.preferences.IPreferenceKeys; @@ -102,13 +102,13 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent /** * Determines if the given peer model node is a value-add. * - * @param peerModel The peer model node. Must not be <code>null</code>. + * @param peerNode The peer model node. Must not be <code>null</code>. * @return <code>True</code> if the peer model node is a value-add, <code>false</code> otherwise. */ - /* default */ final boolean isValueAdd(IPeerModel peerModel) { - Assert.isNotNull(peerModel); + /* default */ final boolean isValueAdd(IPeerNode peerNode) { + Assert.isNotNull(peerNode); - String value = peerModel.getPeer().getAttributes().get("ValueAdd"); //$NON-NLS-1$ + String value = peerNode.getPeer().getAttributes().get("ValueAdd"); //$NON-NLS-1$ boolean isValueAdd = value != null && ("1".equals(value.trim()) || Boolean.parseBoolean(value.trim())); //$NON-NLS-1$ return isValueAdd; @@ -117,22 +117,22 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent /** * Determines if the given peer model node is filtered from the view completely. * - * @param peerModel The peer model node. Must not be <code>null</code>. + * @param peerNode The peer model node. Must not be <code>null</code>. * @return <code>True</code> if filtered, <code>false</code> otherwise. */ - /* default */ final boolean isFiltered(IPeerModel peerModel) { - Assert.isNotNull(peerModel); + /* default */ final boolean isFiltered(IPeerNode peerNode) { + Assert.isNotNull(peerNode); boolean filtered = false; boolean hideValueAdds = CoreBundleActivator.getScopedPreferences().getBoolean(org.eclipse.tcf.te.tcf.locator.interfaces.preferences.IPreferenceKeys.PREF_HIDE_VALUEADDS); - filtered |= isValueAdd(peerModel) && hideValueAdds; + filtered |= isValueAdd(peerNode) && hideValueAdds; if (!showInvisible) { - filtered |= !peerModel.isVisible(); + filtered |= !peerNode.isVisible(); } - filtered |= peerModel.getPeer().getName() != null - && peerModel.getPeer().getName().endsWith("Command Server"); //$NON-NLS-1$ + filtered |= peerNode.getPeer().getName() != null + && peerNode.getPeer().getName().endsWith("Command Server"); //$NON-NLS-1$ return filtered; } @@ -169,13 +169,13 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent } // If it is the locator model, get the peers - if (parentElement instanceof ILocatorModel) { - final ILocatorModel model = (ILocatorModel)parentElement; - final IPeerModel[] peers = model.getPeers(); - final List<IPeerModel> candidates = new ArrayList<IPeerModel>(); + if (parentElement instanceof IPeerModel) { + final IPeerModel model = (IPeerModel)parentElement; + final IPeerNode[] peers = model.getPeers(); + final List<IPeerNode> candidates = new ArrayList<IPeerNode>(); if (IUIConstants.ID_CAT_FAVORITES.equals(catID)) { - for (IPeerModel peer : peers) { + for (IPeerNode peer : peers) { ICategorizable categorizable = (ICategorizable)peer.getAdapter(ICategorizable.class); if (categorizable == null) { categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peer, ICategorizable.class); @@ -189,7 +189,7 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent } } else if (IUIConstants.ID_CAT_MY_TARGETS.equals(catID)) { - for (IPeerModel peer : peers) { + for (IPeerNode peer : peers) { // Check for filtered nodes (Value-add's and Proxies) if (isFiltered(peer)) { continue; @@ -201,8 +201,6 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent } Assert.isNotNull(categorizable); - boolean isStatic = peer.isStatic(); - // 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) { @@ -213,7 +211,7 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent } boolean isMyTargets = Managers.getCategoryManager().belongsTo(catID, categorizable.getId()); - if (!isMyTargets && (isStatic || startedByCurrentUser)) { + if (!isMyTargets && startedByCurrentUser) { // "Value-add's" are not saved to the category persistence automatically Managers.getCategoryManager().addTransient(catID, categorizable.getId()); isMyTargets = true; @@ -225,42 +223,40 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent } } else if (IUIConstants.ID_CAT_NEIGHBORHOOD.equals(catID)) { - for (IPeerModel peer : peers) { - // Check for filtered nodes (Value-add's and Proxies) - if (isFiltered(peer)) { - continue; - } - - ICategorizable categorizable = (ICategorizable)peer.getAdapter(ICategorizable.class); - if (categorizable == null) { - categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peer, ICategorizable.class); - } - Assert.isNotNull(categorizable); - - boolean isStatic = peer.isStatic(); - - boolean startedByCurrentUser = System.getProperty("user.name").equals(peer.getPeer().getUserName()); //$NON-NLS-1$ - if (startedByCurrentUser) { - // If the "My Targets" category is not visible, ignore the startedByCurrentUser flag - if (myTargetsCat != null && !myTargetsCat.isEnabled()) { - startedByCurrentUser = false; - } - } - - boolean isNeighborhood = Managers.getCategoryManager().belongsTo(catID, categorizable.getId()); - if (!isNeighborhood && !isStatic && !startedByCurrentUser) { - // "Neighborhood" is always transient - Managers.getCategoryManager().addTransient(catID, categorizable.getId()); - isNeighborhood = true; - } - - if (isNeighborhood && !candidates.contains(peer)) { - candidates.add(peer); - } - } +// for (IPeerNode peer : peers) { +// // Check for filtered nodes (Value-add's and Proxies) +// if (isFiltered(peer)) { +// continue; +// } +// +// ICategorizable categorizable = (ICategorizable)peer.getAdapter(ICategorizable.class); +// if (categorizable == null) { +// categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peer, ICategorizable.class); +// } +// Assert.isNotNull(categorizable); +// +// boolean startedByCurrentUser = System.getProperty("user.name").equals(peer.getPeer().getUserName()); //$NON-NLS-1$ +// if (startedByCurrentUser) { +// // If the "My Targets" category is not visible, ignore the startedByCurrentUser flag +// if (myTargetsCat != null && !myTargetsCat.isEnabled()) { +// startedByCurrentUser = false; +// } +// } +// +// boolean isNeighborhood = Managers.getCategoryManager().belongsTo(catID, categorizable.getId()); +// if (!isNeighborhood && !isStatic && !startedByCurrentUser) { +// // "Neighborhood" is always transient +// Managers.getCategoryManager().addTransient(catID, categorizable.getId()); +// isNeighborhood = true; +// } +// +// if (isNeighborhood && !candidates.contains(peer)) { +// candidates.add(peer); +// } +// } } else if (catID != null) { - for (IPeerModel peer : peers) { + for (IPeerNode peer : peers) { ICategorizable categorizable = (ICategorizable)peer.getAdapter(ICategorizable.class); if (categorizable == null) { categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(peer, ICategorizable.class); @@ -275,7 +271,7 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent } } else { - for (IPeerModel peer : peers) { + for (IPeerNode peer : peers) { // Check for filtered nodes (Value-add's and Proxies) if (isFiltered(peer)) { continue; @@ -286,12 +282,12 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent } } - children = candidates.toArray(new IPeerModel[candidates.size()]); + children = candidates.toArray(new IPeerNode[candidates.size()]); } // If it is a peer model itself, get the child peers - else if (parentElement instanceof IPeerModel) { - String parentPeerId = ((IPeerModel)parentElement).getPeerId(); - List<IPeerModel> candidates = Model.getModel().getChildren(parentPeerId); + 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) { @@ -306,15 +302,15 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent // If it is a remote peer discover root node, return the children // for the associated peer id. else if (parentElement instanceof PeerRedirectorGroupNode) { - List<IPeerModel> candidates = Model.getModel().getChildren(((PeerRedirectorGroupNode)parentElement).peerId); + 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 IPeerModel candidate: candidates) { + for (final IPeerNode candidate: candidates) { Protocol.invokeLater(new Runnable() { @Override public void run() { - candidate.setProperty(IPeerModelProperties.PROP_SCANNER_EXCLUDE, false); + candidate.setProperty(IPeerNodeProperties.PROP_SCANNER_EXCLUDE, false); ScannerRunnable runnable = new ScannerRunnable(null, candidate); runnable.run(); @@ -344,10 +340,10 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent @Override public Object getParent(final Object element) { // If it is a peer model node, return the parent locator model - if (element instanceof IPeerModel) { + if (element instanceof IPeerNode) { // If it is a peer redirector, return the parent remote peer discover root node - if (((IPeerModel)element).getPeer() instanceof IPeerRedirector) { - IPeer parentPeer = ((IPeerRedirector)((IPeerModel)element).getPeer()).getParent(); + if (((IPeerNode)element).getPeer() instanceof IPeerRedirector) { + IPeer parentPeer = ((IPeerRedirector)((IPeerNode)element).getPeer()).getParent(); String parentPeerId = parentPeer.getID(); if (!roots.containsKey(parentPeerId)) { roots.put(parentPeer.getID(), new PeerRedirectorGroupNode(parentPeerId)); @@ -357,21 +353,21 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent // Determine the parent category node ICategory category = null; - String[] categoryIds = Managers.getCategoryManager().getCategoryIds(((IPeerModel)element).getPeerId()); + String[] categoryIds = Managers.getCategoryManager().getCategoryIds(((IPeerNode)element).getPeerId()); // If we have more than one, take the first one as parent category. // To get all parents, the getParents(Object) method must be called if (categoryIds != null && categoryIds.length > 0) { category = CategoriesExtensionPointManager.getInstance().getCategory(categoryIds[0], false); } - return category != null ? category : ((IPeerModel)element).getModel(); + return category != null ? category : ((IPeerNode)element).getModel(); } else if (element instanceof PeerRedirectorGroupNode) { // Return the parent peer model node - final AtomicReference<IPeerModel> parent = new AtomicReference<IPeerModel>(); + final AtomicReference<IPeerNode> parent = new AtomicReference<IPeerNode>(); final Runnable runnable = new Runnable() { @Override public void run() { - parent.set(Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(((PeerRedirectorGroupNode)element).peerId)); + parent.set(Model.getModel().getService(IPeerModelLookupService.class).lkupPeerModelById(((PeerRedirectorGroupNode)element).peerId)); } }; @@ -402,8 +398,8 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent // is consuming only the last segment. List<TreePath> pathes = new ArrayList<TreePath>(); - if (element instanceof IPeerModel) { - if (Managers.getCategoryManager().belongsTo(IUIConstants.ID_CAT_FAVORITES, ((IPeerModel)element).getPeerId())) { + if (element instanceof IPeerNode) { + if (Managers.getCategoryManager().belongsTo(IUIConstants.ID_CAT_FAVORITES, ((IPeerNode)element).getPeerId())) { // Get the "Favorites" category ICategory favCategory = CategoriesExtensionPointManager.getInstance().getCategory(IUIConstants.ID_CAT_FAVORITES, false); if (favCategory != null) { @@ -484,7 +480,7 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent */ @Override public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) { - final ILocatorModel model = Model.getModel(); + final IPeerModel model = Model.getModel(); // Create and attach the model listener if not yet done if (modelListener == null && model != null && viewer instanceof CommonViewer) { @@ -509,7 +505,7 @@ public class ContentProvider implements ICommonContentProvider, ITreePathContent Protocol.invokeLater(new Runnable() { @Override public void run() { - model.getService(ILocatorModelRefreshService.class).refresh(null); + model.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/ModelListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ModelListener.java index a6ee0b8ec..269bcc313 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/ModelListener.java @@ -15,8 +15,8 @@ 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.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.listener.ModelAdapter; import org.eclipse.tcf.te.ui.views.editor.EditorInput; import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants; @@ -32,7 +32,7 @@ import org.eclipse.ui.navigator.CommonViewer; * TCF locator model listener implementation. */ public class ModelListener extends ModelAdapter { - private final ILocatorModel parentModel; + private final IPeerModel parentModel; /* default */ final CommonViewer viewer; /** @@ -41,7 +41,7 @@ public class ModelListener extends ModelAdapter { * @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 ModelListener(ILocatorModel parent, CommonViewer viewer) { + public ModelListener(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.ILocatorModel, org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel, boolean) + * @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) */ @Override - public void locatorModelChanged(final ILocatorModel model, final IPeerModel peerModel, final boolean added) { + public void locatorModelChanged(final IPeerModel model, final IPeerNode peerNode, final boolean added) { if (parentModel.equals(model)) { // Locator model changed -> refresh the tree Tree tree = viewer.getTree(); @@ -69,17 +69,17 @@ public class ModelListener extends ModelAdapter { }); } - if (peerModel != null) { + if (peerNode != null) { // Check if the peer model node can be adapted to IModelListener. - IAdapterService service = ServiceManager.getInstance().getService(peerModel, IAdapterService.class); - IModelListener listener = service != null ? service.getAdapter(peerModel, IModelListener.class) : null; + IAdapterService service = ServiceManager.getInstance().getService(peerNode, IAdapterService.class); + IModelListener listener = service != null ? service.getAdapter(peerNode, IModelListener.class) : null; // If yes -> Invoke the adapted model listener instance if (listener != null) { - listener.locatorModelChanged(model, peerModel, added); + listener.locatorModelChanged(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. - else if (!added && !peerModel.isStatic()) { + else if (!added) { Display display = PlatformUI.getWorkbench().getDisplay(); if (display != null && !display.isDisposed()) { display.asyncExec(new Runnable() { @@ -91,7 +91,7 @@ public class ModelListener extends ModelAdapter { // Get the active page IWorkbenchPage page = window.getActivePage(); // Create the editor input object - IEditorInput input = new EditorInput(peerModel); + IEditorInput input = new EditorInput(peerNode); // Lookup the editors matching the editor input IEditorReference[] editors = page.findEditors(input, IUIConstants.ID_EDITOR, IWorkbenchPage.MATCH_INPUT); if (editors != null && editors.length > 0) { 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 8ca09120c..bac4216d5 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 @@ -11,7 +11,6 @@ package org.eclipse.tcf.te.tcf.ui.navigator; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.core.runtime.Assert; @@ -22,8 +21,8 @@ import org.eclipse.tcf.protocol.IPeer; import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.te.runtime.services.interfaces.delegates.ILabelProviderDelegate; import org.eclipse.tcf.te.runtime.utils.net.IPAddressUtil; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; +import org.eclipse.tcf.te.tcf.locator.interfaces.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.ui.activator.UIPlugin; import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts; @@ -42,7 +41,7 @@ public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDe */ @Override public String getText(final Object element) { - if (element instanceof IPeerModel || element instanceof IPeer) { + if (element instanceof IPeerNode || element instanceof IPeer) { StringBuilder builder = new StringBuilder(); // Copy the peer node and peer attributes @@ -51,9 +50,9 @@ public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDe Runnable runnable = new Runnable() { @Override public void run() { - if (element instanceof IPeerModel) { - attrs.putAll(((IPeerModel)element).getProperties()); - attrs.putAll(((IPeerModel)element).getPeer().getAttributes()); + if (element instanceof IPeerNode) { + attrs.putAll(((IPeerNode)element).getProperties()); + attrs.putAll(((IPeerNode)element).getPeer().getAttributes()); } else if (element instanceof IPeer) { attrs.putAll(((IPeer)element).getAttributes()); @@ -123,7 +122,7 @@ public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDe Runnable runnable = new Runnable() { @Override public void run() { - count.set(Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelByName(label).length); + count.set(Model.getModel().getService(IPeerModelLookupService.class).lkupPeerModelByName(label).length); } }; @@ -141,30 +140,8 @@ public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDe */ @Override public Image getImage(final Object element) { - if (element instanceof IPeerModel || element instanceof IPeer) { - final AtomicBoolean isStatic = new AtomicBoolean(); - - Runnable runnable = new Runnable() { - @Override - public void run() { - if (element instanceof IPeerModel) { - isStatic.set(((IPeerModel)element).isStatic()); - } - else if (element instanceof IPeer) { - String value = ((IPeer)element).getAttributes().get("static.transient"); //$NON-NLS-1$ - isStatic.set(value != null && Boolean.parseBoolean(value.trim())); - } - } - }; - - if (Protocol.isDispatchThread()) { - runnable.run(); - } - else { - Protocol.invokeAndWait(runnable); - } - - return isStatic.get() ? UIPlugin.getImage(ImageConsts.PEER) : UIPlugin.getImage(ImageConsts.PEER_DISCOVERED); + if (element instanceof IPeerNode || element instanceof IPeer) { + return UIPlugin.getImage(ImageConsts.PEER); } if (element instanceof PeerRedirectorGroupNode) { return UIPlugin.getImage(ImageConsts.DISCOVERY_ROOT); @@ -180,11 +157,11 @@ public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDe public Image decorateImage(Image image, Object element) { Image decoratedImage = image; - if (image != null && element instanceof IPeerModel) { + if (image != null && element instanceof IPeerNode) { AbstractImageDescriptor descriptor = new PeerImageDescriptor( UIPlugin.getDefault().getImageRegistry(), image, - (IPeerModel)element); + (IPeerNode)element); decoratedImage = UIPlugin.getSharedImage(descriptor); } 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 index 308633a42..e9de64f33 100644 --- 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 @@ -16,8 +16,8 @@ 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.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; +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; @@ -52,13 +52,13 @@ public class TreeViewerListener implements ITreeViewerListener, IDisposable { @Override public void treeCollapsed(TreeExpansionEvent event) { if (event.getElement() instanceof PeerRedirectorGroupNode) { - final List<IPeerModel> candidates = Model.getModel().getChildren(((PeerRedirectorGroupNode)event.getElement()).peerId); + 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 IPeerModel candidate: candidates) { + for (final IPeerNode candidate: candidates) { markExcluded(candidate); } } @@ -70,17 +70,17 @@ public class TreeViewerListener implements ITreeViewerListener, IDisposable { /** * Mark the given peer model node and it's child nodes to be excluded from the scanner. * - * @param peerModel The peer model node. Must not be <code>null</code>. + * @param peerNode The peer model node. Must not be <code>null</code>. */ - /* default */ void markExcluded(IPeerModel peerModel) { + /* default */ void markExcluded(IPeerNode peerNode) { Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ - Assert.isNotNull(peerModel); + Assert.isNotNull(peerNode); - peerModel.setProperty(IPeerModelProperties.PROP_SCANNER_EXCLUDE, true); + peerNode.setProperty(IPeerNodeProperties.PROP_SCANNER_EXCLUDE, true); - List<IPeerModel> candidates = Model.getModel().getChildren(peerModel.getPeerId()); + List<IPeerNode> candidates = Model.getModel().getChildren(peerNode.getPeerId()); if (candidates != null && candidates.size() > 0) { - for (final IPeerModel candidate: candidates) { + for (final IPeerNode candidate: candidates) { markExcluded(candidate); } } 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 9ba4385ee..4a697b99f 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 @@ -35,9 +35,9 @@ import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableNodePropert import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +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.ui.views.Managers; import org.eclipse.tcf.te.ui.views.interfaces.ICategory; @@ -80,7 +80,7 @@ public class CommonDnD { * @return true if it is draggable. */ private static boolean isDraggableObject(Object object) { - return object instanceof IPeerModel; + return object instanceof IPeerNode; } /** @@ -120,9 +120,9 @@ public class CommonDnD { if (target instanceof ICategory) { ICategory category = (ICategory) target; - if (element instanceof IPeerModel && category.getId().equals(parentCategory.getId()) && ((IPeerModel)element).isStatic()) { + if (element instanceof IPeerNode && category.getId().equals(parentCategory.getId())) { List<String> usedNames = getUsedNames(); - Map<String,String> attrs = new HashMap<String,String>(((IPeerModel)element).getPeer().getAttributes()); + Map<String,String> attrs = new HashMap<String,String>(((IPeerNode)element).getPeer().getAttributes()); attrs.put(IPeer.ATTR_ID, UUID.randomUUID().toString()); attrs.remove(IPersistableNodeProperties.PROPERTY_URI); int i = 0; @@ -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 ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); + final IPeerModelRefreshService service = Model.getModel().getService(IPeerModelRefreshService.class); if (service != null) { Runnable runnable = new Runnable() { @Override @@ -186,14 +186,14 @@ public class CommonDnD { service.refresh(new Callback() { @Override protected void internalDone(Object caller, org.eclipse.core.runtime.IStatus status) { - IPeerModel peerModel = null; + IPeerNode peerNode = null; if (finalNewPeer != null) { - ILocatorModelLookupService service = Model.getModel().getService(ILocatorModelLookupService.class); + IPeerModelLookupService service = Model.getModel().getService(IPeerModelLookupService.class); if (service != null) { - peerModel = service.lkupPeerModelById(finalNewPeer.getID()); + peerNode = service.lkupPeerModelById(finalNewPeer.getID()); } } - refresh(cNav, finalCat, peerModel != null ? peerModel : finalElement); + refresh(cNav, finalCat, peerNode != null ? peerNode : finalElement); } }); @@ -305,7 +305,7 @@ public class CommonDnD { if (target instanceof ICategory) { ICategory category = (ICategory) target; - if (!link && element instanceof IPeerModel && category.getId().equals(parentCategory.getId()) && ((IPeerModel)element).isStatic()) { + if (!link && element instanceof IPeerNode && category.getId().equals(parentCategory.getId())) { overrideOperation = DND.DROP_COPY; copy = true; } @@ -380,16 +380,14 @@ public class CommonDnD { @Override public void run() { // Get all peer model objects - IPeerModel[] peers = Model.getModel().getPeers(); + IPeerNode[] peers = Model.getModel().getPeers(); // Loop them and find the ones which are of our handled types - for (IPeerModel peerModel : peers) { - if (peerModel.isStatic()) { - String name = peerModel.getPeer().getName(); + for (IPeerNode peerNode : peers) { + String name = peerNode.getPeer().getName(); Assert.isNotNull(name); if (!"".equals(name) && !usedNames.contains(name)) { //$NON-NLS-1$ usedNames.add(name.trim().toUpperCase()); } - } } } }; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/events/EventListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/events/EventListener.java index 33cc59e4e..15a813289 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/events/EventListener.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/events/EventListener.java @@ -14,7 +14,7 @@ import java.util.EventObject; import org.eclipse.tcf.te.runtime.events.ChangeEvent; import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel; -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.ui.views.events.AbstractEventListener; /** @@ -34,7 +34,7 @@ public class EventListener extends AbstractEventListener { // Property changes for the model refreshes the parent peer // node. The runtime model is not visible by itself. if (source instanceof IModel) { - IPeerModel node = (IPeerModel)((IModel)source).getAdapter(IPeerModel.class); + IPeerNode node = (IPeerNode)((IModel)source).getAdapter(IPeerNode.class); refresh(node, false); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/filter/GenericFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/filter/GenericFilter.java index c33a9afcd..07517dfff 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/filter/GenericFilter.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/filter/GenericFilter.java @@ -16,8 +16,8 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.te.tcf.core.interfaces.IPeerType; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; +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.ui.navigator.nodes.PeerRedirectorGroupNode; import org.eclipse.tcf.te.ui.views.interfaces.ICategory; import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants; @@ -34,13 +34,13 @@ public class GenericFilter extends ViewerFilter { public boolean select(Viewer viewer, Object parentElement, final Object element) { boolean visible = true; - if (element instanceof IPeerModel) { + if (element instanceof IPeerNode) { final AtomicReference<String> type = new AtomicReference<String>(); Runnable runnable = new Runnable() { @Override public void run() { - type.set(((IPeerModel)element).getPeer().getAttributes().get(IPeerModelProperties.PROP_TYPE)); + type.set(((IPeerNode)element).getPeer().getAttributes().get(IPeerNodeProperties.PROP_TYPE)); } }; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java index 9264647d0..33cdbb3b1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java @@ -15,7 +15,7 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.te.core.interfaces.IConnectable; -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.ui.internal.ImageConsts; import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor; @@ -35,7 +35,7 @@ public class PeerImageDescriptor extends AbstractImageDescriptor { /** * Constructor. */ - public PeerImageDescriptor(final ImageRegistry registry, final Image baseImage, final IPeerModel node) { + public PeerImageDescriptor(final ImageRegistry registry, final Image baseImage, final IPeerNode node) { super(registry); this.baseImage = baseImage; @@ -62,11 +62,11 @@ public class PeerImageDescriptor extends AbstractImageDescriptor { * * @param node The peer model. Must not be <code>null</code>. */ - protected void initialize(IPeerModel node) { + protected void initialize(IPeerNode node) { Assert.isNotNull(node); Assert.isTrue(Protocol.isDispatchThread()); - connectState = node instanceof IConnectable ? ((IConnectable)node).getConnectState() : IConnectable.STATE_UNKNOWN; + connectState = node.getConnectState(); } /** 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 dab9ab671..95712e6a2 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 @@ -27,8 +27,8 @@ 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.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.model.Model; import org.eclipse.ui.forms.IManagedForm; import org.eclipse.ui.forms.widgets.FormToolkit; @@ -46,18 +46,18 @@ public abstract class AbstractContextSelectorSection extends org.eclipse.tcf.te. final IModelListener modelListener = new IModelListener() { @Override - public void locatorModelDisposed(ILocatorModel model) { + public void locatorModelDisposed(IPeerModel model) { refreshSelectorControl(); } @Override - public void locatorModelChanged(ILocatorModel model, IPeerModel peerModel, boolean added) { + public void locatorModelChanged(IPeerModel model, IPeerNode peerNode, boolean added) { refreshSelectorControl(); } }; final IEventListener eventListener = new IEventListener() { @Override public void eventFired(EventObject event) { - if (event.getSource() instanceof IPeer || event.getSource() instanceof IPeerModel) { + if (event.getSource() instanceof IPeer || event.getSource() instanceof IPeerNode) { refreshSelectorControl(); } } @@ -159,14 +159,14 @@ public abstract class AbstractContextSelectorSection extends org.eclipse.tcf.te. try { if (encoded != null && encoded.trim().length() > 0) { IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(IPeer.class, String.class); - Object[] input = delegate.readList(IPeerModel.class, encoded); + Object[] input = delegate.readList(IPeerNode.class, encoded); List<IModelNode> peers = new ArrayList<IModelNode>(); for (Object object : input) { if (object instanceof IModelNode) { peers.add((IModelNode)object); } } - return peers.toArray(new IPeerModel[peers.size()]); + return peers.toArray(new IPeerNode[peers.size()]); } } catch (Exception e) { 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 44e43bc68..fdfdc6a79 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 @@ -33,11 +33,11 @@ import org.eclipse.tcf.te.core.interfaces.IConnectable; import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; +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.nodes.PeerRedirector; import org.eclipse.tcf.te.tcf.ui.controls.SimulatorTypeSelectionControl; -import org.eclipse.tcf.te.tcf.ui.dialogs.AgentSelectionDialog; +import org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog; import org.eclipse.tcf.te.tcf.ui.nls.Messages; import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl; import org.eclipse.tcf.te.ui.forms.parts.AbstractSection; @@ -59,7 +59,7 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID /* default */ SimulatorTypeSelectionControl simulator; // Reference to the original data object - /* default */ IPeerModel od; + /* default */ IPeerNode od; // Reference to a copy of the original data /* default */ final IPropertiesContainer odc = new PropertiesContainer(); // Reference to the properties container representing the working copy for the section @@ -68,7 +68,7 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID protected static final int SELECTION_REAL = 0; protected static final int SELECTION_SIM = 1; - protected IPeerModel selectedTarget = null; + protected IPeer selectedPeer = null; /** * Constructor. @@ -153,13 +153,13 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID if (target.isLabelControlSelected()) { onSelectionChanged(SELECTION_REAL); if (!isUpdating()) { - onTargetChanged(false, true, selectedTarget, selectedTarget); + onPeerChanged(false, true, selectedPeer, selectedPeer); } } } @Override protected void onButtonControlSelected() { - AgentSelectionDialog dialog = new AgentSelectionDialog(null) { + PeerSelectionDialog dialog = new PeerSelectionDialog(null) { @Override protected boolean supportsMultiSelection() { return false; @@ -169,8 +169,8 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID viewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, final Object element) { - if (element instanceof IPeerModel && !(element instanceof IConnectable)) { - final IPeer peer = ((IPeerModel)element).getPeer(); + if (element instanceof IPeer) { + final IPeer peer = (IPeer)element; final AtomicBoolean isValueAdd = new AtomicBoolean(); final AtomicBoolean isCLI = new AtomicBoolean(); Protocol.invokeAndWait(new Runnable() { @@ -198,11 +198,10 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID if (dialog.open() == Window.OK) { // Get the selected proxy from the dialog ISelection selection = dialog.getSelection(); - if (selection instanceof IStructuredSelection && !selection.isEmpty() && ((IStructuredSelection)selection).getFirstElement() instanceof IPeerModel) { - IPeerModel oldPeerModel = selectedTarget; - selectedTarget = (IPeerModel)((IStructuredSelection)selection).getFirstElement(); - setEditFieldControlText(selectedTarget.getName()); - onTargetChanged(isLabelControlSelected(), isLabelControlSelected(), oldPeerModel, selectedTarget); + if (selection instanceof IStructuredSelection && !selection.isEmpty() && ((IStructuredSelection)selection).getFirstElement() instanceof IPeer) { + IPeer oldPeer = selectedPeer; + selectedPeer = (IPeer)((IStructuredSelection)selection).getFirstElement(); + onPeerChanged(isLabelControlSelected(), isLabelControlSelected(), oldPeer, selectedPeer); } } @@ -279,14 +278,14 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID } /** - * Called on target enabled and selected peer model changed. + * Called on target enabled and selected peer changed. * * @param oldEnabled The old target enabled action. * @param newEnabled The new target enabled action. - * @param oldPeerModel The new selected peer model. - * @param newPeerModel The old selected peer model. + * @param oldPeer The new selected peer. + * @param newPeer The old selected peer. */ - protected void onTargetChanged(boolean oldEnabled, boolean newEnabled, IPeerModel oldPeerModel, IPeerModel newPeerModel) { + protected void onPeerChanged(boolean oldEnabled, boolean newEnabled, IPeer oldPeer, IPeer newPeer) { } /** @@ -302,8 +301,8 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID if (getManagedForm().getContainer() instanceof AbstractEditorPage && !((AbstractEditorPage)getManagedForm().getContainer()).isDirty()) { Object node = ((AbstractEditorPage)getManagedForm().getContainer()).getEditorInputNode(); - if (node instanceof IPeerModel) { - setupData((IPeerModel)node); + if (node instanceof IPeerNode) { + setupData((IPeerNode)node); } } } else { @@ -323,16 +322,16 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID // Initialize the simulator simulator selection control if (simulator != null) { simulator.initialize(od); - simulator.setSelectedSimulatorId(data.getStringProperty(IPeerModelProperties.PROP_SIM_TYPE)); - simulator.setSimulatorConfig(data.getStringProperty(IPeerModelProperties.PROP_SIM_PROPERTIES)); - simulator.setLabelControlSelection(data.getBooleanProperty(IPeerModelProperties.PROP_SIM_ENABLED)); + simulator.setSelectedSimulatorId(data.getStringProperty(IPeerNodeProperties.PROP_SIM_TYPE)); + simulator.setSimulatorConfig(data.getStringProperty(IPeerNodeProperties.PROP_SIM_PROPERTIES)); + simulator.setLabelControlSelection(data.getBooleanProperty(IPeerNodeProperties.PROP_SIM_ENABLED)); } if (target != null) { - target.setLabelControlSelection(!data.getBooleanProperty(IPeerModelProperties.PROP_SIM_ENABLED)); + target.setLabelControlSelection(!data.getBooleanProperty(IPeerNodeProperties.PROP_SIM_ENABLED)); } - onSelectionChanged(data.getBooleanProperty(IPeerModelProperties.PROP_SIM_ENABLED) ? SELECTION_SIM : SELECTION_REAL); + onSelectionChanged(data.getBooleanProperty(IPeerNodeProperties.PROP_SIM_ENABLED) ? SELECTION_SIM : SELECTION_REAL); // Mark the control update as completed now setIsUpdating(false); @@ -349,7 +348,7 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID * * @param node The peer model node or <code>null</code>. */ - public void setupData(final IPeerModel node) { + public void setupData(final IPeerNode node) { // If the section is dirty, nothing is changed if (isDirty()) { return; @@ -388,9 +387,9 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID public void run() { // The section is handling the simulator related properties // Ignore other properties. - odc.setProperty(IPeerModelProperties.PROP_SIM_ENABLED, node.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_ENABLED)); - odc.setProperty(IPeerModelProperties.PROP_SIM_PROPERTIES, node.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_PROPERTIES)); - odc.setProperty(IPeerModelProperties.PROP_SIM_TYPE, node.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_TYPE)); + odc.setProperty(IPeerNodeProperties.PROP_SIM_ENABLED, node.getPeer().getAttributes().get(IPeerNodeProperties.PROP_SIM_ENABLED)); + odc.setProperty(IPeerNodeProperties.PROP_SIM_PROPERTIES, node.getPeer().getAttributes().get(IPeerNodeProperties.PROP_SIM_PROPERTIES)); + odc.setProperty(IPeerNodeProperties.PROP_SIM_TYPE, node.getPeer().getAttributes().get(IPeerNodeProperties.PROP_SIM_TYPE)); // Initially, the working copy is a duplicate of the original data copy wc.setProperties(odc.getProperties()); } @@ -422,14 +421,14 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID // Extract the widget data into the working copy if (target != null) { - data.setProperty(IPeerModelProperties.PROP_SIM_ENABLED, false); - data.setProperty(IPeerModelProperties.PROP_TARGET, target.getEditFieldControlText()); + data.setProperty(IPeerNodeProperties.PROP_SIM_ENABLED, false); + data.setProperty(IPeerNodeProperties.PROP_TARGET, target.getEditFieldControlText()); } if (simulator != null) { - data.setProperty(IPeerModelProperties.PROP_SIM_ENABLED, simulator.isLabelControlSelected()); - data.setProperty(IPeerModelProperties.PROP_SIM_TYPE, simulator.getSelectedSimulatorId()); - data.setProperty(IPeerModelProperties.PROP_SIM_PROPERTIES, simulator.getSimulatorConfig()); + data.setProperty(IPeerNodeProperties.PROP_SIM_ENABLED, simulator.isLabelControlSelected()); + data.setProperty(IPeerNodeProperties.PROP_SIM_TYPE, simulator.getSelectedSimulatorId()); + data.setProperty(IPeerNodeProperties.PROP_SIM_PROPERTIES, simulator.getSimulatorConfig()); } } @@ -441,7 +440,7 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID * * @param node The peer node or <code>null</code>. */ - public void extractData(final IPeerModel node) { + public void extractData(final IPeerNode node) { // If no data is available, we are done if (node == null) { return; @@ -460,9 +459,9 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID Protocol.invokeAndWait(new Runnable() { @Override public void run() { - boolean isSimEnabled = wc.getBooleanProperty(IPeerModelProperties.PROP_SIM_ENABLED); - String configs = wc.getStringProperty(IPeerModelProperties.PROP_SIM_PROPERTIES); - String type = wc.getStringProperty(IPeerModelProperties.PROP_SIM_TYPE); + boolean isSimEnabled = wc.getBooleanProperty(IPeerNodeProperties.PROP_SIM_ENABLED); + String configs = wc.getStringProperty(IPeerNodeProperties.PROP_SIM_PROPERTIES); + String type = wc.getStringProperty(IPeerNodeProperties.PROP_SIM_TYPE); // To update the peer attributes, the peer needs to be recreated IPeer oldPeer = node.getPeer(); @@ -470,26 +469,26 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID Map<String, String> attributes = new HashMap<String, String>(oldPeer.getAttributes()); // Update the data if (isSimEnabled) { - attributes.put(IPeerModelProperties.PROP_SIM_ENABLED, Boolean.toString(isSimEnabled)); + attributes.put(IPeerNodeProperties.PROP_SIM_ENABLED, Boolean.toString(isSimEnabled)); } else { - attributes.remove(IPeerModelProperties.PROP_SIM_ENABLED); + attributes.remove(IPeerNodeProperties.PROP_SIM_ENABLED); } if (configs != null) { - attributes.put(IPeerModelProperties.PROP_SIM_PROPERTIES, configs); + attributes.put(IPeerNodeProperties.PROP_SIM_PROPERTIES, configs); } else { - attributes.remove(IPeerModelProperties.PROP_SIM_PROPERTIES); + attributes.remove(IPeerNodeProperties.PROP_SIM_PROPERTIES); } if (type != null) { - attributes.put(IPeerModelProperties.PROP_SIM_TYPE, type); + attributes.put(IPeerNodeProperties.PROP_SIM_TYPE, type); } else { - attributes.remove(IPeerModelProperties.PROP_SIM_TYPE); + attributes.remove(IPeerNodeProperties.PROP_SIM_TYPE); } // And merge it to the peer model node if (oldPeer instanceof TransientPeer && !(oldPeer instanceof PeerRedirector || oldPeer instanceof Peer)) { // Create a peer object IPeer newPeer = new Peer(attributes); // Update the peer instance - node.setProperty(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties.PROP_INSTANCE, newPeer); + node.setProperty(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties.PROP_INSTANCE, newPeer); } else { if (oldPeer instanceof PeerRedirector) { ((PeerRedirector)oldPeer).updateAttributes(attributes); @@ -539,7 +538,7 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID } // Extract the data into the peer model node - extractData((IPeerModel)getManagedForm().getInput()); + extractData((IPeerNode)getManagedForm().getInput()); } /** @@ -557,12 +556,12 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID // Compare the data if (simulator != null) { - boolean oldEnabled = odc.getBooleanProperty(IPeerModelProperties.PROP_SIM_ENABLED); + boolean oldEnabled = odc.getBooleanProperty(IPeerNodeProperties.PROP_SIM_ENABLED); isDirty |= (oldEnabled != simulator.isLabelControlSelected()); if (simulator.isLabelControlSelected()) { String newType = simulator.getSelectedSimulatorId(); - String oldType = odc.getStringProperty(IPeerModelProperties.PROP_SIM_TYPE); + String oldType = odc.getStringProperty(IPeerNodeProperties.PROP_SIM_TYPE); if (newType == null || "".equals(newType)) { //$NON-NLS-1$ isDirty |= oldType != null && !"".equals(oldType); //$NON-NLS-1$ } else { @@ -570,7 +569,7 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID } String newConfig = simulator.getSimulatorConfig(); - String oldConfig = odc.getStringProperty(IPeerModelProperties.PROP_SIM_PROPERTIES); + String oldConfig = odc.getStringProperty(IPeerNodeProperties.PROP_SIM_PROPERTIES); if (newConfig == null || "".equals(newConfig)) { //$NON-NLS-1$ isDirty |= oldConfig != null && !"".equals(oldConfig); //$NON-NLS-1$ } @@ -604,7 +603,7 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID * Updates the control enablement. */ protected void updateEnablement() { - boolean enabled = od instanceof IConnectable && ((IConnectable)od).getConnectState() == IConnectable.STATE_DISCONNECTED; + boolean enabled = od == null || od.getConnectState() == IConnectable.STATE_DISCONNECTED; if (target != null) { SWTControlUtil.setEnabled(target.getEditFieldControl(), target.isLabelControlSelected() && enabled); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java index ca3da3f88..bf0ba822d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java @@ -28,8 +28,8 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Text; import org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider; import org.eclipse.tcf.te.ui.swt.SWTControlUtil; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.forms.widgets.ExpandableComposite; @@ -51,7 +51,7 @@ public abstract class BaseTitledSection extends AbstractPropertySection implemen protected IPropertyChangeProvider viewerInput; // The input node. - protected IPeerModelProvider provider; + protected IPeerNodeProvider provider; /* * (non-Javadoc) @@ -66,13 +66,13 @@ public abstract class BaseTitledSection extends AbstractPropertySection implemen Assert.isTrue(selection instanceof IStructuredSelection); Object input = ((IStructuredSelection) selection).getFirstElement(); - IPeerModelProvider provider = input instanceof IPeerModelProvider ? (IPeerModelProvider) input : null; - if (provider == null) provider = input instanceof IAdaptable ? (IPeerModelProvider)((IAdaptable)input).getAdapter(IPeerModelProvider.class) : null; - if (provider == null) provider = (IPeerModelProvider)Platform.getAdapterManager().getAdapter(input, IPeerModelProvider.class); + IPeerNodeProvider provider = input instanceof IPeerNodeProvider ? (IPeerNodeProvider) input : null; + if (provider == null) provider = input instanceof IAdaptable ? (IPeerNodeProvider)((IAdaptable)input).getAdapter(IPeerNodeProvider.class) : null; + if (provider == null) provider = (IPeerNodeProvider)Platform.getAdapterManager().getAdapter(input, IPeerNodeProvider.class); if (provider != null) { this.provider = provider; - IPeerModel peerNode = getPeerModel(provider); + IPeerNode peerNode = getPeerModel(provider); this.viewerInput = (IPropertyChangeProvider) peerNode.getAdapter(IPropertyChangeProvider.class); if (this.viewerInput != null) { this.viewerInput.addPropertyChangeListener(this); @@ -90,7 +90,7 @@ public abstract class BaseTitledSection extends AbstractPropertySection implemen * @param provider * @return */ - protected IPeerModel getPeerModel(IPeerModelProvider provider) { + protected IPeerNode getPeerModel(IPeerNodeProvider provider) { Assert.isNotNull(provider); return provider.getPeerModel(); } @@ -100,7 +100,7 @@ public abstract class BaseTitledSection extends AbstractPropertySection implemen * * @param input The input node. */ - protected void updateInput(IPeerModelProvider input) { + protected void updateInput(IPeerNodeProvider input) { } /* diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractConfigWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractConfigWizard.java index 4d4fd155f..87fc856c4 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractConfigWizard.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractConfigWizard.java @@ -22,8 +22,8 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext; import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService; import org.eclipse.tcf.te.runtime.stepper.job.StepperJob; import org.eclipse.tcf.te.runtime.utils.StatusHelper; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; +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.IStepperServiceOperations; import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin; import org.eclipse.tcf.te.tcf.ui.wizards.pages.AbstractConfigWizardPage; @@ -61,11 +61,11 @@ public abstract class AbstractConfigWizard extends NewTargetWizard { protected abstract AbstractConfigWizardPage getConfigWizardPage(); /* (non-Javadoc) - * @see org.eclipse.tcf.te.tcf.ui.wizards.NewTargetWizard#postPerformFinish(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel) + * @see org.eclipse.tcf.te.tcf.ui.wizards.NewTargetWizard#postPerformFinish(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode) */ @Override - protected void postPerformFinish(final IPeerModel peerModel) { - Assert.isNotNull(peerModel); + protected void postPerformFinish(final IPeerNode peerNode) { + Assert.isNotNull(peerNode); // Determine if or if not to auto-connect the created connection. boolean autoConnect = true; @@ -84,25 +84,25 @@ public abstract class AbstractConfigWizard extends NewTargetWizard { Protocol.invokeAndWait(new Runnable() { @Override public void run() { - connect.set(Boolean.parseBoolean(peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_AUTO_CONNECT))); + connect.set(Boolean.parseBoolean(peerNode.getPeer().getAttributes().get(IPeerNodeProperties.PROP_AUTO_CONNECT))); } }); if (connect.get()) { - IService[] services = ServiceManager.getInstance().getServices(peerModel, IStepperOperationService.class, false); + IService[] services = ServiceManager.getInstance().getServices(peerNode, IStepperOperationService.class, false); IStepperOperationService stepperOperationService = null; for (IService service : services) { - if (service instanceof IStepperOperationService && ((IStepperOperationService)service).isHandledOperation(peerModel, IStepperServiceOperations.CONNECT)) { + if (service instanceof IStepperOperationService && ((IStepperOperationService)service).isHandledOperation(peerNode, IStepperServiceOperations.CONNECT)) { stepperOperationService = (IStepperOperationService)service; break; } } if (stepperOperationService != null) { - String stepGroupId = stepperOperationService.getStepGroupId(peerModel, IStepperServiceOperations.CONNECT); - IStepContext stepContext = stepperOperationService.getStepContext(peerModel, IStepperServiceOperations.CONNECT); - String name = stepperOperationService.getStepGroupName(peerModel, IStepperServiceOperations.CONNECT); - IPropertiesContainer data = stepperOperationService.getStepData(peerModel, IStepperServiceOperations.CONNECT); - boolean enabled = stepperOperationService.isEnabled(peerModel, IStepperServiceOperations.CONNECT); + String stepGroupId = stepperOperationService.getStepGroupId(peerNode, IStepperServiceOperations.CONNECT); + IStepContext stepContext = stepperOperationService.getStepContext(peerNode, IStepperServiceOperations.CONNECT); + String name = stepperOperationService.getStepGroupName(peerNode, IStepperServiceOperations.CONNECT); + IPropertiesContainer data = stepperOperationService.getStepData(peerNode, IStepperServiceOperations.CONNECT); + boolean enabled = stepperOperationService.isEnabled(peerNode, IStepperServiceOperations.CONNECT); if (enabled && stepGroupId != null && stepContext != null) { try { 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 376701571..c9d4250ff 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 @@ -33,9 +33,9 @@ import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.tcf.core.peers.Peer; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +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.ui.nls.Messages; import org.eclipse.tcf.te.tcf.ui.wizards.pages.NewTargetWizardPage; @@ -128,13 +128,13 @@ public class NewTargetWizard extends AbstractWizard implements INewWizard { Protocol.invokeLater(new Runnable() { @Override public void run() { - ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class); + IPeerModelRefreshService service = Model.getModel().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 IPeerModel peerNode = Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID)); + final IPeerNode peerNode = Model.getModel().getService(IPeerModelLookupService.class).lkupPeerModelById(attrs.get(IPeer.ATTR_ID)); if (peerNode != null) { // Refresh the viewer ViewsUtil.refresh(IUIConstants.ID_EXPLORER); @@ -183,9 +183,9 @@ public class NewTargetWizard extends AbstractWizard implements INewWizard { * <p> * <b>Note:</b> The method is called from within the UI thread. * - * @param peerModel The peer model node. Must not be <code>null</code>. + * @param peerNode The peer model node. Must not be <code>null</code>. */ - protected void postPerformFinish(IPeerModel peerModel) { + protected void postPerformFinish(IPeerNode peerNode) { // Do nothing } 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 4a5bf06cb..bc3096301 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 @@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Label; 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.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.ui.controls.PeerNameControl; import org.eclipse.tcf.te.tcf.ui.nls.Messages; @@ -310,16 +310,14 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i @Override public void run() { // Get all peer model objects - IPeerModel[] peers = Model.getModel().getPeers(); + IPeerNode[] peers = Model.getModel().getPeers(); // Loop them and find the ones which are of our handled types - for (IPeerModel peerModel : peers) { - if (peerModel.isStatic()) { - String name = peerModel.getPeer().getName(); + for (IPeerNode peerNode : peers) { + String name = peerNode.getPeer().getName(); Assert.isNotNull(name); if (!"".equals(name) && !usedNames.contains(name)) { //$NON-NLS-1$ usedNames.add(name.trim().toUpperCase()); } - } } } }; @@ -434,11 +432,11 @@ public abstract class AbstractConfigWizardPage extends AbstractFormsWizardPage i } if (isAutoStartDebugger()) { - peerAttributes.setProperty(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties.PROP_AUTO_START_DEBUGGER, true); + peerAttributes.setProperty(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties.PROP_AUTO_START_DEBUGGER, true); } if (isAutoConnect()) { - peerAttributes.setProperty(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties.PROP_AUTO_CONNECT, true); + peerAttributes.setProperty(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties.PROP_AUTO_CONNECT, true); } if (selectorSection != null) { 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 67bf46944..42583508c 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 @@ -28,7 +28,7 @@ import org.eclipse.tcf.protocol.Protocol; 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.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.ui.controls.CustomTransportPanel; import org.eclipse.tcf.te.tcf.ui.controls.PeerAttributesTablePart; @@ -454,16 +454,14 @@ public class NewTargetWizardPage extends AbstractValidatingWizardPage implements @Override public void run() { // Get all peer model objects - IPeerModel[] peers = Model.getModel().getPeers(); + IPeerNode[] peers = Model.getModel().getPeers(); // Loop them and find the ones which are of our handled types - for (IPeerModel peerModel : peers) { - if (peerModel.isStatic()) { - String name = peerModel.getPeer().getName(); + for (IPeerNode peerNode : peers) { + String name = peerNode.getPeer().getName(); Assert.isNotNull(name); if (!"".equals(name) && !usedNames.contains(name)) { //$NON-NLS-1$ usedNames.add(name.trim().toUpperCase()); } - } } } }; 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 35acdc10e..998465d72 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 @@ -51,8 +51,8 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService; 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.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.model.Model; import org.eclipse.tcf.te.tcf.ui.nls.Messages; import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider; @@ -100,13 +100,13 @@ public class PeerExportWizardPage extends WizardPage { createPeersGroup(composite); createDestinationGroup(composite); - List<IPeerModel> elements = new ArrayList<IPeerModel>(); + List<IPeerNode> elements = new ArrayList<IPeerNode>(); Iterator<Object> it = fSelection.iterator(); while (it.hasNext()) { Object element = it.next(); - IPeerModel peerModel = (IPeerModel)Platform.getAdapterManager().getAdapter(element, IPeerModel.class); - if (peerModel != null) { - elements.add((IPeerModel)element); + IPeerNode peerNode = (IPeerNode)Platform.getAdapterManager().getAdapter(element, IPeerNode.class); + if (peerNode != null) { + elements.add((IPeerNode)element); } } fViewer.setCheckedElements(elements.toArray()); @@ -141,14 +141,10 @@ public class PeerExportWizardPage extends WizardPage { } @Override public Object[] getElements(Object inputElement) { - List<IPeerModel> elements = new ArrayList<IPeerModel>(); - for (IPeerModel peerModel : ((ILocatorModel)inputElement).getPeers()) { - if (peerModel.isStatic()) { - elements.add(peerModel); - } - + if (inputElement instanceof IPeerModel) { + return ((IPeerModel)inputElement).getPeers(); } - return elements.toArray(); + return new Object[0]; } @Override public Object[] getChildren(TreePath parentPath) { @@ -287,7 +283,7 @@ public class PeerExportWizardPage extends WizardPage { Object[] elements = fViewer.getCheckedElements(); boolean selected = false; for (Object element : elements) { - if(element instanceof IPeerModel) { + if(element instanceof IPeerNode) { selected = true; break; } 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 8fc219182..946c2d673 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 @@ -56,10 +56,10 @@ 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.tcf.core.interfaces.IImportPersistenceService; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; -import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; +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.ui.nls.Messages; import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider; @@ -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 ILocatorModel model = Model.getModel(); + final IPeerModel model = Model.getModel(); final IProgressMonitor finalMonitor; if (monitor == null) { finalMonitor = new NullProgressMonitor(); @@ -349,25 +349,19 @@ public class PeerImportWizardPage extends WizardPage { int toggleResult = -1; for (final Object config : configs) { if (config instanceof IPeer) { - final AtomicReference<IPeerModel> peerModel = new AtomicReference<IPeerModel>(); + final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>(); Protocol.invokeAndWait(new Runnable() { @Override public void run() { - peerModel.set(model.getService(ILocatorModelLookupService.class).lkupPeerModelById(((IPeer)config).getID())); - if (peerModel.get() == null) { - for (IPeerModel peer : model.getPeers()) { - if (peer.isStatic()) { + peerNode.set(model.getService(IPeerModelLookupService.class).lkupPeerModelById(((IPeer)config).getID())); + if (peerNode.get() == null) { + for (IPeerNode peer : model.getPeers()) { String name = peer.getPeer().getName(); if (name.equalsIgnoreCase(((IPeer)config).getName())) { - peerModel.set(peer); + peerNode.set(peer); break; } - } } - - } - if (peerModel.get() != null && !peerModel.get().isStatic()) { - peerModel.set(null); } } }); @@ -376,11 +370,11 @@ public class PeerImportWizardPage extends WizardPage { if (service == null) { service = ServiceManager.getInstance().getService(IURIPersistenceService.class); } - if (peerModel.get() != null) { + if (peerNode.get() != null) { if (!toggleState || toggleResult < 0) { MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion( getShell(), null, - NLS.bind(Messages.PeerImportWizardPage_overwriteDialog_message, peerModel.get().getName()), + NLS.bind(Messages.PeerImportWizardPage_overwriteDialog_message, peerNode.get().getName()), Messages.PeerImportWizardPage_overwriteDialogToggle_message, toggleState, null, null); toggleState = dialog.getToggleState(); toggleResult = dialog.getReturnCode(); @@ -389,7 +383,7 @@ public class PeerImportWizardPage extends WizardPage { continue; } try { - service.delete(peerModel.get().getPeer(), null); + service.delete(peerNode.get().getPeer(), null); } catch (IOException e) { } @@ -413,7 +407,7 @@ public class PeerImportWizardPage extends WizardPage { Protocol.invokeLater(new Runnable() { @Override public void run() { - model.getService(ILocatorModelRefreshService.class).refresh(null); + model.getService(IPeerModelRefreshService.class).refresh(null); } }); finalMonitor.done(); |