Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-10-19 14:35:30 +0000
committerUwe Stieber2012-10-19 14:35:30 +0000
commite3e569b894c779b39111a67147a2547ef4861873 (patch)
tree4443363bd65a9aa0ef8e3e12bf85e3c094af6d63 /target_explorer
parent1c30112b32f7b9fc055b5d950f5c47890d0b2a76 (diff)
downloadorg.eclipse.tcf-e3e569b894c779b39111a67147a2547ef4861873.tar.gz
org.eclipse.tcf-e3e569b894c779b39111a67147a2547ef4861873.tar.xz
org.eclipse.tcf-e3e569b894c779b39111a67147a2547ef4861873.zip
Target Explorer: Fix registration of expression source provider
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml132
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/SelectionSourceProvider.java42
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/WorkbenchWindowListener.java20
3 files changed, 107 insertions, 87 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml
index e9736b6cf..759d39015 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml
@@ -565,6 +565,62 @@
</command>
</extension>
+ <extension point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.eclipse.tcf.te.ui.views.command.find"
+ icon="icons/obj16/search.gif">
+ </image>
+ <image
+ commandId="org.eclipse.tcf.te.ui.views.command.quickfilter"
+ icon="platform:/plugin/org.eclipse.ui.navigator/icons/full/elcl16/filter_ps.gif">
+ </image>
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.tcf.te.ui.views.command.ShowInGroup"
+ contextId="org.eclipse.tcf.te.ui.views.View"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M3+M2+W">
+ </key>
+ <key
+ commandId="org.eclipse.tcf.te.ui.views.command.find"
+ contextId="org.eclipse.tcf.te.ui.views.View"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+F">
+ </key>
+ <key
+ commandId="org.eclipse.tcf.te.ui.views.command.find"
+ contextId="org.eclipse.tcf.te.ui.views.Editor"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+F">
+ </key>
+ <key
+ commandId="org.eclipse.tcf.te.ui.views.command.quickfilter"
+ contextId="org.eclipse.tcf.te.ui.views.View"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+T">
+ </key>
+ <key
+ commandId="org.eclipse.tcf.te.ui.views.command.quickfilter"
+ contextId="org.eclipse.tcf.te.ui.views.Editor"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+T">
+ </key>
+ <key
+ commandId="org.eclipse.tcf.te.ui.views.command.resetfilter"
+ contextId="org.eclipse.tcf.te.ui.views.View"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="ESC">
+ </key>
+ <key
+ commandId="org.eclipse.tcf.te.ui.views.command.resetfilter"
+ contextId="org.eclipse.tcf.te.ui.views.Editor"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="ESC">
+ </key>
+ </extension>
+
<!-- Handler contributions -->
<extension point="org.eclipse.ui.handlers">
<handler
@@ -783,6 +839,7 @@
properties="parentCategoryId,validAddToCategoriesCount"
type="org.eclipse.jface.viewers.ISelection">
</propertyTester>
+
<propertyTester
class="org.eclipse.tcf.te.ui.views.internal.quickfilter.QuickFilterTester"
id="org.eclipse.tcf.te.ui.views.quickfilter.QuickFilterTester"
@@ -790,6 +847,7 @@
properties="isFilterable,isFiltering"
type="org.eclipse.jface.viewers.TreeViewer">
</propertyTester>
+
<propertyTester
class="org.eclipse.tcf.te.ui.views.internal.quickfilter.EditorQuickFilterTester"
id="org.eclipse.tcf.te.ui.views.quickfilter.EditorQuickFilterTester"
@@ -812,53 +870,9 @@
id="org.eclipse.tcf.te.ui.views.categoryFactory">
</factory>
</extension>
- <extension
- point="org.eclipse.ui.bindings">
- <key
- commandId="org.eclipse.tcf.te.ui.views.command.ShowInGroup"
- contextId="org.eclipse.tcf.te.ui.views.View"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M3+M2+W">
- </key>
- <key
- commandId="org.eclipse.tcf.te.ui.views.command.find"
- contextId="org.eclipse.tcf.te.ui.views.View"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+F">
- </key>
- <key
- commandId="org.eclipse.tcf.te.ui.views.command.find"
- contextId="org.eclipse.tcf.te.ui.views.Editor"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+F">
- </key>
- <key
- commandId="org.eclipse.tcf.te.ui.views.command.quickfilter"
- contextId="org.eclipse.tcf.te.ui.views.View"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+T">
- </key>
- <key
- commandId="org.eclipse.tcf.te.ui.views.command.quickfilter"
- contextId="org.eclipse.tcf.te.ui.views.Editor"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+T">
- </key>
- <key
- commandId="org.eclipse.tcf.te.ui.views.command.resetfilter"
- contextId="org.eclipse.tcf.te.ui.views.View"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="ESC">
- </key>
- <key
- commandId="org.eclipse.tcf.te.ui.views.command.resetfilter"
- contextId="org.eclipse.tcf.te.ui.views.Editor"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="ESC">
- </key>
- </extension>
- <extension
- point="org.eclipse.core.runtime.adapters">
+
+<!-- Adapter factory contributions -->
+ <extension point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.tcf.te.ui.views.internal.View"
class="org.eclipse.tcf.te.ui.views.internal.adapters.ViewAdapterFactory">
@@ -874,16 +888,20 @@
</adapter>
</factory>
</extension>
- <extension
- point="org.eclipse.ui.commandImages">
- <image
- commandId="org.eclipse.tcf.te.ui.views.command.find"
- icon="icons/obj16/search.gif">
- </image>
- <image
- commandId="org.eclipse.tcf.te.ui.views.command.quickfilter"
- icon="platform:/plugin/org.eclipse.ui.navigator/icons/full/elcl16/filter_ps.gif">
- </image>
+
+<!-- Source provider contributions -->
+ <extension point="org.eclipse.ui.services">
+ <sourceProvider
+ provider="org.eclipse.tcf.te.ui.views.expressions.SelectionSourceProvider">
+ <variable
+ name="systemManagerViewSelection"
+ priorityLevel="workbench">
+ </variable>
+ <variable
+ name="debugViewSelection"
+ priorityLevel="workbench">
+ </variable>
+ </sourceProvider>
</extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/SelectionSourceProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/SelectionSourceProvider.java
index 527a1c090..82474f6b6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/SelectionSourceProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/SelectionSourceProvider.java
@@ -23,6 +23,7 @@ import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.services.IEvaluationService;
import org.eclipse.ui.services.IServiceLocator;
/**
@@ -52,6 +53,9 @@ public class SelectionSourceProvider extends AbstractSourceProvider implements I
// The map containing the cached selections
private final Map<String, ISelection> cache = new HashMap<String, ISelection>();
+ // The reference to the expression evaluation service
+ private IEvaluationService service = null;
+
/* (non-Javadoc)
* @see org.eclipse.ui.AbstractSourceProvider#initialize(org.eclipse.ui.services.IServiceLocator)
*/
@@ -59,9 +63,19 @@ public class SelectionSourceProvider extends AbstractSourceProvider implements I
public void initialize(IServiceLocator locator) {
super.initialize(locator);
- // Register the source provider with the selection service
- if (PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- windowOpened(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ if (PlatformUI.getWorkbench() != null) {
+ // Register the service provider as workbench window listener
+ PlatformUI.getWorkbench().addWindowListener(this);
+ // Initialize the selection cache and the selection listener
+ if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
+ windowOpened(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ }
+ }
+
+ // Register the source provider with the expression evaluation service
+ if (locator.hasService(IEvaluationService.class)) {
+ service = (IEvaluationService)locator.getService(IEvaluationService.class);
+ if (service != null) service.addSourceProvider(this);
}
}
@@ -70,10 +84,18 @@ public class SelectionSourceProvider extends AbstractSourceProvider implements I
*/
@Override
public void dispose() {
- // Unregister the source provider from the selection service
- if (PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- windowClosed(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ // Unregister the selection listener
+ if (PlatformUI.getWorkbench() != null) {
+ // Unregister the service provide as workbench window listener
+ PlatformUI.getWorkbench().removeWindowListener(this);
+ // Unregister the selection listener
+ if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
+ windowClosed(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ }
}
+
+ // Unregister the source provider from the expression evaluation service
+ if (service != null) { service.removeSourceProvider(this); service = null; }
}
/* (non-Javadoc)
@@ -106,7 +128,7 @@ public class SelectionSourceProvider extends AbstractSourceProvider implements I
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
String partId = part != null ? part.getSite().getId() : null;
- if (!IUIConstants.ID_EXPLORER.equals(partId) || ID_DEBUG_VIEW.equals(partId)) {
+ if (!IUIConstants.ID_EXPLORER.equals(partId) && !ID_DEBUG_VIEW.equals(partId)) {
return;
}
@@ -115,7 +137,7 @@ public class SelectionSourceProvider extends AbstractSourceProvider implements I
else cache.remove(partId);
// Fire the source changed notification
- fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, IUIConstants.ID_EXPLORER.equals(partId) ? systemManagerViewSelectionName : debugViewSelectionName,
+ fireSourceChanged(ISources.WORKBENCH, IUIConstants.ID_EXPLORER.equals(partId) ? systemManagerViewSelectionName : debugViewSelectionName,
selection != null ? selection : IEvaluationContext.UNDEFINED_VARIABLE);
}
@@ -171,14 +193,14 @@ public class SelectionSourceProvider extends AbstractSourceProvider implements I
if (selection != null) cache.put(IUIConstants.ID_EXPLORER, selection);
else cache.remove(IUIConstants.ID_EXPLORER);
- fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, systemManagerViewSelectionName,
+ fireSourceChanged(ISources.WORKBENCH, systemManagerViewSelectionName,
selection != null ? selection : IEvaluationContext.UNDEFINED_VARIABLE);
selection = service.getSelection(ID_DEBUG_VIEW);
if (selection != null) cache.put(ID_DEBUG_VIEW, selection);
else cache.remove(ID_DEBUG_VIEW);
- fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, debugViewSelectionName,
+ fireSourceChanged(ISources.WORKBENCH, debugViewSelectionName,
selection != null ? selection : IEvaluationContext.UNDEFINED_VARIABLE);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/WorkbenchWindowListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/WorkbenchWindowListener.java
index 60c8314e7..144a061a3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/WorkbenchWindowListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/WorkbenchWindowListener.java
@@ -9,14 +9,11 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.views.listeners;
-import org.eclipse.tcf.te.ui.views.expressions.SelectionSourceProvider;
import org.eclipse.ui.IPartService;
import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.services.IEvaluationService;
/**
* The window listener implementation. Takes care of the
@@ -27,24 +24,12 @@ public class WorkbenchWindowListener implements IWindowListener {
private final WorkbenchPartListener partListener = new WorkbenchPartListener();
// The global perspective listener instance
private final WorkbenchPerspectiveListener perspectiveListener = new WorkbenchPerspectiveListener();
- // The global selection service source provider
- private final SelectionSourceProvider sourceProvider = new SelectionSourceProvider();
-
- /**
- * Constructor
- */
- public WorkbenchWindowListener() {
- // Register the source provider with the evaluation service
- IEvaluationService service = (IEvaluationService)PlatformUI.getWorkbench().getService(IEvaluationService.class);
- if (service != null) service.addSourceProvider(sourceProvider);
- }
/* (non-Javadoc)
* @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
*/
@Override
public void windowActivated(IWorkbenchWindow window) {
- sourceProvider.windowActivated(window);
}
/* (non-Javadoc)
@@ -52,7 +37,6 @@ public class WorkbenchWindowListener implements IWindowListener {
*/
@Override
public void windowDeactivated(IWorkbenchWindow window) {
- sourceProvider.windowDeactivated(window);
}
/* (non-Javadoc)
@@ -60,8 +44,6 @@ public class WorkbenchWindowListener implements IWindowListener {
*/
@Override
public void windowClosed(IWorkbenchWindow window) {
- sourceProvider.windowClosed(window);
-
// On close, remove all global listeners from the window
if (window != null) {
if (window.getPartService() != null) {
@@ -76,8 +58,6 @@ public class WorkbenchWindowListener implements IWindowListener {
*/
@Override
public void windowOpened(IWorkbenchWindow window) {
- sourceProvider.windowOpened(window);
-
// On open, register all global listener to the window
if (window != null) {
if (window.getPartService() != null) {

Back to the top