Prompt the user if unpublished changes detected during launch#2047
Prompt the user if unpublished changes detected during launch#2047briandealwis merged 7 commits intomasterfrom
Conversation
There was a problem hiding this comment.
not yet been published?
There was a problem hiding this comment.
no hyphen in "recently changed".
"yet" feels redundant. I suggest deleting it completely.
| point="org.eclipse.debug.core.statusHandlers"> | ||
| <statusHandler | ||
| class="com.google.cloud.tools.eclipse.appengine.localserver.ui.StaleResourcesStatusHandler" | ||
| code="255" |
There was a problem hiding this comment.
a comment for "255" might be helpful
There was a problem hiding this comment.
One space after period. Is it really "Recently changed" or is it "Unsaved changes"?
"Recently changed resources have not been published yet." or "Unsaved changes have not been published."
There was a problem hiding this comment.
Recently changed. These stale resources are usually from the user having saved their unsaved changes, which haven't been published yet.
There was a problem hiding this comment.
Nit:
One space after period.
|
I've decided to make a few more changes. |
| static final int STALE_RESOURCES_CODE = 255; | ||
|
|
||
| /** The status object to pass into the debug prompter */ | ||
| public static final IStatus CONTINUE_LAUNCH_REQUEST = new Status(IStatus.INFO, |
There was a problem hiding this comment.
This is a specially crafted status message; I'll add to the comment.
| if (source instanceof ILaunchConfiguration) { | ||
| ILaunchConfiguration config = (ILaunchConfiguration) source; | ||
| if (DebugUITools.isPrivate(config)) { | ||
| return Boolean.FALSE; |
There was a problem hiding this comment.
What does a "private" config mean? So, if it's private, does this stop launching?
There was a problem hiding this comment.
From what I gather, it's used for launches that aren't visible to the user. Like Ant builds or Maven builds. We could conceivably usr launches for our staging, etc. The advantage being that it's tracked and managed by the launch info.
| * Check if there are pending changes to be published: this is a nasty condition that can occur if | ||
| * the user saves changes as part of launching the server. | ||
| */ | ||
| private boolean hasPendingChangesToPublish() { |
There was a problem hiding this comment.
I'm just wondering if this method can be called before some ResourceChangeJob is actually scheduled?
There was a problem hiding this comment.
Good point. It may not… It should be safe to join on the AUTOBUILD job.
There was a problem hiding this comment.
I see. However, I'm fine with the current status if that turns out too complex or not really worth.
There was a problem hiding this comment.
After experimenting, we need to join on the auto build job to ensure the workspace's resource changes happen, so that we see that there are pending events for publishing.
- Change behaviour to check if there are pending changes to be published and prompt the user whether to continue
|
PTAL @elharo @chanseokoh |
There was a problem hiding this comment.
for (IModule module : modules) will probably work.
Dismissed until test failures are fixed.
|
PTAL @chanseokoh |
I originally tried to detect this unpublished changes situation and tried to force publishing the changes. The code was becoming sufficiently icky that I punted and instead detect the situation and prompt the user whether to continue.
The fix uses the Platform/Debug prompting framework, which is somewhat baroque as you'll see. It uses a
Status's plugin ID and error-code to lookup a status handler. We use the prompter status handler and ask it to punt to our custom stale-resources handler to prompt the user, returning a boolean.Fixes #1832
Fixes #1897 too