Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.core.commands.contexts
Class Context


java.lang.Object
  extended by 

org.eclipse.core.commands.common.EventManager
      extended by 

org.eclipse.core.commands.common.HandleObject
          extended by 

org.eclipse.core.commands.common.NamedHandleObject
              extended by 
org.eclipse.core.commands.contexts.Context
All Implemented Interfaces:
Comparable, IIdentifiable

public final class Context
extends NamedHandleObject
implements Comparable

A context is an answer to the question "when". Other services can listen for the activation and deactivation of contexts, and change their own state in response to these changes. For example, Eclipse's key binding service listens to context activation and deactivation to determine which key bindings should be active.

An instance of this interface can be obtained from an instance of ContextManager for any identifier, whether or not an context with that identifier is defined in the extension registry.

The handle-based nature of this API allows it to work well with runtime plugin activation and deactivation. If a context is defined, that means that its corresponding plug-in is active. If the plug-in is then deactivated, the context will still exist but it will be undefined. An attempts to use an undefined context will result in a NotDefinedException being thrown.

This class is not intended to be extended by clients.

Since:
3.1
See Also:
ContextManager

Field Summary
 
Fields inherited from class org.eclipse.core.commands.common. NamedHandleObject
description, name
 
Fields inherited from class org.eclipse.core.commands.common. HandleObject
defined, id, string
 
Method Summary
 void addContextListener ( IContextListener listener)
          Registers an instance of IContextListener to listen for changes to properties of this instance.
 int compareTo ( Object object)
           
 void define ( String name, String description, String parentId)
           Defines this context by giving it a name, and possibly a description and a parent identifier as well.
  String getParentId ()
          Returns the identifier of the parent of this instance.
 void removeContextListener ( IContextListener contextListener)
          Unregisters an instance of IContextListener listening for changes to properties of this instance.
  String toString ()
          The string representation of this context -- for debugging purposes only.
 void undefine ()
          Makes this context become undefined.
 
Methods inherited from class org.eclipse.core.commands.common. NamedHandleObject
getDescription, getName
 
Methods inherited from class org.eclipse.core.commands.common. HandleObject
equals, getId, hashCode, isDefined
 
Methods inherited from class org.eclipse.core.commands.common. EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang. Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

addContextListener

public final void addContextListener(
IContextListener listener)
Registers an instance of IContextListener to listen for changes to properties of this instance.

Parameters:
listener - the instance to register. Must not be null. If an attempt is made to register an instance which is already registered with this instance, no operation is performed.

compareTo

public final int compareTo(
Object object)
Specified by:
compareTo in interface Comparable

define

public final void define(
String name,
                         
String description,
                         
String parentId)

Defines this context by giving it a name, and possibly a description and a parent identifier as well. The defined property automatically becomes true.

Notification is sent to all listeners that something has changed.

Parameters:
name - The name of this context; must not be null.
description - The description for this context; may be null.
parentId - The parent identifier for this context; may be null.

getParentId

public final 
String getParentId()
                         throws 
NotDefinedException
Returns the identifier of the parent of this instance.

Notification is sent to all registered listeners if this property changes.

Returns:
the identifier of the parent of this instance. May be null.
Throws:
NotDefinedException - if this instance is not defined.

removeContextListener

public final void removeContextListener(
IContextListener contextListener)
Unregisters an instance of IContextListener listening for changes to properties of this instance.

Parameters:
contextListener - the instance to unregister. Must not be null. If an attempt is made to unregister an instance which is not already registered with this instance, no operation is performed.

toString

public final 
String toString()
The string representation of this context -- for debugging purposes only. This string should not be shown to an end user.

Specified by:
toString in class HandleObject
Returns:
The string representation; never null.

undefine

public final void undefine()
Makes this context become undefined. This has the side effect of changing the name, description and parent identifier to null. Notification is sent to all listeners.

Specified by:
undefine in class HandleObject

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire