This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 118144 - Run File action should save the file first
Summary: Run File action should save the file first
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: Denis Anisimov
URL:
Keywords:
: 121318 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-10-08 20:55 UTC by Pavel Buzek
Modified: 2008-02-22 13:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Buzek 2007-10-08 20:55:27 UTC
Run File should save the file, at least by default. Ant has an option for this that is on by default so most users will
expect that build/run actions in general save files. I think it is OK to just save the file for now, in future there can
perhaps be an option.

patch:
RCS file: /cvs/scripting/php/rtexplorer/src/org/netbeans/modules/php/rt/providers/impl/actions/RunCommand.java,v
retrieving revision 1.8
diff -u -r1.8 RunCommand.java
--- src/org/netbeans/modules/php/rt/providers/impl/actions/RunCommand.java      3 Oct 2007 17:37:49 -0000       1.8
+++ src/org/netbeans/modules/php/rt/providers/impl/actions/RunCommand.java      8 Oct 2007 19:50:38 -0000
@@ -50,6 +50,7 @@
 import org.netbeans.modules.php.rt.spi.providers.WebServerProvider;
 import org.netbeans.spi.project.ActionProvider;
 import org.openide.ErrorManager;
+import org.openide.LifecycleManager;
 import org.openide.awt.HtmlBrowser;
 import org.openide.filesystems.FileObject;
 import org.openide.util.Lookup;
@@ -100,6 +101,7 @@
         }
         else {
             for ( FileObject fileObject : getFileObjects() ) {
+                LifecycleManager.getDefault ().saveAll ();
                 String path = getRelativeSrcPath(fileObject);
                 if ( path != null ) {
                     path = '/'+path.replace( File.separatorChar, '/');

I also noticed that scripting\php\rtexplorer defines its own constant for run.local, this is a BAD practice, it makes it
hard to find the code - cannot user find usages on ActionProvider.COMMAND_RUN_SINGLE. Not to speak of the theoretical
possibility that somebody would change the value of ActionProvider.COMMAND_RUN_SINGLE.

   public static final String RUN_LOCAL_ACTION = "run.local"; // NOI18N
Comment 1 Andrew Korostelev 2007-10-25 14:13:55 UTC
file is now saved before run in command line.
It was already saved before upload.

Is still not saved before running on project - we plan to upload before running on server. Saving will be performed
during upload.
Comment 2 Andrew Korostelev 2007-11-12 15:39:36 UTC
fixed Nov 12, 2007.
I have used 
ProjectManager.getDefault().saveProject(getProject());
as previous solution.
It didn't save php files.

Comment 3 Andrew Korostelev 2007-11-12 15:57:57 UTC
*** Issue 121318 has been marked as a duplicate of this issue. ***
Comment 4 Andrew Korostelev 2007-11-19 12:36:40 UTC
About run.local id.
There are two run commands in php project:
- run on server
- run in command line

ActionProvider.COMMAND_RUN is used for running on server (as primary run action).

So I had to create my own Id for running locally in command line.
Comment 5 kozlov 2007-12-20 15:33:38 UTC
Verified in beta.