mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Merge branch 'master' into tycho-build
Conflicts: teavm-eclipse/teavm-eclipse-plugin/META-INF/MANIFEST.MF
This commit is contained in:
commit
5f4d8ded11
|
@ -38,6 +38,7 @@
|
|||
<module>teavm-eclipse-plugin</module>
|
||||
<module>teavm-eclipse-m2e-plugin</module>
|
||||
<module>teavm-eclipse-feature</module>
|
||||
<module>teavm-eclipse-m2e-feature</module>
|
||||
<module>teavm-eclipse-updatesite</module>
|
||||
</modules>
|
||||
|
||||
|
|
|
@ -19,9 +19,8 @@
|
|||
|
||||
<parent>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm</artifactId>
|
||||
<artifactId>teavm-eclipse</artifactId>
|
||||
<version>0.2-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>teavm-eclipse-core-plugin</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
|
@ -60,6 +59,8 @@
|
|||
<arguments>
|
||||
<item>-f</item>
|
||||
<item>dep-pom.xml</item>
|
||||
<item>clean</item>
|
||||
<item>package</item>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
@ -237,7 +237,7 @@
|
|||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="teavm-eclipse-plugin"
|
||||
id="teavm-eclipse-core-plugin"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
|
|
|
@ -28,11 +28,16 @@
|
|||
|
||||
<packaging>eclipse-feature</packaging>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>teavm</id>
|
||||
<url>${project.baseUri}../teavm-eclipse-repository/target/repository</url>
|
||||
<layout>p2</layout>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-eclipse-core-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-eclipse-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,13 +1,15 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: TeaVM plugin for m2e
|
||||
Bundle-SymbolicName: teavm-eclipse-m2-plugin;singleton:=true
|
||||
Bundle-SymbolicName: teavm-eclipse-m2e-plugin;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Vendor: Alexey Andreev <konsoletyper@gmail.com>
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Require-Bundle: teavm-eclipse-plugin;bundle-version="[0.2,0.3)",
|
||||
org.eclipse.m2e.core;bundle-version="[1.3,2)",
|
||||
org.eclipse.core.runtime;bundle-version="[3.8.0,4.0)",
|
||||
org.eclipse.core.runtime;bundle-version="[3.8,4.0)",
|
||||
org.eclipse.m2e.maven.runtime;bundle-version="[1.3,2)",
|
||||
org.eclipse.core.resources;bundle-version="[3.6,4)",
|
||||
org.eclipse.ui;bundle-version="[3.6,4.0)"
|
||||
org.eclipse.core.variables;bundle-version="[3.2,4)",
|
||||
org.eclipse.ui;bundle-version="[3.6,4.0)",
|
||||
org.eclipse.jdt.core;bundle-version="[3.8,4.0.0)"
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
package org.teavm.eclipse.m2e;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.variables.IStringVariableManager;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.jdt.core.IJavaProject;
|
||||
import org.eclipse.jdt.core.JavaCore;
|
||||
import org.eclipse.m2e.core.MavenPlugin;
|
||||
import org.eclipse.m2e.core.embedder.IMaven;
|
||||
import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator;
|
||||
|
@ -16,29 +24,32 @@ import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest;
|
|||
import org.teavm.eclipse.TeaVMEclipsePlugin;
|
||||
import org.teavm.eclipse.TeaVMProfile;
|
||||
import org.teavm.eclipse.TeaVMProjectSettings;
|
||||
import org.teavm.eclipse.TeaVMRuntimeMode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public class TeaVMProjectConfigurator extends AbstractProjectConfigurator {
|
||||
private static final String TOOL_ID = "teavm-eclipse-m2e-plugin.tool";
|
||||
private static final String TEAVM_ARTIFACT_ID = "teavm-maven-plugin";
|
||||
private static final String TEAVM_GROUP_ID = "org.teavm";
|
||||
private static final String TEAVM_MAIN_GOAL = "build-javascript";
|
||||
private int executionIdGenerator;
|
||||
private Set<String> usedExecutionIds = new HashSet<>();
|
||||
private IMaven maven;
|
||||
private MavenProject mavenProject;
|
||||
private MavenSession mavenSession;
|
||||
private IProject project;
|
||||
|
||||
@Override
|
||||
public void configure(ProjectConfigurationRequest configurationRequest, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
maven = MavenPlugin.getMaven();
|
||||
mavenProject = configurationRequest.getMavenProject();
|
||||
mavenSession = configurationRequest.getMavenSession();
|
||||
List<MojoExecution> executions = configurationRequest.getMavenProjectFacade().getMojoExecutions(
|
||||
TEAVM_GROUP_ID, TEAVM_ARTIFACT_ID, monitor, TEAVM_MAIN_GOAL);
|
||||
TeaVMEclipsePlugin teaVMPlugin = TeaVMEclipsePlugin.getDefault();
|
||||
IProject project = configurationRequest.getProject();
|
||||
project = configurationRequest.getProject();
|
||||
boolean hasNature = project.hasNature(TeaVMEclipsePlugin.NATURE_ID);
|
||||
int sz = executions.size();
|
||||
if (!hasNature) {
|
||||
|
@ -48,21 +59,29 @@ public class TeaVMProjectConfigurator extends AbstractProjectConfigurator {
|
|||
TeaVMProjectSettings settings = teaVMPlugin.getSettings(project);
|
||||
settings.load();
|
||||
try {
|
||||
Set<String> coveredProfiles = new HashSet<>();
|
||||
for (MojoExecution execution : executions) {
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
String profileId = getIdForProfile(execution);
|
||||
coveredProfiles.add(profileId);
|
||||
TeaVMProfile profile = settings.getProfile(profileId);
|
||||
if (profile == null) {
|
||||
profile = settings.createProfile();
|
||||
profile.setName(profileId);
|
||||
}
|
||||
profile.setExternalToolId(TOOL_ID);
|
||||
configureProfile(execution, profile, new SubProgressMonitor(monitor, 1000));
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (TeaVMProfile profile : settings.getProfiles()) {
|
||||
if (!coveredProfiles.contains(profile.getName()) && profile.getExternalToolId().equals(TOOL_ID)) {
|
||||
settings.deleteProfile(profile);
|
||||
}
|
||||
}
|
||||
if (!hasNature) {
|
||||
teaVMPlugin.addNature(new SubProgressMonitor(monitor, 1000), project);
|
||||
}
|
||||
|
@ -74,19 +93,120 @@ public class TeaVMProjectConfigurator extends AbstractProjectConfigurator {
|
|||
|
||||
private void configureProfile(MojoExecution execution, TeaVMProfile profile, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
monitor.beginTask("Configuring profile " + profile.getName(), 30);
|
||||
String mainClass = maven.getMojoParameterValue(mavenProject, execution, "mainClass", String.class,
|
||||
new SubProgressMonitor(monitor, 10));
|
||||
monitor.beginTask("Configuring profile " + profile.getName(), 110);
|
||||
String buildDir = getProjectBuildDirectory();
|
||||
|
||||
String mainClass = maven.getMojoParameterValue(mavenSession, execution, "mainClass", String.class);
|
||||
profile.setMainClass(mainClass);
|
||||
String targetDir = maven.getMojoParameterValue(mavenProject, execution, "targetDirectory", String.class,
|
||||
new SubProgressMonitor(monitor, 10));
|
||||
profile.setTargetDirectory(targetDir);
|
||||
String targetFileName = maven.getMojoParameterValue(mavenProject, execution, "targetFileName", String.class,
|
||||
new SubProgressMonitor(monitor, 10));
|
||||
monitor.worked(10);
|
||||
|
||||
String targetDir = maven.getMojoParameterValue(mavenSession, execution, "targetDirectory", String.class);
|
||||
profile.setTargetDirectory(targetDir != null ? absolutePathToWorkspacePath(targetDir) :
|
||||
buildDir + "/javascript");
|
||||
monitor.worked(10);
|
||||
|
||||
String targetFileName = maven.getMojoParameterValue(mavenSession, execution, "targetFileName", String.class);
|
||||
profile.setTargetFileName(targetFileName != null ? targetFileName : "classes.js");
|
||||
monitor.worked(10);
|
||||
|
||||
Boolean minifying = maven.getMojoParameterValue(mavenSession, execution, "minifying", Boolean.class);
|
||||
profile.setMinifying(minifying != null ? minifying : true);
|
||||
monitor.worked(10);
|
||||
|
||||
String runtime = maven.getMojoParameterValue(mavenSession, execution, "runtime", String.class);
|
||||
profile.setRuntimeMode(runtime != null ? getRuntimeMode(runtime) : TeaVMRuntimeMode.SEPARATE);
|
||||
monitor.worked(10);
|
||||
|
||||
Properties properties = maven.getMojoParameterValue(mavenSession, execution, "properties", Properties.class);
|
||||
profile.setProperties(properties != null ? properties : new Properties());
|
||||
monitor.worked(10);
|
||||
|
||||
Boolean debug = maven.getMojoParameterValue(mavenSession, execution, "debugInformationGenerated",
|
||||
Boolean.class);
|
||||
profile.setDebugInformationGenerated(debug != null ? debug : false);
|
||||
monitor.worked(10);
|
||||
|
||||
Boolean sourceMaps = maven.getMojoParameterValue(mavenSession, execution, "sourceMapsGenerated",
|
||||
Boolean.class);
|
||||
profile.setSourceMapsGenerated(sourceMaps != null ? sourceMaps : false);
|
||||
monitor.worked(10);
|
||||
|
||||
Boolean incremental = maven.getMojoParameterValue(mavenSession, execution, "incremental", Boolean.class);
|
||||
profile.setIncremental(incremental != null ? incremental : false);
|
||||
monitor.worked(10);
|
||||
|
||||
String cacheDir = maven.getMojoParameterValue(mavenSession, execution, "cacheDirectory", String.class);
|
||||
profile.setCacheDirectory(cacheDir != null ? absolutePathToWorkspacePath(cacheDir) :
|
||||
buildDir + "/teavm-cache");
|
||||
monitor.worked(10);
|
||||
|
||||
String[] transformers = maven.getMojoParameterValue(mavenSession, execution, "transformers", String[].class);
|
||||
profile.setTransformers(transformers != null ? transformers : new String[0]);
|
||||
monitor.worked(10);
|
||||
|
||||
profile.setClassAliases(readClassAliases(execution));
|
||||
monitor.worked(10);
|
||||
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
private Map<String, String> readClassAliases(MojoExecution execution) {
|
||||
Map<String, String> aliases = new HashMap<>();
|
||||
Xpp3Dom aliasesElem = execution.getConfiguration().getChild("classAliases");
|
||||
if (aliasesElem != null) {
|
||||
for (Xpp3Dom item : aliasesElem.getChildren()) {
|
||||
String className = item.getChild("className").getValue();
|
||||
String alias = item.getChild("alias").getValue();
|
||||
aliases.put(className, alias);
|
||||
}
|
||||
}
|
||||
return aliases;
|
||||
}
|
||||
|
||||
private String getProjectBuildDirectory() throws CoreException {
|
||||
IStringVariableManager varManager = VariablesPlugin.getDefault().getStringVariableManager();
|
||||
if (!project.hasNature(JavaCore.NATURE_ID)) {
|
||||
return varManager.generateVariableExpression("workspace_loc", "/" + project.getName());
|
||||
}
|
||||
IJavaProject javaProject = JavaCore.create(project);
|
||||
String path = javaProject.getOutputLocation().toString();
|
||||
return varManager.generateVariableExpression("workspace_loc", path);
|
||||
}
|
||||
|
||||
private String absolutePathToWorkspacePath(String path) {
|
||||
try {
|
||||
IStringVariableManager varManager = VariablesPlugin.getDefault().getStringVariableManager();
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
IContainer[] containers = root.findContainersForLocationURI(new URI("file://" + path));
|
||||
if (containers.length == 0) {
|
||||
return null;
|
||||
}
|
||||
IContainer container = containers[0];
|
||||
String suffix = "";
|
||||
while (!(container instanceof IProject)) {
|
||||
suffix = "/" + container.getName() + suffix;
|
||||
container = container.getParent();
|
||||
}
|
||||
path = container.getFullPath().toString();
|
||||
return varManager.generateVariableExpression("workspace_loc", path) + suffix;
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private TeaVMRuntimeMode getRuntimeMode(String name) {
|
||||
switch (name) {
|
||||
case "SEPARATE":
|
||||
return TeaVMRuntimeMode.SEPARATE;
|
||||
case "MERGED":
|
||||
return TeaVMRuntimeMode.MERGE;
|
||||
case "NONE":
|
||||
return TeaVMRuntimeMode.NONE;
|
||||
default:
|
||||
return TeaVMRuntimeMode.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
private String getIdForProfile(MojoExecution pluginExecution) {
|
||||
String executionId = pluginExecution.getExecutionId();
|
||||
if (executionId != null && usedExecutionIds.add(executionId)) {
|
||||
|
|
|
@ -23,6 +23,5 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0)",
|
|||
org.eclipse.core.databinding.observable;bundle-version="[1.4.1,2)",
|
||||
org.eclipse.jface.databinding;bundle-version="[1.6.0,2)",
|
||||
teavm-eclipse-core-plugin;bundle-version="0.2.0"
|
||||
Bundle-ClassPath: .
|
||||
Export-Package: org.teavm.eclipse.debugger,org.teavm.eclipse
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
|
|
@ -50,4 +50,4 @@
|
|||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -43,6 +43,7 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
|
|||
public static final String PROPERTIES = "properties";
|
||||
public static final String CLASSES = "classes";
|
||||
public static final String TRANSFORMERS = "transformers";
|
||||
public static final String EXTERNAL_TOOL_ID = "externalTool";
|
||||
|
||||
private static final String NEW_PROFILE_NAME = "New profile";
|
||||
private List<ProfileImpl> profiles = new ArrayList<>();
|
||||
|
@ -71,7 +72,7 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
|
|||
if (profileMap.get(profile.getName()) != profile) {
|
||||
return;
|
||||
}
|
||||
profileMap.remove(profile);
|
||||
profileMap.remove(profile.getName());
|
||||
profiles.remove(profile);
|
||||
}
|
||||
|
||||
|
@ -109,7 +110,8 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
|
|||
}
|
||||
for (String key : globalPreferences.childrenNames()) {
|
||||
if (!profileMap.containsKey(key)) {
|
||||
globalPreferences.node(key).removeNode();
|
||||
Preferences node = globalPreferences.node(key);
|
||||
node.removeNode();
|
||||
}
|
||||
}
|
||||
globalPreferences.flush();
|
||||
|
@ -160,7 +162,8 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
|
|||
private boolean debugInformationGenerated;
|
||||
private Properties properties = new Properties();
|
||||
private String[] transformers = new String[0];
|
||||
private Map<String, String> classeAliases = new HashMap<>();
|
||||
private Map<String, String> classAliases = new HashMap<>();
|
||||
private String externalToolId = "";
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -293,12 +296,12 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
|
|||
|
||||
@Override
|
||||
public Map<String, String> getClassAliases() {
|
||||
return new HashMap<>(classeAliases);
|
||||
return new HashMap<>(classAliases);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClassAliases(Map<String, String> classAliases) {
|
||||
this.classeAliases = new HashMap<>(classAliases);
|
||||
this.classAliases = new HashMap<>(classAliases);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -311,6 +314,16 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
|
|||
this.transformers = transformers.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExternalToolId() {
|
||||
return externalToolId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExternalToolId(String toolId) {
|
||||
this.externalToolId = toolId;
|
||||
}
|
||||
|
||||
public void load() throws BackingStoreException {
|
||||
preferences.sync();
|
||||
enabled = preferences.getBoolean(ENABLED, true);
|
||||
|
@ -335,8 +348,9 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
|
|||
Preferences classesPrefs = preferences.node(CLASSES);
|
||||
classesPrefs.sync();
|
||||
for (String key : classesPrefs.keys()) {
|
||||
classeAliases.put(key, classesPrefs.get(key, "_"));
|
||||
classAliases.put(key, classesPrefs.get(key, "_"));
|
||||
}
|
||||
externalToolId = preferences.get(EXTERNAL_TOOL_ID, "");
|
||||
}
|
||||
|
||||
public void save() throws BackingStoreException {
|
||||
|
@ -365,10 +379,11 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
|
|||
transformersPrefs.flush();
|
||||
Preferences classesPrefs = preferences.node(CLASSES);
|
||||
classesPrefs.clear();
|
||||
for (String key : classeAliases.keySet()) {
|
||||
classesPrefs.put(key, classeAliases.get(key));
|
||||
for (String key : classAliases.keySet()) {
|
||||
classesPrefs.put(key, classAliases.get(key));
|
||||
}
|
||||
classesPrefs.flush();
|
||||
preferences.put(EXTERNAL_TOOL_ID, externalToolId);
|
||||
preferences.flush();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,4 +78,8 @@ public interface TeaVMProfile {
|
|||
Map<String, String> getClassAliases();
|
||||
|
||||
void setClassAliases(Map<String, String> classAliases);
|
||||
|
||||
String getExternalToolId();
|
||||
|
||||
void setExternalToolId(String toolId);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TeaVMProjectBuilder extends IncrementalProjectBuilder {
|
|||
tool.setDebugInformationGenerated(profile.isDebugInformationGenerated());
|
||||
tool.setSourceMapsFileGenerated(profile.isSourceMapsGenerated());
|
||||
String targetDir = profile.getTargetDirectory();
|
||||
tool.setTargetDirectory(new File(varManager.performStringSubstitution(targetDir)));
|
||||
tool.setTargetDirectory(new File(varManager.performStringSubstitution(targetDir, false)));
|
||||
tool.setTargetFileName(profile.getTargetFileName());
|
||||
tool.setMinifying(profile.isMinifying());
|
||||
tool.setRuntime(mapRuntime(profile.getRuntimeMode()));
|
||||
|
@ -107,7 +107,8 @@ public class TeaVMProjectBuilder extends IncrementalProjectBuilder {
|
|||
tool.getProperties().putAll(profile.getProperties());
|
||||
tool.setIncremental(profile.isIncremental());
|
||||
String cacheDir = profile.getCacheDirectory();
|
||||
tool.setCacheDirectory(!cacheDir.isEmpty() ? new File(varManager.performStringSubstitution(cacheDir)) : null);
|
||||
tool.setCacheDirectory(!cacheDir.isEmpty() ?
|
||||
new File(varManager.performStringSubstitution(cacheDir, false)) : null);
|
||||
for (ClassHolderTransformer transformer : instantiateTransformers(profile, classLoader)) {
|
||||
tool.getTransformers().add(transformer);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ import org.teavm.eclipse.TeaVMRuntimeMode;
|
|||
public class TeaVMProfileDialog extends Dialog {
|
||||
private static List<TeaVMRuntimeMode> runtimeModes = Arrays.asList(TeaVMRuntimeMode.SEPARATE,
|
||||
TeaVMRuntimeMode.MERGE, TeaVMRuntimeMode.NONE);
|
||||
private TabFolder tabFolder;
|
||||
private Text nameField;
|
||||
private Text mainClassField;
|
||||
private Button mainClassChooseButton;
|
||||
|
@ -107,7 +108,7 @@ public class TeaVMProfileDialog extends Dialog {
|
|||
area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
ScrolledComposite scrollContainer = new ScrolledComposite(area, SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
scrollContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
TabFolder tabFolder = new TabFolder(scrollContainer, SWT.TOP);
|
||||
tabFolder = new TabFolder(scrollContainer, SWT.TOP);
|
||||
scrollContainer.setContent(tabFolder);
|
||||
scrollContainer.setExpandHorizontal(true);
|
||||
scrollContainer.setExpandVertical(true);
|
||||
|
@ -644,6 +645,18 @@ public class TeaVMProfileDialog extends Dialog {
|
|||
cacheDirectoryWorkspaceButton.setEnabled(incrementalButton.getSelection());
|
||||
}
|
||||
|
||||
private static void setEnabledRecursive(Composite composite, boolean enabled) {
|
||||
Control[] children = composite.getChildren();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
if (children[i] instanceof Composite) {
|
||||
setEnabledRecursive((Composite) children[i], enabled);
|
||||
} else {
|
||||
children[i].setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
composite.setEnabled(enabled);
|
||||
}
|
||||
|
||||
private void load() {
|
||||
nameField.setText(profile.getName());
|
||||
mainClassField.setText(profile.getMainClass() != null ? profile.getMainClass() : "");
|
||||
|
@ -671,6 +684,11 @@ public class TeaVMProfileDialog extends Dialog {
|
|||
row.alias = entry.getValue();
|
||||
classAliases.add(row);
|
||||
}
|
||||
for (Control control : tabFolder.getTabList()) {
|
||||
if (control instanceof Composite) {
|
||||
setEnabledRecursive((Composite)control, profile.getExternalToolId().isEmpty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean save() {
|
||||
|
|
|
@ -99,6 +99,11 @@ public class TeaVMProjectPropertyPage extends PropertyPage implements IWorkbench
|
|||
TableColumn fileColumn = new TableColumn(profilesTable, SWT.LEFT);
|
||||
fileColumn.setText("Target file");
|
||||
fileColumn.setWidth(150);
|
||||
profilesTable.addSelectionListener(new SelectionAdapter() {
|
||||
@Override public void widgetSelected(SelectionEvent e) {
|
||||
updateTableSelection();
|
||||
}
|
||||
});
|
||||
|
||||
addProfileButton = new Button(container, SWT.PUSH);
|
||||
addProfileButton.setText("Add...");
|
||||
|
@ -130,6 +135,16 @@ public class TeaVMProjectPropertyPage extends PropertyPage implements IWorkbench
|
|||
return container;
|
||||
}
|
||||
|
||||
private void updateTableSelection() {
|
||||
if (profilesTable.getSelectionCount() != 1) {
|
||||
removeProfileButton.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
TableItem item = profilesTable.getSelection()[0];
|
||||
TeaVMProfile profile = (TeaVMProfile)item.getData();
|
||||
removeProfileButton.setEnabled(profile.getExternalToolId().isEmpty());
|
||||
}
|
||||
|
||||
private void loadProfiles() {
|
||||
try {
|
||||
settings.load();
|
||||
|
@ -197,6 +212,10 @@ public class TeaVMProjectPropertyPage extends PropertyPage implements IWorkbench
|
|||
return;
|
||||
}
|
||||
TableItem item = profilesTable.getSelection()[0];
|
||||
TeaVMProfile profile = (TeaVMProfile)item.getData();
|
||||
if (!profile.getExternalToolId().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
boolean confirmed = MessageDialog.openConfirm(getShell(), "Deletion confirmation",
|
||||
"Are you sure to delete profile " + item.getText(0) + "?");
|
||||
if (!confirmed) {
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<site>
|
||||
<feature url="features/teavm-eclipse-feature_0.2.0.qualifier.jar" id="teavm-eclipse-feature" version="0.2.0.qualifier" os="aix,hpux,linux,macosx,qnx,solaris,win32" ws="carbon,cocoa,gtk,motif,photon,win32,wpf" arch="ia64,ia64_32,PA_RISC,ppc,sparc,x86,x86_64">
|
||||
<category name="teavm-category"/>
|
||||
</feature>
|
||||
<category-def name="teavm-category" label="TeaVM"/>
|
||||
<feature url="features/teavm-eclipse-feature_0.2.0.qualifier.jar" id="teavm-eclipse-feature"
|
||||
version="0.2.0.qualifier">
|
||||
<category name="teavm-category"/>
|
||||
</feature>
|
||||
<feature url="features/teavm-eclipse-m2e-feature_0.2.0.qualifier.jar" id="teavm-eclipse-m2e-feature"
|
||||
version="0.2.0.qualifier">
|
||||
<category name="teavm-category"/>
|
||||
</feature>
|
||||
<category-def name="teavm-category" label="TeaVM"/>
|
||||
</site>
|
||||
|
|
|
@ -25,14 +25,18 @@
|
|||
</parent>
|
||||
<artifactId>teavm-eclipse-updatesite</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
|
||||
<packaging>eclipse-repository</packaging>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>teavm</id>
|
||||
<url>${project.baseUri}../teavm-eclipse-repository/target/repository</url>
|
||||
<layout>p2</layout>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-eclipse-feature</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-eclipse-m2e-feature</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,10 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<site>
|
||||
<description name="TeaVM update site">
|
||||
TeaVM update site
|
||||
</description>
|
||||
<feature url="features/teavm-eclipse-feature_0.2.0.qualifier.jar" id="teavm-eclipse-feature" version="0.0.0" os="aix,hpux,linux,macosx,qnx,solaris,win32" ws="carbon,cocoa,gtk,motif,photon,win32,wpf" arch="ia64,ia64_32,PA_RISC,ppc,sparc,x86,x86_64">
|
||||
<category name="teavm-eclipse-caregory"/>
|
||||
</feature>
|
||||
<category-def name="teavm-eclipse-caregory" label="TeaVM"/>
|
||||
<description name="TeaVM update site">
|
||||
TeaVM update site
|
||||
</description>
|
||||
<feature url="features/teavm-eclipse-feature_0.2.0.qualifier.jar" id="teavm-eclipse-feature" version="0.0.0">
|
||||
<category name="teavm-eclipse-caregory"/>
|
||||
</feature>
|
||||
<feature url="features/teavm-eclipse-m2e-feature_0.2.0.qualifier.jar" id="teavm-eclipse-m2e-feature" version="0.0.0">
|
||||
<category name="teavm-eclipse-caregory"/>
|
||||
</feature>
|
||||
<category-def name="teavm-eclipse-caregory" label="TeaVM"/>
|
||||
</site>
|
||||
|
|
Loading…
Reference in New Issue
Block a user