projectexplorer.cpp 115 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2
3
4
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2012 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
#include "devicesupport/devicesettingspage.h"
83
84
#include "publishing/ipublishingwizardfactory.h"
#include "publishing/publishingwizardselectiondialog.h"
con's avatar
con committed
85

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

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

119
120
121
#include <QtPlugin>
#include <QDateTime>
#include <QDebug>
122
#include <QFileInfo>
123
#include <QSettings>
Morten Johan Sorvig's avatar
Morten Johan Sorvig committed
124
125

#if QT_VERSION < 0x050000
126
#include <QAbstractFileEngine>
Morten Johan Sorvig's avatar
Morten Johan Sorvig committed
127
#endif
hjk's avatar
hjk committed
128

129
130
131
132
133
134
135
#include <QAction>
#include <QApplication>
#include <QFileDialog>
#include <QMenu>
#include <QMessageBox>
#include <QMainWindow>
#include <QWizard>
con's avatar
con committed
136

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*!
    \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
155
156
157
158
namespace {
bool debug = false;
}

159
160
static const char kCurrentProjectPath[] = "CurrentProject:Path";
static const char kCurrentProjectFilePath[] = "CurrentProject:FilePath";
con's avatar
con committed
161

162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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;
179
    Utils::ParameterAction *m_unloadAction;
180
    QAction *m_closeAllProjects;
181
    QAction *m_buildProjectOnlyAction;
182
    Utils::ParameterAction *m_buildAction;
183
    Utils::ParameterAction *m_buildActionContextMenu;
184
185
    QAction *m_buildSessionAction;
    QAction *m_rebuildProjectOnlyAction;
186
    Utils::ParameterAction *m_rebuildAction;
187
    Utils::ParameterAction *m_rebuildActionContextMenu;
188
189
    QAction *m_rebuildSessionAction;
    QAction *m_cleanProjectOnlyAction;
Tobias Hunger's avatar
Tobias Hunger committed
190
191
192
193
    QAction *m_deployProjectOnlyAction;
    Utils::ParameterAction *m_deployAction;
    Utils::ParameterAction *m_deployActionContextMenu;
    QAction *m_deploySessionAction;
194
    Utils::ParameterAction *m_publishAction;
195
    Utils::ParameterAction *m_cleanAction;
196
    Utils::ParameterAction *m_cleanActionContextMenu;
197
198
199
    QAction *m_cleanSessionAction;
    QAction *m_runAction;
    QAction *m_runActionContextMenu;
200
    QAction *m_runWithoutDeployAction;
201
202
203
    QAction *m_cancelBuildAction;
    QAction *m_addNewFileAction;
    QAction *m_addExistingFilesAction;
204
    QAction *m_addNewSubprojectAction;
205
    QAction *m_removeFileAction;
206
    QAction *m_removeProjectAction;
207
    QAction *m_deleteFileAction;
208
    QAction *m_renameFileAction;
dt's avatar
dt committed
209
    QAction *m_openFileAction;
210
    QAction *m_projectTreeCollapseAllAction;
211
    QAction *m_searchOnFileSystem;
dt's avatar
dt committed
212
213
    QAction *m_showInGraphicalShell;
    QAction *m_openTerminalHere;
214
    QAction *m_setStartupProjectAction;
215
    QAction *m_projectSelectorAction;
216
    QAction *m_projectSelectorActionMenu;
Daniel Teske's avatar
Daniel Teske committed
217
    QAction *m_projectSelectorActionQuick;
dt's avatar
dt committed
218
    QAction *m_runSubProject;
219
220
221
222
223
224
225
226
227
228
229
230

    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;
231
    Internal::AppOutputPane *m_outputPane;
232
233
234
235
236

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

    QString m_lastOpenDirectory;
237
    RunConfiguration *m_delayedRunConfiguration; // TODO this is not right
238
    RunMode m_runMode;
239
    QString m_projectFilterString;
240
    Internal::MiniProjectTargetSelector * m_targetSelector;
241
    Internal::ProjectExplorerSettings m_projectExplorerSettings;
242
    Internal::ProjectWelcomePage *m_welcomePage;
243

244
    Core::IMode *m_projectsMode;
245

246
    TaskHub *m_taskHub;
247
248
249
250
251
252
};

ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
    m_currentProject(0),
    m_currentNode(0),
    m_delayedRunConfiguration(0),
253
    m_runMode(NoRunMode),
Tobias Hunger's avatar
Tobias Hunger committed
254
    m_projectsMode(0)
255
256
257
{
}

258
259
260
class ProjectsMode : public Core::IMode
{
public:
261
262
263
264
    ProjectsMode(QWidget *proWindow)
    {
        setWidget(proWindow);
        setContext(Core::Context(Constants::C_PROJECTEXPLORER));
265
266
267
268
269
270
        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"));
271
    }
272
273
};

274
275
}  // namespace ProjectExplorer

con's avatar
con committed
276
277
278
279
280
281
282
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;


ProjectExplorerPlugin *ProjectExplorerPlugin::m_instance = 0;

ProjectExplorerPlugin::ProjectExplorerPlugin()
283
    : d(new ProjectExplorerPluginPrivate)
con's avatar
con committed
284
285
286
287
288
289
{
    m_instance = this;
}

ProjectExplorerPlugin::~ProjectExplorerPlugin()
{
290
291
    removeObject(d->m_welcomePage);
    delete d->m_welcomePage;
con's avatar
con committed
292
    removeObject(this);
293
    delete d;
con's avatar
con committed
294
295
296
297
298
299
300
}

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

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

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

311
312
    if (!parseArguments(arguments, error))
        return false;
dt's avatar
dt committed
313
314
    addObject(this);

315
    // Add ToolChainFactories:
316
#ifdef Q_OS_WIN
317
318
    addAutoReleasedObject(new WinDebugInterface);

319
    addAutoReleasedObject(new Internal::MsvcToolChainFactory);
SteveKing's avatar
SteveKing committed
320
    addAutoReleasedObject(new Internal::WinCEToolChainFactory);
321
322
323
#else
    addAutoReleasedObject(new Internal::GccToolChainFactory);
    addAutoReleasedObject(new Internal::LinuxIccToolChainFactory);
Tobias Hunger's avatar
Tobias Hunger committed
324
325
326
#endif
#ifndef Q_OS_MAC
    addAutoReleasedObject(new Internal::MingwToolChainFactory); // Mingw offers cross-compiling to windows
327
#endif
Tobias Hunger's avatar
Tobias Hunger committed
328
    addAutoReleasedObject(new Internal::ClangToolChainFactory);
329

Tobias Hunger's avatar
Tobias Hunger committed
330
    new ToolChainManager(this);
331
332
    addAutoReleasedObject(new Internal::ToolChainOptionsPage);

333
334
    d->m_taskHub = new TaskHub;
    addAutoReleasedObject(d->m_taskHub);
335

hjk's avatar
hjk committed
336
337
    Core::ActionManager *am = Core::ICore::actionManager();
    connect(Core::ICore::instance(), SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards()));
con's avatar
con committed
338

339
    d->m_welcomePage = new ProjectWelcomePage;
340
    connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
341
    addObject(d->m_welcomePage);
con's avatar
con committed
342

343
    connect(Core::DocumentManager::instance(), SIGNAL(currentFileChanged(QString)),
hjk's avatar
hjk committed
344
            this, SLOT(setCurrentFile(QString)));
con's avatar
con committed
345

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

Robert Loehning's avatar
Robert Loehning committed
348
    connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
con's avatar
con committed
349
            this, SIGNAL(fileListChanged()));
Robert Loehning's avatar
Robert Loehning committed
350
351
352
    connect(d->m_session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
            this, SLOT(invalidateProject(ProjectExplorer::Project*)));
    connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
con's avatar
con committed
353
            this, SIGNAL(fileListChanged()));
354
355
356
357
    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*)));
Robert Loehning's avatar
Robert Loehning committed
358
    connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
con's avatar
con committed
359
            this, SLOT(startupProjectChanged()));
360
361
    connect(d->m_session, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
            this, SLOT(projectDisplayNameChanged(ProjectExplorer::Project*)));
362
363
    connect(d->m_session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
            this, SLOT(updateActions()));
364
    connect(d->m_session, SIGNAL(sessionLoaded(QString)),
365
            this, SLOT(updateActions()));
366
    connect(d->m_session, SIGNAL(sessionLoaded(QString)),
367
            this, SLOT(updateWelcomePage()));
con's avatar
con committed
368

369
    d->m_proWindow = new ProjectWindow;
con's avatar
con committed
370

371
    Core::Context globalcontext(Core::Constants::C_GLOBAL);
dt's avatar
dt committed
372
    Core::Context projecTreeContext(Constants::C_PROJECT_TREE);
con's avatar
con committed
373

374
    d->m_projectsMode = new ProjectsMode(d->m_proWindow);
375
    d->m_projectsMode->setEnabled(false);
376
    addAutoReleasedObject(d->m_projectsMode);
377
    d->m_proWindow->layout()->addWidget(new Core::FindToolBarPlaceHolder(d->m_proWindow));
con's avatar
con committed
378

379
    addAutoReleasedObject(new CopyTaskHandler);
380
    addAutoReleasedObject(new ShowInEditorTaskHandler);
381
    addAutoReleasedObject(new VcsAnnotateTaskHandler);
382
    addAutoReleasedObject(new CoreListener);
con's avatar
con committed
383

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

389
390
391
392
393
    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*)));

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

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

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

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

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

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

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

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

420
    // Settings pages
421
    addAutoReleasedObject(new ProjectExplorerSettingsPage);
422
    addAutoReleasedObject(new DeviceSettingsPage);
423

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

hjk's avatar
hjk committed
494
    Core::ActionContainer *runMenu = Core::ICore::actionManager()->createMenu(Constants::RUNMENUCONTEXTMENU);
dt's avatar
dt committed
495
    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

Robert Loehning's avatar
Robert Loehning committed
518
    connect(d->m_openWithMenu, SIGNAL(triggered(QAction*)),
519
            Core::DocumentManager::instance(), SLOT(slotExecuteOpenWithMenuAction(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_OS_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
    // session menu
622
    Core::ActionContainer *msession = am->createMenu(Constants::M_SESSION);
623
    msession->menu()->setTitle(tr("Sessions"));
624
625
626
627
628
629
630
631
632
633
634
635
636
    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_closeAllProjects = new QAction(tr("Close All Projects"), this);
    cmd = am->registerAction(d->m_closeAllProjects, 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::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::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
799
    QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP));
    stopIcon.addFile(QLatin1String(Constants::ICON_STOP_SMALL));
    d->m_cancelBuildAction = new QAction(stopIcon, tr("Cancel Build"), this);
800
    cmd = am->registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext);
con's avatar
con committed
801
802
803
    mbuild->addAction(cmd, Constants::G_BUILD_CANCEL);

    // add new file action
804
805
    d->m_addNewFileAction = new QAction(tr("Add New..."), this);
    cmd = am->registerAction(d->m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE,
dt's avatar
dt committed
806
807
808
809
                       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
810
811

    // add existing file action
812
813
    d->m_addExistingFilesAction = new QAction(tr("Add Existing Files..."), this);
    cmd = am->registerAction(d->m_addExistingFilesAction, ProjectExplorer::Constants::ADDEXISTINGFILES,
dt's avatar
dt committed
814
815
816
817
                       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
818

819
820
821
    // 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
822
823
824
                       projecTreeContext);
    mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
    msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
825
826

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

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