Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-09-19 08:48:47 -0400
committerUwe Stieber2013-09-19 08:48:47 -0400
commit6c3710b2f22199b463d0341d86ca48406ad63f6b (patch)
tree22b7cf9959fa5d9039d6a4a07e80bb44f2985a83 /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui
parent9c67aa508de3e5663b1487ee24f62f1ede709374 (diff)
downloadorg.eclipse.tcf-6c3710b2f22199b463d0341d86ca48406ad63f6b.tar.gz
org.eclipse.tcf-6c3710b2f22199b463d0341d86ca48406ad63f6b.tar.xz
org.eclipse.tcf-6c3710b2f22199b463d0341d86ca48406ad63f6b.zip
Target Explorer: Rename ISelectionService to IDefaultContextService
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/DefaultContextStatusTrimControl.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ActiveConnectionStatusTrimControl.java)66
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/SelectionService.java)30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/listeners/WorkbenchPartListener.java9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties4
7 files changed, 57 insertions, 64 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ActiveConnectionStatusTrimControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/DefaultContextStatusTrimControl.java
index 7e1ba2408..f777257d0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ActiveConnectionStatusTrimControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/DefaultContextStatusTrimControl.java
@@ -12,34 +12,29 @@ package org.eclipse.tcf.te.tcf.ui.controls;
import java.util.EventObject;
import java.util.concurrent.atomic.AtomicReference;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
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.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.services.ISelectionService;
+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;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.menus.WorkbenchWindowControlContribution;
/**
- * Default selection status bar trim control implementation.
+ * Default context status bar trim control implementation.
*/
-public class ActiveConnectionStatusTrimControl extends WorkbenchWindowControlContribution implements IEventListener {
- Text text = null;
+public class DefaultContextStatusTrimControl extends WorkbenchWindowControlContribution implements IEventListener {
+ /* default */ Text text = null;
/* (non-Javadoc)
* @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
@@ -51,36 +46,25 @@ public class ActiveConnectionStatusTrimControl extends WorkbenchWindowControlCon
layout.marginHeight = 0; layout.marginWidth = 0;
panel.setLayout(layout);
- text = new Text(panel, SWT.SINGLE | SWT.READ_ONLY);
- GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
- gd.minimumWidth = 120;
- text.setLayoutData(gd);
+ text = new Text(panel, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+ text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
text.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- text.setToolTipText(Messages.ActiveConnectionStatusTrimControl_tooltip);
+ text.setToolTipText(Messages.DefaultContextStatusTrimControl_tooltip);
- ISelectionService service = ServiceManager.getInstance().getService(ISelectionService.class);
- if (service != null) {
- IPeerModel peerModel = service.getDefaultSelection(null);
- final AtomicReference<String> selected = new AtomicReference<String>();
+ String selected = ""; //$NON-NLS-1$
+ 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;
- if (delegate == null) {
- ILabelProvider provider = (ILabelProvider)Platform.getAdapterManager().getAdapter(peerModel, ILabelProvider.class);
- if (provider instanceof ILabelProviderDelegate) {
- delegate = (ILabelProviderDelegate)provider;
- }
- }
- String label = delegate != null ? delegate.getText(peerModel) : peerModel.getName();
- selected.set(NLS.bind(Messages.ActiveConnectionStatusTrimControl_label, label));
+ selected = NLS.bind(Messages.DefaultContextStatusTrimControl_label, peerModel.getName());
}
-
- SWTControlUtil.setText(text, selected.get());
}
+ text.setText(selected);
+
// Register as listener to the selection service
- EventManager.getInstance().addEventListener(this, ChangeEvent.class, ISelectionService.class);
+ EventManager.getInstance().addEventListener(this, ChangeEvent.class, IDefaultContextService.class);
return panel;
}
@@ -101,13 +85,25 @@ public class ActiveConnectionStatusTrimControl extends WorkbenchWindowControlCon
*/
@Override
public void eventFired(EventObject event) {
- if (event.getSource() instanceof ISelectionService) {
- Display.getDefault().asyncExec(new Runnable() {
+ if (event.getSource() instanceof IDefaultContextService) {
+ final AtomicReference<String> selected = new AtomicReference<String>(""); //$NON-NLS-1$
+
+ IDefaultContextService service = (IDefaultContextService)event.getSource();
+ IPeerModel peerModel = service.getDefaultContext(null);
+ if (peerModel != null) {
+ selected.set(NLS.bind(Messages.DefaultContextStatusTrimControl_label, peerModel.getName()));
+ }
+
+ Runnable runnable = new Runnable() {
+
@Override
- public void run() {
+ public void run() {
+ SWTControlUtil.setText(text, selected.get());
getParent().update(true);
}
- });
+ };
+
+ PlatformUI.getWorkbench().getDisplay().asyncExec(runnable);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java
index 6bb9094f5..e6713f0f0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java
@@ -34,7 +34,7 @@ public interface IPreferenceKeys {
public static final String PREF_ACTIVATE_CURRENT_USER_FILTER = PREFIX + "model.currentUserFilter.activate"; //$NON-NLS-1$
/**
- * Preference key to access the flag to enable the active connection status bar trim area.
+ * Preference key to access the flag to enable the default context status bar trim area.
*/
- public static final String PREF_ACTIVE_CONNECTION_TRIM_AREA_ENABLE = PREFIX + "feature.statusbar.trim.activeconnection.enable"; //$NON-NLS-1$
+ public static final String PREF_DEFAULT_CONTEXT_TRIM_AREA_ENABLE = PREFIX + "feature.statusbar.trim.defaultcontext.enable"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java
index df410dc86..53fe6036f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java
@@ -37,7 +37,7 @@ public class PreferencesInitializer extends AbstractPreferenceInitializer {
store.setDefault(IPreferenceKeys.PREF_HIDE_VALUEADDS, true);
// [Hidden] Activate current user filter: default off
store.setDefault(IPreferenceKeys.PREF_ACTIVATE_CURRENT_USER_FILTER, false);
- // [Hidden] Enable active connection status bar trim area: default off
- store.setDefault(IPreferenceKeys.PREF_ACTIVE_CONNECTION_TRIM_AREA_ENABLE, false);
+ // [Hidden] Enable default context status bar trim area: default off
+ store.setDefault(IPreferenceKeys.PREF_DEFAULT_CONTEXT_TRIM_AREA_ENABLE, false);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/SelectionService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java
index 4e1476701..545268c8f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/SelectionService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java
@@ -28,8 +28,8 @@ 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.services.IDefaultContextService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService;
-import org.eclipse.tcf.te.tcf.locator.interfaces.services.ISelectionService;
import org.eclipse.tcf.te.tcf.locator.model.Model;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchWindow;
@@ -37,26 +37,26 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.CommonNavigator;
/**
- * Selection service implementation.
+ * Default context service implementation.
*/
-public class SelectionService extends AbstractService implements ISelectionService {
+public class DefaultContextService extends AbstractService implements IDefaultContextService {
/**
- * Part id: System Manager view
+ * Part id: System Management view
*/
private static final String PART_ID_TE_VIEW = "org.eclipse.tcf.te.ui.views.View"; //$NON-NLS-1$
/**
* Constructor.
*/
- public SelectionService() {
+ public DefaultContextService() {
}
/* (non-Javadoc)
- * @see com.windriver.te.tcf.core.interfaces.services.ISelectionService#getCandidates(java.lang.Object, com.windriver.te.tcf.core.interfaces.services.ISelectionService.ISelectionFilter)
+ * @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, ISelectionFilter filter) {
+ public IPeerModel[] getCandidates(Object currentSelection, IContextFilter filter) {
List<IPeerModel> candidates = new ArrayList<IPeerModel>();
// add given selection first
@@ -77,10 +77,10 @@ public class SelectionService extends AbstractService implements ISelectionServi
}
/* (non-Javadoc)
- * @see com.windriver.te.tcf.core.interfaces.services.ISelectionService#setDefaultSelection(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.IPeerModel)
*/
@Override
- public void setDefaultSelection(final IPeerModel peerModel) {
+ 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));
@@ -109,10 +109,10 @@ public class SelectionService extends AbstractService implements ISelectionServi
}
/* (non-Javadoc)
- * @see com.windriver.te.tcf.core.interfaces.services.ISelectionService#getDefaultSelection(com.windriver.te.tcf.core.interfaces.services.ISelectionService.ISelectionFilter)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService#getDefaultContext(org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService.IContextFilter)
*/
@Override
- public IPeerModel getDefaultSelection(ISelectionFilter filter) {
+ public IPeerModel getDefaultContext(IContextFilter filter) {
for (String peerId : HistoryManager.getInstance().getHistory(getClass().getName())) {
IPeerModel peerModel = addCandidate(getPeerModel(peerId), filter, null);
if (peerModel != null) {
@@ -124,7 +124,7 @@ public class SelectionService extends AbstractService implements ISelectionServi
}
- private IPeerModel addCandidate(IPeerModel peerModel, ISelectionFilter filter, List<IPeerModel> candidates) {
+ 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);
@@ -135,7 +135,7 @@ public class SelectionService extends AbstractService implements ISelectionServi
return null;
}
- private void addCandidates(IStructuredSelection selection, ISelectionFilter filter, List<IPeerModel> candidates) {
+ private void addCandidates(IStructuredSelection selection, IContextFilter filter, List<IPeerModel> candidates) {
if (selection != null) {
Iterator<Object> it = selection.iterator();
while (it.hasNext()) {
@@ -144,13 +144,13 @@ public class SelectionService extends AbstractService implements ISelectionServi
}
}
- private void addCandidates(IPeerModel[] peerModels, ISelectionFilter filter, List<IPeerModel> candidates) {
+ private void addCandidates(IPeerModel[] peerModels, IContextFilter filter, List<IPeerModel> candidates) {
for (IPeerModel peerModel : peerModels) {
addCandidate(peerModel, filter, candidates);
}
}
- private IPeerModel[] getDefaultSelections(ISelectionFilter filter) {
+ private IPeerModel[] getDefaultSelections(IContextFilter filter) {
List<IPeerModel> candidates = new ArrayList<IPeerModel>();
for (String peerId : HistoryManager.getInstance().getHistory(getClass().getName())) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/listeners/WorkbenchPartListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/listeners/WorkbenchPartListener.java
index bdc37eb35..6348635ae 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/listeners/WorkbenchPartListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/listeners/WorkbenchPartListener.java
@@ -12,7 +12,7 @@ package org.eclipse.tcf.te.tcf.ui.listeners;
import org.eclipse.core.runtime.Platform;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.services.ISelectionService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService;
import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
@@ -71,11 +71,8 @@ public class WorkbenchPartListener implements IPartListener2 {
if (part != null) {
IPeerModel peerModel = (IPeerModel)Platform.getAdapterManager().getAdapter(part.getEditorInput(), IPeerModel.class);
if (peerModel != null) {
- ISelectionService selService = ServiceManager.getInstance().getService(ISelectionService.class);
- if (selService != null) {
- selService.setDefaultSelection(peerModel);
- }
-
+ IDefaultContextService service = ServiceManager.getInstance().getService(IDefaultContextService.class);
+ if (service != null) service.setDefaultContext(peerModel);
}
}
}
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 7561219f7..67da4c3dc 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
@@ -240,6 +240,6 @@ public class Messages extends NLS {
public static String PeerImportWizardPage_overwriteDialog_message;
public static String PeerImportWizardPage_overwriteDialogToggle_message;
- public static String ActiveConnectionStatusTrimControl_label;
- public static String ActiveConnectionStatusTrimControl_tooltip;
+ public static String DefaultContextStatusTrimControl_label;
+ public static String DefaultContextStatusTrimControl_tooltip;
}
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 7178b5bd6..398981ce8 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
@@ -199,6 +199,6 @@ PeerImportWizardPage_overwrite_button=Overwrite existing configuration(s) withou
PeerImportWizardPage_overwriteDialog_message=The configuration ''{0}'' already exists. Do you want to overwrite it?
PeerImportWizardPage_overwriteDialogToggle_message=Remember my decision
-ActiveConnectionStatusTrimControl_label={0}
-ActiveConnectionStatusTrimControl_tooltip=Most recently used connection
+DefaultContextStatusTrimControl_label={0}
+DefaultContextStatusTrimControl_tooltip=Most recently used context

Back to the top