xmlconfiguration.java
来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 146 行
JAVA
146 行
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/bind/editors/XMLConfiguration.java,v 1.1.1.1 2004/07/01 09:07:41 wang_j Exp $
* $Revision: 1.1.1.1 $
* $Date: 2004/07/01 09:07:41 $
*
* ====================================================================
*
* The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
*
* Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
* IT Forest Corporation
* All rights reserved.
*
* This software is the confidential and proprietary information of
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
* You shall not disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into with
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
*/
package com.webpump.ui.bind.editors;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextDoubleClickStrategy;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.presentation.IPresentationReconciler;
import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
/**
* Class for the configuration of the XMLEditor which used as the
* member editor in the BindEditor's page0
*
* @author zhang_tx
* @version 2.0.0 2004-2-13
*/
public class XMLConfiguration extends SourceViewerConfiguration {
/** doubleclickstrategy of the XMLEditor */
private XMLDoubleClickStrategy doubleClickStrategy;
/** tagscanner of the XMLEditor */
private XMLTagScanner tagScanner;
/** xmlscanner of the XMLEditor */
private XMLScanner scanner;
/** colormanager of the XMLEditor */
private ColorManager colorManager;
/** the contributor of the XMLEditor,which set the color of the editor
* @param colorManager the colormanager to be set for the XMLEditor
*/
public XMLConfiguration(ColorManager colorManager) {
this.colorManager = colorManager;
}
/** get the color type configured for the XMLEditor
*
* @param sourceViewer the view of the editor
*/
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
return new String[] {
IDocument.DEFAULT_CONTENT_TYPE,
XMLPartitionScanner.XML_ERRORS,
XMLPartitionScanner.XML_COMMENT,
XMLPartitionScanner.XML_COMPONENTS,
XMLPartitionScanner.JSP_CONTENTS,
XMLPartitionScanner.XML_TAG };
}
/** get the doubleclickstrategy for the XMLEditor
* @param sourceViewer the view of the editor
* @param contentType the contentType configured for this editor
*/
public ITextDoubleClickStrategy getDoubleClickStrategy(
ISourceViewer sourceViewer,
String contentType) {
if (doubleClickStrategy == null)
doubleClickStrategy = new XMLDoubleClickStrategy();
return doubleClickStrategy;
}
/** get the XMLScanner for the XMLEditor
*/
protected XMLScanner getXMLScanner() {
if (scanner == null) {
scanner = new XMLScanner(colorManager);
scanner.setDefaultReturnToken(
new Token(
new TextAttribute(
colorManager.getColor(IXMLColorConstants.DEFAULT))));
}
return scanner;
}
/** get the XMLTagScanner for the XMLEditor
*/
protected XMLTagScanner getXMLTagScanner() {
if (tagScanner == null) {
tagScanner = new XMLTagScanner(colorManager);
tagScanner.setDefaultReturnToken(
new Token(
new TextAttribute(
colorManager.getColor(IXMLColorConstants.TAG))));
}
return tagScanner;
}
/** get the PresentationReconciler for the XMLEditor
*/
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
PresentationReconciler reconciler = new PresentationReconciler();
DefaultDamagerRepairer dr =
new DefaultDamagerRepairer(getXMLTagScanner());
reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
dr = new DefaultDamagerRepairer(getXMLScanner());
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
NonRuleBasedDamagerRepairer ndr =
new NonRuleBasedDamagerRepairer(
new TextAttribute(
colorManager.getColor(IXMLColorConstants.XML_COMMENT)));
reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT);
reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT);
ndr = new NonRuleBasedDamagerRepairer(
new TextAttribute(
colorManager.getColor(IXMLColorConstants.XML_ERRORS)));
reconciler.setDamager(ndr, XMLPartitionScanner.XML_ERRORS);
reconciler.setRepairer(ndr, XMLPartitionScanner.XML_ERRORS);
ndr = new NonRuleBasedDamagerRepairer(
new TextAttribute(
colorManager.getColor(IXMLColorConstants.XML_COMPONENTS)));
reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMPONENTS);
reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMPONENTS);
ndr = new NonRuleBasedDamagerRepairer(
new TextAttribute(
colorManager.getColor(IXMLColorConstants.JSP_CONTENTS)));
reconciler.setDamager(ndr, XMLPartitionScanner.JSP_CONTENTS);
reconciler.setRepairer(ndr, XMLPartitionScanner.JSP_CONTENTS);
return reconciler;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?