Hi,
for your suggestion I keep on flooding the mailing list. ;-)
I created a perspective for my plugin. It worked well with BlueBerry
but after the migration to CTK I get an error at run-time. To make it
easy to reconstruct the situation, I remade all the changes on the
AwesomeProject.
The error is the following:
!2.080! [BlueBerry] WARNING: The class QmitkAwesomePerspective was not
registered as an Extension Type using
BERRY_REGISTER_EXTENSION_CLASS(type, pluginContext) or you forgot to
run Qt's moc on the header file. Legacy BlueBerry bundles should use
CreateExecutableExtension<C>(propertyName, C::GetManifestName())
instead.
!2.080! [BlueBerry] WARNING: Could not load executable extension
QmitkAwesomePerspective from my.awesomeproject.exampleplugin
The perspective is registered in mitkPluginActivator.cpp with the
following command:
BERRY_REGISTER_EXTENSION_CLASS(QmitkAwesomePerspective, context)
Moreover, the src/internal/QmitkAwesomePerspective.h is added to the
MOC_H_FILES section of files.cmake.
I attached the test as a patch on the project template. I hope the
format is correct.
Is it a bug or I am doing something wrong?
Thanks!
Miklos
diff --git a/Plugins/my.awesomeproject.exampleplugin/files.cmake b/Plugins/my.awesomeproject.exampleplugin/files.cmake
index 0336e14..19c828f 100644
--- a/Plugins/my.awesomeproject.exampleplugin/files.cmake
+++ b/Plugins/my.awesomeproject.exampleplugin/files.cmake
@@ -5,6 +5,7 @@ set(SRC_CPP_FILES
set(INTERNAL_CPP_FILES
mitkPluginActivator.cpp
QmitkAwesomeView.cpp
+ QmitkAwesomePerspective.cpp
)
set(UI_FILES
@@ -14,6 +15,7 @@ set(UI_FILES
set(MOC_H_FILES
src/internal/mitkPluginActivator.h
src/internal/QmitkAwesomeView.h
+ src/internal/QmitkAwesomePerspective.h
)
# list of resource files which can be used by the plug-in
diff --git a/Plugins/my.awesomeproject.exampleplugin/plugin.xml b/Plugins/my.awesomeproject.exampleplugin/plugin.xml
index be5829a..34daacd 100644
--- a/Plugins/my.awesomeproject.exampleplugin/plugin.xml
+++ b/Plugins/my.awesomeproject.exampleplugin/plugin.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
-
+
<extension point="org.blueberry.ui.views">
<view id="my.awesomeproject.views.awesomeview"
name="Awesome View"
@@ -8,4 +8,11 @@
icon="resources/icon.xpm" />
</extension>
+ <extension point="org.blueberry.ui.perspectives">
+ <perspective id="org.awesomeproject.awesomeperspective"
+ name="AwesomePerspective"
+ class="QmitkAwesomePerspective"
+ icon="resources/icon.xpm" />
+ </extension>
+
</plugin>
diff --git a/Plugins/my.awesomeproject.exampleplugin/src/internal/QmitkAwesomePerspective.cpp b/Plugins/my.awesomeproject.exampleplugin/src/internal/QmitkAwesomePerspective.cpp
new file mode 100644
index 0000000..09ad9ea
--- /dev/null
+++ b/Plugins/my.awesomeproject.exampleplugin/src/internal/QmitkAwesomePerspective.cpp
@@ -0,0 +1,44 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date: 2010-01-16 19:57:43 +0100 (szo, 16 jan 2010) $
+ Version: $Revision: 21070 $
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+#include "QmitkAwesomePerspective.h"
+
+#include <berryIViewLayout.h>
+#include <QDebug>
+
+
+void QmitkAwesomePerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout) {
+ using namespace berry;
+
+ // Editors are placed for free.
+ std::string editorArea = layout->GetEditorArea();
+
+ layout->AddView("org.awesomeproject.views.AwesomeView", IPageLayout::LEFT, 0.2f, editorArea);
+ layout->AddView("org.mitk.views.datamanager", IPageLayout::RIGHT, 0.7f, editorArea);
+
+ IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.datamanager");
+ lo->SetCloseable(false);
+
+ layout->AddView("org.mitk.views.imagenavigator", IPageLayout::BOTTOM, 0.5f, "org.awesomeproject.views.AwesomeView");
+
+ IFolderLayout::Pointer bottomRightFolder = layout->CreateFolder("bottomRight", IPageLayout::BOTTOM, 0.4f, "org.mitk.views.datamanager");
+ bottomRightFolder->AddView("org.mitk.views.segmentation");
+
+ IFolderLayout::Pointer bottomFolder = layout->CreateFolder("bottom", IPageLayout::BOTTOM, 0.7f, editorArea);
+ bottomFolder->AddView("org.mitk.views.propertylistview");
+ bottomFolder->AddView("org.blueberry.views.logview");
+}
diff --git a/Plugins/my.awesomeproject.exampleplugin/src/internal/QmitkAwesomePerspective.h b/Plugins/my.awesomeproject.exampleplugin/src/internal/QmitkAwesomePerspective.h
new file mode 100644
index 0000000..08108e2
--- /dev/null
+++ b/Plugins/my.awesomeproject.exampleplugin/src/internal/QmitkAwesomePerspective.h
@@ -0,0 +1,49 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date: 2010-01-16 19:57:43 +0100 (szo, 16 jan 2010) $
+ Version: $Revision: 21070 $
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+#ifndef __QmitkAwesomePerspective_h
+#define __QmitkAwesomePerspective_h
+
+#include <berryIPerspectiveFactory.h>
+
+/**
+ * This perspective is used for testing api. It defines an initial
+ * layout with no parts, just an editor area.
+ */
+class QmitkAwesomePerspective: public QObject, public berry::IPerspectiveFactory
+{
+
+public:
+
+ /**
+ * Defines the initial layout for a perspective.
+ *
+ * Implementors of this method may add additional views to a
+ * perspective. The perspective already contains an editor folder
+ * with <code>ID = ILayoutFactory::ID_EDITORS</code>. Add additional views
+ * to the perspective in reference to the editor folder.
+ *
+ * This method is only called when a new perspective is created. If
+ * an old perspective is restored from a persistence file then
+ * this method is not called.
+ *
+ * @param factory the factory used to add views to the perspective
+ */
+ virtual void CreateInitialLayout(berry::IPageLayout::Pointer layout);
+};
+
+#endif /* __QmitkAwesomePerspective_h */
diff --git a/Plugins/my.awesomeproject.exampleplugin/src/internal/mitkPluginActivator.cpp b/Plugins/my.awesomeproject.exampleplugin/src/internal/mitkPluginActivator.cpp
index 51d0256..16f73ed 100644
--- a/Plugins/my.awesomeproject.exampleplugin/src/internal/mitkPluginActivator.cpp
+++ b/Plugins/my.awesomeproject.exampleplugin/src/internal/mitkPluginActivator.cpp
@@ -3,12 +3,14 @@
#include <QtPlugin>
#include "QmitkAwesomeView.h"
+#include "QmitkAwesomePerspective.h"
namespace mitk {
void PluginActivator::start(ctkPluginContext* context)
{
BERRY_REGISTER_EXTENSION_CLASS(QmitkAwesomeView, context)
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkAwesomePerspective, context)
}
void PluginActivator::stop(ctkPluginContext* context)
------------------------------------------------------------------------------
5 Ways to Improve & Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more!
http://www.accelacomm.com/jaw/sfnl/114/51426253/
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users