Changes

Jump to: navigation, search

Teams Winter 2011/team2/lab3

1,132 bytes added, 01:40, 23 March 2011
no edit summary
For AddCityHandler.java
<source lang=java>
package ecl.team2.lab3.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
 
//This will allow us to edit the content using the editor window
import ecl.team2.lab3.editor.WeatherEditor;
import ecl.team2.lab3.editor.WeatherInput;
 
public class AddCityHandler extends AbstractHandler implements IHandler {
 
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
IWorkbenchPage page = window.getActivePage();
WeatherInput input = new WeatherInput("-1");
try
{
page.openEditor(input, WeatherEditor.ID);
}
catch (PartInitException e)
{
System.out.println(e.getMessage());
}
return null;
}
 
}
</source>
1
edit

Navigation menu