- Timestamp:
- 11/26/06 01:01:05 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.modelica.mdt.ui/src/org/modelica/mdt/ui/UIPlugin.java
r478 r482 3 3 import org.eclipse.swt.widgets.Display; 4 4 import org.eclipse.swt.widgets.Widget; 5 import org.eclipse.ui.IWorkbenchPage; 6 import org.eclipse.ui.PartInitException; 7 import org.eclipse.ui.PlatformUI; 5 8 import org.eclipse.ui.plugin.AbstractUIPlugin; 6 9 import org.eclipse.core.runtime.CoreException; 7 10 import org.eclipse.core.runtime.IAdapterFactory; 8 11 import org.eclipse.core.runtime.IAdapterManager; 12 import org.eclipse.core.runtime.IStatus; 9 13 import org.eclipse.core.runtime.Platform; 14 import org.eclipse.core.runtime.Status; 10 15 import org.modelica.mdt.core.IModelicaElement; 11 16 import org.modelica.mdt.core.IModelicaProject; 12 17 import org.modelica.mdt.core.ModelicaCore; 18 import org.modelica.mdt.core.OpenModelicaCompiler; 19 import org.modelica.mdt.core.compiler.CompilerInstantiationException; 13 20 import org.osgi.framework.BundleContext; 21 import org.modelica.mdt.ui.UIPlugin; 22 import org.modelica.mdt.ui.view.ModelicaConsoleView; 23 import org.modelica.mdt.ui.console.ModelicaTextConsole; 14 24 import org.modelica.mdt.ui.text.ModelicaTextTools; 25 26 import java.io.OutputStream; 15 27 import java.util.*; 28 29 import javax.swing.text.Document; 16 30 17 31 import org.eclipse.core.resources.IFile; … … 20 34 import org.eclipse.core.resources.IProject; 21 35 import org.eclipse.debug.core.DebugPlugin; 36 import org.eclipse.jface.action.GroupMarker; 37 import org.eclipse.jface.action.IMenuManager; 38 import org.eclipse.jface.action.Separator; 39 import org.eclipse.jface.text.IDocument; 22 40 23 41 /** … … 27 45 { 28 46 private ModelicaTextTools fModelicaTextTools; 29 //private List<IFile> markedFiles; 30 //private MetaModelicaJobListener jobListener; 47 private ModelicaTextConsole fConsole; 31 48 private MetaModelicaBuildLaunchListener buildMetaModelicaLanuchListner; 32 49 private boolean DEBUG = false; 50 public static String PLUGIN_ID = "org.modelica.mdt.ui"; 51 public static String ID_PROJECTSVIEW = "org.modelica.mdt.ui.views.ProjectsView"; 52 private OpenModelicaCompiler omc = null; 33 53 34 54 protected void debug(String message) … … 52 72 DEBUG = true; 53 73 } 54 55 74 plugin = this; 56 75 } … … 67 86 68 87 manager.registerAdapters(factory, IModelicaElement.class); 69 //jobListener = new MetaModelicaJobListener();70 //Platform.getJobManager().addJobChangeListener(jobListener);71 88 buildMetaModelicaLanuchListner = new MetaModelicaBuildLaunchListener(); 72 89 DebugPlugin.getDefault().getLaunchManager().addLaunchListener(buildMetaModelicaLanuchListner); 73 //markedFiles = new Vector<IFile>();74 90 } 75 91 … … 79 95 public void stop(BundleContext context) throws Exception 80 96 { 81 super.stop(context); 97 super.stop(context); 98 fConsole = null; 82 99 plugin = null; 83 //markedFiles.clear(); 84 //markedFiles = null; 85 //Platform.getJobManager().removeJobChangeListener(jobListener); 86 DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(buildMetaModelicaLanuchListner); 100 DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(buildMetaModelicaLanuchListner); 87 101 } 88 102 … … 155 169 } 156 170 } 157 /* 158 if (markedFiles == null) return; 159 for (IFile file : markedFiles) 160 { 161 try 162 { 163 file.deleteMarkers(UIPlugin.METAMODELICA_BULD_MARKER_ID, false, IResource.DEPTH_INFINITE); 164 } 165 catch(Exception e) 166 { 167 } 171 } 172 173 /** 174 * Creates the MDT plug-in's standard groups for view context menus. 175 * 176 * @param menu the menu manager to be populated 177 */ 178 public static void createStandardGroups(IMenuManager menu) { 179 if (!menu.isEmpty()) 180 return; 181 182 menu.add(new Separator("group.new")); 183 menu.add(new GroupMarker("group.goto")); 184 menu.add(new Separator("group.open")); 185 menu.add(new GroupMarker("group.show")); 186 menu.add(new Separator("group.edit")); 187 menu.add(new Separator("group.reorganize")); 188 menu.add(new Separator("group.generate")); 189 menu.add(new Separator("group.search")); 190 menu.add(new Separator("group.build")); 191 menu.add(new Separator("additions")); 192 menu.add(new Separator("group.viewerSetup")); 193 menu.add(new Separator("group.properties")); 194 } 195 196 // public ModelicaConsoleView getModelicaConsole() 197 // { 198 // try 199 // { 200 // IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); 201 // fConsole = (ModelicaConsoleView)page.findView(ModelicaConsoleView.CONSOLE_ID); 202 // //boolean show = ModelicaPlugin.getDefault().getPreferenceStore().getBoolean(ModelicaPreferencePage.SHOW_OUTPUT_IN_CONSOLE); 203 // if (fConsole != null) 204 // { 205 // return fConsole; 206 // } 207 // else 208 // { 209 // page.showView(ModelicaConsoleView.CONSOLE_ID); 210 // fConsole = (ModelicaConsoleView)page.findView(ModelicaConsoleView.CONSOLE_ID); 211 // return fConsole; 212 // } 213 // } 214 // catch (PartInitException e) 215 // { 216 // e.printStackTrace(); 217 // UIPlugin.getDefault().getLog().log( 218 // new Status( 219 // IStatus.ERROR, 220 // UIPlugin.PLUGIN_ID, 221 // 0, 222 // "Error opening MDT Console", 223 // e)); 224 // return null; 225 // } 226 // } 227 228 public ModelicaTextConsole getModelicaTextConsole() 229 { 230 if (fConsole == null) 231 { 232 fConsole = new ModelicaTextConsole(); 168 233 } 169 markedFiles.clear(); 170 */ 171 } 172 173 // public void addMarkedFile(IFile file) 174 // { 175 // markedFiles.add(file); 176 // } 177 // 178 // public void deleteMarkedFile(IFile file) 179 // { 180 // markedFiles.remove(file); 181 // } 182 // 183 // public boolean containsMarkedFile(IFile file) 184 // { 185 // return markedFiles.contains(file); 186 // } 234 return fConsole; 235 } 236 237 public OutputStream getModelicaConsoleOutputStream() 238 { 239 if (fConsole == null) getModelicaTextConsole(); 240 if (fConsole != null) 241 { 242 return fConsole.getOutputStream(); 243 } 244 return null; 245 } 246 247 public OpenModelicaCompiler getCompiler() throws CompilerInstantiationException 248 { 249 if (omc == null) 250 { 251 omc = new OpenModelicaCompiler(); 252 } 253 return omc; 254 } 187 255 }
Note: See TracChangeset
for help on using the changeset viewer.