Commit 7224ccb2 authored by Eike Ziller's avatar Eike Ziller Committed by hjk

Editors: Automatically add editor/document id to context and use that

instead of manually adding a context everywhere.

Change-Id: I4336015a6d19349171a255e949da89b0013d6700
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent cae737e6
......@@ -68,7 +68,6 @@ const char ANDROID_MANIFEST_EDITOR_CONTEXT[] = "Android.AndroidManifestEditor.Id
const char ANDROID_BUILDDIRECTORY[] = "android-build";
const char JAVA_EDITOR_ID[] = "java.editor";
const char C_JAVA_EDITOR[] = "Java Editor";
const char JAVA_MIMETYPE[] = "text/x-java";
const char WIZARD_JAVA[] = "Wizard.Java";
const char JAVA_WIZARD_CATEGORY[] = "U.Java";
......
......@@ -57,7 +57,6 @@ class JavaEditor : public TextEditor::BaseTextEditor
public:
JavaEditor()
{
addContext(Constants::C_JAVA_EDITOR);
setDuplicateSupported(true);
setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<JavaCompletionAssistProvider>());
}
......@@ -113,8 +112,7 @@ JavaEditorFactory::JavaEditorFactory()
setGenericSyntaxHighlighter(QLatin1String(Constants::JAVA_MIMETYPE));
setCommentStyle(Utils::CommentDefinition::CppStyle);
setEditorActionHandlers(Constants::C_JAVA_EDITOR,
TextEditor::TextEditorActionHandler::UnCommentSelection);
setEditorActionHandlers(TextEditor::TextEditorActionHandler::UnCommentSelection);
}
} // namespace Internal
......
......@@ -170,11 +170,11 @@ Core::Id BazaarClient::vcsEditorKind(VcsCommandTag cmd) const
{
switch (cmd) {
case AnnotateCommand:
return Constants::ANNOTATELOG;
return Constants::ANNOTATELOG_ID;
case DiffCommand:
return Constants::DIFFLOG;
return Constants::DIFFLOG_ID;
case LogCommand:
return Constants::FILELOG;
return Constants::FILELOG_ID;
default:
return Core::Id();
}
......
......@@ -115,19 +115,16 @@ const VcsBaseEditorParameters editorParameters[] = {
{ LogOutput, // type
Constants::FILELOG_ID, // id
Constants::FILELOG_DISPLAY_NAME, // display name
Constants::FILELOG, // context
Constants::LOGAPP}, // mime type
{ AnnotateOutput,
Constants::ANNOTATELOG_ID,
Constants::ANNOTATELOG_DISPLAY_NAME,
Constants::ANNOTATELOG,
Constants::ANNOTATEAPP},
{ DiffOutput,
Constants::DIFFLOG_ID,
Constants::DIFFLOG_DISPLAY_NAME,
Constants::DIFFLOG,
Constants::DIFFAPP}
};
......@@ -135,7 +132,6 @@ const VcsBaseSubmitEditorParameters submitEditorParameters = {
COMMITMIMETYPE,
COMMIT_ID,
COMMIT_DISPLAY_NAME,
COMMIT_ID,
VcsBaseSubmitEditorParameters::DiffFiles
};
......
......@@ -48,17 +48,14 @@ const char ANNOTATE_CHANGESET_ID[] = "([.0-9]+)";
// Base editor parameters
const char FILELOG_ID[] = "Bazaar File Log Editor";
const char FILELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar File Log Editor");
const char FILELOG[] = "Bazaar File Log Editor";
const char LOGAPP[] = "text/vnd.qtcreator.bazaar.log";
const char ANNOTATELOG_ID[] = "Bazaar Annotation Editor";
const char ANNOTATELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar Annotation Editor");
const char ANNOTATELOG[] = "Bazaar Annotation Editor";
const char ANNOTATEAPP[] = "text/vnd.qtcreator.bazaar.annotation";
const char DIFFLOG_ID[] = "Bazaar Diff Editor";
const char DIFFLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar Diff Editor");
const char DIFFLOG[] = "Bazaar Diff Editor";
const char DIFFAPP[] = "text/x-patch";
} // namespace Constants
......
......@@ -38,7 +38,6 @@ namespace Constants {
const char VCS_ID_CLEARCASE[] = "E.ClearCase";
const char CLEARCASE_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.clearcase.submit";
const char CLEARCASECHECKINEDITOR[] = "ClearCase Check In Editor";
const char CLEARCASECHECKINEDITOR_ID[] = "ClearCase Check In Editor";
const char CLEARCASECHECKINEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "ClearCase Check In Editor");
const char CHECKIN_SELECTED[] = "ClearCase.CheckInSelected";
......
......@@ -131,17 +131,14 @@ static const VcsBaseEditorParameters editorParameters[] = {
VcsBase::LogOutput,
"ClearCase File Log Editor", // id
QT_TRANSLATE_NOOP("VCS", "ClearCase File Log Editor"), // display_name
"ClearCase File Log Editor", // context
"text/vnd.qtcreator.clearcase.log"},
{ VcsBase::AnnotateOutput,
"ClearCase Annotation Editor", // id
QT_TRANSLATE_NOOP("VCS", "ClearCase Annotation Editor"), // display_name
"ClearCase Annotation Editor", // context
"text/vnd.qtcreator.clearcase.annotation"},
{ VcsBase::DiffOutput,
"ClearCase Diff Editor", // id
QT_TRANSLATE_NOOP("VCS", "ClearCase Diff Editor"), // display_name
"ClearCase Diff Editor", // context
"text/x-patch"}
};
......@@ -431,7 +428,6 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
Constants::CLEARCASE_SUBMIT_MIMETYPE,
Constants::CLEARCASECHECKINEDITOR_ID,
Constants::CLEARCASECHECKINEDITOR_DISPLAY_NAME,
Constants::CLEARCASECHECKINEDITOR,
VcsBaseSubmitEditorParameters::DiffFiles
};
......@@ -601,7 +597,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
m_commandLocator->appendCommand(command);
// Actions of the submit editor
Context clearcasecheckincontext(Constants::CLEARCASECHECKINEDITOR);
Context clearcasecheckincontext(Constants::CLEARCASECHECKINEDITOR_ID);
m_checkInSelectedAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Check In"), this);
command = ActionManager::registerAction(m_checkInSelectedAction, Constants::CHECKIN_SELECTED, clearcasecheckincontext);
......
......@@ -65,7 +65,6 @@ namespace Internal {
CMakeEditor::CMakeEditor()
{
addContext(Constants::C_CMAKEEDITOR);
setDuplicateSupported(true);
setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<CMakeFileCompletionAssistProvider>());
}
......@@ -289,13 +288,12 @@ CMakeEditorFactory::CMakeEditorFactory()
setGenericSyntaxHighlighter(QLatin1String(Constants::CMAKEMIMETYPE));
setCommentStyle(Utils::CommentDefinition::HashStyle);
setEditorActionHandlers(Constants::C_CMAKEEDITOR,
TextEditorActionHandler::UnCommentSelection
setEditorActionHandlers(TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::JumpToFileUnderCursor);
ActionContainer *contextMenu = ActionManager::createMenu(Constants::M_CONTEXT);
contextMenu->addAction(ActionManager::command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR));
contextMenu->addSeparator(Context(Constants::C_CMAKEEDITOR));
contextMenu->addSeparator(Context(Constants::CMAKE_EDITOR_ID));
contextMenu->addAction(ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION));
}
......
......@@ -38,7 +38,6 @@ const char CMAKEMIMETYPE[] = "text/x-cmake";
const char CMAKEPROJECTMIMETYPE[] = "text/x-cmake-project";
const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor";
const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor";
const char C_CMAKEEDITOR[] = "CMakeProject.Context.CMakeEditor";
const char RUNCMAKE[] = "CMakeProject.RunCMake";
const char RUNCMAKECONTEXTMENU[] = "CMakeProject.RunCMakeContextMenu";
......
......@@ -92,7 +92,6 @@ namespace Internal {
CppEditor::CppEditor()
{
m_context.add(Constants::C_CPPEDITOR);
m_context.add(ProjectExplorer::Constants::LANG_CXX);
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
setDuplicateSupported(true);
......
......@@ -34,7 +34,6 @@ namespace CppEditor {
namespace Constants {
const char M_CONTEXT[] = "CppEditor.ContextMenu";
const char C_CPPEDITOR[] = "CppEditor.C++Editor";
const char CPPEDITOR_ID[] = "CppEditor.C++Editor";
const char CPPEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "C++ Editor");
const char SWITCH_DECLARATION_DEFINITION[] = "CppEditor.SwitchDeclarationDefinition";
......
......@@ -93,8 +93,7 @@ public:
setAutoCompleterCreator([]() { return new CppAutoCompleter; });
setCommentStyle(Utils::CommentDefinition::CppStyle);
setEditorActionHandlers(Constants::C_CPPEDITOR,
TextEditorActionHandler::Format
setEditorActionHandlers(TextEditorActionHandler::Format
| TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::UnCollapseAll
| TextEditorActionHandler::FollowSymbolUnderCursor);
......@@ -204,7 +203,7 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
wizard->setId(QLatin1String("C.Header"));
addAutoReleasedObject(wizard);
Context context(Constants::C_CPPEDITOR);
Context context(Constants::CPPEDITOR_ID);
ActionContainer *contextMenu = ActionManager::createMenu(Constants::M_CONTEXT);
......
......@@ -168,7 +168,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
mtools->addMenu(mcpptools);
// Actions
Context context(CppEditor::Constants::C_CPPEDITOR);
Context context(CppEditor::Constants::CPPEDITOR_ID);
QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
Command *command = ActionManager::registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context, true);
......
......@@ -118,7 +118,6 @@ const char CMD_ID_REPOSITORYSTATUS[] = "CVS.RepositoryStatus";
const char CMD_ID_REPOSITORYUPDATE[] = "CVS.RepositoryUpdate";
const char CVS_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.cvs.submit";
const char CVSCOMMITEDITOR[] = "CVS Commit Editor";
const char CVSCOMMITEDITOR_ID[] = "CVS Commit Editor";
const char CVSCOMMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "CVS Commit Editor");
const char SUBMIT_CURRENT[] = "CVS.SubmitCurrentLog";
......@@ -129,22 +128,18 @@ const VcsBaseEditorParameters editorParameters[] = {
OtherContent,
"CVS Command Log Editor", // id
QT_TRANSLATE_NOOP("VCS", "CVS Command Log Editor"), // display name
"CVS Command Log Editor", // context
"text/vnd.qtcreator.cvs.commandlog"},
{ LogOutput,
"CVS File Log Editor", // id
QT_TRANSLATE_NOOP("VCS", "CVS File Log Editor"), // display name
"CVS File Log Editor", // context
"text/vnd.qtcreator.cvs.log"},
{ AnnotateOutput,
"CVS Annotation Editor", // id
QT_TRANSLATE_NOOP("VCS", "CVS Annotation Editor"), // display name
"CVS Annotation Editor", // context
"text/vnd.qtcreator.cvs.annotation"},
{ DiffOutput,
"CVS Diff Editor", // id
QT_TRANSLATE_NOOP("VCS", "CVS Diff Editor"), // display name
"CVS Diff Editor", // context
"text/x-patch"}
};
......@@ -223,7 +218,6 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
CVS_SUBMIT_MIMETYPE,
CVSCOMMITEDITOR_ID,
CVSCOMMITEDITOR_DISPLAY_NAME,
CVSCOMMITEDITOR,
VcsBaseSubmitEditorParameters::DiffFiles
};
......@@ -445,7 +439,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_commandLocator->appendCommand(command);
// Actions of the submit editor
Context cvscommitcontext(CVSCOMMITEDITOR);
Context cvscommitcontext(CVSCOMMITEDITOR_ID);
m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, cvscommitcontext);
......
......@@ -2726,7 +2726,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
const Context globalcontext(CC::C_GLOBAL);
const Context cppDebuggercontext(C_CPPDEBUGGER);
const Context cppeditorcontext(CppEditor::Constants::C_CPPEDITOR);
const Context cppeditorcontext(CppEditor::Constants::CPPEDITOR_ID);
m_startIcon = QIcon(_(":/debugger/images/debugger_start_small.png"));
m_startIcon.addFile(QLatin1String(":/debugger/images/debugger_start.png"));
......
......@@ -37,7 +37,6 @@ const char PROJECTCONTEXT[] = "GenericProject.ProjectContext";
const char GENERICMIMETYPE[] = "text/x-generic-project"; // ### FIXME
// Contexts
const char C_FILESEDITOR[] = ".files Editor";
const char FILES_EDITOR_ID[] = "QT4.FilesEditor";
const char FILES_MIMETYPE[] = "application/vnd.qtcreator.generic.files";
......
......@@ -50,7 +50,6 @@ class ProjectFilesEditor : public BaseTextEditor
public:
ProjectFilesEditor()
{
addContext(Constants::C_FILESEDITOR);
setDuplicateSupported(true);
}
};
......@@ -69,7 +68,7 @@ ProjectFilesFactory::ProjectFilesFactory()
setEditorCreator([]() { return new ProjectFilesEditor; });
setDocumentCreator([]() { return new BaseTextDocument(Constants::FILES_EDITOR_ID); });
setEditorActionHandlers(Constants::C_FILESEDITOR, TextEditorActionHandler::None);
setEditorActionHandlers(TextEditorActionHandler::None);
}
} // namespace Internal
......
......@@ -3256,7 +3256,7 @@ void GitClient::subversionLog(const QString &workingDirectory)
// Create a command editor, no highlighting or interaction.
const QString title = tr("Git SVN Log");
const Id editorId = Git::Constants::C_GIT_COMMAND_LOG_EDITOR;
const Id editorId = Git::Constants::GIT_COMMAND_LOG_EDITOR_ID;
const QString sourceFile = VcsBaseEditor::getSource(workingDirectory, QStringList());
VcsBaseEditorWidget *editor = findExistingVCSEditor("svnLog", sourceFile);
if (!editor)
......
......@@ -37,21 +37,15 @@ namespace Constants {
const char GIT_COMMAND_LOG_EDITOR_ID[] = "Git Command Log Editor";
const char GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Command Log Editor");
const char C_GIT_COMMAND_LOG_EDITOR[] = "Git Command Log Editor";
const char GIT_LOG_EDITOR_ID[] = "Git File Log Editor";
const char GIT_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git File Log Editor");
const char C_GIT_LOG_EDITOR[] = "Git File Log Editor";
const char GIT_BLAME_EDITOR_ID[] = "Git Annotation Editor";
const char GIT_BLAME_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Annotation Editor");
const char C_GIT_BLAME_EDITOR[] = "Git Annotation Editor";
const char GIT_COMMIT_TEXT_EDITOR_ID[] = "Git Commit Editor";
const char GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Commit Editor");
const char C_GIT_COMMIT_TEXT_EDITOR[] = "Git Commit Editor";
const char GIT_REBASE_EDITOR_ID[] = "Git Rebase Editor";
const char GIT_REBASE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Rebase Editor");
const char C_GIT_REBASE_EDITOR[] = "Git Rebase Editor";
const char C_GITSUBMITEDITOR[] = "Git Submit Editor";
const char GITSUBMITEDITOR_ID[] = "Git Submit Editor";
const char GITSUBMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Submit Editor");
const char SUBMIT_CURRENT[] = "Git.SubmitCurrentLog";
......
......@@ -106,27 +106,22 @@ const VcsBaseEditorParameters editorParameters[] = {
VcsBase::OtherContent,
Git::Constants::GIT_COMMAND_LOG_EDITOR_ID,
Git::Constants::GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_COMMAND_LOG_EDITOR,
"text/vnd.qtcreator.git.commandlog"},
{ VcsBase::LogOutput,
Git::Constants::GIT_LOG_EDITOR_ID,
Git::Constants::GIT_LOG_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_LOG_EDITOR,
"text/vnd.qtcreator.git.log"},
{ VcsBase::AnnotateOutput,
Git::Constants::GIT_BLAME_EDITOR_ID,
Git::Constants::GIT_BLAME_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_BLAME_EDITOR,
"text/vnd.qtcreator.git.annotation"},
{ VcsBase::OtherContent,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_COMMIT_TEXT_EDITOR,
"text/vnd.qtcreator.git.commit"},
{ VcsBase::OtherContent,
Git::Constants::GIT_REBASE_EDITOR_ID,
Git::Constants::GIT_REBASE_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_REBASE_EDITOR,
"text/vnd.qtcreator.git.rebase"},
};
......@@ -181,7 +176,6 @@ const VcsBaseSubmitEditorParameters submitParameters = {
Git::Constants::SUBMIT_MIMETYPE,
Git::Constants::GITSUBMITEDITOR_ID,
Git::Constants::GITSUBMITEDITOR_DISPLAY_NAME,
Git::Constants::C_GITSUBMITEDITOR,
VcsBaseSubmitEditorParameters::DiffRows
};
......@@ -644,7 +638,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
gitContainer->addAction(createRepositoryCommand);
// Submit editor
Context submitContext(Constants::C_GITSUBMITEDITOR);
Context submitContext(Constants::GITSUBMITEDITOR_ID);
m_submitCurrentAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
Core::Command *command = ActionManager::registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext);
command->setAttribute(Core::Command::CA_UpdateText);
......
......@@ -334,7 +334,6 @@ class GlslEditor : public TextEditor::BaseTextEditor
public:
GlslEditor()
{
addContext(Constants::C_GLSLEDITOR_ID);
setDuplicateSupported(true);
setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<GlslCompletionAssistProvider>());
}
......@@ -369,8 +368,7 @@ GlslEditorFactory::GlslEditorFactory()
setSyntaxHighlighterCreator([]() { return new GlslHighlighter; });
setCommentStyle(Utils::CommentDefinition::CppStyle);
setEditorActionHandlers(Constants::C_GLSLEDITOR_ID,
TextEditorActionHandler::Format
setEditorActionHandlers(TextEditorActionHandler::Format
| TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::UnCollapseAll);
......
......@@ -48,17 +48,14 @@ const char DIFFIDENTIFIER[] = "^(?:diff --git a/|[+-]{3} (?:/dev/null|[ab]/(.+$)
// Base editor parameters
const char FILELOG_ID[] = "Mercurial File Log Editor";
const char FILELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial File Log Editor");
const char FILELOG[] = "Mercurial File Log Editor";
const char LOGAPP[] = "text/vnd.qtcreator.mercurial.log";
const char ANNOTATELOG_ID[] = "Mercurial Annotation Editor";
const char ANNOTATELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Annotation Editor");
const char ANNOTATELOG[] = "Mercurial Annotation Editor";
const char ANNOTATEAPP[] = "text/vnd.qtcreator.mercurial.annotation";
const char DIFFLOG_ID[] = "Mercurial Diff Editor";
const char DIFFLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Diff Editor");
const char DIFFLOG[] = "Mercurial Diff Editor";
const char DIFFAPP[] = "text/x-patch";
// Submit editor parameters
......
......@@ -286,7 +286,7 @@ void MercurialClient::incoming(const QString &repositoryRoot, const QString &rep
const QString title = tr("Hg incoming %1").arg(id);
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG, title, repositoryRoot,
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot,
true, "incoming", id);
VcsCommand *cmd = createCommand(repository, editor);
enqueueJob(cmd, args);
......@@ -300,7 +300,7 @@ void MercurialClient::outgoing(const QString &repositoryRoot)
const QString title = tr("Hg outgoing %1").
arg(QDir::toNativeSeparators(repositoryRoot));
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG, title, repositoryRoot, true,
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot, true,
"outgoing", repositoryRoot);
VcsCommand *cmd = createCommand(repositoryRoot, editor);
......@@ -367,11 +367,11 @@ Core::Id MercurialClient::vcsEditorKind(VcsCommandTag cmd) const
{
switch (cmd) {
case AnnotateCommand:
return Constants::ANNOTATELOG;
return Constants::ANNOTATELOG_ID;
case DiffCommand:
return Constants::DIFFLOG;
return Constants::DIFFLOG_ID;
case LogCommand:
return Constants::FILELOG;
return Constants::FILELOG_ID;
default:
return Core::Id();
}
......
......@@ -84,19 +84,16 @@ static const VcsBaseEditorParameters editorParameters[] = {
LogOutput,
Constants::FILELOG_ID,
Constants::FILELOG_DISPLAY_NAME,
Constants::FILELOG,
Constants::LOGAPP},
{ AnnotateOutput,
Constants::ANNOTATELOG_ID,
Constants::ANNOTATELOG_DISPLAY_NAME,
Constants::ANNOTATELOG,
Constants::ANNOTATEAPP},
{ DiffOutput,
Constants::DIFFLOG_ID,
Constants::DIFFLOG_DISPLAY_NAME,
Constants::DIFFLOG,
Constants::DIFFAPP}
};
......@@ -104,7 +101,6 @@ static const VcsBaseSubmitEditorParameters submitEditorParameters = {
Constants::COMMITMIMETYPE,
Constants::COMMIT_ID,
Constants::COMMIT_DISPLAY_NAME,
Constants::COMMIT_ID,
VcsBaseSubmitEditorParameters::DiffFiles
};
......
......@@ -84,36 +84,29 @@ const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.p4.submit";
const char PERFORCE_SUBMIT_EDITOR_ID[] = "Perforce.SubmitEditor";
const char PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce.SubmitEditor");
const char PERFORCESUBMITEDITOR_CONTEXT[] = "Perforce Submit Editor";
const char PERFORCE_LOG_EDITOR_ID[] = "Perforce.LogEditor";
const char PERFORCE_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Log Editor");
const char PERFORCE_LOG_EDITOR_CONTEXT[] = "Perforce Log Editor";
const char PERFORCE_DIFF_EDITOR_ID[] = "Perforce.DiffEditor";
const char PERFORCE_DIFF_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Diff Editor");
const char PERFORCE_DIFF_EDITOR_CONTEXT[] = "Perforce Diff Editor";
const char PERFORCE_ANNOTATION_EDITOR_ID[] = "Perforce.AnnotationEditor";
const char PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Annotation Editor");
const char PERFORCE_ANNOTATION_EDITOR_CONTEXT[] = "Perforce Annotation Editor";
const VcsBaseEditorParameters editorParameters[] = {
{
VcsBase::LogOutput,
PERFORCE_LOG_EDITOR_ID,
PERFORCE_LOG_EDITOR_DISPLAY_NAME,
PERFORCE_LOG_EDITOR_CONTEXT,
"text/vnd.qtcreator.p4.log"},
{ VcsBase::AnnotateOutput,
PERFORCE_ANNOTATION_EDITOR_ID,
PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME,
PERFORCE_ANNOTATION_EDITOR_CONTEXT,
"text/vnd.qtcreator.p4.annotation"},
{ VcsBase::DiffOutput,
PERFORCE_DIFF_EDITOR_ID,
PERFORCE_DIFF_EDITOR_DISPLAY_NAME,
PERFORCE_DIFF_EDITOR_CONTEXT,
"text/x-patch"}
};
......@@ -221,7 +214,6 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
SUBMIT_MIMETYPE,
PERFORCE_SUBMIT_EDITOR_ID,
PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME,
PERFORCESUBMITEDITOR_CONTEXT,
VcsBaseSubmitEditorParameters::DiffFiles
};
......@@ -259,7 +251,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
m_menuAction = mperforce->menu()->menuAction();
Context globalcontext(Core::Constants::C_GLOBAL);
Context perforcesubmitcontext(PERFORCESUBMITEDITOR_CONTEXT);
Context perforcesubmitcontext(PERFORCE_SUBMIT_EDITOR_ID);
Core::Command *command;
......
......@@ -62,7 +62,6 @@ class PythonEditor : public BaseTextEditor
public:
PythonEditor()
{
addContext(Constants::C_PYTHONEDITOR_ID);
setDuplicateSupported(true);
}
......
......@@ -60,7 +60,6 @@ class ProFileEditor : public TextEditor::BaseTextEditor
public:
ProFileEditor()
{
addContext(Constants::C_PROFILEEDITOR);
setDuplicateSupported(true);
setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<ProFileCompletionAssistProvider>());
}
......@@ -229,8 +228,7 @@ ProFileEditorFactory::ProFileEditorFactory()
setEditorCreator([]() { return new ProFileEditor; });
setCommentStyle(Utils::CommentDefinition::HashStyle);
setEditorActionHandlers(Constants::C_PROFILEEDITOR,
TextEditorActionHandler::UnCommentSelection
setEditorActionHandlers(TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::JumpToFileUnderCursor);
Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pro");
......
......@@ -59,7 +59,7 @@ ProFileHoverHandler::~ProFileHoverHandler()
bool ProFileHoverHandler::acceptEditor(IEditor *editor)
{
return editor->context().contains(Constants::C_PROFILEEDITOR);
return editor->context().contains(Constants::PROFILE_EDITOR_ID);
}
void ProFileHoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos)
......
......@@ -35,9 +35,6 @@
namespace QmakeProjectManager {
namespace Constants {
// Contexts
const char C_PROFILEEDITOR[] = ".pro File Editor";
// Menus
const char M_CONTEXT[] = "ProFileEditor.ContextMenu";
......
......@@ -254,7 +254,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(QmakeProjectManager::Constants::M_CONTEXT);
Core::Context proFileEditorContext = Core::Context(QmakeProjectManager::Constants::C_PROFILEEDITOR);
Core::Context proFileEditorContext = Core::Context(QmakeProjectManager::Constants::PROFILE_EDITOR_ID);
command = Core::ActionManager::command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR);
contextMenu->addAction(command);
......
......@@ -877,7 +877,6 @@ QString QmlJSEditorWidget::foldReplacementText(const QTextBlock &block) const
QmlJSEditor::QmlJSEditor()
{
addContext(Constants::C_QMLJSEDITOR_ID);
addContext(ProjectExplorer::Constants::LANG_QMLJS);
setDuplicateSupported(true);
setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<Internal::QmlJSCompletionAssistProvider>());
......@@ -913,8 +912,7 @@ QmlJSEditorFactory::QmlJSEditorFactory()
setAutoCompleterCreator([]() { return new AutoCompleter; });
setCommentStyle(Utils::CommentDefinition::CppStyle);
setEditorActionHandlers(Constants::C_QMLJSEDITOR_ID,
TextEditorActionHandler::Format
setEditorActionHandlers(TextEditorActionHandler::Format
| TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::UnCollapseAll
| TextEditorActionHandler::FollowSymbolUnderCursor);
......
......@@ -113,7 +113,6 @@ const char CMD_ID_COMMIT_PROJECT[] = "Subversion.CommitProject";
const char CMD_ID_DESCRIBE[] = "Subversion.Describe";
const char SUBVERSION_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.svn.submit";
const char SUBVERSIONCOMMITEDITOR[] = "Subversion Commit Editor";
const char SUBVERSIONCOMMITEDITOR_ID[] = "Subversion Commit Editor";
const char SUBVERSIONCOMMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Subversion Commit Editor");
const char SUBMIT_CURRENT[] = "Subversion.SubmitCurrentLog";
......@@ -124,17 +123,14 @@ const VcsBaseEditorParameters editorParameters[] = {
LogOutput,
"Subversion File Log Editor", // id
QT_TRANSLATE_NOOP("VCS", "Subversion File Log Editor"), // display_name
"Subversion File Log Editor", // context
"text/vnd.qtcreator.svn.log"},
{ AnnotateOutput,
"Subversion Annotation Editor", // id
QT_TRANSLATE_NOOP("VCS", "Subversion Annotation Editor"), // display_name
"Subversion Annotation Editor", // context
"text/vnd.qtcreator.svn.annotation"},
{ DiffOutput,
"Subversion Diff Editor", // id
QT_TRANSLATE_NOOP("VCS", "Subversion Diff Editor"), // display_name
"Subversion Diff Editor", // context
"text/x-patch"}
};
......@@ -241,7 +237,6 @@ const VcsBaseSubmitEditorParameters submitParameters = {
SUBVERSION_SUBMIT_MIMETYPE,
SUBVERSIONCOMMITEDITOR_ID,
SUBVERSIONCOMMITEDITOR_DISPLAY_NAME,
SUBVERSIONCOMMITEDITOR,
VcsBaseSubmitEditorParameters::DiffFiles
};
......@@ -443,7 +438,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commandLocator->appendCommand(command);
// Actions of the submit editor
Context svncommitcontext(SUBVERSIONCOMMITEDITOR);
Context svncommitcontext(SUBVERSIONCOMMITEDITOR_ID);
m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, svncommitcontext);
......
......@@ -7270,6 +7270,7 @@ BaseTextEditor *BaseTextEditorFactory::createEditorHelper(const BaseTextDocument
{
BaseTextEditorWidget *widget = m_widgetCreator();
BaseTextEditor *editor = m_editorCreator();
editor->addContext(id());
editor->d->m_origin = this;
editor->m_widget = widget;
......
......@@ -65,8 +65,7 @@ PlainTextEditorFactory::PlainTextEditorFactory()
setEditorWidgetCreator([]() { return new PlainTextEditorWidget; });
setIndenterCreator([]() { return new NormalIndenter; });
setEditorActionHandlers(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
TextEditorActionHandler::Format |
setEditorActionHandlers(TextEditorActionHandler::Format |
TextEditorActionHandler::UnCommentSelection |
TextEditorActionHandler::UnCollapseAll);