Changeset 1116 for trunk/org.modelica.mdt.ui/src/org/modelica
- Timestamp:
- 11/22/11 19:52:54 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.modelica.mdt.ui/src/org/modelica/mdt/ui/actions/OpenActionUtil.java
r491 r1116 26 26 import org.eclipse.jface.viewers.LabelProvider; 27 27 28 @SuppressWarnings("unchecked")29 28 public class OpenActionUtil { 30 29 31 30 private OpenActionUtil() { 32 31 // no instance. 33 32 } 34 33 35 34 /** 36 35 * Opens the editor on the given element and subsequently selects it. … … 39 38 open(element, true); 40 39 } 41 40 42 41 /** 43 42 * Opens the editor on the given element and subsequently selects it. … … 53 52 } 54 53 } 55 56 /** 57 * Filters out source references from the given code resolve results. 58 * A utility method that can be called by subclasses. 59 */ 60 public static List filterResolveResults(IModelicaElement[] codeResolveResults) { 61 int nResults= codeResolveResults.length; 62 List refs= new ArrayList(nResults); 63 for (int i= 0; i < nResults; i++) { 64 if (codeResolveResults[i] instanceof IModelicaElement) 65 refs.add(codeResolveResults[i]); 66 } 67 return refs; 68 } 69 54 70 55 /** 71 56 * Shows a dialog for resolving an ambiguous java element. … … 73 58 */ 74 59 public static IModelicaElement selectModelicaElement(IModelicaElement[] elements, Shell shell, String title, String message) { 75 60 76 61 int nResults= elements.length; 77 62 78 63 if (nResults == 0) 79 64 return null; 80 65 81 66 if (nResults == 1) 82 67 return elements[0]; 83 68 84 69 ElementListSelectionDialog dialog= new ElementListSelectionDialog(shell, new LabelProvider()); 85 70 dialog.setTitle(title); 86 71 dialog.setMessage(message); 87 72 dialog.setElements(elements); 88 73 89 74 if (dialog.open() == Window.OK) { 90 75 Object[] selection= dialog.getResult();
Note: See TracChangeset
for help on using the changeset viewer.