Changes

Jump to: navigation, search

Teams Winter 2011/team2/lab3

1,353 bytes added, 03:32, 12 March 2011
no edit summary
*From your current display, right-click the recently added extension->New->menuContribution. After the item has been added, right-click that item and perform the following actions New->menu.
*Fill in the necessary based on the picture below
[[FIleFile:MenuT2.png]]*Before we progress any further with menu, we must create a "Command". We'll first develop the "exit" command. Perform the exact same series of steps done earlier to add a new extension, except this time search for "org.eclipse.ui.commands". Add an item, "Commands", and add the following information based on the picture below.[[File:ExtT2.png]]*As you may recall, I made mention that commands are akin to basically doing an action, which is based on an occurrence of an event. Well, just like an event, you must programatically inform the application of what actions to take place. That is why you must now create package called "ecl.team2.lab3.commands" and a java file named "ExitHandler".*Copy and paste this code into the ExitHandler<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.ui.handlers.HandlerUtil; public class ExitHandler extends AbstractHandler {  @Override public Object execute(ExecutionEvent event) throws ExecutionException { HandlerUtil.getActiveWorkbenchWindow(event).close(); return null; } }</source>*Return back to File menu and add a command file to it.*Enter what is shown in the picture below.[[File:Ext3T2.png]]
1
edit

Navigation menu