17 #include "internal/berryWorkbenchRegistryConstants.h" 18 #include "internal/berryWorkbench.h" 21 #include "internal/intro/berryEditorIntroAdapterPart.h" 22 #include "internal/defaultpresentation/berryQtWorkbenchPresentationFactory.h" 27 #include "internal/berryQtWorkbenchTweaklet.h" 28 #include "internal/berryQtWorkbenchPageTweaklet.h" 29 #include "internal/berryQtWidgetsTweaklet.h" 30 #include "internal/dialogs/berryPerspectivesPreferencePage.h" 31 #include "internal/berryQtStylePreferencePage.h" 32 #include "internal/berryStatusUtil.h" 33 #include "internal/berryHandlerServiceFactory.h" 34 #include "internal/berryMenuServiceFactory.h" 35 #include "internal/berryCommandServiceFactory.h" 36 #include "internal/berryWorkbenchSourceProvider.h" 39 #include "internal/berryPolicy.h" 40 #include "internal/berryHandlerAuthority.h" 42 #include "internal/berryOpenPerspectivePropertyTester.h" 43 #include "internal/berryPerspectiveParameterValues.h" 45 #include "internal/handlers/berryCloseAllPerspectivesHandler.h" 46 #include "internal/handlers/berryClosePerspectiveHandler.h" 47 #include "internal/handlers/berryDynamicHelpHandler.h" 48 #include "internal/handlers/berryHelpContentsHandler.h" 49 #include "internal/handlers/berryIntroHandler.h" 50 #include "internal/handlers/berryOpenInNewWindowHandler.h" 51 #include "internal/handlers/berryNewEditorHandler.h" 52 #include "internal/handlers/berryQuitHandler.h" 53 #include "internal/handlers/berryResetPerspectiveHandler.h" 54 #include "internal/handlers/berrySavePerspectiveHandler.h" 55 #include "internal/handlers/berryShowPerspectiveHandler.h" 56 #include "internal/handlers/berryShowViewHandler.h" 66 #include <QPrinterInfo> 67 #include <QSvgGenerator> 76 WorkbenchPlugin* WorkbenchPlugin::inst =
nullptr;
82 presentationFactory =
nullptr;
83 editorRegistry =
nullptr;
84 viewRegistry =
nullptr;
85 perspRegistry =
nullptr;
86 introRegistry =
nullptr;
91 delete presentationFactory;
92 delete editorRegistry;
103 if (!element->GetAttribute(extensionName).isNull())
return true;
105 QString elementText = element->GetValue();
106 if (!elementText.isEmpty())
return true;
108 QList<IConfigurationElement::Pointer> children(element->GetChildren(extensionName));
109 if (children.size() == 1)
111 if (!(children[0]->
GetAttribute(WorkbenchRegistryConstants::ATT_CLASS).isNull()))
124 return plugin->getState() == ctkPlugin::ACTIVE;
134 QString contributorName;
137 if (!extensionName.isNull())
138 prop = element->GetAttribute(extensionName);
142 prop = element->GetValue();
145 prop = prop.trimmed();
154 QList<IConfigurationElement::Pointer> exec(element->GetChildren(extensionName));
161 i = prop.indexOf(
':');
163 executable = prop.left(i).trimmed();
167 i = executable.indexOf(
'/');
169 contributorName = executable.left(i).trimmed();
172 if (contributorName.isNull())
173 contributorName = element->GetContributor()->GetName();
192 if (perspRegistry ==
nullptr)
194 perspRegistry =
new PerspectiveRegistry();
203 perspRegistry->Load();
207 return perspRegistry;
228 if (introRegistry ==
nullptr)
230 introRegistry =
new IntroRegistry();
232 return introRegistry;
238 viewRegistry =
new ViewRegistry();
246 editorRegistry =
new EditorRegistry();
248 return editorRegistry;
256 WorkbenchRegistryConstants::PL_ELEMENT_FACTORY);
262 WorkbenchRegistryConstants::PL_ELEMENT_FACTORY +
" not found");
268 QList<IConfigurationElement::Pointer> configElements =
269 extensionPoint->GetConfigurationElements();
270 for (
int j = 0; j < configElements.size(); j++)
272 QString strID = configElements[j]->GetAttribute(
"id");
273 if (targetID == strID)
275 targetElement = configElements[j];
289 factory = targetElement->CreateExecutableExtension<
IElementFactory>(
"class");
301 if (presentationFactory !=
nullptr)
return presentationFactory;
303 QString targetID = Workbench::GetInstance()->GetPresentationId();
304 presentationFactory = this->CreateExtension<IPresentationFactory>(
305 WorkbenchRegistryConstants::PL_PRESENTATION_FACTORIES,
306 "factory", targetID);
307 if (presentationFactory ==
nullptr)
309 targetID +
" -- class is not an IPresentationFactory");
311 return presentationFactory;
316 BERRY_INFO <<
"LOG: " << message << std::endl;
324 dbg << exc.printStackTrace();
332 PlatformException exc(message, t);
337 const QString& methodName,
const ctkException &t)
339 QString msg = QString(
"Exception in ") + clazz +
"." + methodName +
": " 349 if (!message.isEmpty())
365 QPrinterInfo forceQt5PrintSupportLinkage;
366 forceQt5PrintSupportLinkage.isNull();
369 QSvgGenerator forceQt5SvgLinkage;
370 forceQt5SvgLinkage.title();
374 bundleContext = context;
378 HandlerAuthority::DEBUG = Policy::DEBUG_HANDLERS();
379 HandlerAuthority::DEBUG_PERFORMANCE = Policy::DEBUG_HANDLERS_PERFORMANCE();
380 HandlerAuthority::DEBUG_VERBOSE = Policy::DEBUG_HANDLERS_VERBOSE();
381 HandlerAuthority::DEBUG_VERBOSE_COMMAND_ID = Policy::DEBUG_HANDLERS_VERBOSE_COMMAND_ID();
452 return bundleContext;
459 styleManager.reset();
461 delete perspRegistry;
463 perspRegistry =
nullptr;
468 QFileInfo fileInfo = bundleContext->getDataFile(
"");
469 if (!fileInfo.isWritable())
return QString();
470 return fileInfo.absoluteFilePath();
static bool IsBundleLoadedForExecutableExtension(const IConfigurationElement::Pointer &element, const QString &extensionName)
static void Log(const QString &message)
ctkPluginContext * GetPluginContext()
QString GetDataLocation() const
virtual SmartPointer< IExtensionPoint > GetExtensionPoint(const QString &extensionPointId) const =0
static char PREFERENCE_PAGE_CATEGORY_SEPARATOR
static WorkbenchPlugin * GetDefault()
SmartPointer< IStatus > GetStatus() const
~WorkbenchPlugin() override
IIntroRegistry * GetIntroRegistry()
void stop(ctkPluginContext *context) override
static QSharedPointer< ctkPlugin > GetBundleForExecutableExtension(const IConfigurationElement::Pointer &element, const QString &extensionName)
IEditorRegistry * GetEditorRegistry()
std::vcl_size_t GetBundleCount()
void start(ctkPluginContext *context) override
void stop(ctkPluginContext *context) override
IElementFactory * GetElementFactory(const QString &targetID) const
IPresentationFactory * GetPresentationFactory()
#define BERRY_REGISTER_EXTENSION_CLASS(_ClassType, _PluginContext)
IPerspectiveRegistry * GetPerspectiveRegistry()
#define GetAttribute(name, type)
IViewRegistry * GetViewRegistry()
virtual void Log(const SmartPointer< IStatus > &status)=0
void start(ctkPluginContext *context) override
static bool HasExecutableExtension(const IConfigurationElement::Pointer &element, const QString &extensionName)