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 258103

Summary: Copy Support Still Running
Product: php Reporter: Caffeine
Component: FTP SupportAssignee: Tomas Mysik <tmysik>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Caffeine 2016-02-22 18:20:30 UTC
I'm working on fixing an issue raised on the PHP Unit Watcher plugin which runs the relevant test file OnSave.

The plugin runs the test via the EventQueue.invokeLater:

EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                Lookup lookup = Lookups.singleton(fileObject);
                if (Arrays.asList(actionProvider.getSupportedActions()).contains(ActionProvider.COMMAND_TEST_SINGLE)
                        && actionProvider.isActionEnabled(ActionProvider.COMMAND_TEST_SINGLE, lookup)) {
                    actionProvider.invokeAction(ActionProvider.COMMAND_TEST_SINGLE, lookup);
                }
                
            }
        });

However if upload on save is enabled the message:

"Copy support is still running, do you really want to continue?"

Blocks the running of the PHPUnit test.

Any ideas on how we can get round this issue?

Kind regards,
Kev
Comment 1 Tomas Mysik 2016-02-23 09:55:18 UTC
Well, currently there is no way (for external plugins) to detect whether CopySupport is running or not. Perhaps the best way could be to delay your code a bit (500 ms?). You can have a look at the RequestProcesor.Task.schedule() method which could help in this case (BTW this would have a nice benefit that if more files are quickly edited in a row, only one test run would be run).

Thanks.
Comment 2 Caffeine 2016-02-23 10:08:43 UTC
Thanks Tomas,

I tried this with a 1000 delay and when saving the same file in quick succession i actually got more than one copy support messages.

I'll put RP back in and do some more testing.
Comment 3 Tomas Mysik 2016-02-23 10:17:16 UTC
I could help with that, let me know if needed. Just add here your Github repo, I would create a PR.

Thanks.
Comment 4 Caffeine 2016-02-23 10:19:45 UTC
RP.Task.schedule(1000) does help a lot.

I'll update to use it for now, thanks for the help. 

I've spent a good few hours looking for different ways to get round this and RP seemed to be the "best" way for now.
Comment 5 Caffeine 2016-02-23 10:47:37 UTC
I'll mark this as resolved for now.

Cheers!