From: Atanas Gegov <atanas.ge...@bmw-carit.de> --- .../ide/natures/YoctoSDKEmptyProjectNature.java | 3 +-- .../yocto/sdk/ide/natures/YoctoSDKNatureUtils.java | 28 ++++++++++++++++++++ .../sdk/ide/natures/YoctoSDKProjectNature.java | 2 +- .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 20 -------------- 4 files changed, 30 insertions(+), 23 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java index 9057b8e..6c9a5ac 100644 --- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java @@ -5,7 +5,6 @@ import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.yocto.sdk.ide.YoctoSDKPlugin; -import org.yocto.sdk.ide.utils.YoctoSDKUtils; public class YoctoSDKEmptyProjectNature implements IProjectNature { @@ -34,7 +33,7 @@ public class YoctoSDKEmptyProjectNature implements IProjectNature { } public static void addYoctoSDKEmptyNature(IProject project, IProgressMonitor monitor) throws CoreException { - YoctoSDKUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor); + YoctoSDKNatureUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor); } } diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java new file mode 100644 index 0000000..d07dd03 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java @@ -0,0 +1,28 @@ +package org.yocto.sdk.ide.natures; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + +public class YoctoSDKNatureUtils { + + public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException + { + IProjectDescription description = project.getDescription(); + String[] natures = description.getNatureIds(); + + for (int i = 0; i < natures.length; ++i) { + if (natureId.equals(natures[i])) + return; + } + + String[] newNatures = new String[natures.length + 1]; + System.arraycopy(natures, 0, newNatures, 0, natures.length); + newNatures[natures.length] = natureId; + description.setNatureIds(newNatures); + project.setDescription(description, monitor); + + } + +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java index 2c6a782..a299aa4 100644 --- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java @@ -60,7 +60,7 @@ public class YoctoSDKProjectNature implements IProjectNature { } public static void addYoctoSDKNature(IProject project, IProgressMonitor monitor) throws CoreException { - YoctoSDKUtils.addNature(project, YoctoSDK_NATURE_ID, monitor); + YoctoSDKNatureUtils.addNature(project, YoctoSDK_NATURE_ID, monitor); } public static void configureAutotoolsOptions(IProject project) { diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java index c37e4fe..621aabf 100644 --- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java @@ -38,10 +38,8 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.debug.core.DebugPlugin; @@ -631,24 +629,6 @@ public class YoctoSDKUtils { } - public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException - { - IProjectDescription description = project.getDescription(); - String[] natures = description.getNatureIds(); - - for (int i = 0; i < natures.length; ++i) { - if (natureId.equals(natures[i])) - return; - } - - String[] newNatures = new String[natures.length + 1]; - System.arraycopy(natures, 0, newNatures, 0, natures.length); - newNatures[natures.length] = natureId; - description.setNatureIds(newNatures); - project.setDescription(description, monitor); - - } - public static String getPlatformArch() { String value = null; -- 1.7.9.5 _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto