-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathterminalplugin.cpp
80 lines (66 loc) · 2.26 KB
/
terminalplugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* Copyright (C) 2012 Adam Treat. All rights reserved.
*/
#include "terminalplugin.h"
#include "terminalwindow.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/imode.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/id.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug>
#include <QtCore/QtPlugin>
#include <QAction>
#include <QMenu>
#include <QMessageBox>
#include <QPushButton>
namespace Terminal {
namespace Internal {
/*! Constructs the Terminal plugin. Normally plugins don't do anything in
their constructor except for initializing their member variables. The
actual work is done later, in the initialize() and extensionsInitialized()
methods.
*/
TerminalPlugin::TerminalPlugin()
: m_window(0)
{
}
/*! Plugins are responsible for deleting objects they created on the heap, and
to unregister objects from the plugin manager that they registered there.
*/
TerminalPlugin::~TerminalPlugin()
{
ExtensionSystem::PluginManager::instance()->removeObject(m_window);
delete m_window;
m_window = 0;
}
/*! Initializes the plugin. Returns true on success.
Plugins want to register objects with the plugin manager here.
\a errorMessage can be used to pass an error message to the plugin system,
if there was any.
*/
bool TerminalPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
m_window = new TerminalWindow(this);
ExtensionSystem::PluginManager::instance()->addObject(m_window);
return true;
}
/*! Notification that all extensions that this plugin depends on have been
initialized. The dependencies are defined in the plugins .pluginspec file.
Normally this method is used for things that rely on other plugins to have
added objects to the plugin manager, that implement interfaces that we're
interested in. These objects can now be requested through the
PluginManagerInterface.
The TerminalPlugin doesn't need things from other plugins, so it does
nothing here.
*/
void TerminalPlugin::extensionsInitialized()
{
}
} // namespace Internal
} // namespace Terminal