bindingallaction.java
来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 128 行
JAVA
128 行
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/bind/action/BindingAllAction.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 binding all parameters.
*
* @author luo_sa
* @version 2.0.0 2004-2-16
*/
public class BindingAllAction extends Action {
/** editor on which the action act*/
private BindEditor m_objBindEditor;
/**
* Constructor
* @param bindeditor
* @param id id of action
*/
public BindingAllAction(BindEditor bindeditor, String id) {
super();
m_objBindEditor = bindeditor;
//set if of action
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(); i++) {
// objPage.removeParameter((ParameterInfo) vParameterInfo.get(i));
//}
Loop:
for (int j = 0; j < m_objBindEditor.getTable().getItemCount(); j++) {
TableItem tableitem = m_objBindEditor.getTable().getItem(j);
if (tableitem.getText(2).compareTo("SingleValue") == 0) {
String strobjectname = tableitem.getText(1);
String strobjectnametrim = strobjectname.trim();
for(int i = 0; i < vParameterInfo.size();i++){
ParameterInfo info = (ParameterInfo) vParameterInfo.get(i);
String name = info.getParamsInfo()[1];
if(name != null && name.equals(strobjectnametrim)) {
continue Loop;
}
}
if (strobjectname.startsWith(" ", 0)) {
String objectname = strobjectname.trim();
String variablename = "m_str" + objectname.substring(0,1).toUpperCase().concat(objectname.substring(1, objectname.length()));
//table同时也要显示相应值
tableitem.setText(3, variablename);
tableitem.setText(4, "private");
tableitem.setText(5, "String[]");
tableitem.setText(6, "null");
tableitem.setText(7, "");
String[] strings = new String[9];
strings[1] = tableitem.getText(1).trim();
strings[2] = tableitem.getText(2);
strings[3] = variablename;
strings[4] = "private";
strings[5] = "String[]";
strings[6] = "null";
strings[7] = "";
strings[8] = "true";
ParameterInfo objParameterInfoNew = new ParameterInfo();
//对象加到
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?