bindingamarkaction.java

来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 96 行

JAVA
96
字号
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/bind/action/BindingAMarkAction.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.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
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.ParameterValue;
import com.webpump.ui.bind.editors.XMLEditor;
import com.webpump.ui.bind.data.*;
import com.webpump.ui.bind.dialog.SetActiveFieldDialog;
import com.webpump.ui.perspective.WebpumpIDEPlugin;

/**
 * Class for the action of binding a mark .
 * 
 * @author luo_sa
 * @version 2.0.0 2004-2-16
 */
public class BindingAMarkAction extends Action {
    
     
    /** editor on which the action act*/
    private BindEditor m_objBindEditor;
    
    /**
     * Constructor
     * @param bindeditor
     * @param id id of action
     */ 
    public BindingAMarkAction(BindEditor bindeditor, String id) {
        super();
        m_objBindEditor = bindeditor;
        //set the id 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();
		   }	
		}
        int index = m_objBindEditor.getTable().getSelectionIndex();
        //取得被双击的柄

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?