clearallaction.java
来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 103 行
JAVA
103 行
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/bind/action/ClearAllAction.java,v 1.1.1.1 2004/07/01 09:07:40 wang_j Exp $
* $Revision: 1.1.1.1 $
* $Date: 2004/07/01 09:07:40 $
*
* ====================================================================
*
* 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.action;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
import com.webpump.ui.module.model.Model;
import com.webpump.ui.module.model.Modules;
import com.webpump.ui.module.model.Page;
import com.webpump.ui.bind.editors.BindEditor;
import com.webpump.ui.bind.editors.XMLEditor;
import com.webpump.ui.bind.data.*;
import com.webpump.ui.perspective.WebpumpIDEPlugin;
/**
* Class for the action of clear all bind parameters.
*
* @author luo_sa
* @version 2.0.0 2004-2-16
*/
public class ClearAllAction extends Action {
/** editor on which the action act*/
private BindEditor m_objBindEditor;
/**
* Constructor
* @param bindeditor
* @param id id of action
*/
public ClearAllAction(BindEditor bindeditor, String id) {
super();
m_objBindEditor = bindeditor;
setId(id);
}
/**
* method which will be called when the action's UI button is clicked by the user
*/
public void run() {
/** the member editor of the editor which is editted by the user */
XMLEditor xmleditor = null;
/** to get the xmleditor object */
if (m_objBindEditor!=null)
xmleditor = m_objBindEditor.getXMLEditor();
if(xmleditor!=null){
/** the text which is now editted in the xmleditor */
String editorText =
xmleditor.getDocumentProvider().getDocument(m_objBindEditor.getEditorInput()).get();
/** to get the document of the xmleditor */
IDocumentProvider provider= ((ITextEditor) xmleditor).getDocumentProvider();
IEditorInput input = xmleditor.getEditorInput();
IDocument document = provider.getDocument(input);
try {
document.replace(document.getLength(),0,"");
} catch (BadLocationException e) {
e.printStackTrace();
}
}
HtmlPage objPage = m_objBindEditor.getHtmlPage();
Vector vParameterInfo = objPage.getvParameterInfo();
//清空objPage
for (int i = 0; i < vParameterInfo.size(); ) {
objPage.removeParameter((ParameterInfo) vParameterInfo.get(i));
}
for (int j = 0; j < m_objBindEditor.getTable().getItemCount(); j++) {
TableItem tableitem = m_objBindEditor.getTable().getItem(j);
tableitem.setText(3, "");
tableitem.setText(4, "");
tableitem.setText(5, "");
tableitem.setText(6, "");
tableitem.setText(7, "");
}
//写xml文
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?