本文整理汇总了C++中core::ICore::uniqueIDManager方法的典型用法代码示例。如果您正苦于以下问题:C++ ICore::uniqueIDManager方法的具体用法?C++ ICore::uniqueIDManager怎么用?C++ ICore::uniqueIDManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::ICore
的用法示例。
在下文中一共展示了ICore::uniqueIDManager方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
{
typedef SharedTools::QScriptHighlighter QScriptHighlighter;
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qtscripteditor/QtScriptEditor.mimetypes.xml"), error_message))
return false;
m_scriptcontext << core->uniqueIDManager()->uniqueIdentifier(QtScriptEditor::Constants::C_QTSCRIPTEDITOR);
m_context = m_scriptcontext;
m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
registerActions(core);
m_editor = new QtScriptEditorFactory(core, m_context, this);
addObject(m_editor);
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
wizardParameters.setDescription(tr("Qt Script file"));
wizardParameters.setName(tr("Qt Script file"));
wizardParameters.setCategory(QLatin1String("Qt"));
wizardParameters.setTrCategory(tr("Qt"));
m_wizard = new TextEditor::TextFileWizard(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_MIMETYPE),
QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR),
QLatin1String("qtscript$"),
wizardParameters, core, this);
addObject(m_wizard);
error_message->clear();
return true;
}
示例2: initialize
bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), errorMessage))
return false;
m_editor = new ResourceEditorFactory(this);
addObject(m_editor);
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
wizardParameters.setDescription(tr("Creates a Qt Resource file (.qrc)."));
wizardParameters.setName(tr("Qt Resource file"));
wizardParameters.setCategory(QLatin1String("Qt"));
wizardParameters.setTrCategory(tr("Qt"));
m_wizard = new ResourceWizard(wizardParameters, this);
addObject(m_wizard);
errorMessage->clear();
// Register undo and redo
Core::ActionManager * const actionManager = core->actionManager();
int const pluginId = core->uniqueIDManager()->uniqueIdentifier(
Constants::C_RESOURCEEDITOR);
const QList<int> idList = QList<int>() << pluginId;
m_undoAction = new QAction(tr("&Undo"), this);
m_redoAction = new QAction(tr("&Redo"), this);
actionManager->registerAction(m_undoAction, Core::Constants::UNDO, idList);
actionManager->registerAction(m_redoAction, Core::Constants::REDO, idList);
connect(m_undoAction, SIGNAL(triggered()), this, SLOT(onUndo()));
connect(m_redoAction, SIGNAL(triggered()), this, SLOT(onRedo()));
return true;
}
示例3: initialize
/*! Initializes the plugin. Returns true on success.
Plugins want to register objects with the plugin manager here.
\a error_message can be used to pass an error message to the plugin system,
if there was any.
*/
bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *error_message)
{
Q_UNUSED(arguments)
Q_UNUSED(error_message)
// Get the primary access point to the workbench.
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
// Create a unique context id for our own view, that will be used for the
// menu entry later.
QList<int> context = QList<int>()
<< core->uniqueIDManager()->uniqueIdentifier(
QLatin1String("HelloWorld.MainView"));
// Create an action to be triggered by a menu entry
QAction *helloWorldAction = new QAction("Say \"&Hello World!\"", this);
connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));
// Register the action with the action manager
Core::ActionManagerInterface *actionManager = core->actionManager();
Core::ICommand *command =
actionManager->registerAction(
helloWorldAction, "HelloWorld.HelloWorldAction", context);
// Create our own menu to place in the Tools menu
Core::IActionContainer *helloWorldMenu =
actionManager->createMenu("HelloWorld.HelloWorldMenu");
QMenu *menu = helloWorldMenu->menu();
menu->setTitle(tr("&Hello World"));
menu->setEnabled(true);
// Add the Hello World action command to the menu
helloWorldMenu->addAction(command);
// Request the Tools menu and add the Hello World menu to it
Core::IActionContainer *toolsMenu =
actionManager->actionContainer(Core::Constants::M_TOOLS);
toolsMenu->addMenu(helloWorldMenu);
// Add a mode with a push button based on BaseMode. Like the BaseView,
// it will unregister itself from the plugin manager when it is deleted.
Core::BaseMode *baseMode = new Core::BaseMode;
baseMode->setUniqueModeName("HelloWorld.HelloWorldMode");
baseMode->setName(tr("Hello world!"));
baseMode->setIcon(QIcon());
baseMode->setPriority(0);
baseMode->setWidget(new QPushButton(tr("Hello World PushButton!")));
addAutoReleasedObject(baseMode);
// Add the Hello World action command to the mode manager (with 0 priority)
Core::ModeManager *modeManager = core->modeManager();
modeManager->addAction(command, 0);
return true;
}
示例4: QPlainTextEdit
OutputWindow::OutputWindow(QWidget *parent)
: QPlainTextEdit(parent)
, m_enforceNewline(false)
, m_scrollToBottom(false)
{
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
//setCenterOnScroll(false);
setWindowTitle(tr("Application Output Window"));
setWindowIcon(QIcon(":/qt4projectmanager/images/window.png"));
setFrameShape(QFrame::NoFrame);
setMouseTracking(true);
static uint usedIds = 0;
Core::ICore *core = Core::ICore::instance();
QList<int> context;
context << core->uniqueIDManager()->uniqueIdentifier(QString(Constants::C_APP_OUTPUT) + QString().setNum(usedIds++));
m_outputWindowContext = new Core::BaseContext(this, context);
core->addContextObject(m_outputWindowContext);
QAction *undoAction = new QAction(this);
QAction *redoAction = new QAction(this);
QAction *cutAction = new QAction(this);
QAction *copyAction = new QAction(this);
QAction *pasteAction = new QAction(this);
QAction *selectAllAction = new QAction(this);
Core::ActionManager *am = core->actionManager();
am->registerAction(undoAction, Core::Constants::UNDO, context);
am->registerAction(redoAction, Core::Constants::REDO, context);
am->registerAction(cutAction, Core::Constants::CUT, context);
am->registerAction(copyAction, Core::Constants::COPY, context);
am->registerAction(pasteAction, Core::Constants::PASTE, context);
am->registerAction(selectAllAction, Core::Constants::SELECTALL, context);
connect(undoAction, SIGNAL(triggered()), this, SLOT(undo()));
connect(redoAction, SIGNAL(triggered()), this, SLOT(redo()));
connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));
connect(this, SIGNAL(undoAvailable(bool)), undoAction, SLOT(setEnabled(bool)));
connect(this, SIGNAL(redoAvailable(bool)), redoAction, SLOT(setEnabled(bool)));
connect(this, SIGNAL(copyAvailable(bool)), cutAction, SLOT(setEnabled(bool))); // OutputWindow never read-only
connect(this, SIGNAL(copyAvailable(bool)), copyAction, SLOT(setEnabled(bool)));
undoAction->setEnabled(false);
redoAction->setEnabled(false);
cutAction->setEnabled(false);
copyAction->setEnabled(false);
}
示例5: initialize
////////////////////////////////////////////////////
//
// INHERITED FROM ExtensionSystem::Plugin
//
////////////////////////////////////////////////////
bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
{
Q_UNUSED(arguments)
Q_UNUSED(error)
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error))
return false;
initializeTemplates();
const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR));
const QList<int> context = QList<int>() << uid;
addAutoReleasedObject(new FormEditorFactory);
// Ensure that loading designer translations is done before FormEditorW is instantiated
const QString locale = qApp->property("qtc_locale").toString();
if (!locale.isEmpty()) {
QTranslator *qtr = new QTranslator(this);
const QString &creatorTrPath =
Core::ICore::instance()->resourcePath() + QLatin1String("/translations");
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &trFile = QLatin1String("designer_") + locale;
if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))
qApp->installTranslator(qtr);
}
if (qgetenv("KDE_SESSION_VERSION") == QByteArray("4")) {
// KDE 4, possibly dangerous...
// KDE 4.2.0 had a nasty bug, which resulted in the File/Open Dialog crashing
// so check for that an fully load the plugins
QProcess proc;
proc.start(QLatin1String("kde4-config"), QStringList(QLatin1String("--version")));
proc.waitForFinished();
const QByteArray output = proc.readAll();
if (output.contains("KDE: 4.2.0"))
FormEditorW::ensureInitStage(FormEditorW::FullyInitialized);
} else {
FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins);
}
error->clear();
return true;
}
示例6: initialize
bool QuickOpenPlugin::initialize(const QStringList &, QString *)
{
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
m_settingsPage = new SettingsPage(core, this);
addObject(m_settingsPage);
m_quickOpenToolWindow = new QuickOpenToolWindow(this);
m_quickOpenToolWindow->setEnabled(false);
Core::BaseView *view = new Core::BaseView("QuickOpen.ToolWindow",
m_quickOpenToolWindow,
QList<int>() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("QuickOpenToolWindow")),
Core::IView::First);
addAutoReleasedObject(view);
const QString actionId = QLatin1String("QtCreator.View.QuickOpen.ToolWindow");
QAction *action = new QAction(m_quickOpenToolWindow->windowIcon(), m_quickOpenToolWindow->windowTitle(), this);
Core::ICommand *cmd = core->actionManager()->registerAction(action, actionId, QList<int>() << Core::Constants::C_GLOBAL_ID);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+K"));
connect(action, SIGNAL(triggered()), this, SLOT(openQuickOpen()));
Core::IActionContainer *mtools = core->actionManager()->actionContainer(Core::Constants::M_TOOLS);
mtools->addAction(cmd);
addObject(new QuickOpenManager(m_quickOpenToolWindow));
m_openDocumentsFilter = new OpenDocumentsFilter(core->editorManager());
addObject(m_openDocumentsFilter);
m_fileSystemFilter = new FileSystemFilter(core->editorManager(), m_quickOpenToolWindow);
addObject(m_fileSystemFilter);
addAutoReleasedObject(new QuickOpenFiltersFilter(this, m_quickOpenToolWindow));
connect(core, SIGNAL(coreOpened()), this, SLOT(startSettingsLoad()));
return true;
}
示例7: initialize
bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
{
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qmljseditor/QmlJSEditor.mimetypes.xml"), error_message))
return false;
m_modelManager = new ModelManager(this);
addAutoReleasedObject(m_modelManager);
QList<int> context;
context << core->uniqueIDManager()->uniqueIdentifier(QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
m_editor = new QmlJSEditorFactory(this);
addObject(m_editor);
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
wizardParameters.setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
wizardParameters.setDescription(tr("Creates a Qt QML file."));
wizardParameters.setDisplayName(tr("Qt QML File"));
wizardParameters.setId(QLatin1String("Q.Qml"));
addAutoReleasedObject(new QmlFileWizard(wizardParameters, core));
m_actionHandler = new TextEditor::TextEditorActionHandler(QmlJSEditor::Constants::C_QMLJSEDITOR_ID,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
m_actionHandler->initializeActions();
Core::ActionManager *am = core->actionManager();
Core::ActionContainer *contextMenu = am->createMenu(QmlJSEditor::Constants::M_CONTEXT);
Core::Command *cmd;
QAction *followSymbolUnderCursorAction = new QAction(tr("Follow Symbol Under Cursor"), this);
cmd = am->registerAction(followSymbolUnderCursorAction, Constants::FOLLOW_SYMBOL_UNDER_CURSOR, context);
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F2));
connect(followSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(followSymbolUnderCursor()));
contextMenu->addAction(cmd);
cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd);
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd);
CodeCompletion *completion = new CodeCompletion(m_modelManager);
addAutoReleasedObject(completion);
addAutoReleasedObject(new HoverHandler);
// Set completion settings and keep them up to date
TextEditor::TextEditorSettings *textEditorSettings = TextEditor::TextEditorSettings::instance();
completion->setCompletionSettings(textEditorSettings->completionSettings());
connect(textEditorSettings, SIGNAL(completionSettingsChanged(TextEditor::CompletionSettings)),
completion, SLOT(setCompletionSettings(TextEditor::CompletionSettings)));
error_message->clear();
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
iconProvider->registerIconOverlayForSuffix(QIcon(":/qmljseditor/images/qmlfile.png"), "qml");
return true;
}
示例8:
TaskWindowContext::TaskWindowContext(QWidget *widget)
: m_taskList(widget)
{
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
m_context << core->uniqueIDManager()->uniqueIdentifier(Core::Constants::C_PROBLEM_PANE);
}
示例9: cmgr
bool
ServantPlugin::initialize(const QStringList &arguments, QString *error_message)
{
Q_UNUSED(arguments);
int nErrors = 0;
do { adportable::debug(__FILE__, __LINE__) << "<----- ServantPlugin::initialize() ..."; } while(0);
OutputWindow * outputWindow = new OutputWindow;
addAutoReleasedObject( outputWindow );
pImpl_ = new internal::ServantPluginImpl( outputWindow );
///////////////////////////////////
Core::ICore * core = Core::ICore::instance();
QList<int> context;
if ( core ) {
Core::UniqueIDManager * uidm = core->uniqueIDManager();
if ( uidm ) {
context.append( uidm->uniqueIdentifier( QLatin1String("Servant.MainView") ) );
context.append( uidm->uniqueIdentifier( Core::Constants::C_NAVIGATION_PANE ) );
}
} else
return false;
// ACE initialize
// acewrapper::instance_manager::initialize();
// <------
boost::filesystem::path plugindir;
do {
std::wstring apppath = qtwrapper::application::path( L".." ); // := "~/qtplatz/bin/.."
std::wstring configFile = adplugin::loader::config_fullpath( apppath, L"/MS-Cheminformatics/does-not-exist.adplugin" );
plugindir = boost::filesystem::path( configFile ).branch_path();
} while(0);
// populate .adplugin files under given folder.
adplugin::loader::populate( plugindir.generic_wstring().c_str() );
std::vector< adplugin::plugin_ptr > spectrometers;
if ( adplugin::loader::select_iids( ".*\\.adplugins\\.massSpectrometer\\..*", spectrometers ) ) {
std::for_each( spectrometers.begin(), spectrometers.end(), []( const adplugin::plugin_ptr& d ){
adcontrols::massspectrometer_factory * factory = d->query_interface< adcontrols::massspectrometer_factory >();
if ( factory )
adcontrols::massSpectrometerBroker::register_factory( factory, factory->name() );
});
}
// ------------ Broker::Manager initialize first --------------------
adorbmgr::orbmgr * pMgr = adorbmgr::orbmgr::instance();
if ( pMgr ) {
pMgr->init( 0, 0 );
pMgr->spawn();
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
Broker::Manager_var bmgr;
adplugin::plugin_ptr adbroker = adplugin::loader::select_iid( ".*\\.orbfactory\\.adbroker" );
if ( adbroker ) {
internal::orbServantCreator broker_creator;
adplugin::orbServant * adBroker = broker_creator( adbroker, orbServants_ );
if ( adBroker ) {
bmgr = Broker::Manager::_narrow( broker_creator.obj );
if ( CORBA::is_nil( bmgr ) ) {
*error_message = "Broker::Manager cannot be created";
return false;
}
} else {
*error_message = broker_creator.errmsg.str().empty() ?
"adplugin for Broker::Manager did not loaded." : broker_creator.errmsg.str().c_str();
return false;
}
adorbmgr::orbmgr::instance()->setBrokerManager( bmgr );
size_t nTrial = 3;
while ( nTrial-- ) {
try {
bmgr->register_ior( adBroker->object_name(), broker_creator.ior.c_str() );
} catch ( CORBA::Exception& ex ) {
if ( /* ex.get_id() == CORBA::TRANSIENT && */ nTrial )
std::this_thread::sleep_for( std::chrono::milliseconds(10) );
else {
*error_message = QString( "CORBA::Exception : " ) + ex._info().c_str();
return false;
}
}
}
}
pImpl_->init_debug_adbroker( bmgr );
// ----------------------- initialize corba servants ------------------------------
std::vector< adplugin::plugin_ptr > factories;
adplugin::loader::select_iids( ".*\\.adplugins\\.orbfactory\\..*", factories );
for ( const adplugin::plugin_ptr& ptr: factories ) {
if ( ptr->iid() == adbroker->iid() )
continue;
internal::orbServantCreator creator;
adplugin::orbServant * servant = creator( ptr, orbServants_ );
if ( servant ) {
BrokerClient::Accessor_var accessor = BrokerClient::Accessor::_narrow( creator.obj );
if ( !CORBA::is_nil( accessor ) ) {
//.........这里部分代码省略.........