Line | |
---|
1 | package org.modelica.mdt; |
---|
2 | import org.eclipse.core.resources.IProject; |
---|
3 | import org.eclipse.core.resources.IProjectDescription; |
---|
4 | import org.eclipse.core.runtime.CoreException; |
---|
5 | import org.eclipse.ui.plugin.AbstractUIPlugin; |
---|
6 | |
---|
7 | public 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.