Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-06-04 10:30:35 +0000
committerUwe Stieber2013-06-04 10:30:35 +0000
commit7602f43042b315334a6470c3cebf949b2ae99ba1 (patch)
tree618f46db7b9cd64263f746d1b7de3e3172da3826 /target_explorer
parentbfeb41386bfb257436ec0ebe7315a168eaf53e58 (diff)
downloadorg.eclipse.tcf-7602f43042b315334a6470c3cebf949b2ae99ba1.tar.gz
org.eclipse.tcf-7602f43042b315334a6470c3cebf949b2ae99ba1.tar.xz
org.eclipse.tcf-7602f43042b315334a6470c3cebf949b2ae99ba1.zip
Target Explorer: Added global toolbar pulldown menu for generic TCF target connections
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPeerType.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/ToolbarAction.java409
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/filter/GenericFilter.java75
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties7
13 files changed, 577 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPeerType.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPeerType.java
new file mode 100644
index 000000000..8875d9476
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPeerType.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.core.interfaces;
+
+/**
+ * Peer type id's.
+ */
+public interface IPeerType {
+
+ /**
+ * Peer attribute "type" for generic TCF peers or if the "type" attribute is not set.
+ */
+ public static final String TYPE_GENERIC = "generic"; //$NON-NLS-1$
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF
index 78e6c581d..3c67a8fb7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF
@@ -33,7 +33,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.tcf.ui.activator,
+Export-Package: org.eclipse.tcf.te.tcf.ui.actions,
+ org.eclipse.tcf.te.tcf.ui.activator,
org.eclipse.tcf.te.tcf.ui.controls,
org.eclipse.tcf.te.tcf.ui.dialogs,
org.eclipse.tcf.te.tcf.ui.editor,
@@ -49,6 +50,7 @@ Export-Package: org.eclipse.tcf.te.tcf.ui.activator,
org.eclipse.tcf.te.tcf.ui.navigator,
org.eclipse.tcf.te.tcf.ui.navigator.dnd,
org.eclipse.tcf.te.tcf.ui.navigator.events,
+ org.eclipse.tcf.te.tcf.ui.navigator.filter,
org.eclipse.tcf.te.tcf.ui.navigator.images,
org.eclipse.tcf.te.tcf.ui.navigator.nodes,
org.eclipse.tcf.te.tcf.ui.nls,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
index 1f6b945cf..444ca621e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
@@ -56,6 +56,8 @@ preference.page.name = Logging
# ***** Command Contributions *****
+ToolbarAction.label=Target Connections
+
command.delete.label=Delete
command.delete.tooltip=Delete the selected target
command.delete.mnemonic = D
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
index a6eab6d67..71ddaea38 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
@@ -231,6 +231,24 @@
</wizard>
</extension>
+<!-- actionSet contributions -->
+ <extension point="org.eclipse.ui.actionSets">
+ <actionSet
+ id="org.eclipse.tcf.te.tcf.ui.launch.gettingStartedActionSet"
+ label="Getting Started Action Set (Target Explorer)"
+ visible="true">
+ <action
+ class="org.eclipse.tcf.te.tcf.ui.actions.ToolbarAction"
+ helpContextId="org.eclipse.tcf.te.tcf.ui.command_ToolbarAction"
+ icon="icons/obj16/peer.gif"
+ id="org.eclipse.tcf.te.tcf.ui.ToolbarAction"
+ label="%ToolbarAction.label"
+ style="pulldown"
+ toolbarPath="org.eclipse.debug.ui.launchActionSet/emptyLaunchGroup">
+ </action>
+ </actionSet>
+ </extension>
+
<!-- Editor page contributions -->
<extension point="org.eclipse.tcf.te.ui.views.editorPages">
<editorPage
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/ToolbarAction.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/ToolbarAction.java
new file mode 100644
index 000000000..e1688221e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/ToolbarAction.java
@@ -0,0 +1,409 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.ui.actions;
+
+import java.util.ArrayList;
+import java.util.EventObject;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.tcf.protocol.Protocol;
+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.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.services.ILocatorModelLookupService;
+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.dialogs.AgentSelectionDialog;
+import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
+import org.eclipse.tcf.te.tcf.ui.navigator.filter.GenericFilter;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+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;
+import org.eclipse.tcf.te.ui.wizards.newWizard.NewWizardRegistry;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.internal.actions.NewWizardShortcutAction;
+import org.eclipse.ui.wizards.IWizardDescriptor;
+
+/**
+ * Target connections toolbar pull down menu action implementation.
+ */
+@SuppressWarnings("restriction")
+public class ToolbarAction extends Action implements IActionDelegate2, IWorkbenchWindowPulldownDelegate2, IEventListener {
+
+ public final static String WIZARD_ID = "org.eclipse.tcf.te.tcf.ui.wizards.NewTargetWizard"; //$NON-NLS-1$
+
+ IWorkbenchWindow window;
+ IAction action;
+
+ private Menu menuCtlParent;
+ private Menu menuMenuParent;
+
+ /* default */ final AtomicBoolean recreateMenuCtlParent = new AtomicBoolean();
+ /* default */ final AtomicBoolean recreateMenuMenuParent = new AtomicBoolean();
+
+ /**
+ * Constructor.
+ */
+ public ToolbarAction() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ EventManager.getInstance().addEventListener(this, ChangeEvent.class);
+ if (action != null) {
+ EventManager.getInstance().fireEvent(new ChangeEvent(HistoryManager.getInstance(), ChangeEvent.ID_CHANGED, IPeerType.TYPE_GENERIC, IPeerType.TYPE_GENERIC));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ @Override
+ public void init(IAction action) {
+ this.action = action;
+ if (window != null) {
+ EventManager.getInstance().fireEvent(new ChangeEvent(HistoryManager.getInstance(), ChangeEvent.ID_CHANGED, IPeerType.TYPE_GENERIC, IPeerType.TYPE_GENERIC));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ @Override
+ public void dispose() {
+ window = null;
+ EventManager.getInstance().removeEventListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
+ */
+ @Override
+ public void eventFired(EventObject event) {
+ if (event instanceof ChangeEvent) {
+ ChangeEvent e = (ChangeEvent)event;
+ if (e.getSource() instanceof HistoryManager && IPeerType.TYPE_GENERIC.equals(e.getNewValue())) {
+ recreateMenuCtlParent.set(true);
+ recreateMenuMenuParent.set(true);
+ IPeerModel peerModel = getPeerModel(HistoryManager.getInstance().getFirst(IPeerType.TYPE_GENERIC));
+ if (action != null) {
+ if (peerModel != null) {
+ ILabelProvider labelProvider = getLabelProvider(peerModel);
+ if (labelProvider != null) {
+ action.setToolTipText("Open " + labelProvider.getText(peerModel)); //$NON-NLS-1$
+ return;
+ }
+
+ }
+ action.setToolTipText(null);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowPulldownDelegate#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ @Override
+ public Menu getMenu(Control parent) {
+ if (menuCtlParent != null) {
+ menuCtlParent.dispose();
+ }
+ menuCtlParent = new Menu(parent);
+ fillMenu(menuCtlParent);
+ initMenu(menuCtlParent, recreateMenuCtlParent);
+ return menuCtlParent;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowPulldownDelegate2#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ @Override
+ public Menu getMenu(Menu parent) {
+ if (menuMenuParent != null) {
+ menuMenuParent.dispose();
+ }
+ menuMenuParent = new Menu(parent);
+ fillMenu(menuMenuParent);
+ initMenu(menuMenuParent, recreateMenuMenuParent);
+ return menuMenuParent;
+ }
+
+ /**
+ * Creates the menu for the action
+ */
+ private void initMenu(final Menu menu, final AtomicBoolean recreateMenu) {
+ // Add listener to re-populate the menu each time
+ // it is shown because of dynamic history list
+ menu.addMenuListener(new MenuAdapter() {
+ @Override
+ public void menuShown(MenuEvent e) {
+ if (recreateMenu.get()) {
+ Menu m = (Menu)e.widget;
+ MenuItem[] items = m.getItems();
+ for (MenuItem item : items) {
+ item.dispose();
+ }
+ fillMenu(m);
+ recreateMenu.set(false);
+ }
+ }
+ });
+ }
+
+ private IPeerModel getPeerModel(final String peerId) {
+ if (peerId != null) {
+ final AtomicReference<IPeerModel> peerModel = new AtomicReference<IPeerModel>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ ILocatorModel model = Model.getModel();
+ Assert.isNotNull(model);
+ peerModel.set(model.getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId));
+ }
+ };
+
+ if (Protocol.isDispatchThread()) {
+ runnable.run();
+ }
+ else {
+ Protocol.invokeAndWait(runnable);
+ }
+
+ return peerModel.get();
+ }
+
+ return null;
+ }
+
+ /**
+ * Fills the drop-down menu with favorites and launch history
+ *
+ * @param menu the menu to fill
+ */
+ @SuppressWarnings("unused")
+ protected void fillMenu(Menu menu) {
+ int accelerator = 1;
+ List<IPeerModel> peerModels = new ArrayList<IPeerModel>();
+ for (String id : HistoryManager.getInstance().getHistory(IPeerType.TYPE_GENERIC)) {
+ IPeerModel peerModel = getPeerModel(id);
+ if (peerModel != null && !peerModels.contains(peerModel)) {
+ peerModels.add(peerModel);
+ }
+ }
+ for (final IPeerModel peerModel: peerModels) {
+ ILabelProvider labelProvider = getLabelProvider(peerModel);
+ String label = peerModel.getPeer().getName();
+ if (labelProvider != null) {
+ label = labelProvider.getText(peerModel);
+ if (labelProvider instanceof ILabelDecorator) {
+ label = ((ILabelDecorator)labelProvider).decorateText(label, peerModel);
+ }
+ }
+ Action action = new Action(label) {
+ @Override
+ public void run() {
+ // Get the active page
+ IWorkbenchPage page = window.getActivePage();
+ // Create the editor input object
+ IEditorInput input = new EditorInput(peerModel);
+ try {
+ // Opens the configuration editor
+ page.openEditor(input, IUIConstants.ID_EDITOR);
+ }
+ catch (PartInitException e) {
+ }
+ }
+ };
+ if (labelProvider != null) {
+ action.setImageDescriptor(ImageDescriptor.createFromImage(labelProvider.getImage(peerModel)));
+ }
+ addToMenu(menu, action, accelerator);
+ accelerator++;
+ }
+
+ // Separator between favorites and history
+ if (accelerator > 1) {
+ new MenuItem(menu, SWT.SEPARATOR);
+ }
+
+ action = new Action(Messages.ToolbarAction_selectPeer) {
+ @Override
+ public void run() {
+ // Get the active page
+ IWorkbenchPage page = window.getActivePage();
+ // Create the agent selection dialog
+ AgentSelectionDialog dialog = new AgentSelectionDialog(null) {
+ @Override
+ protected String getTitle() {
+ return Messages.ToolbarAction_selectionDialog_title;
+ }
+ @Override
+ protected String getDefaultMessage() {
+ return Messages.ToolbarAction_selectionDialog_description;
+ }
+ @Override
+ protected String getShowOnlyReachableLabel() {
+ return Messages.ToolbarAction_selectionDialog_button_showOnlyReachable;
+ }
+ @Override
+ protected boolean supportsMultiSelection() {
+ return false;
+ }
+ @Override
+ protected void configureTableViewer(TableViewer viewer) {
+ super.configureTableViewer(viewer);
+ viewer.addFilter(new GenericFilter());
+ viewer.setSorter(new ViewerSorter());
+ }
+ };
+
+ // Open the dialog
+ 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) {
+ // Create the editor input object
+ IEditorInput input = new EditorInput(((IStructuredSelection)selection).getFirstElement());
+ try {
+ // Opens the configuration editor
+ page.openEditor(input, IUIConstants.ID_EDITOR);
+ }
+ catch (PartInitException e) {
+ }
+ }
+ }
+ }
+ };
+ action.setImageDescriptor(UIPlugin.getImageDescriptor(ImageConsts.NEW_PEER));
+ addToMenu(menu, action, -1);
+
+ action = new Action(Messages.ContentProviderDelegate_newNode) {
+ @Override
+ public void run() {
+ IWizardDescriptor wizardDesc = NewWizardRegistry.getInstance().findWizard(WIZARD_ID);
+ new NewWizardShortcutAction(window, wizardDesc).run();
+ }
+ };
+ action.setImageDescriptor(UIPlugin.getImageDescriptor(ImageConsts.NEW_PEER));
+ addToMenu(menu, action, -1);
+ }
+
+ /**
+ * Adds the given action to the specified menu with an accelerator specified
+ * by the given number.
+ *
+ * @param menu the menu to add the action to
+ * @param action the action to add
+ * @param accelerator the number that should appear as an accelerator
+ */
+ protected void addToMenu(Menu menu, IAction action, int accelerator) {
+ StringBuffer label= new StringBuffer();
+ if (accelerator >= 0 && accelerator < 10) {
+ //add the numerical accelerator
+ label.append('&');
+ label.append(accelerator);
+ label.append(' ');
+ }
+ label.append(action.getText());
+ action.setText(label.toString());
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(menu, -1);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ @Override
+ public void run(IAction action) {
+ IPeerModel peerModel = getPeerModel(HistoryManager.getInstance().getFirst(IPeerType.TYPE_GENERIC));
+ if (peerModel != null) {
+ // Get the active page
+ IWorkbenchPage page = window.getActivePage();
+ // Create the editor input object
+ IEditorInput input = new EditorInput(peerModel);
+ try {
+ // Opens the configuration editor
+ page.openEditor(input, IUIConstants.ID_EDITOR);
+ }
+ catch (PartInitException e) {
+ }
+ return;
+ }
+ IWizardDescriptor wizardDesc = NewWizardRegistry.getInstance().findWizard(WIZARD_ID);
+ new NewWizardShortcutAction(window, wizardDesc).run();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
+ */
+ @Override
+ public void runWithEvent(IAction action, Event event) {
+ run(action);
+ }
+
+ /**
+ * Get the label provider for a peer model node.
+ *
+ * @param peerModel The peer model node.
+ * @return The label provider or <code>null</code>.
+ */
+ protected ILabelProvider getLabelProvider(IPeerModel peerModel) {
+ ILabelProvider labelProvider = (ILabelProvider)peerModel.getAdapter(ILabelProvider.class);
+ if (labelProvider == null) {
+ labelProvider = (ILabelProvider)Platform.getAdapterManager().loadAdapter(peerModel, 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 64ded3e49..17ca22c69 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
@@ -225,6 +225,9 @@ public class UIPlugin extends AbstractUIPlugin {
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "discovery_root.gif"); //$NON-NLS-1$
registry.put(ImageConsts.DISCOVERY_ROOT, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ELCL + "newTarget_wiz.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.NEW_PEER, ImageDescriptor.createFromURL(url));
+
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OVR + "gold_ovr.gif"); //$NON-NLS-1$
registry.put(ImageConsts.GOLD_OVR, ImageDescriptor.createFromURL(url));
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OVR + "green_ovr.gif"); //$NON-NLS-1$
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/AgentSelectionDialog.java
index af4a603b9..6e7cde58c 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/AgentSelectionDialog.java
@@ -12,6 +12,7 @@ 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 org.eclipse.core.runtime.Assert;
@@ -167,6 +168,15 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog {
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();
+
+ 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$
+
+ if (isValueAdd) iterator.remove();
+ }
}
viewer.setInput(nodes.size() > 0 ? nodes.toArray(new IPeerModel[nodes.size()]) : null);
viewer.addDoubleClickListener(new IDoubleClickListener() {
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 a25dc6291..d31f046fa 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,6 +16,7 @@ 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.runtime.persistence.history.HistoryManager;
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;
@@ -51,6 +52,11 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm
return;
}
super.setInput(input);
+ final IPeerModel peerModel = (IPeerModel)input.getAdapter(IPeerModel.class);
+ if (peerModel != null) {
+ // save history to reopen the editor on eclipse startup
+ HistoryManager.getInstance().add(getHistoryId(), peerModel.getPeerId());
+ }
}
/**
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 0580ff2e2..1fbd2ee62 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
@@ -19,10 +19,12 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.persistence.history.HistoryManager;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil;
import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.core.interfaces.IPeerType;
import org.eclipse.tcf.te.tcf.locator.ScannerRunnable;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
@@ -169,8 +171,16 @@ public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage {
*/
@Override
protected void setInput(IEditorInput input) {
+ IEditorInput oldInput = getEditorInput();
+ // do nothing when input did not change
+ if (oldInput != null && oldInput.equals(input)) {
+ return;
+ }
super.setInput(input);
if (getEditorInputNode() instanceof IPeerModel) {
+ // save history to reopen the editor on eclipse startup
+ HistoryManager.getInstance().add(IPeerType.TYPE_GENERIC, ((IPeerModel)getEditorInputNode()).getPeerId());
+ // Invoke the scanner runnable
ScannerRunnable runnable = new ScannerRunnable(null, ((IPeerModel)getEditorInputNode()));
Protocol.invokeLater(runnable);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java
index edb50ee72..d5a2972bd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java
@@ -76,6 +76,11 @@ public interface ImageConsts {
public static final String DISCOVERY_ROOT = "RemotePeerDiscoverRootNodeObject"; //$NON-NLS-1$
/**
+ * The key to access the new peer wizard image.
+ */
+ public static final String NEW_PEER = "NewPeerObject"; //$NON-NLS-1$
+
+ /**
* The key to access the peer object gold overlay image.
*/
public static final String GOLD_OVR = "GoldOverlay"; //$NON-NLS-1$
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
new file mode 100644
index 000000000..c33a9afcd
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/filter/GenericFilter.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.ui.navigator.filter;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.jface.viewers.TreePath;
+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.ui.navigator.nodes.PeerRedirectorGroupNode;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
+import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants;
+
+/**
+ * Filter implementation filtering generic from the root level.
+ */
+public class GenericFilter 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, final Object element) {
+ boolean visible = true;
+
+ if (element instanceof IPeerModel) {
+ 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));
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ boolean belongsTo = type.get() == null || IPeerType.TYPE_GENERIC.equals(type.get());
+
+ if (parentElement instanceof TreePath) {
+ // If the direct parent is not a PeerRedirectorGroupNode, look at the very first
+ // element in the tree path as parent, which is likely the category.
+ Object candidate = ((TreePath)parentElement).getSegment(((TreePath)parentElement).getSegmentCount() - 1);
+ if (candidate instanceof PeerRedirectorGroupNode) parentElement = candidate;
+ else parentElement = ((TreePath)parentElement).getFirstSegment();
+ }
+ if (parentElement instanceof ICategory) {
+ if (IUIConstants.ID_CAT_MY_TARGETS.equals(((ICategory)parentElement).getId()) || IUIConstants.ID_CAT_NEIGHBORHOOD.equals(((ICategory)parentElement).getId())) {
+ visible = belongsTo;
+ }
+ else if (!IUIConstants.ID_CAT_FAVORITES.equals(((ICategory)parentElement).getId())) {
+ visible = !belongsTo;
+ }
+ }
+ else if (!(parentElement instanceof PeerRedirectorGroupNode)) {
+ visible = belongsTo;
+ }
+ }
+
+ return visible;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
index 232a4ddd5..08084ef8f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
@@ -85,6 +85,8 @@ public class Messages extends NLS {
public static String AttributesSection_title;
public static String AttributesSection_description;
+ public static String ContentProviderDelegate_newNode;
+
public static String NewTargetWizard_windowTitle;
public static String NewTargetWizard_newPeer_name;
public static String NewTargetWizard_error_savePeer;
@@ -189,6 +191,11 @@ public class Messages extends NLS {
public static String AbstractConfigWizardPage_advancedButton_label;
public static String AbstractConfigWizardPage_connectJob_label;
+ public static String ToolbarAction_selectPeer;
+ public static String ToolbarAction_selectionDialog_title;
+ public static String ToolbarAction_selectionDialog_description;
+ public static String ToolbarAction_selectionDialog_button_showOnlyReachable;
+
public static String LoggingPreferencePage_label;
public static String LoggingPreferencePage_enabled_label;
public static String LoggingPreferencePage_monitorEnabled_label;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
index b5a670b8f..794adabc6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
@@ -44,6 +44,8 @@ ServicesSection_group_remote_title=Remote Services
AttributesSection_title=Attributes
AttributesSection_description=This section describes the custom attributes.
+ContentProviderDelegate_newNode=Create New Target...
+
NewTargetWizard_windowTitle=New Target
NewTargetWizard_newPeer_name=New Target {0}
NewTargetWizard_error_savePeer=Failed to save target: {0}
@@ -146,6 +148,11 @@ AbstractConfigWizardPage_launchDbg_label=Start debugger after connection has bee
AbstractConfigWizardPage_advancedButton_label=Advanced...
AbstractConfigWizardPage_connectJob_label=Connect ''{0}''
+ToolbarAction_selectPeer=Select Existing Target...
+ToolbarAction_selectionDialog_title=Select Existing Target
+ToolbarAction_selectionDialog_description=Select a existing target.
+ToolbarAction_selectionDialog_button_showOnlyReachable=Show only reachable targets
+
# ***** Preference Pages *****
LoggingPreferencePage_label=Logging settings for agent communication:

Back to the top