Changeset 47

Show
Ignore:
Timestamp:
06/19/08 20:53:58 (7 months ago)
Author:
mb0
Message:

NEW - # 61: compiler cannot find flex-config.xml
http://axdt.org/ticket/61

also fixes # 60 http://axdt.org/ticket/60

renames flex3sdk plugin activator

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • axdt/trunk/org.axdt.as3.launcher/src/org/axdt/as3/launcher/AS3LauncherDelegate.java

    r46 r47  
    4040                        AS3CompilerTarget target = compiler.getTargetFor(file); 
    4141                        monitor.beginTask("Compiling Targets", 100); 
    42                         compiler.compile(target, monitor); 
     42                        boolean successful = compiler.compile(target, monitor); 
    4343                        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                        } 
    6047                } catch (Exception e) { 
    6148                        e.printStackTrace(); 
     
    6350        } 
    6451 
     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 
    6571} 
  • axdt/trunk/org.axdt.as3/src/org/axdt/as3/compiler/AS3Compiler.java

    r43 r47  
    6262 
    6363        @Override 
    64         public void compile(AS3CompilerTarget target, IProgressMonitor monitor) 
     64        public boolean compile(AS3CompilerTarget target, IProgressMonitor monitor) 
    6565                        throws Exception { 
    6666                if (defaultCompiler == null) { 
    6767                        defaultCompiler = getDefaultCompiler(); 
    6868                } 
    69                 defaultCompiler.compile(target, monitor); 
     69                return defaultCompiler.compile(target, monitor); 
    7070        } 
    7171 
  • axdt/trunk/org.axdt.as3/src/org/axdt/as3/compiler/IAS3Compiler.java

    r43 r47  
    55public interface IAS3Compiler { 
    66 
    7         void compile(AS3CompilerTarget target, IProgressMonitor monitor) throws Exception; 
     7        boolean compile(AS3CompilerTarget target, IProgressMonitor monitor) throws Exception; 
    88         
    99} 
  • axdt/trunk/org.axdt.flex3sdk/META-INF/MANIFEST.MF

    r43 r47  
    44Bundle-SymbolicName: org.axdt.flex3sdk;singleton:=true 
    55Bundle-Version: 0.0.2 
    6 Bundle-Activator: org.axdt.flex3sdk.Activator 
     6Bundle-Activator: org.axdt.flex3sdk.Flex3SDKPlugin 
    77Bundle-Vendor: http://axdt.org 
    88Require-Bundle: org.eclipse.core.runtime, 
  • axdt/trunk/org.axdt.flex3sdk/src/org/axdt/flex3sdk/Flex3Compiler.java

    r43 r47  
    33import java.io.File; 
    44import java.io.FileNotFoundException; 
     5import java.net.URL; 
    56 
    67import org.axdt.as3.AS3Plugin; 
     
    89import org.axdt.as3.compiler.IAS3Compiler; 
    910import org.eclipse.core.runtime.IProgressMonitor; 
     11import org.eclipse.core.runtime.Path; 
    1012import org.eclipse.core.runtime.SubProgressMonitor; 
    1113 
     
    2224         
    2325        @Override 
    24         public void compile(AS3CompilerTarget target, IProgressMonitor monitor) 
     26        public boolean compile(AS3CompilerTarget target, IProgressMonitor monitor) 
    2527                        throws Exception { 
    2628                Application app = target.getAdapter(Application.class); 
     
    3638                } 
    3739                app.setProgressMeter(new ProgressMonitor(monitor,target.getDeployName())); 
    38                 app.build(true); 
     40                long status = app.build(true); 
    3941                app.setProgressMeter(null); 
     42                return status != 0; 
    4043        } 
    4144         
     
    4649                app.setOutput(file); 
    4750                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); 
    4855                File[] sourcePaths = target.getSourcePaths(); 
    4956                config.addSourcePath(sourcePaths); 
     
    5461 
    5562        public void log(Message msg, int arg1, String arg2) { 
    56               if (!msg.getLevel().equals(Message.INFO)) 
     63//            if (!msg.getLevel().equals(Message.INFO)) 
    5764                        AS3Plugin.getInstance().writeInfoMsg(msg.toString()); 
    5865        } 
  • axdt/trunk/org.axdt.flex3sdk/src/org/axdt/flex3sdk/Flex3SDKPlugin.java

    r31 r47  
    11package org.axdt.flex3sdk; 
    22 
     3import java.io.IOException; 
     4import java.net.URL; 
     5 
     6import org.eclipse.core.runtime.FileLocator; 
     7import org.eclipse.core.runtime.IPath; 
     8import org.eclipse.core.runtime.Platform; 
    39import org.eclipse.core.runtime.Plugin; 
     10import org.osgi.framework.Bundle; 
    411import org.osgi.framework.BundleContext; 
    512 
     
    714 * The activator class controls the plug-in life cycle 
    815 */ 
    9 public class Activator extends Plugin { 
     16public class Flex3SDKPlugin extends Plugin { 
    1017 
    1118        // The plug-in ID 
     
    1320 
    1421        // The shared instance 
    15         private static Activator plugin; 
     22        private static Flex3SDKPlugin plugin; 
    1623         
    1724        /** 
    1825         * The constructor 
    1926         */ 
    20         public Activator() { 
     27        public Flex3SDKPlugin() { 
    2128        } 
    2229 
     
    4451         * @return the shared instance 
    4552         */ 
    46         public static Activator getDefault() { 
     53        public static Flex3SDKPlugin getDefault() { 
    4754                return plugin; 
    4855        } 
    4956 
     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        } 
    5069}