Changeset 47
- Timestamp:
- 06/19/08 20:53:58 (7 months ago)
- Files:
-
- axdt/trunk/org.axdt.as3.launcher/src/org/axdt/as3/launcher/AS3LauncherDelegate.java (modified) (2 diffs)
- axdt/trunk/org.axdt.as3/src/org/axdt/as3/compiler/AS3Compiler.java (modified) (1 diff)
- axdt/trunk/org.axdt.as3/src/org/axdt/as3/compiler/IAS3Compiler.java (modified) (1 diff)
- axdt/trunk/org.axdt.flex3sdk/META-INF/MANIFEST.MF (modified) (1 diff)
- axdt/trunk/org.axdt.flex3sdk/src/org/axdt/flex3sdk/Flex3Compiler.java (modified) (6 diffs)
- axdt/trunk/org.axdt.flex3sdk/src/org/axdt/flex3sdk/Flex3SDKPlugin.java (moved) (moved from axdt/trunk/org.axdt.flex3sdk/src/org/axdt/flex3sdk/Activator.java) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
axdt/trunk/org.axdt.as3.launcher/src/org/axdt/as3/launcher/AS3LauncherDelegate.java
r46 r47 40 40 AS3CompilerTarget target = compiler.getTargetFor(file); 41 41 monitor.beginTask("Compiling Targets", 100); 42 compiler.compile(target, monitor);42 boolean successful = compiler.compile(target, monitor); 43 43 monitor.done(); 44 final IPath deployFile = target.getDeployFile(); 45 final IPath deployPath = target.getDeployPath(); 46 Display.getDefault().asyncExec(new Runnable(){ 47 public void run(){ 48 IWorkbench workbench = PlatformUI.getWorkbench(); 49 IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); 50 IWorkbenchPage activePage = window.getActivePage(); 51 IContainer deployDir = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(deployPath); 52 try { 53 deployDir.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor()); 54 IDE.openEditor(activePage, deployFile.toFile().toURI(),"org.axdt.swfview.editor",false); 55 } catch (Exception e) { 56 e.printStackTrace(); 57 } 58 } 59 }); 44 if (successful) { 45 openSWFView(target); 46 } 60 47 } catch (Exception e) { 61 48 e.printStackTrace(); … … 63 50 } 64 51 52 private void openSWFView(AS3CompilerTarget target) { 53 final IPath deployFile = target.getDeployFile(); 54 final IPath deployPath = target.getDeployPath(); 55 Display.getDefault().asyncExec(new Runnable(){ 56 public void run(){ 57 IWorkbench workbench = PlatformUI.getWorkbench(); 58 IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); 59 IWorkbenchPage activePage = window.getActivePage(); 60 IContainer deployDir = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(deployPath); 61 try { 62 deployDir.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor()); 63 IDE.openEditor(activePage, deployFile.toFile().toURI(),"org.axdt.swfview.editor",false); 64 } catch (Exception e) { 65 e.printStackTrace(); 66 } 67 } 68 }); 69 } 70 65 71 } axdt/trunk/org.axdt.as3/src/org/axdt/as3/compiler/AS3Compiler.java
r43 r47 62 62 63 63 @Override 64 public voidcompile(AS3CompilerTarget target, IProgressMonitor monitor)64 public boolean compile(AS3CompilerTarget target, IProgressMonitor monitor) 65 65 throws Exception { 66 66 if (defaultCompiler == null) { 67 67 defaultCompiler = getDefaultCompiler(); 68 68 } 69 defaultCompiler.compile(target, monitor);69 return defaultCompiler.compile(target, monitor); 70 70 } 71 71 axdt/trunk/org.axdt.as3/src/org/axdt/as3/compiler/IAS3Compiler.java
r43 r47 5 5 public interface IAS3Compiler { 6 6 7 voidcompile(AS3CompilerTarget target, IProgressMonitor monitor) throws Exception;7 boolean compile(AS3CompilerTarget target, IProgressMonitor monitor) throws Exception; 8 8 9 9 } axdt/trunk/org.axdt.flex3sdk/META-INF/MANIFEST.MF
r43 r47 4 4 Bundle-SymbolicName: org.axdt.flex3sdk;singleton:=true 5 5 Bundle-Version: 0.0.2 6 Bundle-Activator: org.axdt.flex3sdk. Activator6 Bundle-Activator: org.axdt.flex3sdk.Flex3SDKPlugin 7 7 Bundle-Vendor: http://axdt.org 8 8 Require-Bundle: org.eclipse.core.runtime, axdt/trunk/org.axdt.flex3sdk/src/org/axdt/flex3sdk/Flex3Compiler.java
r43 r47 3 3 import java.io.File; 4 4 import java.io.FileNotFoundException; 5 import java.net.URL; 5 6 6 7 import org.axdt.as3.AS3Plugin; … … 8 9 import org.axdt.as3.compiler.IAS3Compiler; 9 10 import org.eclipse.core.runtime.IProgressMonitor; 11 import org.eclipse.core.runtime.Path; 10 12 import org.eclipse.core.runtime.SubProgressMonitor; 11 13 … … 22 24 23 25 @Override 24 public voidcompile(AS3CompilerTarget target, IProgressMonitor monitor)26 public boolean compile(AS3CompilerTarget target, IProgressMonitor monitor) 25 27 throws Exception { 26 28 Application app = target.getAdapter(Application.class); … … 36 38 } 37 39 app.setProgressMeter(new ProgressMonitor(monitor,target.getDeployName())); 38 app.build(true);40 long status = app.build(true); 39 41 app.setProgressMeter(null); 42 return status != 0; 40 43 } 41 44 … … 46 49 app.setOutput(file); 47 50 Configuration config = app.getDefaultConfiguration(); 51 Path path = new Path("flexsdk/frameworks/flex-config.xml"); 52 URL configURL = Flex3SDKPlugin.getBundleURL(path); 53 File confFile = new File(configURL.getPath()); 54 config.setConfiguration(confFile); 48 55 File[] sourcePaths = target.getSourcePaths(); 49 56 config.addSourcePath(sourcePaths); … … 54 61 55 62 public void log(Message msg, int arg1, String arg2) { 56 if (!msg.getLevel().equals(Message.INFO))63 // if (!msg.getLevel().equals(Message.INFO)) 57 64 AS3Plugin.getInstance().writeInfoMsg(msg.toString()); 58 65 } axdt/trunk/org.axdt.flex3sdk/src/org/axdt/flex3sdk/Flex3SDKPlugin.java
r31 r47 1 1 package org.axdt.flex3sdk; 2 2 3 import java.io.IOException; 4 import java.net.URL; 5 6 import org.eclipse.core.runtime.FileLocator; 7 import org.eclipse.core.runtime.IPath; 8 import org.eclipse.core.runtime.Platform; 3 9 import org.eclipse.core.runtime.Plugin; 10 import org.osgi.framework.Bundle; 4 11 import org.osgi.framework.BundleContext; 5 12 … … 7 14 * The activator class controls the plug-in life cycle 8 15 */ 9 public class Activatorextends Plugin {16 public class Flex3SDKPlugin extends Plugin { 10 17 11 18 // The plug-in ID … … 13 20 14 21 // The shared instance 15 private static Activatorplugin;22 private static Flex3SDKPlugin plugin; 16 23 17 24 /** 18 25 * The constructor 19 26 */ 20 public Activator() {27 public Flex3SDKPlugin() { 21 28 } 22 29 … … 44 51 * @return the shared instance 45 52 */ 46 public static ActivatorgetDefault() {53 public static Flex3SDKPlugin getDefault() { 47 54 return plugin; 48 55 } 49 56 57 public static URL getBundleURL(IPath path) { 58 Bundle bundle = Platform.getBundle(PLUGIN_ID); 59 URL[] urls = FileLocator.findEntries(bundle, path); 60 if (urls.length < 1) 61 return null; 62 try { 63 return FileLocator.resolve(urls[0]); 64 } catch (IOException e) { 65 e.printStackTrace(); 66 } 67 return null; 68 } 50 69 }
