mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Repair m2e configurer in Windows
This commit is contained in:
parent
5bb3cbde65
commit
ff469f4cc4
|
@ -1,5 +1,6 @@
|
||||||
package org.teavm.eclipse.m2e;
|
package org.teavm.eclipse.m2e;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -57,8 +58,11 @@ public class TeaVMProjectConfigurator extends AbstractProjectConfigurator {
|
||||||
}
|
}
|
||||||
monitor.beginTask("Configuring TeaVM builder", sz * 1000);
|
monitor.beginTask("Configuring TeaVM builder", sz * 1000);
|
||||||
TeaVMProjectSettings settings = teaVMPlugin.getSettings(project);
|
TeaVMProjectSettings settings = teaVMPlugin.getSettings(project);
|
||||||
settings.load();
|
|
||||||
try {
|
try {
|
||||||
|
if (!hasNature) {
|
||||||
|
teaVMPlugin.addNature(new SubProgressMonitor(monitor, 1000), project);
|
||||||
|
}
|
||||||
|
settings.load();
|
||||||
Set<String> coveredProfiles = new HashSet<>();
|
Set<String> coveredProfiles = new HashSet<>();
|
||||||
for (MojoExecution execution : executions) {
|
for (MojoExecution execution : executions) {
|
||||||
if (monitor.isCanceled()) {
|
if (monitor.isCanceled()) {
|
||||||
|
@ -82,9 +86,6 @@ public class TeaVMProjectConfigurator extends AbstractProjectConfigurator {
|
||||||
settings.deleteProfile(profile);
|
settings.deleteProfile(profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasNature) {
|
|
||||||
teaVMPlugin.addNature(new SubProgressMonitor(monitor, 1000), project);
|
|
||||||
}
|
|
||||||
settings.save();
|
settings.save();
|
||||||
} finally {
|
} finally {
|
||||||
monitor.done();
|
monitor.done();
|
||||||
|
@ -179,10 +180,9 @@ public class TeaVMProjectConfigurator extends AbstractProjectConfigurator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String absolutePathToWorkspacePath(String path) {
|
private String absolutePathToWorkspacePath(String path) {
|
||||||
try {
|
|
||||||
IStringVariableManager varManager = VariablesPlugin.getDefault().getStringVariableManager();
|
IStringVariableManager varManager = VariablesPlugin.getDefault().getStringVariableManager();
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
IContainer[] containers = root.findContainersForLocationURI(new URI("file://" + path));
|
IContainer[] containers = root.findContainersForLocationURI(new File(path).toURI());
|
||||||
if (containers.length == 0) {
|
if (containers.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -194,9 +194,6 @@ public class TeaVMProjectConfigurator extends AbstractProjectConfigurator {
|
||||||
}
|
}
|
||||||
path = container.getFullPath().toString();
|
path = container.getFullPath().toString();
|
||||||
return varManager.generateVariableExpression("workspace_loc", path) + suffix;
|
return varManager.generateVariableExpression("workspace_loc", path) + suffix;
|
||||||
} catch (URISyntaxException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TeaVMRuntimeMode getRuntimeMode(String name) {
|
private TeaVMRuntimeMode getRuntimeMode(String name) {
|
||||||
|
|
|
@ -53,8 +53,11 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
|
||||||
private String projectName;
|
private String projectName;
|
||||||
|
|
||||||
public PreferencesBasedTeaVMProjectSettings(IProject project) {
|
public PreferencesBasedTeaVMProjectSettings(IProject project) {
|
||||||
ProjectScope scope = new ProjectScope(project);
|
this(project, new ProjectScope(project).getNode(TeaVMEclipsePlugin.ID));
|
||||||
globalPreferences = scope.getNode(TeaVMEclipsePlugin.ID);
|
}
|
||||||
|
|
||||||
|
public PreferencesBasedTeaVMProjectSettings(IProject project, IEclipsePreferences preferences) {
|
||||||
|
globalPreferences = preferences;
|
||||||
projectName = project.getName();
|
projectName = project.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,18 +16,21 @@
|
||||||
package org.teavm.eclipse;
|
package org.teavm.eclipse;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
import org.eclipse.jface.operation.IRunnableContext;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -90,6 +93,14 @@ public class TeaVMEclipsePlugin extends AbstractUIPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNature(IProgressMonitor progressMonitor, IProject project) throws CoreException {
|
public void addNature(IProgressMonitor progressMonitor, IProject project) throws CoreException {
|
||||||
|
ProjectScope scope = new ProjectScope(project);
|
||||||
|
try {
|
||||||
|
IEclipsePreferences prefs = scope.getNode(TeaVMEclipsePlugin.ID);
|
||||||
|
prefs.flush();
|
||||||
|
settingsMap.put(project, new PreferencesBasedTeaVMProjectSettings(project, prefs));
|
||||||
|
} catch (BackingStoreException e) {
|
||||||
|
throw new RuntimeException("Error creating preferences", e);
|
||||||
|
}
|
||||||
IProjectDescription projectDescription = project.getDescription();
|
IProjectDescription projectDescription = project.getDescription();
|
||||||
String[] natureIds = projectDescription.getNatureIds();
|
String[] natureIds = projectDescription.getNatureIds();
|
||||||
natureIds = Arrays.copyOf(natureIds, natureIds.length + 1);
|
natureIds = Arrays.copyOf(natureIds, natureIds.length + 1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user