进入run()的时候,我发现window是空值
我就是想调用一个窗口而已
这是我的TestViewAction
package com.test.action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import com.test.view.MainView;
public class TestViewAction implements IWorkbenchWindowActionDelegate{
private IWorkbenchWindow window;
private IShellProvider is = null;
public TestViewAction(IWorkbenchWindow window){
this.window = window;
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
@Override
public void init(IWorkbenchWindow arg0) {
// TODO Auto-generated method stub
}
@Override
public void run(IAction arg0) {
// TODO Auto-generated method stub
window.getActivePage().findView("com.test.view.MainView");
}
@Override
public void selectionChanged(IAction arg0, ISelection arg1) {
// TODO Auto-generated method stub
}
}
plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.ui.actionSets">
<actionSet
label="Sample Action Set"
visible="true"
id="com.test.actionSet">
<menu
label="Test &Menu"
id="testMenu">
<separator
name="testGroup">
</separator>
</menu>
<action
label="&Test Action"
icon="icons/sample.gif"
class="com.test.action.TestViewAction"
tooltip="Hello, Eclipse world"
menubarPath="testMenu/testGroup"
toolbarPath="testGroup"
id="com.test.action.TestViewAction">
</action>
</actionSet>
</extension>