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 <org_blueberry_core_commands_Export.h> namespace berry { /** * <p> * This class is a partial implementation of <code>IHandler</code>. 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}. * </p> */ 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 <code>true</code> - * @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 <code>null</code> * @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 <code>true</code> */ 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. * <p> * 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 <code>AbstractHandler</code> in * <code>org.blueberry.ui.workbench</code>, and clients should be wary of * overriding this behaviour. If this method is overridden, then the first * line of the method should be "<code>super.fireHandlerChanged(handlerEvent);</code>". * </p> * * @param handlerEvent * the event describing changes to this instance. Must not be * <code>null</code>. */ void FireHandlerChanged(const SmartPointer<HandlerEvent>& 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); /** * <p> * Returns true iff there is one or more IHandlerListeners attached to this * AbstractHandler. * </p> * <p> * 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 <code>AbstractHandler</code> in * <code>org.blueberry.ui.qt</code>, and clients should be wary of * overriding this behaviour. If this method is overridden, then the return * value should include "<code>super.hasListeners() ||</code>". * </p> * * @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 <berryICommandListener.h> #include <berryIHandlerListener.h> #include <berryIExecutionListenerWithChecks.h> #include <berryIParameter.h> #include <berryParameterType.h> namespace berry { class CommandCategory; class ExecutionEvent; struct IHandler; /** * <p> * 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. * </p> * <p> * 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 * <code>handlers</code> extension point). This provides another level of * indirection. * </p> * <p> * 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 <code>NotDefinedException</code>. If * you need to know when a command changes from defined to undefined (or vice * versa), then attach a command listener. * </p> * <p> * Commands are mutable and will change as their definition changes. * </p> * */ class BERRY_COMMANDS Command : public NamedHandleObjectWithState, private IHandlerListener { // implements Comparable { public: berryObjectMacro(Command); /** * This flag can be set to <code>true</code> if commands should print * information to <code>System.out</code> when executing. */ static bool DEBUG_COMMAND_EXECUTION; /** * This flag can be set to <code>true</code> if commands should print * information to <code>System.out</code> 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 <code>System.out</code> when * changing handlers. */ static QString DEBUG_HANDLERS_COMMAND_ID; private: /** * The category to which this command belongs. This value should not be * <code>null</code> unless the command is undefined. */ SmartPointer<CommandCategory> 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 * <code>null</code> if there is no handler currently. */ SmartPointer<IHandler> handler; /** * The help context identifier for this command. This can be * <code>null</code> 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 <code>null</code> if there are no parameters, or if the command * is undefined. It may also be empty. */ QList<SmartPointer<IParameter> > parameters; /** * The type of the return value of this command. This value may be * <code>null</code> if the command does not declare a return type. */ SmartPointer<ParameterType> returnType; protected: /** * Constructs a new instance of <code>Command</code> based on the given * identifier. When a command is first constructed, it is undefined. * Commands should only be constructed by the <code>CommandManager</code> * to ensure that the identifier remains unique. * * @param id * The identifier for the command. This value must not be * <code>null</code>, 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 <code>null</code>. */ 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 <code>null</code>. */ void AddExecutionListener(IExecutionListener* executionListener); /** * <p> * 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}. * </p> * <p> * A single instance of {@link State} cannot be registered with multiple * commands. Each command requires its own unique instance. * </p> * * @param id * The identifier of the state to add; must not be * <code>null</code>. * @param state * The state to add; must not be <code>null</code>. */ void AddState(const QString& id, const SmartPointer<State>& 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 * <code>Command</code>. * @return false if the object is * equal to or greater than this command. */ bool operator<(const Object* object) const override; /** * <p> * Defines this command by giving it a name, and possibly a description as * well. The defined property automatically becomes <code>true</code>. * </p> * <p> * Notification is sent to all listeners that something has changed. * </p> * * @param name * The name of this command; must not be <code>null</code>. * @param description * The description for this command; may be <code>null</code>. * @param category * The category for this command; must not be <code>null</code>. * @param parameters * The parameters understood by this command. This value may be * either <code>null</code> or empty if the command does not * accept parameters. * @param returnType * The type of value returned by this command. This value may be * <code>null</code> if the command does not declare a return * type. * @param helpContextId * The identifier of the help context to associate with this * command; may be <code>null</code> if this command does not * have any help associated with it. */ void Define(const QString& name, const QString& description, const SmartPointer<CommandCategory> category, const QList<SmartPointer<IParameter> >& parameters = QList<SmartPointer<IParameter> >(), const SmartPointer<ParameterType>& returnType = SmartPointer<ParameterType>(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 <code>null</code>. * @return The result of the execution; may be <code>null</code>. 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<const ExecutionEvent> 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 * <code>null</code>. */ void FireCommandChanged(const SmartPointer<const CommandEvent> 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 * <code>null</code>. * @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 * <code>null</code>. */ 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 * <code>null</code>. */ 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 <code>null</code>. * 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 <code>null</code>. */ 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 <code>null</code>. */ void FirePreExecute(const SmartPointer<const ExecutionEvent> 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. * <p> * This value can change at any time and should never be cached. * </p> * * @return The current handler for this command; may be <code>null</code>. */ SmartPointer<IHandler> 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 * <code>null</code> if there is none. */ QString GetHelpContextId() const; /** * Returns the parameter with the provided id or <code>null</code> 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 <code>null</code> if this * command does not have a parameter with the id. * @throws NotDefinedException * If the handle is not currently defined. */ SmartPointer<IParameter> 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 * <code>null</code>, if the command has no parameters. * @throws NotDefinedException * If the handle is not currently defined. */ QList<SmartPointer<IParameter> > GetParameters() const; /** * Returns the {@link ParameterType} for the parameter with the provided id * or <code>null</code> 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 <code>null</code> if this command does not have a parameter * type with the provided id. * @throws NotDefinedException * If the handle is not currently defined. */ SmartPointer<ParameterType> GetParameterType(const QString& parameterId) const; /** * Returns the {@link ParameterType} for the return value of this command or * <code>null</code> if this command does not declare a return value * parameter type. * * @return The {@link ParameterType} for the return value of this command or * <code>null</code> if this command does not declare a return * value parameter type. * @throws NotDefinedException * If the handle is not currently defined. */ SmartPointer<ParameterType> GetReturnType() const; /** * Returns whether this command has a handler, and whether this handler is * also handled and enabled. * * @return <code>true</code> if the command is handled; <code>false</code> * 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 <code>null</code> * 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 <code>true</code> if the command is handled; <code>false</code> * otherwise. */ bool IsHandled() const; /** * Removes a listener from this command. * * @param commandListener * The listener to be removed; must not be <code>null</code>. * */ void RemoveCommandListener(ICommandListener* commandListener); /** * Removes a listener from this command. * * @param executionListener * The listener to be removed; must not be <code>null</code>. * */ void RemoveExecutionListener(IExecutionListener* executionListener); /** * <p> * 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}. * </p> * * @param stateId * The identifier of the state to remove; must not be * <code>null</code>. */ 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 <code>handler</code>. * If debugging is turned on, then this will also print information about * the change to <code>System.out</code>. * * @param handler * The new handler; may be <code>null</code> if none. * @return <code>true</code> if the handler changed; <code>false</code> * otherwise. */ bool SetHandler(const SmartPointer<IHandler> 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>& 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 <code>null</code>. */ QString ToString() const override; /** * Makes this command become undefined. This has the side effect of changing * the name and description to <code>null</code>. 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 <QScopedPointer> namespace berry { struct IParameter; struct IHandler; class ParameterType; class ParameterizedCommand; class Parameterization; class Command; class CommandCategory; /** * <p> * 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. * </p> * * @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<const CommandCategoryEvent>& categoryEvent) override; private: CommandManager* commandManager; }; QScopedPointer<ICommandCategoryListener> categoryListener; struct CommandListener: public ICommandListener { CommandListener(CommandManager* commandManager); void CommandChanged(const SmartPointer<const CommandEvent>& commandEvent) override; private: CommandManager* commandManager; }; QScopedPointer<ICommandListener> commandListener; struct ParameterTypeListener: public IParameterTypeListener { ParameterTypeListener(CommandManager* commandManager); void ParameterTypeChanged( const SmartPointer<const ParameterTypeEvent>& parameterTypeEvent) override; private: CommandManager* commandManager; }; QScopedPointer<IParameterTypeListener> parameterTypeListener; public: /** * The identifier of the category in which all auto-generated commands will * appear. This value must never be <code>null</code>. */ 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 <code>null</code>. */ 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 <code>null</code>. */ 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 <code>null</code>. + * {@link #GetCategory} is called with <code>null</code>. * * @param name * The name of the category for uncategorized commands; must not * be <code>null</code>. * @param description * The description of the category for uncategorized commands; * may be <code>null</code>. */ void DefineUncategorizedCategory(const QString& name, const QString& description); /** * <p> * Returns a {@link ParameterizedCommand} with a command and * parameterizations as specified in the provided * <code>serializedParameterizedCommand</code> string. The * <code>serializedParameterizedCommand</code> 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. * </p> * <p> * If a parameter id encoded in the * <code>serializedParameterizedCommand</code> 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 * <code>serializedParameterizedCommand</code>. This will not result in * an exception, but in this case the value of the parameter when the * command is executed is unspecified. * </p> * <p> * This method will never return <code>null</code>, however it may throw * an exception if there is a problem processing the serialization string or * the encoded command is undefined. * </p> * * @param serializedParameterizedCommand * a string representing a command id and parameter ids and * values; must not be <code>null</code> * @return a {@link ParameterizedCommand} with the command and * parameterizations encoded in the * <code>serializedParameterizedCommand</code>; never * <code>null</code>. * @throws NotDefinedException * if the command indicated in * <code>serializedParameterizedCommand</code> is not defined * @throws SerializationException * if there is an error deserializing * <code>serializedParameterizedCommand</code> * @see ParameterizedCommand#serialize() */ SmartPointer<ParameterizedCommand> 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 <code>null</code>. */ QList<SmartPointer<Command> > 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 <code>null</code>. If * the category is <code>null</code>, then a category suitable * for uncategorized items is defined and returned. * @return The category with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see Category */ SmartPointer<CommandCategory> 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 <code>null</code> and * must not be zero-length. * @return The command with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see Command */ SmartPointer<Command> GetCommand(const QString& commandId); /** * Returns the categories that are defined. * * @return The defined categories; this value may be empty, but it is never * <code>null</code>. */ QList<SmartPointer<CommandCategory> > 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 <code>null</code>. */ QSet<QString> 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 <code>null</code>. */ QSet<QString> GetDefinedCommandIds() const; /** * Returns the commands that are defined. * * @return The defined commands; this value may be empty, but it is never * <code>null</code>. */ QList<SmartPointer<Command> > 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 <code>null</code>. */ QSet<QString> 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 <code>null</code>. */ QList<SmartPointer<ParameterType> > 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 <code>null</code> is returned. * * @param command * The command for which the help context should be retrieved; * must not be <code>null</code>. * @return The help context identifier to use for the given command; may be * <code>null</code>. * @throws NotDefinedException * If the given command is not defined. */ QString GetHelpContextId(const SmartPointer<const Command> 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 <code>null</code> and * must not be zero-length. * @return The {@link ParameterType} with the given identifier; this value * will never be <code>null</code>, but it might be undefined. */ SmartPointer<ParameterType> GetParameterType(const QString& parameterTypeId); /** * Removes a listener from this command manager. * * @param listener * The listener to be removed; must not be <code>null</code>. */ void RemoveCommandManagerListener(ICommandManagerListener* listener); /** * Removes an execution listener from this command manager. * * @param listener * The listener to be removed; must not be <code>null</code>. */ void RemoveExecutionListener(IExecutionListener* listener); /** * Block updates all of the handlers for all of the commands. If the handler * is <code>null</code> 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 (<code>String</code>) to * handlers (<code>IHandler</code>). This map may be * <code>null</code> if all handlers should be cleared. * Similarly, if the map is empty, then all commands will become * unhandled. */ void SetHandlersByCommandId( const QHash<QString, SmartPointer<IHandler> >& 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 <code>null</code>. * @param helpContextId * The help context identifier to register; may be * <code>null</code> if the help context identifier should be * removed. */ void SetHelpContextId(const SmartPointer<IHandler> handler, const QString& helpContextId); /** * Fires the <code>notEnabled</code> event for * <code>executionListeners</code>. * <p> * <b>Note:</b> This supports bridging actions to the command framework, * and should not be used outside the framework. * </p> * * @param commandId * The command id of the command about to execute, never * <code>null</code>. * @param exception * The exception, never <code>null</code>. */ void FireNotEnabled(const QString& commandId, const NotEnabledException* exception); /** * Fires the <code>notDefined</code> event for * <code>executionListeners</code>. * <p> * <b>Note:</b> This supports bridging actions to the command framework, * and should not be used outside the framework. * </p> * * @param commandId * The command id of the command about to execute, never * <code>null</code>. * @param exception * The exception, never <code>null</code>. */ void FireNotDefined(const QString& commandId, const NotDefinedException* exception); /** * Fires the <code>preExecute</code> event for * <code>executionListeners</code>. * <p> * <b>Note:</b> This supports bridging actions to the command framework, * and should not be used outside the framework. * </p> * * @param commandId * The command id of the command about to execute, never * <code>null</code>. * @param event * The event that triggered the command, may be <code>null</code>. */ void FirePreExecute(const QString& commandId, const SmartPointer< const ExecutionEvent> event); /** * Fires the <code>postExecuteSuccess</code> event for * <code>executionListeners</code>. * <p> * <b>Note:</b> This supports bridging actions to the command framework, * and should not be used outside the framework. * </p> * * @param commandId * The command id of the command executed, never * <code>null</code>. * @param returnValue * The value returned from the command, may be <code>null</code>. */ void FirePostExecuteSuccess(const QString& commandId, Object::Pointer returnValue); /** * Fires the <code>postExecuteFailure</code> event for * <code>executionListeners</code>. * <p> * <b>Note:</b> This supports bridging actions to the command framework, * and should not be used outside the framework. * </p> * * @param commandId * The command id of the command executed, never * <code>null</code>. * @param exception * The exception, never <code>null</code>. */ 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. * <p> * See also ParameterizedCommand.escape(String) * </p> * * @param escapedText * a <code>String</code> that may contain escaped special * characters for command serialization. * @return a <code>String</code> representing <code>escapedText</code> * with any escaped characters replaced by their literal values * @throws SerializationException * if <code>escapedText</code> contains an invalid escape * sequence */ static QString Unescape(const QString& escapedText); /** * The map of category identifiers (<code>String</code>) to categories ( * <code>Category</code>). This collection may be empty, but it is never * <code>null</code>. */ QHash<QString, SmartPointer<CommandCategory> > categoriesById; /** * The set of identifiers for those categories that are defined. This value * may be empty, but it is never <code>null</code>. */ QSet<QString> definedCategoryIds; /** * The set of identifiers for those command parameter types that are * defined. This value may be empty, but it is never <code>null</code>. * */ QSet<QString> definedParameterTypeIds; /** * The execution listener for this command manager. This just forwards * events from commands controlled by this manager to listeners on this * manager. */ QScopedPointer<IExecutionListenerWithChecks> executionListener; /** * The collection of execution listeners. This collection is * <code>null</code> 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 <code>null</code>. Entries are * removed if all strong references to the handler are removed. */ QHash<WeakPointer<IHandler>, QString> helpContextIdsByHandler; /** * The map of parameter type identifiers (<code>String</code>) to * parameter types ( <code>ParameterType</code>). This collection may be * empty, but it is never <code>null</code>. */ QHash<QString, SmartPointer<ParameterType> > 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 * <code>null</code>. */ void FireCommandManagerChanged( const SmartPointer<const CommandManagerEvent> event); /** * Returns an array of parameterizations for the provided command by * deriving the parameter ids and values from the provided * <code>serializedParameters</code> string. * * @param serializedParameters * a String encoding parameter ids and values; must not be * <code>null</code>. * @param parameters * array of parameters of the command being deserialized; may be * <code>null</code>. * @return an array of parameterizations; may be <code>null</code>. * @throws SerializationException * if there is an error deserializing the parameters */ QList<Parameterization> GetParameterizations( const QString& serializedParameters, const QList<SmartPointer<IParameter> >& parameters) const; /** * Searches for the index of a <code>char</code> in a <code>String</code> * 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 <code>ch</code> in * @param ch * a character to search for in <code>escapedText</code> * @return the index of the first unescaped occurrence of the character in * <code>escapedText</code>, or <code>-1</code> 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 <berryMacros.h> #include "berryCommand.h" #include <QHash> namespace berry { /** * <p> * 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. * </p> * <p> * 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. * </p> */ class BERRY_COMMANDS ExecutionEvent : public Object { public: berryObjectMacro(ExecutionEvent); typedef QHash<QString, QString> 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 * <code>null</code>. */ const Object::Pointer applicationContext; /** * The command being executed. This value may be <code>null</code>. */ 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 <code>null</code>. */ 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 <code>null</code>. */ const Object::ConstPointer trigger; public: /** * Constructs a new instance of <code>ExecutionEvent</code> with no * parameters, no trigger and no application context. This is just a * convenience method. */ ExecutionEvent(); /** * Constructs a new instance of <code>ExecutionEvent</code>. * * @param command * The command being executed; may be <code>null</code>. * @param parameters * The parameters to qualify the execution; must not be * <code>null</code>. This must be a map of parameter ids (<code>String</code>) * to parameter values (<code>String</code>). * @param trigger * The object that triggered the execution; may be * <code>null</code>. * @param applicationContext * The state of the application at the time the execution was * triggered; may be <code>null</code>. */ 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 <code>null</code>. */ 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. * <p> * 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 <code>ExecutionException</code> to be thrown. * </p> * * @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 <code>null</code>. * @return The parameter value; <code>null</code> if the parameter cannot * be found. */ QString GetParameter(const QString ¶meterId) const; /** * Returns all of the parameters. * * @return The parameters; never <code>null</code>, but may be empty. */ const ParameterMap& GetParameters() const; /** * Returns the object that triggered the execution * * @return The trigger; <code>null</code> 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 <org_blueberry_core_expressions_Export.h> #include "Poco/Any.h" #include <vector> #include <QHash> namespace berry { /** * A default implementation of an evaluation context. * <p> * Clients may instantiate this default context. The class is * not intended to be subclassed by clients. * </p> * * @since 3.0 */ class BERRY_EXPRESSIONS EvaluationContext : public IEvaluationContext { private: IEvaluationContext* const fParent; Object::ConstPointer fDefaultVariable; QHash<QString, Object::ConstPointer> fVariables; std::vector<IVariableResolver*> fVariableResolvers; int fAllowPluginActivation; public: /** * Create a new evaluation context with the given parent and default * variable. * * @param parent the parent context. Can be <code>null</code>. * @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 <code>null</code>. * @param defaultVariable the default variable * @param resolvers an array of <code>IVariableResolvers</code> to * resolve additional variables. * - * @see #resolveVariable(String, Object[]) + * @see #ResolveVariable */ EvaluationContext(IEvaluationContext* parent, const Object::ConstPointer& defaultVariable, const std::vector<IVariableResolver*>& 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<Object::Pointer>& 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 <string> #include <org_blueberry_core_expressions_Export.h> #include <berryObject.h> namespace berry { /** * An evaluation result represents the result of an expression * evaluation. There are exact three instances of evaluation * result. They are: <code>FALSE_EVAL</code>, <code>TRUE_EVAL</code> and * <code>NOT_LOADED</code>. <code>NOT_LOADED</code> represents * the fact that an expression couldn't be evaluated since a * plug-in providing certain test expressions isn't loaded yet. * <p> * In addition the class implements the three operation <code>and * </code>, <code>or</code> and <code>not</code>. The operation are * defined as follows: * </p> * <p> * The and operation: * </p> * <table border="1" cellpadding="5"> - * <colgroup> - * <col width="120"> - * <col width="120"> - * <col width="120"> - * <col width="120"> - * </colgroup> - * <tbody> * <tr> * <td><em>AND</em></td> * <td>FALSE_EVAL</td> * <td>TRUE_EVAL</td> * <td>NOT_LOADED</td> * </tr> * <tr> * <td>FALSE_EVAL</td> * <td>FALSE_EVAL</td> * <td>FALSE_EVAL</td> * <td>FALSE_EVAL</td> * </tr> * <tr> * <td>TRUE_EVAL</td> * <td>FALSE_EVAL</td> * <td>TRUE_EVAL</td> * <td>NOT_LOADED</td> * </tr> * <tr> * <td>NOT_LOADED</td> * <td>FALSE_EVAL</td> * <td>NOT_LOADED</td> * <td>NOT_LOADED</td> * </tr> - * </tbody> * </table> * <p> * The or operation: * </p> * <table border="1" cellpadding="5"> - * <colgroup> - * <col width="120"> - * <col width="120"> - * <col width="120"> - * <col width="120"> - * </colgroup> - * <tbody> * <tr> * <td><em>OR</em></td> * <td>FALSE_EVAL</td> * <td>TRUE_EVAL</td> * <td>NOT_LOADED</td> * </tr> * <tr> * <td>FALSE_EVAL</td> * <td>FALSE_EVAL</td> * <td>TRUE_EVAL</td> * <td>NOT_LOADED</td> * </tr> * <tr> * <td>TRUE_EVAL</td> * <td>TRUE_EVAL</td> * <td>TRUE_EVAL</td> * <td>TRUE_EVAL</td> * </tr> * <tr> * <td>NOT_LOADED</td> * <td>NOT_LOADED</td> * <td>TRUE_EVAL</td> * <td>NOT_LOADED</td> * </tr> - * </tbody> * </table> * <p> * The not operation: * </p> * <table border="1" cellpadding="5"> - * <colgroup> - * <col width="120"> - * <col width="120"> - * <col width="120"> - * <col width="120"> - * </colgroup> - * <tbody> * <tr> - * <td><em>NOT<em></td> + * <td><em>NOT</em></td> * <td>FALSE_EVAL</td> * <td>TRUE_EVAL</td> * <td>NOT_LOADED</td> * </tr> * <tr> * <td></td> * <td>TRUE_EVAL</td> * <td>FALSE_EVAL</td> * <td>NOT_LOADED</td> * </tr> - * </tbody> * </table> * * <p> * The class is not intended to be subclassed by clients. * </p> * @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<const EvaluationResult> FALSE_EVAL; /** The evaluation result representing the value TRUE */ static const SmartPointer<const EvaluationResult> TRUE_EVAL; /** The evaluation result representing the value NOT_LOADED */ static const SmartPointer<const EvaluationResult> NOT_LOADED; private: static const SmartPointer<const EvaluationResult> AND[3][3]; static const SmartPointer<const EvaluationResult> OR[3][3]; static const SmartPointer<const EvaluationResult> NOT[3]; /* * No instances outside of <code>EvaluationResult</code> */ EvaluationResult(int value); EvaluationResult(const EvaluationResult& o); public: berryObjectMacro(berry::EvaluationResult); bool operator==(const Object*) const override; bool operator!=(const Object*) const; /** * Returns an <code>EvaluationResult</code> whose value is <code>this && other)</code>. * * @param other the right hand side of the and operation. * * @return <code>this && other</code> as defined by the evaluation result */ EvaluationResult::ConstPointer And(const EvaluationResult::ConstPointer& other) const; /** * Returns an <code>EvaluationResult</code> whose value is <code>this || other)</code>. * * @param other the right hand side of the or operation. * * @return <code>this || other</code> 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 * <code>TRUE_EVAL</code> then <code>ExpressionResult.TRUE_EVAL</code> * is returned. If the value is <code>FALSE_EVAL</code> then <code> * ExpressionResult.FALSE_EVAL</code> 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 <org_blueberry_core_expressions_Export.h> #include <berryMacros.h> #include <berryObject.h> namespace berry { /** * Abstract base class for all expressions provided by the common * expression language. * <p> - * An expression is evaluated by calling {@link #evaluate(IEvaluationContext)}. + * An expression is evaluated by calling {@link #Evaluate}. * </p> * <p> * This class may be subclassed to provide specific expressions. * </p> */ 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 <code>value</code>). */ 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 - * <code>equals(Object)</code> method of the <code>left</code> object. - * This method handles <code>null</code> for either the <code>left</code> - * or <code>right</code> object. - * - * @param left the first object to compare; may be <code>null</code>. - * @param right the second object to compare; may be <code>null</code>. - * @return <code>TRUE_EVAL</code> if the two objects are equivalent; - * <code>FALSE_EVAL</code> 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 <code>null</code>, but their elements may be * <code>null</code>. * * @param leftArray the left array to compare; may be <code>null</code>, and * may be empty and may contain <code>null</code> elements. * @param rightArray the right array to compare; may be <code>null</code>, * and may be empty and may contain <code>null</code> elements. * * @return <code>TRUE_EVAL</code> if the arrays are equal length and the elements * at the same position are equal; <code>FALSE_EVAL</code> otherwise. */ static bool Equals(const QList<Expression::Pointer>& leftArray, const QList<Expression::Pointer>& rightArray); static bool Equals(const QList<Object::Pointer>& leftArray, const QList<Object::Pointer>& rightArray); /** * Returns the hash code for the given <code>object</code>. This method * handles <code>null</code>. * * @param object the object for which the hash code is desired; may be * <code>null</code>. * * @return The hash code of the object; zero if the object is * <code>null</code>. */ static uint HashCode(Expression::Pointer object); /** * Returns the hash code for the given array. This method handles * <code>null</code>. * * @param array the array for which the hash code is desired; may be * <code>null</code>. * @return the hash code of the array; zero if the object is * <code>null</code>. */ static uint HashCode(const QList<Expression::Pointer>& array); static uint HashCode(const QList<Object::Pointer>& array); /** * Method to compute the hash code for this object. The result * returned from this method is cached in the <code>fHashCode</code> * field. If the value returned from the method equals {@link #HASH_CODE_NOT_COMPUTED} * (e.g. <code>-1</code>) then the value is incremented by one. * <p> * This default implementation calls <code>super.hashCode()</code> * </p> * @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<const EvaluationResult> Evaluate(IEvaluationContext* context) const = 0; /** * Computes the expression information for the given expression tree. * <p> * This is a convenience method for collecting the expression information - * using {@link Expression#collectExpressionInfo(ExpressionInfo)}. + * using {@link Expression#CollectExpressionInfo}. * </p> * * @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<const EvaluationResult> Evaluate(IEvaluationContext* /*context*/) const override { return EvaluationResult::TRUE_EVAL; } void CollectExpressionInfo(ExpressionInfo* /*info*/) const override {} }; class FALSE_EVALExpression : public Expression { public: SmartPointer<const EvaluationResult> 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 <org_blueberry_core_expressions_Export.h> #include <berrySmartPointer.h> #include <QList> 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. * * <p> * 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. * </p> * * @since 3.0 */ class BERRY_EXPRESSIONS ExpressionConverter { private: QList<SmartPointer<ElementHandler> > 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<SmartPointer<ElementHandler> >& 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 <code>null</code> * 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<Expression> Perform(const SmartPointer<IConfigurationElement>& 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 <code>null</code> * 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<Expression> Perform(Poco::XML::Element* root); void ProcessChildren(const SmartPointer<IConfigurationElement>& element, const SmartPointer<CompositeExpression>& result); QString GetDebugPath(const SmartPointer<IConfigurationElement>& configurationElement); void ProcessChildren(Poco::XML::Element* element, const SmartPointer<CompositeExpression>& 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 <QSet> #include <typeinfo> #include <org_blueberry_core_expressions_Export.h> 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. * <p> * This class is not intended to be extended by clients. * </p> * * @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<QString> fAccessedVariableNames; QSet<QString> fMisbehavingExpressionTypes; QSet<QString> fAccessedPropertyNames; public: ExpressionInfo(); /** * Returns <code>true</code> 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 <code>true</code> 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<QString> 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<QString> 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 <code>null</code> if * all expressions implement the method. * * @return the set of expression types which don't implement the * <code>computeReevaluationInfo</code> method. */ QSet<QString> 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 <berryMacros.h> #include <berryObject.h> #include <org_blueberry_core_expressions_Export.h> 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. * <p> * This interface is not intended to be implemented by clients. Clients * are allowed to instantiate <code>EvaluationContext</code>. * </p> * * @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, <code>false</code> * will be returned. */ static Object::ConstPointer UNDEFINED_VARIABLE; ~IEvaluationContext() override; /** * Returns the parent context or <code>null</code> if * this is the root of the evaluation context hierarchy. * * @return the parent evaluation context or <code>null</code> */ 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 <code> * true</code> and the actual test expression must have the * attribute <code>forcePluginActivation</code> set to <code> * true</code> 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 <code>false</code> * 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 <code>null</code> 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 <code>null</code> 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 <code>null</code> 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 <code>resolve</code> 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 <code>null</code> 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<Object::Pointer>& 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 <berryObject.h> #include <berryMacros.h> #include <berryIStatus.h> #include <Poco/Timestamp.h> #include <org_blueberry_core_jobs_Export.h> 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 <code>-1</code> if not applicable for this type of event. * This value is only applicable for the <code>scheduled</code> 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<Job> GetJob() const = 0; /** * The result returned by the job's run method, or <code>null</code> if * not applicable. This value is only applicable for the <code>done</code> 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. * <p> * 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). * </p><p> * Clients should not rely on the result of the <code>Job#GetState()</code> * 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. * </p><p> * Clients may implement this interface. * </p> * @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<const IJobChangeEvent::ConstPointer&> 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<IJobChangeListener, const IJobChangeEvent::ConstPointer&> 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<string> #include <org_blueberry_core_jobs_Export.h> #include "berryJob.h" #include "berryProgressProvider.h" #include "berryIProgressMonitor.h" #include "berryIJobChangeListener.h" #include<Poco/Thread.h> namespace berry { /** * The job manager provides facilities for scheduling, querying, and maintaining jobs * and locks. In particular, the job manager provides the following services: * <ul> * <li>Maintains a queue of jobs that are waiting to be run. Items can be added to * the queue using the <code>schedule</code> method.</li> * <li> @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.> </li> * * <li>Allows listeners to find out about progress on running jobs, and to find out * when jobs have changed states.</li> * <li> @todo Provides a factory for creating lock objects. Lock objects are smart monitors * that have strategies for avoiding deadlock. ></li> * * <li>Provide feedback to a client that is waiting for a given job or family of jobs * to complete.</li> * </ul> * * @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 <code>true</code> to force all worker * threads to be created as daemon threads. Set to <code>false</code> 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 <tt>beginRule</tt> must eventually be followed - // * by a matching call to <tt>endRule</tt> in the same thread and with the identical - // * rule instance. - // * <p> - // * Rules can be nested only if the rule for the inner <tt>beginRule</tt> - // * is contained within the rule for the outer <tt>beginRule</tt>. Rule containment - // * is tested with the API method <tt>ISchedulingRule.contains</tt>. Also, begin/end - // * pairs must be strictly nested. Only the rule that has most recently begun - // * can be ended at any given time. - // * <p> - // * A rule of <code>null</code> can be used, but will be ignored for scheduling - // * purposes. The outermost non-null rule in the thread will be used for scheduling. A - // * <code>null</code> rule that is begun must still be ended. - // * <p> - // * 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. - // * <p> - // * Note that <tt>endRule</tt> must be called even if <tt>beginRule</tt> fails. - // * The recommended usage is: - // * <pre> - // * final ISchedulingRule rule = ...; - // * try { - // * manager.beginRule(rule, monitor); - // * } finally { - // * manager.endRule(rule); - // * } - // * </pre> - // * - // * @param rule the rule to begin applying in this thread, or <code>null</code> - // * @param monitor a progress monitor, or <code>null</code> 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 <code>null</code> 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. * <p> * Recommended usage (this snippet runs two jobs in sequence in a * single progress group): - * <pre> - * 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(); - * } - * </pre> + * \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 <code>null</code> if there - // * is no currently running job. - // * - // * @return the job or <code>null</code> - // */ - //// virtual Job CurrentJob() = 0; - - ///** - // * Ends the application of a rule to the calling thread. Calls to <tt>endRule</tt> - // * must be preceded by a matching call to <tt>beginRule</tt> in the same thread - // * with an identical rule instance. - // * <p> - // * Rules can be nested only if the rule for the inner <tt>beginRule</tt> - // * is contained within the rule for the outer <tt>beginRule</tt>. 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 <code>null</code> 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 <code>true</code> if the job manager is idle, and * <code>false</code> otherwise * @since 3.1 */ virtual bool IsIdle()= 0; /** * Returns whether the job manager is currently suspended. * * @return <code>true</code> if the job manager is suspended, and * <code>false</code> 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. - // * <p> - // * 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. - // * </p> - // * <p> - // * 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. - // * </p> - // * - // * @param family the job family to join, or <code>null</code> to join all jobs. - // * @param monitor Progress monitor for reporting progress on how the - // * wait is progressing, or <code>null</code> 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 <code>suspend</code>. 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. - // * <p> - // * 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 <code>suspend</code>. 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. - // * <p> - // * Calling <code>resume</code> 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. - // * <p> - // * This method is for internal use by the platform-related plug-ins. - // * Clients should not call this method. - // * </p> - // * @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. * <p> * This method is intended for use by the currently executing Eclipse application. * Plug-ins outside the currently running application should not call this method. * </p> * * @param provider the new provider, or <code>null</code> 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. - * <p> - * The job manager will remain suspended until a subsequent call to - * <code>resume</code>. Further calls to <code>suspend</code> - * when the job manager is already suspended are ignored. - * <p> - * All attempts to join sleeping and waiting jobs while the job manager is - * suspended will return immediately. - * <p> - * 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. - // * <p> - // * While a rule is suspended, all calls to <code>beginRule</code> and - // * <code>endRule</code> on a suspended rule will not block the caller. - // * The rule remains suspended until a subsequent call to - // * <code>resume(ISchedulingRule)</code> with the identical rule instance. - // * Further calls to <code>suspend</code> with an identical rule prior to calling - // * <code>resume</code> are ignored. - // * </p> - // * <p> - // * 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. - // * </p> - // * 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 <code>null</code>. - // * @param monitor a progress monitor, or <code>null</code> 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 - // * <code>SLEEPING</code> 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. - // * <p> - // * Sleeping jobs can be resumed using <code>wakeUp</code>. - // * - // * @param family the job family to sleep, or <code>null</code> 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 <code>beginRule</code>. The destination thread must - // * not already own a scheduling rule. - // * <p> - // * Calling this method is equivalent to atomically calling <code>endRule</code> - // * in the calling thread followed by an immediate <code>beginRule</code> in - // * the destination thread. The destination thread is responsible for subsequently - // * calling <code>endRule</code> when it is finished using the rule. - // * <p> - // * 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 <code>null</code> 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 <org_blueberry_core_runtime_Export.h> #include <QObject> 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 <code>org.blueberry.osgi.applications</code> extension-point. * * <p> * Clients may implement this interface. * </p> */ 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 <code>BlueBerry.exitdata</code> 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.<p> * * Applications can return any object they like. If an <code>Integer</code> is returned * it is treated as the program exit code if BlueBerry is exiting. * <p> * Note: This method is called by the platform; it is not intended * to be called directly by clients. * </p> * @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<p> * * 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. * <p> * Note: This method is called by the platform; it is not intended * to be called directly by clients. * </p> */ 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 <org_blueberry_core_runtime_Export.h> #include <QHash> #include <QVariant> #include <QString> namespace berry { /** * The context used to start an application. * <p> * This interface is not intended to be implemented by clients. * </p> - * @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 <code>QStringList</code>. * <p> * * 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 <code>QStringList</code>. * <p> * * 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<QString, QVariant> 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 <org_blueberry_core_runtime_Export.h> #include <QSharedPointer> class ctkPlugin; namespace berry { template<typename A> class SmartPointer; struct IContributor; /** * The contributor factory creates new registry contributors for use in the registry. * <p> * This class can not be extended or instantiated by clients. * </p> - * @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 <code>null</code>. * * @param contributor plugin associated with the contribution * @return new registry contributor based on the Plugin */ static SmartPointer<IContributor> CreateContributor(const QSharedPointer<ctkPlugin>& contributor); /** * Returns the CTK plugin used to define this contributor. * * <p>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.</p> * * @param contributor plugin-based registry contributor * @return the actual CTK plugin associated with this contributor */ static QSharedPointer<ctkPlugin> Resolve(const SmartPointer<IContributor>& 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 <org_blueberry_core_runtime_Export.h> #include <vector> #include <typeinfo> namespace berry { /** * An adapter factory defines behavioral extensions for * one or more classes that implements the <code>IAdaptable</code> * interface. Adapter factories are registered with an * adapter manager. * <p> * This interface can be used without OSGi running. * </p><p> * Clients may implement this interface. * </p> * @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 <code>0</code> if * no such object can be found. * * A typical implementation would look like this: * * <code> * void* GetAdapter(void* adaptableObject, const std::type_info& adaptableType, const std::string& adapterType) * { * if (Image* img = CastHelper<Image>(adaptableObject, adaptableType)) * { * if (adapterType == "berry::IResource") * { * return new IResource(img->GetPath()); * } * } * return 0; * } * </code> * * @param adaptableObject the adaptable object being queried * (usually an instance of <code>IAdaptable</code>) - * @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 <code>0</code> 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. * <p> * This method is generally used by an adapter manager * to discover which adapter types are supported, in advance * of dispatching any actual <code>getAdapter</code> requests. * </p> * * @return the collection of adapter types */ virtual void GetAdapterList(std::vector<const std::type_info&>& 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 <berryMacros.h> #include <org_blueberry_core_runtime_Export.h> #include "berryPlatformObject.h" #include "berryIAdapterFactory.h" #include <QtPlugin> #include <typeinfo> 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 <code>IAdaptable</code> * interface) tunnel <code>IAdaptable.getAdapter</code> invocations to their * adapter manager's <code>IAdapterManger.getAdapter</code> method. The * adapter manager then forwards this request unmodified to the <code>IAdapterFactory.getAdapter</code> * method on one of the registered adapter factories. * <p> * Adapter factories can be registered programmatically using the <code>registerAdapters</code> * method. Alternatively, they can be registered declaratively using the * <code>org.blueberry.core.runtime.adapters</code> extension point. Factories registered * with this extension point will not be able to provide adapters until their * corresponding plugin has been activated. * <p> * The following code snippet shows how one might register an adapter of type * <code>com.example.acme.Sticky</code> on resources in the workspace. * <p> * - * <pre> + * \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); - * </pre> + * \endcode * * </p><p> * This interface can be used without OSGi running. * </p><p> * This interface is not intended to be implemented by clients. * </p> * @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. * <p> * 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 * <code>LoadAdapter</code> method instead. * * @param adaptable the adaptable object being queried (usually an instance * of <code>IAdaptable</code>) - * @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<typename A> A* GetAdapter(const Object* adaptable) { const char* typeName = qobject_interface_iid<A*>(); if (typeName == nullptr) { BERRY_WARN << "Error getting adapter for '" << Reflection::GetClassName(adaptable) << "': " << "Cannot get the interface id for type '" << Reflection::GetClassName<A>() << "'. It is probably missing a Q_DECLARE_INTERFACE macro in its header."; return nullptr; } return dynamic_cast<A*>(this->GetAdapter(adaptable, typeName, false)); } /** * Returns an object which is an instance of the given class name associated * with the given object. Returns <code>null</code> if no such object can * be found. * <p> * 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 <code>null</code>. * If activation of the plug-in providing the factory is required, use the * <code>loadAdapter</code> method instead. * * @param adaptable the adaptable object being queried (usually an instance * of <code>IAdaptable</code>) * @param adapterTypeName the fully qualified name of the type of adapter to look up * @return an object castable to the given adapter type, or <code>null</code> * 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 <code>adaptable</code> to an object of type <code>adapterTypeName</code>. * <p> * Note that a return value of <code>true</code> does not guarantee that * a subsequent call to <code>GetAdapter</code> 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 * <code>GetAdapter</code> 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 <code>IAdaptable</code>) - * @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 <code>true</code> if there is an adapter factory that claims * it can convert <code>adaptable</code> to an object of type <code>adapterType</code>, * and <code>false</code> otherwise. */ virtual bool HasAdapter(const Object* adaptableType, const QString& adapterType) = 0; template<typename A> int QueryAdapter(const Object* adaptable) { const char* typeName = qobject_interface_iid<A*>(); if (typeName == nullptr) { BERRY_WARN << "Error querying adapter manager for '" << Reflection::GetClassName(adaptable) << "': " << "Cannot get the interface id for type '" << Reflection::GetClassName<A>() << "'. 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 <code>adaptable</code> to an object of type <code>adapterTypeName</code>. * <p> * One of the following values can be returned:<ul> * <li>{@link berry::IAdapterManager::NONE} if no applicable adapter factory was found;</li> * <li>{@link berry::IAdapterManager::NOT_LOADED} if an adapter factory was found, but has not been loaded;</li> * <li>{@link berry::IAdapterManager::LOADED} if an adapter factory was found, and it is loaded.</li> * </ul></p> - * @param adaptable the adaptable object being queried (usually an instance + * @param adaptableType the adaptable object being queried (usually an instance * of <code>IAdaptable</code>) - * @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. * <p> * Note that unlike the <code>GetAdapter</code> 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 <code>GetAdapter</code> instead. * * @param adaptable the adaptable object being queried (usually an instance * of <code>IAdaptable</code>) - * @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<typename A> A* LoadAdapter(const Object* adaptable) { const char* typeName = qobject_interface_iid<A*>(); if (typeName == nullptr) { BERRY_WARN << "Error getting adapter for '" << Reflection::GetClassName(adaptable) << "': " << "Cannot get the interface id for type '" << Reflection::GetClassName<A>() << "'. It is probably missing a Q_DECLARE_INTERFACE macro in its header."; return nullptr; } return dynamic_cast<A*>(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 <code>UnregisterAdapters(IAdapterFactory*, const std::string&)</code> * 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 <org_blueberry_core_runtime_Export.h> #include "berrySmartPointer.h" #include <QList> 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. * <p> * This interface is not intended to be implemented by clients. * </p> - * @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<IExtension>& extension, const SmartPointer<Object>& 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<IExtension>& extension, const SmartPointer<Object>& 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<SmartPointer<Object> > UnregisterObject(const SmartPointer<IExtension>& 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<SmartPointer<Object> > GetObjects(const SmartPointer<IExtension>& 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 <berryObject.h> #include <berryLog.h> 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 (<code>plugin.xml</code>) file. * <p> * This interface also provides a way to create executable extension * objects. * </p> * <p> * 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 * <code>InvalidRegistryObjectException</code> 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. * </p><p> * This interface is not intended to be implemented by clients. * </p> - * @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. * <p> * The specified class is instantiated using its 0-argument public constructor. * <p> * Then the following checks are done:<br> * 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. * <p> * If the specified class implements {@link IExecutableExtensionFactory} * interface, the method {@link IExecutableExtensionFactory#Create()} * is invoked. * </p> * <p> * Unlike other methods on this object, invoking this method may activate * the plug-in. * </p> * * @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<class C> C* CreateExecutableExtension(const QString &propertyName) const { C* interface = qobject_cast<C*>(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<C*>() << "\", or you forgot the Q_INTERFACES macro."; } return interface; } /** * Returns the named attribute of this configuration element, or * <code>null</code> if none. * <p> * The names of configuration element attributes * are the same as the attribute names of the corresponding XML element. * For example, the configuration markup * <pre> * <bg pattern="stripes"/> * </pre> * corresponds to a configuration element named <code>"bg"</code> * with an attribute named <code>"pattern"</code> * with attribute value <code>"stripes"</code>. * </p> * <p> Note that any translation specified in the plug-in manifest * file is automatically applied. * </p> * * @param name the name of the attribute * @return attribute value, or <code>null</code> 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. * <p> * The names of configuration element attributes * are the same as the attribute names of the corresponding XML element. * For example, the configuration markup * <pre> * <bg color="blue" pattern="stripes"/> * </pre> * corresponds to a configuration element named <code>"bg"</code> * with attributes named <code>"color"</code> * and <code>"pattern"</code>. * </p> * * @return the names of the attributes * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual QList<QString> 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. * <p> * Each child corresponds to a nested * XML element in the configuration markup. * For example, the configuration markup - * <pre> - * <view> - *     <verticalHint>top</verticalHint> - *     <horizontalHint>left</horizontalHint> - * </view> - * </pre> + * \code{.unparsed} + * <view> + * <verticalHint>top</verticalHint> + * <horizontalHint>left</horizontalHint> + * </view> + * \endcode * corresponds to a configuration element, named <code>"view"</code>, * with two children. * </p> * * @return the child configuration elements * @throws InvalidRegistryObjectException if this configuration element is no longer valid - * @see #getChildren(String) */ virtual QList<IConfigurationElement::Pointer> 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<IConfigurationElement::Pointer> 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<IExtension> 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 * <pre> * <wizard name="Create Project"/> * </pre> * corresponds to a configuration element named <code>"wizard"</code>. * * @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 <code>IExtension</code>. * Otherwise the returned value can be downcast to * <code>IConfigurationElement</code>. * * @return the parent of this configuration element * or <code>null</code> * @throws InvalidRegistryObjectException if this configuration element is no longer valid */ virtual SmartPointer<Object> GetParent() const = 0; /** * Returns the text value of this configuration element. * For example, the configuration markup - * <pre> - * <script lang="javascript">.\scripts\cp.js</script> - * </pre> - * corresponds to a configuration element <code>"script"</code> + * \code{.unparsed} + * <script lang="javascript">./scripts/cp.js</script> + * \endcode + * corresponds to a configuration element <code>"script"</code> * with value <code>".\scripts\cp.js"</code>. * <p> Values may span multiple lines (i.e., contain carriage returns * and/or line feeds). * <p> Note that any translation specified in the plug-in manifest * file is automatically applied. * </p> * * @return the text value of this configuration element or <code>null</code> * @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 <code>null</code> if none. * <p> * 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. * </p><p> * If multi-language support is not enabled, this method is equivalent to the method - * {@link #getValue()}. + * {@link #GetValue()}. * </p> * @param locale the requested locale * @return the text value of this configuration element in the specified locale, * or <code>null</code> * @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<IContributor> GetContributor() const = 0; /** * Returns whether this configuration element object is valid. * * @return <code>true</code> if the object is valid, and <code>false</code> * 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 <org_blueberry_core_runtime_Export.h> namespace berry { /** * This interface describes a registry contributor - an entity that supplies information * to the extension registry. * <p> * 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. * </p><p> * This interface is not intended to be implemented or extended by clients. * </p> * @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 <berryObject.h> #include <QList> namespace berry { struct IConfigurationElement; struct IContributor; /** * An extension declared in a plug-in. * All information is obtained from the declaring plug-in's * manifest (<code>plugin.xml</code>) file. * <p> * 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 * <code>InvalidRegistryObjectException</code> 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. * </p><p> * This interface is not intended to be implemented by clients. * </p> - * @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 (<code>plugin.xml</code>) * 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<SmartPointer<IConfigurationElement> > 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<IContributor> 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. * <p> Note that any translation specified in the extension manifest * file is automatically applied. * <p> * * @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 <code>null</code> * 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 * (<code>'.'</code>) and must be unique within the defining host. * * @return the simple identifier of the extension (e.g. <code>"main"</code>) * or <code>null</code> * @throws InvalidRegistryObjectException if this extension is no longer valid */ virtual QString GetSimpleIdentifier() const = 0; /** * Returns the unique identifier of this extension, or <code>null</code> * 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. <code>"com.example.acme.main"</code>), or <code>null</code> * @throws InvalidRegistryObjectException if this extension is no longer valid */ virtual QString GetUniqueIdentifier() const = 0; /** * Returns whether this extension object is valid. * * @return <code>true</code> if the object is valid, and <code>false</code> * 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 <berryObject.h> 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 (<code>plugin.xml</code>) file. * <p> * 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 * <code>InvalidRegistryObjectException</code> 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. * </p> * <p> * This interface is not intended to be implemented by clients. * </p> - * @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<SmartPointer<IConfigurationElement> > 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<IContributor> GetContributor() const = 0; /** * Returns the extension with the given unique identifier configured into * this extension point, or <code>null</code> if there is no such extension. * Since an extension might not have an identifier, some extensions * can only be found via the <code>getExtensions</code> method. * * @param extensionId the unique identifier of an extension * (e.g. <code>"com.example.acme.main"</code>). * @return an extension, or <code>null</code> * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual SmartPointer<IExtension> 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<SmartPointer<IExtension> > 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. * <p> Note that any translation specified in the plug-in manifest * file is automatically applied. * </p> * * @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 (<code>'.'</code>) and is guaranteed * to be unique within the defining plug-in. * * @return the simple identifier of the extension point (e.g. <code>"builders"</code>) * @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. <code>"org.blueberry.core.resources.builders"</code>) * @throws InvalidRegistryObjectException if this extension point is no longer valid */ virtual QString GetUniqueIdentifier() const = 0; /** * Returns whether this extension point object is valid. * * @return <code>true</code> if the object is valid, and <code>false</code> * 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 <berrySmartPointer.h> #include <QList> 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. * <p> * The extension registry can be queried, by name, for * extension points and extensions. * </p> * <p> * 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 - * <code>isValid()</code> will throw {@link org.eclipse.core.runtime.InvalidRegistryObjectException}. + * <code>isValid()</code> 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 <code>isValid()</code>, 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 <code>InvalidRegistryObjectException</code> 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. * </p> * <p> * Extensions and extension points are declared by generic entities called - * <cite>namespaces</cite>. 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. * </p><p> * This interface is not intended to be implemented by clients. * </p> - * @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. <code>"org.blueberry.core.applications"</code>) * @return the configuration elements */ virtual QList<SmartPointer<IConfigurationElement> > 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. <code>"org.eclipse.core.resources"</code>) * @param extensionPointName the simple identifier of the * extension point (e.g. <code>"builders"</code>) * @return the configuration elements */ virtual QList<SmartPointer<IConfigurationElement> > 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. <code>"org.eclipse.core.resources"</code>) * @param extensionPointName the simple identifier of the * extension point (e.g. <code>"builders"</code>) * @param extensionId the unique identifier of the extension * (e.g. <code>"com.example.acme.coolbuilder"</code>) * @return the configuration elements */ virtual QList<SmartPointer<IConfigurationElement> > GetConfigurationElementsFor( const QString& namespaze, const QString& extensionPointName, const QString& extensionId) const = 0; /** * Returns the specified extension in this extension registry, * or <code>null</code> if there is no such extension. * * @param extensionId the unique identifier of the extension * (e.g. <code>"com.example.acme.coolbuilder"</code>) * @return the extension, or <code>null</code> */ virtual SmartPointer<IExtension> GetExtension(const QString& extensionId) const = 0; /** * Returns the specified extension in this extension registry, * or <code>null</code> 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. <code>"org.eclipse.core.resources.builders"</code>) * @param extensionId the unique identifier of the extension * (e.g. <code>"com.example.acme.coolbuilder"</code>) * @return the extension, or <code>null</code> */ virtual SmartPointer<IExtension> GetExtension(const QString& extensionPointId, const QString& extensionId) const = 0; /** * Returns the specified extension in this extension registry, * or <code>null</code> 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. <code>"org.eclipse.core.resources"</code>) * @param extensionPointName the simple identifier of the * extension point (e.g. <code>"builders"</code>) * @param extensionId the unique identifier of the extension * (e.g. <code>"com.example.acme.coolbuilder"</code>) * @return the extension, or <code>null</code> */ virtual SmartPointer<IExtension> 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 <code>null</code> if there is no such * extension point. * * @param extensionPointId the unique identifier of the extension point * (e.g., <code>"org.blueberry.core.applications"</code>) * @return the extension point, or <code>null</code> */ virtual SmartPointer<IExtensionPoint> GetExtensionPoint(const QString& extensionPointId) const = 0; /** * Returns the extension point in this extension registry * with the given namespace and extension point simple identifier, * or <code>null</code> 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. <code>"org.eclipse.core.resources"</code>) * @param extensionPointName the simple identifier of the * extension point (e.g. <code>"builders"</code>) * @return the extension point, or <code>null</code> */ virtual SmartPointer<IExtensionPoint> 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<SmartPointer<IExtensionPoint> > 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. <code>"org.eclipse.core.resources"</code>) * @return the extension points in this registry declared in the given namespace */ virtual QList<SmartPointer<IExtensionPoint> > GetExtensionPoints(const QString& namespaze) const = 0; /** * Returns all extension points supplied by the contributor, or <code>null</code> * 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 <code>null</code> * @since 3.4 */ virtual QList<SmartPointer<IExtensionPoint> > GetExtensionPoints( const SmartPointer<IContributor>& 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. <code>"org.eclipse.core.resources"</code>) * @return the extensions in this registry declared in the given namespace */ virtual QList<SmartPointer<IExtension> > GetExtensions(const QString& namespaze) const = 0; /** * Returns all extensions supplied by the contributor, or <code>null</code> 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 <code>null</code> */ virtual QList<SmartPointer<IExtension> > GetExtensions(const SmartPointer<IContributor>& 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. * <p> * 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. * </p> * @return all namespaces known to this registry */ virtual QList<QString> 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. * <p> * 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. * </p> * * @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 <code>false</code>, * 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 <code>QString()</code> * @param translationBundle optional translator used for translations; might be <code>nullptr</code> * @param token the key used to check permissions * @return <code>true</code> if the contribution was successfully processed and <code>false</code> otherwise * @throws ctkInvalidArgumentException if an incorrect token is passed * * @see IContributor */ virtual bool AddContribution(QIODevice* is, const SmartPointer<IContributor>& contributor, bool persist, const QString& name, QTranslator* translationBundle, QObject* token) = 0; /** * Removes the given extension from this registry. * <p> * 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. * </p> * * @param extension extension to be removed * @param token the key used to check permissions * @return <code>true</code> if the extension was successfully removed, and <code>false</code> otherwise * @throws ctkInvalidArgumentException if an incorrect token is passed */ virtual bool RemoveExtension(const SmartPointer<IExtension>& extension, QObject* token) = 0; /** * Removes the specified extension point from this registry. * <p> * 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. * </p> * * @param extensionPoint extension point to be removed * @param token the key used to check permissions * @return <code>true</code> if the extension point was successfully removed, and * <code>false</code> otherwise * @throws ctkInvalidArgumentException if incorrect token is passed */ virtual bool RemoveExtensionPoint(const SmartPointer<IExtensionPoint>& 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. * <p> * This method is an access controlled method. Master token should be passed as an argument. * </p> - * @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. * <p> * 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. * </p><p> * 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. * </p><p> * This method has no effect if the listener is already registered. * </p> * @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. * <p> * 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. * </p><p> * 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. * </p><p> * This method has no effect if the listener is already registered. * </p> * @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. * <p> * This method has no effect if the listener is not registered. * </p> * @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. * <p> * See the runtime option "-registryMultiLanguage" for enabling multi-language * support. * </p> * @return <code>true</code> if multiple languages are supported by this * instance of the extension registry; <code>false</code> 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 <berryObject.h> #include <org_blueberry_ui_qt_Export.h> 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: * <p> * * <pre> * 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); * </pre> * * </p> * <p> * Only the abstract methods may be implemented. * </p> * * @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 * <code>null</code>. - * @param namespace + * @param namespaze * the namespace for this contribution. May be <code>null</code>. - * @see #getNamespace() + * @see #GetNamespace */ AbstractContributionFactory(const QString& location, const QString& namespaze); /** * Return the location as a String. * * @return the location - never <code>null</code>. */ 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. * <p> * This method is not meant to be called by clients. It will be called by * the menu service at the appropriate time. * </p> * * @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 <code>null</code>. * @see org.eclipse.ui.menus.CommandContributionItem * @see org.eclipse.jface.action.MenuManager */ virtual void CreateContributionItems(IServiceLocator* serviceLocator, const SmartPointer<IContributionRoot>& 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 <QHash> #include <QIcon> #include <QKeySequence> #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 * <code>null</code>. */ IServiceLocator* serviceLocator; /** * The id for this item. May be <code>null</code>. Items without an id * cannot be referenced later. */ QString id; /** * A command id for a defined command. Must not be <code>null</code>. */ 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 * <code>null</code> */ QHash<QString, Object::Pointer> parameters; /** * An icon for this item. May be <code>null</code>. */ QIcon icon; /** * A label for this item. May be <code>null</code>. */ QString label; /** * A mnemonic for this item to be applied to the label. May be * <code>null</code>. */ 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 <code>null</code>. 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 * <code>null</code> */ 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 * <code>null</code>. * @param id * The id for this item. May be <code>null</code>. Items * without an id cannot be referenced later. * @param commandId * A command id for a defined command. Must not be * <code>null</code>. * @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. * <p> * <b>Note:</b> This constructor should not be called outside the framework. * </p> * * @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 * <code>null</code>. * @param id * The id for this item. May be <code>null</code>. Items * without an id cannot be referenced later. * @param commandId * A command id for a defined command. Must not be * <code>null</code>. * @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 <code>null</code> * @param icon * An icon for this item. May be <code>null</code>. - * @param disabledIcon - * A disabled icon for this item. May be <code>null</code>. - * @param hoverIcon - * A hover icon for this item. May be <code>null</code>. * @param label * A label for this item. May be <code>null</code>. * @param mnemonic * A mnemonic for this item to be applied to the label. May be * <code>null</code>. * @param tooltip * A tooltip for this item. May be <code>null</code>. 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 * <code>null</code> * @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<QString, Object::Pointer> ¶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 <org_blueberry_ui_qt_Export.h> 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 <code>IContributionItem</code> * method does nothing. Subclasses may override. */ void Fill(QStatusBar* parent) override; /** * The default implementation of this <code>IContributionItem</code> * method does nothing. Subclasses may override. */ void Fill(QMenu* menu, QAction* before) override; /** * The default implementation of this <code>IContributionItem</code> * method does nothing. Subclasses may override. */ void Fill(QMenuBar* menu, QAction* before) override; /** * The default implementation of this <code>IContributionItem</code> * method does nothing. Subclasses may override. */ void Fill(QToolBar* parent, QAction* before) override; /** * The default implementation of this <code>IContributionItem</code> * method does nothing. Subclasses may override. */ void SaveWidgetState() override; /* * Method declared on IContributionItem. */ QString GetId() const override; /** * Returns the parent contribution manager, or <code>null</code> if this * contribution item is not currently added to a contribution manager. * * @return the parent contribution manager, or <code>null</code> */ IContributionManager *GetParent() const; /** * The default implementation of this <code>IContributionItem</code> * method returns <code>false</code>. Subclasses may override. */ bool IsDirty() const override; /** * The default implementation of this <code>IContributionItem</code> * method returns <code>true</code>. Subclasses may override. */ bool IsEnabled() const override; /** * The default implementation of this <code>IContributionItem</code> * method returns <code>false</code>. Subclasses may override. */ bool IsDynamic() const override; /** * The default implementation of this <code>IContributionItem</code> * method returns <code>false</code>. Subclasses may override. */ bool IsGroupMarker() const override; /** * The default implementation of this <code>IContributionItem</code> * method returns <code>false</code>. Subclasses may override. */ bool IsSeparator() const override; /** * The default implementation of this <code>IContributionItem</code> * method returns the value recorded in an internal state variable, * which is <code>true</code> by default. <code>setVisible</code> * should be used to change this setting. */ bool IsVisible() const override; /** * The default implementation of this <code>IContributionItem</code> * method stores the value in an internal state variable, * which is <code>true</code> 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 <code>IContributionItem</code> * method does nothing. Subclasses may override. */ void Update() override; /* * Method declared on IContributionItem. */ void SetParent(IContributionManager* parent) override; /** * The <code>ContributionItem</code> implementation of this * method declared on <code>IContributionItem</code> 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 <code>null</code> id. * Calls <code>this(String)</code> with <code>null</code>. */ 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 <code>null</code> */ ContributionItem(const QString& id); private: /** * The identifier for this contribution item, of <code>null</code> if none. */ QString id; /** * Indicates this item is visible in its manager; <code>true</code> * 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 <code>IContributionManager</code>. This class provides * functionality common across the specific managers defined by this framework. * <p> * This class maintains a list of contribution items and a dirty flag, both as * internal state. In addition to providing implementations of most * <code>IContributionManager</code> 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 <code>update</code> method, which subclasses must * implement. * </p> * <p> * Note: A <code>ContributionItem</code> cannot be shared between different * <code>ContributionManager</code>s. * </p> */ 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<IContributionItem>& 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<IContributionItem>& item) override; /* * Method declared on IContributionManager. */ SmartPointer<IContributionItem> Find(const QString& id) const override; /* * Method declared on IContributionManager. */ QList<SmartPointer<IContributionItem> > GetItems() const override; /** * Return the number of contributions in this manager. * * @return the number of contributions in this manager */ int GetSize(); /** * The <code>ContributionManager</code> implementation of this method * declared on <code>IContributionManager</code> returns the current * overrides. If there is no overrides it lazily creates one which overrides * no item state. */ SmartPointer<IContributionManagerOverrides> GetOverrides() override; /** * Returns the index of the item with the given id. * * @param id * The id of the item whose index is requested. * * @return <code>int</code> 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<IContributionItem>& 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<IContributionItem>& 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<IContributionItem>& 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<IContributionItem>& item) override; /* * Method declared on IContributionManager. */ SmartPointer<IContributionItem> Remove(const QString& ID) override; /* * Method declared on IContributionManager. */ SmartPointer<IContributionItem> Remove(const SmartPointer<IContributionItem> &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 <code>null</code>. * @param replacementItem * The contribution item to replace the old item; must not be * <code>null</code>. Use - * {@link org.eclipse.jface.action.ContributionManager#remove(java.lang.String) remove} + * {@link ContributionManager#Remove} * if that is what you want to do. - * @return <code>true</code> if the given identifier can be; <code> + * @return <code>true</code> if the given identifier can be */ bool ReplaceItem(const QString &identifier, const SmartPointer<IContributionItem>& replacementItem); /** * Sets the overrides for this contribution manager * * @param newOverrides * the overrides for the items of this manager */ void SetOverrides(const SmartPointer<IContributionManagerOverrides>& newOverrides); protected: /** * Creates a new contribution manager. */ ContributionManager(); /** * This method allows subclasses of <code>ContributionManager</code> to * prevent certain items in the contributions list. * <code>ContributionManager</code> 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 <code>null</code>. * @return <code>true</code> if the addition should be allowed; * <code>false</code> otherwise. The default implementation allows * all items. */ virtual bool AllowItem(IContributionItem* itemToAdd); /** * Internal debug method for printing statistics about this manager to * <code>cout</code>. */ void DumpStatistics(); /** * Returns whether this contribution manager contains dynamic items. A * dynamic contribution item contributes items conditionally, dependent on * some internal state. * * @return <code>true</code> if this manager contains dynamic items, and * <code>false</code> otherwise */ bool HasDynamicItems() const; /** * Returns the index of the object in the internal structure. This is * different from <code>indexOf(String id)</code> 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<IContributionItem>& 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<IContributionItem>& 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<IContributionItem>& item); /** * Sets whether this manager is dirty. When dirty, the list of contributions * is not accurately reflected in the corresponding widgets. * * @param dirty * <code>true</code> if this manager is dirty, and * <code>false</code> 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<SmartPointer<IContributionItem> >& items); private: /** * The list of contribution items. */ QList<SmartPointer<IContributionItem> > 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<IContributionManagerOverrides> 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 * <code>true</code> to add to the end of the group, and * <code>false</code> 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<IContributionItem>& 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 <internal/berryAbstractGroupMarker.h> 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. * <p> * This class may be instantiated; it is not intended to be * subclassed outside the framework. * </p> - * @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 <code>null</code> 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 <code>GroupMarker</code> implementation of this method * returns <code>false</code> 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 <berryMacros.h> #include <berryObject.h> 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. * <p> * A contribution item can realize itself in different Qt widgets, using the different * <code>fill</code> methods. The same type of contribution item can be used with a * <code>MenuBarManager</code>, <code>ToolBarManager</code>, - * </code>or a <code>StatusLineManager</code>. + * or a <code>StatusLineManager</code>. * </p> * <p> * This interface is internal to the framework; it should not be implemented outside * the framework. * </p> * * @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 <code>StatusLineManager</code>. * * @param parent the parent control */ virtual void Fill(QStatusBar* parent) = 0; /** * Fills the given menu bar with controls representing this contribution item. * Used by <code>MenuBarManager</code>. * * @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 <code>MenuManager</code>. * * @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 <code>ToolBarManager</code>. * * @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 <code>null</code> * if none */ virtual QString GetId() const = 0; /** * Returns whether this contribution item is enabled. * * @return <code>true</code> 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 <code>true</code> 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 <code>true</code> if this item is dynamic, and * <code>false</code> 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 <code>true</code> if this item is a group marker, and * <code>false</code> 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 <code>true</code> if this item is a separator, and * <code>false</code> for normal items * @see Separator */ virtual bool IsSeparator() const = 0; /** * Returns whether this contribution item is visibile within its manager. * * @return <code>true</code> if this item is visible, and * <code>false</code> 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 <code>true</code> if this item should be visible, and * <code>false</code> 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 <berryMacros.h> #include <berryObject.h> class QAction; namespace berry { struct IContributionItem; struct IContributionManagerOverrides; /** * A contribution manager organizes contributions to such UI components * as menus, toolbars and status lines. * <p> * 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. * </p> * <p> * The <code>IContributionManager</code> 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. * </p> - * <p> - * There are several implementions of this interface in this package, - * including ones for menus ({@link MenuManager <code>MenuManager</code>}), - * tool bars ({@link ToolBarManager <code>ToolBarManager</code>}), - * and status lines ({@link StatusLineManager <code>StatusLineManager</code>}). - * </p> */ struct IContributionManager : public virtual Object { berryObjectMacro(berry::IContributionManager); /** * Adds an action as a contribution item to this manager. * Equivalent to <code>Add(IContributionItem::Pointer(new QActionContributionItem(action, id)))</code>. * * @param action the action, this cannot be <code>null</code> * @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 <code>null</code> */ virtual void Add(const SmartPointer<IContributionItem>& item) = 0; /** * Adds a contribution item for the given action at the end of the group * with the given name. * Equivalent to * <code>AppendToGroup(groupName,IContributionItem::Pointer(new QActionContributionItem(action, id)))</code>. * * @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<IContributionItem>& item) = 0; /** * Finds the contribution item with the given id. * * @param id the contribution item id * @return the contribution item, or <code>null</code> if * no item with the given id can be found */ virtual SmartPointer<IContributionItem> Find(const QString& id) const = 0; /** * Returns all contribution items known to this manager. * * @return a list of contribution items */ virtual QList<SmartPointer<IContributionItem> > GetItems() const = 0; /** * Returns the overrides for the items of this manager. * * @return the overrides for the items of this manager */ virtual SmartPointer<IContributionManagerOverrides> 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<IContributionItem>& 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<IContributionItem>& item) = 0; /** * Returns whether the list of contributions has recently changed and * has yet to be reflected in the corresponding widgets. * * @return <code>true</code> if this manager is dirty, and <code>false</code> * if it is up-to-date */ virtual bool IsDirty() const = 0; /** * Returns whether this manager has any contribution items. * * @return <code>true</code> if there are no items, and * <code>false</code> 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<IContributionItem>& item) = 0; /** * Removes and returns the contribution item with the given id from this manager. * Returns <code>null</code> 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 <code>null</code> if none */ virtual SmartPointer<IContributionItem> 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 <code>item</code> parameter if the item was removed, * and <code>null</code> if it was not found */ virtual SmartPointer<IContributionItem> Remove(const SmartPointer<IContributionItem>& 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 <code>true</code> means update even if not dirty, * and <code>false</code> 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 <berryMacros.h> #include <berryObject.h> #include <org_blueberry_ui_qt_Export.h> namespace berry { struct IContributionItem; /** * This interface is used by instances of <code>IContributionItem</code> * to determine if the values for certain properties have been overriden * by their manager. * <p> * This interface is internal to the framework; it should not be implemented outside * the framework. * </p> - * - * @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 <code>"enabled"</code>. */ 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 <ul> * <li><code>1</code> if the given contribution item should be enabled</li> * <li><code>0</code> if the item should not be enabled</li> * <li><code>-1</code> if the item may determine its own enablement</li> * </ul> */ virtual int GetEnabled(const IContributionItem* item) const = 0; /** * Visiblity override. * * @param item the contribution item in question * @return <ul> * <li><code>1</code> if the given contribution item should be visible</li> * <li><code>0</code> if the item should not be visible</li> * <li><code>-1</code> if the item may determine its own visibility</li> * </ul> */ 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 <berryObject.h> #include <org_blueberry_ui_qt_Export.h> namespace berry { struct IWorkbenchWindowConfigurer; struct IMenuManager; struct IToolBarManager; /** * Interface providing special access for configuring the action bars * of a workbench window. * <p> * Note that these objects are only available to the main application * (the plug-in that creates and owns the workbench). * </p> * <p> * This interface is not intended to be implemented by clients. * </p> * * @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<IWorkbenchWindowConfigurer> 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 * <code>MenuManager</code> 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 * <code>ToolBarManager</code> 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. * <p> * 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. * </p> * * @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 <org_blueberry_ui_qt_Export.h> #include <berryPlugin.h> namespace berry { template<class T> 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. * <p> * Subclasses obtain the following capabilities: * </p> * <p> * Preferences * <ul> * <li> The platform core runtime contains general support for plug-in * preferences (<code>org.blueberry.core.runtime.Preferences</code>). * This class provides appropriate conversion to the older JFace preference * API (<code>org.blueberry.jface.preference.IPreferenceStore</code>).</li> * <li> The method <code>getPreferenceStore</code> returns the JFace preference * store (cf. <code>Plugin.getPluginPreferences</code> which returns * a core runtime preferences object.</li> * <li> Subclasses may reimplement <code>initializeDefaultPreferences</code> * to set up any default values for preferences using JFace API. In this * case, <code>initializeDefaultPluginPreferences</code> should not be * overridden.</li> * <li> Subclasses may reimplement * <code>initializeDefaultPluginPreferences</code> to set up any default * values for preferences using core runtime API. In this * case, <code>initializeDefaultPreferences</code> should not be * overridden.</li> * <li> 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.</li> * </ul> * Dialogs * <ul> * <li> The dialog store is read the first time <code>getDialogSettings</code> * is called.</li> * <li> 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". </li> * <li> The dialog store is found in the file whose name is given by the * constant <code>FN_DIALOG_STORE</code>. 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.</li> * <li> Plug-in code can call <code>saveDialogSettings</code> 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. </li> * <li> Dialog settings are also saved automatically on plug-in shutdown.</li> * </ul> * <p> * 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 <code>getDefault</code> * method. * </p> * <p> * See the description on {@link Plugin}. * </p> */ class BERRY_UI_QT AbstractUICTKPlugin : public Plugin { Q_OBJECT private: /** * The name of the dialog settings file (value * <code>"dialog_settings.xml"</code>). */ static const QString FN_DIALOG_SETTINGS; - /** - * Storage for dialog and wizard data; <code>null</code> 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. * <p> * Plug-in runtime classes are <code>ctkPluginActivator</code>s 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. - * <p> - * If an error occurs reading the dialog store, an empty one is quietly created - * and returned. - * </p> - * <p> - * Subclasses may override this method but are not expected to. - * </p> - * - * @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. * <p> * If an error occurs reading the preferences service, an empty preference service is * quietly created, initialized with defaults, and returned. * </p> * * @return the preferences service */ IPreferencesService* GetPreferencesService() const; SmartPointer<IPreferences> GetPreferences() const; /** * Returns the Platform UI workbench. * <p> * This method exists as a convenience for plugin implementors. The * workbench can also be accessed by invoking <code>PlatformUI.getWorkbench()</code>. * </p> * @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. - * <p> - * The default implementation of this method creates an empty registry. - * Subclasses may override this method if needed. - * </p> - * - * @return ImageRegistry the resulting registry. - * @see #getImageRegistry - */ -// ImageRegistry createImageRegistry(); - - /** - * Initializes an image registry with images which are frequently used by the - * plugin. - * <p> - * 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. - * </p><p> - * 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. - * </p><p> - * Subclasses may override this method to fill the image registry. - * </p> - * @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. - * <p> - * This framework method may be overridden, although this is typically - * unnecessary. - * </p> - */ -// void loadDialogSettings(); - - - /** - * Refreshes the actions for the plugin. - * This method is called from <code>startup</code>. - * <p> - * This framework method may be overridden, although this is typically - * unnecessary. - * </p> - */ -// void refreshPluginActions(); - - /** - * Saves this plug-in's dialog settings. - * Any problems which arise are silently ignored. - */ -// void saveDialogSettings(); - - public: /** * The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code> * method refreshes the plug-in actions. Subclasses may extend this method, * but must send super <b>first</b>. + * + * \param context */ void start(ctkPluginContext* context) override; /** * The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code> * 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 <b>last</b>. A try-finally statement should * be used where necessary to ensure that <code>super.shutdown()</code> 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. * <p> * 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". * </p> * * @param pluginId the id of the plug-in containing the image file; * <code>null</code> 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 <code>null</code> 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 <org_blueberry_ui_qt_Export.h> #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. * <p> * This class should be subclassed by clients wishing to define new editors. * The name of the subclass should be given as the <code>"class"</code> * attribute in a <code>editor</code> extension contributed to the workbench's * editor extension point (named <code>"org.mitk.ui.editors"</code>). * For example, the plug-in's XML markup might contain: - * <pre> - * <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> - * </pre> + * \code{.unparsed} + * <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> + * \endcode * where <code>com.example.myplugin.MyEditor</code> is the name of the * <code>EditorPart</code> subclass. * </p> * <p> * Subclasses must implement the following methods: * <ul> * <li><code>IEditorPart.init</code> - to initialize editor when assigned its site</li> * <li><code>IWorkbenchPart.createPartControl</code> - to create the editor's controls </li> * <li><code>IWorkbenchPart.setFocus</code> - to accept focus</li> * <li><code>IEditorPart.isDirty</code> - to decide whether a significant change has * occurred</li> * <li><code>IEditorPart.doSave</code> - to save contents of editor</li> * <li><code>IEditorPart.doSaveAs</code> - to save contents of editor</li> * <li><code>IEditorPart.isSaveAsAllowed</code> - to control Save As</li> * </ul> * </p> * <p> * Subclasses may extend or reimplement the following methods as required: * <ul> * <li><code>IExecutableExtension.setInitializationData</code> - extend to provide additional * initialization when editor extension is instantiated</li> * <li><code>IWorkbenchPart.dispose</code> - extend to provide additional cleanup</li> * <li><code>IAdaptable.getAdapter</code> - reimplement to make the editor * adaptable</li> * </ul> * </p> */ 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 <code>null</code> 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. * * <p>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.</p> * * <p>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.</p> * * @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. * * <p>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.</p> * * @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 <code>IEditorSite</code>. * * @param site the site to check * @since 3.1 */ void CheckSite(IWorkbenchPartSite::Pointer site) override; public: /* (non-Javadoc) * Saves the contents of this editor. * <p> * Subclasses must override this method to implement the open-save-close lifecycle * for an editor. For greater details, see <code>IEditorPart</code> * </p> * * @see IEditorPart */ void DoSave(/*IProgressMonitor monitor*/) override = 0; /* (non-Javadoc) * Saves the contents of this editor to another object. * <p> * Subclasses must override this method to implement the open-save-close lifecycle * for an editor. For greater details, see <code>IEditorPart</code> * </p> * * @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. * <p> * Subclasses of <code>EditorPart</code> 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: * </p> * <pre> * if (!(input instanceof IFileEditorInput)) * throw new PartInitException("Invalid Input: Must be IFileEditorInput"); * setSite(site); * setInput(input); * </pre> */ 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. * <p> * Subclasses must override this method to implement the open-save-close lifecycle * for an editor. For greater details, see <code>IEditorPart</code> * </p> * * @see IEditorPart */ bool IsDirty() const override = 0; /* (non-Javadoc) * Returns whether the "save as" operation is supported by this editor. * <p> * Subclasses must override this method to implement the open-save-close lifecycle * for an editor. For greater details, see <code>IEditorPart</code> * </p> * * @see IEditorPart */ bool IsSaveAsAllowed() const override = 0; /* (non-Javadoc) * Returns whether the contents of this editor should be saved when the editor * is closed. * <p> * This method returns <code>true</code> if and only if the editor is dirty * (<code>isDirty</code>). * </p> */ 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 <org_blueberry_ui_qt_Export.h> 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 <berryObject.h> 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. * <p> * 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. * </p><p> * A part may also contribute new actions to the action bars as required. To do * this, call <code>GetMenuManager</code>, <code>GetToolBarManager</code>, or * <code>GetStatusLineManager</code> as appropriate to get the action target. * Add the action(s) to the target and call <code>update</code> to commit * any changes to the underlying widgets. * </p><p> * This interface is not intended to be implemented by clients. * </p> - * @noimplement This interface is not intended to be implemented by clients. */ struct IActionBars : public Object { berryObjectMacro(berry::IActionBars); /** * Returns the menu manager. * <p> * Note: Clients who add or remove items from the returned menu manager are * responsible for calling <code>updateActionBars</code> so that the changes * can be propagated throughout the workbench. * </p> * * @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 <code>null</code>. */ virtual IServiceLocator* GetServiceLocator() = 0; /** * Returns the status line manager. * <p> * Note: Clients who add or remove items from the returned status line * manager are responsible for calling <code>updateActionBars</code> so * that the changes can be propagated throughout the workbench. * </p> * * @return the status line manager */ virtual IStatusLineManager* GetStatusLineManager() = 0; /** * Returns the tool bar manager. * <p> * Note: Clients who add or remove items from the returned tool bar manager are * responsible for calling <code>updateActionBars</code> so that the changes * can be propagated throughout the workbench. * </p> * * @return the tool bar manager */ virtual IToolBarManager* GetToolBarManager() = 0; /** * Updates the action bars. * <p> * 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. * </p> */ 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; /** * <p> * Provides services related to contexts in the blueberry workbench. This provides * access to contexts. * </p> * <p> * This service can be acquired from your service locator: * <pre> * IContextService service = (IContextService) getSite().getService(IContextService.class); * </pre> * <ul> * <li>This service is available globally.</li> * </ul> * </p> * - * @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 <code>EnabledSubmission</code> 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 }; /** * <p> * 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. * </p> * <p> * 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 <code>IWorkbenchPartSite</code> * would deactivate all of its contexts when the site is destroyed. * </p> * * @param contextId * The identifier for the context which should be activated; must * not be <code>null</code>. * @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<IContextActivation> ActivateContext(const QString& contextId) = 0; /** * <p> * Activates the given context within the context of this service. The * context becomes active when <code>expression</code> evaluates to * <code>true</code>. This is the same as calling - * {@link #activateContext(String, Expression, boolean)} with global==<code>false</code>. + * {@link #ActivateContext} with <code>global==false</code>. * </p> * <p> * 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 <code>IWorkbenchPartSite</code> * would deactivate all of its handlers when the site is destroyed. * </p> * * @param contextId * The identifier for the context which should be activated; must * not be <code>null</code>. * @param expression * This expression must evaluate to <code>true</code> before * this context will really become active. The expression may be * <code>null</code> 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<IContextActivation> ActivateContext(const QString& contextId, const SmartPointer<Expression>& expression) = 0; /** * <p> * Activates the given context within the context of this service. The * context becomes active when <code>expression</code> evaluates to * <code>true</code>. If global==<code>false</code> then this service * must also be the active service to activate the context. * </p> * <p> * 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 <code>IWorkbenchPartSite</code> * would deactivate all of its handlers when the site is destroyed. * </p> * * @param contextId * The identifier for the context which should be activated; must * not be <code>null</code>. * @param expression * This expression must evaluate to <code>true</code> before * this context will really become active. The expression may be * <code>null</code> 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<IContextActivation> ActivateContext(const QString& contextId, const SmartPointer<Expression>& 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. * <p> * <b>Note:</b> listeners should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. * </p> * * @param listener * The listener to attach; must not be <code>null</code>. * @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 * <code>IContextActivation</code> used to activate the context. * * @param activation * The token that was returned from a call to * <code>activateContext</code>; must not be <code>null</code>. */ virtual void DeactivateContext(const SmartPointer<IContextActivation>& 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 * <code>IContextActivation</code> instances used to activate the * contexts. * * @param activations * The tokens that were returned from a call to * <code>activateContext</code>. This collection must only * contain instances of <code>IContextActivation</code>. The * collection must not be <code>null</code>. */ virtual void DeactivateContexts(const QList<SmartPointer<IContextActivation> >& activations) = 0; /** * Returns the set of active context identifiers. * * @return The set of active context identifiers; this value may be * <code>null</code> if no active contexts have been set yet. If * the set is not <code>null</code>, then it contains only * instances of <code>String</code>. */ virtual QList<QString> 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 <code>null</code>. * @return A context with the given identifier, either defined or undefined. */ virtual SmartPointer<Context> GetContext(const QString& contextId) const = 0; /** * Returns the collection of all of the defined contexts in the workbench. * * @return The collection of contexts (<code>Context</code>) that are * defined; never <code>null</code>, but may be empty. */ virtual QList<SmartPointer<Context> > GetDefinedContexts() const = 0; /** * Returns the collection of the identifiers for all of the defined contexts * in the workbench. * * @return The collection of context identifiers (<code>String</code>) * that are defined; never <code>null</code>, but may be empty. */ virtual QList<QString> 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 <code>null</code>, then * <code>IContextService.TYPE_NONE</code> is returned. * @return <code>IContextService.TYPE_WINDOW</code>, * <code>IContextService.TYPE_DIALOG</code>, or * <code>IContextService.TYPE_NONE</code>. */ virtual ShellType GetShellType(const SmartPointer<Shell>& shell) const = 0; virtual ShellType GetShellType(QWidget* widget) const = 0; /** * <p> * 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. * </p> */ virtual void ReadRegistry() = 0; /** * <p> * 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. * </p> * <p> * 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). * </p> * <p> * If the provided shell has already been registered, then this method will * change the registration. * </p> * * @param shell * The shell to register for key bindings; must not be * <code>null</code>. * @param type * The type of shell being registered. This value must be one of * the constants given in this interface. * * @return <code>true</code> if the shell had already been registered * (i.e., the registration has changed); <code>false</code> * otherwise. */ virtual bool RegisterShell(const SmartPointer<Shell>& shell, ShellType type) = 0; /** * Removes a listener from this context service. * * @param listener * The listener to be removed; must not be <code>null</code>. */ virtual void RemoveContextManagerListener(IContextManagerListener* listener) = 0; /** * <p> * 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. * </p> * <p> * If the shell was never registered, or if the shell is <code>null</code>, * then this method returns <code>false</code> and does nothing. * * @param shell * The shell to be unregistered; does nothing if this value is * <code>null</code>. * * @return <code>true</code> if the shell had been registered; * <code>false</code> otherwise. */ virtual bool UnregisterShell(const SmartPointer<Shell>& shell) = 0; /** * Informs the service that a batch operation has started. * <p> * <b>Note:</b> You must insure that if you call * <code>deferUpdates(true)</code> that nothing in your batched operation * will prevent the matching call to <code>deferUpdates(false)</code>. * </p> * * @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 <org_blueberry_ui_qt_Export.h> #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. * <p> * An editor descriptor typically represents one of three types of editors: * <ul> * <li>a file editor extension for a specific file extension.</li> * <li>a file editor added by the user (via the workbench preference page)</li> * <li>a general editor extension which works on objects other than files.</li> * </ul> * </p> * <p> * This interface is not intended to be implemented or extended by clients. * </p> * * @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. * <p> * 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. * </p> * * @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 <code>true</code> if editor is inside editor area, and * <code>false</code> 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 <code>true</code> if editor is in-place, and <code>false</code> * 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 <code>true</code> if editor is external, and <code>false</code> * otherwise * @since 3.0 */ virtual bool IsOpenExternal() const = 0; /** * Returns the editor matching strategy object for editors * represented by this editor descriptor, or <code>null</code> * if there is no explicit matching strategy specified. * * @return the editor matching strategy, or <code>null</code> 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 <berryMacros.h> #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. * <p> * Implementations should inspect the given editor input first, * and try to reject it early before calling <code>IEditorReference.getEditorInput()</code>, * since that method may be expensive. * </p> * * @param editorRef the editor reference to match against * @param input the editor input to match * @return <code>true</code> if the editor matches the given editor input, * <code>false</code> 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 <QObject> 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 <code>IEditorInput</code>. 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). * <p> * 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. * </p><p> * An editor should be used in place of a view whenever more than one instance * of a document type can exist. * </p><p> * This interface may be implemented directly. For convenience, a base * implementation is defined in <code>EditorPart</code>. * </p> * <p> * An editor part is added to the workbench in two stages: * <ol> * <li>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.</li> * <li>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).</li> * </ol> * </p> * <p> * All editor parts implement the <code>IAdaptable</code> interface; extensions * are managed by the platform's adapter manager. * </p> * * @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 <code>getEditorInput</code>. */ //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 <code>PROP_INPUT</code>. * * @return the editor input */ virtual SmartPointer<IEditorInput> GetEditorInput() const = 0; /** * Returns the site for this editor. * This method is equivalent to <code>(IEditorSite) getSite()</code>. * <p> * The site can be <code>null</code> while the editor is being initialized. * After the initialization is complete, this value must be non-<code>null</code> * for the remainder of the editor's life cycle. * </p> * * @return the editor site; this value may be <code>null</code> if the editor * has not yet been initialized */ virtual SmartPointer<IEditorSite> GetEditorSite() const = 0; /** * Initializes this editor with the given editor site and input. * <p> * 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. * </p><p> * Implementors of this method must examine the editor input object type to * determine if it is understood. If not, the implementor must throw * a <code>PartInitException</code> * </p> * @param site the editor site * @param input the editor input * @exception PartInitException if this editor was not initialized successfully */ virtual void Init(SmartPointer<IEditorSite> site, SmartPointer<IEditorInput> 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. * <p> * An editor can be created in one of two ways: * <ul> * <li>An editor can be defined by an extension to the workbench.</li> * <li>The user manually associates an editor with a given resource extension * type. This will override any default workbench or platform association. * </li> * </ul> * </p> * <p> * The registry does not keep track of editors that are "implicitly" determined. * For example a bitmap (<code>.bmp</code>) file will typically not have a * registered editor. Instead, when no registered editor is found, the * underlying OS is consulted. * </p> * <p> * This interface is not intended to be implemented by clients. * </p> * * @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. * <p> * The properties ids are as follows: * <ul> * <li><code>PROP_CONTENTS</code>: Triggered when the file editor mappings in * the editor registry change.</li> * </ul> * </p> * * @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 <code>null</code> 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 <code>findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID)</code> * 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. * <p> * The default editor is determined by taking the file extension for the * file and obtaining the default editor for that extension. * </p> * * @param fileName * the file name in the system * @return the descriptor of the default editor, or <code>null</code> 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. * <p> * The default editor is determined by taking the file extension for the * file and obtaining the default editor for that extension. * </p> * * @param fileName the file name in the system * @param contentType the content type or <code>null</code> for the unknown content type * @return the descriptor of the default editor, or <code>null</code> 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. * <p> * Note: Use <code>getDefaultEditor(String)</code> if you only the need * the default editor rather than all candidate editors. * </p> * * @param fileName * the file name in the system * @return a list of editor descriptors */ virtual QList<IEditorDescriptor::Pointer> 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. * <p> * Note: Use <code>getDefaultEditor(String)</code> if you only the need * the default editor rather than all candidate editors. * </p> * * @param fileName * the file name in the system * @param contentType * the content type or <code>null</code> for the unknown * content type * @return a list of editor descriptors * @since 3.1 */ //virtual QList<IEditorDescriptor::Pointer> 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. * <p> * 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. * </p> * * @return a list of mappings sorted alphabetically by extension */ virtual QList<IFileEditorMapping::Pointer> 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. * <p> * 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. * </p> * * @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. * <p> * 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. * </p> * * @param filename * the file name in the system * @param contentType * the content type of the file or <code>null</code> 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 <code>null</code> 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 <code>true</code> if an in-place editor is available, and * <code>false</code> 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 <code>true</code> if an external editor available, and * <code>false</code> 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 <code>null</code> * 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. * <p> * The workbench exposes its implemention of editor part sites via this * interface, which is not intended to be implemented or extended by clients. * </p> - * @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. * <p> * 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. * </p> * * @return the editor action bar contributor, or <code>null</code> 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 <code>IEditorActionBarContributor</code>. * * @return the action bars * @since 2.1 */ //virtual IActionBars getActionBars(); /** * <p> * Registers a pop-up menu with the default id for extension. The default id * is defined as the part id. * </p> * <p> * 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 <code>includeEditorInput</code> * as <code>false</code>. This might be desirable for editors that * present a localized view of an editor input (e.g., a node in a model * editor). * </p> * <p> * For a detailed description of context menu registration see * {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)} * </p> * * @param menuManager * the menu manager; must not be <code>null</code>. * @param selectionProvider * the selection provider; must not be <code>null</code>. * @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); /** * <p> * 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. * </p> * <p> * 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 <code>includeEditorInput</code> * as <code>false</code>. This might be desirable for editors that * present a localized view of an editor input (e.g., a node in a model * editor). * </p> * <p> * For a detailed description of context menu registration see * {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)} * </p> * * @param menuId * the menu id; must not be <code>null</code>. * @param menuManager * the menu manager; must not be <code>null</code>. * @param selectionProvider * the selection provider; must not be <code>null</code>. * @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 <org_blueberry_ui_qt_Export.h> #include <berrySmartPointer.h> namespace berry { struct IAdaptable; struct IMemento; /** * A factory for re-creating objects from a previously saved memento. * <p> * Clients should implement this interface and include the name of their class * in an extension to the platform extension point named * <code>"org.blueberry.ui.elementFactories"</code>. * For example, the plug-in's XML markup might contain: - * <pre> - * <extension point="org.blueberry.ui.elementFactories"> - * <factory id="com.example.myplugin.MyFactory" class="MyFactory" /> - * </extension> - * </pre> + * \code{.unparsed} + * <extension point="org.blueberry.ui.elementFactories"> + * <factory id="com.example.myplugin.MyFactory" class="MyFactory" /> + * </extension> + * \endcode * </p> * * @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. * <p> * If the result is not null, it should be persistable; that is, * <pre> * result.getAdapter(org.eclipse.ui.IPersistableElement.class) * </pre> * should not return <code>null</code>. The caller takes ownership of the * result and must delete it when it is not needed any more. * </p> * * @param memento * a memento containing the state for the object * @return an object, or <code>nullptr</code> if the element could not be * created */ virtual IAdaptable* CreateElement(const SmartPointer<IMemento>& 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 <berryMacros.h> #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. * <p> * 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*) * </p> * <p> * This interface is not intended to be implemented by clients. * </p> * - * @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 <code>null</code> if there * is no default editor registered. Will also return <code>null</code> 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<IEditorDescriptor::Pointer> 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<IEditorDescriptor::Pointer> 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. * <p> * The image is obtained from the default editor. A default file image is * returned if no default editor is available. * </p> * * @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 "<it>name</it>.<it>extension</it>". * * @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 <code>IFolderLayout</code> is used to define the initial views within a folder. * The folder itself is contained within an <code>IPageLayout</code>. * <p> * This interface is not intended to be implemented by clients. * </p> * * @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 <code>"org.blueberry.ui.views"</code>). * * @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 <QIcon> namespace berry { /** * <p> * Provides a look-up facility for images associated with commands. * </p> * <p> * The <em>type</em> of an image indicates the state of the associated command * within the user interface. The supported types are: <code>TYPE_DEFAULT</code> * (to be used for an enabled command), <code>TYPE_DISABLED</code> (to be used * for a disabled command) and <code>TYPE_HOVER</code> (to be used for an * enabled command over which the mouse is hovering). * </p> * <p> * The <em>style</em> 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. * </p> * <p> * We currently support a default image style (none) and an image style of * IMAGE_STYLE_TOOLBAR. * </p> * - * @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 <b>null</b>) */ 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 <b>toolbar</b>) */ 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 <code>null</code>. * @return An image appropriate for the given command; may be * <code>null</code>. */ 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 <code>null</code>. * @param style * The style of the image to retrieve; may be <code>null</code>. * @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 <QHash> namespace berry { struct IExecutionListener; struct IHandler; struct IElementReference; class UIElement; class Command; class CommandCategory; class ParameterizedCommand; class ParameterType; /** * <p> * Provides services related to the command architecture within the workbench. * This service can be used to access the set of commands and command * categories. * </p> * <p> * This service can be acquired from your service locator: * <pre> * ICommandService service = (ICommandService) getSite().getService(ICommandService.class); * </pre> * <ul> * <li>This service is available globally.</li> * </ul> * </p> - * @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 <code>null</code>. */ static const QString AUTOGENERATED_CATEGORY_ID(); /** * Adds an execution listener to the command service. This listener will be * notified as commands are executed. * <p> * <b>Note:</b> listeners should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. * </p> * * @param listener * The listener to add; must not be <code>null</code>. - * @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 <code>null</code>. + * {@link #GetCategory} is called with <code>null</code>. * * @param name * The name of the category for uncategorized commands; must not * be <code>null</code>. * @param description * The description of the category for uncategorized commands; * may be <code>null</code>. */ virtual void DefineUncategorizedCategory(const QString& name, const QString& description) = 0; /** * <p> * Returns a {@link ParameterizedCommand} with a command and * parameterizations as specified in the provided * <code>serializedParameterizedCommand</code> string. The * <code>serializedParameterizedCommand</code> 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. * </p> * <p> * If a parameter id encoded in the * <code>serializedParameterizedCommand</code> 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 * <code>serializedParameterizedCommand</code>. This will not result in * an exception, but the value of the parameter when the command is executed * cannot be specified here. * </p> * <p> * This method will never return <code>null</code>, however it may throw * an exception if there is a problem processing the serialization string or * the encoded command is undefined. * </p> * * @param serializedParameterizedCommand * a <code>String</code> representing a command id and * parameter ids and values * @return a <code>ParameterizedCommand</code> with the command and * parameterizations encoded in the * <code>serializedParameterizedCommand</code> * @throws NotDefinedException * if the command indicated in * <code>serializedParameterizedCommand</code> is not defined * @throws SerializationException * if there is an error deserializing * <code>serializedParameterizedCommand</code> * @see ParameterizedCommand#serialize() * @see CommandManager#deserialize(String) */ virtual SmartPointer<ParameterizedCommand> 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 <code>null</code>, * then a category suitable for uncategorized items is defined * and returned. * @return A category with the given identifier, either defined or * undefined. */ virtual SmartPointer<CommandCategory> 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 <code>null</code>. * @return A command with the given identifier, either defined or undefined. */ virtual SmartPointer<Command> GetCommand(const QString& commandId) const = 0; /** * Returns the collection of all of the defined categories in the workbench. * * @return The collection of categories (<code>Category</code>) that are * defined; never <code>null</code>, but may be empty. */ virtual QList<SmartPointer<CommandCategory> > GetDefinedCategories() const = 0; /** * Returns the collection of the identifiers for all of the defined * categories in the workbench. * * @return The collection of category identifiers (<code>String</code>) * that are defined; never <code>null</code>, 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 (<code>String</code>) * that are defined; never <code>null</code>, 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 (<code>Command</code>) that are * defined; never <code>null</code>, but may be empty. */ virtual QList<SmartPointer<Command> > 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 (<code>String</code>) * that are defined; never <code>null</code>, 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 (<code>ParameterType</code>) * that are defined; never <code>null</code>, but may be empty. */ virtual QList<SmartPointer<ParameterType> > 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 <code>null</code> is returned. * * @param command * The command for which the help context should be retrieved; * must not be <code>null</code>. * @return The help context identifier to use for the given command; may be * <code>null</code>. * @throws NotDefinedException * If the given command is not defined. */ virtual QString GetHelpContextId(const SmartPointer<const Command>& 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 <code>null</code> is returned. * * @param commandId * The identifier of the command for which the help context * should be retrieved; must not be <code>null</code>. * @return The help context identifier to use for the given command; may be * <code>null</code>. * @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 <code>null</code>. * @return A command parameter type with the given identifier, either * defined or undefined. */ virtual SmartPointer<ParameterType> GetParameterType(const QString& parameterTypeId) const = 0; /** * <p> * 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. * </p> */ virtual void ReadRegistry() = 0; /** * Removes an execution listener from the command service. * * @param listener * The listener to remove; must not be <code>null</code>. */ 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 <code>null</code>. * @param helpContextId * The help context identifier to register; may be * <code>null</code> if the help context identifier should be * removed. */ virtual void SetHelpContextId(const SmartPointer<IHandler>& handler, const QString& helpContextId) = 0; /** * Register that this element accepts callbacks for this parameterized * command. * <p> * <b>Note:</b> elements should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. * </p> * * @param command * The parameterized command that is already specialized. Must * not be <code>null</code>. * @param element * The callback to register for this specialized command * instance. Must not be <code>null</code>. * @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 <code>null</code>. - * @see #unregisterElement(IElementReference) + * @see #UnregisterElement */ virtual SmartPointer<IElementReference> RegisterElementForCommand( const SmartPointer<ParameterizedCommand>& command, const SmartPointer<UIElement>& 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}. * <p> * <b>Note:</b> elements should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. * </p> * * @param elementReference * The reference to re-register. Must not be <code>null</code>. - * @see #unregisterElement(IElementReference) + * @see #UnregisterElement */ virtual void RegisterElement(const SmartPointer<IElementReference>& 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 <b>must</b> be used to unregister the element. * * @param elementReference * The callback reference that was provided by the command * service on registration. Must not be <code>null</code>. */ virtual void UnregisterElement(const SmartPointer<IElementReference>& 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. * <p> * 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: * * <pre> * Map filter = new HashMap(); * filter.put(IServiceScopes.WINDOW_SCOPE, getSite().getPage() * .getWorkbenchWindow()); * commandService.refreshElements(commandId, filter); * </pre> * * </p> * * @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 <b>AND</b>ed together. This may be * <code>null</code>. */ virtual void RefreshElements(const QString& commandId, const QHash<QString, Object::Pointer>& 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 <berryExecutionEvent.h> #include <berryObjectList.h> #include <berryObjectString.h> #include <org_blueberry_ui_qt_Export.h> #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. * <p> * <b>Note</b>: this class should not be instantiated or extended by clients. * </p> * * @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<ObjectString::Pointer> 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 <code>null</code> * 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 * <code>null</code>. * @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 <code>null</code> * @param name * The variable name to extract. * @return The object from the application context, or <code>null</code> * 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 <code>null</code>. */ 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 * <code>null</code>. * @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 <code>null</code>. - */ -// 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 <code>null</code>. - * @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 <code>null</code>. */ 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 <code>null</code>. * @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 <code>null</code>. - */ - //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 <code>null</code>. - * @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 <code>null</code>. */ 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 * <code>null</code>. * @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 <code>null</code>. */ 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 <code>null</code>. * @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 <code>null</code>. */ 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 <code>null</code>. * @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 <code>null</code>. */ 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 <code>null</code>. * @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 <code>null</code>. */ 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 <code>null</code>. * @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 <code>null</code>. */ 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 <code>null</code>. * @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 <code>null</code>. */ 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 <code>null</code>. * @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 <code>null</code>. */ 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 <code>null</code>. * @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 <code>null</code>. */ static ISelection::ConstPointer GetShowInSelection(const ExecutionEvent::ConstPointer& event); /** * Return the ShowInContext selection. Will not return <code>null</code>. * * @param event * The execution event that contains the application context * @return the show in selection, or <code>null</code>. * @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 <code>null</code>. */ static Object::ConstPointer GetShowInInput(const ExecutionEvent::ConstPointer& event); /** * Return the ShowInContext input. Will not return <code>null</code>. * * @param event * The execution event that contains the application context * @return the show in input, or <code>null</code>. * @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>& 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 <code>true</code> whe the values are same, <code>false</code> * 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<ExecutionEvent>& 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>& 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; /** * <p> * Provides services related to activating and deactivating handlers within the * workbench. * </p> * <p> * This service can be acquired from your service locator: * <pre> * IHandlerService service = (IHandlerService) getSite().getService(IHandlerService.class); * </pre> * <ul> * <li>This service is available globally.</li> * </ul> * </p> - * @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; /** * <p> * 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. * </p> * * @param activation * The activation that is local to the child service; must not be * <code>null</code>. * @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<IHandlerActivation> ActivateHandler(const SmartPointer<IHandlerActivation>& activation) = 0; /** * <p> * 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. * </p> * <p> * 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 <code>IWorkbenchPartSite</code> * would deactivate all of its handlers when the site is destroyed. * </p> * * @param commandId * The identifier for the command which this handler handles; * must not be <code>null</code>. * @param handler * The handler to activate; must not be <code>null</code>. * @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<IHandlerActivation> ActivateHandler( const QString& commandId, const SmartPointer<IHandler>& handler) = 0; /** * <p> * Activates the given handler within the context of this service. The * handler becomes active when <code>expression</code> evaluates to * <code>true</code>. This is the same as calling - * {@link #activateHandler(String, IHandler, Expression, boolean)} with - * global==false. + * {@link #ActivateHandler} with \c global==false . * </p> * <p> * 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 <code>IWorkbenchPartSite</code> * would deactivate all of its handlers when the site is destroyed. * </p> * * @param commandId * The identifier for the command which this handler handles; * must not be <code>null</code>. * @param handler * The handler to activate; must not be <code>null</code>. * @param expression * This expression must evaluate to <code>true</code> before * this handler will really become active. The expression may be * <code>null</code> 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<IHandlerActivation> ActivateHandler( const QString& commandId, const SmartPointer<IHandler>& handler, const SmartPointer<Expression>& expression) = 0; /** * <p> * Activates the given handler within the context of this service. The * handler becomes active when <code>expression</code> evaluates to * <code>true</code>. if global==<code>false</code>, 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. * </p> * <p> * 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 <code>IWorkbenchPartSite</code> * would deactivate all of its handlers when the site is destroyed. * </p> * * @param commandId * The identifier for the command which this handler handles; * must not be <code>null</code>. * @param handler * The handler to activate; must not be <code>null</code>. * @param expression * This expression must evaluate to <code>true</code> before * this handler will really become active. The expression may be * <code>null</code> 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<IHandlerActivation> ActivateHandler( const QString& commandId, const SmartPointer<IHandler>& handler, const SmartPointer<Expression>& 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 <code>null</code>. - * @param event - * The SWT event triggering the command execution; may be - * <code>null</code>. + * @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<const ExecutionEvent> CreateExecutionEvent( const SmartPointer<const Command>& command, const SmartPointer<const UIElement>& 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 <code>null</code>. - * @param event - * The SWT event triggering the command execution; may be - * <code>null</code>. + * @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<const ExecutionEvent> CreateExecutionEvent( const SmartPointer<const ParameterizedCommand>& command, const SmartPointer<const UIElement>& 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 * <code>IHandlerActivation</code> used to activate the handler. * * @param activation * The token that was returned from a call to * <code>activateHandler</code>; must not be <code>null</code>. */ virtual void DeactivateHandler(const SmartPointer<IHandlerActivation>& 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 * <code>IHandlerActivation</code> used to activate the handler. * * @param activations * The tokens that were returned from a call to * <code>activateHandler</code>. This collection must only * contain instances of <code>IHandlerActivation</code>. The * collection must not be <code>null</code>. */ virtual void DeactivateHandlers( const QList<SmartPointer<IHandlerActivation> >& activations) = 0; /** * Executes the command with the given identifier and no parameters. * * @param commandId * The identifier of the command to execute; must not be * <code>null</code>. - * @param event - * The SWT event triggering the command execution; may be - * <code>null</code>. + * @param uielement * @return The return value from the execution; may be <code>null</code>. * @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<const UIElement>& uielement) = 0; /** * Executes the given parameterized command. * * @param command * The parameterized command to be executed; must not be * <code>null</code>. - * @param event - * The SWT event triggering the command execution; may be - * <code>null</code>. + * @param uielement * @return The return value from the execution; may be <code>null</code>. * @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<ParameterizedCommand>& command, const SmartPointer<const UIElement>& 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 * <code>null</code>. - * @param event - * The SWT event triggering the command execution; may be - * <code>null</code>. + * @param uielement * @param context * the evaluation context to run against. Must not be * <code>null</code> * @return The return value from the execution; may be <code>null</code>. * @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<ParameterizedCommand>& command, const SmartPointer<const UIElement>& uielement, const SmartPointer<IEvaluationContext>& context) = 0; /** * This method creates a copy of the application context returned by - * {@link #getCurrentState()}. + * {@link #GetCurrentState}. * * @param includeSelection * if <code>true</code>, 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<IEvaluationContext> 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 <code>null</code>. - * @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<IEvaluationContext> GetCurrentState() const = 0; /** * <p> * 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. * </p> */ 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 <code>null</code>. * @param helpContextId * The help context identifier to register; may be * <code>null</code> if the help context identifier should be * removed. * @since 3.2 */ virtual void SetHelpContextId(const SmartPointer<IHandler>& 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 <berryIWorkbenchWindow.h> 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. * <p> * 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. * </p> * <p> - * See {@link org.eclipse.ui.intro.IIntroPart} for details on where intro parts + * See {@link IIntroPart} for details on where intro parts * come from. * </p> * <p> * This interface is not intended to be extended or implemented by clients. * </p> * * @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 <code>true</code> if the intro part was closed, and * <code>false</code> otherwise. <code>false</code> is returned * if part is <code>null</code> 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 <code>null</code> 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 <code>null</code> 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 <code>true</code> if there is an intro that could be shown, and * <code>false</code> 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 <code>true</code> if the part in its partially * visible standy mode, and <code>false</code> if in its fully visible state. * <code>false</code> is returned if part is <code>null</code> 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. * <p> * This method does nothing if the part is <code>null</code> or is not - * the intro part returned by {@link #getIntro()}. + * the intro part returned by {@link #GetIntro}. * </p> * * @param part the intro part, or <code>null</code> * @param standby <code>true</code> to put the part in its partially * visible standy mode, and <code>false</code> 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 * <code>null</code> to indicate the currently active workbench window * @param standby <code>true</code> to put the intro part in its partially * visible standy mode, and <code>false</code> to make it fully visible * @return the newly-created or existing intro part, or <code>null</code> * if no intro part is available or if <code>preferredWindow</code> is * <code>null</code> and there is no currently active workbench window */ virtual IIntroPart::Pointer ShowIntro( IWorkbenchWindow::Pointer preferredWindow, bool standby) = 0; /** * Returns <code>true</code> if there is an intro content detector and it * reports that new intro content is available. * * @return <code>true</code> 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 <berryObject.h> #include <berryMacros.h> #include <berryIMemento.h> #include <berryIPropertyChangeListener.h> #include <berryUIException.h> #include "berryIIntroSite.h" #include <QObject> 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. * <p> * The intro part implementation is contributed to the workbench via the * <code>org.blueberry.ui.intro</code> 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. * </p> * <p> * This interface in not intended to be directly implemented. Rather, clients * providing a intro part implementation should subclass * {@link berry::IntroPart}. * </p> * * @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. * <p> * 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. * </p> * * @param site the intro site * @param memento the intro part state or <code>null</code> 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. * <p> * 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. * </p> * * @param standby <code>true</code> to put this part in its partially * visible standy mode, and <code>false</code> to make it fully visible */ virtual void StandbyStateChanged(bool standby) = 0; /** * Saves the object state within a memento. * <p> * This method is automatically called by the workbench at appropriate * times. Clients must not call this method directly. * </p> * * @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. * <p> * Clients should not call this method (the workbench calls this method when * it needs to, which may be never). * </p> * <p> * For implementors this is a multi-step process: * <ol> * <li>Create one or more controls within the parent.</li> * <li>Set the parent layout as needed.</li> * <li>Register any global actions with the <code>IActionService</code>.</li> * <li>Register any popup menus with the <code>IActionService</code>.</li> * <li>Register a selection provider with the <code>ISelectionService</code> * (optional). </li> * </ol> * </p> * * @param parent the parent control */ virtual void CreatePartControl(void* parent) = 0; /** * Returns the title image of this intro part. * <p> * 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 <b>not</b> dispose the returned image. * </p> * * @return the title image */ virtual QIcon GetTitleImage() const = 0; /** * Returns the title of this intro part. * <p> * The title is used to populate the title bar of this part's visual * container. * </p> * * @return the intro part title (not <code>null</code>) */ 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. * <p> * 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}. * </p> */ 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 <berryIWorkbenchSite.h> namespace berry { /** * The primary interface between an intro part and the workbench. * <p> * The workbench exposes its implemention of intro part sites via this * interface, which is not intended to be implemented or extended by clients. * </p> - * - * @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. * <p> * The name comes from the <code>id</code> attribute in the configuration * element. * </p> * * @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 <org_blueberry_ui_qt_Export.h> #include <berryObject.h> #include <berryMacros.h> namespace berry { /** * <p> * The interface that should be implemented by services that make themselves * available through the <code>IAdaptable</code> mechanism. This is the * interface that drives the majority of services provided at the workbench * level. * </p> * <p> * 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. * </p> * <p> * This interface has nothing to do with OSGi services. * </p> * <p> * This interface can be extended or implemented by clients. * </p> */ 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 <code>IEvaluationService</code>. * - * @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 <berryIServiceWithSources.h> #include <org_blueberry_ui_qt_Export.h> 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 * <code>IPropertyChangeListener</code> that will be notified as changes * occur. * <p> * This can be used to implement core expressions in client extension points * similar to the <enabledWhen> of * <code>org.blueberry.ui.handlers/handler</code> elements. * </p> * <p> * The service will fire <code>TRUE</code> and * <code>FALSE</code> for the oldValue and newValue in the property * change events. * </p> * <p> * Adding the evaluation listener will fire one change with oldValue=<code>null</code> * and newValue="evaluated expression". Remove the * <code>IEvaluationReference</code> will fire one change with * oldValue="last evaluated value" and newValue=<code>null</code>. * </p> * <p> * Adding a service listener will fire the {@link #PROP_NOTIFYING} property * change event with newValue=<code>TRUE</code> when a source change * causes expression evaluations to update and another {@link #PROP_NOTIFYING} * property change event with newValue=<code>FALSE</code> 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. * </p> * <p> * Variable sources can be provided to this service using the <code>org.blueberry.ui.services</code> * Extension Point. This makes the available to <with/> expressions. * </p> * <p> * This service can be acquired from your service locator: * <pre> * IEvaluationService::Pointer service = GetSite()->GetService(IEvaluationService::GetManifestName()); * </pre> * <ul> * <li>This service is available globally.</li> * </ul> * </p> * - * @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=<code>TRUE</code>. * This property is not fired for any source changes caused by the outer * recalculations. * <p> * <b>Note:</b> listeners should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. * </p> * * @param listener * The listener to be notified. Must not be <code>null</code>. * 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 <code>null</code>. 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. * <p> * <b>Note:</b> listeners should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. * </p> * * @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<IEvaluationReference> AddEvaluationListener( const SmartPointer<Expression>& expression, IPropertyChangeListener* listener, const QString& property) = 0; /** * Re-add a property change listener that has already been removed by - * {@link #removeEvaluationListener(IEvaluationReference)}. + * {@link #RemoveEvaluationListener}. * <p> * 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. * </p> * <p> * <b>Note:</b> references should be removed when no longer necessary. If * not, they will be removed when the IServiceLocator used to acquire this * service is disposed. * </p> * * @param ref * The listener to re-add. - * @see #removeEvaluationListener(IEvaluationReference) + * @see #RemoveEvaluationListener */ virtual void AddEvaluationReference(const SmartPointer<IEvaluationReference>& ref) = 0; /** * Remove the listener represented by the evaluation reference. * * @param ref * the reference to be removed. */ virtual void RemoveEvaluationListener(const SmartPointer<IEvaluationReference>& 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. * <p> * Note: This context should not be modified. * </p> * * @return the latest context. * @see ISources#ACTIVE_CURRENT_SELECTION_NAME */ virtual SmartPointer<IEvaluationContext> 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. * <p> * Notes: * <ul> * <li>the property must be able to return the new value before this * re-evaluation is requested</li> * <li>limit calls to this method to avoid unnecessary churn</li> * <li>A re-evaluation that does not change the value of an expression will * not fire a property change event</li> * </ul> * </p> * * @param propertyName * The fully qualified property name, like * <code>org.eclipse.core.resources.name</code>. Must not be * <code>null</code>. */ 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<GuiWidgetsTweaklet> 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 <code>IControlListener</code> * 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<Shell::Pointer>& 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<Shell::Pointer> 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_ */