Changeset 1399 for trunk/org.modelica.mdt.ui/src
- Timestamp:
- 03/18/12 22:24:03 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.modelica.mdt.ui/src/org/modelica/mdt/ui/actions/ModelicaBuildAction.java
r694 r1399 7 7 import java.util.ResourceBundle; 8 8 9 import org.eclipse.core.resources.IncrementalProjectBuilder; 10 import org.eclipse.swt.custom.BusyIndicator; 11 import org.eclipse.swt.widgets.Display; 12 import org.eclipse.swt.widgets.Shell; 13 import org.eclipse.ui.IActionBars; 14 import org.eclipse.ui.IEditorSite; 15 import org.eclipse.ui.IWorkbenchWindow; 9 16 import org.eclipse.ui.actions.GlobalBuildAction; 10 17 import org.eclipse.ui.ide.IDEActionFactory; 18 import org.eclipse.ui.texteditor.ITextEditor; 11 19 import 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; 20 import org.modelica.mdt.ui.constants.Constants; 17 21 18 22 /** 19 * Class that defines the action to build the Modelica project cor esponding to this file23 * Class that defines the action to build the Modelica project corresponding to this file 20 24 */ 21 25 public class ModelicaBuildAction extends TextEditorAction { 22 26 23 27 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(); 28 30 29 31 /** 30 32 * Constructs and updates the action. 31 33 */ 32 private ModelicaBuildAction() 33 { 34 private ModelicaBuildAction() { 34 35 /* 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); 37 37 } 38 38 39 public static ModelicaBuildAction getInstance() 40 { 39 public static ModelicaBuildAction getInstance() { 41 40 return instance; 42 41 } 43 42 44 43 /* 45 44 * @see org.eclipse.jface.action.Action#run() 46 45 */ 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() { 58 61 fullBuildAction.run(); 59 62 } 60 63 }; 61 Display display= getTextEditor().getEditorSite().getWorkbenchWindow().getShell().getDisplay(); 64 65 Shell shell = workbenchWindow.getShell(); 66 Display display = shell.getDisplay(); 67 62 68 BusyIndicator.showWhile(display, runnable); 63 69 } 64 70 } 65 66
Note: See TracChangeset
for help on using the changeset viewer.