source: trunk/src/org/modelica/mdt/MdtPlugin.java @ 11

Last change on this file since 11 was 10, checked in by boris, 19 years ago
File size: 850 bytes
Line 
1package org.modelica.mdt;
2import org.eclipse.core.resources.IProject;
3import org.eclipse.core.resources.IProjectDescription;
4import org.eclipse.core.runtime.CoreException;
5import org.eclipse.ui.plugin.AbstractUIPlugin;
6
7public class MdtPlugin extends AbstractUIPlugin
8{
9
10    public static final String MODELICA_NATURE = 
11        "org.modelica.mdt.ModelicaNature";
12   
13    public static void addModelicaNature(IProject project) throws CoreException
14    {
15        if (project.hasNature(MODELICA_NATURE)) 
16            return;
17
18        IProjectDescription description = project.getDescription();
19        String[] ids= description.getNatureIds();
20        String[] newIds= new String[ids.length + 1];
21        System.arraycopy(ids, 0, newIds, 0, ids.length);
22        newIds[ids.length]= MODELICA_NATURE;
23        description.setNatureIds(newIds);
24        project.setDescription(description, null);
25    }
26   
27}
Note: See TracBrowser for help on using the repository browser.