projectexplorer.cpp 114 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2
3
4
**
** This file is part of Qt Creator
**
con's avatar
con committed
5
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
con's avatar
con committed
8
**
9
**
10
** GNU Lesser General Public License Usage
11
**
hjk's avatar
hjk committed
12
13
14
15
16
17
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18
**
con's avatar
con committed
19
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
con's avatar
con committed
21
22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23
24
25
26
27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
con's avatar
con committed
28
** If you have questions regarding the use of this file, please contact
29
** Nokia at qt-info@nokia.com.
con's avatar
con committed
30
**
31
**************************************************************************/
hjk's avatar
hjk committed
32

33
#include "projectexplorer.h"
Tobias Hunger's avatar
Tobias Hunger committed
34

Tobias Hunger's avatar
Tobias Hunger committed
35
36
#include "buildsteplist.h"
#include "deployconfiguration.h"
37
#include "gcctoolchainfactories.h"
38
#include "project.h"
39
#include "projectexplorersettings.h"
Tobias Hunger's avatar
Tobias Hunger committed
40
41
#include "target.h"
#include "targetsettingspanel.h"
42
43
#include "toolchainmanager.h"
#include "toolchainoptionspage.h"
44
#include "copytaskhandler.h"
45
#include "showineditortaskhandler.h"
46
#include "vcsannotatetaskhandler.h"
47
#include "localapplicationruncontrol.h"
con's avatar
con committed
48
49
50
51
#include "allprojectsfilter.h"
#include "allprojectsfind.h"
#include "buildmanager.h"
#include "buildsettingspropertiespage.h"
52
#include "currentprojectfind.h"
con's avatar
con committed
53
54
#include "currentprojectfilter.h"
#include "customexecutablerunconfiguration.h"
55
#include "editorsettingspropertiespage.h"
56
#include "codestylesettingspropertiespage.h"
57
#include "dependenciespanel.h"
con's avatar
con committed
58
59
60
61
#include "foldernavigationwidget.h"
#include "iprojectmanager.h"
#include "metatypedeclarations.h"
#include "nodesvisitor.h"
62
#include "appoutputpane.h"
con's avatar
con committed
63
64
65
#include "pluginfilefactory.h"
#include "processstep.h"
#include "projectexplorerconstants.h"
66
#include "customwizard.h"
con's avatar
con committed
67
68
69
70
71
72
#include "projectfilewizardextension.h"
#include "projecttreewidget.h"
#include "projectwindow.h"
#include "removefiledialog.h"
#include "runsettingspropertiespage.h"
#include "session.h"
73
#include "projectnodes.h"
con's avatar
con committed
74
#include "sessiondialog.h"
Tobias Hunger's avatar
Tobias Hunger committed
75
#include "target.h"
76
#include "projectexplorersettingspage.h"
77
#include "projectwelcomepage.h"
78
#include "corelistenercheckingforrunningbuild.h"
79
#include "buildconfiguration.h"
80
#include "miniprojecttargetselector.h"
dt's avatar
dt committed
81
#include "taskhub.h"
82
83
#include "publishing/ipublishingwizardfactory.h"
#include "publishing/publishingwizardselectiondialog.h"
con's avatar
con committed
84

85
#ifdef Q_OS_WIN
86
#    include "windebuginterface.h"
87
#    include "msvctoolchain.h"
SteveKing's avatar
SteveKing committed
88
#    include "wincetoolchain.h"
89
90
#endif

91
#include <extensionsystem/pluginspec.h>
con's avatar
con committed
92
#include <coreplugin/coreconstants.h>
93
94
#include <coreplugin/filemanager.h>
#include <coreplugin/icore.h>
95
#include <coreplugin/imode.h>
con's avatar
con committed
96
97
#include <coreplugin/mimedatabase.h>
#include <coreplugin/modemanager.h>
98
#include <coreplugin/actionmanager/actionmanager.h>
99
100
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h>
101
#include <coreplugin/id.h>
con's avatar
con committed
102
103
104
105
106
107
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/findplaceholder.h>
#include <coreplugin/basefilewizard.h>
#include <coreplugin/vcsmanager.h>
#include <coreplugin/iversioncontrol.h>
108
#include <coreplugin/variablemanager.h>
Robert Loehning's avatar
Robert Loehning committed
109
#include <coreplugin/fileutils.h>
110
#include <extensionsystem/pluginmanager.h>
111
#include <find/searchresultwindow.h>
112
#include <utils/consoleprocess.h>
hjk's avatar
hjk committed
113
#include <utils/qtcassert.h>
114
#include <utils/parameteraction.h>
115
#include <utils/stringutils.h>
Jarek Kobus's avatar
Jarek Kobus committed
116
#include <utils/persistentsettings.h>
con's avatar
con committed
117

118
#include <QtCore/QtPlugin>
hjk's avatar
hjk committed
119
#include <QtCore/QDateTime>
con's avatar
con committed
120
121
#include <QtCore/QDebug>
#include <QtCore/QSettings>
122
#include <QtCore/QAbstractFileEngine>
hjk's avatar
hjk committed
123

con's avatar
con committed
124
125
#include <QtGui/QAction>
#include <QtGui/QApplication>
hjk's avatar
hjk committed
126
127
128
#include <QtGui/QFileDialog>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
129
#include <QtGui/QMainWindow>
130
#include <QtGui/QWizard>
con's avatar
con committed
131

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*!
    \namespace ProjectExplorer
    ProjectExplorer plugin namespace
*/

/*!
    \namespace ProjectExplorer::Internal
    Internal namespace of the ProjectExplorer plugin
    \internal
*/

/*!
    \class ProjectExplorer::ProjectExplorerPlugin

    \brief ProjectExplorerPlugin with static accessor and utility functions to obtain
    current project, open projects, etc.
*/

con's avatar
con committed
150
151
152
153
namespace {
bool debug = false;
}

154
155
static const char kCurrentProjectPath[] = "CurrentProject:Path";
static const char kCurrentProjectFilePath[] = "CurrentProject:FilePath";
con's avatar
con committed
156

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
namespace ProjectExplorer {

struct ProjectExplorerPluginPrivate {
    ProjectExplorerPluginPrivate();

    QMenu *m_sessionContextMenu;
    QMenu *m_sessionMenu;
    QMenu *m_projectMenu;
    QMenu *m_subProjectMenu;
    QMenu *m_folderMenu;
    QMenu *m_fileMenu;
    QMenu *m_openWithMenu;

    QMultiMap<int, QObject*> m_actionMap;
    QAction *m_sessionManagerAction;
    QAction *m_newAction;
    QAction *m_loadAction;
174
    Utils::ParameterAction *m_unloadAction;
175
176
    QAction *m_clearSession;
    QAction *m_buildProjectOnlyAction;
177
    Utils::ParameterAction *m_buildAction;
178
    Utils::ParameterAction *m_buildActionContextMenu;
179
180
    QAction *m_buildSessionAction;
    QAction *m_rebuildProjectOnlyAction;
181
    Utils::ParameterAction *m_rebuildAction;
182
    Utils::ParameterAction *m_rebuildActionContextMenu;
183
184
    QAction *m_rebuildSessionAction;
    QAction *m_cleanProjectOnlyAction;
Tobias Hunger's avatar
Tobias Hunger committed
185
186
187
188
    QAction *m_deployProjectOnlyAction;
    Utils::ParameterAction *m_deployAction;
    Utils::ParameterAction *m_deployActionContextMenu;
    QAction *m_deploySessionAction;
189
    Utils::ParameterAction *m_publishAction;
190
    Utils::ParameterAction *m_cleanAction;
191
    Utils::ParameterAction *m_cleanActionContextMenu;
192
193
194
    QAction *m_cleanSessionAction;
    QAction *m_runAction;
    QAction *m_runActionContextMenu;
195
    QAction *m_runWithoutDeployAction;
196
197
198
    QAction *m_cancelBuildAction;
    QAction *m_addNewFileAction;
    QAction *m_addExistingFilesAction;
199
    QAction *m_addNewSubprojectAction;
200
    QAction *m_removeFileAction;
201
    QAction *m_removeProjectAction;
202
    QAction *m_deleteFileAction;
203
    QAction *m_renameFileAction;
dt's avatar
dt committed
204
    QAction *m_openFileAction;
205
    QAction *m_projectTreeCollapseAllAction;
206
    QAction *m_searchOnFileSystem;
dt's avatar
dt committed
207
208
    QAction *m_showInGraphicalShell;
    QAction *m_openTerminalHere;
209
    QAction *m_setStartupProjectAction;
210
    QAction *m_projectSelectorAction;
211
    QAction *m_projectSelectorActionMenu;
Daniel Teske's avatar
Daniel Teske committed
212
    QAction *m_projectSelectorActionQuick;
dt's avatar
dt committed
213
    QAction *m_runSubProject;
214
215
216
217
218
219
220
221
222
223
224
225

    Internal::ProjectWindow *m_proWindow;
    SessionManager *m_session;
    QString m_sessionToRestoreAtStartup;

    Project *m_currentProject;
    Node *m_currentNode;

    BuildManager *m_buildManager;

    QList<Internal::ProjectFileFactory*> m_fileFactories;
    QStringList m_profileMimeTypes;
226
    Internal::AppOutputPane *m_outputPane;
227
228
229
230
231

    QList<QPair<QString, QString> > m_recentProjects; // pair of filename, displayname
    static const int m_maxRecentProjects = 7;

    QString m_lastOpenDirectory;
232
    RunConfiguration *m_delayedRunConfiguration; // TODO this is not right
233
    RunMode m_runMode;
234
    QString m_projectFilterString;
235
    Internal::MiniProjectTargetSelector * m_targetSelector;
236
    Internal::ProjectExplorerSettings m_projectExplorerSettings;
237
    Internal::ProjectWelcomePage *m_welcomePage;
238

239
    Core::IMode *m_projectsMode;
240
241

    ToolChainManager *m_toolChainManager;
242
243
244
245
246
247
};

ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
    m_currentProject(0),
    m_currentNode(0),
    m_delayedRunConfiguration(0),
248
    m_runMode(NoRunMode),
249
250
    m_projectsMode(0),
    m_toolChainManager(0)
251
252
253
{
}

254
255
256
class ProjectsMode : public Core::IMode
{
public:
257
258
259
260
    ProjectsMode(QWidget *proWindow)
    {
        setWidget(proWindow);
        setContext(Core::Context(Constants::C_PROJECTEXPLORER));
261
262
263
264
265
266
        setDisplayName(QCoreApplication::translate("ProjectExplorer::ProjectsMode", "Projects"));
        setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Project.png")));
        setPriority(Constants::P_MODE_SESSION);
        setId(QLatin1String(Constants::MODE_SESSION));
        setType(QString());
        setContextHelpId(QLatin1String("Managing Projects"));
267
    }
268
269
};

270
271
}  // namespace ProjectExplorer

con's avatar
con committed
272
273
274
275
276
277
278
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;


ProjectExplorerPlugin *ProjectExplorerPlugin::m_instance = 0;

ProjectExplorerPlugin::ProjectExplorerPlugin()
279
    : d(new ProjectExplorerPluginPrivate)
con's avatar
con committed
280
281
282
283
284
285
{
    m_instance = this;
}

ProjectExplorerPlugin::~ProjectExplorerPlugin()
{
286
287
    removeObject(d->m_welcomePage);
    delete d->m_welcomePage;
288
    delete d->m_toolChainManager;
con's avatar
con committed
289
    removeObject(this);
290
    delete d;
con's avatar
con committed
291
292
293
294
295
296
297
}

ProjectExplorerPlugin *ProjectExplorerPlugin::instance()
{
    return m_instance;
}

298
299
300
301
302
303
bool ProjectExplorerPlugin::parseArguments(const QStringList &arguments, QString * /* error */)
{
    CustomWizard::setVerbose(arguments.count(QLatin1String("-customwizard-verbose")));
    return true;
}

304
bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *error)
con's avatar
con committed
305
{
Friedemann Kleint's avatar
Friedemann Kleint committed
306
307
    qRegisterMetaType<ProjectExplorer::RunControl *>();

308
309
    if (!parseArguments(arguments, error))
        return false;
dt's avatar
dt committed
310
311
    addObject(this);

312
    // Add ToolChainFactories:
313
#ifdef Q_OS_WIN
314
315
    addAutoReleasedObject(new WinDebugInterface);

316
317
    addAutoReleasedObject(new Internal::MingwToolChainFactory);
    addAutoReleasedObject(new Internal::MsvcToolChainFactory);
SteveKing's avatar
SteveKing committed
318
    addAutoReleasedObject(new Internal::WinCEToolChainFactory);
319
320
321
#else
    addAutoReleasedObject(new Internal::GccToolChainFactory);
    addAutoReleasedObject(new Internal::LinuxIccToolChainFactory);
322
#endif
Tobias Hunger's avatar
Tobias Hunger committed
323
    addAutoReleasedObject(new Internal::ClangToolChainFactory);
324
325
326
327
328

    d->m_toolChainManager = new ToolChainManager(this);

    addAutoReleasedObject(new Internal::ToolChainOptionsPage);

dt's avatar
dt committed
329
    addAutoReleasedObject(new TaskHub);
330

331
332
    Core::ICore *core = Core::ICore::instance();
    Core::ActionManager *am = core->actionManager();
333
    connect(core, SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards()));
con's avatar
con committed
334

335
    d->m_welcomePage = new ProjectWelcomePage;
336
    connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
337
    addObject(d->m_welcomePage);
con's avatar
con committed
338

hjk's avatar
hjk committed
339
340
    connect(core->fileManager(), SIGNAL(currentFileChanged(QString)),
            this, SLOT(setCurrentFile(QString)));
con's avatar
con committed
341

342
    d->m_session = new SessionManager(this);
con's avatar
con committed
343

344
    connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project *)),
con's avatar
con committed
345
            this, SIGNAL(fileListChanged()));
346
    connect(d->m_session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project *)),
con's avatar
con committed
347
            this, SLOT(invalidateProject(ProjectExplorer::Project *)));
348
    connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project *)),
con's avatar
con committed
349
            this, SIGNAL(fileListChanged()));
350
351
352
353
    connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
            this, SLOT(projectAdded(ProjectExplorer::Project*)));
    connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
            this, SLOT(projectRemoved(ProjectExplorer::Project*)));
354
    connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project *)),
con's avatar
con committed
355
            this, SLOT(startupProjectChanged()));
356
357
    connect(d->m_session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
            this, SLOT(updateActions()));
358
359
    connect(d->m_session, SIGNAL(sessionLoaded()),
            this, SLOT(updateActions()));
360
361
    connect(d->m_session, SIGNAL(sessionLoaded()),
            this, SLOT(updateWelcomePage()));
con's avatar
con committed
362

363
    d->m_proWindow = new ProjectWindow;
con's avatar
con committed
364

365
    Core::Context globalcontext(Core::Constants::C_GLOBAL);
dt's avatar
dt committed
366
    Core::Context projecTreeContext(Constants::C_PROJECT_TREE);
con's avatar
con committed
367

368
    d->m_projectsMode = new ProjectsMode(d->m_proWindow);
369
370
    d->m_projectsMode->setEnabled(session()->startupProject());
    addAutoReleasedObject(d->m_projectsMode);
371
    d->m_proWindow->layout()->addWidget(new Core::FindToolBarPlaceHolder(d->m_proWindow));
con's avatar
con committed
372

373
    addAutoReleasedObject(new CopyTaskHandler);
374
    addAutoReleasedObject(new ShowInEditorTaskHandler);
375
    addAutoReleasedObject(new VcsAnnotateTaskHandler);
376

377
378
    d->m_buildManager = new BuildManager(this);
    connect(d->m_buildManager, SIGNAL(buildStateChanged(ProjectExplorer::Project *)),
con's avatar
con committed
379
            this, SLOT(buildStateChanged(ProjectExplorer::Project *)));
380
    connect(d->m_buildManager, SIGNAL(buildQueueFinished(bool)),
con's avatar
con committed
381
382
            this, SLOT(buildQueueFinished(bool)));

383
    addAutoReleasedObject(new CoreListener);
con's avatar
con committed
384

385
    d->m_outputPane = new AppOutputPane;
386
387
388
    addAutoReleasedObject(d->m_outputPane);
    connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project *)),
            d->m_outputPane, SLOT(projectRemoved()));
con's avatar
con committed
389

390
391
392
393
394
    connect(d->m_outputPane, SIGNAL(runControlStarted(ProjectExplorer::RunControl*)),
            this, SIGNAL(runControlStarted(ProjectExplorer::RunControl*)));
    connect(d->m_outputPane, SIGNAL(runControlFinished(ProjectExplorer::RunControl*)),
            this, SIGNAL(runControlFinished(ProjectExplorer::RunControl*)));

395
    AllProjectsFilter *allProjectsFilter = new AllProjectsFilter(this);
con's avatar
con committed
396
397
    addAutoReleasedObject(allProjectsFilter);

398
    CurrentProjectFilter *currentProjectFilter = new CurrentProjectFilter(this);
con's avatar
con committed
399
400
401
402
403
    addAutoReleasedObject(currentProjectFilter);

    addAutoReleasedObject(new BuildSettingsPanelFactory);
    addAutoReleasedObject(new RunSettingsPanelFactory);
    addAutoReleasedObject(new EditorSettingsPanelFactory);
404
    addAutoReleasedObject(new CodeStyleSettingsPanelFactory);
405
    addAutoReleasedObject(new DependenciesPanelFactory(d->m_session));
con's avatar
con committed
406
407
408
409

    ProcessStepFactory *processStepFactory = new ProcessStepFactory;
    addAutoReleasedObject(processStepFactory);

410
    AllProjectsFind *allProjectsFind = new AllProjectsFind(this);
con's avatar
con committed
411
412
    addAutoReleasedObject(allProjectsFind);

413
    CurrentProjectFind *currentProjectFind = new CurrentProjectFind(this);
con's avatar
con committed
414
415
    addAutoReleasedObject(currentProjectFind);

416
    addAutoReleasedObject(new LocalApplicationRunControlFactory);
con's avatar
con committed
417
418
    addAutoReleasedObject(new CustomExecutableRunConfigurationFactory);

419
    addAutoReleasedObject(new ProjectFileWizardExtension);
con's avatar
con committed
420

421
422
423
    // Settings page
    addAutoReleasedObject(new ProjectExplorerSettingsPage);

con's avatar
con committed
424
    // context menus
425
    Core::ActionContainer *msessionContextMenu =
con's avatar
con committed
426
        am->createMenu(Constants::M_SESSIONCONTEXT);
dt's avatar
dt committed
427
    Core::ActionContainer *mprojectContextMenu =
con's avatar
con committed
428
        am->createMenu(Constants::M_PROJECTCONTEXT);
dt's avatar
dt committed
429
    Core::ActionContainer *msubProjectContextMenu =
con's avatar
con committed
430
        am->createMenu(Constants::M_SUBPROJECTCONTEXT);
dt's avatar
dt committed
431
    Core::ActionContainer *mfolderContextMenu =
con's avatar
con committed
432
        am->createMenu(Constants::M_FOLDERCONTEXT);
dt's avatar
dt committed
433
    Core::ActionContainer *mfileContextMenu =
con's avatar
con committed
434
435
        am->createMenu(Constants::M_FILECONTEXT);

436
    d->m_sessionContextMenu = msessionContextMenu->menu();
dt's avatar
dt committed
437
438
439
440
    d->m_projectMenu = mprojectContextMenu->menu();
    d->m_subProjectMenu = msubProjectContextMenu->menu();
    d->m_folderMenu = mfolderContextMenu->menu();
    d->m_fileMenu = mfileContextMenu->menu();
con's avatar
con committed
441

442
    Core::ActionContainer *mfile =
con's avatar
con committed
443
        am->actionContainer(Core::Constants::M_FILE);
444
    Core::ActionContainer *menubar =
con's avatar
con committed
445
446
447
        am->actionContainer(Core::Constants::MENU_BAR);

    // build menu
448
    Core::ActionContainer *mbuild =
con's avatar
con committed
449
        am->createMenu(Constants::M_BUILDPROJECT);
450
    mbuild->menu()->setTitle(tr("&Build"));
con's avatar
con committed
451
452
453
    menubar->addMenu(mbuild, Core::Constants::G_VIEW);

    // debug menu
454
    Core::ActionContainer *mdebug =
con's avatar
con committed
455
        am->createMenu(Constants::M_DEBUG);
456
    mdebug->menu()->setTitle(tr("&Debug"));
con's avatar
con committed
457
458
    menubar->addMenu(mdebug, Core::Constants::G_VIEW);

459
460
461
462
    Core::ActionContainer *mstartdebugging =
        am->createMenu(Constants::M_DEBUG_STARTDEBUGGING);
    mstartdebugging->menu()->setTitle(tr("&Start Debugging"));
    mdebug->addMenu(mstartdebugging, Core::Constants::G_DEFAULT_ONE);
con's avatar
con committed
463
464
465
466
467
468
469
470
471

    //
    // Groups
    //

    mbuild->appendGroup(Constants::G_BUILD_SESSION);
    mbuild->appendGroup(Constants::G_BUILD_PROJECT);
    mbuild->appendGroup(Constants::G_BUILD_OTHER);
    mbuild->appendGroup(Constants::G_BUILD_CANCEL);
dt's avatar
dt committed
472
    mbuild->appendGroup(Constants::G_BUILD_RUN);
con's avatar
con committed
473
474
475
476
477

    msessionContextMenu->appendGroup(Constants::G_SESSION_BUILD);
    msessionContextMenu->appendGroup(Constants::G_SESSION_FILES);
    msessionContextMenu->appendGroup(Constants::G_SESSION_OTHER);
    msessionContextMenu->appendGroup(Constants::G_SESSION_CONFIG);
478
    msessionContextMenu->appendGroup(Constants::G_PROJECT_TREE);
con's avatar
con committed
479

dt's avatar
dt committed
480
481
482
483
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_FIRST);
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_BUILD);
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_RUN);
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_FILES);
484
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_LAST);
485
    mprojectContextMenu->appendGroup(Constants::G_PROJECT_TREE);
con's avatar
con committed
486

dt's avatar
dt committed
487
488
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_FIRST);
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_BUILD);
dt's avatar
dt committed
489
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_RUN);
dt's avatar
dt committed
490
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_FILES);
491
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_LAST);
492
    msubProjectContextMenu->appendGroup(Constants::G_PROJECT_TREE);
con's avatar
con committed
493

dt's avatar
dt committed
494
495
    Core::ActionContainer *runMenu = Core::ICore::instance()->actionManager()->createMenu(Constants::RUNMENUCONTEXTMENU);
    runMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide);
Friedemann Kleint's avatar
Friedemann Kleint committed
496
    QIcon runIcon = QIcon(QLatin1String(Constants::ICON_RUN));
497
    runIcon.addFile(QLatin1String(Constants::ICON_RUN_SMALL));
dt's avatar
dt committed
498
    runMenu->menu()->setIcon(runIcon);
499
    runMenu->menu()->setTitle(tr("Run"));
dt's avatar
dt committed
500
501
    msubProjectContextMenu->addMenu(runMenu, ProjectExplorer::Constants::G_PROJECT_RUN);

dt's avatar
dt committed
502
503
504
    mfolderContextMenu->appendGroup(Constants::G_FOLDER_FILES);
    mfolderContextMenu->appendGroup(Constants::G_FOLDER_OTHER);
    mfolderContextMenu->appendGroup(Constants::G_FOLDER_CONFIG);
505
    mfolderContextMenu->appendGroup(Constants::G_PROJECT_TREE);
con's avatar
con committed
506

dt's avatar
dt committed
507
508
509
    mfileContextMenu->appendGroup(Constants::G_FILE_OPEN);
    mfileContextMenu->appendGroup(Constants::G_FILE_OTHER);
    mfileContextMenu->appendGroup(Constants::G_FILE_CONFIG);
510
    mfileContextMenu->appendGroup(Constants::G_PROJECT_TREE);
con's avatar
con committed
511
    // "open with" submenu
512
    Core::ActionContainer * const openWith =
con's avatar
con committed
513
            am->createMenu(ProjectExplorer::Constants::M_OPENFILEWITHCONTEXT);
514
    openWith->setOnAllDisabledBehavior(Core::ActionContainer::Show);
515
516
    d->m_openWithMenu = openWith->menu();
    d->m_openWithMenu->setTitle(tr("Open With"));
con's avatar
con committed
517

518
    connect(d->m_openWithMenu, SIGNAL(triggered(QAction *)),
519
            Core::FileManager::instance(), SLOT(executeOpenWithMenuAction(QAction*)));
con's avatar
con committed
520
521
522
523
524

    //
    // Separators
    //

con's avatar
con committed
525
    Core::Command *cmd;
con's avatar
con committed
526
527
528
529
    QAction *sep;

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
530
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Build.Sep"), globalcontext);
con's avatar
con committed
531
532
533
534
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

    sep = new QAction(this);
    sep->setSeparator(true);
dt's avatar
dt committed
535
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Files.Sep"), projecTreeContext);
con's avatar
con committed
536
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
dt's avatar
dt committed
537
538
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
con's avatar
con committed
539
540
541

    sep = new QAction(this);
    sep->setSeparator(true);
dt's avatar
dt committed
542
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Config.Sep"), projecTreeContext);
con's avatar
con committed
543
544
545
546
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_CONFIG);

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
547
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Projects.Sep"), globalcontext);
con's avatar
con committed
548
549
550
551
    mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
552
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Other.Sep"), globalcontext);
con's avatar
con committed
553
554
555
556
557
    mbuild->addAction(cmd, Constants::G_BUILD_OTHER);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_OTHER);

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
558
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Run.Sep"), globalcontext);
con's avatar
con committed
559
    mbuild->addAction(cmd, Constants::G_BUILD_RUN);
dt's avatar
dt committed
560
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
con's avatar
con committed
561
562
563

    sep = new QAction(this);
    sep->setSeparator(true);
hjk's avatar
hjk committed
564
    cmd = am->registerAction(sep, Core::Id("ProjectExplorer.CancelBuild.Sep"), globalcontext);
con's avatar
con committed
565
566
567
568
569
570
571
    mbuild->addAction(cmd, Constants::G_BUILD_CANCEL);

    //
    // Actions
    //

    // new action
572
573
    d->m_newAction = new QAction(tr("New Project..."), this);
    cmd = am->registerAction(d->m_newAction, Constants::NEWPROJECT, globalcontext);
con's avatar
con committed
574
575
576
577
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+N")));
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);

    // open action
578
579
    d->m_loadAction = new QAction(tr("Load Project..."), this);
    cmd = am->registerAction(d->m_loadAction, Constants::LOAD, globalcontext);
580
#ifndef Q_WS_MAC
con's avatar
con committed
581
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+O")));
582
#endif
con's avatar
con committed
583
584
585
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);

    // Default open action
586
587
    d->m_openFileAction = new QAction(tr("Open File"), this);
    cmd = am->registerAction(d->m_openFileAction, ProjectExplorer::Constants::OPENFILE,
dt's avatar
dt committed
588
589
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
con's avatar
con committed
590

591
592
593
594
595
596
    d->m_searchOnFileSystem = new QAction(FolderNavigationWidget::msgFindOnFileSystem(), this);
    cmd = am->registerAction(d->m_searchOnFileSystem, ProjectExplorer::Constants::SEARCHONFILESYSTEM, projecTreeContext);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_CONFIG);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST);

597
    d->m_showInGraphicalShell = new QAction(Core::FileUtils::msgGraphicalShellAction(), this);
598
    cmd = am->registerAction(d->m_showInGraphicalShell, ProjectExplorer::Constants::SHOWINGRAPHICALSHELL,
dt's avatar
dt committed
599
600
601
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
con's avatar
con committed
602

603
    d->m_openTerminalHere = new QAction(Core::FileUtils::msgTerminalAction(), this);
604
    cmd = am->registerAction(d->m_openTerminalHere, ProjectExplorer::Constants::OPENTERMIANLHERE,
dt's avatar
dt committed
605
606
607
                       projecTreeContext);
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
608

con's avatar
con committed
609
    // Open With menu
dt's avatar
dt committed
610
    mfileContextMenu->addMenu(openWith, ProjectExplorer::Constants::G_FILE_OPEN);
con's avatar
con committed
611

mae's avatar
mae committed
612
    // recent projects menu
613
    Core::ActionContainer *mrecent =
mae's avatar
mae committed
614
        am->createMenu(Constants::M_RECENTPROJECTS);
615
    mrecent->menu()->setTitle(tr("Recent P&rojects"));
616
    mrecent->setOnAllDisabledBehavior(Core::ActionContainer::Show);
mae's avatar
mae committed
617
618
619
620
    mfile->addMenu(mrecent, Core::Constants::G_FILE_OPEN);
    connect(mfile->menu(), SIGNAL(aboutToShow()),
        this, SLOT(updateRecentProjectMenu()));

621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
    // recent session menu
    Core::ActionContainer *msession = am->createMenu(Constants::M_SESSION);
    msession->menu()->setTitle(tr("Recent Sessions"));
    msession->setOnAllDisabledBehavior(Core::ActionContainer::Show);
    mfile->addMenu(msession, Core::Constants::G_FILE_OPEN);
    d->m_sessionMenu = msession->menu();
    connect(mfile->menu(), SIGNAL(aboutToShow()),
            this, SLOT(updateSessionMenu()));

    // session manager action
    d->m_sessionManagerAction = new QAction(tr("Session Manager..."), this);
    cmd = am->registerAction(d->m_sessionManagerAction, Constants::NEWSESSION, globalcontext);
    mfile->addAction(cmd, Core::Constants::G_FILE_OPEN);
    cmd->setDefaultKeySequence(QKeySequence());


dt's avatar
dt committed
637
    // XXX same action?
con's avatar
con committed
638
    // unload action
639
640
    d->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""),
                                                      Utils::ParameterAction::EnabledWithParameter, this);
641
    cmd = am->registerAction(d->m_unloadAction, Constants::UNLOAD, globalcontext);
con's avatar
con committed
642
    cmd->setAttribute(Core::Command::CA_UpdateText);
643
    cmd->setDescription(d->m_unloadAction->text());
con's avatar
con committed
644
645
646
    mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);

    // unload session action
647
648
    d->m_clearSession = new QAction(tr("Close All Projects"), this);
    cmd = am->registerAction(d->m_clearSession, Constants::CLEARSESSION, globalcontext);
con's avatar
con committed
649
650
651
652
    mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);

    // build session action
Friedemann Kleint's avatar
Friedemann Kleint committed
653
    QIcon buildIcon = QIcon(QLatin1String(Constants::ICON_BUILD));
654
    buildIcon.addFile(QLatin1String(Constants::ICON_BUILD_SMALL));
655
656
    d->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this);
    cmd = am->registerAction(d->m_buildSessionAction, Constants::BUILDSESSION, globalcontext);
con's avatar
con committed
657
658
659
660
661
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B")));
    mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);

    // rebuild session action
Friedemann Kleint's avatar
Friedemann Kleint committed
662
    QIcon rebuildIcon = QIcon(QLatin1String(Constants::ICON_REBUILD));
663
    rebuildIcon.addFile(QLatin1String(Constants::ICON_REBUILD_SMALL));
664
665
    d->m_rebuildSessionAction = new QAction(rebuildIcon, tr("Rebuild All"), this);
    cmd = am->registerAction(d->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext);
con's avatar
con committed
666
667
668
    mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);

Tobias Hunger's avatar
Tobias Hunger committed
669
670
671
672
673
674
    // deploy session
    d->m_deploySessionAction = new QAction(tr("Deploy All"), this);
    cmd = am->registerAction(d->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext);
    mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);

con's avatar
con committed
675
    // clean session
Friedemann Kleint's avatar
Friedemann Kleint committed
676
    QIcon cleanIcon = QIcon(QLatin1String(Constants::ICON_CLEAN));
677
    cleanIcon.addFile(QLatin1String(Constants::ICON_CLEAN_SMALL));
678
679
    d->m_cleanSessionAction = new QAction(cleanIcon, tr("Clean All"), this);
    cmd = am->registerAction(d->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext);
con's avatar
con committed
680
681
682
683
    mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
    msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);

    // build action
684
    d->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""),
685
                                                     Utils::ParameterAction::AlwaysEnabled, this);
dt's avatar
dt committed
686
    d->m_buildAction->setIcon(buildIcon);
687
    cmd = am->registerAction(d->m_buildAction, Constants::BUILD, globalcontext);
688
    cmd->setAttribute(Core::Command::CA_UpdateText);
689
    cmd->setDescription(d->m_buildAction->text());
con's avatar
con committed
690
691
692
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+B")));
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

693
    // Add to mode bar
694
    Core::ModeManager::instance()->addAction(cmd->action(), Constants::P_ACTION_BUILDPROJECT);
695

con's avatar
con committed
696
    // rebuild action
697
    d->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""),
698
                                                       Utils::ParameterAction::AlwaysEnabled, this);
699
    cmd = am->registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext);
700
    cmd->setAttribute(Core::Command::CA_UpdateText);
701
    cmd->setDescription(d->m_rebuildAction->text());
con's avatar
con committed
702
703
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

Tobias Hunger's avatar
Tobias Hunger committed
704
705
706
707
708
    // deploy action
    d->m_deployAction = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""),
                                                     Utils::ParameterAction::AlwaysEnabled, this);
    cmd = am->registerAction(d->m_deployAction, Constants::DEPLOY, globalcontext);
    cmd->setAttribute(Core::Command::CA_UpdateText);
709
    cmd->setDescription(d->m_deployAction->text());
Tobias Hunger's avatar
Tobias Hunger committed
710
711
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

712
713
714
715
716
    // Publish action
    d->m_publishAction = new Utils::ParameterAction(tr("Publish Project..."), tr("Publish Project \"%1\"..."),
                                                    Utils::ParameterAction::AlwaysEnabled, this);
    cmd = am->registerAction(d->m_publishAction, Constants::PUBLISH, globalcontext);
    cmd->setAttribute(Core::Command::CA_UpdateText);
717
    cmd->setDescription(d->m_publishAction->text());
718
719
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);

con's avatar
con committed
720
    // clean action
721
    d->m_cleanAction = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""),
722
                                                     Utils::ParameterAction::AlwaysEnabled, this);
723
    cmd = am->registerAction(d->m_cleanAction, Constants::CLEAN, globalcontext);
724
    cmd->setAttribute(Core::Command::CA_UpdateText);
725
    cmd->setDescription(d->m_cleanAction->text());
con's avatar
con committed
726
    mbuild->addAction(cmd, Constants::G_BUILD_PROJECT);
727
728
729
730

    // build action (context menu)
    d->m_buildActionContextMenu = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""),
                                                             Utils::ParameterAction::AlwaysEnabled, this);
dt's avatar
dt committed
731
    cmd = am->registerAction(d->m_buildActionContextMenu, Constants::BUILDCM, projecTreeContext);
732
    cmd->setAttribute(Core::Command::CA_UpdateText);
733
    cmd->setDescription(d->m_buildActionContextMenu->text());
dt's avatar
dt committed
734
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
735
736
737
738

    // rebuild action (context menu)
    d->m_rebuildActionContextMenu = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""),
                                                               Utils::ParameterAction::AlwaysEnabled, this);
dt's avatar
dt committed
739
    cmd = am->registerAction(d->m_rebuildActionContextMenu, Constants::REBUILDCM, projecTreeContext);
740
    cmd->setAttribute(Core::Command::CA_UpdateText);
741
    cmd->setDescription(d->m_rebuildActionContextMenu->text());
dt's avatar
dt committed
742
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
743

Tobias Hunger's avatar
Tobias Hunger committed
744
745
746
    // deploy action (context menu)
    d->m_deployActionContextMenu = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""),
                                                              Utils::ParameterAction::AlwaysEnabled, this);
dt's avatar
dt committed
747
    cmd = am->registerAction(d->m_deployActionContextMenu, Constants::DEPLOYCM, projecTreeContext);
Tobias Hunger's avatar
Tobias Hunger committed
748
    cmd->setAttribute(Core::Command::CA_UpdateText);
749
    cmd->setDescription(d->m_deployActionContextMenu->text());
dt's avatar
dt committed
750
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
Tobias Hunger's avatar
Tobias Hunger committed
751

752
753
754
    // clean action (context menu)
    d->m_cleanActionContextMenu = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""),
                                                             Utils::ParameterAction::AlwaysEnabled, this);
dt's avatar
dt committed
755
    cmd = am->registerAction(d->m_cleanActionContextMenu, Constants::CLEANCM, projecTreeContext);
756
    cmd->setAttribute(Core::Command::CA_UpdateText);
757
    cmd->setDescription(d->m_cleanActionContextMenu->text());
dt's avatar
dt committed
758
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
con's avatar
con committed
759

760
    // build without dependencies action
761
762
    d->m_buildProjectOnlyAction = new QAction(tr("Build Without Dependencies"), this);
    cmd = am->registerAction(d->m_buildProjectOnlyAction, Constants::BUILDPROJECTONLY, globalcontext);
763

764
    // rebuild without dependencies action
765
766
    d->m_rebuildProjectOnlyAction = new QAction(tr("Rebuild Without Dependencies"), this);
    cmd = am->registerAction(d->m_rebuildProjectOnlyAction, Constants::REBUILDPROJECTONLY, globalcontext);
767

Tobias Hunger's avatar
Tobias Hunger committed
768
769
770
771
    // deploy without dependencies action
    d->m_deployProjectOnlyAction = new QAction(tr("Deploy Without Dependencies"), this);
    cmd = am->registerAction(d->m_deployProjectOnlyAction, Constants::DEPLOYPROJECTONLY, globalcontext);

772
    // clean without dependencies action
773
774
    d->m_cleanProjectOnlyAction = new QAction(tr("Clean Without Dependencies"), this);
    cmd = am->registerAction(d->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext);
775

con's avatar
con committed
776
    // run action
777
778
    d->m_runAction = new QAction(runIcon, tr("Run"), this);
    cmd = am->registerAction(d->m_runAction, Constants::RUN, globalcontext);
779
780
    cmd->setAttribute(Core::Command::CA_UpdateText);

con's avatar
con committed
781
782
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R")));
    mbuild->addAction(cmd, Constants::G_BUILD_RUN);
783

784
    Core::ModeManager::instance()->addAction(cmd->action(), Constants::P_ACTION_RUN);
con's avatar
con committed
785

786
    d->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
dt's avatar
dt committed
787
788
    cmd = am->registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
dt's avatar
dt committed
789
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
790

791
792
793
794
795
    // run without deployment action
    d->m_runWithoutDeployAction = new QAction(tr("Run Without Deployment"), this);
    cmd = am->registerAction(d->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY, globalcontext);
    mbuild->addAction(cmd, Constants::G_BUILD_RUN);

con's avatar
con committed
796
    // cancel build action
797
798
    d->m_cancelBuildAction = new QAction(tr("Cancel Build"), this);
    cmd = am->registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext);
con's avatar
con committed
799
800
801
    mbuild->addAction(cmd, Constants::G_BUILD_CANCEL);

    // add new file action
802
803
    d->m_addNewFileAction = new QAction(tr("Add New..."), this);
    cmd = am->registerAction(d->m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE,
dt's avatar
dt committed
804
805
806
807
                       projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
con's avatar
con committed
808
809

    // add existing file action
810
811
    d->m_addExistingFilesAction = new QAction(tr("Add Existing Files..."), this);
    cmd = am->registerAction(d->m_addExistingFilesAction, ProjectExplorer::Constants::ADDEXISTINGFILES,
dt's avatar
dt committed
812
813
814
815
                       projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
con's avatar
con committed
816

817
818
819
    // new subproject action
    d->m_addNewSubprojectAction = new QAction(tr("New Subproject..."), this);
    cmd = am->registerAction(d->m_addNewSubprojectAction, ProjectExplorer::Constants::ADDNEWSUBPROJECT,
dt's avatar
dt committed
820
821
822
                       projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
823
824

    // unload project again, in right position
825
    mprojectContextMenu->addAction(am->command(Constants::UNLOAD), Constants::G_PROJECT_LAST);
826

con's avatar
con committed
827
    // remove file action
828
829
    d->m_removeFileAction = new QAction(tr("Remove File..."), this);
    cmd = am->registerAction(d->m_removeFileAction, ProjectExplorer::Constants::REMOVEFILE,
dt's avatar
dt committed
830
                       projecTreeContext);
831
    cmd->setDefaultKeySequence(QKeySequence::Delete);
dt's avatar
dt committed
832
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
con's avatar
con committed
833

Friedemann Kleint's avatar
Friedemann Kleint committed
834
835
    //: Remove project from parent profile (Project explorer view); will not physically delete any files.
    d->m_removeProjectAction = new QAction(tr("Remove Project..."), this);
836
    cmd = am->registerAction(d->m_removeProjectAction, ProjectExplorer::Constants::REMOVEPROJECT,
dt's avatar
dt committed
837
838
                       projecTreeContext);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
839

dt's avatar
dt committed
840
    // delete file action
841
842
    d->m_deleteFileAction = new QAction(tr("Delete File..."), this);
    cmd = am->registerAction(d->m_deleteFileAction, ProjectExplorer::Constants::DELETEFILE,
dt's avatar
dt committed
843
                             projecTreeContext);
844
    cmd->setDefaultKeySequence(QKeySequence::Delete);
dt's avatar
dt committed
845
    mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);