From 55c996cf2cd4030ea6dc1702873b1ec05bbae055 Mon Sep 17 00:00:00 2001 From: vrubezhny Date: Wed, 9 Apr 2014 18:08:00 +0400 Subject: [PATCH] Make AngularJS-eclipse 'convert project ...' action bevare of that Tern.java is able to treat a custom project nature as Tern nature. Signed-off-by: vrubezhny --- .../ui/handlers/ConvertProjectToAngularCommandHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.eclipse.angularjs.ui/src/org/eclipse/angularjs/internal/ui/handlers/ConvertProjectToAngularCommandHandler.java b/org.eclipse.angularjs.ui/src/org/eclipse/angularjs/internal/ui/handlers/ConvertProjectToAngularCommandHandler.java index 148ea27..1bcf4a3 100644 --- a/org.eclipse.angularjs.ui/src/org/eclipse/angularjs/internal/ui/handlers/ConvertProjectToAngularCommandHandler.java +++ b/org.eclipse.angularjs.ui/src/org/eclipse/angularjs/internal/ui/handlers/ConvertProjectToAngularCommandHandler.java @@ -31,6 +31,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.handlers.HandlerUtil; +import tern.eclipse.ide.core.IDETernProject; import tern.eclipse.ide.core.TernNature; /** @@ -52,6 +53,8 @@ public Object execute(ExecutionEvent event) throws ExecutionException { public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { + boolean adoptedToTern = IDETernProject.hasTernNature(project); + IProjectDescription projectDescription = project .getDescription(); @@ -81,8 +84,9 @@ public IStatus runInWorkspace(IProgressMonitor monitor) newNatures.add(natures[c]); } } + if (!adoptedToTern) // Add Tern Nature only if the project is not adopted + newNatures.add(TernNature.ID); newNatures.add(AngularNature.ID); - newNatures.add(TernNature.ID); projectDescription.setNatureIds((String[]) newNatures .toArray(new String[newNatures.size()]));