Ignore:
Timestamp:
03/18/12 22:24:03 (13 years ago)
Author:
masberg
Message:

Add missing override annotations, fix typos, formatting fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/org.modelica.mdt.ui/src/org/modelica/mdt/ui/actions/ModelicaBuildAction.java

    r694 r1399  
    77import java.util.ResourceBundle;
    88
     9import org.eclipse.core.resources.IncrementalProjectBuilder;
     10import org.eclipse.swt.custom.BusyIndicator;
     11import org.eclipse.swt.widgets.Display;
     12import org.eclipse.swt.widgets.Shell;
     13import org.eclipse.ui.IActionBars;
     14import org.eclipse.ui.IEditorSite;
     15import org.eclipse.ui.IWorkbenchWindow;
    916import org.eclipse.ui.actions.GlobalBuildAction;
    1017import org.eclipse.ui.ide.IDEActionFactory;
     18import org.eclipse.ui.texteditor.ITextEditor;
    1119import org.eclipse.ui.texteditor.TextEditorAction;
    12 
    13 import org.eclipse.swt.custom.BusyIndicator;
    14 import org.eclipse.swt.widgets.Display;
    15 
    16 import org.eclipse.core.resources.IncrementalProjectBuilder;
     20import org.modelica.mdt.ui.constants.Constants;
    1721
    1822/**
    19  * Class that defines the action to build the Modelica project coresponding to this file
     23 * Class that defines the action to build the Modelica project corresponding to this file
    2024 */
    2125public class ModelicaBuildAction extends TextEditorAction {
    2226   
    2327    private GlobalBuildAction fullBuildAction;
    24    
    25     private static final String ACTIONS_RESOURCE_BUNDLE = "org.modelica.mdt.ui.editor.ModelicaActions";
    26     private static ModelicaBuildAction instance =
    27         new ModelicaBuildAction();
     28
     29    private static ModelicaBuildAction instance = new ModelicaBuildAction();
    2830   
    2931        /**
    3032         * Constructs and updates the action.
    3133         */
    32         private ModelicaBuildAction()
    33         {
     34        private ModelicaBuildAction() {
    3435            /* Editor will be set later that's why we have null here */
    35             super(ResourceBundle.getBundle(ACTIONS_RESOURCE_BUNDLE),
    36             "ModelicaBuildAction.", null);
     36            super(ResourceBundle.getBundle(Constants.MDT_UI_ACTIONS_RESOURCE_BUNDLE), "ModelicaBuildAction.", null);
    3737        }
    3838
    39         public static ModelicaBuildAction getInstance()
    40         {
     39        public static ModelicaBuildAction getInstance() {
    4140            return instance;
    4241        }
    43    
     42
    4443    /*
    4544     * @see org.eclipse.jface.action.Action#run()
    4645     */
    47     public void run()
    48     {
    49         fullBuildAction = new GlobalBuildAction(
    50                  getTextEditor().getEditorSite().getWorkbenchWindow(),
    51                  IncrementalProjectBuilder.FULL_BUILD);
    52         getTextEditor().getEditorSite().getActionBars().setGlobalActionHandler(IDEActionFactory.BUILD_PROJECT.getId(), fullBuildAction);       
    53         Runnable runnable= new Runnable()
    54         {
    55             public void run()
    56             {
    57                 // some comment.
     46    @Override
     47    public void run() {
     48        ITextEditor textEditor = getTextEditor();
     49        IEditorSite editorSite = textEditor.getEditorSite();
     50        IWorkbenchWindow workbenchWindow = editorSite.getWorkbenchWindow();
     51
     52        fullBuildAction = new GlobalBuildAction(workbenchWindow, IncrementalProjectBuilder.FULL_BUILD);
     53       
     54        IActionBars actionBars = editorSite.getActionBars();
     55       
     56        actionBars.setGlobalActionHandler(IDEActionFactory.BUILD_PROJECT.getId(), fullBuildAction);
     57
     58        Runnable runnable= new Runnable() {
     59            @Override
     60            public void run() {
    5861                fullBuildAction.run();
    5962            }
    6063        };
    61         Display display= getTextEditor().getEditorSite().getWorkbenchWindow().getShell().getDisplay();
     64
     65        Shell shell = workbenchWindow.getShell();
     66        Display display = shell.getDisplay();
     67
    6268        BusyIndicator.showWhile(display, runnable);     
    6369    }   
    6470}
    65 
    66 
Note: See TracChangeset for help on using the changeset viewer.