diff --git a/Plugins/org.blueberry.core.commands/src/berryAbstractHandler.h b/Plugins/org.blueberry.core.commands/src/berryAbstractHandler.h index daab470ee7..7a2fbdbf4a 100644 --- a/Plugins/org.blueberry.core.commands/src/berryAbstractHandler.h +++ b/Plugins/org.blueberry.core.commands/src/berryAbstractHandler.h @@ -1,159 +1,159 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYABSTRACTHANDLER_H_ #define BERRYABSTRACTHANDLER_H_ #include "berryIHandler.h" #include "berryIHandlerListener.h" #include namespace berry { /** *

* This class is a partial implementation of IHandler. This * abstract implementation provides support for handler listeners. You should * subclass from this class unless you want to implement your own listener * support. Subclasses should call - * {@link AbstractHandler#fireHandlerChanged(HandlerEvent)}when the handler - * changes. Subclasses can also override {@link AbstractHandler#isEnabled()} and - * {@link AbstractHandler#isHandled()}. + * {@link AbstractHandler#FireHandlerChanged} when the handler + * changes. Subclasses can also override {@link AbstractHandler#IsEnabled} and + * {@link AbstractHandler#IsHandled}. *

*/ class BERRY_COMMANDS AbstractHandler : public QObject, public IHandler { // ,public EventManager { Q_OBJECT Q_INTERFACES(berry::IHandler) public: berryObjectMacro(AbstractHandler); private: /** * Track this base class enabled state. */ bool baseEnabled; IHandlerListener::Events handlerListeners; public: AbstractHandler(); /** * @see IHandler#addHandlerListener(IHandlerListener) */ void AddHandlerListener(IHandlerListener* handlerListener) override; /** * The default implementation does nothing. Subclasses who attach listeners * to other objects are encouraged to detach them in this method. * * @see IHandler#Dispose() */ void Dispose() override; /** * Whether this handler is capable of executing at this time. Subclasses may * override this method. If clients override this method they should also - * consider overriding {@link #setEnabled(Object)} so they can be notified + * consider overriding {@link #SetEnabled} so they can be notified * about framework execution contexts. * * @return true - * @see #setEnabled(Object) - * @see #setBaseEnabled(boolean) + * @see #SetEnabled + * @see #SetBaseEnabled */ bool IsEnabled() const override; /** * Called by the framework to allow the handler to update its enabled state * by extracting the same information available at execution time. Clients * may override if they need to extract information from the application * context. * * @param evaluationContext * the application context. May be null * @see #SetBaseEnabled(bool) */ void SetEnabled(const Object::Pointer& evaluationContext) override; /** * Whether this handler is capable of handling delegated responsibilities at * this time. Subclasses may override this method. * * @return true */ bool IsHandled() const override; /** * @see IHandler#removeHandlerListener(IHandlerListener) */ void RemoveHandlerListener(IHandlerListener* handlerListener) override; protected: /** * Fires an event to all registered listeners describing changes to this * instance. *

* Subclasses may extend the definition of this method (i.e., if a different * type of listener can be attached to a subclass). This is used primarily * for support of AbstractHandler in * org.blueberry.ui.workbench, and clients should be wary of * overriding this behaviour. If this method is overridden, then the first * line of the method should be "super.fireHandlerChanged(handlerEvent);". *

* * @param handlerEvent * the event describing changes to this instance. Must not be * null. */ void FireHandlerChanged(const SmartPointer& handlerEvent); /** - * Allow the default {@link #isEnabled()} to answer our enabled state. It + * Allow the default {@link #IsEnabled} to answer our enabled state. It * will fire a HandlerEvent if necessary. If clients use this method they - * should also consider overriding {@link #setEnabled(Object)} so they can + * should also consider overriding {@link #SetEnabled} so they can * be notified about framework execution contexts. * * @param state * the enabled state */ void SetBaseEnabled(bool state); /** *

* Returns true iff there is one or more IHandlerListeners attached to this * AbstractHandler. *

*

* Subclasses may extend the definition of this method (i.e., if a different * type of listener can be attached to a subclass). This is used primarily * for support of AbstractHandler in * org.blueberry.ui.qt, and clients should be wary of * overriding this behaviour. If this method is overridden, then the return * value should include "super.hasListeners() ||". *

* * @return true iff there is one or more IHandlerListeners attached to this * AbstractHandler */ virtual bool HasListeners() const; }; } #endif /*BERRYABSTRACTHANDLER_H_*/ diff --git a/Plugins/org.blueberry.core.commands/src/berryCommand.h b/Plugins/org.blueberry.core.commands/src/berryCommand.h index adea1e035f..27836c032d 100644 --- a/Plugins/org.blueberry.core.commands/src/berryCommand.h +++ b/Plugins/org.blueberry.core.commands/src/berryCommand.h @@ -1,509 +1,509 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYCOMMAND_H_ #define BERRYCOMMAND_H_ #include "berryNamedHandleObjectWithState.h" #include #include #include #include #include namespace berry { class CommandCategory; class ExecutionEvent; struct IHandler; /** *

* A command is an abstract representation for some semantic behaviour. It is * not the actual implementation of this behaviour, nor is it the visual * appearance of this behaviour in the user interface. Instead, it is a bridge * between the two. *

*

* The concept of a command is based on the command design pattern. The notable * difference is how the command delegates responsibility for execution. Rather * than allowing concrete subclasses, it uses a handler mechanism (see the * handlers extension point). This provides another level of * indirection. *

*

* A command will exist in two states: defined and undefined. A command is * defined if it is declared in the XML of a resolved plug-in. If the plug-in is * unloaded or the command is simply not declared, then it is undefined. Trying * to reference an undefined command will succeed, but trying to access any of * its functionality will fail with a NotDefinedException. If * you need to know when a command changes from defined to undefined (or vice * versa), then attach a command listener. *

*

* Commands are mutable and will change as their definition changes. *

* */ class BERRY_COMMANDS Command : public NamedHandleObjectWithState, private IHandlerListener { // implements Comparable { public: berryObjectMacro(Command); /** * This flag can be set to true if commands should print * information to System.out when executing. */ static bool DEBUG_COMMAND_EXECUTION; /** * This flag can be set to true if commands should print * information to System.out when changing handlers. */ static bool DEBUG_HANDLERS; /** * This flag can be set to a particular command identifier if only that * command should print information to System.out when * changing handlers. */ static QString DEBUG_HANDLERS_COMMAND_ID; private: /** * The category to which this command belongs. This value should not be * null unless the command is undefined. */ SmartPointer category; /** * A collection of objects listening to the execution of this command. */ IExecutionListenerWithChecks::Events executionEvents; //ListenerList executionListeners; /** * A collection of objects listening to changes of this command. */ ICommandListener::Events commandEvents; /** * The handler currently associated with this command. This value may be * null if there is no handler currently. */ SmartPointer handler; /** * The help context identifier for this command. This can be * null if there is no help currently associated with the * command. */ QString helpContextId; /** * The ordered array of parameters understood by this command. This value * may be null if there are no parameters, or if the command * is undefined. It may also be empty. */ QList > parameters; /** * The type of the return value of this command. This value may be * null if the command does not declare a return type. */ SmartPointer returnType; protected: /** * Constructs a new instance of Command based on the given * identifier. When a command is first constructed, it is undefined. * Commands should only be constructed by the CommandManager * to ensure that the identifier remains unique. * * @param id * The identifier for the command. This value must not be * null, and must be unique amongst all commands. */ Command(const QString& id); friend class CommandManager; public: /** * Adds a listener to this command that will be notified when this command's * state changes. * * @param commandListener * The listener to be added; must not be null. */ void AddCommandListener(ICommandListener* commandListener); /** * Adds a listener to this command that will be notified when this command * is about to execute. * * @param executionListener * The listener to be added; must not be null. */ void AddExecutionListener(IExecutionListener* executionListener); /** *

* Adds a state to this command. This will add this state to the active * handler, if the active handler is an instance of {@link IObjectWithState}. *

*

* A single instance of {@link State} cannot be registered with multiple * commands. Each command requires its own unique instance. *

* * @param id * The identifier of the state to add; must not be * null. * @param state * The state to add; must not be null. */ void AddState(const QString& id, const SmartPointer& state) override; /** * Compares this command with another command by comparing each of its * non-transient attributes. * * @param object * The object with which to compare; must be an instance of * Command. * @return false if the object is * equal to or greater than this command. */ bool operator<(const Object* object) const override; /** *

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

*

* Notification is sent to all listeners that something has changed. *

* * @param name * The name of this command; must not be null. * @param description * The description for this command; may be null. * @param category * The category for this command; must not be null. * @param parameters * The parameters understood by this command. This value may be * either null or empty if the command does not * accept parameters. * @param returnType * The type of value returned by this command. This value may be * null if the command does not declare a return * type. * @param helpContextId * The identifier of the help context to associate with this * command; may be null if this command does not * have any help associated with it. */ void Define(const QString& name, const QString& description, const SmartPointer category, const QList >& parameters = QList >(), const SmartPointer& returnType = SmartPointer(nullptr), const QString& helpContextId = ""); /** * Executes this command by delegating to the current handler, if any. If * the debugging flag is set, then this method prints information about * which handler is selected for performing this command. This does checks * to see if the command is enabled and defined. If it is not both enabled * and defined, then the execution listeners will be notified and an * exception thrown. * * @param event * An event containing all the information about the current * state of the application; must not be null. * @return The result of the execution; may be null. This * result will be available to the client executing the command, and * execution listeners. * @throws ExecutionException * If the handler has problems executing this command. * @throws NotDefinedException * If the command you are trying to execute is not defined. * @throws NotEnabledException * If the command you are trying to execute is not enabled. * @throws NotHandledException * If there is no handler. */ Object::Pointer ExecuteWithChecks(const SmartPointer event); private: /** * Notifies the listeners for this command that it has changed in some way. * * @param commandEvent * The event to send to all of the listener; must not be * null. */ void FireCommandChanged(const SmartPointer commandEvent); /** * Notifies the execution listeners for this command that an attempt to * execute has failed because the command is not defined. * * @param e * The exception that is about to be thrown; never * null. * @since 3.2 */ void FireNotDefined(const NotDefinedException* e); /** * Notifies the execution listeners for this command that an attempt to * execute has failed because there is no handler. * * @param e * The exception that is about to be thrown; never * null. */ void FireNotEnabled(const NotEnabledException* e); /** * Notifies the execution listeners for this command that an attempt to * execute has failed because there is no handler. * * @param e * The exception that is about to be thrown; never * null. */ void FireNotHandled(const NotHandledException* e); /** * Notifies the execution listeners for this command that an attempt to * execute has failed during the execution. * * @param e * The exception that has been thrown; never null. * After this method completes, the exception will be thrown * again. */ void FirePostExecuteFailure(const ExecutionException* e); /** * Notifies the execution listeners for this command that an execution has * completed successfully. * * @param returnValue * The return value from the command; may be null. */ void FirePostExecuteSuccess(const Object::Pointer returnValue); /** * Notifies the execution listeners for this command that an attempt to * execute is about to start. * * @param event * The execution event that will be used; never null. */ void FirePreExecute(const SmartPointer event); public: /** * Returns the current handler for this command. This is used by the command * manager for determining the appropriate help context identifiers and by * the command service to allow handlers to update elements. *

* This value can change at any time and should never be cached. *

* * @return The current handler for this command; may be null. */ SmartPointer GetHandler() const; /** * Returns the help context identifier associated with this command. This * method should not be called by clients. Clients should use - * {@link CommandManager#getHelpContextId(Command)} instead. + * {@link CommandManager#GetHelpContextId} instead. * * @return The help context identifier for this command; may be * null if there is none. */ QString GetHelpContextId() const; /** * Returns the parameter with the provided id or null if this * command does not have a parameter with the id. * * @param parameterId * The id of the parameter to retrieve. * @return The parameter with the provided id or null if this * command does not have a parameter with the id. * @throws NotDefinedException * If the handle is not currently defined. */ SmartPointer GetParameter(const QString& parameterId) const; /** * Returns the parameters for this command. This call triggers provides a * copy of the array, so excessive calls to this method should be avoided. * * @return The parameters for this command. This value might be * null, if the command has no parameters. * @throws NotDefinedException * If the handle is not currently defined. */ QList > GetParameters() const; /** * Returns the {@link ParameterType} for the parameter with the provided id * or null if this command does not have a parameter type * with the id. * * @param parameterId * The id of the parameter to retrieve the {@link ParameterType} * of. * @return The {@link ParameterType} for the parameter with the provided id * or null if this command does not have a parameter * type with the provided id. * @throws NotDefinedException * If the handle is not currently defined. */ SmartPointer GetParameterType(const QString& parameterId) const; /** * Returns the {@link ParameterType} for the return value of this command or * null if this command does not declare a return value * parameter type. * * @return The {@link ParameterType} for the return value of this command or * null if this command does not declare a return * value parameter type. * @throws NotDefinedException * If the handle is not currently defined. */ SmartPointer GetReturnType() const; /** * Returns whether this command has a handler, and whether this handler is * also handled and enabled. * * @return true if the command is handled; false * otherwise. */ bool IsEnabled() const; /** * Called be the framework to allow the handler to update its enabled state. * * @param evaluationContext * the state to evaluate against. May be null * which indicates that the handler can query whatever model that * is necessary. This context must not be cached. */ void SetEnabled(const Object::Pointer& evaluationContext); /** * Returns whether this command has a handler, and whether this handler is * also handled. * * @return true if the command is handled; false * otherwise. */ bool IsHandled() const; /** * Removes a listener from this command. * * @param commandListener * The listener to be removed; must not be null. * */ void RemoveCommandListener(ICommandListener* commandListener); /** * Removes a listener from this command. * * @param executionListener * The listener to be removed; must not be null. * */ void RemoveExecutionListener(IExecutionListener* executionListener); /** *

* Removes a state from this command. This will remove the state from the * active handler, if the active handler is an instance of * {@link IObjectWithState}. *

* * @param stateId * The identifier of the state to remove; must not be * null. */ void RemoveState(const QString& stateId) override; /** * Changes the handler for this command. This will remove all the state from * the currently active handler (if any), and add it to handler. * If debugging is turned on, then this will also print information about * the change to System.out. * * @param handler * The new handler; may be null if none. * @return true if the handler changed; false * otherwise. */ bool SetHandler(const SmartPointer handler); private: /** * @return the handler listener */ IHandlerListener* GetHandlerListener(); /** * Our command will listen to the active handler for enablement changes so * that they can be fired from the command itself. */ void HandlerChanged(const SmartPointer& handlerEvent) override; public: /** * The string representation of this command -- for debugging purposes only. * This string should not be shown to an end user. * * @return The string representation; never null. */ QString ToString() const override; /** * Makes this command become undefined. This has the side effect of changing * the name and description to null. This also removes all * state and disposes of it. Notification is sent to all listeners. */ void Undefine() override; }; } #endif /*BERRYCOMMAND_H_*/ diff --git a/Plugins/org.blueberry.core.commands/src/berryCommandManager.h b/Plugins/org.blueberry.core.commands/src/berryCommandManager.h index 4cc307186f..e01dae7312 100755 --- a/Plugins/org.blueberry.core.commands/src/berryCommandManager.h +++ b/Plugins/org.blueberry.core.commands/src/berryCommandManager.h @@ -1,628 +1,628 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYCOMMANDMANAGER_H_ #define BERRYCOMMANDMANAGER_H_ #include "common/berryHandleObjectManager.h" #include "berryIExecutionListenerWithChecks.h" #include "berryICommandListener.h" #include "berryIParameterTypeListener.h" #include "berryICommandCategoryListener.h" #include "berryICommandManagerListener.h" #include namespace berry { struct IParameter; struct IHandler; class ParameterType; class ParameterizedCommand; class Parameterization; class Command; class CommandCategory; /** *

* A central repository for commands -- both in the defined and undefined * states. Commands can be created and retrieved using this manager. It is * possible to listen to changes in the collection of commands by attaching a * listener to the manager. *

* * @see CommandManager#getCommand(String) * @since 3.1 */ class BERRY_COMMANDS CommandManager: public HandleObjectManager { private: typedef HandleObjectManager::HandleObjectsSet HandleObjectsSet; typedef HandleObjectManager::HandleObjectsByIdMap HandleObjectsByIdMap; /** * A listener that forwards incoming execution events to execution listeners * on this manager. The execution events will come from any command on this * manager. */ struct ExecutionListener: public IExecutionListenerWithChecks { ExecutionListener(CommandManager* commandManager); void NotDefined(const QString& commandId, const NotDefinedException* exception) override; void NotEnabled(const QString& commandId, const NotEnabledException* exception) override; void NotHandled(const QString& commandId, const NotHandledException* exception) override; void PostExecuteFailure(const QString& commandId, const ExecutionException* exception) override; void PostExecuteSuccess(const QString& commandId, const Object::Pointer& returnValue) override; void PreExecute(const QString& commandId, const SmartPointer< const ExecutionEvent>& event) override; private: CommandManager* commandManager; }; struct CommandCategoryListener: public ICommandCategoryListener { CommandCategoryListener(CommandManager* commandManager); void CategoryChanged( const SmartPointer& categoryEvent) override; private: CommandManager* commandManager; }; QScopedPointer categoryListener; struct CommandListener: public ICommandListener { CommandListener(CommandManager* commandManager); void CommandChanged(const SmartPointer& commandEvent) override; private: CommandManager* commandManager; }; QScopedPointer commandListener; struct ParameterTypeListener: public IParameterTypeListener { ParameterTypeListener(CommandManager* commandManager); void ParameterTypeChanged( const SmartPointer& parameterTypeEvent) override; private: CommandManager* commandManager; }; QScopedPointer parameterTypeListener; public: /** * The identifier of the category in which all auto-generated commands will * appear. This value must never be null. */ static const QString AUTOGENERATED_CATEGORY_ID; // = "org.blueberry.core.commands.categories.autogenerated"; /** * The default constructor */ CommandManager(); /** * Adds a listener to this command manager. The listener will be notified * when the set of defined commands changes. This can be used to track the * global appearance and disappearance of commands. * * @param listener * The listener to attach; must not be null. */ void AddCommandManagerListener(ICommandManagerListener* listener); /** * Adds an execution listener to this manager. This listener will be * notified if any of the commands controlled by this manager execute. This * can be used to support macros and instrumentation of commands. * * @param listener * The listener to attach; must not be null. */ void AddExecutionListener(IExecutionListener* listener); /** * Sets the name and description of the category for uncategorized commands. * This is the category that will be returned if - * {@link #getCategory(String)} is called with null. + * {@link #GetCategory} is called with null. * * @param name * The name of the category for uncategorized commands; must not * be null. * @param description * The description of the category for uncategorized commands; * may be null. */ void DefineUncategorizedCategory(const QString& name, const QString& description); /** *

* Returns a {@link ParameterizedCommand} with a command and * parameterizations as specified in the provided * serializedParameterizedCommand string. The * serializedParameterizedCommand must use the format - * returned by {@link ParameterizedCommand#serialize()} and described in the + * returned by {@link ParameterizedCommand#Serialize} and described in the * Javadoc for that method. *

*

* If a parameter id encoded in the * serializedParameterizedCommand does not exist in the * encoded command, that parameter id and value are ignored. A given * parameter id should not be used more than once in * serializedParameterizedCommand. This will not result in * an exception, but in this case the value of the parameter when the * command is executed is unspecified. *

*

* This method will never return null, however it may throw * an exception if there is a problem processing the serialization string or * the encoded command is undefined. *

* * @param serializedParameterizedCommand * a string representing a command id and parameter ids and * values; must not be null * @return a {@link ParameterizedCommand} with the command and * parameterizations encoded in the * serializedParameterizedCommand; never * null. * @throws NotDefinedException * if the command indicated in * serializedParameterizedCommand is not defined * @throws SerializationException * if there is an error deserializing * serializedParameterizedCommand * @see ParameterizedCommand#serialize() */ SmartPointer Deserialize(const QString& serializedParameterizedCommand); /** * Returns all of the commands known by this manager -- defined and * undefined. * * @return All of the commands; may be empty, but never null. */ QList > GetAllCommands() const; /** * Gets the category with the given identifier. If no such category * currently exists, then the category will be created (but be undefined). * * @param categoryId * The identifier to find; must not be null. If * the category is null, then a category suitable * for uncategorized items is defined and returned. * @return The category with the given identifier; this value will never be * null, but it might be undefined. * @see Category */ SmartPointer GetCategory(const QString& categoryId); /** * Gets the command with the given identifier. If no such command currently * exists, then the command will be created (but will be undefined). * * @param commandId * The identifier to find; must not be null and * must not be zero-length. * @return The command with the given identifier; this value will never be * null, but it might be undefined. * @see Command */ SmartPointer GetCommand(const QString& commandId); /** * Returns the categories that are defined. * * @return The defined categories; this value may be empty, but it is never * null. */ QList > GetDefinedCategories(); /** * Returns the set of identifiers for those category that are defined. * * @return The set of defined category identifiers; this value may be empty, * but it is never null. */ QSet GetDefinedCategoryIds() const; /** * Returns the set of identifiers for those commands that are defined. * * @return The set of defined command identifiers; this value may be empty, * but it is never null. */ QSet GetDefinedCommandIds() const; /** * Returns the commands that are defined. * * @return The defined commands; this value may be empty, but it is never * null. */ QList > GetDefinedCommands() const; /** * Returns the set of identifiers for those parameter types that are * defined. * * @return The set of defined command parameter type identifiers; this value * may be empty, but it is never null. */ QSet GetDefinedParameterTypeIds() const; /** * Returns the command parameter types that are defined. * * @return The defined command parameter types; this value may be empty, but * it is never null. */ QList > GetDefinedParameterTypes(); /** * Gets the help context identifier for a particular command. The command's * handler is first checked for a help context identifier. If the handler * does not have a help context identifier, then the help context identifier * for the command is returned. If neither has a help context identifier, * then null is returned. * * @param command * The command for which the help context should be retrieved; * must not be null. * @return The help context identifier to use for the given command; may be * null. * @throws NotDefinedException * If the given command is not defined. */ QString GetHelpContextId(const SmartPointer command) const; /** * Gets the command {@link ParameterType} with the given identifier. If no * such command parameter type currently exists, then the command parameter * type will be created (but will be undefined). * * @param parameterTypeId * The identifier to find; must not be null and * must not be zero-length. * @return The {@link ParameterType} with the given identifier; this value * will never be null, but it might be undefined. */ SmartPointer GetParameterType(const QString& parameterTypeId); /** * Removes a listener from this command manager. * * @param listener * The listener to be removed; must not be null. */ void RemoveCommandManagerListener(ICommandManagerListener* listener); /** * Removes an execution listener from this command manager. * * @param listener * The listener to be removed; must not be null. */ void RemoveExecutionListener(IExecutionListener* listener); /** * Block updates all of the handlers for all of the commands. If the handler * is null or the command id does not exist in the map, then * the command becomes unhandled. Otherwise, the handler is set to the * corresponding value in the map. * * @param handlersByCommandId * A map of command identifiers (String) to * handlers (IHandler). This map may be * null if all handlers should be cleared. * Similarly, if the map is empty, then all commands will become * unhandled. */ void SetHandlersByCommandId( const QHash >& handlersByCommandId); /** * Sets the help context identifier to associate with a particular handler. * * @param handler * The handler with which to register a help context identifier; * must not be null. * @param helpContextId * The help context identifier to register; may be * null if the help context identifier should be * removed. */ void SetHelpContextId(const SmartPointer handler, const QString& helpContextId); /** * Fires the notEnabled event for * executionListeners. *

* Note: This supports bridging actions to the command framework, * and should not be used outside the framework. *

* * @param commandId * The command id of the command about to execute, never * null. * @param exception * The exception, never null. */ void FireNotEnabled(const QString& commandId, const NotEnabledException* exception); /** * Fires the notDefined event for * executionListeners. *

* Note: This supports bridging actions to the command framework, * and should not be used outside the framework. *

* * @param commandId * The command id of the command about to execute, never * null. * @param exception * The exception, never null. */ void FireNotDefined(const QString& commandId, const NotDefinedException* exception); /** * Fires the preExecute event for * executionListeners. *

* Note: This supports bridging actions to the command framework, * and should not be used outside the framework. *

* * @param commandId * The command id of the command about to execute, never * null. * @param event * The event that triggered the command, may be null. */ void FirePreExecute(const QString& commandId, const SmartPointer< const ExecutionEvent> event); /** * Fires the postExecuteSuccess event for * executionListeners. *

* Note: This supports bridging actions to the command framework, * and should not be used outside the framework. *

* * @param commandId * The command id of the command executed, never * null. * @param returnValue * The value returned from the command, may be null. */ void FirePostExecuteSuccess(const QString& commandId, Object::Pointer returnValue); /** * Fires the postExecuteFailure event for * executionListeners. *

* Note: This supports bridging actions to the command framework, * and should not be used outside the framework. *

* * @param commandId * The command id of the command executed, never * null. * @param exception * The exception, never null. */ void FirePostExecuteFailure(const QString& commandId, const ExecutionException* exception); protected: /** * The escape character to use for serialization and deserialization of * parameterized commands. */ static const char ESCAPE_CHAR; // = '%'; /** * The character that separates a parameter id from its value. */ static const char ID_VALUE_CHAR; // = '='; /** * The character that indicates the end of a list of parameters. */ static const char PARAMETER_END_CHAR; // = ')'; /** * The character that separators parameters from each other. */ static const char PARAMETER_SEPARATOR_CHAR; // = ','; /** * The character that indicates the start of a list of parameters. */ static const char PARAMETER_START_CHAR; // = '('; friend class ParameterizedCommand; private: /** * Unescapes special characters in the command id, parameter ids and * parameter values for {@link #deserialize(String)}. The special characters * {@link #PARAMETER_START_CHAR}, {@link #PARAMETER_END_CHAR}, * {@link #ID_VALUE_CHAR}, {@link #PARAMETER_SEPARATOR_CHAR} and * {@link #ESCAPE_CHAR} are escaped by prepending an {@link #ESCAPE_CHAR} * character. *

* See also ParameterizedCommand.escape(String) *

* * @param escapedText * a String that may contain escaped special * characters for command serialization. * @return a String representing escapedText * with any escaped characters replaced by their literal values * @throws SerializationException * if escapedText contains an invalid escape * sequence */ static QString Unescape(const QString& escapedText); /** * The map of category identifiers (String) to categories ( * Category). This collection may be empty, but it is never * null. */ QHash > categoriesById; /** * The set of identifiers for those categories that are defined. This value * may be empty, but it is never null. */ QSet definedCategoryIds; /** * The set of identifiers for those command parameter types that are * defined. This value may be empty, but it is never null. * */ QSet definedParameterTypeIds; /** * The execution listener for this command manager. This just forwards * events from commands controlled by this manager to listeners on this * manager. */ QScopedPointer executionListener; /** * The collection of execution listeners. This collection is * null if there are no listeners. */ IExecutionListenerWithChecks::Events executionEvents; /** * */ ICommandManagerListener::Events commandManagerEvents; /** * The help context identifiers ({@link String}) for a handler ({@link IHandler}). * This map may be empty, but it is never null. Entries are * removed if all strong references to the handler are removed. */ QHash, QString> helpContextIdsByHandler; /** * The map of parameter type identifiers (String) to * parameter types ( ParameterType). This collection may be * empty, but it is never null. */ QHash > parameterTypesById; /** * Notifies all of the listeners to this manager that the set of defined * command identifiers has changed. * * @param event * The event to send to all of the listeners; must not be * null. */ void FireCommandManagerChanged( const SmartPointer event); /** * Returns an array of parameterizations for the provided command by * deriving the parameter ids and values from the provided * serializedParameters string. * * @param serializedParameters * a String encoding parameter ids and values; must not be * null. * @param parameters * array of parameters of the command being deserialized; may be * null. * @return an array of parameterizations; may be null. * @throws SerializationException * if there is an error deserializing the parameters */ QList GetParameterizations( const QString& serializedParameters, const QList >& parameters) const; /** * Searches for the index of a char in a String * but disregards characters prefixed with the {@link #ESCAPE_CHAR} escape * character. This is used by {@link #deserialize(String)} and * {@link #getParameterizations(String, IParameter[])} to parse the * serialized parameterized command string. * * @param escapedText * the string to search for the index of ch in * @param ch * a character to search for in escapedText * @return the index of the first unescaped occurrence of the character in * escapedText, or -1 if the * character does not occur unescaped. * @see String#indexOf(int) */ int UnescapedIndexOf(const QString& escapedText, const char ch) const; }; } #endif /* BERRYCOMMANDMANAGER_H_ */ diff --git a/Plugins/org.blueberry.core.commands/src/berryExecutionEvent.h b/Plugins/org.blueberry.core.commands/src/berryExecutionEvent.h index d6871926b5..5b1a00cf29 100644 --- a/Plugins/org.blueberry.core.commands/src/berryExecutionEvent.h +++ b/Plugins/org.blueberry.core.commands/src/berryExecutionEvent.h @@ -1,169 +1,169 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYEXECUTIONEVENT_H_ #define BERRYEXECUTIONEVENT_H_ #include #include "berryCommand.h" #include namespace berry { /** *

* The data object to pass to the command (and its handler) as it executes. This * carries information about the current state of the application, and the * application context in which the command was executed. *

*

* An execution event carries three blocks of data: the parameters, the trigger, * and the application context. How these blocks are used is application * dependent. In the BlueBerry workbench, the trigger is an SWT event, and the * application context contains information about the selection and active part. *

*/ class BERRY_COMMANDS ExecutionEvent : public Object { public: berryObjectMacro(ExecutionEvent); typedef QHash ParameterMap; private: /** * The state of the application at the time the execution was triggered. In * the BlueBerry workbench, this might contain information about the active * part of the active selection (for example). This value may be * null. */ const Object::Pointer applicationContext; /** * The command being executed. This value may be null. */ const Command::ConstPointer command; /** * The parameters to qualify the execution. For handlers that normally * prompt for additional information, these can be used to avoid prompting. * This value may be empty, but it is never null. */ const ParameterMap parameters; /** * The object that triggered the execution. In an event-driven architecture, * this is typically just another event. In the BlueBerry workbench, this is * typically an SWT event. This value may be null. */ const Object::ConstPointer trigger; public: /** * Constructs a new instance of ExecutionEvent with no * parameters, no trigger and no application context. This is just a * convenience method. */ ExecutionEvent(); /** * Constructs a new instance of ExecutionEvent. * * @param command * The command being executed; may be null. * @param parameters * The parameters to qualify the execution; must not be * null. This must be a map of parameter ids (String) * to parameter values (String). * @param trigger * The object that triggered the execution; may be * null. * @param applicationContext * The state of the application at the time the execution was * triggered; may be null. */ ExecutionEvent(const Command::ConstPointer& command, const ParameterMap& parameters, const Object::ConstPointer& trigger, const Object::Pointer& applicationContext); /** * Returns the state of the application at the time the execution was * triggered. * * @return The application context; may be null. */ const Object::Pointer GetApplicationContext() const; /** * Returns the command being executed. * * @return The command being executed. */ const Command::ConstPointer GetCommand() const; /** * Returns the object represented by the string value of the parameter with * the provided id. *

* This is intended to be used in the scope of an - * {@link IHandler#execute(ExecutionEvent)} method, so any problem getting + * {@link IHandler#Execute} method, so any problem getting * the object value causes ExecutionException to be thrown. *

* * @param parameterId * The id of a parameter to retrieve the object value of. * @return The object value of the parameter with the provided id. * @throws ExecutionException * if the parameter object value could not be obtained for any * reason */ const Object::ConstPointer GetObjectParameterForExecution(const QString& parameterId) const; /** * Returns the value of the parameter with the given id. * * @param parameterId * The id of the parameter to retrieve; may be null. * @return The parameter value; null if the parameter cannot * be found. */ QString GetParameter(const QString ¶meterId) const; /** * Returns all of the parameters. * * @return The parameters; never null, but may be empty. */ const ParameterMap& GetParameters() const; /** * Returns the object that triggered the execution * * @return The trigger; null if there was no trigger. */ const Object::ConstPointer GetTrigger() const; /** * The string representation of this execution event -- for debugging * purposes only. This string should not be shown to an end user. */ QString ToString() const override; }; } #endif /*BERRYEXECUTIONEVENT_H_*/ diff --git a/Plugins/org.blueberry.core.expressions/src/berryEvaluationContext.h b/Plugins/org.blueberry.core.expressions/src/berryEvaluationContext.h index de5874b8b1..6a37bbfbcd 100644 --- a/Plugins/org.blueberry.core.expressions/src/berryEvaluationContext.h +++ b/Plugins/org.blueberry.core.expressions/src/berryEvaluationContext.h @@ -1,121 +1,121 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYEVALUATIONCONTEXT_H_ #define BERRYEVALUATIONCONTEXT_H_ #include "berryIEvaluationContext.h" #include "berryIVariableResolver.h" #include #include "Poco/Any.h" #include #include namespace berry { /** * A default implementation of an evaluation context. *

* Clients may instantiate this default context. The class is * not intended to be subclassed by clients. *

* * @since 3.0 */ class BERRY_EXPRESSIONS EvaluationContext : public IEvaluationContext { private: IEvaluationContext* const fParent; Object::ConstPointer fDefaultVariable; QHash fVariables; std::vector fVariableResolvers; int fAllowPluginActivation; public: /** * Create a new evaluation context with the given parent and default * variable. * * @param parent the parent context. Can be null. * @param defaultVariable the default variable */ EvaluationContext(IEvaluationContext* parent, const Object::ConstPointer& defaultVariable); /** * Create a new evaluation context with the given parent and default * variable. * * @param parent the parent context. Can be null. * @param defaultVariable the default variable * @param resolvers an array of IVariableResolvers to * resolve additional variables. * - * @see #resolveVariable(String, Object[]) + * @see #ResolveVariable */ EvaluationContext(IEvaluationContext* parent, const Object::ConstPointer& defaultVariable, const std::vector& resolvers); /** * {@inheritDoc} */ IEvaluationContext* GetParent() const override; /** * {@inheritDoc} */ IEvaluationContext* GetRoot() const override; /** * {@inheritDoc} */ Object::ConstPointer GetDefaultVariable() const override; /** * {@inheritDoc} */ void SetAllowPluginActivation(bool value) override; /** * {@inheritDoc} */ bool GetAllowPluginActivation() const override; /** * {@inheritDoc} */ void AddVariable(const QString& name, const Object::ConstPointer& value) override; /** * {@inheritDoc} */ Object::ConstPointer RemoveVariable(const QString& name) override; /** * {@inheritDoc} */ Object::ConstPointer GetVariable(const QString &name) const override; /** * {@inheritDoc} */ Object::ConstPointer ResolveVariable(const QString& name, const QList& args) const override; }; } // namespace berry #endif /*BERRYEVALUATIONCONTEXT_H_*/ diff --git a/Plugins/org.blueberry.core.expressions/src/berryEvaluationResult.h b/Plugins/org.blueberry.core.expressions/src/berryEvaluationResult.h index 1ca4427706..ff39bd7fdb 100644 --- a/Plugins/org.blueberry.core.expressions/src/berryEvaluationResult.h +++ b/Plugins/org.blueberry.core.expressions/src/berryEvaluationResult.h @@ -1,231 +1,207 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYEVALUATIONRESULT_ #define BERRYEVALUATIONRESULT_ #include #include #include namespace berry { /** * An evaluation result represents the result of an expression * evaluation. There are exact three instances of evaluation * result. They are: FALSE_EVAL, TRUE_EVAL and * NOT_LOADED. NOT_LOADED represents * the fact that an expression couldn't be evaluated since a * plug-in providing certain test expressions isn't loaded yet. *

* In addition the class implements the three operation and * , or and not. The operation are * defined as follows: *

*

* The and operation: *

* - * - * - * - * - * - * - * * * * * * * * * * * * * * * * * * * * * * * * * - * *
ANDFALSE_EVALTRUE_EVALNOT_LOADED
FALSE_EVALFALSE_EVALFALSE_EVALFALSE_EVAL
TRUE_EVALFALSE_EVALTRUE_EVALNOT_LOADED
NOT_LOADEDFALSE_EVALNOT_LOADEDNOT_LOADED
*

* The or operation: *

* - * - * - * - * - * - * - * * * * * * * * * * * * * * * * * * * * * * * * * - * *
ORFALSE_EVALTRUE_EVALNOT_LOADED
FALSE_EVALFALSE_EVALTRUE_EVALNOT_LOADED
TRUE_EVALTRUE_EVALTRUE_EVALTRUE_EVAL
NOT_LOADEDNOT_LOADEDTRUE_EVALNOT_LOADED
*

* The not operation: *

* - * - * - * - * - * - * - * * - * + * * * * * * * * * * * - * *
NOTNOTFALSE_EVALTRUE_EVALNOT_LOADED
TRUE_EVALFALSE_EVALNOT_LOADED
* *

* The class is not intended to be subclassed by clients. *

* @since 3.0 */ class BERRY_EXPRESSIONS EvaluationResult : public Object { private: int fValue; static const int FALSE_VALUE; static const int TRUE_VALUE; static const int NOT_LOADED_VALUE; public: /** The evaluation result representing the value FALSE */ static const SmartPointer FALSE_EVAL; /** The evaluation result representing the value TRUE */ static const SmartPointer TRUE_EVAL; /** The evaluation result representing the value NOT_LOADED */ static const SmartPointer NOT_LOADED; private: static const SmartPointer AND[3][3]; static const SmartPointer OR[3][3]; static const SmartPointer NOT[3]; /* * No instances outside of EvaluationResult */ EvaluationResult(int value); EvaluationResult(const EvaluationResult& o); public: berryObjectMacro(berry::EvaluationResult); bool operator==(const Object*) const override; bool operator!=(const Object*) const; /** * Returns an EvaluationResult whose value is this && other). * * @param other the right hand side of the and operation. * * @return this && other as defined by the evaluation result */ EvaluationResult::ConstPointer And(const EvaluationResult::ConstPointer& other) const; /** * Returns an EvaluationResult whose value is this || other). * * @param other the right hand side of the or operation. * * @return this || other as defined by the evaluation result */ EvaluationResult::ConstPointer Or(const EvaluationResult::ConstPointer& other) const; /** * Returns the inverted value of this evaluation result * * @return the inverted value of this evaluation result */ EvaluationResult::ConstPointer Not() const; /** * Returns an evaluation result instance representing the * given boolean value. If the given boolean value is * TRUE_EVAL then ExpressionResult.TRUE_EVAL * is returned. If the value is FALSE_EVAL then * ExpressionResult.FALSE_EVAL is returned. * * @param b a boolean value * * @return the expression result representing the boolean * value */ static EvaluationResult::ConstPointer ValueOf(bool b); /** * For debugging purpose only * * @return a string representing this object. The result is not * human readable */ QString ToString() const override; }; } // namespace berry #endif /*BERRYEVALUATIONRESULT_*/ diff --git a/Plugins/org.blueberry.core.expressions/src/berryExpression.h b/Plugins/org.blueberry.core.expressions/src/berryExpression.h index 24922ea25a..620027e477 100644 --- a/Plugins/org.blueberry.core.expressions/src/berryExpression.h +++ b/Plugins/org.blueberry.core.expressions/src/berryExpression.h @@ -1,220 +1,207 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYEXPRESSION_H_ #define BERRYEXPRESSION_H_ #include "berryExpressionInfo.h" #include "berryIEvaluationContext.h" #include "berryEvaluationResult.h" #include #include #include namespace berry { /** * Abstract base class for all expressions provided by the common * expression language. *

- * An expression is evaluated by calling {@link #evaluate(IEvaluationContext)}. + * An expression is evaluated by calling {@link #Evaluate}. *

*

* This class may be subclassed to provide specific expressions. *

*/ class BERRY_EXPRESSIONS Expression : public Object { public: berryObjectMacro(Expression); /** * The constant integer hash code value meaning the hash code has not yet * been computed. */ static const uint HASH_CODE_NOT_COMPUTED; /** * A factor for computing the hash code for all expressions. */ static const uint HASH_FACTOR; /** * Name of the value attribute of an expression (value is value). */ static const QString ATT_VALUE; private: /** * The hash code for this object. This value is computed lazily. If it is * not yet computed, it is equal to {@link #HASH_CODE_NOT_COMPUTED}. */ mutable uint fHashCode; protected: - /** - * Checks whether two objects are equal using the - * equals(Object) method of the left object. - * This method handles null for either the left - * or right object. - * - * @param left the first object to compare; may be null. - * @param right the second object to compare; may be null. - * @return TRUE_EVAL if the two objects are equivalent; - * FALSE_EVAL otherwise. - */ - // static bool Equals(final Object left, final Object right); - /** * Tests whether two arrays of objects are equal to each other. The arrays * must not be null, but their elements may be * null. * * @param leftArray the left array to compare; may be null, and * may be empty and may contain null elements. * @param rightArray the right array to compare; may be null, * and may be empty and may contain null elements. * * @return TRUE_EVAL if the arrays are equal length and the elements * at the same position are equal; FALSE_EVAL otherwise. */ static bool Equals(const QList& leftArray, const QList& rightArray); static bool Equals(const QList& leftArray, const QList& rightArray); /** * Returns the hash code for the given object. This method * handles null. * * @param object the object for which the hash code is desired; may be * null. * * @return The hash code of the object; zero if the object is * null. */ static uint HashCode(Expression::Pointer object); /** * Returns the hash code for the given array. This method handles * null. * * @param array the array for which the hash code is desired; may be * null. * @return the hash code of the array; zero if the object is * null. */ static uint HashCode(const QList& array); static uint HashCode(const QList& array); /** * Method to compute the hash code for this object. The result * returned from this method is cached in the fHashCode * field. If the value returned from the method equals {@link #HASH_CODE_NOT_COMPUTED} * (e.g. -1) then the value is incremented by one. *

* This default implementation calls super.hashCode() *

* @return a hash code for this object. */ virtual uint ComputeHashCode() const; public: /** * The expression corresponding to {@link EvaluationResult#TRUE_EVAL}. */ static const Expression::Pointer TRUE_EVAL; /** * The expression corresponding to {@link EvaluationResult#FALSE_EVAL}. */ static const Expression::Pointer FALSE_EVAL; Expression(); ~Expression() override; uint HashCode() const override; /** * Evaluates this expression. * * @param context an evaluation context providing information like variable, * name spaces, etc. necessary to evaluate this expression * * @return the result of the expression evaluation * * @throws CoreException if the evaluation failed. The concrete reason is * defined by the subclass implementing this method */ virtual SmartPointer Evaluate(IEvaluationContext* context) const = 0; /** * Computes the expression information for the given expression tree. *

* This is a convenience method for collecting the expression information - * using {@link Expression#collectExpressionInfo(ExpressionInfo)}. + * using {@link Expression#CollectExpressionInfo}. *

* * @return the expression information */ virtual const ExpressionInfo* ComputeExpressionInfo() const; /** * Collects information about this expression tree. This default * implementation add the expression's type to the set of misbehaving * expression types. * * @param info the expression information object used * to collect the information */ virtual void CollectExpressionInfo(ExpressionInfo* info) const; QString ToString() const override; bool operator==(const Object* object) const override; }; class TRUE_EVALExpression : public Expression { public: SmartPointer Evaluate(IEvaluationContext* /*context*/) const override { return EvaluationResult::TRUE_EVAL; } void CollectExpressionInfo(ExpressionInfo* /*info*/) const override {} }; class FALSE_EVALExpression : public Expression { public: SmartPointer Evaluate(IEvaluationContext* /*context*/) const override { return EvaluationResult::FALSE_EVAL; } void CollectExpressionInfo(ExpressionInfo* /*info*/) const override {} }; } // namespace berry #endif /*BERRYEXPRESSION_H_*/ diff --git a/Plugins/org.blueberry.core.expressions/src/berryExpressionConverter.h b/Plugins/org.blueberry.core.expressions/src/berryExpressionConverter.h index f7a6d88c58..8d973f23e8 100644 --- a/Plugins/org.blueberry.core.expressions/src/berryExpressionConverter.h +++ b/Plugins/org.blueberry.core.expressions/src/berryExpressionConverter.h @@ -1,123 +1,123 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYEXPRESSIONCONVERTER_H_ #define BERRYEXPRESSIONCONVERTER_H_ #include #include #include namespace Poco { namespace XML { class Element; } } namespace berry { struct IConfigurationElement; class CompositeExpression; class ElementHandler; class Expression; /** * An expression converter converts an XML expression represented by an - * {@link IConfigurationElement} or {@link Element} (DOM) subtree into a + * {@link IConfigurationElement} (DOM) subtree into a * corresponding expression tree. * *

* An expression converter manages a list of {@link ElementHandler}s. Element * handlers are responsible to do the actual conversion. The element handlers * build a chain of responsibility. *

* * @since 3.0 */ class BERRY_EXPRESSIONS ExpressionConverter { private: QList > fHandlers; static ExpressionConverter* INSTANCE; public: /** * Returns the default expression converter. The default expression converter * can cope with all expression elements defined by the common expression * language. * * @return the default expression converter */ static ExpressionConverter* GetDefault(); /** * Creates a new expression converter with the given list of element * handlers. The element handlers build a chain of responsibility * meaning that the first handler in the list is first used to * convert the configuration element. If this handler isn't able * to convert the configuration element the next handler in the * array is used. * * @param handlers the array of element handlers */ ExpressionConverter(const QList >& handlers); /** * Converts the tree of configuration elements represented by the given * root element and returns a corresponding expression tree. * * @param root the configuration element to be converted * * @return the corresponding expression tree or null * if the configuration element cannot be converted * * @throws CoreException if the configuration element can't be * converted. Reasons include: (a) no handler is available to * cope with a certain configuration element or (b) the XML * expression tree is malformed. */ SmartPointer Perform(const SmartPointer& root); /** * Converts the tree of DOM elements represented by the given * root element and returns a corresponding expression tree. * * @param root the element to be converted * * @return the corresponding expression tree or null * if the element cannot be converted * * @throws CoreException if the element can't be converted. * Reasons include: (a) no handler is available to cope with * a certain element or (b) the XML expression tree is malformed. */ SmartPointer Perform(Poco::XML::Element* root); void ProcessChildren(const SmartPointer& element, const SmartPointer& result); QString GetDebugPath(const SmartPointer& configurationElement); void ProcessChildren(Poco::XML::Element* element, const SmartPointer& result); }; } // namespace berry #endif /*BERRYEXPRESSIONCONVERTER_H_*/ diff --git a/Plugins/org.blueberry.core.expressions/src/berryExpressionInfo.h b/Plugins/org.blueberry.core.expressions/src/berryExpressionInfo.h index c13df875e4..2e95c0c066 100644 --- a/Plugins/org.blueberry.core.expressions/src/berryExpressionInfo.h +++ b/Plugins/org.blueberry.core.expressions/src/berryExpressionInfo.h @@ -1,185 +1,183 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYEXPRESSIONINFO_H_ #define BERRYEXPRESSIONINFO_H_ #include #include #include namespace berry { /** * A status object describing information about an expression tree. * This information can for example be used to decide whether a * expression tree as to be reevaluated if the value of some * variables changes. *

* This class is not intended to be extended by clients. *

* * @since 3.2 */ class BERRY_EXPRESSIONS ExpressionInfo { private: bool fHasDefaultVariableAccess; bool fHasSystemPropertyAccess; // Although we are using this as sets we use lists since // they are faster for smaller numbers of elements QSet fAccessedVariableNames; QSet fMisbehavingExpressionTypes; QSet fAccessedPropertyNames; public: ExpressionInfo(); /** * Returns true if the default variable is accessed * by the expression tree. * * @return whether the default variable is accessed or not */ bool HasDefaultVariableAccess() const; /** * Marks the default variable as accessed. */ void MarkDefaultVariableAccessed(); /** * Returns true if the system property is accessed * by the expression tree. * * @return whether the system property is accessed or not */ bool HasSystemPropertyAccess() const; /** * Marks the system property as accessed. */ void MarkSystemPropertyAccessed(); /** * Returns the set off accessed variables. * * @return the set off accessed variables */ QSet GetAccessedVariableNames() const; /** * Marks the given variable as accessed. * * @param name the accessed variable */ void AddVariableNameAccess(const QString& name); /** * Returns the set of accessed properties. * * @return the set of accessed properties, or an empty array */ QSet GetAccessedPropertyNames() const; /** * Marks that this expression access this property. It should be the fully * qualified property name. * * @param name * the fully qualified property name */ void AddAccessedPropertyName(const QString& name); /** - * Returns the set of expression types which don't implement the - * new (@link Expression#computeReevaluationInfo(IEvaluationContext)} - * method. If one expression didn't implement the method the expression + * If one expression didn't implement the method the expression * tree no optimizations can be done. Returns null if * all expressions implement the method. * * @return the set of expression types which don't implement the * computeReevaluationInfo method. */ QSet GetMisbehavingExpressionTypes() const; /** * Adds the given class to the list of misbehaving classes. * * @param clazz the class to add. */ void AddMisBehavingExpressionType(const std::type_info& clazz); /** * Merges this reevaluation information with the given info. * * @param other the information to merge with */ void Merge(ExpressionInfo* other); /** * Merges this reevaluation information with the given info * ignoring the default variable access. * * @param other the information to merge with */ void MergeExceptDefaultVariable(ExpressionInfo* other); private: /** * Merges only the default variable access. * * @param other the information to merge with */ void MergeDefaultVariableAccess(ExpressionInfo* other); /** * Merges only the system property access. * * @param other the information to merge with */ void MergeSystemPropertyAccess(ExpressionInfo* other); /** * Merges only the accessed variable names. * * @param other the information to merge with */ void MergeAccessedVariableNames(ExpressionInfo* other); /** * Merges only the accessed property names. * * @param other the information to merge with * @since 3.4 */ void MergeAccessedPropertyNames(ExpressionInfo* other); /** * Merges only the misbehaving expression types. * * @param other the information to merge with */ void MergeMisbehavingExpressionTypes(ExpressionInfo* other); }; } // namespace berry #endif /*BERRYEXPRESSIONINFO_H_*/ diff --git a/Plugins/org.blueberry.core.expressions/src/berryIEvaluationContext.h b/Plugins/org.blueberry.core.expressions/src/berryIEvaluationContext.h index f592178f94..96404415d1 100644 --- a/Plugins/org.blueberry.core.expressions/src/berryIEvaluationContext.h +++ b/Plugins/org.blueberry.core.expressions/src/berryIEvaluationContext.h @@ -1,145 +1,145 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEVALUATIONCONTEXT_H_ #define BERRYIEVALUATIONCONTEXT_H_ #include #include #include namespace berry { /** * An evaluation context is used to manage a set of objects needed during * XML expression evaluation. A context has a parent context, can manage * a set of named variables and has a default variable. The default variable * is used during XML expression evaluation if no explicit variable is * referenced. *

* This interface is not intended to be implemented by clients. Clients * are allowed to instantiate EvaluationContext. *

* * @since 3.0 */ struct BERRY_EXPRESSIONS IEvaluationContext : public Object { berryObjectMacro(berry::IEvaluationContext); /** * Represents the value used by variables that exist but are not defined * in a evaluation context. When tested by the 'with' expression, false * will be returned. */ static Object::ConstPointer UNDEFINED_VARIABLE; ~IEvaluationContext() override; /** * Returns the parent context or null if * this is the root of the evaluation context hierarchy. * * @return the parent evaluation context or null */ virtual IEvaluationContext* GetParent() const = 0; /** * Returns the root evaluation context. * * @return the root evaluation context */ virtual IEvaluationContext* GetRoot() const = 0; /** * Specifies whether this evaluation context allows activation * of plug-ins for testers used in the expression tree. To actual * trigger the plug-in loading this flag has to be set to * true and the actual test expression must have the * attribute forcePluginActivation set to * true as well. * * @param value whether this evaluation context allows plug-in activation * @since 3.2 */ virtual void SetAllowPluginActivation(bool value) = 0; /** * Returns whether this evaluation context supports plug-in - * activation. If not set via {@link #setAllowPluginActivation(boolean)} + * activation. If not set via {@link #SetAllowPluginActivation} * the parent value is returned. If no parent is set false * is returned. * * @return whether plug-in activation is supported or not * @since 3.2 */ virtual bool GetAllowPluginActivation() const = 0; /** * Returns the default variable. * * @return the default variable or null if * no default variable is managed. */ virtual Object::ConstPointer GetDefaultVariable() const = 0; /** * Adds a new named variable to this context. If a variable * with the name already exists the new one overrides the * existing one. * * @param name the variable's name * @param value the variable's value */ virtual void AddVariable(const QString& name, const Object::ConstPointer& value) = 0; /** * Removes the variable managed under the given name * from this evaluation context. * * @param name the variable's name * @return the currently stored value or null if * the variable doesn't exist */ virtual Object::ConstPointer RemoveVariable(const QString& name) = 0; /** * Returns the variable managed under the given name. * * @param name the variable's name * @return the variable's value or null if the content * doesn't manage a variable with the given name */ virtual Object::ConstPointer GetVariable(const QString& name) const = 0; /** * Resolves a variable for the given name and arguments. This * method can be used to dynamically resolve variable such as * plug-in descriptors, resources, etc. The method is used * by the resolve expression. * * @param name the variable to resolve * @param args an object array of arguments used to resolve the * variable * @return the variable's value or null if no variable * can be resolved for the given name and arguments * @exception CoreException if an errors occurs while resolving * the variable */ virtual Object::ConstPointer ResolveVariable(const QString& name, const QList& args) const = 0; }; } // namespace berry #endif /*BERRYIEVALUATIONCONTEXT_H_*/ diff --git a/Plugins/org.blueberry.core.jobs/src/berryIJobChangeEvent.h b/Plugins/org.blueberry.core.jobs/src/berryIJobChangeEvent.h index 3ce868c321..888c382e75 100644 --- a/Plugins/org.blueberry.core.jobs/src/berryIJobChangeEvent.h +++ b/Plugins/org.blueberry.core.jobs/src/berryIJobChangeEvent.h @@ -1,70 +1,70 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIJOBCHANGEEVENT_H_ #define BERRYIJOBCHANGEEVENT_H_ #include #include #include #include #include namespace berry { class Job; /** * An event describing a change to the state of a job. * * @see IJobChangeListener - * @noimplement This interface is not intended to be implemented by clients. + * @note This interface is not intended to be implemented by clients. */ struct BERRY_JOBS IJobChangeEvent : public Object { berryObjectMacro(berry::IJobChangeEvent); /** * The amount of time in milliseconds to wait after scheduling the job before it * should be run, or -1 if not applicable for this type of event. * This value is only applicable for the scheduled event. * * @return the delay time for this event */ virtual Poco::Timestamp::TimeDiff GetDelay() const = 0; /** * The job on which this event occurred. * * @return the job for this event */ virtual SmartPointer GetJob() const = 0; /** * The result returned by the job's run method, or null if * not applicable. This value is only applicable for the done event. * * @return the status for this event */ virtual IStatus::Pointer GetResult() const = 0; }; } #endif /* BERRYIJOBCHANGEEVENT_H_ */ diff --git a/Plugins/org.blueberry.core.jobs/src/berryIJobChangeListener.h b/Plugins/org.blueberry.core.jobs/src/berryIJobChangeListener.h index 14ab9d6c19..1d8e41422f 100644 --- a/Plugins/org.blueberry.core.jobs/src/berryIJobChangeListener.h +++ b/Plugins/org.blueberry.core.jobs/src/berryIJobChangeListener.h @@ -1,153 +1,140 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIJOBCHANGELISTENER_H_ #define BERRYIJOBCHANGELISTENER_H_ #include "berryIJobChangeEvent.h" namespace berry { /** * Callback interface for clients interested in being notified when jobs change state. *

* A single job listener instance can be added either to the job manager, for notification * of all scheduled jobs, or to any set of individual jobs. A single listener instance should * not be added to both the job manager, and to individual jobs (such a listener may * receive duplicate notifications). *

* Clients should not rely on the result of the Job#GetState() * method on jobs for which notification is occurring. Listeners are notified of * all job state changes, but whether the state change occurs before, during, or * after listeners are notified is unspecified. *

* Clients may implement this interface. *

* @see IJobManager#AddJobChangeListener(IJobChangeListener::Pointer) * @see IJobManager#RemoveJobChangeListener(IJobChangeListener::Pointer) * @see Job#AddJobChangeListener(IJobChangeListener::Pointer) * @see Job#GetState() * @see Job#RemoveJobChangeListener(IJobChangeListener::Pointer) */ struct BERRY_JOBS IJobChangeListener { struct BERRY_JOBS Events { typedef Message1 JobChangeEventType; enum Type { NONE = 0x00000000, ABOUT_TO_RUN = 0x00000001, AWAKE = 0x00000002, DONE = 0x00000004, RUNNING = 0x00000008, SCHEDULED = 0x00000010, SLEEPING = 0x00000020, ALL = 0xffffffff }; Q_DECLARE_FLAGS(Types, Type) JobChangeEventType jobAboutToRun; JobChangeEventType jobAwake; JobChangeEventType jobDone; JobChangeEventType jobRunning; JobChangeEventType jobScheduled; JobChangeEventType jobSleeping; void AddListener(IJobChangeListener* listener); void RemoveListener(IJobChangeListener* listener); void SetExceptionHandler(const AbstractExceptionHandler& handler); typedef MessageDelegate1 Delegate; }; virtual Events::Types GetEventTypes() = 0; /** * Notification that a job is about to be run. Listeners are allowed to sleep, cancel, * or change the priority of the job before it is started (and as a result may prevent * the run from actually occurring). - * - * @param event the event details */ virtual void AboutToRun(const IJobChangeEvent::ConstPointer& /*event*/) { } /** * Notification that a job was previously sleeping and has now been rescheduled * to run. - * - * @param event the event details */ virtual void Awake(const IJobChangeEvent::ConstPointer& /*event*/) { } /** * Notification that a job has completed execution, either due to cancelation, successful * completion, or failure. The event status object indicates how the job finished, * and the reason for failure, if applicable. - * - * @param event the event details */ virtual void Done(const IJobChangeEvent::ConstPointer& /*event*/) { } /** * Notification that a job has started running. - * - * @param event the event details */ virtual void Running(const IJobChangeEvent::ConstPointer& /*event*/) { } /** * Notification that a job is being added to the queue of scheduled jobs. * The event details includes the scheduling delay before the job should start * running. - * - * @param event the event details, including the job instance and the scheduling - * delay */ virtual void Scheduled(const IJobChangeEvent::ConstPointer& /*event*/) { } /** * Notification that a job was waiting to run and has now been put in the * sleeping state. - * - * @param event the event details */ virtual void Sleeping(const IJobChangeEvent::ConstPointer& /*event*/) { } }; } Q_DECLARE_OPERATORS_FOR_FLAGS(berry::IJobChangeListener::Events::Types) #endif /* BERRYIJOBCHANGELISTENER_H_ */ diff --git a/Plugins/org.blueberry.core.jobs/src/berryIJobManager.h b/Plugins/org.blueberry.core.jobs/src/berryIJobManager.h index e7c98c6d8d..88ccd41d7a 100644 --- a/Plugins/org.blueberry.core.jobs/src/berryIJobManager.h +++ b/Plugins/org.blueberry.core.jobs/src/berryIJobManager.h @@ -1,436 +1,156 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef _BERRY_IJOBMANAGER_H #define _BERRY_IJOBMANAGER_H #include #include #include "berryJob.h" #include "berryProgressProvider.h" #include "berryIProgressMonitor.h" #include "berryIJobChangeListener.h" #include namespace berry { /** * The job manager provides facilities for scheduling, querying, and maintaining jobs * and locks. In particular, the job manager provides the following services: *
    *
  • Maintains a queue of jobs that are waiting to be run. Items can be added to * the queue using the schedule method.
  • *
  • @todo Allows manipulation of groups of jobs called job families. } Job families can * be canceled, put to sleep, or woken up atomically. There is also a mechanism * for querying the set of known jobs in a given family.>
  • * *
  • Allows listeners to find out about progress on running jobs, and to find out * when jobs have changed states.
  • *
  • @todo Provides a factory for creating lock objects. Lock objects are smart monitors * that have strategies for avoiding deadlock. >
  • * *
  • Provide feedback to a client that is waiting for a given job or family of jobs * to complete.
  • *
* * @see Job * @see ILock * - * @noimplement This interface is not intended to be implemented by clients. + * @note This interface is not intended to be implemented by clients. */ struct BERRY_JOBS IJobManager: public Object { berryObjectMacro(berry::IJobManager); /** * A system property key indicating whether the job manager should create * job threads as daemon threads. Set to true to force all worker * threads to be created as daemon threads. Set to false to force * all worker threads to be created as non-daemon threads. * * not used yet */ static const std::string PROP_USE_DAEMON_THREADS ; /** * Registers a job listener with the job manager. * Has no effect if an identical listener is already registered. * * @param listener the listener to be added - * @see #removeJobChangeListener(IJobChangeListener) + * @see #RemoveJobChangeListener * @see IJobChangeListener */ virtual void AddJobChangeListener(IJobChangeListener* listener) = 0; - ///** - // * Begins applying this rule in the calling thread. If the rule conflicts with another - // * rule currently running in another thread, this method blocks until there are - // * no conflicting rules. Calls to beginRule must eventually be followed - // * by a matching call to endRule in the same thread and with the identical - // * rule instance. - // *

- // * Rules can be nested only if the rule for the inner beginRule - // * is contained within the rule for the outer beginRule. Rule containment - // * is tested with the API method ISchedulingRule.contains. Also, begin/end - // * pairs must be strictly nested. Only the rule that has most recently begun - // * can be ended at any given time. - // *

- // * A rule of null can be used, but will be ignored for scheduling - // * purposes. The outermost non-null rule in the thread will be used for scheduling. A - // * null rule that is begun must still be ended. - // *

- // * If this method is called from within a job that has a scheduling rule, the - // * given rule must also be contained within the rule for the running job. - // *

- // * Note that endRule must be called even if beginRule fails. - // * The recommended usage is: - // *

-  // * final ISchedulingRule rule = ...;
-  // * try {
-  // *   manager.beginRule(rule, monitor);
-  // * } finally {
-  // *   manager.endRule(rule);
-  // * }
-  // * 
- // * - // * @param rule the rule to begin applying in this thread, or null - // * @param monitor a progress monitor, or null if progress - // * reporting and cancellation are not desired - // * @throws IllegalArgumentException if the rule is not strictly nested within - // * all other rules currently active for this thread - // * @throws OperationCanceledException if the supplied monitor reports cancelation - // * before the rule becomes available - // * @see ISchedulingRule#contains(ISchedulingRule) - // */ - - /// virtual void BeginRule(const ISchedulingRule& rule, const IProgressMonitor& monitor) = 0; - - ///** - // * Cancels all jobs in the given job family. Jobs in the family that are currently waiting - // * will be removed from the queue. Sleeping jobs will be discarded without having - // * a chance to wake up. Currently executing jobs will be asked to cancel but there - // * is no guarantee that they will do so. - // * - // * @param family the job family to cancel, or null to cancel all jobs - // * @see Job#belongsTo(Object) - // */ - /// virtual void Cancel(const Object& family); - /** * Returns a progress monitor that can be used to provide * aggregated progress feedback on a set of running jobs. A user * interface will typically group all jobs in a progress group together, * providing progress feedback for individual jobs as well as aggregated * progress for the entire group. Jobs in the group may be run sequentially, * in parallel, or some combination of the two. *

* Recommended usage (this snippet runs two jobs in sequence in a * single progress group): - *

-   *    Job parseJob, compileJob;
-   *    IProgressMonitor pm = Platform.getJobManager().createProgressGroup();
-   *    try {
-   *       pm.beginTask("Building", 10);
-   *       parseJob.setProgressGroup(pm, 5);
-   *       parseJob.schedule();
-   *       compileJob.setProgressGroup(pm, 5);
-   *       compileJob.schedule();
-   *       parseJob.join();
-   *       compileJob.join();
-   *    } finally {
-   *       pm.done();
-   *    }
-   * 
+ * \code + * Job parseJob, compileJob; + * IProgressMonitor pm = Platform.getJobManager().createProgressGroup(); + * try { + * pm.beginTask("Building", 10); + * parseJob.setProgressGroup(pm, 5); + * parseJob.schedule(); + * compileJob.setProgressGroup(pm, 5); + * compileJob.schedule(); + * parseJob.join(); + * compileJob.join(); + * } finally { + * pm.done(); + * } + * \endcode * - * @see Job#setProgressGroup(IProgressMonitor, int) + * @see Job#SetProgressGroup * @see IProgressMonitor * @return a progress monitor */ virtual IProgressMonitor::Pointer CreateProgressGroup() = 0; - ///** - // * Returns the job that is currently running in this thread, or null if there - // * is no currently running job. - // * - // * @return the job or null - // */ - //// virtual Job CurrentJob() = 0; - - ///** - // * Ends the application of a rule to the calling thread. Calls to endRule - // * must be preceded by a matching call to beginRule in the same thread - // * with an identical rule instance. - // *

- // * Rules can be nested only if the rule for the inner beginRule - // * is contained within the rule for the outer beginRule. Also, begin/end - // * pairs must be strictly nested. Only the rule that has most recently begun - // * can be ended at any given time. - // * - // * @param rule the rule to end applying in this thread - // * @throws IllegalArgumentException if this method is called on a rule for which - // * there is no matching begin, or that does not match the most recent begin. - // * @see ISchedulingRule#contains(ISchedulingRule) - // */ - /// virtual void EndRule(const ISchedulingRule& rule) = 0; - - ///** - // * Returns all waiting, executing and sleeping jobs belonging - // * to the given family. If no jobs are found, an empty array is returned. - // * - // * @param family the job family to find, or null to find all jobs - // * @return the job array - // * @see Job#belongsTo(Object) - // */ - /// virtual Job[] Find(const Object& family) = 0; - /** * Returns whether the job manager is currently idle. The job manager is * idle if no jobs are currently running or waiting to run. * * @return true if the job manager is idle, and * false otherwise * @since 3.1 */ virtual bool IsIdle()= 0; /** * Returns whether the job manager is currently suspended. * * @return true if the job manager is suspended, and * false otherwise * @since 3.4 - * @see #suspend() - * @see #resume() */ virtual bool IsSuspended() = 0; - ///** - // * Waits until all jobs of the given family are finished. This method will block the - // * calling thread until all such jobs have finished executing, or until this thread is - // * interrupted. If there are no jobs in - // * the family that are currently waiting, running, or sleeping, this method returns - // * immediately. Feedback on how the join is progressing is provided to a progress - // * monitor. - // *

- // * If this method is called while the job manager is suspended, only jobs - // * that are currently running will be joined; Once there are no jobs - // * in the family in the {@link Job#RUNNING} state, this method returns. - // *

- // *

- // * Note that there is a deadlock risk when using join. If the calling thread owns - // * a lock or object monitor that the joined thread is waiting for, deadlock - // * will occur. This method can also result in starvation of the current thread if - // * another thread continues to add jobs of the given family, or if a - // * job in the given family reschedules itself in an infinite loop. - // *

- // * - // * @param family the job family to join, or null to join all jobs. - // * @param monitor Progress monitor for reporting progress on how the - // * wait is progressing, or null if no progress monitoring is required. - // * @exception InterruptedException if this thread is interrupted while waiting - // * @exception OperationCanceledException if the progress monitor is canceled while waiting - // * @see Job#belongsTo(Object) - // * @see #suspend() - // */ - /// virtual void Join(const Object& family, const IProgressMonitor& monitor) - /// throw(InterruptedException, OperationCanceledException) = 0; - ///** - // * Creates a new lock object. All lock objects supplied by the job manager - // * know about each other and will always avoid circular deadlock amongst - // * themselves. - // * - // * @return the new lock object - // */ - /// virtual ILock newLock() = 0; - /** * Removes a job listener from the job manager. * Has no effect if an identical listener is not already registered. * * @param listener the listener to be removed - * @see #addJobChangeListener(IJobChangeListener) + * @see #AddJobChangeListener * @see IJobChangeListener */ virtual void RemoveJobChangeListener(IJobChangeListener* listener) = 0; - ///** - // * Resumes execution of jobs after a previous suspend. All - // * jobs that were sleeping or waiting prior to the suspension, or that were - // * scheduled while the job manager was suspended, will now be eligible - // * for execution. - // *

- // * Calling this method on a rule that is not suspended has no effect. If another - // * thread also owns the rule at the time this method is called, then the rule will - // * not be resumed until all threads have released the rule. - // * - // * @deprecated This method is not safe and should not be used. - // * Suspending a scheduling rule violates the thread safety - // * of clients that use scheduling rules as a mutual exclusion mechanism, - // * and can result in concurrency problems in all clients that use the suspended rule. - // * @see #suspend(ISchedulingRule, IProgressMonitor) - // */ - /// virtual void Resume(const ISchedulingRule& rule) = 0; - - ///** - // * Resumes execution of jobs after a previous suspend. All - // * jobs that were sleeping or waiting prior to the suspension, or that were - // * scheduled while the job manager was suspended, will now be eligible - // * for execution. - // *

- // * Calling resume when the job manager is not suspended - // * has no effect. - // * - // * @see #suspend() - // * @see #isSuspended() - // */ - ////virtual void Resume() = 0; - - ///** - // * Provides a hook that is notified whenever a thread is about to wait on a lock, - // * or when a thread is about to release a lock. This hook must only be set once. - // *

- // * This method is for internal use by the platform-related plug-ins. - // * Clients should not call this method. - // *

- // * @see LockListener - // */ - // TODO LockListener .. SetLockListener - /// virtual void SetLockListener(const LockListener& listener) = 0; - /** * Registers a progress provider with the job manager. If there was a * provider already registered, it is replaced. *

* This method is intended for use by the currently executing Eclipse application. * Plug-ins outside the currently running application should not call this method. *

* * @param provider the new provider, or null if no progress * is needed */ - virtual void SetProgressProvider(ProgressProvider::Pointer) = 0; - - /** - * Suspends execution of all jobs. Jobs that are already running - * when this method is invoked will complete as usual, but all sleeping and - * waiting jobs will not be executed until the job manager is resumed. - *

- * The job manager will remain suspended until a subsequent call to - * resume. Further calls to suspend - * when the job manager is already suspended are ignored. - *

- * All attempts to join sleeping and waiting jobs while the job manager is - * suspended will return immediately. - *

- * Note that this very powerful function should be used with extreme caution. - * Suspending the job manager will prevent all jobs in the system from executing, - * which may have adverse affects on components that are relying on - * execution of jobs. The job manager should never be suspended without intent - * to resume execution soon afterwards. - * - * @see #resume() - * @see #join(Object, IProgressMonitor) - * @see #isSuspended() - */ - // virtual void Suspend() = 0; - - ///** - // * Defers execution of all jobs with scheduling rules that conflict with the - // * given rule. The caller will be blocked until all currently executing jobs with - // * conflicting rules are completed. Conflicting jobs that are sleeping or waiting at - // * the time this method is called will not be executed until the rule is resumed. - // *

- // * While a rule is suspended, all calls to beginRule and - // * endRule on a suspended rule will not block the caller. - // * The rule remains suspended until a subsequent call to - // * resume(ISchedulingRule) with the identical rule instance. - // * Further calls to suspend with an identical rule prior to calling - // * resume are ignored. - // *

- // *

- // * This method is long-running; progress and cancelation are provided by - // * the given progress monitor. In the case of cancelation, the rule will - // * not be suspended. - // *

- // * Note: this very powerful function should be used with extreme caution. - // * Suspending rules will prevent jobs in the system from executing, which may - // * have adverse effects on components that are relying on execution of jobs. - // * The job manager should never be suspended without intent to resume - // * execution soon afterwards. Deadlock will result if the thread responsible - // * for resuming the rule attempts to join a suspended job. - // * - // * @deprecated This method is not safe and should not be used. - // * Suspending a scheduling rule violates the thread safety - // * of clients that use scheduling rules as a mutual exclusion mechanism, - // * and can result in concurrency problems in all clients that use the suspended rule. - // * @param rule The scheduling rule to suspend. Must not be null. - // * @param monitor a progress monitor, or null if progress - // * reporting is not desired - // * @exception OperationCanceledException if the operation is canceled. - // * Cancelation can occur even if no progress monitor is provided. - // * @see #resume(ISchedulingRule) - // */ - /// virtual void Suspend(const ISchedulingRule& rule, const IProgressMonitor& monitor) = 0; - - ///** - // * Requests that all jobs in the given job family be suspended. Jobs currently - // * waiting to be run will be removed from the queue and moved into the - // * SLEEPING state. Jobs that have been put to sleep - // * will remain in that state until either resumed or canceled. This method has - // * no effect on jobs that are not currently waiting to be run. - // *

- // * Sleeping jobs can be resumed using wakeUp. - // * - // * @param family the job family to sleep, or null to sleep all jobs. - // * @see Job#belongsTo(Object) - // */ - /// virtual void Sleep(const Object& family) = 0; - - ///** - // * Transfers ownership of a scheduling rule to another thread. The identical - // * scheduling rule must currently be owned by the calling thread as a result of - // * a previous call to beginRule. The destination thread must - // * not already own a scheduling rule. - // *

- // * Calling this method is equivalent to atomically calling endRule - // * in the calling thread followed by an immediate beginRule in - // * the destination thread. The destination thread is responsible for subsequently - // * calling endRule when it is finished using the rule. - // *

- // * This method has no effect when the destination thread is the same as the - // * calling thread. - // * - // * @param rule The scheduling rule to transfer - // * @param destinationThread The new owner for the transferred rule. - // * @since 3.1 - // */ - /// virtual void TransferRule(const ISchedulingRule& rule, Poco::Thread* destinationThread) = 0; - - ///** - // * Resumes scheduling of all sleeping jobs in the given family. This method - // * has no effect on jobs in the family that are not currently sleeping. - // * - // * @param family the job family to wake up, or null to wake up all jobs - // * @see Job#belongsTo(Object) - // */ - /// virtual void WakeUp(const Object& family) = 0; - + virtual void SetProgressProvider(ProgressProvider::Pointer provider) = 0; }; } #endif /* IJOBMANAGER */ diff --git a/Plugins/org.blueberry.core.runtime/src/application/berryIApplication.h b/Plugins/org.blueberry.core.runtime/src/application/berryIApplication.h index 35918795aa..ef409c007e 100644 --- a/Plugins/org.blueberry.core.runtime/src/application/berryIApplication.h +++ b/Plugins/org.blueberry.core.runtime/src/application/berryIApplication.h @@ -1,96 +1,96 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIAPPLICATION_H_ #define BERRYIAPPLICATION_H_ #include #include namespace berry { struct IApplicationContext; /** * Bootstrap type for an application. An IApplication represent executable * entry points into an application. An IApplication can be configured into * the Platform's org.blueberry.osgi.applications extension-point. * *

* Clients may implement this interface. *

*/ struct org_blueberry_core_runtime_EXPORT IApplication { /** * Exit object indicating normal termination */ static const int EXIT_OK; /** * Exit object requesting platform restart */ static const int EXIT_RESTART; /** * Exit object requesting that the command passed back be executed. Typically * this is used to relaunch BlueBerry with different command line arguments. When the executable is * relaunched the command line will be retrieved from the BlueBerry.exitdata system property. */ static const int EXIT_RELAUNCH; virtual ~IApplication(); /** * Starts this application with the given context and returns a result. This * method must not exit until the application is finished and is ready to exit. * The content of the context is unchecked and should conform to the expectations of * the application being invoked.

* * Applications can return any object they like. If an Integer is returned * it is treated as the program exit code if BlueBerry is exiting. *

* Note: This method is called by the platform; it is not intended * to be called directly by clients. *

* @return the return value of the application * @see #EXIT_OK * @see #EXIT_RESTART * @see #EXIT_RELAUNCH * @param context the application context to pass to the application * @exception std::exception if there is a problem running this application. */ virtual QVariant Start(IApplicationContext* context) = 0; /** * Forces this running application to exit. This method should wait until the - * running application is ready to exit. The {@link #start()} + * running application is ready to exit. The {@link #Start} * should already have exited or should exit very soon after this method exits

* * This method is only called to force an application to exit. * This method will not be called if an application exits normally from - * the {@link #start()} method. + * the {@link #Start} method. *

* Note: This method is called by the platform; it is not intended * to be called directly by clients. *

*/ virtual void Stop() = 0; }; } Q_DECLARE_INTERFACE(berry::IApplication, "org.blueberry.IApplication") #endif /*BERRYIAPPLICATION_H_*/ diff --git a/Plugins/org.blueberry.core.runtime/src/application/berryIApplicationContext.h b/Plugins/org.blueberry.core.runtime/src/application/berryIApplicationContext.h index e5772e630b..d3db56cf50 100644 --- a/Plugins/org.blueberry.core.runtime/src/application/berryIApplicationContext.h +++ b/Plugins/org.blueberry.core.runtime/src/application/berryIApplicationContext.h @@ -1,83 +1,82 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIAPPLICATIONCONTEXT_H #define BERRYIAPPLICATIONCONTEXT_H #include #include #include #include namespace berry { /** * The context used to start an application. *

* This interface is not intended to be implemented by clients. *

- * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. + * @note This interface is not intended to be extended by clients. */ struct org_blueberry_core_runtime_EXPORT IApplicationContext { virtual ~IApplicationContext(); /** * A key used to store arguments for the application. The content of this argument * is unchecked and should conform to the expectations of the application being invoked. * Typically this is a QStringList. *

* * If the properties used to launch an application do * not contain a value for this key then command line arguments used to launch * the platform are set in the arguments of the application context. */ static const QString APPLICATION_ARGS; // = "application.args"; /** * A key used to store unprocessed arguments for the application. * This is a QStringList. *

* * If the properties used to launch an application do * not contain a value for this key then command line arguments used to launch * the platform are set in the unprocessed arguments of the application context. */ static const QString APPLICATION_ARGS_UNPROCESSED; // = "application.args.unprocessed"; /** * The arguments used for the application. The arguments from * QObject::dynamicPropertyNames() of a QObject service object registered under * the interface "org.blueberry.core.runtime.AppDescriptor" are used as the arguments * for this context when an application is launched. * * @return a map of application arguments. */ virtual QHash GetArguments() const = 0; /** * This method should be called once the application is completely initialized and running. * This method will perform certain operations that are needed once an application is running. * One example is bringing down a splash screen if it exists. */ virtual void ApplicationRunning() = 0; }; } Q_DECLARE_INTERFACE(berry::IApplicationContext, "org.blueberry.IApplicationContext") #endif // BERRYIAPPLICATIONCONTEXT_H diff --git a/Plugins/org.blueberry.core.runtime/src/berryContributorFactory.h b/Plugins/org.blueberry.core.runtime/src/berryContributorFactory.h index e1695d3fec..c2bb6eb4fa 100644 --- a/Plugins/org.blueberry.core.runtime/src/berryContributorFactory.h +++ b/Plugins/org.blueberry.core.runtime/src/berryContributorFactory.h @@ -1,71 +1,69 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYCONTRIBUTORFACTORY_H #define BERRYCONTRIBUTORFACTORY_H #include #include class ctkPlugin; namespace berry { template class SmartPointer; struct IContributor; /** * The contributor factory creates new registry contributors for use in the registry. *

* This class can not be extended or instantiated by clients. *

- * @noinstantiate This class is not intended to be instantiated by clients. - * @noextend This class is not intended to be subclassed by clients. */ class org_blueberry_core_runtime_EXPORT ContributorFactory { public: /** * Creates registry contributor object based on a Plugin. The plugin must not * be null. * * @param contributor plugin associated with the contribution * @return new registry contributor based on the Plugin */ static SmartPointer CreateContributor(const QSharedPointer& contributor); /** * Returns the CTK plugin used to define this contributor. * *

The method may return null if the contributor is not based on a plugin, * if the plugin can't be found, or if the plugin is presently unresolved or * uninstalled.

* * @param contributor plugin-based registry contributor * @return the actual CTK plugin associated with this contributor */ static QSharedPointer Resolve(const SmartPointer& contributor); private: // not implemented ContributorFactory(); ~ContributorFactory(); }; } #endif // BERRYCONTRIBUTORFACTORY_H diff --git a/Plugins/org.blueberry.core.runtime/src/berryIAdapterFactory.h b/Plugins/org.blueberry.core.runtime/src/berryIAdapterFactory.h index 0e0d7487bf..013c9f32bf 100644 --- a/Plugins/org.blueberry.core.runtime/src/berryIAdapterFactory.h +++ b/Plugins/org.blueberry.core.runtime/src/berryIAdapterFactory.h @@ -1,87 +1,86 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIADAPTERFACTORY_H_ #define BERRYIADAPTERFACTORY_H_ #include #include #include namespace berry { /** * An adapter factory defines behavioral extensions for * one or more classes that implements the IAdaptable * interface. Adapter factories are registered with an * adapter manager. *

* This interface can be used without OSGi running. *

* Clients may implement this interface. *

* @see IAdapterManager * @see IAdaptable */ struct org_blueberry_core_runtime_EXPORT IAdapterFactory { virtual ~IAdapterFactory() {}; /** * Returns an object which can be cast to the given adapter type and which is * associated with the given adaptable object. Returns 0 if * no such object can be found. * * A typical implementation would look like this: * * * void* GetAdapter(void* adaptableObject, const std::type_info& adaptableType, const std::string& adapterType) * { * if (Image* img = CastHelper(adaptableObject, adaptableType)) * { * if (adapterType == "berry::IResource") * { * return new IResource(img->GetPath()); * } * } * return 0; * } * * * @param adaptableObject the adaptable object being queried * (usually an instance of IAdaptable) - * @param adaptableType the type information for the adaptable object * @param adapterType the type of adapter to look up * @return a object castable to the given adapter type, * or 0 if this adapter factory * does not have an adapter of the given type for the * given object */ virtual Object* GetAdapter(IAdaptable* adaptableObject, const std::string& adapterType) = 0; /** * Returns the collection of adapter types handled by this * factory. *

* This method is generally used by an adapter manager * to discover which adapter types are supported, in advance * of dispatching any actual getAdapter requests. *

* * @return the collection of adapter types */ virtual void GetAdapterList(std::vector& adapters) = 0; }; } #endif /*BERRYIADAPTERFACTORY_H_*/ diff --git a/Plugins/org.blueberry.core.runtime/src/berryIAdapterManager.h b/Plugins/org.blueberry.core.runtime/src/berryIAdapterManager.h index eb4b638a76..96fa476b20 100644 --- a/Plugins/org.blueberry.core.runtime/src/berryIAdapterManager.h +++ b/Plugins/org.blueberry.core.runtime/src/berryIAdapterManager.h @@ -1,283 +1,280 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIADAPTERMANAGER_H_ #define BERRYIADAPTERMANAGER_H_ #include #include #include "berryPlatformObject.h" #include "berryIAdapterFactory.h" #include #include namespace berry { /** * An adapter manager maintains a registry of adapter factories. Clients * directly invoke methods on an adapter manager to register and unregister * adapters. All adaptable objects (that is, objects that implement the IAdaptable * interface) tunnel IAdaptable.getAdapter invocations to their * adapter manager's IAdapterManger.getAdapter method. The * adapter manager then forwards this request unmodified to the IAdapterFactory.getAdapter * method on one of the registered adapter factories. *

* Adapter factories can be registered programmatically using the registerAdapters * method. Alternatively, they can be registered declaratively using the * org.blueberry.core.runtime.adapters extension point. Factories registered * with this extension point will not be able to provide adapters until their * corresponding plugin has been activated. *

* The following code snippet shows how one might register an adapter of type * com.example.acme.Sticky on resources in the workspace. *

* - *

+ * \code
  *  IAdapterFactory pr = new IAdapterFactory() {
  *    public Class[] getAdapterList() {
  *      return new Class[] { com.example.acme.Sticky.class };
  *    }
  *    public Object getAdapter(Object adaptableObject, Class adapterType) {
  *      IResource res = (IResource) adaptableObject;
  *      QualifiedName key = new QualifiedName("com.example.acme", "sticky-note");
  *      try {
  *        com.example.acme.Sticky v = (com.example.acme.Sticky) res.getSessionProperty(key);
  *        if (v == null) {
  *          v = new com.example.acme.Sticky();
  *          res.setSessionProperty(key, v);
  *        }
  *      } catch (CoreException e) {
  *        // unable to access session property - ignore
  *      }
  *      return v;
  *    }
  *  }
  *  Platform.getAdapterManager().registerAdapters(pr, IResource.class);
- *   
+ * \endcode * *

* This interface can be used without OSGi running. *

* This interface is not intended to be implemented by clients. *

* @see IAdaptable * @see IAdapterFactory */ struct org_blueberry_core_runtime_EXPORT IAdapterManager: public Object { berryObjectMacro(berry::IAdapterManager); /** * This value can be returned to indicate that no applicable adapter factory * was found. * @since org.blueberry.equinox.common 3.3 */ static const int NONE; /** * This value can be returned to indicate that an adapter factory was found, * but has not been loaded. * @since org.blueberry.equinox.common 3.3 */ static const int NOT_LOADED; /** * This value can be returned to indicate that an adapter factory is loaded. * @since org.blueberry.equinox.common 3.3 */ static const int LOADED; /** * Returns a Poco::Any object which contains an instance of the given name associated * with the given adaptable. Returns an empty Poco::Any if no such object can * be found. *

* Note that this method will never cause plug-ins to be loaded. If the * only suitable factory is not yet loaded, this method will return an empty Poco::Any. * If activation of the plug-in providing the factory is required, use the * LoadAdapter method instead. * * @param adaptable the adaptable object being queried (usually an instance * of IAdaptable) - * @param adapterTypeName the fully qualified name of the type of adapter to look up * @return a Poco::Any castable to the given adapter type, or empty * if the given adaptable object does not have an available adapter of the * given type */ template A* GetAdapter(const Object* adaptable) { const char* typeName = qobject_interface_iid(); if (typeName == nullptr) { BERRY_WARN << "Error getting adapter for '" << Reflection::GetClassName(adaptable) << "': " << "Cannot get the interface id for type '" << Reflection::GetClassName() << "'. It is probably missing a Q_DECLARE_INTERFACE macro in its header."; return nullptr; } return dynamic_cast(this->GetAdapter(adaptable, typeName, false)); } /** * Returns an object which is an instance of the given class name associated * with the given object. Returns null if no such object can * be found. *

* Note that this method will never cause plug-ins to be loaded. If the * only suitable factory is not yet loaded, this method will return null. * If activation of the plug-in providing the factory is required, use the * loadAdapter method instead. * * @param adaptable the adaptable object being queried (usually an instance * of IAdaptable) * @param adapterTypeName the fully qualified name of the type of adapter to look up * @return an object castable to the given adapter type, or null * if the given adaptable object does not have an available adapter of the * given type */ virtual Object* GetAdapter(const Object* adaptable, const QString& adapterTypeName) = 0; /** * Returns whether there is an adapter factory registered that may be able * to convert adaptable to an object of type adapterTypeName. *

* Note that a return value of true does not guarantee that * a subsequent call to GetAdapter with the same arguments * will return a non-empty result. If the factory's plug-in has not yet been * loaded, or if the factory itself returns nothing, then * GetAdapter will still return an empty Poco::Any. * - * @param adaptable the adaptable object being queried (usually an instance + * @param adaptableType the adaptable object being queried (usually an instance * of IAdaptable) - * @param adapterTypeName the fully qualified class name of an adapter to + * @param adapterType the fully qualified class name of an adapter to * look up * @return true if there is an adapter factory that claims * it can convert adaptable to an object of type adapterType, * and false otherwise. */ virtual bool HasAdapter(const Object* adaptableType, const QString& adapterType) = 0; template int QueryAdapter(const Object* adaptable) { const char* typeName = qobject_interface_iid(); if (typeName == nullptr) { BERRY_WARN << "Error querying adapter manager for '" << Reflection::GetClassName(adaptable) << "': " << "Cannot get the interface id for type '" << Reflection::GetClassName() << "'. It is probably missing a Q_DECLARE_INTERFACE macro in its header."; return NONE; } return this->QueryAdapter(adaptable, typeName); } /** * Returns a status of an adapter factory registered that may be able * to convert adaptable to an object of type adapterTypeName. *

* One of the following values can be returned:

- * @param adaptable the adaptable object being queried (usually an instance + * @param adaptableType the adaptable object being queried (usually an instance * of IAdaptable) - * @param adapterTypeName the fully qualified class name of an adapter to + * @param adapterType the fully qualified class name of an adapter to * look up * @return a status of the adapter */ virtual int QueryAdapter(const Object* adaptableType, const QString& adapterType) = 0; /** * Returns an object that is an instance of the given class name associated * with the given object. Returns an empty Poco::Any if no such object can * be found. *

* Note that unlike the GetAdapter methods, this method * will cause the plug-in that contributes the adapter factory to be loaded * if necessary. As such, this method should be used judiciously, in order * to avoid unnecessary plug-in activations. Most clients should avoid * activation by using GetAdapter instead. * * @param adaptable the adaptable object being queried (usually an instance * of IAdaptable) - * @param adapterTypeName the fully qualified name of the type of adapter to look up * @return a Poco::Any castable to the given adapter type, or empty * if the given adaptable object does not have an available adapter of the * given type */ template A* LoadAdapter(const Object* adaptable) { const char* typeName = qobject_interface_iid(); if (typeName == nullptr) { BERRY_WARN << "Error getting adapter for '" << Reflection::GetClassName(adaptable) << "': " << "Cannot get the interface id for type '" << Reflection::GetClassName() << "'. It is probably missing a Q_DECLARE_INTERFACE macro in its header."; return nullptr; } return dynamic_cast(this->GetAdapter(adaptable, typeName, true)); } /** * Registers the given adapter factory as extending objects of the given * type. * * @param factory the adapter factory * @param adaptableTypeName the fully qualified typename being extended - * @see #UnregisterAdapters(IAdapterFactory*) - * @see #UnregisterAdapters(IAdapterFactory*, const std::adaptableTypeName&) + * @see #UnregisterAdapters */ virtual void RegisterAdapters(IAdapterFactory* factory, const QString& adaptableTypeName) = 0; /** * Removes the given adapter factory completely from the list of registered * factories. Equivalent to calling UnregisterAdapters(IAdapterFactory*, const std::string&) * on all classes against which it had been explicitly registered. Does * nothing if the given factory is not currently registered. * * @param factory the adapter factory to remove - * @see #RegisterAdapters(IAdapterFactory*, const std::string&) + * @see #RegisterAdapters */ virtual void UnregisterAdapters(IAdapterFactory* factory) = 0; /** * Removes the given adapter factory from the list of factories registered * as extending the given class. Does nothing if the given factory and type * combination is not registered. * * @param factory the adapter factory to remove * @param adaptableTypeName one of the type names against which the given factory is * registered - * @see #RegisterAdapters(IAdapterFactory*, const std::string&) + * @see #RegisterAdapters */ virtual void UnregisterAdapters(IAdapterFactory* factory, const QString& adaptableTypeName) = 0; private: virtual Object* GetAdapter(const Object* adaptable, const QString& adapterType, bool force) = 0; }; } // namespace berry Q_DECLARE_INTERFACE(berry::IAdapterManager, "org.blueberry.service.IAdapterManager") #endif /*BERRYIADAPTERMANAGER_H_*/ diff --git a/Plugins/org.blueberry.core.runtime/src/dynamichelpers/berryIExtensionTracker.h b/Plugins/org.blueberry.core.runtime/src/dynamichelpers/berryIExtensionTracker.h index f9cb0820f2..70438d483d 100644 --- a/Plugins/org.blueberry.core.runtime/src/dynamichelpers/berryIExtensionTracker.h +++ b/Plugins/org.blueberry.core.runtime/src/dynamichelpers/berryIExtensionTracker.h @@ -1,140 +1,139 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*//*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEXTENSIONTRACKER_H #define BERRYIEXTENSIONTRACKER_H #include #include "berrySmartPointer.h" #include namespace berry { struct IExtension; struct IExtensionChangeHandler; struct IExtensionPointFilter; class Object; /** * An extension tracker keeps associations between extensions and their derived * objects on an extension basis. All extensions being added in a tracker will * automatically be removed when the extension is uninstalled from the registry. * Users interested in extension removal can register a handler that will let * them know when an object is being removed. *

* This interface is not intended to be implemented by clients. *

- * @noimplement This interface is not intended to be implemented by clients. */ struct org_blueberry_core_runtime_EXPORT IExtensionTracker { enum ReferenceType { /** * Constant for strong (normal) reference holding. */ REF_STRONG, /** * Constant for weak reference holding. */ REF_WEAK }; virtual ~IExtensionTracker(); /** * Register an extension change handler with this tracker using the given filter. * * @param handler the handler to be registered * @param filter the filter to use to choose interesting changes */ virtual void RegisterHandler(IExtensionChangeHandler* handler, const IExtensionPointFilter& filter) = 0; /** * Register an extension change handler with this tracker for the given extension point id. * * @param handler the handler to be registered * @param extensionPointId the extension point id to track */ virtual void RegisterHandler(IExtensionChangeHandler *handler, const QString& extensionPointId = QString()) = 0; /** * Unregister the given extension change handler previously registered with this tracker. * * @param handler the handler to be unregistered */ virtual void UnregisterHandler(IExtensionChangeHandler* handler) = 0; /** * Create an association between the given extension and the given object. * The referenceType indicates how strongly the object is being kept in memory. * There are 2 possible values: REF_STRONG and REF_WEAK. * * @param extension the extension * @param object the object to associate with the extension * @param referenceType one of REF_STRONG, REF_WEAK */ virtual void RegisterObject(const SmartPointer& extension, const SmartPointer& object, ReferenceType referenceType) = 0; /** * Remove an association between the given extension and the given object. * * @param extension the extension under which the object has been registered * @param object the object to unregister */ virtual void UnregisterObject(const SmartPointer& extension, const SmartPointer& object) = 0; /** * Remove all the objects associated with the given extension. Return * the removed objects. * * @param extension the extension for which the objects are removed * @return the objects that were associated with the extension */ virtual QList > UnregisterObject(const SmartPointer& extension) = 0; /** * Return all the objects that have been associated with the given extension. * All objects registered strongly will be return unless they have been unregistered. * The objects registered softly or weakly may not be returned if they have been garbage collected. * Return an empty array if no associations exist. * * @param extension the extension for which the object must be returned * @return the array of associated objects */ virtual QList > GetObjects(const SmartPointer& extension) const = 0; /** * Close the tracker. All registered objects are freed and all handlers are being automatically removed. */ virtual void Close() = 0; }; } #endif // BERRYIEXTENSIONTRACKER_H diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIConfigurationElement.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIConfigurationElement.h index 5170bb8bdc..003043e482 100644 --- a/Plugins/org.blueberry.core.runtime/src/registry/berryIConfigurationElement.h +++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIConfigurationElement.h @@ -1,300 +1,296 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEXTENSIONELEMENT_H_ #define BERRYIEXTENSIONELEMENT_H_ #include #include namespace berry { struct IContributor; struct IExtension; class Handle; /** * A configuration element, with its attributes and children, * directly reflects the content and structure of the extension section * within the declaring plug-in's manifest (plugin.xml) file. *

* This interface also provides a way to create executable extension * objects. *

*

* These registry objects are intended for relatively short-term use. Clients that * deal with these objects must be aware that they may become invalid if the * declaring plug-in is updated or uninstalled. If this happens, all methods except * {@link #IsValid()} will throw {@link InvalidRegistryObjectException}. * For configuration element objects, the most common case is code in a plug-in dealing * with extensions contributed to one of the extension points it declares. * Code in a plug-in that has declared that it is not dynamic aware (or not * declared anything) can safely ignore this issue, since the registry * would not be modified while it is active. However, code in a plug-in that * declares that it is dynamic aware must be careful when accessing the extension * and configuration element objects because they become invalid if the contributing * plug-in is removed. Similarly, tools that analyze or display the extension registry * are vulnerable. Client code can pre-test for invalid objects by calling {@link #IsValid()}, * which never throws this exception. However, pre-tests are usually not sufficient * because of the possibility of the extension or configuration element object becoming * invalid as a result of a concurrent activity. At-risk clients must treat * InvalidRegistryObjectException as if it were a checked exception. * Also, such clients should probably register a listener with the extension registry * so that they receive notification of any changes to the registry. *

* This interface is not intended to be implemented by clients. *

- * @noimplement This interface is not intended to be implemented by clients. */ struct org_blueberry_core_runtime_EXPORT IConfigurationElement : public virtual Object { berryObjectMacro(berry::IConfigurationElement); ~IConfigurationElement() override; /** * Creates and returns a new instance of the executable extension * identified by the named attribute of this configuration element. * The named attribute value must contain a fully qualified name * of a class. The class can either refer to a class implementing * the executable extension or to a factory capable of returning the * executable extension. *

* The specified class is instantiated using its 0-argument public constructor. *

* Then the following checks are done:
* If the specified class implements the {@link IExecutableExtension} - * interface, the method {@link IExecutableExtension#SetInitializationData(IConfigurationElement, QString, Object*)} + * interface, the method {@link IExecutableExtension#SetInitializationData} * is called, passing to the object the configuration information that was used to create it. *

* If the specified class implements {@link IExecutableExtensionFactory} * interface, the method {@link IExecutableExtensionFactory#Create()} * is invoked. *

*

* Unlike other methods on this object, invoking this method may activate * the plug-in. *

* * @param propertyName the name of the property * @return the executable instance * @exception CoreException if an instance of the executable extension * could not be created for any reason * @see IExecutableExtension#SetInitializationData(IConfigurationElement, QString, Object*) * @see IExecutableExtensionFactory * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual QObject* CreateExecutableExtension(const QString& propertyName) const = 0; template C* CreateExecutableExtension(const QString &propertyName) const { C* interface = qobject_cast(this->CreateExecutableExtension(propertyName)); if (interface == nullptr) { BERRY_WARN << "The QObject subclass " << this->GetAttribute(propertyName).toStdString() << " does not seem to implement the required interface \"" << qobject_interface_iid() << "\", or you forgot the Q_INTERFACES macro."; } return interface; } /** * Returns the named attribute of this configuration element, or * null if none. *

* The names of configuration element attributes * are the same as the attribute names of the corresponding XML element. * For example, the configuration markup *

    * <bg pattern="stripes"/>
    * 
* corresponds to a configuration element named "bg" * with an attribute named "pattern" * with attribute value "stripes". *

*

Note that any translation specified in the plug-in manifest * file is automatically applied. *

* * @param name the name of the attribute * @return attribute value, or null if none * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual QString GetAttribute(const QString& name) const = 0; /** * Returns the names of the attributes of this configuration element. * Returns an empty list if this configuration element has no attributes. *

* The names of configuration element attributes * are the same as the attribute names of the corresponding XML element. * For example, the configuration markup *

    * <bg color="blue" pattern="stripes"/>
    * 
* corresponds to a configuration element named "bg" * with attributes named "color" * and "pattern". *

* * @return the names of the attributes * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual QList GetAttributeNames() const = 0; /** * Returns all configuration elements that are children of this * configuration element. * Returns an empty list if this configuration element has no children. *

* Each child corresponds to a nested * XML element in the configuration markup. * For example, the configuration markup - *

-   * <view>
-   *     <verticalHint>top</verticalHint>
-   *     <horizontalHint>left</horizontalHint>
-   * </view>
-   * 
+ * \code{.unparsed} + * + * top + * left + * + * \endcode * corresponds to a configuration element, named "view", * with two children. *

* * @return the child configuration elements * @throws InvalidRegistryObjectException if this configuration element is no longer valid - * @see #getChildren(String) */ virtual QList GetChildren() const = 0; /** * Returns all child configuration elements with the given name. * Returns an empty list if this configuration element has no children * with the given name. * * @param name the name of the child configuration element * @return the child configuration elements with that name * @throws InvalidRegistryObjectException if this configuration element is no longer valid - * @see #getChildren() */ virtual QList GetChildren(const QString& name) const = 0; /** * Returns the extension that declares this configuration element. * * @return the extension * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual SmartPointer GetDeclaringExtension() const = 0; /** * Returns the name of this configuration element. * The name of a configuration element is the same as * the XML tag of the corresponding XML element. * For example, the configuration markup *
    * <wizard name="Create Project"/>
    * 
* corresponds to a configuration element named "wizard". * * @return the name of this configuration element * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual QString GetName() const = 0; /** * Returns the element which contains this element. If this element * is an immediate child of an extension, the * returned value can be downcast to IExtension. * Otherwise the returned value can be downcast to * IConfigurationElement. * * @return the parent of this configuration element * or null * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual SmartPointer GetParent() const = 0; /** * Returns the text value of this configuration element. * For example, the configuration markup - *
-   * <script lang="javascript">.\scripts\cp.js</script>
-   * 
- * corresponds to a configuration element "script" + * \code{.unparsed} + * + * \endcode + * corresponds to a configuration element "script" * with value ".\scripts\cp.js". *

Values may span multiple lines (i.e., contain carriage returns * and/or line feeds). *

Note that any translation specified in the plug-in manifest * file is automatically applied. *

* * @return the text value of this configuration element or null * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual QString GetValue() const = 0; /** * When multi-language support is enabled, this method returns the text value of this * configuration element in the specified locale, or null if none. *

* The locale matching tries to find the best match between available translations and * the requested locale, falling back to a more generic locale ("en") when the specific * locale ("en_US") is not available. *

* If multi-language support is not enabled, this method is equivalent to the method - * {@link #getValue()}. + * {@link #GetValue()}. *

* @param locale the requested locale * @return the text value of this configuration element in the specified locale, * or null * @throws InvalidRegistryObjectException if this configuration element is no longer valid - * @see #GetValue(String) * @see IExtensionRegistry#IsMultiLanguage() */ virtual QString GetValue(const QLocale& locale) const = 0; /** * Returns the namespace name for this configuration element. * * @return the namespace name for this configuration element * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual QString GetNamespaceIdentifier() const = 0; /** * Returns the contributor of this configuration element. * * @return the contributor for this configuration element * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual SmartPointer GetContributor() const = 0; /** * Returns whether this configuration element object is valid. * * @return true if the object is valid, and false * if it is no longer valid */ virtual bool IsValid() const = 0; }; } // namespace berry Q_DECLARE_INTERFACE(berry::IConfigurationElement, "org.blueberry.core.IConfigurationElement") #endif /*BERRYIEXTENSIONELEMENT_H_*/ diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIContributor.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIContributor.h index 2b353ffc4f..a3c73d630b 100644 --- a/Plugins/org.blueberry.core.runtime/src/registry/berryIContributor.h +++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIContributor.h @@ -1,55 +1,55 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYICONTRIBUTOR_H #define BERRYICONTRIBUTOR_H #include "berryObject.h" #include namespace berry { /** * This interface describes a registry contributor - an entity that supplies information * to the extension registry. *

* Registry contributor objects can be obtained by calling {@link IExtensionPoint#GetContributor()}, * {@link IExtension#GetContributor()}, and {@link IConfigurationElement#GetContributor()}. * Alternatively, a contributor factory appropriate for the registry in use can be called to directly * obtain an IContributor object. *

* This interface is not intended to be implemented or extended by clients. *

* @see ContributorFactoryOSGi * @see ContributorFactorySimple * - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. + * @note This interface is not intended to be implemented by clients. + * @note This interface is not intended to be extended by clients. */ struct org_blueberry_core_runtime_EXPORT IContributor : public Object { berryObjectMacro(berry::IContributor); ~IContributor() override; /** * Provides name of the contributor (e.g., "org.eclipse.core.runtime"). * * @return name of the registry contributor */ virtual QString GetName() const = 0; }; } #endif // BERRYICONTRIBUTOR_H diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtension.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtension.h index f43c389cf6..7b3f01df2f 100644 --- a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtension.h +++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtension.h @@ -1,151 +1,150 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEXTENSION_H_ #define BERRYIEXTENSION_H_ #include #include namespace berry { struct IConfigurationElement; struct IContributor; /** * An extension declared in a plug-in. * All information is obtained from the declaring plug-in's * manifest (plugin.xml) file. *

* These registry objects are intended for relatively short-term use. Clients that * deal with these objects must be aware that they may become invalid if the * declaring plug-in is updated or uninstalled. If this happens, all methods except * {@link #IsValid()} will throw {@link InvalidRegistryObjectException}. * For extension objects, the most common case is code in a plug-in dealing * with extensions contributed to one of the extension points it declares. * Code in a plug-in that has declared that it is not dynamic aware (or not * declared anything) can safely ignore this issue, since the registry * would not be modified while it is active. However, code in a plug-in that * declares that it is dynamic aware must be careful when accessing the extension * objects because they become invalid if the contributing plug-in is removed. * Similarly, tools that analyze or display the extension registry are vulnerable. * Client code can pre-test for invalid objects by calling {@link #IsValid()}, * which never throws this exception. However, pre-tests are usually not sufficient * because of the possibility of the extension object becoming invalid as a * result of a concurrent activity. At-risk clients must treat * InvalidRegistryObjectException as if it were a checked exception. * Also, such clients should probably register a listener with the extension registry * so that they receive notification of any changes to the registry. *

* This interface is not intended to be implemented by clients. *

- * @noimplement This interface is not intended to be implemented by clients. */ struct org_blueberry_core_runtime_EXPORT IExtension : public virtual Object { berryObjectMacro(berry::IExtension); ~IExtension() override; /** * Returns all configuration elements declared by this extension. * These elements are a direct reflection of the configuration * markup supplied in the manifest (plugin.xml) * file for the plug-in that declares this extension. * Returns an empty array if this extension does not declare any * configuration elements. * * @return the configuration elements declared by this extension * @throws InvalidRegistryObjectException if this extension is no longer valid */ virtual QList > GetConfigurationElements() const = 0; /** * Returns the namespace name for this extension. * * @return the namespace name for this extension * @throws InvalidRegistryObjectException if this extension is no longer valid */ virtual QString GetNamespaceIdentifier() const = 0; /** * Returns the contributor of this extension. * * @return the contributor for this extension * @throws InvalidRegistryObjectException if this extension is no longer valid */ virtual SmartPointer GetContributor() const = 0; /** * Returns the unique identifier of the extension point * to which this extension should be contributed. * * @return the unique identifier of the relevant extension point * @throws InvalidRegistryObjectException if this extension is no longer valid */ virtual QString GetExtensionPointUniqueIdentifier() const = 0; /** * Returns a displayable label for this extension. * Returns the empty string if no label for this extension * is specified in the extension manifest file. *

Note that any translation specified in the extension manifest * file is automatically applied. *

* * @return a displayable string label for this extension, * possibly the empty string * @throws InvalidRegistryObjectException if this extension is no longer valid */ virtual QString GetLabel() const = 0; /** * Returns the simple identifier of this extension, or null * if this extension does not have an identifier. * This identifier is specified in the extensions manifest * file as a non-empty string containing no period characters * ('.') and must be unique within the defining host. * * @return the simple identifier of the extension (e.g. "main") * or null * @throws InvalidRegistryObjectException if this extension is no longer valid */ virtual QString GetSimpleIdentifier() const = 0; /** * Returns the unique identifier of this extension, or null * if this extension does not have an identifier. * If available, this identifier is unique within the extension registry, and * is composed of the identifier of the host that declared * this extension and this extension's simple identifier. * * @return the unique identifier of the extension * (e.g. "com.example.acme.main"), or null * @throws InvalidRegistryObjectException if this extension is no longer valid */ virtual QString GetUniqueIdentifier() const = 0; /** * Returns whether this extension object is valid. * * @return true if the object is valid, and false * if it is no longer valid */ virtual bool IsValid() const = 0; }; } #endif /*BERRYIEXTENSION_H_*/ diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionPoint.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionPoint.h index faa799e5df..6e7e814c39 100644 --- a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionPoint.h +++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionPoint.h @@ -1,163 +1,162 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEXTENSIONPOINT_H_ #define BERRYIEXTENSIONPOINT_H_ #include namespace berry { struct IConfigurationElement; struct IContributor; struct IExtension; /** * An extension point declared in a plug-in. * Except for the list of extensions plugged in to it, the information * available for an extension point is obtained from the declaring plug-in's * manifest (plugin.xml) file. *

* These registry objects are intended for relatively short-term use. Clients that * deal with these objects must be aware that they may become invalid if the * declaring plug-in is updated or uninstalled. If this happens, all methods except - * {@link #isValid()} will throw {@link InvalidRegistryObjectException}. + * {@link #IsValid()} will throw {@link InvalidRegistryObjectException}. * For extension point objects, the most common case is code in a plug-in dealing * with one of the extension points it declares. These extension point objects are * guaranteed to be valid while the plug-in is active. Code in a plug-in that has * declared that it is not dynamic aware (or not declared anything) can also safely * ignore this issue, since the registry would not be modified while it is * active. However, code in a plug-in that declares that it is dynamic aware * must be careful if it access the extension point object of a different plug-in, * because it's at risk if that other plug-in is removed. Similarly, * tools that analyze or display the extension registry are vulnerable. - * Client code can pre-test for invalid objects by calling {@link #isValid()}, + * Client code can pre-test for invalid objects by calling {@link #IsValid()}, * which never throws this exception. However, pre-tests are usually not sufficient * because of the possibility of the extension point object becoming invalid as a * result of a concurrent activity. At-risk clients must treat * InvalidRegistryObjectException as if it were a checked exception. * Also, such clients should probably register a listener with the extension registry * so that they receive notification of any changes to the registry. *

*

* This interface is not intended to be implemented by clients. *

- * @noimplement This interface is not intended to be implemented by clients. */ struct IExtensionPoint : public virtual Object { berryObjectMacro(berry::IExtensionPoint); ~IExtensionPoint() override; /** * Returns all configuration elements from all extensions configured * into this extension point. Returns an empty array if this extension * point has no extensions configured, or none of the extensions * contain configuration elements. * * @return the configuration elements for all extension configured * into this extension point * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual QList > GetConfigurationElements() const = 0; /** * Returns the namespace name for this extension point. * * @return the namespace name for this extension point * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual QString GetNamespaceIdentifier() const = 0; /** * Returns the contributor of this extension point. * * @return the contributor for this extension point * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual SmartPointer GetContributor() const = 0; /** * Returns the extension with the given unique identifier configured into * this extension point, or null if there is no such extension. * Since an extension might not have an identifier, some extensions * can only be found via the getExtensions method. * * @param extensionId the unique identifier of an extension * (e.g. "com.example.acme.main"). * @return an extension, or null * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual SmartPointer GetExtension(const QString& extensionId) const = 0; /** * Returns all extensions configured into this extension point. * Returns an empty array if this extension point has no extensions. * * @return the extensions configured into this extension point * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual QList > GetExtensions() const = 0; /** * Returns a displayable label for this extension point. * Returns the empty string if no label for this extension point * is specified in the plug-in manifest file. *

Note that any translation specified in the plug-in manifest * file is automatically applied. *

* * @return a displayable string label for this extension point, * possibly the empty string * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual QString GetLabel() const = 0; /** * Returns the simple identifier of this extension point. * This identifier is a non-empty string containing no * period characters ('.') and is guaranteed * to be unique within the defining plug-in. * * @return the simple identifier of the extension point (e.g. "builders") * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual QString GetSimpleIdentifier() const = 0; /** * Returns the unique identifier of this extension point. * This identifier is unique within the plug-in registry, and * is composed of the namespace for this extension point * and this extension point's simple identifier. * * * @return the unique identifier of the extension point * (e.g. "org.blueberry.core.resources.builders") * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual QString GetUniqueIdentifier() const = 0; /** * Returns whether this extension point object is valid. * * @return true if the object is valid, and false * if it is no longer valid */ virtual bool IsValid() const = 0; }; } #endif /*BERRYIEXTENSIONPOINT_H_*/ diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionRegistry.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionRegistry.h index b87c4d70c7..a42b906847 100644 --- a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionRegistry.h +++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionRegistry.h @@ -1,401 +1,396 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEXTENSIONREGISTRY_H #define BERRYIEXTENSIONREGISTRY_H #include "org_blueberry_core_runtime_Export.h" #include #include class QTranslator; namespace berry { struct IConfigurationElement; struct IContributor; struct IExtension; struct IExtensionPoint; struct IExtensionPointFilter; struct IRegistryEventListener; /** * The extension registry holds the master list of all * discovered namespaces, extension points and extensions. *

* The extension registry can be queried, by name, for * extension points and extensions. *

*

* The various objects that describe the contents of the extension registry * ({@link IExtensionPoint}, {@link IExtension}, and {@link IConfigurationElement}) * are intended for relatively short-term use. Clients that deal with these objects * must be aware that they may become invalid if the declaring plug-in is updated * or uninstalled. If this happens, all methods on these object except - * isValid() will throw {@link org.eclipse.core.runtime.InvalidRegistryObjectException}. + * isValid() will throw {@link InvalidRegistryObjectException}. * Code in a plug-in that has declared that it is not dynamic aware (or not declared * anything) can safely ignore this issue, since the registry would not be * modified while it is active. However, code in a plug-in that declares that it * is dynamic aware must be careful if it accesses extension registry objects, * because it's at risk if plug-in are removed. Similarly, tools that analyze * or display the extension registry are vulnerable. Client code can pre-test for * invalid objects by calling isValid(), which never throws this exception. * However, pre-tests are usually not sufficient because of the possibility of the * extension registry object becoming invalid as a result of a concurrent activity. * At-risk clients must treat InvalidRegistryObjectException as if it * were a checked exception. Also, such clients should probably register a listener * with the extension registry so that they receive notification of any changes to * the registry. *

*

* Extensions and extension points are declared by generic entities called - * namespaces. The only fact known about namespaces is that they + * \c namespaces . The only fact known about namespaces is that they * have unique string-based identifiers. One example of a namespace * is a plug-in, for which the namespace id is the plug-in id. *

* This interface is not intended to be implemented by clients. *

- * @noimplement This interface is not intended to be implemented by clients. */ struct org_blueberry_core_runtime_EXPORT IExtensionRegistry { virtual ~IExtensionRegistry(); /** * Returns all configuration elements from all extensions configured * into the identified extension point. Returns an empty list if the extension * point does not exist, has no extensions configured, or none of the extensions * contain configuration elements. * * @param extensionPointId the unique identifier of the extension point * (e.g. "org.blueberry.core.applications") * @return the configuration elements */ virtual QList > GetConfigurationElementsFor( const QString& extensionPointId) const = 0; /** * Returns all configuration elements from all extensions configured * into the identified extension point. Returns an empty list if the extension * point does not exist, has no extensions configured, or none of the extensions * contain configuration elements. * - * @param namespace the namespace for the extension point + * @param namespaze the namespace for the extension point * (e.g. "org.eclipse.core.resources") * @param extensionPointName the simple identifier of the * extension point (e.g. "builders") * @return the configuration elements */ virtual QList > GetConfigurationElementsFor( const QString& namespaze, const QString& extensionPointName) const = 0; /** * Returns all configuration elements from the identified extension. * Returns an empty array if the extension does not exist or * contains no configuration elements. * - * @param namespace the namespace for the extension point + * @param namespaze the namespace for the extension point * (e.g. "org.eclipse.core.resources") * @param extensionPointName the simple identifier of the * extension point (e.g. "builders") * @param extensionId the unique identifier of the extension * (e.g. "com.example.acme.coolbuilder") * @return the configuration elements */ virtual QList > GetConfigurationElementsFor( const QString& namespaze, const QString& extensionPointName, const QString& extensionId) const = 0; /** * Returns the specified extension in this extension registry, * or null if there is no such extension. * * @param extensionId the unique identifier of the extension * (e.g. "com.example.acme.coolbuilder") * @return the extension, or null */ virtual SmartPointer GetExtension(const QString& extensionId) const = 0; /** * Returns the specified extension in this extension registry, * or null if there is no such extension. * The first parameter identifies the extension point, and the second * parameter identifies an extension plugged in to that extension point. * * @param extensionPointId the unique identifier of the extension point * (e.g. "org.eclipse.core.resources.builders") * @param extensionId the unique identifier of the extension * (e.g. "com.example.acme.coolbuilder") * @return the extension, or null */ virtual SmartPointer GetExtension(const QString& extensionPointId, const QString& extensionId) const = 0; /** * Returns the specified extension in this extension registry, * or null if there is no such extension. * The first two parameters identify the extension point, and the third * parameter identifies an extension plugged in to that extension point. * - * @param namespace the namespace for the extension point + * @param namespaze the namespace for the extension point * (e.g. "org.eclipse.core.resources") * @param extensionPointName the simple identifier of the * extension point (e.g. "builders") * @param extensionId the unique identifier of the extension * (e.g. "com.example.acme.coolbuilder") * @return the extension, or null */ virtual SmartPointer GetExtension(const QString& namespaze, const QString& extensionPointName, const QString& extensionId) const = 0; /** * Returns the extension point with the given extension point identifier * in this extension registry, or null if there is no such * extension point. * * @param extensionPointId the unique identifier of the extension point * (e.g., "org.blueberry.core.applications") * @return the extension point, or null */ virtual SmartPointer GetExtensionPoint(const QString& extensionPointId) const = 0; /** * Returns the extension point in this extension registry * with the given namespace and extension point simple identifier, * or null if there is no such extension point. * - * @param namespace the namespace for the given extension point + * @param namespaze the namespace for the given extension point * (e.g. "org.eclipse.core.resources") * @param extensionPointName the simple identifier of the * extension point (e.g. "builders") * @return the extension point, or null */ virtual SmartPointer GetExtensionPoint(const QString& namespaze, const QString& extensionPointName) const = 0; /** * Returns all extension points known to this extension registry. * Returns an empty array if there are no extension points. * * @return the extension points known to this extension registry */ virtual QList > GetExtensionPoints() const = 0; /** * Returns all extension points declared in the given namespace. Returns an empty array if * there are no extension points declared in the namespace. * - * @param namespace the namespace for the extension points + * @param namespaze the namespace for the extension points * (e.g. "org.eclipse.core.resources") * @return the extension points in this registry declared in the given namespace */ virtual QList > GetExtensionPoints(const QString& namespaze) const = 0; /** * Returns all extension points supplied by the contributor, or null * if there are no such extension points. * * @param contributor the contributor for the extensions (for OSGi registry, bundles and * fragments are different contributors) * @return the extension points, or null * @since 3.4 */ virtual QList > GetExtensionPoints( const SmartPointer& contributor) const = 0; /** * Returns all extensions declared in the given namespace. Returns an empty array if * no extensions are declared in the namespace. * - * @param namespace the namespace for the extensions + * @param namespaze the namespace for the extensions * (e.g. "org.eclipse.core.resources") * @return the extensions in this registry declared in the given namespace */ virtual QList > GetExtensions(const QString& namespaze) const = 0; /** * Returns all extensions supplied by the contributor, or null if there * are no such extensions. * @param contributor the contributor for the extensions (for OSGi registry, bundles and * fragments are different contributors) * @return the extensions, or null */ virtual QList > GetExtensions(const SmartPointer& contributor) const = 0; /** * Returns all namespaces currently used by extensions and extension points in this * registry. Returns an empty array if there are no known extensions/extension points * in this registry. *

* The fully-qualified name of an extension point or an extension consist of * a namespace and a simple name (much like a qualified Java class name consist * of a package name and a class name). The simple names are presumed to be unique * in the namespace. *

* @return all namespaces known to this registry */ virtual QList GetNamespaces() const = 0; /** * Adds to this extension registry an extension point(s), extension(s), or * a combination of those described by the XML file. The information in * the XML file should be supplied in the same format as the plugin.xml; in fact, * Plug-in Manifest editor can be used to prepare the XML file. The top token * of the contribution (normally, "plugin" or "fragment" in the Plug-in Manifest * editor) is ignored by this method. *

* This method is an access controlled method. Proper token (master token or user token) should - * be passed as an argument. Two registry keys are set in the registry constructor - * {@link RegistryFactory#CreateRegistry(RegistryStrategy*, QObject*, QObject*)}: + * be passed as an argument. Two registry keys are set in the registry constructor: * master token and a user token. Master token allows all operations; user token allows * non-persisted registry elements to be modified. *

* * @param is stream open on the XML file. The XML file can contain an extension * point(s) or/and extension(s) described in the format similar to plugin.xml. The method * closes the device before returning. * @param contributor the contributor making this contribution. * @param persist indicates if the contribution(s) should be stored in the registry cache. If false, * contribution is not persisted in the registry cache and is lost on BlueBerry restart * @param name optional name of the contribution. Used for error reporting; might be QString() * @param translationBundle optional translator used for translations; might be nullptr * @param token the key used to check permissions * @return true if the contribution was successfully processed and false otherwise * @throws ctkInvalidArgumentException if an incorrect token is passed * * @see IContributor */ virtual bool AddContribution(QIODevice* is, const SmartPointer& contributor, bool persist, const QString& name, QTranslator* translationBundle, QObject* token) = 0; /** * Removes the given extension from this registry. *

* This method is an access controlled method. Proper token (master token or user token) should - * be passed as an argument. Two registry keys are set in the registry constructor - * {@link RegistryFactory#CreateRegistry(RegistryStrategy*, QObject*, QObject*)}: + * be passed as an argument. Two registry keys are set in the registry constructor: * master token and a user token. Master token allows all operations; user token only * allows non-persisted registry elements to be modified. *

* * @param extension extension to be removed * @param token the key used to check permissions * @return true if the extension was successfully removed, and false otherwise * @throws ctkInvalidArgumentException if an incorrect token is passed */ virtual bool RemoveExtension(const SmartPointer& extension, QObject* token) = 0; /** * Removes the specified extension point from this registry. *

* This method is an access controlled method. Proper token (master token or user token) should - * be passed as an argument. Two registry keys are set in the registry constructor - * {@link RegistryFactory#CreateRegistry(RegistryStrategy*, QObject*, QObject*)}: + * be passed as an argument. Two registry keys are set in the registry constructor: * master token and a user token. Master token allows all operations; user token only * allows non-persisted registry elements to be modified. *

* * @param extensionPoint extension point to be removed * @param token the key used to check permissions * @return true if the extension point was successfully removed, and * false otherwise * @throws ctkInvalidArgumentException if incorrect token is passed */ virtual bool RemoveExtensionPoint(const SmartPointer& extensionPoint, QObject* token) = 0; /** * Call this method to properly stop the registry. The method stops registry event processing * and writes out cache information to be used in the next run. This is an access controlled * method; master token is required. *

* This method is an access controlled method. Master token should be passed as an argument. *

- * @see RegistryFactory#CreateRegistry(RegistryStrategy*, QObject*, QObject*) * @param token master token for the registry * @throws IllegalArgumentException if incorrect token is passed */ virtual void Stop(QObject* token) = 0; /** * Adds the given listener for registry change events related to the specified * extension point or for changes to all extension points and underlying * extensions if the \c extensionPointId argument is empty. *

* Depending on activity, listeners of this type might receive a large number * of modifications and negatively impact overall system performance. Whenever * possible, consider registering listener specific to an extension point rather * than a "global" listener. *

* Once registered, a listener starts receiving notification of changes to * the registry. Registry change notifications are sent asynchronously. * The listener continues to receive notifications until it is removed. *

* This method has no effect if the listener is already registered. *

* @param listener the listener * @param extensionPointId the unique identifier of extension point * @see IExtensionPoint#GetUniqueIdentifier() */ virtual void AddListener(IRegistryEventListener* listener, const QString& extensionPointId = QString()) = 0; /** * Adds the given listener for registry change events for extension points * matching the provided filter. *

* Depending on activity, listeners of this type might receive a large number * of modifications and negatively impact overall system performance. Whenever * possible, consider registering listener specific to an extension point rather * than a "global" listener. *

* Once registered, a listener starts receiving notification of changes to * the registry. Registry change notifications are sent asynchronously. * The listener continues to receive notifications until it is removed. *

* This method has no effect if the listener is already registered. *

* @param listener the listener * @param filter An extension point filter * @see ExtensionTracker */ virtual void AddListener(IRegistryEventListener *listener, const IExtensionPointFilter& filter) = 0; /** * Removes the given registry change listener from this registry. *

* This method has no effect if the listener is not registered. *

* @param listener the listener * @see #AddListener(IRegistryEventListener*, const QString&) */ virtual void RemoveListener(IRegistryEventListener* listener) = 0; /** * Call this method to determine if this extension registry supports multiple languages. *

* See the runtime option "-registryMultiLanguage" for enabling multi-language * support. *

* @return true if multiple languages are supported by this * instance of the extension registry; false otherwise. */ virtual bool IsMultiLanguage() const = 0; }; } Q_DECLARE_INTERFACE(berry::IExtensionRegistry, "org.blueberry.service.IExtensionRegistry") #endif // BERRYIEXTENSIONREGISTRY_H diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryAbstractContributionFactory.h b/Plugins/org.blueberry.ui.qt/src/actions/berryAbstractContributionFactory.h index c22feb26b7..38c741102a 100644 --- a/Plugins/org.blueberry.ui.qt/src/actions/berryAbstractContributionFactory.h +++ b/Plugins/org.blueberry.ui.qt/src/actions/berryAbstractContributionFactory.h @@ -1,135 +1,135 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYABSTRACTCONTRIBUTIONFACTORY_H_ #define BERRYABSTRACTCONTRIBUTIONFACTORY_H_ #include #include namespace berry { struct IServiceLocator; struct IContributionRoot; /** * ContributionFactories are used by the IMenuService to populate * ContributionManagers. In CreateContributionItems() * you fill in the additions List with {@link IContributionItem} to be inserted at this * factory's location. For example: *

* *

  * AbstractContributionFactory contributions = new AbstractContributionFactory(
  *    "menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions") {
  *  public void CreateContributionItems(IMenuService menuService, List additions) {
  *    CommandContributionItem item = new CommandContributionItem(
  *        "org.eclipse.ui.tests.menus.helloWorld",
  *        "org.eclipse.ui.tests.commands.enabledHelloWorld", null, null,
  *        "Say Hello", null);
  *    additions.add(item);
  *    item = new CommandContributionItem(
  *        "org.eclipse.ui.tests.menus.refresh",
  *        "org.eclipse.ui.tests.commands.refreshView", null, null,
  *        "Refresh", null);
  *    menuService.registerVisibleWhen(item, new MyActiveContextExpression(
  *        "org.eclipse.ui.tests.myview.context"));
  *    additions.add(item);
  *  }
  *
  *  public void releaseContributionItems(IMenuService menuService, List items) {
  *    // we have nothing to do
  *  }
  * };
  * IMenuService service = (IMenuService) PlatformUI.getWorkbench().getService(
  *    IMenuService.class);
  * service.addContributionFactory(contributions);
  * 
* *

*

* Only the abstract methods may be implemented. *

* * @see IMenuService * @see MenuManager * @see ToolBarManager */ class BERRY_UI_QT AbstractContributionFactory: public Object { private: QString location; QString namespaze; public: berryObjectMacro(berry::AbstractContributionFactory); /** * The contribution factories must be instantiated with their location, * which which specifies the contributions insertion location. * * @param location * the addition location in Menu API URI format. It must not be * null. - * @param namespace + * @param namespaze * the namespace for this contribution. May be null. - * @see #getNamespace() + * @see #GetNamespace */ AbstractContributionFactory(const QString& location, const QString& namespaze); /** * Return the location as a String. * * @return the location - never null. */ QString GetLocation() const; /** * This factory should create the IContributionItems that it wants to * contribute, and add them to the additions list. The menu service will * call this method at the appropriate time. It should always return new * instances of its contributions in the additions list. *

* This method is not meant to be called by clients. It will be called by * the menu service at the appropriate time. *

* * @param serviceLocator * a service locator that may be used in the construction of * items created by this factory * @param additions * A {@link IContributionRoot} supplied by the framework. It will * never be null. * @see org.eclipse.ui.menus.CommandContributionItem * @see org.eclipse.jface.action.MenuManager */ virtual void CreateContributionItems(IServiceLocator* serviceLocator, const SmartPointer& additions) = 0; /** * Return the namespace for this cache. This corresponds to the plug-in that * is contributing this factory. * * @return the namespace the namespace of this factory */ QString GetNamespace() const; }; } #endif /* BERRYABSTRACTCONTRIBUTIONFACTORY_H_ */ diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryCommandContributionItemParameter.h b/Plugins/org.blueberry.ui.qt/src/actions/berryCommandContributionItemParameter.h index 5001a63f8a..52cb8ea7ff 100644 --- a/Plugins/org.blueberry.ui.qt/src/actions/berryCommandContributionItemParameter.h +++ b/Plugins/org.blueberry.ui.qt/src/actions/berryCommandContributionItemParameter.h @@ -1,197 +1,193 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYCOMMANDCONTRIBUTIONITEMPARAMETER_H #define BERRYCOMMANDCONTRIBUTIONITEMPARAMETER_H #include #include #include #include "berryCommandContributionItem.h" namespace berry { struct IServiceLocator; /** * A help class for the various parameters that can be used with command * contributions. Mandatory parameters are in the constructor, and public fields * can be set to fill in other parameters. */ class BERRY_UI_QT CommandContributionItemParameter : public virtual Object { public: berryObjectMacro(CommandContributionItemParameter); /** * a service locator that is most appropriate for this contribution. * Typically the local {@link IWorkbenchWindow} or * {@link IWorkbenchPartSite} will be sufficient. Must not be * null. */ IServiceLocator* serviceLocator; /** * The id for this item. May be null. Items without an id * cannot be referenced later. */ QString id; /** * A command id for a defined command. Must not be null. */ QString commandId; /** * A map of strings to strings which represent parameter names to values. * The parameter names must match those in the command definition. May be * null */ QHash parameters; /** * An icon for this item. May be null. */ QIcon icon; /** * A label for this item. May be null. */ QString label; /** * A mnemonic for this item to be applied to the label. May be * null. */ QChar mnemonic; /** * A shortcut key sequence. This is a workaround and will be * removed when key binding support is fully implemented */ QKeySequence shortcut; /** * A tooltip for this item. May be null. Tooltips are * currently only valid for toolbar contributions. */ QString tooltip; /** * The style of this menu contribution. See the CommandContributionItem * STYLE_* contants. */ CommandContributionItem::Style style; /** * The help context id to be applied to this contribution. May be * null */ QString helpContextId; /** * The icon style to use. */ QString iconStyle; /** * The visibility tracking for a menu contribution. */ bool visibleEnabled; /** * Any number of mode bits, like * {@link CommandContributionItem#MODE_FORCE_TEXT}. */ CommandContributionItem::Modes mode; /** * Create the parameter object. Nullable attributes can be set directly. * * @param serviceLocator * a service locator that is most appropriate for this * contribution. Typically the local {@link IWorkbenchWindow} or * {@link IWorkbenchPartSite} will be sufficient. Must not be * null. * @param id * The id for this item. May be null. Items * without an id cannot be referenced later. * @param commandId * A command id for a defined command. Must not be * null. * @param style * The style of this menu contribution. See the STYLE_* contants. */ CommandContributionItemParameter(IServiceLocator* serviceLocator, const QString& id, const QString& commandId, CommandContributionItem::Style style); /** * Build the parameter object. *

* Note: This constructor should not be called outside the framework. *

* * @param serviceLocator * a service locator that is most appropriate for this * contribution. Typically the local {@link IWorkbenchWindow} or * {@link IWorkbenchPartSite} will be sufficient. Must not be * null. * @param id * The id for this item. May be null. Items * without an id cannot be referenced later. * @param commandId * A command id for a defined command. Must not be * null. * @param parameters * A map of strings to strings which represent parameter names to * values. The parameter names must match those in the command * definition. May be null * @param icon * An icon for this item. May be null. - * @param disabledIcon - * A disabled icon for this item. May be null. - * @param hoverIcon - * A hover icon for this item. May be null. * @param label * A label for this item. May be null. * @param mnemonic * A mnemonic for this item to be applied to the label. May be * null. * @param tooltip * A tooltip for this item. May be null. Tooltips * are currently only valid for toolbar contributions. * @param style * The style of this menu contribution. See the STYLE_* contants. * @param helpContextId * the help context id to be applied to this contribution. May be * null * @param visibleEnabled * Visibility tracking for the menu contribution. - * @noreference This constructor is not intended to be referenced by clients. + * @note This constructor is not intended to be referenced by clients. */ CommandContributionItemParameter(IServiceLocator* serviceLocator, const QString& id, const QString& commandId, const QHash ¶meters, const QIcon& icon, const QString label, const QChar &mnemonic, const QString& tooltip, CommandContributionItem::Style style, const QString& helpContextId, bool visibleEnabled); }; } #endif // BERRYCOMMANDCONTRIBUTIONITEM_H diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryContributionItem.h b/Plugins/org.blueberry.ui.qt/src/actions/berryContributionItem.h index c2d28f944b..7411c02ab4 100644 --- a/Plugins/org.blueberry.ui.qt/src/actions/berryContributionItem.h +++ b/Plugins/org.blueberry.ui.qt/src/actions/berryContributionItem.h @@ -1,227 +1,227 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYCONTRIBUTIONITEM_H #define BERRYCONTRIBUTIONITEM_H #include "berryIContributionItem.h" #include namespace berry { /** * An abstract base implementation for contribution items. */ class BERRY_UI_QT ContributionItem : public IContributionItem { public: berryObjectMacro(ContributionItem); enum Mode { DEFAULT = 0x00, /** * Mode bit: Show text on tool items or buttons, even if an image is * present. If this mode bit is not set, text is only shown on tool items if * there is no image present. */ MODE_FORCE_TEXT = 0x01 }; Q_DECLARE_FLAGS(Modes, Mode) enum Style { /** * A push button tool item or menu item. */ STYLE_PUSH = 0x01, /** * A checked tool item or menu item. */ STYLE_CHECK = 0x02, /** * A radio-button style menu item. */ STYLE_RADIO = 0x04, /** * A ToolBar pulldown item. */ STYLE_PULLDOWN = 0x08 }; /** * The default implementation of this IContributionItem * method does nothing. Subclasses may override. */ void Fill(QStatusBar* parent) override; /** * The default implementation of this IContributionItem * method does nothing. Subclasses may override. */ void Fill(QMenu* menu, QAction* before) override; /** * The default implementation of this IContributionItem * method does nothing. Subclasses may override. */ void Fill(QMenuBar* menu, QAction* before) override; /** * The default implementation of this IContributionItem * method does nothing. Subclasses may override. */ void Fill(QToolBar* parent, QAction* before) override; /** * The default implementation of this IContributionItem * method does nothing. Subclasses may override. */ void SaveWidgetState() override; /* * Method declared on IContributionItem. */ QString GetId() const override; /** * Returns the parent contribution manager, or null if this * contribution item is not currently added to a contribution manager. * * @return the parent contribution manager, or null */ IContributionManager *GetParent() const; /** * The default implementation of this IContributionItem * method returns false. Subclasses may override. */ bool IsDirty() const override; /** * The default implementation of this IContributionItem * method returns true. Subclasses may override. */ bool IsEnabled() const override; /** * The default implementation of this IContributionItem * method returns false. Subclasses may override. */ bool IsDynamic() const override; /** * The default implementation of this IContributionItem * method returns false. Subclasses may override. */ bool IsGroupMarker() const override; /** * The default implementation of this IContributionItem * method returns false. Subclasses may override. */ bool IsSeparator() const override; /** * The default implementation of this IContributionItem * method returns the value recorded in an internal state variable, * which is true by default. setVisible * should be used to change this setting. */ bool IsVisible() const override; /** * The default implementation of this IContributionItem * method stores the value in an internal state variable, * which is true by default. */ void SetVisible(bool visible) override; /** * Returns a string representation of this contribution item * suitable only for debugging. */ QString ToString() const override; /** * The default implementation of this IContributionItem * method does nothing. Subclasses may override. */ void Update() override; /* * Method declared on IContributionItem. */ void SetParent(IContributionManager* parent) override; /** * The ContributionItem implementation of this * method declared on IContributionItem does nothing. * Subclasses should override to update their state. */ void Update(const QString& id) override; /** * The ID for this contribution item. It should be set once either in the * constructor or using this method. * * @param itemId - * @see #getId() + * @see #GetId */ void SetId(const QString& itemId); protected: /** * Creates a contribution item with a null id. * Calls this(String) with null. */ ContributionItem(); /** * Creates a contribution item with the given (optional) id. * The given id is used to find items in a contribution manager, * and for positioning items relative to other items. * * @param id the contribution item identifier, or null */ ContributionItem(const QString& id); private: /** * The identifier for this contribution item, of null if none. */ QString id; /** * Indicates this item is visible in its manager; true * by default. */ bool visible; /** * The parent contribution manager for this item */ IContributionManager* parent; }; } #endif // BERRYCONTRIBUTIONITEM_H diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryContributionManager.h b/Plugins/org.blueberry.ui.qt/src/actions/berryContributionManager.h index d62e7af4ce..cc6031961b 100644 --- a/Plugins/org.blueberry.ui.qt/src/actions/berryContributionManager.h +++ b/Plugins/org.blueberry.ui.qt/src/actions/berryContributionManager.h @@ -1,339 +1,339 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYCONTRIBUTIONMANAGER_H #define BERRYCONTRIBUTIONMANAGER_H #include "berryIContributionManager.h" namespace berry { struct IContributionManagerOverrides; /** * Abstract base class for all contribution managers, and standard * implementation of IContributionManager. This class provides * functionality common across the specific managers defined by this framework. *

* This class maintains a list of contribution items and a dirty flag, both as * internal state. In addition to providing implementations of most * IContributionManager methods, this class automatically * coalesces adjacent separators, hides beginning and ending separators, and * deals with dynamically changing sets of contributions. When the set of * contributions does change dynamically, the changes are propagated to the * control via the update method, which subclasses must * implement. *

*

* Note: A ContributionItem cannot be shared between different * ContributionManagers. *

*/ class ContributionManager : public virtual IContributionManager { protected: // Internal debug flag. // static final boolean DEBUG = false; public: berryObjectMacro(berry::ContributionManager); ~ContributionManager() override; /* * Method declared on IContributionManager. */ void Add(QAction* action, const QString& id) override; /* * Method declared on IContributionManager. */ void Add(const SmartPointer& item) override; /* * Method declared on IContributionManager. */ void AppendToGroup(const QString& groupName, QAction* action, const QString& id) override; /* * Method declared on IContributionManager. */ void AppendToGroup(const QString& groupName, const SmartPointer& item) override; /* * Method declared on IContributionManager. */ SmartPointer Find(const QString& id) const override; /* * Method declared on IContributionManager. */ QList > GetItems() const override; /** * Return the number of contributions in this manager. * * @return the number of contributions in this manager */ int GetSize(); /** * The ContributionManager implementation of this method * declared on IContributionManager returns the current * overrides. If there is no overrides it lazily creates one which overrides * no item state. */ SmartPointer GetOverrides() override; /** * Returns the index of the item with the given id. * * @param id * The id of the item whose index is requested. * * @return int the index or -1 if the item is not found */ int IndexOf(const QString& id); /** * Insert the item at the given index. * * @param index * The index to be used for insertion * @param item * The item to be inserted */ void Insert(int index, const SmartPointer& item); /* * (non-Javadoc) Method declared on IContributionManager. */ //void InsertAfter(const QString& ID, Action* action); /* * (non-Javadoc) Method declared on IContributionManager. */ void InsertAfter(const QString& ID, const SmartPointer& item) override; /* * (non-Javadoc) Method declared on IContributionManager. */ //void InsertBefore(const QString& ID, Action* action); /* * Method declared on IContributionManager. */ void InsertBefore(const QString& ID, const SmartPointer& item) override; /* * Method declared on IContributionManager. */ bool IsDirty() const override; /* * Method declared on IContributionManager. */ bool IsEmpty() const override; /* * Method declared on IContributionManager. */ void MarkDirty() override; /* * Method declared on IContributionManager. */ //void PrependToGroup(const QString& groupName, Action* action); /* * Method declared on IContributionManager. */ void PrependToGroup(const QString& groupName, const SmartPointer& item) override; /* * Method declared on IContributionManager. */ SmartPointer Remove(const QString& ID) override; /* * Method declared on IContributionManager. */ SmartPointer Remove(const SmartPointer &item) override; /* * (non-Javadoc) Method declared on IContributionManager. */ void RemoveAll() override; /** * Replaces the item of the given identifier with another contribution item. * This can be used, for example, to replace large contribution items with * placeholders to avoid memory leaks. If the identifier cannot be found in * the current list of items, then this does nothing. If multiple * occurrences are found, then the replacement items is put in the first * position and the other positions are removed. * * @param identifier * The identifier to look for in the list of contributions; * should not be null. * @param replacementItem * The contribution item to replace the old item; must not be * null. Use - * {@link org.eclipse.jface.action.ContributionManager#remove(java.lang.String) remove} + * {@link ContributionManager#Remove} * if that is what you want to do. - * @return true if the given identifier can be; + * @return true if the given identifier can be */ bool ReplaceItem(const QString &identifier, const SmartPointer& replacementItem); /** * Sets the overrides for this contribution manager * * @param newOverrides * the overrides for the items of this manager */ void SetOverrides(const SmartPointer& newOverrides); protected: /** * Creates a new contribution manager. */ ContributionManager(); /** * This method allows subclasses of ContributionManager to * prevent certain items in the contributions list. * ContributionManager will either block or allow an addition * based on the result of this method call. This can be used to prevent * duplication, for example. * * @param itemToAdd * The contribution item to be added; may be null. * @return true if the addition should be allowed; * false otherwise. The default implementation allows * all items. */ virtual bool AllowItem(IContributionItem* itemToAdd); /** * Internal debug method for printing statistics about this manager to * cout. */ void DumpStatistics(); /** * Returns whether this contribution manager contains dynamic items. A * dynamic contribution item contributes items conditionally, dependent on * some internal state. * * @return true if this manager contains dynamic items, and * false otherwise */ bool HasDynamicItems() const; /** * Returns the index of the object in the internal structure. This is * different from indexOf(String id) since some contribution * items may not have an id. * * @param item * The contribution item * @return the index, or -1 if the item is not found */ int IndexOf(const SmartPointer& item) const; /** * The given item was added to the list of contributions. Marks the manager * as dirty and updates the number of dynamic items, and the memento. * * @param item * the item to be added * */ void ItemAdded(const SmartPointer& item); /** * The given item was removed from the list of contributions. Marks the * manager as dirty and updates the number of dynamic items. * * @param item * remove given parent from list of contributions */ void ItemRemoved(const SmartPointer& item); /** * Sets whether this manager is dirty. When dirty, the list of contributions * is not accurately reflected in the corresponding widgets. * * @param dirty * true if this manager is dirty, and * false if it is up-to-date */ void SetDirty(bool dirty); /** * An internal method for setting the order of the contribution items. * * @param items * the contribution items in the specified order */ void InternalSetItems(const QList >& items); private: /** * The list of contribution items. */ QList > contributions; /** * Indicates whether the widgets are in sync with the contributions. */ bool isDirty; /** * Number of dynamic contribution items. */ int dynamicItems; /** * The overrides for items of this manager */ SmartPointer overrides; /** * Adds a contribution item to the start or end of the group with the given * name. * * @param groupName * the name of the group * @param item * the contribution item * @param append * true to add to the end of the group, and * false to add the beginning of the group * @exception IllegalArgumentException * if there is no group with the given name */ void AddToGroup(const QString& groupName, const SmartPointer& item, bool append); }; } #endif // BERRYCONTRIBUTIONMANAGER_H diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryGroupMarker.h b/Plugins/org.blueberry.ui.qt/src/actions/berryGroupMarker.h index c049d2f490..fef2190730 100644 --- a/Plugins/org.blueberry.ui.qt/src/actions/berryGroupMarker.h +++ b/Plugins/org.blueberry.ui.qt/src/actions/berryGroupMarker.h @@ -1,54 +1,53 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYGROUPMARKER_H #define BERRYGROUPMARKER_H #include namespace berry { /** * A group marker is a special kind of contribution item denoting * the beginning of a group. These groups are used to structure * the list of items. Unlike regular contribution items and * separators, group markers have no visual representation. * The name of the group is synonymous with the contribution item id. *

* This class may be instantiated; it is not intended to be * subclassed outside the framework. *

- * @noextend This class is not intended to be subclassed by clients. */ class BERRY_UI_QT GroupMarker : public AbstractGroupMarker { public: /** * Create a new group marker with the given name. * The group name must not be null or the empty string. * The group name is also used as the item id. * * @param groupName the name of the group */ GroupMarker(const QString& groupName); /** * The GroupMarker implementation of this method * returns false since group markers are always invisible. */ bool IsVisible() const override; }; } #endif // BERRYGROUPMARKER_H diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionItem.h b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionItem.h index 471f8b5718..7c2600b8bf 100644 --- a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionItem.h +++ b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionItem.h @@ -1,195 +1,194 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYICONTRIBUTIONITEM_H #define BERRYICONTRIBUTIONITEM_H #include #include class QStatusBar; class QMenu; class QMenuBar; class QToolBar; class QAction; namespace berry { struct IContributionManager; /** * A contribution item represents a contribution to a shared UI resource such as a * menu or tool bar. More generally, contribution items are managed by a contribution * manager. * For instance, in a tool bar a contribution item is a tool bar button or a separator. * In a menu bar a contribution item is a menu, and in a menu a contribution item * is a menu item or separator. *

* A contribution item can realize itself in different Qt widgets, using the different * fill methods. The same type of contribution item can be used with a * MenuBarManager, ToolBarManager, - * or a StatusLineManager. + * or a StatusLineManager. *

*

* This interface is internal to the framework; it should not be implemented outside * the framework. *

* * @see IContributionManager - * @noimplement This interface is not intended to be implemented by clients. */ struct IContributionItem : public virtual Object { berryObjectMacro(berry::IContributionItem); /** * Fills the given status bar control with controls representing this * contribution item. Used by StatusLineManager. * * @param parent the parent control */ virtual void Fill(QStatusBar* parent) = 0; /** * Fills the given menu bar with controls representing this contribution item. * Used by MenuBarManager. * * @param parent the parent menu * @param before */ virtual void Fill(QMenuBar* parent, QAction* before) = 0; /** * Fills the given menu with controls representing this contribution item. * Used by MenuManager. * * @param parent the parent menu * @param before */ virtual void Fill(QMenu* parent, QAction* before) = 0; /** * Fills the given tool bar with controls representing this contribution item. * Used by ToolBarManager. * * @param parent the parent tool bar * @param before */ virtual void Fill(QToolBar* parent, QAction* before) = 0; /** * Returns the identifier of this contribution item. * The id is used for retrieving an item from its manager. * * @return the contribution item identifier, or null * if none */ virtual QString GetId() const = 0; /** * Returns whether this contribution item is enabled. * * @return true if this item is enabled */ virtual bool IsEnabled() const = 0; /** * Returns whether this contribution item is dirty. A dirty item will be * recreated when the action bar is updated. * * @return true if this item is dirty */ virtual bool IsDirty() const = 0; /** * Returns whether this contribution item is dynamic. A dynamic contribution * item contributes items conditionally, dependent on some internal state. * * @return true if this item is dynamic, and * false for normal items */ virtual bool IsDynamic() const = 0; /** * Returns whether this contribution item is a group marker. * This information is used when adding items to a group. * * @return true if this item is a group marker, and * false for normal items * * @see GroupMarker * @see IContributionManager#appendToGroup(String, IContributionItem) * @see IContributionManager#prependToGroup(String, IContributionItem) */ virtual bool IsGroupMarker() const = 0; /** * Returns whether this contribution item is a separator. * This information is used to enable hiding of unnecessary separators. * * @return true if this item is a separator, and * false for normal items * @see Separator */ virtual bool IsSeparator() const = 0; /** * Returns whether this contribution item is visibile within its manager. * * @return true if this item is visible, and * false otherwise */ virtual bool IsVisible() const = 0; /** * Saves any state information of the control(s) owned by this contribution item. * The contribution manager calls this method before disposing of the controls. */ virtual void SaveWidgetState() = 0; /** * Sets the parent manager of this item * * @param parent the parent contribution manager */ virtual void SetParent(IContributionManager* parent) = 0; /** * Sets whether this contribution item is visibile within its manager. * * @param visible true if this item should be visible, and * false otherwise */ virtual void SetVisible(bool visible) = 0; /** * Updates any controls cached by this contribution item with any * changes which have been made to this contribution item since the last update. * Called by contribution manager update methods. */ virtual void Update() = 0; /** * Updates any controls cached by this contribution item with changes * for the the given property. * * @param id the id of the changed property */ virtual void Update(const QString& id) = 0; }; } #endif // BERRYICONTRIBUTIONITEM_H diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManager.h b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManager.h index 03ba9702a3..161f67233f 100644 --- a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManager.h +++ b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManager.h @@ -1,212 +1,206 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYICONTRIBUTIONMANAGER_H #define BERRYICONTRIBUTIONMANAGER_H #include #include class QAction; namespace berry { struct IContributionItem; struct IContributionManagerOverrides; /** * A contribution manager organizes contributions to such UI components * as menus, toolbars and status lines. *

* A contribution manager keeps track of a list of contribution * items. Each contribution item may has an optional identifier, which can be used * to retrieve items from a manager, and for positioning items relative to * each other. The list of contribution items can be subdivided into named groups * using special contribution items that serve as group markers. *

*

* The IContributionManager interface provides general * protocol for adding, removing, and retrieving contribution items. * It also provides convenience methods that make it convenient * to contribute actions. This interface should be implemented * by all objects that wish to manage contributions. *

- *

- * There are several implementions of this interface in this package, - * including ones for menus ({@link MenuManager MenuManager}), - * tool bars ({@link ToolBarManager ToolBarManager}), - * and status lines ({@link StatusLineManager StatusLineManager}). - *

*/ struct IContributionManager : public virtual Object { berryObjectMacro(berry::IContributionManager); /** * Adds an action as a contribution item to this manager. * Equivalent to Add(IContributionItem::Pointer(new QActionContributionItem(action, id))). * * @param action the action, this cannot be null * @param id the unique action id */ virtual void Add(QAction* action, const QString& id) = 0; /** * Adds a contribution item to this manager. * * @param item the contribution item, this cannot be null */ virtual void Add(const SmartPointer& item) = 0; /** * Adds a contribution item for the given action at the end of the group * with the given name. * Equivalent to * AppendToGroup(groupName,IContributionItem::Pointer(new QActionContributionItem(action, id))). * * @param groupName the name of the group * @param action the action * @param id the unique action id * @exception ctkInvalidArgumentException if there is no group with * the given name */ virtual void AppendToGroup(const QString& groupName, QAction* action, const QString& id) = 0; /** * Adds a contribution item to this manager at the end of the group * with the given name. * * @param groupName the name of the group * @param item the contribution item * @exception ctkInvalidArgumentException if there is no group with * the given name */ virtual void AppendToGroup(const QString& groupName, const SmartPointer& item) = 0; /** * Finds the contribution item with the given id. * * @param id the contribution item id * @return the contribution item, or null if * no item with the given id can be found */ virtual SmartPointer Find(const QString& id) const = 0; /** * Returns all contribution items known to this manager. * * @return a list of contribution items */ virtual QList > GetItems() const = 0; /** * Returns the overrides for the items of this manager. * * @return the overrides for the items of this manager */ virtual SmartPointer GetOverrides() = 0; /** * Inserts a contribution item after the item with the given id. * * @param id the contribution item id * @param item the contribution item to insert * @exception IllegalArgumentException if there is no item with * the given id */ virtual void InsertAfter(const QString& id, const SmartPointer& item) = 0; /** * Inserts a contribution item before the item with the given id. * * @param id the contribution item id * @param item the contribution item to insert * @exception IllegalArgumentException if there is no item with * the given id */ virtual void InsertBefore(const QString& id, const SmartPointer& item) = 0; /** * Returns whether the list of contributions has recently changed and * has yet to be reflected in the corresponding widgets. * * @return true if this manager is dirty, and false * if it is up-to-date */ virtual bool IsDirty() const = 0; /** * Returns whether this manager has any contribution items. * * @return true if there are no items, and * false otherwise */ virtual bool IsEmpty() const = 0; /** * Marks this contribution manager as dirty. */ virtual void MarkDirty() = 0; /** * Adds a contribution item to this manager at the beginning of the * group with the given name. * * @param groupName the name of the group * @param item the contribution item * @exception IllegalArgumentException if there is no group with * the given name */ virtual void PrependToGroup(const QString& groupName, const SmartPointer& item) = 0; /** * Removes and returns the contribution item with the given id from this manager. * Returns null if this manager has no contribution items * with the given id. * * @param id the contribution item id * @return the item that was found and removed, or null if none */ virtual SmartPointer Remove(const QString& id) = 0; /** * Removes the given contribution item from the contribution items * known to this manager. * * @param item the contribution item * @return the item parameter if the item was removed, * and null if it was not found */ virtual SmartPointer Remove(const SmartPointer& item) = 0; /** * Removes all contribution items from this manager. */ virtual void RemoveAll() = 0; /** * Updates this manager's underlying widget(s) with any changes which * have been made to it or its items. Normally changes to a contribution * manager merely mark it as dirty, without updating the underlying widgets. * This brings the underlying widgets up to date with any changes. * * @param force true means update even if not dirty, * and false for normal incremental updating */ virtual void Update(bool force) = 0; }; } #endif // BERRYICONTRIBUTIONMANAGER_H diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManagerOverrides.h b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManagerOverrides.h index d0d32c8408..8fdb67e9a7 100644 --- a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManagerOverrides.h +++ b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManagerOverrides.h @@ -1,75 +1,72 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYICONTRIBUTIONMANAGEROVERRIDES_H #define BERRYICONTRIBUTIONMANAGEROVERRIDES_H #include #include #include namespace berry { struct IContributionItem; /** * This interface is used by instances of IContributionItem * to determine if the values for certain properties have been overriden * by their manager. *

* This interface is internal to the framework; it should not be implemented outside * the framework. *

- * - * @noimplement This interface is not intended to be implemented by clients. */ struct BERRY_UI_QT IContributionManagerOverrides : virtual Object { berryObjectMacro(berry::IContributionManagerOverrides); /** * Id for the enabled property. Value is "enabled". */ static const QString P_ENABLED; /** * Find out the enablement of the item * @param item the contribution item for which the enable override value is * determined - * @param defaultValue the default value * @return
    *
  • 1 if the given contribution item should be enabled
  • *
  • 0 if the item should not be enabled
  • *
  • -1 if the item may determine its own enablement
  • *
*/ virtual int GetEnabled(const IContributionItem* item) const = 0; /** * Visiblity override. * * @param item the contribution item in question * @return
    *
  • 1 if the given contribution item should be visible
  • *
  • 0 if the item should not be visible
  • *
  • -1 if the item may determine its own visibility
  • *
*/ virtual int GetVisible(const IContributionItem* item) const = 0; }; } #endif // BERRYICONTRIBUTIONMANAGEROVERRIDES_H diff --git a/Plugins/org.blueberry.ui.qt/src/application/berryIActionBarConfigurer.h b/Plugins/org.blueberry.ui.qt/src/application/berryIActionBarConfigurer.h index 0a234640ce..ff05d24915 100644 --- a/Plugins/org.blueberry.ui.qt/src/application/berryIActionBarConfigurer.h +++ b/Plugins/org.blueberry.ui.qt/src/application/berryIActionBarConfigurer.h @@ -1,102 +1,101 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIACTIONBARCONFIGURER_H_ #define BERRYIACTIONBARCONFIGURER_H_ #include #include namespace berry { struct IWorkbenchWindowConfigurer; struct IMenuManager; struct IToolBarManager; /** * Interface providing special access for configuring the action bars * of a workbench window. *

* Note that these objects are only available to the main application * (the plug-in that creates and owns the workbench). *

*

* This interface is not intended to be implemented by clients. *

* * @see org.blueberry.ui.application.WorkbenchAdvisor#fillActionBars - * @noimplement This interface is not intended to be implemented by clients. */ struct BERRY_UI_QT IActionBarConfigurer : public Object { berryObjectMacro(berry::IActionBarConfigurer); ~IActionBarConfigurer() override; /** * Returns the workbench window configurer for the window * containing this configurer's action bars. * * @return the workbench window configurer */ virtual SmartPointer GetWindowConfigurer() = 0; /** * Creates a menu manager for the main menu bar of a workbench window. The * action bar advisor should use this factory method rather than creating a * MenuManager directly. * * @return the menu manager */ virtual IMenuManager* GetMenuManager() = 0; /** * Creates a tool bar manager for the workbench window's tool bar. The * action bar advisor should use this factory method rather than creating a * ToolBarManager directly. * * @return the tool bar manager */ virtual IToolBarManager* GetToolBarManager() = 0; /* * Returns the status line manager of a workbench window. * * @return the status line manager */ //virtual IStatusLineManager GetStatusLineManager() = 0; /* * Register the action as a global action with a workbench * window. *

* For a workbench retarget action * ({@link org.blueberry.ui.actions.RetargetAction RetargetAction}) * to work, it must be registered. * You should also register actions that will participate * in custom key bindings. *

* * @param action the global action * @see org.blueberry.ui.actions.RetargetAction */ //virtual void RegisterGlobalAction(IAction action) = 0; }; } #endif /*BERRYIACTIONBARCONFIGURER_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/berryAbstractUICTKPlugin.h b/Plugins/org.blueberry.ui.qt/src/berryAbstractUICTKPlugin.h index e619d2af76..1c2582ff86 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryAbstractUICTKPlugin.h +++ b/Plugins/org.blueberry.ui.qt/src/berryAbstractUICTKPlugin.h @@ -1,290 +1,194 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYABSTRACTUICTKPLUGIN_H_ #define BERRYABSTRACTUICTKPLUGIN_H_ #include #include namespace berry { template class SmartPointer; struct IPreferences; struct IPreferencesService; struct IWorkbench; /** * \ingroup org_blueberry_ui_qt * * Abstract base class for plug-ins that integrate with the BlueBerry platform UI. *

* Subclasses obtain the following capabilities: *

*

* Preferences *

    *
  • The platform core runtime contains general support for plug-in * preferences (org.blueberry.core.runtime.Preferences). * This class provides appropriate conversion to the older JFace preference * API (org.blueberry.jface.preference.IPreferenceStore).
  • *
  • The method getPreferenceStore returns the JFace preference * store (cf. Plugin.getPluginPreferences which returns * a core runtime preferences object.
  • *
  • Subclasses may reimplement initializeDefaultPreferences * to set up any default values for preferences using JFace API. In this * case, initializeDefaultPluginPreferences should not be * overridden.
  • *
  • Subclasses may reimplement * initializeDefaultPluginPreferences to set up any default * values for preferences using core runtime API. In this * case, initializeDefaultPreferences should not be * overridden.
  • *
  • Preferences are also saved automatically on plug-in shutdown. * However, saving preferences immediately after changing them is * strongly recommended, since that ensures that preference settings * are not lost even in the event of a platform crash.
  • *
* Dialogs *
    *
  • The dialog store is read the first time getDialogSettings * is called.
  • *
  • The dialog store allows the plug-in to "record" important choices made * by the user in a wizard or dialog, so that the next time the * wizard/dialog is used the widgets can be defaulted to better values. A * wizard could also use it to record the last 5 values a user entered into * an editable combo - to show "recent values".
  • *
  • The dialog store is found in the file whose name is given by the * constant FN_DIALOG_STORE. A dialog store file is first * looked for in the plug-in's read/write state area; if not found there, * the plug-in's install directory is checked. * This allows a plug-in to ship with a read-only copy of a dialog store * file containing initial values for certain settings.
  • *
  • Plug-in code can call saveDialogSettings to cause settings to * be saved in the plug-in's read/write state area. A plug-in may opt to do * this each time a wizard or dialog is closed to ensure the latest * information is always safe on disk.
  • *
  • Dialog settings are also saved automatically on plug-in shutdown.
  • *
*

* For easy access to your plug-in object, use the singleton pattern. Declare a * static variable in your plug-in class for the singleton. Store the first * (and only) instance of the plug-in class in the singleton when it is created. * Then access the singleton when needed through a static getDefault * method. *

*

* See the description on {@link Plugin}. *

*/ class BERRY_UI_QT AbstractUICTKPlugin : public Plugin { Q_OBJECT private: /** * The name of the dialog settings file (value * "dialog_settings.xml"). */ static const QString FN_DIALOG_SETTINGS; - /** - * Storage for dialog and wizard data; null if not yet - * initialized. - */ - //DialogSettings dialogSettings = null; - /** * Storage for preferences. */ mutable IPreferencesService* preferencesService; - /** - * The bundle listener used for kicking off refreshPluginActions(). - */ - //BundleListener bundleListener; - public: /** * Creates an abstract UI plug-in runtime object. *

* Plug-in runtime classes are ctkPluginActivators and so must * have an default constructor. This method is called by the runtime when * the associated bundle is being activated. */ AbstractUICTKPlugin(); - /** - * Returns the dialog settings for this UI plug-in. - * The dialog settings is used to hold persistent state data for the various - * wizards and dialogs of this plug-in in the context of a workbench. - *

- * If an error occurs reading the dialog store, an empty one is quietly created - * and returned. - *

- *

- * Subclasses may override this method but are not expected to. - *

- * - * @return the dialog settings - */ -// IDialogSettings getDialogSettings(); - /** * Returns the preferences service for this UI plug-in. * This preferences service is used to hold persistent settings for this plug-in in * the context of a workbench. Some of these settings will be user controlled, * whereas others may be internal setting that are never exposed to the user. *

* If an error occurs reading the preferences service, an empty preference service is * quietly created, initialized with defaults, and returned. *

* * @return the preferences service */ IPreferencesService* GetPreferencesService() const; SmartPointer GetPreferences() const; /** * Returns the Platform UI workbench. *

* This method exists as a convenience for plugin implementors. The * workbench can also be accessed by invoking PlatformUI.getWorkbench(). *

* @return IWorkbench the workbench for this plug-in */ IWorkbench* GetWorkbench(); - -protected: - - /** - * Returns a new image registry for this plugin-in. The registry will be - * used to manage images which are frequently used by the plugin-in. - *

- * The default implementation of this method creates an empty registry. - * Subclasses may override this method if needed. - *

- * - * @return ImageRegistry the resulting registry. - * @see #getImageRegistry - */ -// ImageRegistry createImageRegistry(); - - /** - * Initializes an image registry with images which are frequently used by the - * plugin. - *

- * The image registry contains the images used by this plug-in that are very - * frequently used and so need to be globally shared within the plug-in. Since - * many OSs have a severe limit on the number of images that can be in memory - * at any given time, each plug-in should only keep a small number of images in - * its registry. - *

- * Implementors should create a JFace image descriptor for each frequently used - * image. The descriptors describe how to create/find the image should it be needed. - * The image described by the descriptor is not actually allocated until someone - * retrieves it. - *

- * Subclasses may override this method to fill the image registry. - *

- * @param reg the registry to initalize - * - * @see #getImageRegistry - */ -// void initializeImageRegistry(ImageRegistry reg); - - /** - * Loads the dialog settings for this plug-in. - * The default implementation first looks for a standard named file in the - * plug-in's read/write state area; if no such file exists, the plug-in's - * install directory is checked to see if one was installed with some default - * settings; if no file is found in either place, a new empty dialog settings - * is created. If a problem occurs, an empty settings is silently used. - *

- * This framework method may be overridden, although this is typically - * unnecessary. - *

- */ -// void loadDialogSettings(); - - - /** - * Refreshes the actions for the plugin. - * This method is called from startup. - *

- * This framework method may be overridden, although this is typically - * unnecessary. - *

- */ -// void refreshPluginActions(); - - /** - * Saves this plug-in's dialog settings. - * Any problems which arise are silently ignored. - */ -// void saveDialogSettings(); - - public: /** * The AbstractUIPlugin implementation of this Plugin * method refreshes the plug-in actions. Subclasses may extend this method, * but must send super first. + * + * \param context */ void start(ctkPluginContext* context) override; /** * The AbstractUIPlugin implementation of this Plugin * method saves this plug-in's preference and dialog stores and shuts down * its image registry (if they are in use). Subclasses may extend this * method, but must send super last. A try-finally statement should * be used where necessary to ensure that super.shutdown() is * always done. */ void stop(ctkPluginContext* context) override; /** * Creates and returns a new image descriptor for an image file located * within the specified plug-in. *

* This is a convenience method that simply locates the image file in * within the plug-in (no image registries are involved). The path is * relative to the root of the plug-in, and takes into account files * coming from plug-in fragments. The path may include $arg$ elements. * However, the path must not have a leading "." or path separator. * Clients should use a path like "icons/mysample.gif" rather than * "./icons/mysample.gif" or "/icons/mysample.gif". *

* * @param pluginId the id of the plug-in containing the image file; * null is returned if the plug-in does not exist * @param imageFilePath the relative path of the image file, relative to the * root of the plug-in; the path must be legal * @return an image descriptor, or null if no image * could be found */ static QIcon ImageDescriptorFromPlugin( const QString& pluginId, const QString& imageFilePath); static QIcon GetMissingIcon(); }; } // namespace berry #endif /*BERRYABSTRACTUICTKPLUGIN_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/berryEditorPart.h b/Plugins/org.blueberry.ui.qt/src/berryEditorPart.h index b2a72fb275..1d25e52058 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryEditorPart.h +++ b/Plugins/org.blueberry.ui.qt/src/berryEditorPart.h @@ -1,246 +1,245 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYEDITORPART_H_ #define BERRYEDITORPART_H_ #include #include "berryIEditorPart.h" #include "berryIEditorInput.h" #include "berryIEditorSite.h" #include "berryWorkbenchPart.h" namespace berry { /** * \ingroup org_blueberry_ui_qt * * Abstract base implementation of all workbench editors. *

* This class should be subclassed by clients wishing to define new editors. * The name of the subclass should be given as the "class" * attribute in a editor extension contributed to the workbench's * editor extension point (named "org.mitk.ui.editors"). * For example, the plug-in's XML markup might contain: - *

- * <extension point="org.blueberry.ui.editors">
- *      <editor id="com.example.myplugin.ed"
- *         name="My Editor"
- *         icon="./images/cedit.gif"
- *       extensions="foo"
- *       class="com.example.myplugin.MyFooEditor"
- *       contributorClass="com.example.myplugin.MyFooEditorContributor"
- *      />
- * </extension>
- * 
+ * \code{.unparsed} + * + * + * + * \endcode * where com.example.myplugin.MyEditor is the name of the * EditorPart subclass. *

*

* Subclasses must implement the following methods: *

    *
  • IEditorPart.init - to initialize editor when assigned its site
  • *
  • IWorkbenchPart.createPartControl - to create the editor's controls
  • *
  • IWorkbenchPart.setFocus - to accept focus
  • *
  • IEditorPart.isDirty - to decide whether a significant change has * occurred
  • *
  • IEditorPart.doSave - to save contents of editor
  • *
  • IEditorPart.doSaveAs - to save contents of editor
  • *
  • IEditorPart.isSaveAsAllowed - to control Save As
  • *
*

*

* Subclasses may extend or reimplement the following methods as required: *

    *
  • IExecutableExtension.setInitializationData - extend to provide additional * initialization when editor extension is instantiated
  • *
  • IWorkbenchPart.dispose - extend to provide additional cleanup
  • *
  • IAdaptable.getAdapter - reimplement to make the editor * adaptable
  • *
*

*/ class BERRY_UI_QT EditorPart : public WorkbenchPart , public virtual IEditorPart { Q_OBJECT Q_INTERFACES(berry::IEditorPart) public: berryObjectMacro(EditorPart, WorkbenchPart, IEditorPart); private: /** * Editor input, or null if none. */ IEditorInput::Pointer editorInput; protected: /** * Creates a new workbench editor. */ EditorPart(); /** * Sets the input to this editor. This method simply updates the internal * member variable. * *

Unlike most of the other set methods on this class, this method does * not fire a property change. Clients that call this method from a subclass * must ensure that they fire an IWorkbenchPartConstants.PROP_INPUT property * change after calling this method but before leaving whatever public method * they are in. Clients that expose this method as public API must fire * the property change within their implementation of setInput.

* *

Note that firing a property change may cause listeners to immediately * reach back and call methods on this editor. Care should be taken not to * fire the property change until the editor has fully updated its internal * state to reflect the new input.

* * @param input the editor input * - * @see #setInputWithNotify(IEditorInput) + * @see #SetInputWithNotify */ virtual void SetInput(IEditorInput::Pointer input) ; /** * Sets the input to this editor and fires a PROP_INPUT property change if * the input has changed. This is the convenience method implementation. * *

Note that firing a property change may cause other objects to reach back * and invoke methods on the editor. Care should be taken not to call this method * until the editor has fully updated its internal state to reflect the * new input.

* * @since 3.2 * * @param input the editor input */ virtual void SetInputWithNotify(IEditorInput::Pointer input); /* (non-Javadoc) * @see org.blueberry.ui.part.WorkbenchPart#setContentDescription(java.lang.String) */ void SetContentDescription(const QString& description) override; /* (non-Javadoc) * @see org.blueberry.ui.part.WorkbenchPart#setPartName(java.lang.String) */ void SetPartName(const QString& partName) override; /** * Checks that the given site is valid for this type of part. * The site for an editor must be an IEditorSite. * * @param site the site to check * @since 3.1 */ void CheckSite(IWorkbenchPartSite::Pointer site) override; public: /* (non-Javadoc) * Saves the contents of this editor. *

* Subclasses must override this method to implement the open-save-close lifecycle * for an editor. For greater details, see IEditorPart *

* * @see IEditorPart */ void DoSave(/*IProgressMonitor monitor*/) override = 0; /* (non-Javadoc) * Saves the contents of this editor to another object. *

* Subclasses must override this method to implement the open-save-close lifecycle * for an editor. For greater details, see IEditorPart *

* * @see IEditorPart */ void DoSaveAs() override = 0; /* (non-Javadoc) * Method declared on IEditorPart. */ IEditorInput::Pointer GetEditorInput() const override; /* (non-Javadoc) * Method declared on IEditorPart. */ IEditorSite::Pointer GetEditorSite() const override; /* (non-Javadoc) * Gets the title tool tip text of this part. * * @return the tool tip text */ QString GetTitleToolTip() const override; /* (non-Javadoc) * Initializes the editor part with a site and input. *

* Subclasses of EditorPart must implement this method. Within * the implementation subclasses should verify that the input type is acceptable * and then save the site and input. Here is sample code: *

*
      *    if (!(input instanceof IFileEditorInput))
      *      throw new PartInitException("Invalid Input: Must be IFileEditorInput");
      *    setSite(site);
      *    setInput(input);
      * 
*/ void Init(IEditorSite::Pointer site, IEditorInput::Pointer input) override = 0; /* (non-Javadoc) * Returns whether the contents of this editor have changed since the last save * operation. *

* Subclasses must override this method to implement the open-save-close lifecycle * for an editor. For greater details, see IEditorPart *

* * @see IEditorPart */ bool IsDirty() const override = 0; /* (non-Javadoc) * Returns whether the "save as" operation is supported by this editor. *

* Subclasses must override this method to implement the open-save-close lifecycle * for an editor. For greater details, see IEditorPart *

* * @see IEditorPart */ bool IsSaveAsAllowed() const override = 0; /* (non-Javadoc) * Returns whether the contents of this editor should be saved when the editor * is closed. *

* This method returns true if and only if the editor is dirty * (isDirty). *

*/ bool IsSaveOnCloseNeeded() const override; }; } #endif /*BERRYEDITORPART_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/berryGeometry.h b/Plugins/org.blueberry.ui.qt/src/berryGeometry.h index 7be28d65d2..d80c46d8a8 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryGeometry.h +++ b/Plugins/org.blueberry.ui.qt/src/berryGeometry.h @@ -1,162 +1,162 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYGEOMETRY_H_ #define BERRYGEOMETRY_H_ #include class QRect; class QPoint; class QWidget; namespace berry { struct BERRY_UI_QT Geometry { /** * Returns the height or width of the given rectangle. * * @param toMeasure rectangle to measure * @param width returns the width if true, and the height if false * @return the width or height of the given rectangle * @since 3.0 */ static int GetDimension(const QRect& toMeasure, bool width); /** * Returns true iff the given side constant corresponds to a horizontal side * of a rectangle. That is, returns true for the top and bottom but false for the * left and right. * - * @param swtSideConstant one of Constants::TOP, Constants::BOTTOM, Constants::LEFT, or Constants::RIGHT + * @param berrySideConstant one of Constants::TOP, Constants::BOTTOM, Constants::LEFT, or Constants::RIGHT * @return true iff the given side is horizontal. * @since 3.0 */ static bool IsHorizontal(int berrySideConstant); /** * Extrudes the given edge inward by the given distance. That is, if one side of the rectangle * was sliced off with a given thickness, this returns the rectangle that forms the slice. Note * that the returned rectangle will be inside the given rectangle if size > 0. * * @param toExtrude the rectangle to extrude. The resulting rectangle will share three sides * with this rectangle. * @param size distance to extrude. A negative size will extrude outwards (that is, the resulting * rectangle will overlap the original iff this is positive). * @param orientation the side to extrude. One of Constants::LEFT, Constants::RIGHT, Constants::TOP, or Constants::BOTTOM. The * resulting rectangle will always share this side with the original rectangle. * @return a rectangle formed by extruding the given side of the rectangle by the given distance. */ static QRect GetExtrudedEdge(const QRect& toExtrude, int size, int orientation); /** * Normalizes the given rectangle. That is, any rectangle with * negative width or height becomes a rectangle with positive * width or height that extends to the upper-left of the original * rectangle. * * @param rect rectangle to modify */ static void Normalize(QRect& rect); /** * Returns the edge of the given rectangle is closest to the given * point. * * @param boundary rectangle to test * @param toTest point to compare * @return one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM * * @since 3.0 */ static int GetClosestSide(const QRect& boundary, const QPoint& toTest); /** * Returns the distance of the given point from a particular side of the given rectangle. * Returns negative values for points outside the rectangle. * * @param rectangle a bounding rectangle * @param testPoint a point to test * @param edgeOfInterest side of the rectangle to test against * @return the distance of the given point from the given edge of the rectangle * @since 3.0 */ static int GetDistanceFromEdge(const QRect& rectangle, const QPoint& testPoint, int edgeOfInterest); /** * Returns the opposite of the given direction. That is, returns SWT.LEFT if * given SWT.RIGHT and visa-versa. * - * @param swtDirectionConstant one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM + * @param directionConstant one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM * @return one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM * @since 3.0 */ static int GetOppositeSide(int directionConstant); /** * Converts the given rectangle from display coordinates to the local coordinate system * of the given object * * @param coordinateSystem local coordinate system (widget) being converted to * @param toConvert rectangle to convert * @return a rectangle in control coordinates * @since 3.0 */ static QRect ToControl(QWidget* coordinateSystem, const QRect& toConvert); /** * Converts the given point from display coordinates to the local coordinate system * of the given object * * @param coordinateSystem local coordinate system (widget) being converted to * @param toConvert point to convert * @return a point in control coordinates * @since 3.0 */ static QPoint ToControl(QWidget* coordinateSystem, const QPoint& toConvert); /** * Converts the given rectangle from the local coordinate system of the given object * into display coordinates. * * @param coordinateSystem local coordinate system (widget) being converted from * @param toConvert rectangle to convert * @return a rectangle in display coordinates * @since 3.0 */ static QRect ToDisplay(QWidget* coordinateSystem, const QRect& toConvert); /** * Converts the given point from the local coordinate system of the given object * into display coordinates. * * @param coordinateSystem local coordinate system (widget) being converted from * @param toConvert point to convert * @return a point in display coordinates * @since 3.0 */ static QPoint ToDisplay(QWidget* coordinateSystem, const QPoint& toConvert); }; } #endif /* BERRYGEOMETRY_H_ */ diff --git a/Plugins/org.blueberry.ui.qt/src/berryIActionBars.h b/Plugins/org.blueberry.ui.qt/src/berryIActionBars.h index 0e1dc6c8e4..4c79df5e4a 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIActionBars.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIActionBars.h @@ -1,108 +1,107 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIACTIONBARS_H #define BERRYIACTIONBARS_H #include namespace berry { struct IServiceLocator; struct IMenuManager; struct IStatusLineManager; struct IToolBarManager; class Action; /** * Used by a part to access its menu, toolbar, and status line managers. *

* Within the workbench each part, editor or view, has a private set of action * bars. This set, which contains a menu, toolbar, and status line, appears * in the local toolbar for a view and in the window for an editor. The view * may provide an implementation for pre-existing actions or add new actions to * the action bars. *

* A part may also contribute new actions to the action bars as required. To do * this, call GetMenuManager, GetToolBarManager, or * GetStatusLineManager as appropriate to get the action target. * Add the action(s) to the target and call update to commit * any changes to the underlying widgets. *

* This interface is not intended to be implemented by clients. *

- * @noimplement This interface is not intended to be implemented by clients. */ struct IActionBars : public Object { berryObjectMacro(berry::IActionBars); /** * Returns the menu manager. *

* Note: Clients who add or remove items from the returned menu manager are * responsible for calling updateActionBars so that the changes * can be propagated throughout the workbench. *

* * @return the menu manager */ virtual IMenuManager* GetMenuManager() = 0; /** * Returns the service locator for these action bars. The locator is found * by looking locally, and then ascending the action bar hierarchy. * * @return The service locator; never null. */ virtual IServiceLocator* GetServiceLocator() = 0; /** * Returns the status line manager. *

* Note: Clients who add or remove items from the returned status line * manager are responsible for calling updateActionBars so * that the changes can be propagated throughout the workbench. *

* * @return the status line manager */ virtual IStatusLineManager* GetStatusLineManager() = 0; /** * Returns the tool bar manager. *

* Note: Clients who add or remove items from the returned tool bar manager are * responsible for calling updateActionBars so that the changes * can be propagated throughout the workbench. *

* * @return the tool bar manager */ virtual IToolBarManager* GetToolBarManager() = 0; /** * Updates the action bars. *

* Clients who add or remove items from the menu, tool bar, or status line * managers, or that update global action handlers, should call this method * to propagated the changes throughout the workbench. *

*/ virtual void UpdateActionBars() = 0; }; } #endif // BERRYIACTIONBARS_H diff --git a/Plugins/org.blueberry.ui.qt/src/berryIContextService.h b/Plugins/org.blueberry.ui.qt/src/berryIContextService.h index eefd65c018..febb4813e4 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIContextService.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIContextService.h @@ -1,378 +1,378 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYICONTEXTSERVICE_H #define BERRYICONTEXTSERVICE_H #include "berryIServiceWithSources.h" namespace berry { struct IContextActivation; struct IContextManagerListener; class Context; class Expression; class Shell; /** *

* Provides services related to contexts in the blueberry workbench. This provides * access to contexts. *

*

* This service can be acquired from your service locator: *

  *   IContextService service = (IContextService) getSite().getService(IContextService.class);
  * 
*
    *
  • This service is available globally.
  • *
*

* - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. + * @note This interface is not intended to be extended by clients. + * @note This interface is not intended to be implemented by clients. */ struct IContextService : public IServiceWithSources { /** * The identifier for the context that is active when a workbench is active. */ static const QString CONTEXT_ID_WORKBENCH_MENU; // = "org.blueberry.ui.contexts.workbenchMenu"; /** * The identifier for the context that is active when a shell registered as * a dialog. */ static const QString CONTEXT_ID_DIALOG; // = "org.blueberry.ui.contexts.dialog"; /** * The identifier for the context that is active when a shell is registered * as either a window or a dialog. */ static const QString CONTEXT_ID_DIALOG_AND_WINDOW; // = "org.blueberry.ui.contexts.dialogAndWindow"; /** * The identifier for the context that is active when a shell is registered * as a window. */ static const QString CONTEXT_ID_WINDOW; // = "org.blueberry.ui.contexts.window"; enum ShellType { /** * The type used for registration indicating that the shell should be * treated as a dialog. When the given shell is active, the "In Dialogs" * context should also be active. */ TYPE_DIALOG = 0, /** * The type used for registration indicating that the shell should not * receive any key bindings be default. When the given shell is active, we * should not provide any EnabledSubmission instances for the * "In Dialogs" or "In Windows" contexts. * */ TYPE_NONE = 1, /** * The type used for registration indicating that the shell should be * treated as a window. When the given shell is active, the "In Windows" * context should also be active. */ TYPE_WINDOW = 2 }; /** *

* Activates the given context within the context of this service. If this * service was retrieved from the workbench, then this context will be * active globally. If the service was retrieved from a nested component, * then the context will only be active within that component. *

*

* Also, it is guaranteed that the contexts submitted through a particular * service will be cleaned up when that services is destroyed. So, for * example, a service retrieved from a IWorkbenchPartSite * would deactivate all of its contexts when the site is destroyed. *

* * @param contextId * The identifier for the context which should be activated; must * not be null. * @return A token which can be used to later cancel the activation. Only * someone with access to this token can cancel the activation. The * activation will automatically be cancelled if the context from * which this service was retrieved is destroyed. */ virtual SmartPointer ActivateContext(const QString& contextId) = 0; /** *

* Activates the given context within the context of this service. The * context becomes active when expression evaluates to * true. This is the same as calling - * {@link #activateContext(String, Expression, boolean)} with global==false. + * {@link #ActivateContext} with global==false. *

*

* Also, it is guaranteed that the context submitted through a particular * service will be cleaned up when that services is destroyed. So, for * example, a service retrieved from a IWorkbenchPartSite * would deactivate all of its handlers when the site is destroyed. *

* * @param contextId * The identifier for the context which should be activated; must * not be null. * @param expression * This expression must evaluate to true before * this context will really become active. The expression may be * null if the context should always be active. * @return A token which can be used to later cancel the activation. Only * someone with access to this token can cancel the activation. The * activation will automatically be cancelled if the context from * which this service was retrieved is destroyed. * * @see ISources */ virtual SmartPointer ActivateContext(const QString& contextId, const SmartPointer& expression) = 0; /** *

* Activates the given context within the context of this service. The * context becomes active when expression evaluates to * true. If global==false then this service * must also be the active service to activate the context. *

*

* Also, it is guaranteed that the context submitted through a particular * service will be cleaned up when that services is destroyed. So, for * example, a service retrieved from a IWorkbenchPartSite * would deactivate all of its handlers when the site is destroyed. *

* * @param contextId * The identifier for the context which should be activated; must * not be null. * @param expression * This expression must evaluate to true before * this context will really become active. The expression may be * null if the context should always be active. * @param global * Indicates that the handler should be activated irrespectively * of whether the corresponding workbench component (e.g., * window, part, etc.) is active. * @return A token which can be used to later cancel the activation. Only * someone with access to this token can cancel the activation. The * activation will automatically be cancelled if the context from * which this service was retrieved is destroyed. * * @see ISources */ virtual SmartPointer ActivateContext(const QString& contextId, const SmartPointer& expression, bool global) = 0; /** * Adds a listener to this context service. The listener will be notified * when the set of defined contexts changes. This can be used to track the * global appearance and disappearance of contexts. *

* Note: listeners should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. *

* * @param listener * The listener to attach; must not be null. * @see RemoveContextManagerListener(IContextManagerListener*) */ virtual void AddContextManagerListener(IContextManagerListener* listener) = 0; /** * Deactivates the given context within the context of this service. If the * handler was context with a different service, then it must be deactivated * from that service instead. It is only possible to retract a context * activation with this method. That is, you must have the same * IContextActivation used to activate the context. * * @param activation * The token that was returned from a call to * activateContext; must not be null. */ virtual void DeactivateContext(const SmartPointer& activation) = 0; /** * Deactivates the given contexts within the context of this service. If the * contexts were activated with a different service, then they must be * deactivated from that service instead. It is only possible to retract * context activations with this method. That is, you must have the same * IContextActivation instances used to activate the * contexts. * * @param activations * The tokens that were returned from a call to * activateContext. This collection must only * contain instances of IContextActivation. The * collection must not be null. */ virtual void DeactivateContexts(const QList >& activations) = 0; /** * Returns the set of active context identifiers. * * @return The set of active context identifiers; this value may be * null if no active contexts have been set yet. If * the set is not null, then it contains only * instances of String. */ virtual QList GetActiveContextIds() const = 0; /** * Retrieves the context with the given identifier. If no such context * exists, then an undefined context with the given id is created. * * @param contextId * The identifier to find; must not be null. * @return A context with the given identifier, either defined or undefined. */ virtual SmartPointer GetContext(const QString& contextId) const = 0; /** * Returns the collection of all of the defined contexts in the workbench. * * @return The collection of contexts (Context) that are * defined; never null, but may be empty. */ virtual QList > GetDefinedContexts() const = 0; /** * Returns the collection of the identifiers for all of the defined contexts * in the workbench. * * @return The collection of context identifiers (String) * that are defined; never null, but may be empty. */ virtual QList GetDefinedContextIds() const = 0; /** * Returns the shell type for the given shell. * * @param shell * The shell for which the type should be determined. If this * value is null, then * IContextService.TYPE_NONE is returned. * @return IContextService.TYPE_WINDOW, * IContextService.TYPE_DIALOG, or * IContextService.TYPE_NONE. */ virtual ShellType GetShellType(const SmartPointer& shell) const = 0; virtual ShellType GetShellType(QWidget* widget) const = 0; /** *

* Reads the context information from the registry and the preferences. This * will overwrite any of the existing information in the context service. * This method is intended to be called during start-up. When this method * completes, this context service will reflect the current state of the * registry and preference store. *

*/ virtual void ReadRegistry() = 0; /** *

* Registers a shell to automatically promote or demote some basic types of * contexts. The "In Dialogs" and "In Windows" contexts are provided by the * system. This a convenience method to ensure that these contexts are * promoted when the given is shell is active. *

*

* If a shell is registered as a window, then the "In Windows" context is * enabled when that shell is active. If a shell is registered as a dialog -- * or is not registered, but has a parent shell -- then the "In Dialogs" * context is enabled when that shell is active. If the shell is registered * as none -- or is not registered, but has no parent shell -- then the * neither of the contexts will be enabled (by us -- someone else can always * enabled them). *

*

* If the provided shell has already been registered, then this method will * change the registration. *

* * @param shell * The shell to register for key bindings; must not be * null. * @param type * The type of shell being registered. This value must be one of * the constants given in this interface. * * @return true if the shell had already been registered * (i.e., the registration has changed); false * otherwise. */ virtual bool RegisterShell(const SmartPointer& shell, ShellType type) = 0; /** * Removes a listener from this context service. * * @param listener * The listener to be removed; must not be null. */ virtual void RemoveContextManagerListener(IContextManagerListener* listener) = 0; /** *

* Unregisters a shell that was previously registered. After this method * completes, the shell will be treated as if it had never been registered * at all. If you have registered a shell, you should ensure that this * method is called when the shell is disposed. Otherwise, a potential * memory leak will exist. *

*

* If the shell was never registered, or if the shell is null, * then this method returns false and does nothing. * * @param shell * The shell to be unregistered; does nothing if this value is * null. * * @return true if the shell had been registered; * false otherwise. */ virtual bool UnregisterShell(const SmartPointer& shell) = 0; /** * Informs the service that a batch operation has started. *

* Note: You must insure that if you call * deferUpdates(true) that nothing in your batched operation * will prevent the matching call to deferUpdates(false). *

* * @param defer * true when starting a batch operation false when ending the * operation */ virtual void DeferUpdates(bool defer) = 0; }; } Q_DECLARE_INTERFACE(berry::IContextService, "org.blueberry.ui.IContextService") #endif // BERRYICONTEXTSERVICE_H diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorDescriptor.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorDescriptor.h index 30636db656..80f027d2b1 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIEditorDescriptor.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorDescriptor.h @@ -1,119 +1,118 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEDITORDESCRIPTOR_H_ #define BERRYIEDITORDESCRIPTOR_H_ #include #include "berryIWorkbenchPartDescriptor.h" #include "berryIEditorMatchingStrategy.h" namespace berry { /** * \ingroup org_blueberry_ui_qt * * Description of an editor in the workbench editor registry. The * editor descriptor contains the information needed to create editor instances. *

* An editor descriptor typically represents one of three types of editors: *

    *
  • a file editor extension for a specific file extension.
  • *
  • a file editor added by the user (via the workbench preference page)
  • *
  • a general editor extension which works on objects other than files.
  • *
*

*

* This interface is not intended to be implemented or extended by clients. *

* * @see IEditorRegistry - * @noimplement This interface is not intended to be implemented by clients. */ struct BERRY_UI_QT IEditorDescriptor : public IWorkbenchPartDescriptor { berryObjectMacro(berry::IEditorDescriptor); ~IEditorDescriptor() override; /** * Returns the editor id. *

* For internal editors, this is the extension id as defined in the workbench * registry; for external editors, it is path and file name of the external * program. *

* * @return the id of the editor */ QString GetId() const override = 0; /** * Returns the descriptor of the image for this editor. * * @return the descriptor of the image to display next to this editor */ //ImageDescriptor getImageDescriptor() = 0; /** * Returns the label to show for this editor. * * @return the editor label */ QString GetLabel() const override = 0; /** * Returns whether this editor descriptor will open a regular editor * part inside the editor area. * * @return true if editor is inside editor area, and * false otherwise * @since 3.0 */ virtual bool IsInternal() const = 0; /** * Returns whether this editor descriptor will open an external * editor in-place inside the editor area. * * @return true if editor is in-place, and false * otherwise * @since 3.0 */ virtual bool IsOpenInPlace() const = 0; /** * Returns whether this editor descriptor will open an external editor * in a new window outside the workbench. * * @return true if editor is external, and false * otherwise * @since 3.0 */ virtual bool IsOpenExternal() const = 0; /** * Returns the editor matching strategy object for editors * represented by this editor descriptor, or null * if there is no explicit matching strategy specified. * * @return the editor matching strategy, or null if none * @since 3.1 */ virtual IEditorMatchingStrategy::Pointer GetEditorMatchingStrategy() = 0; }; } #endif /*BERRYIEDITORDESCRIPTOR_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorMatchingStrategy.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorMatchingStrategy.h index 3e763cf436..01403f4075 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIEditorMatchingStrategy.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorMatchingStrategy.h @@ -1,61 +1,61 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEDITORMATCHINGSTRATEGY_H_ #define BERRYIEDITORMATCHINGSTRATEGY_H_ #include #include "berryIEditorReference.h" #include "berryIEditorInput.h" namespace berry { /** * \ingroup org_blueberry_ui_qt * * An editor matching strategy allows editor extensions to provide their own * algorithm for matching the input of an open editor of that type to a * given editor input. This is used to find a matching editor during - * {@link org.blueberry.ui.IWorkbenchPage#openEditor(IEditorInput, String, boolean)} and - * {@link org.blueberry.ui.IWorkbenchPage#findEditor(IEditorInput)}. + * {@link IWorkbenchPage#OpenEditor} and + * {@link IWorkbenchPage#FindEditor}. */ struct BERRY_UI_QT IEditorMatchingStrategy : public Object { berryObjectMacro(berry::IEditorMatchingStrategy); ~IEditorMatchingStrategy() override; /** * Returns whether the editor represented by the given editor reference * matches the given editor input. *

* Implementations should inspect the given editor input first, * and try to reject it early before calling IEditorReference.getEditorInput(), * since that method may be expensive. *

* * @param editorRef the editor reference to match against * @param input the editor input to match * @return true if the editor matches the given editor input, * false if it does not match */ virtual bool Matches(IEditorReference::Pointer editorRef, IEditorInput::Pointer input) = 0; }; } Q_DECLARE_INTERFACE(berry::IEditorMatchingStrategy, "org.blueberry.ui.IEditorMatchingStrategy") #endif /*BERRYIEDITORMATCHINGSTRATEGY_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorPart.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorPart.h index 1a99febfc8..5b5fa78333 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIEditorPart.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorPart.h @@ -1,127 +1,125 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEDITORPART_H_ #define BERRYIEDITORPART_H_ #include "berryIWorkbenchPart.h" #include "berryISaveablePart.h" #include namespace berry { struct IEditorInput; struct IEditorSite; /** * \ingroup org_blueberry_ui_qt * * An editor is a visual component within a workbench page. It is * typically used to edit or browse a document or input object. The input * is identified using an IEditorInput. Modifications made * in an editor part follow an open-save-close lifecycle model (in contrast * to a view part, where modifications are saved to the workbench * immediately). *

* An editor is document or input-centric. Each editor has an input, and only * one editor can exist for each editor input within a page. This policy has * been designed to simplify part management. *

* An editor should be used in place of a view whenever more than one instance * of a document type can exist. *

* This interface may be implemented directly. For convenience, a base * implementation is defined in EditorPart. *

*

* An editor part is added to the workbench in two stages: *

    *
  1. An editor extension is contributed to the workbench registry. This * extension defines the extension id, extension class, and the file * extensions which are supported by the editor.
  2. *
  3. An editor part based upon the extension is created and added to the * workbench when the user opens a file with one of the supported file * extensions (or some other suitable form of editor input).
  4. *
*

*

* All editor parts implement the IAdaptable interface; extensions * are managed by the platform's adapter manager. *

* * @see org.blueberry.ui.IWorkbenchPage#openEditor(IEditorInput, String) * @see org.blueberry.ui.part.EditorPart */ struct BERRY_UI_QT IEditorPart : public virtual IWorkbenchPart, public ISaveablePart { berryObjectMacro(berry::IEditorPart, IWorkbenchPart, ISaveablePart); ~IEditorPart() override; /** * The property id for getEditorInput. */ //static const int PROP_INPUT = IWorkbenchPartConstants.PROP_INPUT; /** * Returns the input for this editor. If this value changes the part must * fire a property listener event with PROP_INPUT. * * @return the editor input */ virtual SmartPointer GetEditorInput() const = 0; /** * Returns the site for this editor. * This method is equivalent to (IEditorSite) getSite(). *

* The site can be null while the editor is being initialized. * After the initialization is complete, this value must be non-null * for the remainder of the editor's life cycle. *

* * @return the editor site; this value may be null if the editor * has not yet been initialized */ virtual SmartPointer GetEditorSite() const = 0; /** * Initializes this editor with the given editor site and input. *

* This method is automatically called shortly after the part is instantiated. - * It marks the start of the part's lifecycle. The - * {@link IWorkbenchPart#dispose IWorkbenchPart.dispose} method will be called - * automically at the end of the lifecycle. Clients must not call this method. + * It marks the start of the part's lifecycle. Clients must not call this method. *

* Implementors of this method must examine the editor input object type to * determine if it is understood. If not, the implementor must throw * a PartInitException *

* @param site the editor site * @param input the editor input * @exception PartInitException if this editor was not initialized successfully */ virtual void Init(SmartPointer site, SmartPointer input) = 0; }; } Q_DECLARE_INTERFACE(berry::IEditorPart, "org.blueberry.ui.IEditorPart") #endif /*BERRYIEDITORPART_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorRegistry.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorRegistry.h index 76497a0b74..ac26a03df3 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIEditorRegistry.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorRegistry.h @@ -1,281 +1,275 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef MITKIEDITORREGISTRY_H_ #define MITKIEDITORREGISTRY_H_ #include "berryIEditorDescriptor.h" #include "berryIFileEditorMapping.h" namespace berry { /** * \ingroup org_blueberry_ui_qt * * Registry of editors known to the workbench. *

* An editor can be created in one of two ways: *

    *
  • An editor can be defined by an extension to the workbench.
  • *
  • The user manually associates an editor with a given resource extension * type. This will override any default workbench or platform association. *
  • *
*

*

* The registry does not keep track of editors that are "implicitly" determined. * For example a bitmap (.bmp) file will typically not have a * registered editor. Instead, when no registered editor is found, the * underlying OS is consulted. *

*

* This interface is not intended to be implemented by clients. *

* * @see org.blueberry.ui.IWorkbench#getEditorRegistry() - * @noimplement This interface is not intended to be implemented by clients. */ struct BERRY_UI_QT IEditorRegistry { /** * The property identifier for the contents of this registry. */ static const int PROP_CONTENTS; // = 0x01; /** * The identifier for the system external editor descriptor. This descriptor * is always present in the registry on all platforms. - * This editor requires an input which implements - * {@link org.blueberry.ui.IPathEditorInput IPathEditorInput}. - * Use {@link #findEditor findEditor} to access the editor descriptor for - * this identifier. + * Use {@link #FindEditor} to access the editor descriptor for this identifier. * * @since 3.0 */ static const QString SYSTEM_EXTERNAL_EDITOR_ID; // = "org.blueberry.ui.systemExternalEditor"; /** * The identifier for the system in-place editor descriptor. This descriptor * is only present in the registry on platforms that support in-place editing - * (for example Win32). This editor requires an input which implements - * {@link org.blueberry.ui.IInPlaceEditorInput IInPlaceEditorInput}. Use - * {@link #findEditor findEditor} to access the editor descriptor for this - * identifier. + * (for example Win32). Use {@link #FindEditor} to access the editor + * descriptor for this identifier. * * @since 3.0 */ static const QString SYSTEM_INPLACE_EDITOR_ID; // = "org.blueberry.ui.systemInPlaceEditor"; /* * Adds a listener for changes to properties of this registry. * Has no effect if an identical listener is already registered. *

* The properties ids are as follows: *

    *
  • PROP_CONTENTS: Triggered when the file editor mappings in * the editor registry change.
  • *
*

* * @param listener a property listener */ // virtual void AddPropertyListener(IPropertyListener listener) = 0; virtual ~IEditorRegistry(); /** * Finds and returns the descriptor of the editor with the given editor id. * * @param editorId the editor id * @return the editor descriptor with the given id, or null if not * found */ virtual IEditorDescriptor::Pointer FindEditor(const QString& editorId) = 0; /** * Returns the default editor. The default editor always exist. * * @return the descriptor of the default editor * @deprecated The system external editor is the default editor. * Use findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID) * instead. */ virtual IEditorDescriptor::Pointer GetDefaultEditor() = 0; /** * Returns the default editor for a given file name. This method assumes an * unknown content type for the given file. *

* The default editor is determined by taking the file extension for the * file and obtaining the default editor for that extension. *

* * @param fileName * the file name in the system * @return the descriptor of the default editor, or null if * not found */ virtual IEditorDescriptor::Pointer GetDefaultEditor(const QString& fileName) = 0; /* * Returns the default editor for a given file name and with the given content type. *

* The default editor is determined by taking the file extension for the * file and obtaining the default editor for that extension. *

* * @param fileName the file name in the system * @param contentType the content type or null for the unknown content type * @return the descriptor of the default editor, or null if not * found * @since 3.1 */ //virtual IEditorDescriptor::Pointer GetDefaultEditor(const QString& fileName, IContentType contentType) = 0; /** * Returns the list of file editors registered to work against the file with * the given file name. This method assumes an unknown content type for the * given file. *

* Note: Use getDefaultEditor(String) if you only the need * the default editor rather than all candidate editors. *

* * @param fileName * the file name in the system * @return a list of editor descriptors */ virtual QList GetEditors(const QString& fileName) = 0; /* * Returns the list of file editors registered to work against the file with * the given file name and with the given content type. *

* Note: Use getDefaultEditor(String) if you only the need * the default editor rather than all candidate editors. *

* * @param fileName * the file name in the system * @param contentType * the content type or null for the unknown * content type * @return a list of editor descriptors * @since 3.1 */ //virtual QList GetEditors(const QString& fileName, IContentType contentType) = 0; /** * Returns a list of mappings from file type to editor. The resulting list * is sorted in ascending order by file extension. *

* Each mapping defines an extension and the set of editors that are * available for that type. The set of editors includes those registered * via plug-ins and those explicitly associated with a type by the user * in the workbench preference pages. *

* * @return a list of mappings sorted alphabetically by extension */ virtual QList GetFileEditorMappings() = 0; /* * Returns the image descriptor associated with a given file. This image is * usually displayed next to the given file. This method assumes an unknown * content type for the given file. *

* The image is determined by taking the file extension of the file and * obtaining the image for the default editor associated with that * extension. A default image is returned if no default editor is available. *

* * @param filename * the file name in the system * @return the descriptor of the image to display next to the file */ // virtual ImageDescriptor* GetImageDescriptor(const QString& filename) = 0; /* * Returns the image descriptor associated with a given file. This image is * usually displayed next to the given file. *

* The image is determined by taking the file extension of the file and * obtaining the image for the default editor associated with that * extension. A default image is returned if no default editor is available. *

* * @param filename * the file name in the system * @param contentType * the content type of the file or null for the * unknown content type * @return the descriptor of the image to display next to the file * @since 3.1 */ // virtual ImageDescriptor* GetImageDescriptor(const std::tring& filename, IContentType contentType) = 0; /* * Removes the given property listener from this registry. * Has no affect if an identical listener is not registered. * * @param listener a property listener */ // virtual void RemovePropertyListener(IPropertyListener listener) = 0; /** * Sets the default editor id for the files that match that * specified file name or extension. The specified editor must be * defined as an editor for that file name or extension. * * @param fileNameOrExtension the file name or extension pattern (e.g. "*.xml"); * @param editorId the editor id or null for no default */ virtual void SetDefaultEditor(const QString& fileNameOrExtension, const QString& editorId) = 0; /** * Returns whether there is an in-place editor that could handle a file * with the given name. * * @param filename the file name * @return true if an in-place editor is available, and * false otherwise * @since 3.0 */ virtual bool IsSystemInPlaceEditorAvailable(const QString& filename) = 0; /** * Returns whether the system has an editor that could handle a file * with the given name. * * @param filename the file name * @return true if an external editor available, and * false otherwise * @since 3.0 */ virtual bool IsSystemExternalEditorAvailable(const QString& filename) = 0; /* * Returns the image descriptor associated with the system editor that * would be used to edit this file externally. * * @param filename the file name * @return the descriptor of the external editor image, or null * if none * @since 3.0 */ // virtual ImageDescriptor GetSystemExternalEditorImageDescriptor(const QString& filename) = 0; }; } #endif /*MITKIEDITORREGISTRY_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorSite.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorSite.h index e9a8d79052..f04095c4df 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIEditorSite.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorSite.h @@ -1,129 +1,128 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEDITORSITE_H_ #define BERRYIEDITORSITE_H_ #include "berryIWorkbenchPartSite.h" namespace berry { /** * \ingroup org_blueberry_ui_qt * * The primary interface between an editor part and the workbench. *

* The workbench exposes its implemention of editor part sites via this * interface, which is not intended to be implemented or extended by clients. *

- * @noimplement This interface is not intended to be implemented by clients. */ struct BERRY_UI_QT IEditorSite : public virtual IWorkbenchPartSite { berryObjectMacro(berry::IEditorSite); ~IEditorSite() override; /** * Returns the action bar contributor for this editor. *

* An action contributor is responsable for the creation of actions. * By design, this contributor is used for one or more editors of the same type. * Thus, the contributor returned by this method is not owned completely * by the editor - it is shared. *

* * @return the editor action bar contributor, or null if none exists */ //virtual IEditorActionBarContributor getActionBarContributor(); /** * Returns the action bars for this part site. Editors of the same type (and * in the same window) share the same action bars. Contributions to the * action bars are done by the IEditorActionBarContributor. * * @return the action bars * @since 2.1 */ //virtual IActionBars getActionBars(); /** *

* Registers a pop-up menu with the default id for extension. The default id * is defined as the part id. *

*

* By default, context menus include object contributions based on the * editor input for the current editor. It is possible to override this * behaviour by calling this method with includeEditorInput * as false. This might be desirable for editors that * present a localized view of an editor input (e.g., a node in a model * editor). *

*

* For a detailed description of context menu registration see * {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)} *

* * @param menuManager * the menu manager; must not be null. * @param selectionProvider * the selection provider; must not be null. * @param includeEditorInput * Whether the editor input should be included when adding object * contributions to this context menu. * @see IWorkbenchPartSite#registerContextMenu(MenuManager, * ISelectionProvider) * @since 3.1 */ // virtual void registerContextMenu(MenuManager menuManager, // ISelectionProvider selectionProvider, boolean includeEditorInput); /** *

* Registers a pop-up menu with a particular id for extension. This method * should only be called if the target part has more than one context menu * to register. *

*

* By default, context menus include object contributions based on the * editor input for the current editor. It is possible to override this * behaviour by calling this method with includeEditorInput * as false. This might be desirable for editors that * present a localized view of an editor input (e.g., a node in a model * editor). *

*

* For a detailed description of context menu registration see * {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)} *

* * @param menuId * the menu id; must not be null. * @param menuManager * the menu manager; must not be null. * @param selectionProvider * the selection provider; must not be null. * @param includeEditorInput * Whether the editor input should be included when adding object * contributions to this context menu. * @see IWorkbenchPartSite#registerContextMenu(MenuManager, * ISelectionProvider) * @since 3.1 */ // virtual void registerContextMenu(String menuId, MenuManager menuManager, // ISelectionProvider selectionProvider, boolean includeEditorInput); }; } #endif /*BERRYIEDITORSITE_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/berryIElementFactory.h b/Plugins/org.blueberry.ui.qt/src/berryIElementFactory.h index e71211cf2b..4105bba7fd 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIElementFactory.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIElementFactory.h @@ -1,71 +1,71 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIELEMENTFACTORY_H #define BERRYIELEMENTFACTORY_H #include #include namespace berry { struct IAdaptable; struct IMemento; /** * A factory for re-creating objects from a previously saved memento. *

* Clients should implement this interface and include the name of their class * in an extension to the platform extension point named * "org.blueberry.ui.elementFactories". * For example, the plug-in's XML markup might contain: - *

- * <extension point="org.blueberry.ui.elementFactories">
- *    <factory id="com.example.myplugin.MyFactory" class="MyFactory" />
- * </extension>
- * 
+ * \code{.unparsed} + * + * + * + * \endcode *

* * @see IPersistableElement * @see IMemento * @see IWorkbench#GetElementFactory */ struct BERRY_UI_QT IElementFactory { virtual ~IElementFactory(); /** * Re-creates and returns an object from the state captured within the given * memento. *

* If the result is not null, it should be persistable; that is, *

    * result.getAdapter(org.eclipse.ui.IPersistableElement.class)
    * 
* should not return null. The caller takes ownership of the * result and must delete it when it is not needed any more. *

* * @param memento * a memento containing the state for the object * @return an object, or nullptr if the element could not be * created */ virtual IAdaptable* CreateElement(const SmartPointer& memento) = 0; }; } Q_DECLARE_INTERFACE(berry::IElementFactory, "org.blueberry.ui.IElementFactory") #endif // BERRYIELEMENTFACTORY_H diff --git a/Plugins/org.blueberry.ui.qt/src/berryIFileEditorMapping.h b/Plugins/org.blueberry.ui.qt/src/berryIFileEditorMapping.h index f82ac8814d..610eebd843 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIFileEditorMapping.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIFileEditorMapping.h @@ -1,107 +1,106 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIFILEEDITORMAPPING_H_ #define BERRYIFILEEDITORMAPPING_H_ #include #include "berryIEditorDescriptor.h" namespace berry { /** * \ingroup org_blueberry_ui_qt * * An association between a file name/extension and a list of known editors for * files of that type. *

* The name and extension can never empty or null. The name may contain * the single wild card character (*) to indicate the editor applies to * all files with the same extension (e.g. *.doc). The name can never * embed the wild card character within itself (i.e. rep*) *

*

* This interface is not intended to be implemented by clients. *

* - * @see IEditorRegistry#getFileEditorMappings - * @noimplement This interface is not intended to be implemented by clients. + * @see IEditorRegistry#GetFileEditorMappings */ struct BERRY_UI_QT IFileEditorMapping : public Object { berryObjectMacro(berry::IFileEditorMapping); ~IFileEditorMapping() override; /** * Returns the default editor registered for this type mapping. * * @return the descriptor of the default editor, or null if there * is no default editor registered. Will also return null if * the default editor exists but fails the Expressions check. */ virtual IEditorDescriptor::Pointer GetDefaultEditor() = 0; /** * Returns the list of editors registered for this type mapping. * * @return a possibly empty list of editors. */ virtual QList GetEditors() const = 0; /** * Returns the list of editors formerly registered for this type mapping * which have since been deleted. * * @return a possibly empty list of editors */ virtual QList GetDeletedEditors() const = 0; /** * Returns the file's extension for this type mapping. * * @return the extension for this mapping */ virtual QString GetExtension() const = 0; /** * Returns the descriptor of the image to use for a file of this type. *

* The image is obtained from the default editor. A default file image is * returned if no default editor is available. *

* * @return the descriptor of the image to use for a resource of this type */ //virtual ImageDescriptor GetImageDescriptor() = 0; /** * Returns the label to use for this mapping. * Labels have the form "name.extension". * * @return the label to use for this mapping */ virtual QString GetLabel() const = 0; /** * Returns the file's name for this type mapping. * * @return the name for this mapping */ virtual QString GetName() const = 0; }; } #endif /*BERRYIFILEEDITORMAPPING_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/berryIFolderLayout.h b/Plugins/org.blueberry.ui.qt/src/berryIFolderLayout.h index a121c0b551..79155c97be 100644 --- a/Plugins/org.blueberry.ui.qt/src/berryIFolderLayout.h +++ b/Plugins/org.blueberry.ui.qt/src/berryIFolderLayout.h @@ -1,53 +1,52 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIFOLDERLAYOUT_H_ #define BERRYIFOLDERLAYOUT_H_ #include "berryIPlaceholderFolderLayout.h" namespace berry { /** * \ingroup org_blueberry_ui_qt * * An IFolderLayout is used to define the initial views within a folder. * The folder itself is contained within an IPageLayout. *

* This interface is not intended to be implemented by clients. *

* * @see IPageLayout#createFolder - * @noimplement This interface is not intended to be implemented by clients. */ struct BERRY_UI_QT IFolderLayout : public IPlaceholderFolderLayout { berryObjectMacro(berry::IFolderLayout); ~IFolderLayout() override; /** * Adds a view with the given compound id to this folder. * See the {@link IPageLayout} type documentation for more details about compound ids. * The primary id must name a view contributed to the workbench's view extension point * (named "org.blueberry.ui.views"). * * @param viewId the view id */ virtual void AddView(const QString& viewId) = 0; }; } #endif /*BERRYIFOLDERLAYOUT_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/commands/berryICommandImageService.h b/Plugins/org.blueberry.ui.qt/src/commands/berryICommandImageService.h index 0d18b6cd79..37b3ebc6b5 100644 --- a/Plugins/org.blueberry.ui.qt/src/commands/berryICommandImageService.h +++ b/Plugins/org.blueberry.ui.qt/src/commands/berryICommandImageService.h @@ -1,99 +1,99 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYICOMMANDIMAGESERVICE_H_ #define BERRYICOMMANDIMAGESERVICE_H_ #include "../services/berryIDisposable.h" #include namespace berry { /** *

* Provides a look-up facility for images associated with commands. *

*

* The type of an image indicates the state of the associated command * within the user interface. The supported types are: TYPE_DEFAULT * (to be used for an enabled command), TYPE_DISABLED (to be used * for a disabled command) and TYPE_HOVER (to be used for an * enabled command over which the mouse is hovering). *

*

* The style of an image is an arbitrary string used to distinguish * between sets of images associated with a command. For example, a command may * appear in the menus as the default style. However, in the toolbar, the * command is simply the default action for a toolbar drop down item. As such, * perhaps a different image style is appropriate. The classic case is the "Run * Last Launched" command, which appears in the menu and the toolbar, but with * different icons in each location. *

*

* We currently support a default image style (none) and an image style of * IMAGE_STYLE_TOOLBAR. *

* - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. + * @note This interface is not intended to be implemented by clients. + * @note This interface is not intended to be extended by clients. * */ struct BERRY_UI_QT ICommandImageService : public IDisposable { berryObjectMacro(berry::ICommandImageService); /** * The default image style. This is provided when no style is requested or * when the requested style is unavailable. (Value is null) */ static const QString IMAGE_STYLE_DEFAULT; /** * The image style used for commands in a toolbar. This is useful if you * want the icon for the command in the toolbar to be different than the one * that is displayed with menu items. (Value is toolbar) */ static const QString IMAGE_STYLE_TOOLBAR; // = "toolbar"; /** * Retrieves the image associated with the given command in the * default style. * * @param commandId * The identifier to find; must not be null. * @return An image appropriate for the given command; may be * null. */ virtual QIcon GetImage(const QString& commandId) = 0; /** * Retrieves the image associated with the given command in the * given style. * * @param commandId * The identifier to find; must not be null. * @param style * The style of the image to retrieve; may be null. * @return An image appropriate for the given command; A null QIcon * if the given image style cannot be found. */ virtual QIcon GetImage(const QString& commandId, const QString& style) = 0; }; } Q_DECLARE_INTERFACE(berry::ICommandImageService, "org.blueberry.ui.ICommandImageService") #endif /* BERRYICOMMANDIMAGESERVICE_H_ */ diff --git a/Plugins/org.blueberry.ui.qt/src/commands/berryICommandService.h b/Plugins/org.blueberry.ui.qt/src/commands/berryICommandService.h index 45ed978431..da1c9041b6 100644 --- a/Plugins/org.blueberry.ui.qt/src/commands/berryICommandService.h +++ b/Plugins/org.blueberry.ui.qt/src/commands/berryICommandService.h @@ -1,372 +1,372 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYICOMMANDSERVICE_H_ #define BERRYICOMMANDSERVICE_H_ #include "../services/berryIDisposable.h" #include namespace berry { struct IExecutionListener; struct IHandler; struct IElementReference; class UIElement; class Command; class CommandCategory; class ParameterizedCommand; class ParameterType; /** *

* Provides services related to the command architecture within the workbench. * This service can be used to access the set of commands and command * categories. *

*

* This service can be acquired from your service locator: *

  *  ICommandService service = (ICommandService) getSite().getService(ICommandService.class);
  * 
*
    *
  • This service is available globally.
  • *
*

- * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. + * @note This interface is not intended to be implemented by clients. + * @note This interface is not intended to be extended by clients. */ struct BERRY_UI_QT ICommandService : public IDisposable { berryObjectMacro(berry::ICommandService); /** * The identifier of the category in which all auto-generated commands will * appear. This value must never be null. */ static const QString AUTOGENERATED_CATEGORY_ID(); /** * Adds an execution listener to the command service. This listener will be * notified as commands are executed. *

* Note: listeners should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. *

* * @param listener * The listener to add; must not be null. - * @see #removeExecutionListener(IExecutionListener) + * @see #RemoveExecutionListener */ virtual void AddExecutionListener(IExecutionListener* listener) = 0; /** * Sets the name and description of the category for uncategorized commands. * This is the category that will be returned if - * {@link #getCategory(String)} is called with null. + * {@link #GetCategory} is called with null. * * @param name * The name of the category for uncategorized commands; must not * be null. * @param description * The description of the category for uncategorized commands; * may be null. */ virtual void DefineUncategorizedCategory(const QString& name, const QString& description) = 0; /** *

* Returns a {@link ParameterizedCommand} with a command and * parameterizations as specified in the provided * serializedParameterizedCommand string. The * serializedParameterizedCommand must use the format - * returned by {@link ParameterizedCommand#serialize()} and described in the + * returned by {@link ParameterizedCommand#Serialize} and described in the * Javadoc for that method. *

*

* If a parameter id encoded in the * serializedParameterizedCommand does not exist in the * encoded command, that parameter id and value are ignored. A given * parameter id should not be used more than once in * serializedParameterizedCommand. This will not result in * an exception, but the value of the parameter when the command is executed * cannot be specified here. *

*

* This method will never return null, however it may throw * an exception if there is a problem processing the serialization string or * the encoded command is undefined. *

* * @param serializedParameterizedCommand * a String representing a command id and * parameter ids and values * @return a ParameterizedCommand with the command and * parameterizations encoded in the * serializedParameterizedCommand * @throws NotDefinedException * if the command indicated in * serializedParameterizedCommand is not defined * @throws SerializationException * if there is an error deserializing * serializedParameterizedCommand * @see ParameterizedCommand#serialize() * @see CommandManager#deserialize(String) */ virtual SmartPointer Deserialize(const QString& serializedParameterizedCommand) const = 0; /** * Retrieves the category with the given identifier. If no such category * exists, then an undefined category with the given id is created. * * @param categoryId * The identifier to find. If the category is null, * then a category suitable for uncategorized items is defined * and returned. * @return A category with the given identifier, either defined or * undefined. */ virtual SmartPointer GetCategory(const QString& categoryId) const = 0; /** * Retrieves the command with the given identifier. If no such command * exists, then an undefined command with the given id is created. * * @param commandId * The identifier to find; must not be null. * @return A command with the given identifier, either defined or undefined. */ virtual SmartPointer GetCommand(const QString& commandId) const = 0; /** * Returns the collection of all of the defined categories in the workbench. * * @return The collection of categories (Category) that are * defined; never null, but may be empty. */ virtual QList > GetDefinedCategories() const = 0; /** * Returns the collection of the identifiers for all of the defined * categories in the workbench. * * @return The collection of category identifiers (String) * that are defined; never null, but may be empty. */ virtual QStringList GetDefinedCategoryIds() const = 0; /** * Returns the collection of the identifiers for all of the defined commands * in the workbench. * * @return The collection of command identifiers (String) * that are defined; never null, but may be empty. */ virtual QStringList GetDefinedCommandIds() const = 0; /** * Returns the collection of all of the defined commands in the workbench. * * @return The collection of commands (Command) that are * defined; never null, but may be empty. */ virtual QList > GetDefinedCommands() const = 0; /** * Returns the collection of the identifiers for all of the defined command * parameter types in the workbench. * * @return The collection of command parameter type identifiers (String) * that are defined; never null, but may be empty. */ virtual QStringList GetDefinedParameterTypeIds() const = 0; /** * Returns the collection of all of the defined command parameter types in * the workbench. * * @return The collection of command parameter types (ParameterType) * that are defined; never null, but may be empty. */ virtual QList > GetDefinedParameterTypes() const = 0; /** * Gets the help context identifier for a particular command. The command's * handler is first checked for a help context identifier. If the handler * does not have a help context identifier, then the help context identifier * for the command is returned. If neither has a help context identifier, * then null is returned. * * @param command * The command for which the help context should be retrieved; * must not be null. * @return The help context identifier to use for the given command; may be * null. * @throws NotDefinedException * If the given command is not defined. */ virtual QString GetHelpContextId(const SmartPointer& command) const = 0; /** * Gets the help context identifier for a particular command. The command's * handler is first checked for a help context identifier. If the handler * does not have a help context identifier, then the help context identifier * for the command is returned. If neither has a help context identifier, * then null is returned. * * @param commandId * The identifier of the command for which the help context * should be retrieved; must not be null. * @return The help context identifier to use for the given command; may be * null. * @throws NotDefinedException * If the command with the given identifier is not defined. */ virtual QString GetHelpContextId(const QString& commandId) const = 0; /** * Retrieves the command parameter type with the given identifier. If no * such parameter type exists, then an undefined parameter type with the * given id is created. * * @param parameterTypeId * The identifier to find; must not be null. * @return A command parameter type with the given identifier, either * defined or undefined. */ virtual SmartPointer GetParameterType(const QString& parameterTypeId) const = 0; /** *

* Reads the command information from the registry and the preferences. This * will overwrite any of the existing information in the command service. * This method is intended to be called during start-up. When this method * completes, this command service will reflect the current state of the * registry and preference store. *

*/ virtual void ReadRegistry() = 0; /** * Removes an execution listener from the command service. * * @param listener * The listener to remove; must not be null. */ virtual void RemoveExecutionListener(IExecutionListener* listener) = 0; /** * Sets the help context identifier to associate with a particular handler. * * @param handler * The handler with which to register a help context identifier; * must not be null. * @param helpContextId * The help context identifier to register; may be * null if the help context identifier should be * removed. */ virtual void SetHelpContextId(const SmartPointer& handler, const QString& helpContextId) = 0; /** * Register that this element accepts callbacks for this parameterized * command. *

* Note: elements should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. *

* * @param command * The parameterized command that is already specialized. Must * not be null. * @param element * The callback to register for this specialized command * instance. Must not be null. * @return A reference for the registered element that can be used to * unregister it. * @throws NotDefinedException * If the command included in the ParameterizedCommand is not * defined, or the element is null. - * @see #unregisterElement(IElementReference) + * @see #UnregisterElement */ virtual SmartPointer RegisterElementForCommand( const SmartPointer& command, const SmartPointer& element) = 0; /** * Re-register a callback element provided by the ICommandService. This * element reference must not currently be held by the ICommandService. i.e. * it must have been removed using - * {@link #unregisterElement(IElementReference)}. + * {@link #UnregisterElement}. *

* Note: elements should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. *

* * @param elementReference * The reference to re-register. Must not be null. - * @see #unregisterElement(IElementReference) + * @see #UnregisterElement */ virtual void RegisterElement(const SmartPointer& elementReference) = 0; /** * Unregister an element callback. It will be removed from the * ICommandService. The same service that is used to register an element for * a command must be used to unregister the element. * * @param elementReference * The callback reference that was provided by the command * service on registration. Must not be null. */ virtual void UnregisterElement(const SmartPointer& elementReference) = 0; /** * Refresh any elements registered against the command with the given id. * It allows the active handler the opportunity to provide user feedback. If * the command is parameterized, some of the parameters can be specified to * help narrow down which elements to refresh. *

* The service locator used in registering the element can also be used to * scope the search. For example: if you wanted all elements for your * command but only within the part's workbench window, you could use: * *

    * Map filter = new HashMap();
    * filter.put(IServiceScopes.WINDOW_SCOPE, getSite().getPage()
    *    .getWorkbenchWindow());
    * commandService.refreshElements(commandId, filter);
    * 
* *

* * @param commandId * The command id to refresh if it has registered eleemnts. * @param filter * key-value pairs that can narrow down the callbacks to return. * The parameters are ANDed together. This may be * null. */ virtual void RefreshElements(const QString& commandId, const QHash& filter) = 0; }; } Q_DECLARE_INTERFACE(berry::ICommandService, "org.blueberry.ui.ICommandService") #endif /* BERRYICOMMANDSERVICE_H_ */ diff --git a/Plugins/org.blueberry.ui.qt/src/handlers/berryHandlerUtil.h b/Plugins/org.blueberry.ui.qt/src/handlers/berryHandlerUtil.h index 8c1aab12ea..d526f0ac1f 100644 --- a/Plugins/org.blueberry.ui.qt/src/handlers/berryHandlerUtil.h +++ b/Plugins/org.blueberry.ui.qt/src/handlers/berryHandlerUtil.h @@ -1,440 +1,382 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYHANDLERUTIL_H_ #define BERRYHANDLERUTIL_H_ #include #include #include #include #include "berryIWorkbenchPart.h" #include "berryIWorkbenchPartSite.h" #include "berryISelection.h" #include "berryIWorkbenchWindow.h" #include "berryISources.h" namespace berry { /** * \ingroup org_blueberry_ui_qt * * Some common utilities for working with handlers in Platform UI. *

* Note: this class should not be instantiated or extended by clients. *

* * @since 3.3 */ class BERRY_UI_QT HandlerUtil { private: static void NoVariableFound(const ExecutionEvent::ConstPointer& event, const QString& name); static void IncorrectTypeFound(const ExecutionEvent::ConstPointer& event, const QString& name, const QString& expectedType, const QString& wrongType); public: typedef ObjectList StringVectorType; /** * Extract the variable. * * @param event * The execution event that contains the application context * @param name * The variable name to extract. * @return The object from the application context, or null * if it could not be found. */ static Object::ConstPointer GetVariable(const ExecutionEvent::ConstPointer& event, const QString& name); /** * Extract the variable. * * @param event * The execution event that contains the application context * @param name * The variable name to extract. * @return The object from the application context. Will not return * null. * @throws ExecutionException * if the variable is not found. */ static Object::ConstPointer GetVariableChecked(const ExecutionEvent::ConstPointer& event, const QString& name); /** * Extract the variable. * * @param context * The IEvaluationContext or null * @param name * The variable name to extract. * @return The object from the application context, or null * if it could not be found. */ static Object::ConstPointer GetVariable(Object::Pointer context, const QString& name); /** * Return the active contexts. * * @param event * The execution event that contains the application context * @return a collection of String contextIds, or null. */ static StringVectorType::ConstPointer GetActiveContexts(const ExecutionEvent::ConstPointer& event); /** * Return the active contexts. * * @param event * The execution event that contains the application context * @return a collection of String contextIds. Will not return * null. * @throws ExecutionException * If the context variable is not found. */ static StringVectorType::ConstPointer GetActiveContextsChecked(const ExecutionEvent::ConstPointer& event); - /** - * Return the active shell. Is not necessarily the active workbench window - * shell. - * - * @param event - * The execution event that contains the application context - * @return the active shell, or null. - */ -// static Shell GetActiveShell(const ExecutionEvent::ConstPointer& event) { -// Object::Pointer o = getVariable(event, ISources.ACTIVE_SHELL_NAME); -// if (o instanceof Shell) { -// return (Shell) o; -// } -// return null; -// } - - /** - * Return the active shell. Is not necessarily the active workbench window - * shell. - * - * @param event - * The execution event that contains the application context - * @return the active shell. Will not return null. - * @throws ExecutionException - * If the active shell variable is not found. - */ -// static Shell GetActiveShellChecked(const ExecutionEvent::ConstPointer& event) -// { -// Object::Pointer o = getVariableChecked(event, ISources.ACTIVE_SHELL_NAME); -// if (!(o instanceof Shell)) { -// incorrectTypeFound(event, ISources.ACTIVE_SHELL_NAME, Shell.class, -// o.getClass()); -// } -// return (Shell) o; -// } - /** * Return the active workbench window. * * @param event * The execution event that contains the application context * @return the active workbench window, or null. */ static IWorkbenchWindow::Pointer GetActiveWorkbenchWindow(const ExecutionEvent::ConstPointer& event); /** * Return the active workbench window. * * @param event * The execution event that contains the application context * @return the active workbench window. Will not return null. * @throws ExecutionException * If the active workbench window variable is not found. */ static IWorkbenchWindow::Pointer GetActiveWorkbenchWindowChecked( const ExecutionEvent::ConstPointer& event); - /** - * Return the active editor. - * - * @param event - * The execution event that contains the application context - * @return the active editor, or null. - */ - //static IEditorPart::Pointer GetActiveEditor(const ExecutionEvent::ConstPointer& event); - - /** - * Return the active editor. - * - * @param event - * The execution event that contains the application context - * @return the active editor. Will not return null. - * @throws ExecutionException - * If the active editor variable is not found. - */ - //static IEditorPart::Pointer GetActiveEditorChecked(const ExecutionEvent::ConstPointer& event); - /** * Return the part id of the active editor. * * @param event * The execution event that contains the application context * @return the part id of the active editor, or null. */ static ObjectString::ConstPointer GetActiveEditorId(const ExecutionEvent::ConstPointer& event); /** * Return the part id of the active editor. * * @param event * The execution event that contains the application context * @return the part id of the active editor. Will not return * null. * @throws ExecutionException * If the active editor id variable is not found. */ static ObjectString::ConstPointer GetActiveEditorIdChecked(const ExecutionEvent::ConstPointer& event); /** * Return the active part. * * @param event * The execution event that contains the application context * @return the active part, or null. */ static IWorkbenchPart::Pointer GetActivePart(const ExecutionEvent::ConstPointer& event); /** * Return the active part. * * @param event * The execution event that contains the application context * @return the active part. Will not return null. * @throws ExecutionException * If the active part variable is not found. */ static IWorkbenchPart::Pointer GetActivePartChecked(const ExecutionEvent::ConstPointer& event); /** * Return the part id of the active part. * * @param event * The execution event that contains the application context * @return the part id of the active part, or null. */ static ObjectString::ConstPointer GetActivePartId(const ExecutionEvent::ConstPointer& event); /** * Return the part id of the active part. * * @param event * The execution event that contains the application context * @return the part id of the active part. Will not return null. * @throws ExecutionException * If the active part id variable is not found. */ static ObjectString::ConstPointer GetActivePartIdChecked(const ExecutionEvent::ConstPointer& event); /** * Return the active part site. * * @param event * The execution event that contains the application context * @return the active part site, or null. */ static IWorkbenchPartSite::Pointer GetActiveSite(const ExecutionEvent::ConstPointer& event); /** * Return the active part site. * * @param event * The execution event that contains the application context * @return the active part site. Will not return null. * @throws ExecutionException * If the active part site variable is not found. */ static IWorkbenchPartSite::Pointer GetActiveSiteChecked(const ExecutionEvent::ConstPointer& event); /** * Return the current selection. * * @param event * The execution event that contains the application context * @return the current selection, or null. */ static ISelection::ConstPointer GetCurrentSelection(const ExecutionEvent::ConstPointer& event); /** * Return the current selection. * * @param event * The execution event that contains the application context * @return the current selection. Will not return null. * @throws ExecutionException * If the current selection variable is not found. */ static ISelection::ConstPointer GetCurrentSelectionChecked(const ExecutionEvent::ConstPointer& event); /** - * Return the menu IDs that were applied to the registered context menu. For - * example, #CompilationUnitEditorContext. + * Return the menu IDs that were applied to the registered context menu. * * @param event * The execution event that contains the application context * @return the menu IDs, or null. */ static StringVectorType::ConstPointer GetActiveMenus(const ExecutionEvent::ConstPointer& event); /** - * Return the menu IDs that were applied to the registered context menu. For - * example, #CompilationUnitEditorContext. + * Return the menu IDs that were applied to the registered context menu. * * @param event * The execution event that contains the application context * @return the menu IDs. Will not return null. * @throws ExecutionException * If the active menus variable is not found. */ static StringVectorType::ConstPointer GetActiveMenusChecked(const ExecutionEvent::ConstPointer& event); /** * Return the active menu selection. The active menu is a registered context * menu. * * @param event * The execution event that contains the application context * @return the active menu selection, or null. */ static ISelection::ConstPointer GetActiveMenuSelection(const ExecutionEvent::ConstPointer& event); /** * Return the active menu selection. The active menu is a registered context * menu. * * @param event * The execution event that contains the application context * @return the active menu selection. Will not return null. * @throws ExecutionException * If the active menu selection variable is not found. */ static ISelection::ConstPointer GetActiveMenuSelectionChecked(const ExecutionEvent::ConstPointer& event); /** * Return the active menu editor input, if available. The active menu is a * registered context menu. * * @param event * The execution event that contains the application context * @return the active menu editor, or null. */ static ISelection::ConstPointer GetActiveMenuEditorInput(const ExecutionEvent::ConstPointer& event); /** * Return the active menu editor input. The active menu is a registered * context menu. Some context menus do not include the editor input which * will throw an exception. * * @param event * The execution event that contains the application context * @return the active menu editor input. Will not return null. * @throws ExecutionException * If the active menu editor input variable is not found. */ static ISelection::ConstPointer GetActiveMenuEditorInputChecked( const ExecutionEvent::ConstPointer& event); /** * Return the ShowInContext selection. * * @param event * The execution event that contains the application context * @return the show in selection, or null. */ static ISelection::ConstPointer GetShowInSelection(const ExecutionEvent::ConstPointer& event); /** * Return the ShowInContext selection. Will not return null. * * @param event * The execution event that contains the application context * @return the show in selection, or null. * @throws ExecutionException * If the show in selection variable is not found. */ static ISelection::ConstPointer GetShowInSelectionChecked(const ExecutionEvent::ConstPointer& event); /** * Return the ShowInContext input. * * @param event * The execution event that contains the application context * @return the show in input, or null. */ static Object::ConstPointer GetShowInInput(const ExecutionEvent::ConstPointer& event); /** * Return the ShowInContext input. Will not return null. * * @param event * The execution event that contains the application context * @return the show in input, or null. * @throws ExecutionException * If the show in input variable is not found. */ static Object::ConstPointer GetShowInInputChecked(const ExecutionEvent::ConstPointer& event); /** * Toggles the command's state. * * @param command The command whose state needs to be toggled * @return the original value before toggling * * @throws ExecutionException * When the command doesn't contain the toggle state or when the state doesn't contain a boolean value */ static bool ToggleCommandState(const SmartPointer& command); /** * Checks whether the radio state of the command is same as the radio state * parameter's value * * @param event * The execution event that contains the application context * @return true whe the values are same, false * otherwise * * @throws ExecutionException * When the command doesn't have the radio state or the event * doesn't have the radio state parameter */ static bool MatchesRadioState(const SmartPointer& event); /** * Updates the radio state of the command to the given value * * @param command * the command whose state should be updated * @param newState * the new state * * @throws ExecutionException * When the command doesn't have a radio state */ static void UpdateRadioState(const SmartPointer& command, const QString& newState); }; } #endif /*BERRYHANDLERUTIL_H_*/ diff --git a/Plugins/org.blueberry.ui.qt/src/handlers/berryIHandlerService.h b/Plugins/org.blueberry.ui.qt/src/handlers/berryIHandlerService.h index aa732682a7..b4343a97c3 100755 --- a/Plugins/org.blueberry.ui.qt/src/handlers/berryIHandlerService.h +++ b/Plugins/org.blueberry.ui.qt/src/handlers/berryIHandlerService.h @@ -1,391 +1,379 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIHANDLERSERVICE_H_ #define BERRYIHANDLERSERVICE_H_ #include "services/berryIServiceWithSources.h" #include "common/berryCommandExceptions.h" namespace berry { class Command; class ExecutionEvent; class ParameterizedCommand; class Expression; class UIElement; struct IEvaluationContext; struct IHandler; struct IHandlerActivation; /** *

* Provides services related to activating and deactivating handlers within the * workbench. *

*

* This service can be acquired from your service locator: *

  *  IHandlerService service = (IHandlerService) getSite().getService(IHandlerService.class);
  * 
*
    *
  • This service is available globally.
  • *
*

- * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. + * @note This interface is not intended to be implemented by clients. + * @note This interface is not intended to be extended by clients. * * @since 3.1 */ struct BERRY_UI_QT IHandlerService : public IServiceWithSources { berryObjectMacro(berry::IHandlerService); ~IHandlerService() override; /** *

* Activates the given handler from a child service. This is used by slave * and nested services to promote handler activations up to the root. By * using this method, it is possible for handlers coming from a more nested * component to override the nested component. *

* * @param activation * The activation that is local to the child service; must not be * null. * @return A token which can be used to later cancel the activation. Only * someone with access to this token can cancel the activation. The * activation will automatically be cancelled if the service locator * context from which this service was retrieved is destroyed. This * activation is local to this service (i.e., it is not the * activation that is passed as a parameter). * @since 3.2 */ virtual SmartPointer ActivateHandler(const SmartPointer& activation) = 0; /** *

* Activates the given handler within the context of this service. If this * service was retrieved from the workbench, then this handler will be * active globally. If the service was retrieved from a nested component, * then the handler will only be active within that component. *

*

* Also, it is guaranteed that the handlers submitted through a particular * service will be cleaned up when that services is destroyed. So, for * example, a service retrieved from a IWorkbenchPartSite * would deactivate all of its handlers when the site is destroyed. *

* * @param commandId * The identifier for the command which this handler handles; * must not be null. * @param handler * The handler to activate; must not be null. * @return A token which can be used to later cancel the activation. Only * someone with access to this token can cancel the activation. The * activation will automatically be cancelled if the context from * which this service was retrieved is destroyed. */ virtual SmartPointer ActivateHandler( const QString& commandId, const SmartPointer& handler) = 0; /** *

* Activates the given handler within the context of this service. The * handler becomes active when expression evaluates to * true. This is the same as calling - * {@link #activateHandler(String, IHandler, Expression, boolean)} with - * global==false. + * {@link #ActivateHandler} with \c global==false . *

*

* Also, it is guaranteed that the handlers submitted through a particular * service will be cleaned up when that service is destroyed. So, for * example, a service retrieved from a IWorkbenchPartSite * would deactivate all of its handlers when the site is destroyed. *

* * @param commandId * The identifier for the command which this handler handles; * must not be null. * @param handler * The handler to activate; must not be null. * @param expression * This expression must evaluate to true before * this handler will really become active. The expression may be * null if the handler should always be active. * @return A token which can be used to later cancel the activation. Only * someone with access to this token can cancel the activation. The * activation will automatically be cancelled if the context from * which this service was retrieved is destroyed. * * @see org.eclipse.ui.ISources * @since 3.2 */ virtual SmartPointer ActivateHandler( const QString& commandId, const SmartPointer& handler, const SmartPointer& expression) = 0; /** *

* Activates the given handler within the context of this service. The * handler becomes active when expression evaluates to * true. if global==false, then this * handler service must also be the active service to active the handler. * For example, the handler service on a part is active when that part is * active. *

*

* Also, it is guaranteed that the handlers submitted through a particular * service will be cleaned up when that services is destroyed. So, for * example, a service retrieved from a IWorkbenchPartSite * would deactivate all of its handlers when the site is destroyed. *

* * @param commandId * The identifier for the command which this handler handles; * must not be null. * @param handler * The handler to activate; must not be null. * @param expression * This expression must evaluate to true before * this handler will really become active. The expression may be * null if the handler should always be active. * @param global * Indicates that the handler should be activated irrespectively * of whether the corresponding workbench component (e.g., * window, part, etc.) is active. * @return A token which can be used to later cancel the activation. Only * someone with access to this token can cancel the activation. The * activation will automatically be cancelled if the context from * which this service was retrieved is destroyed. * * @see org.eclipse.ui.ISources * @since 3.2 */ virtual SmartPointer ActivateHandler( const QString& commandId, const SmartPointer& handler, const SmartPointer& expression, bool global) = 0; /** * Creates an execution event based on an SWT event. This execution event * can then be passed to a command for execution. * * @param command * The command for which an execution event should be created; * must not be null. - * @param event - * The SWT event triggering the command execution; may be - * null. + * @param uielement * @return An execution event suitable for calling - * {@link Command#executeWithChecks(ExecutionEvent)}. + * {@link Command#ExecuteWithChecks}. * @since 3.2 - * @see Command#executeWithChecks(ExecutionEvent) + * @see Command#ExecuteWithChecks */ virtual SmartPointer CreateExecutionEvent( const SmartPointer& command, const SmartPointer& uielement) = 0; /** * Creates a parameterized execution event based on an SWT event and a * parameterized command. This execution event can then be passed to a * command for execution. * * @param command * The parameterized command for which an execution event should * be created; must not be null. - * @param event - * The SWT event triggering the command execution; may be - * null. + * @param uielement * @return An execution event suitable for calling - * {@link Command#executeWithChecks(ExecutionEvent)}. + * {@link Command#ExecuteWithChecks}. * @since 3.2 - * @see ParameterizedCommand#getCommand() - * @see Command#executeWithChecks(ExecutionEvent) + * @see ParameterizedCommand#GetCommand + * @see Command#ExecuteWithChecks */ virtual SmartPointer CreateExecutionEvent( const SmartPointer& command, const SmartPointer& uielement) = 0; /** * Deactivates the given handler within the context of this service. If the * handler was activated with a different service, then it must be * deactivated from that service instead. It is only possible to retract a * handler activation with this method. That is, you must have the same * IHandlerActivation used to activate the handler. * * @param activation * The token that was returned from a call to * activateHandler; must not be null. */ virtual void DeactivateHandler(const SmartPointer& activation) = 0; /** * Deactivates the given handlers within the context of this service. If the * handler was activated with a different service, then it must be * deactivated from that service instead. It is only possible to retract a * handler activation with this method. That is, you must have the same * IHandlerActivation used to activate the handler. * * @param activations * The tokens that were returned from a call to * activateHandler. This collection must only * contain instances of IHandlerActivation. The * collection must not be null. */ virtual void DeactivateHandlers( const QList >& activations) = 0; /** * Executes the command with the given identifier and no parameters. * * @param commandId * The identifier of the command to execute; must not be * null. - * @param event - * The SWT event triggering the command execution; may be - * null. + * @param uielement * @return The return value from the execution; may be null. * @throws ExecutionException * If the handler has problems executing this command. * @throws NotDefinedException * If the command you are trying to execute is not defined. * @throws NotEnabledException * If the command you are trying to execute is not enabled. * @throws NotHandledException * If there is no handler. * @since 3.2 - * @see Command#executeWithChecks(ExecutionEvent) + * @see Command#ExecuteWithChecks */ virtual Object::Pointer ExecuteCommand(const QString& commandId, const SmartPointer& uielement) = 0; /** * Executes the given parameterized command. * * @param command * The parameterized command to be executed; must not be * null. - * @param event - * The SWT event triggering the command execution; may be - * null. + * @param uielement * @return The return value from the execution; may be null. * @throws ExecutionException * If the handler has problems executing this command. * @throws NotDefinedException * If the command you are trying to execute is not defined. * @throws NotEnabledException * If the command you are trying to execute is not enabled. * @throws NotHandledException * If there is no handler. * @since 3.2 - * @see Command#executeWithChecks(ExecutionEvent) + * @see Command#ExecuteWithChecks */ virtual Object::Pointer ExecuteCommand(const SmartPointer& command, const SmartPointer& uielement) = 0; /** * Executes the given parameterized command in the provided context. It * takes care of finding the correct active handler given the context, calls - * {@link IHandler2#setEnabled(Object)} to update the enabled state if + * \c IHandler2.setEnabled(Object) to update the enabled state if * supported, and executes with that handler. * * @param command * The parameterized command to be executed; must not be * null. - * @param event - * The SWT event triggering the command execution; may be - * null. + * @param uielement * @param context * the evaluation context to run against. Must not be * null * @return The return value from the execution; may be null. * @throws ExecutionException * If the handler has problems executing this command. * @throws NotDefinedException * If the command you are trying to execute is not defined. * @throws NotEnabledException * If the command you are trying to execute is not enabled. * @throws NotHandledException * If there is no handler. * @since 3.4 - * @see Command#executeWithChecks(ExecutionEvent) - * @see #createContextSnapshot(boolean) + * @see Command#ExecuteWithChecks + * @see #CreateContextSnapshot */ virtual Object::Pointer ExecuteCommandInContext( const SmartPointer& command, const SmartPointer& uielement, const SmartPointer& context) = 0; /** * This method creates a copy of the application context returned by - * {@link #getCurrentState()}. + * {@link #GetCurrentState}. * * @param includeSelection * if true, include the default variable and * selection variables * @return an context filled with the current set of variables. If selection * is not included, the default variable is an empty collection */ virtual SmartPointer CreateContextSnapshot(bool includeSelection) = 0; /** * Returns an evaluation context representing the current state of the * world. This is equivalent to the application context required by * {@link ExecutionEvent}. * * @return the current state of the application; never null. - * @see ParameterizedCommand#executeWithChecks(Object, Object) - * @see ExecutionEvent#ExecutionEvent(Command, java.util.Map, Object, - * Object) - * @see org.eclipse.ui.services.IEvaluationService + * @see ParameterizedCommand#ExecuteWithChecks + * @see ExecutionEvent#ExecutionEvent + * @see IEvaluationService */ virtual SmartPointer GetCurrentState() const = 0; /** *

* Reads the handler information from the registry. This will overwrite any * of the existing information in the handler service. This method is * intended to be called during start-up. When this method completes, this * handler service will reflect the current state of the registry. *

*/ virtual void ReadRegistry() = 0; /** * Sets the help context identifier to associate with a particular handler. * * @param handler * The handler with which to register a help context identifier; * must not be null. * @param helpContextId * The help context identifier to register; may be * null if the help context identifier should be * removed. * @since 3.2 */ virtual void SetHelpContextId(const SmartPointer& handler, const QString& helpContextId) = 0; }; } Q_DECLARE_INTERFACE(berry::IHandlerService, "org.blueberry.ui.IHandlerService") #endif /* BERRYIHANDLERSERVICE_H_ */ diff --git a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroManager.h b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroManager.h index 697703c32e..bd238a103a 100644 --- a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroManager.h +++ b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroManager.h @@ -1,137 +1,136 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIINTROMANAGER_H_ #define BERRYIINTROMANAGER_H_ #include "berryIIntroPart.h" #include namespace berry { /** * Manages the intro part that introduces the product to new users. * The intro part is typically shown the first time a product is started up. *

* The initial behavior of the intro part is controlled by the application - * from via the {@link org.eclipse.ui.application.WorkbenchWindowAdvisor#openIntro()} + * from via the {@link WorkbenchWindowAdvisor#OpenIntro()} * method. *

*

- * See {@link org.eclipse.ui.intro.IIntroPart} for details on where intro parts + * See {@link IIntroPart} for details on where intro parts * come from. *

*

* This interface is not intended to be extended or implemented by clients. *

* * @see org.eclipse.ui.IWorkbench#getIntroManager() * @since 3.0 - * @noimplement This interface is not intended to be implemented by clients. */ struct BERRY_UI_QT IIntroManager { virtual ~IIntroManager(); /** * Closes the given intro part. * * @param part the intro part * @return true if the intro part was closed, and * false otherwise. false is returned * if part is null or it is not the intro part returned - * by {@link #getIntro()}. + * by {@link #GetIntro()}. */ virtual bool CloseIntro(IIntroPart::Pointer part) = 0; /** * Returns the intro part. Returns null if there is no intro - * part, if it has been previously closed via {@link #closeIntro(IIntroPart)} - * or if there is an intro part but {@link #showIntro(IWorkbenchWindow, boolean)} + * part, if it has been previously closed via {@link #CloseIntro} + * or if there is an intro part but {@link #ShowIntro} * has not yet been called to create it. * * @return the intro part, or null if none is available */ virtual IIntroPart::Pointer GetIntro() const = 0; /** * Return whether an intro is available. Note that this checks whether * there is an applicable intro part that could be instantiated and shown * to the user. - * Use {@link #getIntro()} to discover whether an intro part has already + * Use {@link #GetIntro} to discover whether an intro part has already * been created. * * @return true if there is an intro that could be shown, and * false if there is no intro */ virtual bool HasIntro() const = 0; /** * Return the standby state of the given intro part. * * @param part the intro part * @return true if the part in its partially * visible standy mode, and false if in its fully visible state. * false is returned if part is null or it is not - * the intro part returned by {@link #getIntro()}. + * the intro part returned by {@link #GetIntro}. */ virtual bool IsIntroStandby(IIntroPart::Pointer part) const = 0; /** * Sets the standby state of the given intro part. Intro part usually should * render themselves differently in the full and standby modes. In standby * mode, the part should be partially visible to the user but otherwise * allow them to work. In full mode, the part should be fully visible and * be the center of the user's attention. *

* This method does nothing if the part is null or is not - * the intro part returned by {@link #getIntro()}. + * the intro part returned by {@link #GetIntro}. *

* * @param part the intro part, or null * @param standby true to put the part in its partially * visible standy mode, and false to make it fully visible. */ virtual void SetIntroStandby(IIntroPart::Pointer part, bool standby) = 0; /** * Shows the intro part in the given workbench window. If the intro part has * not been created yet, one will be created. If the intro part is currently * being shown in some workbench window, that other window is made active. * * @param preferredWindow the preferred workbench window, or * null to indicate the currently active workbench window * @param standby true to put the intro part in its partially * visible standy mode, and false to make it fully visible * @return the newly-created or existing intro part, or null * if no intro part is available or if preferredWindow is * null and there is no currently active workbench window */ virtual IIntroPart::Pointer ShowIntro( IWorkbenchWindow::Pointer preferredWindow, bool standby) = 0; /** * Returns true if there is an intro content detector and it * reports that new intro content is available. * * @return true if new intro content is available * * @since 3.3 */ virtual bool IsNewContentAvailable() = 0; }; } #endif /* BERRYIINTROMANAGER_H_ */ diff --git a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroPart.h b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroPart.h index 71099009de..512f075bdb 100644 --- a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroPart.h +++ b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroPart.h @@ -1,189 +1,189 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIINTROPART_H_ #define BERRYIINTROPART_H_ #include #include #include #include #include #include "berryIIntroSite.h" #include namespace berry { /** * The intro part is a visual component within the workbench responsible for * introducing the product to new users. The intro part is typically shown the * first time a product is started up. *

* The intro part implementation is contributed to the workbench via the * org.blueberry.ui.intro extension point. There can be several * intro part implementations, and associations between intro part * implementations and products. The workbench will only make use of the intro * part implementation for the current product (as given by * {@link berry::Platform#GetProduct()}. There is at most one * intro part instance in the entire workbench, and it resides in exactly one * workbench window at a time. *

*

* This interface in not intended to be directly implemented. Rather, clients * providing a intro part implementation should subclass * {@link berry::IntroPart}. *

* * @see IIntroManager#ShowIntro */ struct BERRY_UI_QT IIntroPart : public virtual Object { // IAdaptable { berryObjectMacro(berry::IIntroPart); ~IIntroPart() override; /** * Returns the site for this intro part. * * @return the intro site */ virtual IIntroSite::Pointer GetIntroSite() const = 0; /** * Initializes this intro part with the given intro site. A memento is * passed to the part which contains a snapshot of the part state from a * previous session. Where possible, the part should try to recreate that * state. *

* This method is automatically called by the workbench shortly after * part construction. It marks the start of the intro's lifecycle. Clients * must not call this method. *

* * @param site the intro site * @param memento the intro part state or null if there is no previous * saved state * @exception PartInitException if this part was not initialized * successfully */ virtual void Init(IIntroSite::Pointer site, IMemento::Pointer memento) = 0; /** * Sets the standby state of this intro part. An intro part should render * itself differently in the full and standby modes. In standby mode, the * part should be partially visible to the user but otherwise allow them * to work. In full mode, the part should be fully visible and be the center * of the user's attention. *

* This method is automatically called by the workbench at appropriate * times. Clients must not call this method directly (call - * {@link IIntroManager#setIntroStandby(IIntroPart, boolean)} instead. + * {@link IIntroManager#SetIntroStandby} instead. *

* * @param standby true to put this part in its partially * visible standy mode, and false to make it fully visible */ virtual void StandbyStateChanged(bool standby) = 0; /** * Saves the object state within a memento. *

* This method is automatically called by the workbench at appropriate * times. Clients must not call this method directly. *

* * @param memento a memento to receive the object state */ virtual void SaveState(IMemento::Pointer memento) = 0; /** * Adds a listener for changes to properties of this intro part. * Has no effect if an identical listener is already registered. * * @param listener a property listener */ virtual void AddPropertyListener(IPropertyChangeListener* listener) = 0; /** * Creates the SWT controls for this intro part. *

* Clients should not call this method (the workbench calls this method when * it needs to, which may be never). *

*

* For implementors this is a multi-step process: *

    *
  1. Create one or more controls within the parent.
  2. *
  3. Set the parent layout as needed.
  4. *
  5. Register any global actions with the IActionService.
  6. *
  7. Register any popup menus with the IActionService.
  8. *
  9. Register a selection provider with the ISelectionService * (optional).
  10. *
*

* * @param parent the parent control */ virtual void CreatePartControl(void* parent) = 0; /** * Returns the title image of this intro part. *

* The title image is usually used to populate the title bar of this part's * visual container. Since this image is managed by the part itself, callers * must not dispose the returned image. *

* * @return the title image */ virtual QIcon GetTitleImage() const = 0; /** * Returns the title of this intro part. *

* The title is used to populate the title bar of this part's visual * container. *

* * @return the intro part title (not null) */ virtual QString GetPartName() const = 0; /** * Removes the given property listener from this intro part. * Has no affect if an identical listener is not registered. * * @param listener a property listener */ virtual void RemovePropertyListener(IPropertyChangeListener* listener) = 0; /** * Asks this part to take focus within the workbench. *

* Clients should not call this method (the workbench calls this method at * appropriate times). To have the workbench activate a part, use - * {@link IIntroManager#showIntro(IWorkbenchWindow, boolean)}. + * {@link IIntroManager#ShowIntro}. *

*/ virtual void SetFocus() = 0; }; } Q_DECLARE_INTERFACE(berry::IIntroPart, "org.blueberry.ui.IIntroPart") #endif /* BERRYIINTROPART_H_ */ diff --git a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroSite.h b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroSite.h index 4d3db03698..92fde8c48b 100644 --- a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroSite.h +++ b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroSite.h @@ -1,68 +1,66 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIINTROSITE_H_ #define BERRYIINTROSITE_H_ #include namespace berry { /** * The primary interface between an intro part and the workbench. *

* The workbench exposes its implemention of intro part sites via this * interface, which is not intended to be implemented or extended by clients. *

- * - * @noimplement This interface is not intended to be implemented by clients. */ struct BERRY_UI_QT IIntroSite : public IWorkbenchSite { berryObjectMacro(berry::IIntroSite); ~IIntroSite() override; /** * Returns the part registry extension id for this intro site's part. *

* The name comes from the id attribute in the configuration * element. *

* * @return the registry extension id */ virtual QString GetId() const = 0; /** * Returns the unique identifier of the plug-in that defines this intro * site's part. * * @return the unique identifier of the declaring plug-in * @see org.eclipse.core.runtime.IPluginDescriptor#getUniqueIdentifier() */ virtual QString GetPluginId() const = 0; /** * Returns the action bars for this part site. * The intro part has exclusive use of its site's action bars. * * @return the action bars */ //virtual IActionBars GetActionBars() const = 0; }; } #endif /* BERRYIINTROSITE_H_ */ diff --git a/Plugins/org.blueberry.ui.qt/src/services/berryIDisposable.h b/Plugins/org.blueberry.ui.qt/src/services/berryIDisposable.h index d1332c8656..31f514b014 100755 --- a/Plugins/org.blueberry.ui.qt/src/services/berryIDisposable.h +++ b/Plugins/org.blueberry.ui.qt/src/services/berryIDisposable.h @@ -1,63 +1,63 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIDISPOSABLE_H_ #define BERRYIDISPOSABLE_H_ #include #include #include namespace berry { /** *

* The interface that should be implemented by services that make themselves * available through the IAdaptable mechanism. This is the * interface that drives the majority of services provided at the workbench * level. *

*

* A service has life-cycle. When the constructor completes, the service must be * fully functional. When it comes time for the service to go away, then the - * service will receive a {@link #dispose()} call. At this point, the service + * service will receive a {@link #Dispose} call. At this point, the service * must release all resources and detach all listeners. A service can only be * disposed once; it cannot be reused. *

*

* This interface has nothing to do with OSGi services. *

*

* This interface can be extended or implemented by clients. *

*/ struct IDisposable : public virtual Object { berryObjectMacro(berry::IDisposable); ~IDisposable() override; /** * Disposes of this service. All resources must be freed. All listeners must * be detached. Dispose will only be called once during the life cycle of a * service. */ virtual void Dispose() = 0; }; } #endif /* BERRYIDISPOSABLE_H_ */ diff --git a/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationReference.h b/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationReference.h index 09608163c0..afcd3965b7 100644 --- a/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationReference.h +++ b/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationReference.h @@ -1,53 +1,53 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEVALUATIONREFERENCE_H #define BERRYIEVALUATIONREFERENCE_H #include "internal/berryIEvaluationResultCache.h" namespace berry { struct IPropertyChangeListener; /** * A token representing a core expression and property change listener currently * working in the IEvaluationService. * - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. + * @note This interface is not intended to be implemented by clients. + * @note This interface is not intended to be extended by clients. */ struct IEvaluationReference : public virtual IEvaluationResultCache { berryObjectMacro(berry::IEvaluationReference); /** * The property change listener associated with the evaluated expression. * * @return the listener for updates. */ virtual IPropertyChangeListener* GetListener() const = 0; /** * The property used in change notifications. * * @return the property name. */ virtual QString GetProperty() const = 0; }; } #endif // BERRYIEVALUATIONREFERENCE_H diff --git a/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationService.h b/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationService.h index 7f6c9d9f13..72334e47fe 100644 --- a/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationService.h +++ b/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationService.h @@ -1,209 +1,207 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYIEVALUATIONSERVICE_H #define BERRYIEVALUATIONSERVICE_H #include #include namespace berry { struct IEvaluationContext; struct IEvaluationReference; struct IPropertyChangeListener; class Expression; /** * Evaluate a core expression against the workbench application context and * report updates using a Boolean property. Clients supply an * IPropertyChangeListener that will be notified as changes * occur. *

* This can be used to implement core expressions in client extension points * similar to the <enabledWhen> of * org.blueberry.ui.handlers/handler elements. *

*

* The service will fire TRUE and * FALSE for the oldValue and newValue in the property * change events. *

*

* Adding the evaluation listener will fire one change with oldValue=null * and newValue="evaluated expression". Remove the * IEvaluationReference will fire one change with * oldValue="last evaluated value" and newValue=null. *

*

* Adding a service listener will fire the {@link #PROP_NOTIFYING} property * change event with newValue=TRUE when a source change * causes expression evaluations to update and another {@link #PROP_NOTIFYING} * property change event with newValue=FALSE when the * changes that started with a specific source change have finished. The * {@link #PROP_NOTIFYING} change events will not be fired for source changes * caused by the outer most recalculations. *

*

* Variable sources can be provided to this service using the org.blueberry.ui.services * Extension Point. This makes the available to <with/> expressions. *

*

* This service can be acquired from your service locator: *

  *   IEvaluationService::Pointer service = GetSite()->GetService(IEvaluationService::GetManifestName());
  * 
*
    *
  • This service is available globally.
  • *
*

* - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. + * @note This interface is not intended to be extended by clients. + * @note This interface is not intended to be implemented by clients. */ struct BERRY_UI_QT IEvaluationService : public IServiceWithSources { berryObjectMacro(berry::IEvaluationService); /** * A general property that can be used. */ static const QString RESULT; // = "org.blueberry.ui.services.result"; /** * The property used to notify any service listeners. */ static const QString PROP_NOTIFYING; // = "org.blueberry.ui.services.notifying"; /** * When a source change starts recalculating expressions the * {@link #PROP_NOTIFYING} property change is fired with the newValue=TRUE. * This property is not fired for any source changes caused by the outer * recalculations. *

* Note: listeners should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. *

* * @param listener * The listener to be notified. Must not be null. * Has no effect if the listener has already been added. */ virtual void AddServiceListener(IPropertyChangeListener* listener) = 0; /** * Remove the listener for {@link #PROP_NOTIFYING} property changes. * * @param listener * The listener to remove. Must not be null. Has * no effect if the listener is not currently registered. */ virtual void RemoveServiceListener(IPropertyChangeListener* listener) = 0; /** * Add a listener that can be notified when the workbench application * context causes the expression evaluation value to change. *

* Note: listeners should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. *

* * @param expression * the core expression to evaluate. * @param listener * the listener to be notified. * @param property * the property contained in the notification * @return a token that can be used to remove this listener. - * {@link #removeEvaluationListener(IEvaluationReference)} + * {@link #RemoveEvaluationListener} */ virtual SmartPointer AddEvaluationListener( const SmartPointer& expression, IPropertyChangeListener* listener, const QString& property) = 0; /** * Re-add a property change listener that has already been removed by - * {@link #removeEvaluationListener(IEvaluationReference)}. + * {@link #RemoveEvaluationListener}. *

* It will only accept IEvaluationReferences returned from a previous call - * to - * {@link #addEvaluationListener(Expression, IPropertyChangeListener, String)} - * on this service. + * to {@link #AddEvaluationListener} on this service. *

*

* Note: references should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. *

* * @param ref * The listener to re-add. - * @see #removeEvaluationListener(IEvaluationReference) + * @see #RemoveEvaluationListener */ virtual void AddEvaluationReference(const SmartPointer& ref) = 0; /** * Remove the listener represented by the evaluation reference. * * @param ref * the reference to be removed. */ virtual void RemoveEvaluationListener(const SmartPointer& ref) = 0; /** * Get an IEvaluationContext that contains the current state of the * workbench application context. This context changes with the application * state, but becomes invalid when the global current selection changes. *

* Note: This context should not be modified. *

* * @return the latest context. * @see ISources#ACTIVE_CURRENT_SELECTION_NAME */ virtual SmartPointer GetCurrentState() const = 0; /** * Request that this service re-evaluate all registered core expressions * that contain a property tester for the given property name. This will * fire a {@link #PROP_NOTIFYING} property change event to service * listeners. *

* Notes: *

    *
  • the property must be able to return the new value before this * re-evaluation is requested
  • *
  • limit calls to this method to avoid unnecessary churn
  • *
  • A re-evaluation that does not change the value of an expression will * not fire a property change event
  • *
*

* * @param propertyName * The fully qualified property name, like * org.eclipse.core.resources.name. Must not be * null. */ virtual void RequestEvaluation(const QString& propertyName) = 0; }; } Q_DECLARE_INTERFACE(berry::IEvaluationService, "org.blueberry.ui.IEvaluationService") #endif // BERRYIEVALUATIONSERVICE_H diff --git a/Plugins/org.blueberry.ui.qt/src/tweaklets/berryGuiWidgetsTweaklet.h b/Plugins/org.blueberry.ui.qt/src/tweaklets/berryGuiWidgetsTweaklet.h index a5a8a7288c..ce09eb7a02 100755 --- a/Plugins/org.blueberry.ui.qt/src/tweaklets/berryGuiWidgetsTweaklet.h +++ b/Plugins/org.blueberry.ui.qt/src/tweaklets/berryGuiWidgetsTweaklet.h @@ -1,206 +1,208 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef BERRYGUIWIDGETSTWEAKLET_H_ #define BERRYGUIWIDGETSTWEAKLET_H_ #include "internal/berryTweaklets.h" #include "guitk/berryGuiTkISelectionListener.h" #include "guitk/berryGuiTkIControlListener.h" #include "berryShell.h" //#include "commands/berryIMenu.h" //#include "commands/berryIMenuItem.h" namespace berry { struct BERRY_UI_QT GuiWidgetsTweaklet { static Tweaklets::TweakKey KEY; virtual void AddSelectionListener(QWidget* widget, GuiTk::ISelectionListener::Pointer listener) = 0; virtual void RemoveSelectionListener(QWidget* widget, GuiTk::ISelectionListener::Pointer listener) = 0; /** * Adds the listener to the collection of listeners who will * be notified when the widget is moved or resized, by sending * it one of the messages defined in the IControlListener * interface. * + * @param widget * @param listener the listener which should be notified * * @see IControlListener * @see #RemoveControlListener */ virtual void AddControlListener(QWidget* widget, GuiTk::IControlListener::Pointer listener) = 0; /** * Removes the listener from the collection of listeners who will * be notified when the widget is moved or resized. * + * @param widget * @param listener the listener which should no longer be notified * * @see IControlListener * @see #AddControlListener */ virtual void RemoveControlListener(QWidget* widget, GuiTk::IControlListener::Pointer listener) = 0; virtual bool GetEnabled(QWidget* widget) = 0; virtual void SetEnabled(QWidget* widget, bool enabled) = 0; virtual void SetBounds(QWidget* widget, const QRect& bounds) = 0; virtual QRect GetBounds(QWidget* widget) = 0; virtual void SetVisible(QWidget* widget, bool visible) = 0; virtual bool GetVisible(QWidget* widget) = 0; virtual bool IsVisible(QWidget* widget) = 0; virtual QRect GetClientArea(QWidget* widget) = 0; virtual QWidget* GetParent(QWidget* widget) = 0; virtual bool SetParent(QWidget* widget, QWidget* parent) = 0; virtual void SetData(QWidget* widget, const QString& id, Object::Pointer data) = 0; virtual Object::Pointer GetData(QWidget* widget, const QString& id) = 0; virtual QPoint GetCursorLocation() = 0; virtual QWidget* GetCursorControl() = 0; virtual QWidget* FindControl(const QList& shells, const QPoint& location) = 0; /** * Determines if one control is a child of another. Returns true iff the second * argument is a child of the first (or the same object). * * @param potentialParent * @param childToTest * @return */ virtual bool IsChild(QWidget* potentialParent, QWidget* childToTest) = 0; /** * Returns the control which currently has keyboard focus, * or null if keyboard events are not currently going to * any of the controls built by the currently running * application. * * @return the control under the cursor */ virtual QWidget* GetFocusControl() = 0; virtual bool IsReparentable(QWidget* widget) = 0; virtual void MoveAbove(QWidget* widgetToMove, QWidget* widget) = 0; virtual void MoveBelow(QWidget* widgetToMove, QWidget* widget) = 0; virtual void Dispose(QWidget* widget) = 0; virtual Shell::Pointer CreateShell(Shell::Pointer parent, int style) = 0; virtual void DisposeShell(Shell::Pointer shell) = 0; virtual QWidget* CreateComposite(QWidget* parent) = 0; virtual QList GetShells() = 0; virtual Shell::Pointer GetShell(QWidget* widget) = 0; virtual Shell::Pointer GetActiveShell() = 0; // command framework interface classes //virtual IMenu::Pointer CreateMenu(QWidget*, IMenu::Style = IMenu::POP_UP) = 0; //virtual IMenu::Pointer CreateMenu(IMenu::Pointer parent) = 0; //virtual IMenuItem::Pointer CreateMenuItem(IMenu::Pointer, IMenuItem::Style, int index = -1) = 0; /** * @brief returns the coordinates of the center point of the primary screen * (where the application starts) of the current desktop. * * @param i the number of the screen (if there are multiple). If i = -1 * a rectangle representing the size of the virtual desktop is returned. * @return the screen Geometry. * @see GetScreenNumber() * @see GetPrimaryScreenNumber() */ virtual QRect GetScreenSize(int i = -1) = 0; virtual QRect GetAvailableScreenSize(int i = -1) = 0; virtual int GetClosestScreenNumber(const QRect&) = 0; /** * @brief Gets the number of available screens in a multi-screen environment. * * @return the number of available screens in a multi-screen environment. */ virtual unsigned int GetScreenNumber() = 0; /** * @brief Gets the number of the primary screen. * * @return the number of the primary screen. */ virtual int GetPrimaryScreenNumber() = 0; /** * Converts the given rectangle from display coordinates to the local coordinate system * of the given object * * @param coordinateSystem local coordinate system (widget) being converted to * @param toConvert rectangle to convert * @return a rectangle in control coordinates * @since 3.0 */ virtual QRect ToControl(QWidget* coordinateSystem, const QRect& toConvert) = 0; /** * Converts the given point from display coordinates to the local coordinate system * of the given object * * @param coordinateSystem local coordinate system (widget) being converted to * @param toConvert point to convert * @return a point in control coordinates * @since 3.0 */ virtual QPoint ToControl(QWidget* coordinateSystem, const QPoint& toConvert) = 0; /** * Converts the given rectangle from the local coordinate system of the given object * into display coordinates. * * @param coordinateSystem local coordinate system (widget) being converted from * @param toConvert rectangle to convert * @return a rectangle in display coordinates * @since 3.0 */ virtual QRect ToDisplay(QWidget* coordinateSystem, const QRect& toConvert) = 0; /** * Converts the given point from the local coordinate system of the given object * into display coordinates. * * @param coordinateSystem local coordinate system (widget) being converted from * @param toConvert point to convert * @return a point in display coordinates * @since 3.0 */ virtual QPoint ToDisplay(QWidget* coordinateSystem, const QPoint& toConvert) = 0; }; } Q_DECLARE_INTERFACE(berry::GuiWidgetsTweaklet, "org.blueberry.GuiWidgetsTweaklet") #endif /* BERRYGUIWIDGETSTWEAKLET_H_ */