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; }
void QtTestPlugin::extensionsInitialized() { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); m_messageOutputWindow = new TestOutputWindow(); pm->addObject(m_messageOutputWindow); m_testResultsWindow = TestResultsWindow::instance(); connect(m_testResultsWindow, SIGNAL(stopTest()), this, SLOT(stopTesting())); connect(m_testResultsWindow, SIGNAL(retryFailedTests(QStringList)), this, SLOT(retryTests(QStringList))); connect(TestExecuter::instance(), SIGNAL(testStarted()), m_testResultsWindow, SLOT(onTestStarted())); connect(TestExecuter::instance(), SIGNAL(testStop()), m_testResultsWindow, SLOT(onTestStopped())); connect(TestExecuter::instance(), SIGNAL(testFinished()), m_testResultsWindow, SLOT(onTestFinished())); pm->addObject(m_testResultsWindow); connect(testResultsPane(), SIGNAL(defectSelected(TestCaseRec)), this, SLOT(onDefectSelected(TestCaseRec))); // Add context menu to CPP editor Core::ActionContainer *mcontext = am->actionContainer(CppEditor::Constants::M_CONTEXT); m_contextMenu->init(mcontext->menu(), 2, this); // Add context menu to JS editor mcontext = am->actionContainer(QmlJSEditor::Constants::M_CONTEXT); m_contextMenu->init(mcontext->menu(), 2, this); // Add a Test menu to the menu bar Core::ActionContainer* ac = am->createMenu("QtTestPlugin.TestMenu"); ac->menu()->setTitle(tr("&Test")); m_contextMenu->init(ac->menu(), 0, 0); // Insert the "Test" menu between "Window" and "Help". QMenu *windowMenu = am->actionContainer(Core::Constants::M_TOOLS)->menu(); QMenuBar *menuBar = am->actionContainer(Core::Constants::MENU_BAR)->menuBar(); menuBar->insertMenu(windowMenu->menuAction(), ac->menu()); ProjectExplorer::ProjectExplorerPlugin *explorer = ProjectExplorer::ProjectExplorerPlugin::instance(); connect(explorer->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), this, SLOT(onStartupProjectChanged(ProjectExplorer::Project *))); connect(core->progressManager(), SIGNAL(allTasksFinished(QString)), this, SLOT(onAllTasksFinished(QString))); connect(explorer->session(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project *)), this, SLOT(onProjectRemoved(ProjectExplorer::Project *))); m_contextMenu->init(0, 3, this); }
/*! 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; }
bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) { Q_UNUSED(arguments) Q_UNUSED(error) qRegisterMetaType<CppTools::CppCodeStyleSettings>("CppTools::CppCodeStyleSettings"); Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); m_settings = new CppToolsSettings(this); // force registration of cpp tools settings // Objects m_modelManager = new CppModelManager(this); Core::VcsManager *vcsManager = core->vcsManager(); Core::FileManager *fileManager = core->fileManager(); connect(vcsManager, SIGNAL(repositoryChanged(QString)), m_modelManager, SLOT(updateModifiedSourceFiles())); connect(fileManager, SIGNAL(filesChangedInternally(QStringList)), m_modelManager, SLOT(updateSourceFiles(QStringList))); addAutoReleasedObject(m_modelManager); addAutoReleasedObject(new CppCompletionAssistProvider); addAutoReleasedObject(new CppLocatorFilter(m_modelManager)); addAutoReleasedObject(new CppClassesFilter(m_modelManager)); addAutoReleasedObject(new CppFunctionsFilter(m_modelManager)); addAutoReleasedObject(new CppCurrentDocumentFilter(m_modelManager, core->editorManager())); addAutoReleasedObject(new CompletionSettingsPage); addAutoReleasedObject(new CppFileSettingsPage(m_fileSettings)); addAutoReleasedObject(new SymbolsFindFilter(m_modelManager)); addAutoReleasedObject(new CppCodeStyleSettingsPage); TextEditor::CodeStylePreferencesManager::instance()->registerFactory( new CppTools::CppCodeStylePreferencesFactory()); // Menus Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); Core::ActionContainer *mcpptools = am->createMenu(CppTools::Constants::M_TOOLS_CPP); QMenu *menu = mcpptools->menu(); menu->setTitle(tr("&C++")); menu->setEnabled(true); mtools->addMenu(mcpptools); // Actions Core::Context context(CppEditor::Constants::C_CPPEDITOR); QAction *switchAction = new QAction(tr("Switch Header/Source"), this); Core::Command *command = am->registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context, true); command->setDefaultKeySequence(QKeySequence(Qt::Key_F4)); mcpptools->addAction(command); connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource())); return true; }
OutputWindow::OutputWindow(Core::Context context, QWidget *parent) : QPlainTextEdit(parent) , m_formatter(0) , m_enforceNewline(false) , m_scrollToBottom(false) , m_linksActive(true) , m_mousePressed(false) , m_maxLineCount(100000) { setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //setCenterOnScroll(false); setFrameShape(QFrame::NoFrame); setMouseTracking(true); Core::ICore *core = Core::ICore::instance(); m_outputWindowContext = new Core::IContext; m_outputWindowContext->setContext(context); m_outputWindowContext->setWidget(this); 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); }
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); }
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; }
/*! 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 HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMessage) { Q_UNUSED(arguments) Q_UNUSED(errorMessage) // Get the primary access point to the workbench. Core::ICore *core = Core::ICore::instance(); // Create a unique context for our own view, that will be used for the // menu entry later. Core::Context context("HelloWorld.MainView"); // Create an action to be triggered by a menu entry QAction *helloWorldAction = new QAction(tr("Say \"&Hello World!\""), this); connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld())); // Register the action with the action manager Core::ActionManager *actionManager = core->actionManager(); Core::Command *command = actionManager->registerAction( helloWorldAction, "HelloWorld.HelloWorldAction", context); // Create our own menu to place in the Tools menu Core::ActionContainer *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::ActionContainer *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::IMode *helloMode = new HelloMode; addAutoReleasedObject(helloMode); return true; }
void MacroOptionsWidget::createTable() { QDir dir(MacroManager::instance()->macrosDirectory()); Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); QMapIterator<QString, Macro *> it(MacroManager::instance()->macros()); while (it.hasNext()) { it.next(); QFileInfo fileInfo(it.value()->fileName()); if (fileInfo.absoluteDir() == dir.absolutePath()) { QTreeWidgetItem *macroItem = new QTreeWidgetItem(m_ui->treeWidget); macroItem->setText(0, it.value()->displayName()); macroItem->setText(1, it.value()->description()); macroItem->setData(0, NAME_ROLE, it.value()->displayName()); macroItem->setData(0, WRITE_ROLE, it.value()->isWritable()); Core::Command *command = am->command(Core::Id(Constants::PREFIX_MACRO+it.value()->displayName())); if (command && command->shortcut()) macroItem->setText(2, command->shortcut()->key().toString()); } } }
bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message) { Core::ICore *core = Core::ICore::instance(); if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"), error_message)) return false; parseGlslFile(QLatin1String("glsl_120.frag"), &m_glsl_120_frag); parseGlslFile(QLatin1String("glsl_120.vert"), &m_glsl_120_vert); parseGlslFile(QLatin1String("glsl_120_common.glsl"), &m_glsl_120_common); parseGlslFile(QLatin1String("glsl_es_100.frag"), &m_glsl_es_100_frag); parseGlslFile(QLatin1String("glsl_es_100.vert"), &m_glsl_es_100_vert); parseGlslFile(QLatin1String("glsl_es_100_common.glsl"), &m_glsl_es_100_common); // m_modelManager = new ModelManager(this); // addAutoReleasedObject(m_modelManager); addAutoReleasedObject(new GLSLHoverHandler(this)); Core::Context context(GLSLEditor::Constants::C_GLSLEDITOR_ID); m_editor = new GLSLEditorFactory(this); addObject(m_editor); addAutoReleasedObject(new GLSLCompletionAssistProvider); m_actionHandler = new TextEditor::TextEditorActionHandler(GLSLEditor::Constants::C_GLSLEDITOR_ID, TextEditor::TextEditorActionHandler::Format | TextEditor::TextEditorActionHandler::UnCommentSelection | TextEditor::TextEditorActionHandler::UnCollapseAll); m_actionHandler->initializeActions(); Core::ActionManager *am = core->actionManager(); Core::ActionContainer *contextMenu = am->createMenu(GLSLEditor::Constants::M_CONTEXT); Core::ActionContainer *glslToolsMenu = am->createMenu(Core::Id(Constants::M_TOOLS_GLSL)); glslToolsMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide); QMenu *menu = glslToolsMenu->menu(); //: GLSL sub-menu in the Tools menu menu->setTitle(tr("GLSL")); am->actionContainer(Core::Constants::M_TOOLS)->addMenu(glslToolsMenu); Core::Command *cmd = 0; // Insert marker for "Refactoring" menu: Core::Context globalContext(Core::Constants::C_GLOBAL); Core::Command *sep = createSeparator(am, this, globalContext, Constants::SEPARATOR1); sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT); contextMenu->addAction(sep); contextMenu->addAction(createSeparator(am, this, globalContext, Constants::SEPARATOR2)); cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); error_message->clear(); Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance(); Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase(); iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")), mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE))); iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")), mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_VERT))); iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")), mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG))); iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")), mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES))); iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")), mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES))); Core::BaseFileWizardParameters fragWizardParameters(Core::IWizard::FileWizard); fragWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL)); fragWizardParameters.setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL)); fragWizardParameters.setDescription (tr("Creates a fragment shader in the OpenGL/ES 2.0 Shading " "Language (GLSL/ES). Fragment shaders generate the final " "pixel colors for triangles, points and lines rendered " "with OpenGL.")); fragWizardParameters.setDisplayName(tr("Fragment Shader (OpenGL/ES 2.0)")); fragWizardParameters.setId(QLatin1String("F.GLSL")); addAutoReleasedObject(new GLSLFileWizard(fragWizardParameters, GLSLFileWizard::FragmentShaderES, core)); Core::BaseFileWizardParameters vertWizardParameters(Core::IWizard::FileWizard); vertWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL)); vertWizardParameters.setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL)); vertWizardParameters.setDescription (tr("Creates a vertex shader in the OpenGL/ES 2.0 Shading " "Language (GLSL/ES). Vertex shaders transform the " "positions, normals and texture co-ordinates of " "triangles, points and lines rendered with OpenGL.")); vertWizardParameters.setDisplayName(tr("Vertex Shader (OpenGL/ES 2.0)")); vertWizardParameters.setId(QLatin1String("G.GLSL")); addAutoReleasedObject(new GLSLFileWizard(vertWizardParameters, GLSLFileWizard::VertexShaderES, core)); fragWizardParameters.setDescription (tr("Creates a fragment shader in the Desktop OpenGL Shading " "Language (GLSL). Fragment shaders generate the final " "pixel colors for triangles, points and lines rendered " "with OpenGL.")); fragWizardParameters.setDisplayName(tr("Fragment Shader (Desktop OpenGL)")); fragWizardParameters.setId(QLatin1String("J.GLSL")); addAutoReleasedObject(new GLSLFileWizard(fragWizardParameters, GLSLFileWizard::FragmentShaderDesktop, core)); vertWizardParameters.setDescription (tr("Creates a vertex shader in the Desktop OpenGL Shading " "Language (GLSL). Vertex shaders transform the " "positions, normals and texture co-ordinates of " "triangles, points and lines rendered with OpenGL.")); vertWizardParameters.setDisplayName(tr("Vertex Shader (Desktop OpenGL)")); vertWizardParameters.setId(QLatin1String("K.GLSL")); addAutoReleasedObject(new GLSLFileWizard(vertWizardParameters, GLSLFileWizard::VertexShaderDesktop, core)); return true; }
QWidget *QmlProfilerTool::createWidgets() { // Analyzer::AnalyzerManager *analyzerMgr = Analyzer::AnalyzerManager::instance(); // Utils::FancyMainWindow *mw = analyzerMgr->mainWindow(); QWidget *mw = this; d->m_traceWindow = new TraceWindow(mw); d->m_traceWindow->reset(d->m_client); connect(d->m_traceWindow, SIGNAL(gotoSourceLocation(QString,int)),this, SLOT(gotoSourceLocation(QString,int))); connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal))); d->m_statistics = new QmlProfilerEventStatistics(mw); d->m_eventsView = new QmlProfilerEventsView(mw, d->m_statistics); d->m_eventsView->setViewType(QmlProfilerEventsView::EventsView); connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)), d->m_statistics, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int))); connect(d->m_traceWindow, SIGNAL(viewUpdated()), d->m_statistics, SLOT(complete())); connect(d->m_eventsView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); d->m_calleeView = new QmlProfilerEventsView(mw, d->m_statistics); d->m_calleeView->setViewType(QmlProfilerEventsView::CalleesView); connect(d->m_calleeView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); d->m_callerView = new QmlProfilerEventsView(mw, d->m_statistics); d->m_callerView->setViewType(QmlProfilerEventsView::CallersView); connect(d->m_callerView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); #if 0 Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); Core::ActionContainer *manalyzer = am->actionContainer(Analyzer::Constants::M_DEBUG_ANALYZER); const Core::Context globalcontext(Core::Constants::C_GLOBAL); d->m_attachAction = new QAction(tr("Attach..."), manalyzer); Core::Command *command = am->registerAction(d->m_attachAction, Constants::ATTACH, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); //manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP); connect(d->m_attachAction, SIGNAL(triggered()), this, SLOT(attach())); updateAttachAction(false); QDockWidget *eventsDock = AnalyzerManager::createDockWidget (this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea); QDockWidget *timelineDock = AnalyzerManager::createDockWidget (this, tr("Timeline"), d->m_traceWindow, Qt::BottomDockWidgetArea); QDockWidget *calleeDock = AnalyzerManager::createDockWidget (this, tr("Callees"), d->m_calleeView, Qt::BottomDockWidgetArea); QDockWidget *callerDock = AnalyzerManager::createDockWidget (this, tr("Callers"), d->m_callerView, Qt::BottomDockWidgetArea); mw->splitDockWidget(mw->toolBarDockWidget(), eventsDock, Qt::Vertical); mw->tabifyDockWidget(eventsDock, timelineDock); mw->tabifyDockWidget(timelineDock, calleeDock); mw->tabifyDockWidget(calleeDock, callerDock); #endif QTabWidget *tabWidget = new QTabWidget; tabWidget->addTab(d->m_eventsView, tr("Events")); tabWidget->addTab(d->m_traceWindow, tr("Timeline")); tabWidget->addTab(d->m_calleeView, tr("Callees")); tabWidget->addTab(d->m_callerView, tr("Callers")); // // Toolbar // QWidget *toolbarWidget = new QWidget; toolbarWidget->setObjectName(QLatin1String("QmlProfilerToolBarWidget")); QHBoxLayout *layout = new QHBoxLayout; layout->setMargin(0); layout->setSpacing(0); d->m_recordButton = new QToolButton(toolbarWidget); // icon and tooltip set in setRecording(), called later d->m_recordButton->setCheckable(true); connect(d->m_recordButton,SIGNAL(toggled(bool)), this, SLOT(setRecording(bool))); d->m_recordButton->setChecked(true); layout->addWidget(d->m_recordButton); d->m_clearButton = new QToolButton(toolbarWidget); d->m_clearButton->setIcon(QIcon(QLatin1String(":/qmlprofiler/clean_pane_small.png"))); d->m_clearButton->setToolTip(tr("Discard data")); connect(d->m_clearButton,SIGNAL(clicked()), this, SLOT(clearDisplay())); layout->addWidget(d->m_clearButton); QLabel *timeLabel = new QLabel(tr("Elapsed: 0 s")); QPalette palette = timeLabel->palette(); palette.setColor(QPalette::WindowText, Qt::white); timeLabel->setPalette(palette); timeLabel->setIndent(10); connect(this, SIGNAL(setTimeLabel(QString)), timeLabel, SLOT(setText(QString))); layout->addWidget(timeLabel); toolbarWidget->setLayout(layout); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(toolbarWidget); mainLayout->addWidget(tabWidget); return toolbarWidget; }
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 = QmlJS::ModelManagerInterface::instance(); addAutoReleasedObject(new QmlJSSnippetProvider); Core::Context context(QmlJSEditor::Constants::C_QMLJSEDITOR_ID); m_editor = new QmlJSEditorFactory(this); addObject(m_editor); Core::BaseFileWizardParameters qmlWizardParameters(Core::IWizard::FileWizard); qmlWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_QML)); qmlWizardParameters.setDisplayCategory(QCoreApplication::translate("QmlJsEditor", Constants::WIZARD_TR_CATEGORY_QML)); qmlWizardParameters.setDescription(tr("Creates a QML file.")); qmlWizardParameters.setDisplayName(tr("QML File")); qmlWizardParameters.setId(QLatin1String("Q.Qml")); addAutoReleasedObject(new QmlFileWizard(qmlWizardParameters, core)); Core::BaseFileWizardParameters jsWizardParameters(Core::IWizard::FileWizard); jsWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_QML)); jsWizardParameters.setDisplayCategory(QCoreApplication::translate("QmlJsEditor", Constants::WIZARD_TR_CATEGORY_QML)); jsWizardParameters.setDescription(tr("Creates a JavaScript file.")); jsWizardParameters.setDisplayName(tr("JS File")); jsWizardParameters.setId(QLatin1String("Z.Js")); addAutoReleasedObject(new JsFileWizard(jsWizardParameters, 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::ActionContainer *qmlToolsMenu = am->createMenu(Core::Id(Constants::M_TOOLS_QML)); qmlToolsMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide); QMenu *menu = qmlToolsMenu->menu(); //: QML sub-menu in the Tools menu menu->setTitle(tr("QML")); am->actionContainer(Core::Constants::M_TOOLS)->addMenu(qmlToolsMenu); 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); qmlToolsMenu->addAction(cmd); QAction *findUsagesAction = new QAction(tr("Find Usages"), this); cmd = am->registerAction(findUsagesAction, Constants::FIND_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); connect(findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd); QAction *showQuickToolbar = new QAction(tr("Show Qt Quick Toolbar"), this); cmd = am->registerAction(showQuickToolbar, Constants::SHOW_QT_QUICK_HELPER, context); #ifdef Q_WS_MACX cmd->setDefaultKeySequence(QKeySequence(Qt::META + Qt::ALT + Qt::Key_Space)); #else cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Space)); #endif connect(showQuickToolbar, SIGNAL(triggered()), this, SLOT(showContextPane())); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd); // Insert marker for "Refactoring" menu: Core::Context globalContext(Core::Constants::C_GLOBAL); Core::Command *sep = createSeparator(am, this, globalContext, Constants::SEPARATOR1); sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT); contextMenu->addAction(sep); contextMenu->addAction(createSeparator(am, this, globalContext, Constants::SEPARATOR2)); 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(QLatin1String(":/qmljseditor/images/qmlfile.png")), "qml"); m_quickFixCollector = new QmlJSQuickFixCollector; addAutoReleasedObject(m_quickFixCollector); QmlJSQuickFixCollector::registerQuickFixes(this); addAutoReleasedObject(new QmlJSOutlineWidgetFactory); m_qmlTaskManager = new QmlTaskManager; addAutoReleasedObject(m_qmlTaskManager); connect(m_modelManager, SIGNAL(documentChangedOnDisk(QmlJS::Document::Ptr)), m_qmlTaskManager, SLOT(documentChangedOnDisk(QmlJS::Document::Ptr))); connect(m_modelManager, SIGNAL(aboutToRemoveFiles(QStringList)), m_qmlTaskManager, SLOT(documentsRemoved(QStringList))); addAutoReleasedObject(new QuickToolBar); addAutoReleasedObject(new Internal::QuickToolBarSettingsPage); connect(core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*))); return true; }
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; }
void BauhausPlugin::createDesignModeWidget() { Core::ICore *creatorCore = Core::ICore::instance(); Core::ActionManager *actionManager = creatorCore->actionManager(); m_editorManager = creatorCore->editorManager(); Core::ActionContainer *editMenu = actionManager->actionContainer(Core::Constants::M_EDIT); m_mainWidget = new DesignModeWidget; m_context = new DesignModeContext(m_mainWidget); creatorCore->addContextObject(m_context); Core::Context qmlDesignerMainContext(Constants::C_QMLDESIGNER); Core::Context qmlDesignerFormEditorContext(Constants::C_QMLFORMEDITOR); Core::Context qmlDesignerNavigatorContext(Constants::C_QMLNAVIGATOR); // Revert to saved actionManager->registerAction(m_revertToSavedAction, Core::Constants::REVERTTOSAVED, qmlDesignerMainContext); connect(m_revertToSavedAction, SIGNAL(triggered()), m_editorManager, SLOT(revertToSaved())); //Save actionManager->registerAction(m_saveAction, Core::Constants::SAVE, qmlDesignerMainContext); connect(m_saveAction, SIGNAL(triggered()), m_editorManager, SLOT(saveFile())); //Save As actionManager->registerAction(m_saveAsAction, Core::Constants::SAVEAS, qmlDesignerMainContext); connect(m_saveAsAction, SIGNAL(triggered()), m_editorManager, SLOT(saveFileAs())); //Close Editor actionManager->registerAction(m_closeCurrentEditorAction, Core::Constants::CLOSE, qmlDesignerMainContext); connect(m_closeCurrentEditorAction, SIGNAL(triggered()), m_editorManager, SLOT(closeEditor())); //Close All actionManager->registerAction(m_closeAllEditorsAction, Core::Constants::CLOSEALL, qmlDesignerMainContext); connect(m_closeAllEditorsAction, SIGNAL(triggered()), m_editorManager, SLOT(closeAllEditors())); //Close All Others Action actionManager->registerAction(m_closeOtherEditorsAction, Core::Constants::CLOSEOTHERS, qmlDesignerMainContext); connect(m_closeOtherEditorsAction, SIGNAL(triggered()), m_editorManager, SLOT(closeOtherEditors())); // Undo / Redo actionManager->registerAction(m_mainWidget->undoAction(), Core::Constants::UNDO, qmlDesignerMainContext); actionManager->registerAction(m_mainWidget->redoAction(), Core::Constants::REDO, qmlDesignerMainContext); Core::Command *command; //GoIntoComponent command = actionManager->registerAction(m_mainWidget->goIntoComponentAction(), Constants::GO_INTO_COMPONENT, qmlDesignerMainContext); command->setDefaultKeySequence(QKeySequence(Qt::Key_F2)); //Edit Menu command = actionManager->registerAction(m_mainWidget->deleteAction(), QmlDesigner::Constants::DELETE, qmlDesignerFormEditorContext); command = actionManager->registerAction(m_mainWidget->deleteAction(), QmlDesigner::Constants::DELETE, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::Delete); command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); command = actionManager->registerAction(m_mainWidget->cutAction(), Core::Constants::CUT, qmlDesignerFormEditorContext); command = actionManager->registerAction(m_mainWidget->cutAction(), Core::Constants::CUT, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::Cut); editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); command = actionManager->registerAction(m_mainWidget->copyAction(), Core::Constants::COPY, qmlDesignerFormEditorContext); command = actionManager->registerAction(m_mainWidget->copyAction(), Core::Constants::COPY, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::Copy); editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); command = actionManager->registerAction(m_mainWidget->pasteAction(), Core::Constants::PASTE, qmlDesignerFormEditorContext); command = actionManager->registerAction(m_mainWidget->pasteAction(), Core::Constants::PASTE, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::Paste); editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); command = actionManager->registerAction(m_mainWidget->selectAllAction(), Core::Constants::SELECTALL, qmlDesignerFormEditorContext); command = actionManager->registerAction(m_mainWidget->selectAllAction(), Core::Constants::SELECTALL, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::SelectAll); editMenu->addAction(command, Core::Constants::G_EDIT_SELECTALL); Core::ActionContainer *viewsMenu = actionManager->actionContainer(Core::Constants::M_WINDOW_VIEWS); command = actionManager->registerAction(m_mainWidget->toggleLeftSidebarAction(), Constants::TOGGLE_LEFT_SIDEBAR, qmlDesignerMainContext); command->setAttribute(Core::Command::CA_Hide); command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+0")); viewsMenu->addAction(command); command = actionManager->registerAction(m_mainWidget->toggleRightSidebarAction(), Constants::TOGGLE_RIGHT_SIDEBAR, qmlDesignerMainContext); command->setAttribute(Core::Command::CA_Hide); command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+Shift+0")); viewsMenu->addAction(command); command = actionManager->registerAction(m_mainWidget->restoreDefaultViewAction(), Constants::RESTORE_DEFAULT_VIEW, qmlDesignerMainContext); command->setAttribute(Core::Command::CA_Hide); viewsMenu->addAction(command); command = actionManager->registerAction(m_mainWidget->hideSidebarsAction(), Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext); #ifdef Q_OS_MACX // add second shortcut to trigger delete QAction *deleteAction = new QAction(m_mainWidget); deleteAction->setShortcut(QKeySequence(QLatin1String("Backspace"))); connect(deleteAction, SIGNAL(triggered()), m_mainWidget->deleteAction(), SIGNAL(triggered())); m_mainWidget->addAction(deleteAction); #endif // Q_OS_MACX connect(m_editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)), this, SLOT(updateEditor(Core::IEditor*))); connect(m_editorManager, SIGNAL(editorsClosed(QList<Core::IEditor*>)), this, SLOT(textEditorsClosed(QList<Core::IEditor*>))); connect(creatorCore, SIGNAL(contextChanged(Core::IContext*,Core::Context)), this, SLOT(contextChanged(Core::IContext*,Core::Context))); }
bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { Core::ICore *core = Core::ICore::instance(); if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage)) return false; addAutoReleasedObject(new CppEditorFactory(this)); addAutoReleasedObject(new CppHoverHandler); addAutoReleasedObject(new CppOutlineWidgetFactory); addAutoReleasedObject(new CppTypeHierarchyFactory); addAutoReleasedObject(new CppSnippetProvider); m_quickFixCollector = new CppQuickFixCollector; addAutoReleasedObject(m_quickFixCollector); CppQuickFixCollector::registerQuickFixes(this); CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); wizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY)); wizardParameters.setDisplayCategory(QCoreApplication::translate(Constants::WIZARD_CATEGORY, Constants::WIZARD_TR_CATEGORY)); wizardParameters.setDisplayName(tr("C++ Class")); wizardParameters.setId(QLatin1String("A.Class")); wizardParameters.setKind(Core::IWizard::ClassWizard); wizardParameters.setDescription(tr("Creates a C++ header and a source file for a new class that you can add to a C++ project.")); addAutoReleasedObject(new CppClassWizard(wizardParameters, core)); wizardParameters.setKind(Core::IWizard::FileWizard); wizardParameters.setDescription(tr("Creates a C++ source file that you can add to a C++ project.")); wizardParameters.setDisplayName(tr("C++ Source File")); wizardParameters.setId(QLatin1String("B.Source")); addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core)); wizardParameters.setDescription(tr("Creates a C++ header file that you can add to a C++ project.")); wizardParameters.setDisplayName(tr("C++ Header File")); wizardParameters.setId(QLatin1String("C.Header")); addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core)); Core::Context context(CppEditor::Constants::C_CPPEDITOR); Core::ActionManager *am = core->actionManager(); Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT); Core::Command *cmd; Core::ActionContainer *cppToolsMenu = am->actionContainer(Core::Id(CppTools::Constants::M_TOOLS_CPP)); QAction *jumpToDefinition = new QAction(tr("Follow Symbol Under Cursor"), this); cmd = am->registerAction(jumpToDefinition, Constants::JUMP_TO_DEFINITION, context, true); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F2)); connect(jumpToDefinition, SIGNAL(triggered()), this, SLOT(jumpToDefinition())); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Method Declaration/Definition"), this); cmd = am->registerAction(switchDeclarationDefinition, Constants::SWITCH_DECLARATION_DEFINITION, context, true); cmd->setDefaultKeySequence(QKeySequence("Shift+F2")); connect(switchDeclarationDefinition, SIGNAL(triggered()), this, SLOT(switchDeclarationDefinition())); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); m_findUsagesAction = new QAction(tr("Find Usages"), this); cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); m_openTypeHierarchyAction = new QAction(tr("Open Type Hierarchy"), this); cmd = am->registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+T"))); connect(m_openTypeHierarchyAction, SIGNAL(triggered()), this, SLOT(openTypeHierarchy())); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); // Refactoring sub-menu Core::Context globalContext(Core::Constants::C_GLOBAL); Core::Command *sep = createSeparator(am, this, globalContext, Constants::SEPARATOR2); sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT); contextMenu->addAction(sep); contextMenu->addAction(createSeparator(am, this, globalContext, Constants::SEPARATOR3)); m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol Under Cursor"), this); cmd = am->registerAction(m_renameSymbolUnderCursorAction, Constants::RENAME_SYMBOL_UNDER_CURSOR, context); cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R")); connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor())); cppToolsMenu->addAction(cmd); // Update context in global context cppToolsMenu->addAction(createSeparator(am, this, globalContext, CppEditor::Constants::SEPARATOR4)); m_updateCodeModelAction = new QAction(tr("Update Code Model"), this); cmd = am->registerAction(m_updateCodeModelAction, Core::Id(Constants::UPDATE_CODEMODEL), globalContext); CPlusPlus::CppModelManagerInterface *cppModelManager = CPlusPlus::CppModelManagerInterface::instance(); connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles())); cppToolsMenu->addAction(cmd); m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR, TextEditor::TextEditorActionHandler::Format | TextEditor::TextEditorActionHandler::UnCommentSelection | TextEditor::TextEditorActionHandler::UnCollapseAll); m_actionHandler->initializeActions(); contextMenu->addAction(createSeparator(am, this, context, CppEditor::Constants::SEPARATOR)); cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); connect(core->progressManager(), SIGNAL(taskStarted(QString)), this, SLOT(onTaskStarted(QString))); connect(core->progressManager(), SIGNAL(allTasksFinished(QString)), this, SLOT(onAllTasksFinished(QString))); connect(core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*))); readSettings(); return true; }