2014-01-15 16:58:52 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2014-01-15 16:58:52 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2014-01-15 16:58:52 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2014-01-15 16:58:52 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "javaeditor.h"
|
|
|
|
|
#include "javaindenter.h"
|
|
|
|
|
#include "androidconstants.h"
|
|
|
|
|
#include "javacompletionassistprovider.h"
|
|
|
|
|
|
2014-08-22 12:49:02 +02:00
|
|
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
2015-02-26 13:38:54 +01:00
|
|
|
#include <texteditor/normalindenter.h>
|
|
|
|
|
#include <texteditor/textdocument.h>
|
2014-08-20 01:09:56 +02:00
|
|
|
#include <texteditor/texteditoractionhandler.h>
|
2014-01-15 16:58:52 +01:00
|
|
|
#include <texteditor/texteditorconstants.h>
|
2015-02-26 13:38:54 +01:00
|
|
|
#include <texteditor/texteditor.h>
|
|
|
|
|
|
2014-01-15 16:58:52 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2015-02-26 13:38:54 +01:00
|
|
|
#include <utils/fileutils.h>
|
|
|
|
|
#include <utils/uncommentselection.h>
|
2014-01-15 16:58:52 +01:00
|
|
|
|
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
|
2014-08-20 01:09:56 +02:00
|
|
|
namespace Android {
|
|
|
|
|
namespace Internal {
|
2014-01-15 16:58:52 +01:00
|
|
|
|
2016-05-30 15:23:52 +02:00
|
|
|
static TextEditor::TextDocument *createJavaDocument()
|
2014-08-22 12:49:02 +02:00
|
|
|
{
|
2016-05-30 15:23:52 +02:00
|
|
|
auto doc = new TextEditor::TextDocument;
|
|
|
|
|
doc->setId(Constants::JAVA_EDITOR_ID);
|
|
|
|
|
doc->setMimeType(QLatin1String(Constants::JAVA_MIMETYPE));
|
|
|
|
|
doc->setIndenter(new JavaIndenter);
|
|
|
|
|
return doc;
|
2014-01-15 16:58:52 +01:00
|
|
|
}
|
|
|
|
|
|
2014-08-20 01:09:56 +02:00
|
|
|
//
|
|
|
|
|
// JavaEditorFactory
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
JavaEditorFactory::JavaEditorFactory()
|
|
|
|
|
{
|
2014-08-22 12:49:02 +02:00
|
|
|
setId(Constants::JAVA_EDITOR_ID);
|
2014-08-20 01:09:56 +02:00
|
|
|
setDisplayName(tr("Java Editor"));
|
2014-08-22 12:49:02 +02:00
|
|
|
addMimeType(Constants::JAVA_MIMETYPE);
|
2014-08-20 01:09:56 +02:00
|
|
|
|
2016-05-30 15:23:52 +02:00
|
|
|
setDocumentCreator(createJavaDocument);
|
2015-02-03 09:18:57 +01:00
|
|
|
setUseGenericHighlighter(true);
|
2017-04-24 16:01:14 +02:00
|
|
|
setCommentDefinition(Utils::CommentDefinition::CppStyle);
|
2014-09-02 12:25:20 +02:00
|
|
|
setEditorActionHandlers(TextEditor::TextEditorActionHandler::UnCommentSelection);
|
2014-10-01 22:39:47 +02:00
|
|
|
setCompletionAssistProvider(new JavaCompletionAssistProvider);
|
2014-10-15 00:36:39 +02:00
|
|
|
setMarksVisible(true);
|
2014-08-20 01:09:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Android
|