sampleaction.java
来自「eclipse jsp 插件」· Java 代码 · 共 45 行
JAVA
45 行
package test.actions;import org.eclipse.jface.viewers.ISelection;import org.eclipse.jface.viewers.IStructuredSelection;import org.eclipse.jface.viewers.TableViewer;import org.eclipse.swt.widgets.Composite;import org.eclipse.ui.ISelectionListener;import org.eclipse.ui.IWorkbenchPart;import org.eclipse.ui.part.ViewPart;import org.eclipse.wst.xml.core.internal.document.ElementImpl;@SuppressWarnings("restriction")public class SampleAction extends ViewPart implements ISelectionListener { public static TableViewer tableViewer; private String tagName; public static ElementImpl ei; public SampleAction() { } public void selectionChanged(IWorkbenchPart sourcepart, ISelection selection) { // we ignore our own selections if (sourcepart != SampleAction.this) { IStructuredSelection isse=(IStructuredSelection)selection; ei=(ElementImpl)isse.getFirstElement(); ListenerShowSelection lss=new ShowSelection(tableViewer,ei); tagName=lss.showSelection(sourcepart, selection); setContentDescription(tagName); } } public void createPartControl(Composite parent) { Table_Viewer mt=new CreateTable(tableViewer); mt.createMyTable(parent); mt.getTable(); tableViewer=mt.getTableViewer(); getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(this); tableViewer.refresh(); } @Override public void setFocus() { }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?