Monday, March 22, 2010

title pic On The Subject of Organized Imports…

Posted by pookzilla on August 1, 2006

Does this give anyone ideas? *coughscriptingcough*

class MyExecutionListener implements org.eclipse.core.commands.IExecutionListener {

    ... <snip uninteresting bits > ...

    public void preExecute(String commandId, ExecutionEvent event) {        if ("org.eclipse.ui.file.save".equals(commandId)) {            Command command = service .getCommand("org.eclipse.jdt.ui.edit.text.java.organize.imports");               if (command != null) {                    ExecutionEvent newEvent = new ExecutionEvent(                        command,                         event.getParameters(),                         event.getTrigger(),                         event.getApplicationContext());                    try {                        command.executeWithChecks(newEvent);                    } catch (Exception e) {                    }                }            }        }    }}
top