diff options
| author | Tom Schindl | 2013-05-29 09:20:49 +0000 |
|---|---|---|
| committer | Tom Schindl | 2013-05-29 09:20:49 +0000 |
| commit | 7e5d70ec0ddd62801a2629db6b0675f91ca7a594 (patch) | |
| tree | 8dfe8523c402c090e76aa5257afbd6a04e668e16 | |
| parent | 6f5fc85d7f00b7988f626c52b71c9899ca70b499 (diff) | |
| download | org.eclipse.efxclipse-7e5d70ec0ddd62801a2629db6b0675f91ca7a594.tar.gz org.eclipse.efxclipse-7e5d70ec0ddd62801a2629db6b0675f91ca7a594.tar.xz org.eclipse.efxclipse-7e5d70ec0ddd62801a2629db6b0675f91ca7a594.zip | |
NEW - bug 409358: Running generated ant file fails with Class not found:
javac1.8
2 files changed, 41 insertions, 6 deletions
diff --git a/bundles/tooling/org.eclipse.fx.ide.jdt.ui/META-INF/MANIFEST.MF b/bundles/tooling/org.eclipse.fx.ide.jdt.ui/META-INF/MANIFEST.MF index d0f86b2b9..33dad00ea 100755 --- a/bundles/tooling/org.eclipse.fx.ide.jdt.ui/META-INF/MANIFEST.MF +++ b/bundles/tooling/org.eclipse.fx.ide.jdt.ui/META-INF/MANIFEST.MF @@ -44,7 +44,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.help.ui;bundle-version="3.5.100", org.eclipse.help.webapp;bundle-version="3.6.0", org.eclipse.equinox.http.jetty;bundle-version="2.0.100", - org.eclipse.emf.ecore.xmi;bundle-version="2.7.0" + org.eclipse.emf.ecore.xmi;bundle-version="2.7.0", + org.eclipse.fx.core;bundle-version="0.8.1", + org.eclipse.fx.osgi.util;bundle-version="0.8.1" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/tooling/org.eclipse.fx.ide.jdt.ui/src/org/eclipse/fx/ide/jdt/ui/internal/handler/AbstractBuildHandler.java b/bundles/tooling/org.eclipse.fx.ide.jdt.ui/src/org/eclipse/fx/ide/jdt/ui/internal/handler/AbstractBuildHandler.java index 85bf27d42..2d59753bf 100755 --- a/bundles/tooling/org.eclipse.fx.ide.jdt.ui/src/org/eclipse/fx/ide/jdt/ui/internal/handler/AbstractBuildHandler.java +++ b/bundles/tooling/org.eclipse.fx.ide.jdt.ui/src/org/eclipse/fx/ide/jdt/ui/internal/handler/AbstractBuildHandler.java @@ -25,6 +25,8 @@ import org.eclipse.core.externaltools.internal.IExternalToolConstants; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
@@ -34,11 +36,14 @@ import org.eclipse.debug.ui.DebugUITools; import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.fx.core.log.Logger;
import org.eclipse.fx.ide.jdt.ui.internal.JavaFXUIPlugin;
import org.eclipse.fx.ide.jdt.ui.internal.editors.model.anttasks.AntTask;
+import org.eclipse.fx.osgi.util.LoggerCreator;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstall3;
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.VMStandin;
@@ -64,15 +69,14 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.Bundle;
-/**
- * @author Tom Schindl
- *
- */
@SuppressWarnings( "restriction" )
public abstract class AbstractBuildHandler extends AbstractAntHandler {
-
+
+ private static Logger LOGGER = LoggerCreator.createLogger(AbstractBuildHandler.class);
+
@Override
public Object execute( ExecutionEvent event ) throws ExecutionException {
IEvaluationContext context = (IEvaluationContext) event.getApplicationContext();
@@ -175,6 +179,10 @@ public abstract class AbstractBuildHandler extends AbstractAntHandler { }
}
+ if( isAnt18AndJDK8(install) ) {
+ cfg.setAttribute( "org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", "-Dbuild.compiler=javac1.7" );
+ }
+
cfg.doSave();
return cfg;
}
@@ -182,11 +190,36 @@ public abstract class AbstractBuildHandler extends AbstractAntHandler { }
static boolean isJDK(IVMInstall install) {
+ if( install == null ) {
+ return false;
+ }
File f = install.getInstallLocation();
File tools = new File(new File( f, "lib" ), "tools.jar");
return tools.exists();
}
+ static boolean isAnt18AndJDK8(IVMInstall install) {
+ boolean rv = true;
+ try {
+ if( install instanceof IVMInstall3 ) {
+ String version = ((IVMInstall3)install).evaluateSystemProperties(new String[] {"java.version"}, new NullProgressMonitor()).get("java.version");
+ if( version != null ) {
+ rv = version.startsWith("1.8.0");
+ }
+ }
+
+ if( rv ) {
+ Bundle b = Platform.getBundle("org.apache.ant");
+ if( b.getVersion().toString().startsWith("1.9") ) {
+ return false;
+ }
+ }
+ } catch (CoreException e) {
+ LOGGER.error("Unable to detect java version", e);
+ }
+ return rv;
+ }
+
static class JDKSelectionDialog extends TitleAreaDialog {
private TableViewer viewer;
|
