diff --git a/BlueBerry/Bundles/org.blueberry.ui/schema/perspectives.exsd b/BlueBerry/Bundles/org.blueberry.ui/schema/perspectives.exsd index 9796fb4d28..8e355d8ed3 100755 --- a/BlueBerry/Bundles/org.blueberry.ui/schema/perspectives.exsd +++ b/BlueBerry/Bundles/org.blueberry.ui/schema/perspectives.exsd @@ -1,180 +1,181 @@ This extension point is used to add perspective factories to the workbench. A perspective factory is used to define the initial layout and visible action sets for a perspective. The user can select a perspective by invoking the "Open Perspective" submenu of the "Window" menu. a fully qualified identifier of the target extension point an optional identifier of the extension instance an optional name of the extension instance + a unique name that will be used to identify this perspective. a translatable name that will be used in the workbench window menu bar to represent this perspective. - a fully qualified name of the class that implements + a fully qualified name of the class that implements <samp>berry::IPerspectiveFactory</samp> interface. - a relative name of the icon that will be associated + a relative name of the icon that will be associated with this perspective. indicates whether the layout of the perspective is fixed. If true, then views created by the perspective factory are not closeable, and cannot be moved. The default is false. an optional subelement whose body should contain text providing a short description of the perspective. - The following is an example of a perspective extension: + The following is an example of a perspective extension: <p> <pre> - <extension - point="org.blueberry.ui.perspectives"> - <perspective - id="org.blueberry.ui.resourcePerspective" - name="Resource" - class="berry::ResourcePerspective" - icon="resources/MyIcon.gif"> - </perspective> - </extension> + <extension + point="org.blueberry.ui.perspectives"> + <perspective + id="org.blueberry.ui.resourcePerspective" + name="Resource" + class="berry::ResourcePerspective" + icon="resources/MyIcon.gif"> + </perspective> + </extension> </pre> </p> - The value of the <samp>class</samp> attribute must be the -fully qualified name of a class that implements -<samp>berry::IPerspectiveFactory</samp>. -The class must supply the initial layout for a + The value of the <samp>class</samp> attribute must be the +fully qualified name of a class that implements +<samp>berry::IPerspectiveFactory</samp>. +The class must supply the initial layout for a perspective when asked by the workbench. <p> -The <samp>plugin_customization.ini</samp> file is used to define the default perspective. The <i>default perspective</i> is the first perspective which appears when the product is launched after install. It is also used when the user opens a page or window with no specified perspective. The default perspective is defined as a property within the plugin_customization.ini, as shown below. The user may also override this perspective from the workbench perspectives preference page. +The <samp>plugin_customization.ini</samp> file is used to define the default perspective. The <i>default perspective</i> is the first perspective which appears when the product is launched after install. It is also used when the user opens a page or window with no specified perspective. The default perspective is defined as a property within the plugin_customization.ini, as shown below. The user may also override this perspective from the workbench perspectives preference page. <pre> - defaultPerspectiveId = org.blueberry.ui.resourcePerspective + defaultPerspectiveId = org.blueberry.ui.resourcePerspective </pre> The perspectives which appear in the "Open Perspective" menu are shortcuts for perspective selection. This set is defined by the active perspective itself, and extensions made through the perspectiveExtensions extension point. - The workbench provides a "Resource Perspective". -Additional perspectives may be added by plug-ins. + The workbench provides a "Resource Perspective". +Additional perspectives may be added by plug-ins. They are selected using the "Open Perspective" submenu of the "Window" menu. Copyright (c) 2002, 2005 IBM Corporation and others.<br> All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies -this distribution, and is available at <a +this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> diff --git a/BlueBerry/Bundles/org.blueberry.ui/schema/views.exsd b/BlueBerry/Bundles/org.blueberry.ui/schema/views.exsd index 3f234b4e36..76bf00cdc7 100755 --- a/BlueBerry/Bundles/org.blueberry.ui/schema/views.exsd +++ b/BlueBerry/Bundles/org.blueberry.ui/schema/views.exsd @@ -1,310 +1,311 @@ - This extension point is used to define additional views -for the workbench. A view is a visual component -within a workbench page. It is typically used to -navigate a hierarchy of information (like the workspace), -open an editor, or display properties for -the active editor. The user can make a view -visible from the Window > Show View menu or close it from the -view local title bar. + This extension point is used to define additional views +for the workbench. A view is a visual component +within a workbench page. It is typically used to +navigate a hierarchy of information (like the workspace), +open an editor, or display properties for +the active editor. The user can make a view +visible from the Window > Show View menu or close it from the +view local title bar. <p> In order to reduce the visual clutter in the Show View Dialog, views should be grouped using categories. a fully qualified identifier of the target extension point an optional identifier of the extension instance an optional name of the extension instance a unique name that will be used to identify this category a translatable name that will be used in the UI for this category an optional path composed of category IDs separated by '/'. This allows the creation of a hierarchy of categories. + a unique name that will be used to identify this view a translatable name that will be used in the UI for this view an optional attribute that is composed of the category IDs separated by '/'. Each referenced category must be declared in a corresponding category element. - a fully qualified name of the class that implements -<samp>berry::IViewPart</samp>. A common practice + a fully qualified name of the class that implements +<samp>berry::IViewPart</samp>. A common practice is to subclass <samp>berry::ViewPart</samp> or <samp>berry::QtViewPart</samp> in order to inherit the default functionality. - a relative name of the icon that will + a relative name of the icon that will be associated with the view. the percentage of the width of the workbench that the view will take up as an active fast view. This must be defined as a floating point value and lie between 0.05 and 0.95. If no value is supplied, a default ratio will be used. flag indicating whether this view allows multiple instances to be created using IWorkbenchPage::ShowView(std::string id, std::string secondaryId). The default is false. flag indicating whether this view allows to be restored upon workbench restart. If set to false, the view will not be open after a workbench restart. The default is true. an optional subelement whose body should contain text providing a short description of the view. A sticky view is a view that will appear by default across all perspectives in a window once it is opened. Its initial placement is governemed by the location attribute, but nothing prevents it from being moved or closed by the user. Use of this element will only cause a placeholder for the view to be created, it will not show the view. Please note that usage of this element should be done with great care and should only be applied to views that truely have a need to live across perspectives. the id of the view to be made sticky. optional attribute that specifies the location of the sticky view relative to the editor area. If absent, the view will be docked to the right of the editor area. optional attribute that specifies wether the view should be closeable. If absent it will be closeable. optional attribute that specifies wether the view should be moveable. If absent it will be moveable. - The following is an example of the extension point: + The following is an example of the extension point: <p> <pre> - <extension point="org.blueberry.ui.views"> - <category - id="com.xyz.views.XYZviews" - name="XYZ"/> - <view - id="com.xyz.views.XYZView" - name="XYZ View" - category="com.xyz.views.XYZviews" - class="ns::XYZView" + <extension point="org.blueberry.ui.views"> + <category + id="com.xyz.views.XYZviews" + name="XYZ"/> + <view + id="com.xyz.views.XYZView" + name="XYZ View" + category="com.xyz.views.XYZviews" + class="ns::XYZView" icon="icons/XYZ.gif"/> - </extension> + </extension> </pre> </p> The following is an example of a sticky view declaration: <p> <pre> - <extension point="org.blueberry.ui.views"> + <extension point="org.blueberry.ui.views"> <stickyView id="com.xyz.views.XYZView" /> - </extension> + </extension> </pre> </p> - The value of the <samp>class</samp> attribute must be a -fully qualified name of the class that implements -<samp>berry::IViewPart</samp>. It is common + The value of the <samp>class</samp> attribute must be a +fully qualified name of the class that implements +<samp>berry::IViewPart</samp>. It is common practice to subclass <samp>berry::ViewPart</samp> or <samp>berry::QtViewPart<samp> when developing a new view. The BlueBerry Platform provides a number of standard views. From the user point of view, these views are no different from any other view provided by the plug-ins. All the views can be shown from the "Show View" submenu of the "Window" menu. The position of a view is persistent: it is saved when the view is closed and restored when the view is reopened in a single session. The position is also persisted between workbench sessions. Copyright (c) 2002, 2005 IBM Corporation and others.<br> All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies -this distribution, and is available at <a +this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/berryIPerspectiveDescriptor.h b/BlueBerry/Bundles/org.blueberry.ui/src/berryIPerspectiveDescriptor.h index 88532225a8..e89610badd 100644 --- a/BlueBerry/Bundles/org.blueberry.ui/src/berryIPerspectiveDescriptor.h +++ b/BlueBerry/Bundles/org.blueberry.ui/src/berryIPerspectiveDescriptor.h @@ -1,114 +1,113 @@ /*=================================================================== BlueBerry Platform Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef BERRYIPERSPECTIVEDESCRIPTOR_H_ #define BERRYIPERSPECTIVEDESCRIPTOR_H_ #include #include #include #include "berryImageDescriptor.h" namespace berry { - /** * \ingroup org_blueberry_ui * * A perspective descriptor describes a perspective in an * IPerspectiveRegistry. *

* A perspective is a template for view visibility, layout, and action visibility * within a workbench page. There are two types of perspective: a predefined * perspective and a custom perspective. *

    *
  • A predefined perspective is defined by an extension to the workbench's * perspective extension point ("org.blueberry.ui.perspectives"). * The extension defines a id, label, and IPerspectiveFactory. * A perspective factory is used to define the initial layout for a page. *
  • *
  • A custom perspective is defined by the user. In this case a predefined * perspective is modified to suit a particular task and saved as a new * perspective. The attributes for the perspective are stored in a separate file * in the workbench's metadata directory. *
  • *
*

*

* Within a page the user can open any of the perspectives known * to the workbench's perspective registry, typically by selecting one from the * workbench's Open Perspective menu. When selected, the views * and actions within the active page rearrange to reflect the perspective. *

*

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

* @see IPerspectiveRegistry * @noimplement This interface is not intended to be implemented by clients. */ struct BERRY_UI IPerspectiveDescriptor : public Object { - berryInterfaceMacro(IPerspectiveDescriptor, berry); virtual ~IPerspectiveDescriptor(); /** * Returns the description of this perspective. * This is the value of its "description" attribute. * * @return the description * @since 3.0 */ virtual std::string GetDescription() const = 0; /** * Returns this perspective's id. For perspectives declared via an extension, * this is the value of its "id" attribute. * * @return the perspective id */ virtual std::string GetId() const = 0; /** * Returns the descriptor of the image to show for this perspective. * If the extension for this perspective specifies an image, the descriptor * for it is returned. Otherwise a default image is returned. * * @return the descriptor of the image to show for this perspective */ virtual ImageDescriptor::Pointer GetImageDescriptor() const = 0; /** * Returns this perspective's label. For perspectives declared via an extension, * this is the value of its "label" attribute. * * @return the label */ virtual std::string GetLabel() const = 0; /** * Returns true if this perspective is predefined by an * extension. * * @return boolean whether this perspective is predefined by an extension */ virtual bool IsPredefined() const = 0; -}; + virtual std::vector< std::string> GetKeywordReferences() const = 0; +}; } #endif /*BERRYIPERSPECTIVEDESCRIPTOR_H_*/ diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/berryIViewDescriptor.h b/BlueBerry/Bundles/org.blueberry.ui/src/berryIViewDescriptor.h index ab72c8eb09..1cb28d8de2 100644 --- a/BlueBerry/Bundles/org.blueberry.ui/src/berryIViewDescriptor.h +++ b/BlueBerry/Bundles/org.blueberry.ui/src/berryIViewDescriptor.h @@ -1,107 +1,107 @@ /*=================================================================== BlueBerry Platform Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef BERRYIVIEWDESCRIPTOR_H_ #define BERRYIVIEWDESCRIPTOR_H_ #include #include "berryIWorkbenchPartDescriptor.h" #include "berryIViewPart.h" #include #include #include "berryImageDescriptor.h" #include #include namespace berry { - /** * \ingroup org_blueberry_ui * * This is a view descriptor. It provides a "description" of a given * given view so that the view can later be constructed. *

* The view registry provides facilities to map from an extension * to a IViewDescriptor. *

*

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

* * @see org.blueberry.ui.IViewRegistry */ struct BERRY_UI IViewDescriptor : public IWorkbenchPartDescriptor, public IAdaptable { - berryInterfaceMacro(IViewDescriptor, berry); ~IViewDescriptor(); /** * Creates an instance of the view defined in the descriptor. * * @return the view part * @throws CoreException thrown if there is a problem creating the part */ virtual IViewPart::Pointer CreateView() = 0; + + virtual std::vector< std::string> GetKeywordReferences() const = 0; + /** * Returns an array of strings that represent * view's category path. This array will be used * for hierarchical presentation of the * view in places like submenus. * @return array of category tokens or null if not specified. */ virtual const std::vector& GetCategoryPath() const = 0; /** * Returns the description of this view. * * @return the description */ virtual std::string GetDescription() const = 0; /** * Returns the descriptor for the icon to show for this view. */ virtual SmartPointer GetImageDescriptor() const = 0; /** * Returns whether this view allows multiple instances. * * @return whether this view allows multiple instances */ virtual bool GetAllowMultiple() const = 0; /** * Returns whether this view can be restored upon workbench restart. * * @return whether whether this view can be restored upon workbench restart */ virtual bool IsRestorable() const = 0; virtual bool operator==(const Object*) const = 0; }; - } #endif /*BERRYIVIEWDESCRIPTOR_H_*/ diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.cpp index de532d0501..1b4cf54743 100644 --- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.cpp +++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.cpp @@ -1,306 +1,324 @@ /*=================================================================== BlueBerry Platform Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "berryPerspectiveDescriptor.h" #include "berryWorkbenchRegistryConstants.h" #include "berryWorkbenchPlugin.h" #include "berryWorkbenchConstants.h" #include "berryPerspectiveRegistry.h" namespace berry { - PerspectiveDescriptor::PerspectiveDescriptor(const std::string& id, const std::string& label, PerspectiveDescriptor::Pointer originalDescriptor) : singleton(false), fixed(false) { this->id = id; this->label = label; if (originalDescriptor != 0) { this->originalId = originalDescriptor->GetOriginalId(); this->imageDescriptor = originalDescriptor->imageDescriptor; // This perspective is based on a perspective in some bundle -- if // that // bundle goes away then I think it makes sense to treat this // perspective // the same as any other -- so store it with the original // descriptor's // bundle's list. // // It might also make sense the other way...removing the following // line // will allow the perspective to stay around when the originating // bundle // is unloaded. // // This might also have an impact on upgrade cases -- should we // really be // destroying all user customized perspectives when the older // version is // removed? // // I'm leaving this here for now since its a good example, but // wouldn't be // surprised if we ultimately decide on the opposite. // // The reason this line is important is that this is the value used // to // put the object into the UI level registry. When that bundle goes // away, // the registry will remove the entire list of objects. So if this // desc // has been put into that list -- it will go away. this->pluginId = originalDescriptor->GetPluginId(); } } PerspectiveDescriptor::PerspectiveDescriptor(const std::string& id, IConfigurationElement::Pointer configElement) : singleton(false), fixed(false) { this->configElement = configElement; this->id = id; // Sanity check. if ((this->GetId() == "") || (this->GetLabel() == "") || (this->GetFactoryClassName() == "")) { throw CoreException("Invalid extension (missing label, id or class name): " + this->GetId()); } } IPerspectiveFactory::Pointer PerspectiveDescriptor::CreateFactory() { // if there is an originalId, then use that descriptor instead if (originalId != "") { // Get the original descriptor to create the factory. If the // original is gone then nothing can be done. IPerspectiveDescriptor::Pointer target = dynamic_cast (WorkbenchPlugin::GetDefault()->GetPerspectiveRegistry()) ->FindPerspectiveWithId( originalId); return target == 0 ? IPerspectiveFactory::Pointer(0) : target.Cast< PerspectiveDescriptor> ()->CreateFactory(); } // otherwise try to create the executable extension if (configElement != 0) { try { IPerspectiveFactory::Pointer factory( configElement ->CreateExecutableExtension ( WorkbenchRegistryConstants::ATT_CLASS)); if (factory.IsNull()) { // support legacy BlueBerry extensions factory = configElement ->CreateExecutableExtension ( WorkbenchRegistryConstants::ATT_CLASS, IPerspectiveFactory::GetManifestName()); } return factory; } catch (CoreException& /*e*/) { // do nothing } } return IPerspectiveFactory::Pointer(0); } void PerspectiveDescriptor::DeleteCustomDefinition() { dynamic_cast (WorkbenchPlugin::GetDefault() ->GetPerspectiveRegistry())->DeleteCustomDefinition( PerspectiveDescriptor::Pointer(this)); } std::string PerspectiveDescriptor::GetDescription() const { return configElement == 0 ? description : RegistryReader::GetDescription( configElement); } bool PerspectiveDescriptor::GetFixed() const { if (configElement == 0) return fixed; bool val = false; configElement->GetBoolAttribute(WorkbenchRegistryConstants::ATT_FIXED, val); return val; } +std::vector< std::string> PerspectiveDescriptor::GetKeywordReferences() const +{ + std::vector result; + if (configElement.IsNull()) + { + return result; + } + + std::string keywordRefId; + std::vector keywordRefs; + berry::IConfigurationElement::vector::iterator keywordRefsIt; + keywordRefs = configElement->GetChildren("keywordReference"); + for (keywordRefsIt = keywordRefs.begin() + ; keywordRefsIt != keywordRefs.end(); ++keywordRefsIt) // iterate over all refs + { + (*keywordRefsIt)->GetAttribute("id", keywordRefId); + result.push_back(keywordRefId); + } + return result; +} + std::string PerspectiveDescriptor::GetId() const { return id; } std::string PerspectiveDescriptor::GetPluginId() const { return configElement == 0 ? pluginId : configElement->GetContributor(); } ImageDescriptor::Pointer PerspectiveDescriptor::GetImageDescriptor() const { if (imageDescriptor) return imageDescriptor; if (configElement) { std::string icon; configElement->GetAttribute(WorkbenchRegistryConstants::ATT_ICON, icon); if (!icon.empty()) { imageDescriptor = AbstractUICTKPlugin::ImageDescriptorFromPlugin( configElement->GetContributor(), icon); } - } if (!imageDescriptor) { imageDescriptor = ImageDescriptor::GetMissingImageDescriptor(); } return imageDescriptor; } std::string PerspectiveDescriptor::GetLabel() const { if (configElement == 0) return label; std::string val; configElement->GetAttribute(WorkbenchRegistryConstants::ATT_NAME, val); return val; } std::string PerspectiveDescriptor::GetOriginalId() const { if (originalId == "") { return this->GetId(); } return originalId; } bool PerspectiveDescriptor::HasCustomDefinition() const { return dynamic_cast (WorkbenchPlugin::GetDefault()->GetPerspectiveRegistry())->HasCustomDefinition( PerspectiveDescriptor::ConstPointer(this)); } bool PerspectiveDescriptor::HasDefaultFlag() const { if (configElement == 0) { return false; } bool val = false; configElement->GetBoolAttribute(WorkbenchRegistryConstants::ATT_DEFAULT, val); return val; } bool PerspectiveDescriptor::IsPredefined() const { return this->GetFactoryClassName() != "" && configElement != 0; } bool PerspectiveDescriptor::IsSingleton() const { if (configElement == 0) return singleton; bool val = false; configElement->GetBoolAttribute(WorkbenchRegistryConstants::ATT_SINGLETON, val); return val; } bool PerspectiveDescriptor::RestoreState(IMemento::Pointer memento) { IMemento::Pointer childMem(memento->GetChild( WorkbenchConstants::TAG_DESCRIPTOR)); if (childMem) { childMem->GetString(WorkbenchConstants::TAG_ID, id); childMem->GetString(WorkbenchConstants::TAG_DESCRIPTOR, originalId); childMem->GetString(WorkbenchConstants::TAG_LABEL, label); childMem->GetString(WorkbenchConstants::TAG_CLASS, className); int singletonVal; singleton = childMem->GetInteger(WorkbenchConstants::TAG_SINGLETON, singletonVal); // Find a descriptor in the registry. IPerspectiveDescriptor::Pointer descriptor = WorkbenchPlugin::GetDefault() ->GetPerspectiveRegistry()->FindPerspectiveWithId( this->GetOriginalId()); if (descriptor) { // Copy the state from the registred descriptor. imageDescriptor = descriptor->GetImageDescriptor(); } } //return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", null); //$NON-NLS-1$ return true; } void PerspectiveDescriptor::RevertToPredefined() { if (this->IsPredefined()) { this->DeleteCustomDefinition(); } } bool PerspectiveDescriptor::SaveState(IMemento::Pointer memento) { IMemento::Pointer childMem(memento->CreateChild( WorkbenchConstants::TAG_DESCRIPTOR)); childMem->PutString(WorkbenchConstants::TAG_ID, GetId()); if (!originalId.empty()) { childMem->PutString(WorkbenchConstants::TAG_DESCRIPTOR, originalId); } childMem->PutString(WorkbenchConstants::TAG_LABEL, GetLabel()); childMem->PutString(WorkbenchConstants::TAG_CLASS, GetFactoryClassName()); if (singleton) { childMem->PutInteger(WorkbenchConstants::TAG_SINGLETON, 1); } //return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", null); return true; } IConfigurationElement::Pointer PerspectiveDescriptor::GetConfigElement() const { return configElement; } std::string PerspectiveDescriptor::GetFactoryClassName() const { return configElement == 0 ? className : RegistryReader::GetClassValue( configElement, WorkbenchRegistryConstants::ATT_CLASS); } - -} +} \ No newline at end of file diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.h b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.h index d7c3f78cce..b5151f633c 100644 --- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.h +++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.h @@ -1,230 +1,231 @@ /*=================================================================== BlueBerry Platform Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef BERRYPERSPECTIVEDESCRIPTOR_H_ #define BERRYPERSPECTIVEDESCRIPTOR_H_ #include #include "berryIPerspectiveDescriptor.h" #include "berryIPerspectiveFactory.h" #include "berryIMemento.h" #include namespace berry { /** * \ingroup org_blueberry_ui_internal * * PerspectiveDescriptor. *

* A PerspectiveDesciptor has 3 states: *

*
    *
  1. It isPredefined(), in which case it was defined from an * extension point.
  2. *
  3. It isPredefined() and hasCustomFile, in * which case the user has customized a predefined perspective.
  4. *
  5. It hasCustomFile, in which case the user created a new * perspective.
  6. *
* */ class PerspectiveDescriptor : public IPerspectiveDescriptor { public: berryObjectMacro(PerspectiveDescriptor); private: std::string id; std::string pluginId; std::string originalId; std::string label; std::string className; std::string description; bool singleton; bool fixed; mutable ImageDescriptor::Pointer imageDescriptor; IConfigurationElement::Pointer configElement; /** * Create a new empty descriptor. * * @param id * the id of the new descriptor * @param label * the label of the new descriptor * @param originalDescriptor * the descriptor that this descriptor is based on */ public: PerspectiveDescriptor(const std::string& id, const std::string& label, PerspectiveDescriptor::Pointer originalDescriptor); /** * Create a descriptor from a config element. * * @param id * the id of the element to create * @param configElement * the element to base this perspective on * @throws CoreException * thrown if there are any missing attributes */ public: PerspectiveDescriptor(const std::string& id, IConfigurationElement::Pointer configElement); /** * Creates a factory for a predefined perspective. If the perspective is not * predefined return null. * * @return the IPerspectiveFactory or null * @throws CoreException * if the object could not be instantiated. */ public: IPerspectiveFactory::Pointer CreateFactory(); /** * Deletes the custom definition for a perspective.. */ public: void DeleteCustomDefinition(); /* * (non-Javadoc) * * @see org.blueberry.ui.IPerspectiveDescriptor#getDescription() */ public: std::string GetDescription() const; public: void SetDescription(std::string desc) {description = desc; } + std::vector< std::string> GetKeywordReferences() const; /** * Returns whether or not this perspective is fixed. * * @return whether or not this perspective is fixed */ public: bool GetFixed() const; /* * (non-Javadoc) * * @see org.blueberry.ui.IPerspectiveDescriptor#getId() */ public: std::string GetId() const; public: std::string GetPluginId() const; /* * (non-Javadoc) * * @see org.blueberry.ui.IPerspectiveDescriptor#getImageDescriptor() */ public: ImageDescriptor::Pointer GetImageDescriptor() const; /* * (non-Javadoc) * * @see org.blueberry.ui.IPerspectiveDescriptor#getLabel() */ public: std::string GetLabel() const; /** * Return the original id of this descriptor. * * @return the original id of this descriptor */ public: std::string GetOriginalId() const; /** * Returns true if this perspective has a custom definition. * * @return whether this perspective has a custom definition */ public: bool HasCustomDefinition() const; /** * Returns true if this perspective wants to be default. * * @return whether this perspective wants to be default */ public: bool HasDefaultFlag() const; /** * Returns true if this perspective is predefined by an * extension. * * @return boolean whether this perspective is predefined by an extension */ public: bool IsPredefined() const; /** * Returns true if this perspective is a singleton. * * @return whether this perspective is a singleton */ public: bool IsSingleton() const; /** * Restore the state of a perspective from a memento. * * @param memento * the memento to restore from * @return the IStatus of the operation * @see org.blueberry.ui.IPersistableElement */ public: bool RestoreState(IMemento::Pointer memento); /** * Revert to the predefined extension template. Does nothing if this * descriptor is user defined. */ public: void RevertToPredefined(); /** * Save the state of a perspective to a memento. * * @param memento * the memento to restore from * @return the IStatus of the operation * @see org.blueberry.ui.IPersistableElement */ public: bool SaveState(IMemento::Pointer memento); /** * Return the configuration element used to create this perspective, if one * was used. * * @return the configuration element used to create this perspective * @since 3.0 */ public: IConfigurationElement::Pointer GetConfigElement() const; /** * Returns the factory class name for this descriptor. * * @return the factory class name for this descriptor * @since 3.1 */ public: std::string GetFactoryClassName() const; }; } #endif /*BERRYPERSPECTIVEDESCRIPTOR_H_*/ diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryViewDescriptor.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryViewDescriptor.cpp index 052d3d59fe..efce111c1c 100644 --- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryViewDescriptor.cpp +++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryViewDescriptor.cpp @@ -1,213 +1,228 @@ /*=================================================================== BlueBerry Platform Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "berryViewDescriptor.h" #include "service/berryIConfigurationElement.h" #include "berryPlatformException.h" #include "berryRegistryReader.h" #include "berryWorkbenchRegistryConstants.h" #include "berryImageDescriptor.h" #include "berryAbstractUIPlugin.h" #include "berryAbstractUICTKPlugin.h" #include "berryImageDescriptor.h" #include "handlers/berryIHandlerActivation.h" #include #include namespace berry { - ViewDescriptor::ViewDescriptor(IConfigurationElement::Pointer e) : configElement(e) { this->LoadFromExtension(); } IViewPart::Pointer ViewDescriptor::CreateView() { IViewPart::Pointer part(configElement->CreateExecutableExtension ( WorkbenchRegistryConstants::ATT_CLASS)); if (part.IsNull()) { // support legacy BlueBerry extensions part = configElement->CreateExecutableExtension ( WorkbenchRegistryConstants::ATT_CLASS, IViewPart::GetManifestName()); } return part; } const std::vector& ViewDescriptor::GetCategoryPath() const { return categoryPath; } IConfigurationElement::Pointer ViewDescriptor::GetConfigurationElement() const { return configElement; } std::string ViewDescriptor::GetDescription() const { return RegistryReader::GetDescription(configElement); } std::string ViewDescriptor::GetId() const { return id; } bool ViewDescriptor::operator==(const Object* o) const { if (const IViewDescriptor* other = dynamic_cast(o)) return this->GetId() == other->GetId(); return false; } ImageDescriptor::Pointer ViewDescriptor::GetImageDescriptor() const { if (imageDescriptor) { return imageDescriptor; } std::string iconName; configElement->GetAttribute(WorkbenchRegistryConstants::ATT_ICON, iconName); // If the icon attribute was omitted, use the default one if (iconName.empty()) { //TODO default image descriptor //return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW); return ImageDescriptor::GetMissingImageDescriptor(); } const IExtension* extension(configElement->GetDeclaringExtension()); const std::string extendingPluginId(extension->GetNamespace()); imageDescriptor = AbstractUICTKPlugin::ImageDescriptorFromPlugin( extendingPluginId, iconName); if (!imageDescriptor) { // Try legacy BlueBerry method imageDescriptor = AbstractUIPlugin::ImageDescriptorFromPlugin( extendingPluginId, iconName); } // If the icon attribute was invalid, use the error icon if (!imageDescriptor) { imageDescriptor = ImageDescriptor::GetMissingImageDescriptor(); } return imageDescriptor; } std::string ViewDescriptor::GetLabel() const { std::string label; configElement->GetAttribute(WorkbenchRegistryConstants::ATT_NAME, label); return label; } std::string ViewDescriptor::GetAccelerator() const { std::string accel; configElement->GetAttribute(WorkbenchRegistryConstants::ATT_ACCELERATOR, accel); return accel; } bool ViewDescriptor::GetAllowMultiple() const { bool allow = false; configElement->GetBoolAttribute(WorkbenchRegistryConstants::ATT_ALLOW_MULTIPLE, allow); return allow; } bool ViewDescriptor::IsRestorable() const { std::string string; if (configElement->GetAttribute(WorkbenchRegistryConstants::ATT_RESTORABLE, string)) { return Poco::icompare(string, "true") == 0; } else { return true; } } Poco::Any ViewDescriptor::GetAdapter(const std::string& adapter) { if (adapter == IConfigurationElement::GetStaticClassName()) { return Poco::Any(GetConfigurationElement()); } return Poco::Any(); } void ViewDescriptor::ActivateHandler() { //TODO ViewDescriptor handler activation // if (!handlerActivation) // { // IHandler::Pointer handler(new ShowViewHandler(this->GetId())); // IHandlerService::Pointer handlerService( // PlatformUI::GetWorkbench()->GetService(IHandlerService::GetManifestName()).Cast()); // handlerActivation = handlerService // ->ActivateHandler(this->GetId(), handler); // } } void ViewDescriptor::DeactivateHandler() { //TODO ViewDescriptor handler deactivation // if (handlerActivation) // { // IHandlerService::Pointer handlerService( // PlatformUI::GetWorkbench()->GetService(IHandlerService::GetManifestName()).Cast()); // handlerService->DeactivateHandler(handlerActivation); // handlerActivation = 0; // } } +std::vector< std::string> ViewDescriptor::GetKeywordReferences() const +{ + std::vector result; + std::string keywordRefId; + std::vector keywordRefs; + berry::IConfigurationElement::vector::iterator keywordRefsIt; + keywordRefs = configElement->GetChildren("keywordReference"); + for (keywordRefsIt = keywordRefs.begin() + ; keywordRefsIt != keywordRefs.end(); ++keywordRefsIt) // iterate over all refs + { + (*keywordRefsIt)->GetAttribute("id", keywordRefId); + result.push_back(keywordRefId); + } + return result; +} + + void ViewDescriptor::LoadFromExtension() { configElement->GetAttribute(WorkbenchRegistryConstants::ATT_ID, id); // Sanity check. std::string name; if ((configElement->GetAttribute(WorkbenchRegistryConstants::ATT_NAME, name) == false) || (RegistryReader::GetClassValue(configElement, WorkbenchRegistryConstants::ATT_CLASS) == "")) { throw CoreException( "Invalid extension (missing label or class name)", id); } std::string category; if (configElement->GetAttribute(WorkbenchRegistryConstants::TAG_CATEGORY, category)) { Poco::StringTokenizer stok(category, "/", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); // Parse the path tokens and store them for (Poco::StringTokenizer::Iterator iter = stok.begin(); iter != stok.end(); ++iter) { categoryPath.push_back(*iter); } } } - -} // namespace berry +} // namespace berry \ No newline at end of file diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryViewDescriptor.h b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryViewDescriptor.h index f7027d7768..8882a72a84 100644 --- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryViewDescriptor.h +++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryViewDescriptor.h @@ -1,152 +1,152 @@ /*=================================================================== BlueBerry Platform Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef BERRYVIEWDESCRIPTOR_H_ #define BERRYVIEWDESCRIPTOR_H_ #include "berryIViewPart.h" #include "berryIViewDescriptor.h" #include "service/berryIConfigurationElement.h" #include #include namespace berry { - struct IHandlerActivation; /** * \ingroup org_blueberry_ui_internal * */ class ViewDescriptor : public IViewDescriptor { private: std::string id; mutable SmartPointer imageDescriptor; IConfigurationElement::Pointer configElement; std::vector categoryPath; /** * The activation token returned when activating the show view handler with * the workbench. */ SmartPointer handlerActivation; public: berryObjectMacro(ViewDescriptor); /** * Create a new ViewDescriptor for an extension. * * @param e the configuration element * @throws CoreException thrown if there are errors in the configuration */ ViewDescriptor(IConfigurationElement::Pointer e); /* (non-Javadoc) * @see org.blueberry.ui.internal.registry.IViewDescriptor#createView() */ IViewPart::Pointer CreateView(); /* (non-Javadoc) * @see org.blueberry.ui.internal.registry.IViewDescriptor#getCategoryPath() */ const std::vector& GetCategoryPath() const; /** * Return the configuration element for this descriptor. * * @return the configuration element */ IConfigurationElement::Pointer GetConfigurationElement() const; /* (non-Javadoc) * @see org.blueberry.ui.internal.registry.IViewDescriptor#getDescription() */ std::string GetDescription() const; + std::vector< std::string> GetKeywordReferences() const; + /* (non-Javadoc) * @see org.blueberry.ui.IWorkbenchPartDescriptor#getId() */ std::string GetId() const; /* (non-Javadoc) * @see org.blueberry.ui.IWorkbenchPartDescriptor#getImageDescriptor() */ SmartPointer GetImageDescriptor() const; /* (non-Javadoc) * @see org.blueberry.ui.IWorkbenchPartDescriptor#getLabel() */ std::string GetLabel() const; /** * Return the accelerator attribute. * * @return the accelerator attribute */ std::string GetAccelerator() const; /* (non-Javadoc) * @see org.blueberry.ui.internal.registry.IViewDescriptor#getAllowMultiple() */ bool GetAllowMultiple() const; /* (non-Javadoc) * @see org.eclipse.ui.views.IViewDescriptor#getRestorable() */ bool IsRestorable() const; bool operator==(const Object*) const; /** * Activates a show view handler for this descriptor. This handler can later * be deactivated by calling {@link ViewDescriptor#deactivateHandler()}. * This method will only activate the handler if it is not currently active. * */ void ActivateHandler(); /** * Deactivates the show view handler for this descriptor. This handler was * previously activated by calling {@link ViewDescriptor#activateHandler()}. * This method will only deactivative the handler if it is currently active. * */ void DeactivateHandler(); protected: /* (non-Javadoc) * @see IAdaptable#GetAdapterImpl(const std::type_info&) */ Poco::Any GetAdapter(const std::string& adapter); private: /** * load a view descriptor from the registry. */ void LoadFromExtension(); }; - } #endif /*BERRYVIEWDESCRIPTOR_H_*/ diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml b/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml index 8d9a6664f0..7bf77e73d4 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml @@ -1,206 +1,207 @@ This is a short information about this perspective + diff --git a/Plugins/org.mitk.gui.qt.ext/files.cmake b/Plugins/org.mitk.gui.qt.ext/files.cmake index 1417fb89bb..b56eabfd78 100644 --- a/Plugins/org.mitk.gui.qt.ext/files.cmake +++ b/Plugins/org.mitk.gui.qt.ext/files.cmake @@ -1,70 +1,67 @@ set(SRC_CPP_FILES QmitkExtActionBarAdvisor.cpp QmitkExtWorkbenchWindowAdvisor.cpp QmitkExtFileSaveProjectAction.cpp QmitkOpenDicomEditorAction.cpp QmitkOpenXnatEditorAction.cpp QmitkViewBrowserWidget.cpp QmitkNewPerspectiveDialog.cpp - ViewTagsRegistry.cpp - ViewTagsDescriptor.cpp - ExtensionPointDefinitionConstants.cpp ) set(INTERNAL_CPP_FILES QmitkAppInstancesPreferencePage.cpp QmitkExternalProgramsPreferencePage.cpp QmitkCommonExtPlugin.cpp QmitkInputDevicesPrefPage.cpp QmitkModuleView.cpp ) set(UI_FILES src/internal/QmitkAppInstancesPreferencePage.ui src/internal/QmitkExternalProgramsPreferencePage.ui src/QmitkViewBrowserWidgetControls.ui ) set(MOC_H_FILES src/QmitkExtFileSaveProjectAction.h src/QmitkExtWorkbenchWindowAdvisor.h src/internal/QmitkAppInstancesPreferencePage.h src/internal/QmitkExternalProgramsPreferencePage.h src/internal/QmitkCommonExtPlugin.h src/internal/QmitkExtWorkbenchWindowAdvisorHack.h src/internal/QmitkInputDevicesPrefPage.h src/internal/QmitkModuleView.h src/QmitkOpenDicomEditorAction.h src/QmitkOpenXnatEditorAction.h src/QmitkViewBrowserWidget.h src/mitkQtPerspectiveItem.h src/mitkQtViewItem.h src/QmitkNewPerspectiveDialog.h ) set(CACHED_RESOURCE_FILES # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench plugin.xml resources/ModuleView.png ) set(QRC_FILES # uncomment the following line if you want to use Qt resources resources/org_mitk_gui_qt_ext.qrc ) set(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Plugins/org.mitk.gui.qt.ext/plugin.xml b/Plugins/org.mitk.gui.qt.ext/plugin.xml index 6803d03bad..b9e718f264 100644 --- a/Plugins/org.mitk.gui.qt.ext/plugin.xml +++ b/Plugins/org.mitk.gui.qt.ext/plugin.xml @@ -1,35 +1,34 @@ - diff --git a/Plugins/org.mitk.gui.qt.ext/schema/taglist.exsd b/Plugins/org.mitk.gui.qt.ext/schema/taglist.exsd deleted file mode 100644 index 4121d861d7..0000000000 --- a/Plugins/org.mitk.gui.qt.ext/schema/taglist.exsd +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - This extension point is used as an example for the extension point declaration (BlueBerry examples). - - - - - - - - - - - - a fully qualified identifier of the target extension point - - - - - - - an optional identifier of the extension instance - - - - - - - an optional name of the extension instance - - - - - - - - - - - - - - - - - - the identifier of the text changer - - - - - - - - - - - - - An optional subelement whose body should contain text providing a short description. - - - - - - - - - - The value of the <samp>class</samp> attribute must be a -fully qualified name of the class that implements -<samp>Inewchangetext</samp>. - - - - - - - - - Copyright (c) 2012 Medical and Biological Informatics, DKFZ<br> -All rights reserved. - - - - \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.ext/src/ExtensionPointDefinitionConstants.cpp b/Plugins/org.mitk.gui.qt.ext/src/ExtensionPointDefinitionConstants.cpp deleted file mode 100644 index 4120055986..0000000000 --- a/Plugins/org.mitk.gui.qt.ext/src/ExtensionPointDefinitionConstants.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#include "ExtensionPointDefinitionConstants.h" - -#include "ViewTagsRegistry.h" - -const std::string ExtensionPointDefinitionConstants::VIEWTAGS_XP_NAME = "org.blueberry.ui.taglists"; -const std::string ExtensionPointDefinitionConstants::VIEWTAGS_CHILD_TAG = "tag"; -const std::string ExtensionPointDefinitionConstants::VIEWTAGS_XMLATTRIBUTE_ID = "id"; \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.ext/src/ExtensionPointDefinitionConstants.h b/Plugins/org.mitk.gui.qt.ext/src/ExtensionPointDefinitionConstants.h deleted file mode 100644 index f03a0794cd..0000000000 --- a/Plugins/org.mitk.gui.qt.ext/src/ExtensionPointDefinitionConstants.h +++ /dev/null @@ -1,40 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#ifndef EXTENSIONPOINTDEFINITIONCONSTANTS_H_ -#define EXTENSIONPOINTDEFINITIONCONSTANTS_H_ - -#include - -/** - * The ExtensionPointDefinitionConstants contains a list of unique ids in the - * following form:
- * "org.mitk.mybundle.mytype.propername"
- * - * This ids have the purpose of connecting the plugin.xml of each bundle to the - * appropriate classes. - * - * Additionally it includes names of tags, which are used in XML files
- * regarding the BlueBerry example. - */ -struct ExtensionPointDefinitionConstants -{ - static const std::string VIEWTAGS_XP_NAME; - static const std::string VIEWTAGS_CHILD_TAG; - static const std::string VIEWTAGS_XMLATTRIBUTE_ID; -}; - -#endif /*EXTENSIONPOINTDEFINITIONCONSTANTS_H_*/ diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.cpp b/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.cpp index b3ef210158..eb3c13b34e 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.cpp +++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.cpp @@ -1,544 +1,589 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ //Qmitk headers #include "QmitkViewBrowserWidget.h" // Blueberry #include #include #include #include #include +#include + // Qt #include #include #include #include +class KeywordRegistry +{ +public: + KeywordRegistry() + { + berry::IExtensionPointService::Pointer extensionPointService = berry::Platform::GetExtensionPointService(); + berry::IConfigurationElement::vector keywordExts(extensionPointService->GetConfigurationElementsFor("org.blueberry.ui.keywords")); + + std::string keywordId; + std::string keywordLabels; + berry::IConfigurationElement::vector::iterator keywordExtsIt; + for (keywordExtsIt = keywordExts.begin(); keywordExtsIt != keywordExts.end(); ++keywordExtsIt) + { + (*keywordExtsIt)->GetAttribute("id", keywordId); + (*keywordExtsIt)->GetAttribute("label", keywordLabels); + + if (m_Keywords.find(keywordId) == m_Keywords.end()) + { + m_Keywords[keywordId] = std::vector(); + } + m_Keywords[keywordId].push_back(QString::fromStdString(keywordLabels)); + } + } + + std::vector GetKeywords(std::string id) + { + return m_Keywords[id]; + } + + std::vector GetKeywords(std::vector ids) + { + std::vector result; + for (int i = 0; i < ids.size(); ++i) + { + std::vector< QString > tmpResult; + tmpResult = this->GetKeywords(ids[i]); + result.insert(result.end(), tmpResult.begin(), tmpResult.end()); + } + return result; + } + +private: + std::map > m_Keywords; +}; + + class ClassFilterProxyModel : public QSortFilterProxyModel { private : bool hasToBeDisplayed(const QModelIndex index) const; bool displayElement(const QModelIndex index) const; public: ClassFilterProxyModel(QObject *parent = NULL); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; }; ClassFilterProxyModel::ClassFilterProxyModel(QObject *parent): QSortFilterProxyModel(parent) { } bool ClassFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); return hasToBeDisplayed(index); } bool ClassFilterProxyModel::displayElement(const QModelIndex index) const { bool result = false; QString type = sourceModel()->data(index, Qt::DisplayRole).toString(); QStandardItem * item = dynamic_cast(sourceModel())->itemFromIndex(index); if (type.contains(filterRegExp())) { return true; } { mitk::QtViewItem* viewItem = dynamic_cast(item); if (viewItem) { for (int i = 0; i < viewItem->m_Tags.size(); ++i) { if (viewItem->m_Tags[i].contains(filterRegExp())) { return true; } } if (viewItem->m_Description.contains(filterRegExp())) { return true; } } } { mitk::QtPerspectiveItem* viewItem = dynamic_cast(item); if (viewItem) { for (int i = 0; i < viewItem->m_Tags.size(); ++i) { if (viewItem->m_Tags[i].contains(filterRegExp())) { return true; } } if (viewItem->m_Description.contains(filterRegExp())) { return true; } } } return result; } bool ClassFilterProxyModel::hasToBeDisplayed(const QModelIndex index) const { bool result = false; // How many child this element have if ( sourceModel()->rowCount(index) > 0 ) { for( int ii = 0; ii < sourceModel()->rowCount(index); ii++) { QModelIndex childIndex = sourceModel()->index(ii,0,index); if ( ! childIndex.isValid() ) break; result = hasToBeDisplayed(childIndex); result |= displayElement(index); if (result) { // there is atless one element to display break; } } } else { result = displayElement(index); } return result; } struct ViewBrowserWindowListener : public berry::IWindowListener { ViewBrowserWindowListener(QmitkViewBrowserWidget* switcher) : switcher(switcher), m_Running(false) {} virtual void WindowOpened(berry::IWorkbenchWindow::Pointer /*window*/) { if (m_Running) return; m_Running = true; switcher->FillTreeList(); m_Running = false; } virtual void WindowActivated(berry::IWorkbenchWindow::Pointer /*window*/) { if (m_Running) return; m_Running = true; switcher->FillTreeList(); m_Running = false; } private: QmitkViewBrowserWidget* switcher; bool m_Running; }; bool compareViews(berry::IViewDescriptor::Pointer a, berry::IViewDescriptor::Pointer b) { if (a.IsNull() || b.IsNull()) return false; return a->GetLabel().compare(b->GetLabel()) < 0; } bool compareQStandardItems(QStandardItem* a, QStandardItem* b) { if (a==NULL || b==NULL) return false; return a->text().compare(b->text()) < 0; } QmitkViewBrowserWidget::QmitkViewBrowserWidget( QWidget * parent, Qt::WindowFlags ) : QWidget(parent) { this->CreateQtPartControl(this); } QmitkViewBrowserWidget::~QmitkViewBrowserWidget() { } void QmitkViewBrowserWidget::CreateQtPartControl( QWidget *parent ) { // create GUI widgets from the Qt Designer's .ui file m_WindowListener = ViewBrowserWindowListener::Pointer(new ViewBrowserWindowListener(this)); berry::PlatformUI::GetWorkbench()->AddWindowListener(m_WindowListener); m_Parent = parent; m_Controls.setupUi( parent ); connect( m_Controls.m_PluginTreeView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(CustomMenuRequested(QPoint))); connect( m_Controls.m_PluginTreeView, SIGNAL(doubleClicked(const QModelIndex&)), SLOT(ItemClicked(const QModelIndex&))); connect( m_Controls.lineEdit, SIGNAL(textChanged(QString)), SLOT(FilterChanged())); m_ContextMenu = new QMenu(m_Controls.m_PluginTreeView); m_Controls.m_PluginTreeView->setContextMenuPolicy(Qt::CustomContextMenu); // Create a new TreeModel for the data m_TreeModel = new QStandardItemModel(); m_FilterProxyModel = new ClassFilterProxyModel(this); m_FilterProxyModel->setSourceModel(m_TreeModel); //proxyModel->setFilterFixedString("Diff"); m_Controls.m_PluginTreeView->setModel(m_FilterProxyModel); FillTreeList(); - - QList additions = m_Registry.GetViewTags(); - foreach (const ViewTagsDescriptor::Pointer& var, additions) - { - std::cout << var->GetID().toStdString() << std::endl; - } } void QmitkViewBrowserWidget::FillTreeList() { // active workbench window available? if (berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow().IsNull()) return; // active page available? berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); if (page.IsNull()) return; // everything is fine and we can remove the window listener berry::PlatformUI::GetWorkbench()->RemoveWindowListener(m_WindowListener); // initialize tree model m_TreeModel->clear(); QStandardItem *treeRootItem = m_TreeModel->invisibleRootItem(); // get all available perspectives berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); std::vector perspectives(perspRegistry->GetPerspectives()); + // get all Keywords + KeywordRegistry keywordRegistry; + QModelIndex currentIndex; berry::IPerspectiveDescriptor::Pointer currentPersp = page->GetPerspective(); std::vector perspectiveExcludeList = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetPerspectiveExcludeList(); QStandardItem *perspectiveRootItem = new QStandardItem("Perspectives"); treeRootItem->appendRow(perspectiveRootItem); for (unsigned int i=0; iGetId()) { skipPerspective = true; break; } if (skipPerspective) continue; QIcon* pIcon = static_cast(p->GetImageDescriptor()->CreateImage()); mitk::QtPerspectiveItem* pItem = new mitk::QtPerspectiveItem(*pIcon, QString::fromStdString(p->GetLabel())); pItem->m_Perspective = p; - ViewTagsDescriptor::Pointer tags = m_Registry.Find(p->GetId()); pItem->m_Description = QString::fromStdString(p->GetDescription()); - pItem->m_Tags = tags->GetTags(); + std::vector keylist = p->GetKeywordReferences(); + pItem->m_Tags = keywordRegistry.GetKeywords(keylist); perspectiveRootItem->appendRow(pItem); if (currentPersp) { if (currentPersp->GetId()==p->GetId()) currentIndex = pItem->index(); } } // get all available views berry::IViewRegistry* viewRegistry = berry::PlatformUI::GetWorkbench()->GetViewRegistry(); std::vector views(viewRegistry->GetViews()); std::sort(views.begin(), views.end(), compareViews); std::vector viewExcludeList = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetViewExcludeList(); QStandardItem* viewRootItem = new QStandardItem(QIcon(),"View categories"); treeRootItem->appendRow(viewRootItem); std::vector< QStandardItem* > categoryItems; QStandardItem* noCategoryItem = new QStandardItem(QIcon(),"Miscellaneous"); for (unsigned int i = 0; i < views.size(); ++i) { berry::IViewDescriptor::Pointer v = views[i]; - ViewTagsDescriptor::Pointer tags = m_Registry.Find(views[i]->GetId()); bool skipView = false; for(unsigned int e=0; eGetId()) { skipView = true; break; } if (skipView) continue; std::vector catPath = v->GetCategoryPath(); QIcon* icon = static_cast(v->GetImageDescriptor()->CreateImage()); mitk::QtViewItem* vItem = new mitk::QtViewItem(*icon, QString::fromStdString(v->GetLabel())); vItem->m_View = v; vItem->m_Description = QString::fromStdString(v->GetDescription()); - vItem->m_Tags = tags->GetTags(); + std::vector keylist = v->GetKeywordReferences(); + vItem->m_Tags = keywordRegistry.GetKeywords(keylist); if (catPath.empty()) noCategoryItem->appendRow(vItem); else { QStandardItem* categoryItem = NULL; for (unsigned int c=0; ctext().toStdString() == catPath.front()) { categoryItem = categoryItems.at(c); break; } if (categoryItem==NULL) { categoryItem = new QStandardItem(QIcon(),catPath.front().c_str()); categoryItems.push_back(categoryItem); } categoryItem->appendRow(vItem); } } std::sort(categoryItems.begin(), categoryItems.end(), compareQStandardItems); for (unsigned int i=0; iappendRow(categoryItems.at(i)); if (noCategoryItem->hasChildren()) viewRootItem->appendRow(noCategoryItem); QModelIndex correctedIndex = m_FilterProxyModel->mapFromSource(currentIndex); m_Controls.m_PluginTreeView->setCurrentIndex(correctedIndex); } void QmitkViewBrowserWidget::FilterChanged() { QString filterString = m_Controls.lineEdit->text(); if (filterString.size() > 0 ) m_Controls.m_PluginTreeView->expandAll(); else m_Controls.m_PluginTreeView->collapseAll(); QRegExp::PatternSyntax syntax = QRegExp::RegExp; Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive; QString strPattern = "^*" + filterString; QRegExp regExp(strPattern, caseSensitivity); m_FilterProxyModel->setFilterRegExp(regExp); } void QmitkViewBrowserWidget::ItemClicked(const QModelIndex &index) { QStandardItem* item = m_TreeModel->itemFromIndex(m_FilterProxyModel->mapToSource(index)); if ( dynamic_cast< mitk::QtPerspectiveItem* >(item) ) { try { mitk::QtPerspectiveItem* pItem = dynamic_cast< mitk::QtPerspectiveItem* >(item); berry::PlatformUI::GetWorkbench()->ShowPerspective( pItem->m_Perspective->GetId(), berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow() ); } catch (...) { QMessageBox::critical(0, "Opening Perspective Failed", QString("The requested perspective could not be opened.\nSee the log for details.")); } } else if ( dynamic_cast< mitk::QtViewItem* >(item) ) { berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); if (page.IsNotNull()) { try { mitk::QtViewItem* vItem = dynamic_cast< mitk::QtViewItem* >(item); page->ShowView(vItem->m_View->GetId()); } catch (berry::PartInitException e) { BERRY_ERROR << "Error: " << e.displayText() << std::endl; } } } } void QmitkViewBrowserWidget::AddPerspective() { QmitkNewPerspectiveDialog* dialog = new QmitkNewPerspectiveDialog( m_Parent ); int dialogReturnValue = dialog->exec(); if ( dialogReturnValue == QDialog::Rejected ) return; berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); try { berry::IPerspectiveDescriptor::Pointer perspDesc; perspDesc = perspRegistry->CreatePerspective(dialog->GetPerspectiveName().toStdString(), perspRegistry->FindPerspectiveWithId(perspRegistry->GetDefaultPerspective())); berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->SetPerspective(perspDesc); } catch(...) { QMessageBox::warning(m_Parent, "Error", "Duplication of selected perspective failed. Please make sure the specified perspective name is not already in use!"); } FillTreeList(); } void QmitkViewBrowserWidget::ClonePerspective() { if (m_RegisteredPerspective.IsNotNull()) { QmitkNewPerspectiveDialog* dialog = new QmitkNewPerspectiveDialog( m_Parent ); QString defaultName(m_RegisteredPerspective->GetLabel().c_str()); defaultName.append(" Copy"); dialog->SetPerspectiveName(defaultName); int dialogReturnValue = dialog->exec(); if ( dialogReturnValue == QDialog::Rejected ) return; berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); try { berry::IPerspectiveDescriptor::Pointer perspDesc = perspRegistry->ClonePerspective(dialog->GetPerspectiveName().toStdString(), dialog->GetPerspectiveName().toStdString(), m_RegisteredPerspective); berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->SetPerspective(perspDesc); } catch(...) { QMessageBox::warning(m_Parent, "Error", "Duplication of selected perspective failed. Please make sure the specified perspective name is not already in use!"); } FillTreeList(); } } void QmitkViewBrowserWidget::ResetPerspective() { if (QMessageBox::Yes == QMessageBox(QMessageBox::Question, "Please confirm", "Do you really want to reset the curent perspective?", QMessageBox::Yes|QMessageBox::No).exec()) berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ResetPerspective(); } void QmitkViewBrowserWidget::DeletePerspective() { if (m_RegisteredPerspective.IsNotNull()) { QString question = "Do you really want to remove the perspective '"; question.append(m_RegisteredPerspective->GetLabel().c_str()); question.append("'?"); if (QMessageBox::Yes == QMessageBox(QMessageBox::Question, "Please confirm", question, QMessageBox::Yes|QMessageBox::No).exec()) { berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); perspRegistry->DeletePerspective(m_RegisteredPerspective); berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->RemovePerspective(m_RegisteredPerspective); FillTreeList(); if (! berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->GetPerspective()) { berry::IPerspectiveDescriptor::Pointer persp = perspRegistry->FindPerspectiveWithId(perspRegistry->GetDefaultPerspective()); berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->SetPerspective(persp); } } } } void QmitkViewBrowserWidget::ClosePerspective() { if (QMessageBox::Yes == QMessageBox(QMessageBox::Question, "Please confirm", "Do you really want to close the curent perspective?", QMessageBox::Yes|QMessageBox::No).exec()) { berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); page->CloseCurrentPerspective(true, true); if ( page->GetPerspective().IsNull() ) { berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); berry::PlatformUI::GetWorkbench()->ShowPerspective( perspRegistry->GetDefaultPerspective(), berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow() ); } } } void QmitkViewBrowserWidget::ClosePerspectives() { if (QMessageBox::Yes == QMessageBox(QMessageBox::Question, "Please confirm", "Do you really want to close all perspectives?", QMessageBox::Yes|QMessageBox::No).exec()) { berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); page->CloseAllPerspectives(true, true); berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); berry::PlatformUI::GetWorkbench()->ShowPerspective( perspRegistry->GetDefaultPerspective(), berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow() ); } } void QmitkViewBrowserWidget::CustomMenuRequested(QPoint pos) { QModelIndex index = m_Controls.m_PluginTreeView->indexAt(pos); QStandardItem* item = m_TreeModel->itemFromIndex(m_FilterProxyModel->mapToSource(index)); if (m_ContextMenu==NULL || item==NULL) return; m_ContextMenu->clear(); m_RegisteredPerspective = NULL; bool showMenu = false; if (item->text()=="Perspectives") { QAction* resetAction = new QAction("Reset current perspective", this); m_ContextMenu->addAction(resetAction); connect(resetAction, SIGNAL(triggered()), SLOT(ResetPerspective())); QAction* closeAction = new QAction("Close current perspective", this); m_ContextMenu->addAction(closeAction); connect(closeAction, SIGNAL(triggered()), SLOT(ClosePerspective())); m_ContextMenu->addSeparator(); QAction* closeAllAction = new QAction("Close all perspectives", this); m_ContextMenu->addAction(closeAllAction); connect(closeAllAction, SIGNAL(triggered()), SLOT(ClosePerspectives())); showMenu = true; } if (dynamic_cast< mitk::QtPerspectiveItem* >(item) ) { m_RegisteredPerspective = dynamic_cast< mitk::QtPerspectiveItem* >(item)->m_Perspective; //m_ContextMenu->addSeparator(); QAction* cloneAction = new QAction("Duplicate perspective", this); m_ContextMenu->addAction(cloneAction); connect(cloneAction, SIGNAL(triggered()), SLOT(ClonePerspective())); if (!m_RegisteredPerspective->IsPredefined()) { QAction* deleteAction = new QAction("Remove perspective", this); m_ContextMenu->addAction(deleteAction); connect(deleteAction, SIGNAL(triggered()), SLOT(DeletePerspective())); } showMenu = true; } if (showMenu) m_ContextMenu->popup(m_Controls.m_PluginTreeView->viewport()->mapToGlobal(pos)); } \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.h b/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.h index 9052257270..a7cc5cf78a 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.h +++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.h @@ -1,85 +1,83 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _QMITKViewBrowserWidget_H_INCLUDED #define _QMITKViewBrowserWidget_H_INCLUDED //QT headers #include #include #include "ui_QmitkViewBrowserWidgetControls.h" #include #include #include #include #include #include #include #include #include #include #include -#include class ClassFilterProxyModel; /** @brief */ class QmitkViewBrowserWidget : public QWidget { //this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT public: QmitkViewBrowserWidget (QWidget* parent = 0, Qt::WindowFlags f = 0); virtual ~QmitkViewBrowserWidget(); virtual void CreateQtPartControl(QWidget *parent); void FillTreeList(); public slots: void CustomMenuRequested(QPoint pos); void ItemClicked(const QModelIndex &index); void AddPerspective(); void ClonePerspective(); void ResetPerspective(); void DeletePerspective(); void ClosePerspectives(); void ClosePerspective(); void FilterChanged(); protected: // member variables Ui::QmitkViewBrowserWidgetControls m_Controls; QWidget* m_Parent; QStandardItemModel* m_TreeModel; ClassFilterProxyModel* m_FilterProxyModel; QMenu* m_ContextMenu; berry::IPerspectiveDescriptor::Pointer m_RegisteredPerspective; berry::IWindowListener::Pointer m_WindowListener; friend struct ViewBrowserViewListener; - ViewTagsRegistry m_Registry; private: }; #endif // _QMITKViewBrowserWidget_H_INCLUDED diff --git a/Plugins/org.mitk.gui.qt.ext/src/ViewTagsDescriptor.cpp b/Plugins/org.mitk.gui.qt.ext/src/ViewTagsDescriptor.cpp deleted file mode 100644 index e079be9b52..0000000000 --- a/Plugins/org.mitk.gui.qt.ext/src/ViewTagsDescriptor.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#include "ViewTagsDescriptor.h" -#include "ExtensionPointDefinitionConstants.h" - -#include "berryPlatformException.h" - -ViewTagsDescriptor::ViewTagsDescriptor(QString id) -{ - this->m_Id = id; - m_Tags.clear(); -} -ViewTagsDescriptor::ViewTagsDescriptor(berry::IConfigurationElement::Pointer changeTextExtensionPoint) - : m_ChangeTextExtensionPoint(changeTextExtensionPoint) -{ - std::string id; - std::string name; - - // Check if the "id" and "name" attributes are available - if (!this->m_ChangeTextExtensionPoint->GetAttribute(ExtensionPointDefinitionConstants::VIEWTAGS_XMLATTRIBUTE_ID, id)) - { - throw berry::CoreException("Invalid changetext configuration element (missing id) from: " + - m_ChangeTextExtensionPoint->GetContributor()); - } - - this->m_Id = QString::fromStdString(id); - - // Get the optional "description" child element - std::vector tags( - this->m_ChangeTextExtensionPoint->GetChildren(ExtensionPointDefinitionConstants::VIEWTAGS_CHILD_TAG)); - - for (int i = 0; i < tags.size(); ++i) - { - std::string tmpTag = tags[i]->GetValue(); - m_Tags.push_back(QString::fromStdString(tmpTag)); - } -} - -ViewTagsDescriptor::~ViewTagsDescriptor() -{ -} - -std::vector ViewTagsDescriptor::GetTags() -{ - return m_Tags; -} - -QString ViewTagsDescriptor::GetID() const -{ - return this->m_Id; -} - -bool ViewTagsDescriptor::operator==(const Object* object) const -{ - if (const ViewTagsDescriptor* other = dynamic_cast(object)) - { - return this->GetID() == other->GetID(); - } - return false; -} \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.ext/src/ViewTagsDescriptor.h b/Plugins/org.mitk.gui.qt.ext/src/ViewTagsDescriptor.h deleted file mode 100644 index ced8786754..0000000000 --- a/Plugins/org.mitk.gui.qt.ext/src/ViewTagsDescriptor.h +++ /dev/null @@ -1,70 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#ifndef VIEWTAGSDESCRIPTOR_H_ -#define VIEWTAGSDESCRIPTOR_H_ - -#include -#include - -class ViewTagsDescriptor : public berry::Object -{ -public: - - berryObjectMacro(ViewTagsDescriptor); - - /** - * Initialize the "ChangeText" Descriptor with the given extension point. - * - * @param changeTextExtensionPoint - * element, that refers to a extension point (type, id, name, class) - */ - ViewTagsDescriptor(berry::IConfigurationElement::Pointer changeTextExtensionPoint); - ViewTagsDescriptor(QString id); - - /** - * Default destructor - */ - ~ViewTagsDescriptor(); - - /** - * Returns the id of this "ChangeText". - * - * @return the id - */ - QString GetID() const; - - - std::vector GetTags(); - /** - * Equals this class with the given parameter. - * - * @param object - * the object for the equation - * @return true, if the objects are equal :: false, if they differ in any way - */ - bool operator==(const Object* object) const; - -private: - - // IConfigurationElements are used to access xml files (here: plugin.xml) - berry::IConfigurationElement::Pointer m_ChangeTextExtensionPoint; - - QString m_Id; - std::vector m_Tags; -}; - -#endif /*VIEWTAGSDESCRIPTOR_H_*/ diff --git a/Plugins/org.mitk.gui.qt.ext/src/ViewTagsRegistry.cpp b/Plugins/org.mitk.gui.qt.ext/src/ViewTagsRegistry.cpp deleted file mode 100644 index 5ea40a1e5e..0000000000 --- a/Plugins/org.mitk.gui.qt.ext/src/ViewTagsRegistry.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#include -#include -#include -#include "ViewTagsRegistry.h" -#include "ExtensionPointDefinitionConstants.h" - -ViewTagsRegistry::ViewTagsRegistry() -{ - //initialize the registry by copying all available extension points into a local variable - berry::IExtensionPointService::Pointer extensionPointService = berry::Platform::GetExtensionPointService(); - std::vector allExtensionsChangeTexts - = extensionPointService->GetConfigurationElementsFor(ExtensionPointDefinitionConstants::VIEWTAGS_XP_NAME); - - for(std::vector::const_iterator it = allExtensionsChangeTexts.begin(); - it != allExtensionsChangeTexts.end();++it) - { - ViewTagsDescriptor::Pointer temp(new ViewTagsDescriptor(*it)); - - if(!this->m_ListRegisteredViewTags.contains(temp->GetID())) - { - m_ListRegisteredViewTags.insert(temp->GetID(),temp); - } - else - { - BERRY_WARN << "The ChangeText ID: " << qPrintable(temp->GetID()) << " is already registered."; - } - } -} - -ViewTagsRegistry::~ViewTagsRegistry() -{ -} - -ViewTagsDescriptor::Pointer ViewTagsRegistry::Find(const std::string &id) const -{ - return this->Find(QString::fromStdString(id)); -} -ViewTagsDescriptor::Pointer ViewTagsRegistry::Find(const QString &id) const -{ - if (this->m_ListRegisteredViewTags.contains(id)) - { - return this->m_ListRegisteredViewTags.value(id); - } - else - { - ViewTagsDescriptor::Pointer tmp(new ViewTagsDescriptor(id)); - return tmp; - } -} - -QList ViewTagsRegistry::GetViewTags() const -{ - return m_ListRegisteredViewTags.values(); -} \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.ext/src/ViewTagsRegistry.h b/Plugins/org.mitk.gui.qt.ext/src/ViewTagsRegistry.h deleted file mode 100644 index eadc2d6b72..0000000000 --- a/Plugins/org.mitk.gui.qt.ext/src/ViewTagsRegistry.h +++ /dev/null @@ -1,54 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#ifndef VIEWTAGSREGISTRY_H -#define VIEWTAGSREGISTRY_H - -#include - -#include "ViewTagsDescriptor.h" - -class ViewTagsRegistry : public berry::Object -{ -public: - - ViewTagsRegistry(); - ~ViewTagsRegistry(); - - /** - * Return an "change text" descriptor with the given extension id. If no "change text" exists, - * with the id return null. - * - * @param id - * the id to search for - * @return the descriptor or null - */ - ViewTagsDescriptor::Pointer Find(const QString& id) const; - ViewTagsDescriptor::Pointer Find(const std::string& id) const; - - /** - * Return a list of "change texts" defined in the registry. - * - * @return the change texts. - */ - QList GetViewTags() const; - -private: - - QHash m_ListRegisteredViewTags; -}; - -#endif /*VIEWTAGSREGISTRY_H*/ diff --git a/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml b/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml index 8ecb5c523d..7aee1a8968 100644 --- a/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml +++ b/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml @@ -1,29 +1,27 @@ This is a short information about this perspective + - - - Moving Images - Documentation - Visualisation - Document - Screen capture - - + + +