Ignore:
Timestamp:
11/26/06 01:01:05 (18 years ago)
Author:
adrpo
Message:

latest updates for 0.6.9

File:
1 edited

Legend:

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

    r478 r482  
    33import org.eclipse.swt.widgets.Display;
    44import org.eclipse.swt.widgets.Widget;
     5import org.eclipse.ui.IWorkbenchPage;
     6import org.eclipse.ui.PartInitException;
     7import org.eclipse.ui.PlatformUI;
    58import org.eclipse.ui.plugin.AbstractUIPlugin;
    69import org.eclipse.core.runtime.CoreException;
    710import org.eclipse.core.runtime.IAdapterFactory;
    811import org.eclipse.core.runtime.IAdapterManager;
     12import org.eclipse.core.runtime.IStatus;
    913import org.eclipse.core.runtime.Platform;
     14import org.eclipse.core.runtime.Status;
    1015import org.modelica.mdt.core.IModelicaElement;
    1116import org.modelica.mdt.core.IModelicaProject;
    1217import org.modelica.mdt.core.ModelicaCore;
     18import org.modelica.mdt.core.OpenModelicaCompiler;
     19import org.modelica.mdt.core.compiler.CompilerInstantiationException;
    1320import org.osgi.framework.BundleContext;
     21import org.modelica.mdt.ui.UIPlugin;
     22import org.modelica.mdt.ui.view.ModelicaConsoleView;
     23import org.modelica.mdt.ui.console.ModelicaTextConsole;
    1424import org.modelica.mdt.ui.text.ModelicaTextTools;
     25
     26import java.io.OutputStream;
    1527import java.util.*;
     28
     29import javax.swing.text.Document;
    1630
    1731import org.eclipse.core.resources.IFile;
     
    2034import org.eclipse.core.resources.IProject;
    2135import org.eclipse.debug.core.DebugPlugin;
     36import org.eclipse.jface.action.GroupMarker;
     37import org.eclipse.jface.action.IMenuManager;
     38import org.eclipse.jface.action.Separator;
     39import org.eclipse.jface.text.IDocument;
    2240
    2341/**
     
    2745{
    2846    private ModelicaTextTools fModelicaTextTools;
    29     //private List<IFile> markedFiles;
    30     //private MetaModelicaJobListener jobListener;
     47    private ModelicaTextConsole fConsole;
    3148    private MetaModelicaBuildLaunchListener buildMetaModelicaLanuchListner;
    3249    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;
    3353
    3454    protected void debug(String message)
     
    5272            DEBUG = true;
    5373        }
    54        
    5574        plugin = this;
    5675    }
     
    6786
    6887        manager.registerAdapters(factory, IModelicaElement.class);
    69         //jobListener = new MetaModelicaJobListener();
    70         //Platform.getJobManager().addJobChangeListener(jobListener);
    7188        buildMetaModelicaLanuchListner = new MetaModelicaBuildLaunchListener();
    7289        DebugPlugin.getDefault().getLaunchManager().addLaunchListener(buildMetaModelicaLanuchListner);
    73         //markedFiles = new Vector<IFile>();
    7490    }
    7591
     
    7995    public void stop(BundleContext context) throws Exception
    8096    {
    81         super.stop(context);           
     97        super.stop(context);
     98        fConsole = null;
    8299        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);
    87101    }
    88102
     
    155169            }
    156170        }
    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();
    168233        }
    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    }
    187255}
Note: See TracChangeset for help on using the changeset viewer.