Runtime

org.eclipse.gmf.runtime.common.ui.services.action.filter
Class ActionFilterService

java.lang.Object
  extended by org.eclipse.gmf.runtime.common.core.service.AbstractProvider
      extended by org.eclipse.gmf.runtime.common.core.service.Service
          extended by org.eclipse.gmf.runtime.common.ui.services.action.filter.ActionFilterService
All Implemented Interfaces:
java.util.EventListener, IOperationHistoryListener, IProvider, IProviderChangeListener, org.eclipse.gmf.runtime.common.ui.services.action.internal.filter.IActionFilterProvider, IActionFilter

public class ActionFilterService
extends Service
implements org.eclipse.gmf.runtime.common.ui.services.action.internal.filter.IActionFilterProvider, IOperationHistoryListener

A service that provides action filters that can be used in evaluating action expressions.


Nested Class Summary
protected static class ActionFilterService.ProviderDescriptor
          A descriptor for action filter providers defined by a configuration element.
 
Field Summary
protected static java.lang.String PREFIX
          Prefix for action expressions that use the action filter service.
 
Fields inherited from class org.eclipse.gmf.runtime.common.core.service.Service
INVALID_ELEMENT_MESSAGE_PATTERN
 
Constructor Summary
protected ActionFilterService()
          Constructs a new action filter service.
 
Method Summary
 void clearCachedResults()
          Clears this action filter service's cached results.
protected  ActionManager getActionManager()
          Retrieves the action manager for this action filter service.
static ActionFilterService getInstance()
          Retrieves the singleton instance of the action filter service.
protected  IOperationHistory getOperationHistory()
          Returns the operation history from my action manager.
 void historyNotification(OperationHistoryEvent event)
          Clears my cache when my operation history changes.
protected  Service.ProviderDescriptor newProviderDescriptor(IConfigurationElement element)
          Creates a new action filter provider descriptor for the specified configuration element.
 boolean testAttribute(java.lang.Object target, java.lang.String name, java.lang.String value)
          Returns whether the specific attribute matches the state of the target object.
protected  void updateCachedData()
          Updates the cached results and selection based on the current selection.
 
Methods inherited from class org.eclipse.gmf.runtime.common.core.service.Service
addProvider, clearCache, configureProviders, configureProviders, createPriorityCache, execute, executeUnique, getAllProviders, getCachingKey, getPriority, getProviders, isOptimistic, isOptimized, providerChanged, provides, provides, removeProvider
 
Methods inherited from class org.eclipse.gmf.runtime.common.core.service.AbstractProvider
addProviderChangeListener, fireProviderChange, removeProviderChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.gmf.runtime.common.core.service.IProvider
addProviderChangeListener, provides, removeProviderChangeListener
 

Field Detail

PREFIX

protected static final java.lang.String PREFIX
Prefix for action expressions that use the action filter service.

See Also:
Constant Field Values
Constructor Detail

ActionFilterService

protected ActionFilterService()
Constructs a new action filter service.

Method Detail

getInstance

public static ActionFilterService getInstance()
Retrieves the singleton instance of the action filter service.

Returns:
The action filter service singleton.

getActionManager

protected ActionManager getActionManager()
Retrieves the action manager for this action filter service.

Returns:
The action manager for this action filter service.

getOperationHistory

protected IOperationHistory getOperationHistory()
Returns the operation history from my action manager.

Returns:
the operation history

newProviderDescriptor

protected Service.ProviderDescriptor newProviderDescriptor(IConfigurationElement element)
Creates a new action filter provider descriptor for the specified configuration element.

Overrides:
newProviderDescriptor in class Service
Parameters:
element - The configuration element from which to create the descriptor.
Returns:
A new action filter provider descriptor.

clearCachedResults

public final void clearCachedResults()
Clears this action filter service's cached results.

Clients are strongly discouraged from using this method. It will degrade performance.


updateCachedData

protected void updateCachedData()
Updates the cached results and selection based on the current selection.


testAttribute

public boolean testAttribute(java.lang.Object target,
                             java.lang.String name,
                             java.lang.String value)
Returns whether the specific attribute matches the state of the target object.

Specified by:
testAttribute in interface IActionFilter
Parameters:
target - The target object.
name - The attribute name.
value - The attriute value.
Returns:
true if the attribute matches; false otherwise
See Also:
IActionFilter.testAttribute(Object, String, String)

historyNotification

public void historyNotification(OperationHistoryEvent event)
Clears my cache when my operation history changes.

Specified by:
historyNotification in interface IOperationHistoryListener

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.