📄 templateeditor.java
字号:
/*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.editors;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.TextOperationAction;
/**
* A simple xml editor with template capabilities.
*/
public class TemplateEditor extends AbstractDecoratedTextEditor {
private static final String TEMPLATE_PROPOSALS= "template_proposals_action"; //$NON-NLS-1$
private ColorManager colorManager;
/**
* Creates a new template editor.
*/
public TemplateEditor() {
super();
colorManager = new ColorManager();
setSourceViewerConfiguration(new XMLConfiguration(colorManager));
setDocumentProvider(new XMLDocumentProvider());
}
public void dispose() {
colorManager.dispose();
super.dispose();
}
protected void createActions() {
super.createActions();
IAction action= new TextOperationAction(
TemplateMessages.getResourceBundle(),
"Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
this,
ISourceViewer.CONTENTASSIST_PROPOSALS);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
setAction(TEMPLATE_PROPOSALS, action);
markAsStateDependentAction(TEMPLATE_PROPOSALS, true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -