ConvertFromAction
来源:互联网 发布:c语言buffer 编辑:程序博客网 时间:2024/05/28 11:50
package com.test.myplugin.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IType;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.internal.Workbench;
import com.test.myplugin.ConvertStore;
public class ConvertFromAction extends AbstractHandler{
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
ISelectionService selectionService =
Workbench.getInstance().getActiveWorkbenchWindow().getSelectionService();
ISelection selection = selectionService.getSelection();
Object [] compUnits = ((IStructuredSelection) selection).toArray();
ICompilationUnit compUnit = (ICompilationUnit) compUnits[0];
IType type = compUnit.findPrimaryType();
ConvertStore.setValue("from", type);
return null;
}
}
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IType;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.internal.Workbench;
import com.test.myplugin.ConvertStore;
public class ConvertFromAction extends AbstractHandler{
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
ISelectionService selectionService =
Workbench.getInstance().getActiveWorkbenchWindow().getSelectionService();
ISelection selection = selectionService.getSelection();
Object [] compUnits = ((IStructuredSelection) selection).toArray();
ICompilationUnit compUnit = (ICompilationUnit) compUnits[0];
IType type = compUnit.findPrimaryType();
ConvertStore.setValue("from", type);
return null;
}
}
0 0
- ConvertFromAction
- LinuxKernel 入侵式双向链表的设计,分析,使用
- ConvertStore
- 国防科大校赛决赛-final(镜像赛) Problem B: XueXX and Binary
- ConvertAction
- spring配置
- ConvertFromAction
- C/C++对文件的读写
- 如何设置幻灯片自动播放
- ecshop邮件服务器设置注意事项
- ConvertToAction
- 有疑问
- ZOJ 2419-- Triangle-凸包+旋转卡壳求最大面积三角形(计算几何)
- Python实战_2_第一周_第三节课程:真实世界中的网页解析
- Android FlexboxLayout基本用法