在启动期间禁用Eclipse中的菜单项

时间:2017-03-06 11:57:33

标签: java eclipse plugins

我正在开发一个Eclipse插件。我需要检查启动时是否存在nvcc,如果没有,则禁用特定的菜单项。这是我的代码,直到现在:

package Startup;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.eclipse.ui.IStartup;


public class StartCheck implements IStartup {

public void earlyStartup() {
    // This method checks for presence of nvcc when Eclipse starts-up.
    String command="nvcc -version";
    Runtime run = Runtime.getRuntime();
    Process pr;
    try {
        pr = run.exec(command);
        pr.waitFor();
        BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
        //print-out the nvcc version
        System.out.println(buf.readLine());
    }catch (IOException e) {
        //disable all buttons since no further task can be done, prompt user to install nvcc.
        System.out.println("nvcc not present, freezing the energy estimation plugin...");
        disableMenu();
        } catch (InterruptedException e) {
        e.printStackTrace();
        }


    }
public static void disableMenu(){

}

}

如您所见,禁用菜单方法不包含任何内容。有人可以帮我这个吗?如果在上面的代码中发生IOException,我必须基本上禁用特定的菜单项。

谢谢!

0 个答案:

没有答案