showselection.java

来自「eclipse jsp 插件」· Java 代码 · 共 39 行

JAVA
39
字号
package test.actions;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.w3c.dom.NamedNodeMap;


@SuppressWarnings("restriction")
public class ShowSelection implements ListenerShowSelection{
	private TableViewer tableViewer;
	private ElementImpl ei;
	public ShowSelection(TableViewer tableViewer,ElementImpl ei){
		this.tableViewer=tableViewer;
		this.ei=ei;
	}
	public ShowSelection(){
		
	}
	public String showSelection(IWorkbenchPart sourcepart, ISelection selection) {
			PropertyFactory pf=new PropertyFactory();
			tableViewer.setInput(pf.showSelection(ei));
			String tagName=pf.getTagName();
			return tagName;
	}

	public void changeSelection(String property,String valueName) {
		NamedNodeMap pro=SampleAction.ei.getAttributes();
		for (int j=0;j<pro.getLength();j++){
			if(property.equals(pro.item(j).getNodeName().trim())){
				SampleAction.ei.getAttributes().item(j).setNodeValue(valueName);
			}
		}
	}

	
}

⌨️ 快捷键说明

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