我正在创建一个简单的插件来从目标控制台读取值。为此,我编写了以下代码。
private MessageConsole findConsole(String name) {
ConsolePlugin plugin = ConsolePlugin.getDefault();
IConsoleManager conMan = plugin.getConsoleManager();
MessageConsole myConsole = new MessageConsole(name, null);
conMan.addConsoles(new IConsole[] { myConsole });
return myConsole;
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil
.getActiveWorkbenchWindowChecked(event);
String CONSOLE_NAME = window.getShell().getText();
MessageConsole myConsole = findConsole(CONSOLE_NAME);
out = myConsole.newMessageStream();
out.println("Hello from Generic console sample action");
myConsole.activate();
myConsole.initialize();
IOConsoleInputStream aa = myConsole.getInputStream();
InputStream iStream = myConsole.getInputStream();
BufferedReader buf = new BufferedReader(new InputStreamReader(iStream));
try {
String a = buf.readLine();
out.println(a);
ATGHandler.main(null);
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return null;
}
它正在生成一个异常“此类文件的jar属于容器'插件依赖项',它不允许修改其条目上的源附件。” 请帮我解决这个问题。