-
Notifications
You must be signed in to change notification settings - Fork 52
Prompt the user if unpublished changes detected during launch #2047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| SERVER_ALREADY_RUNNING_IN_MODE=Server is already running in "{0}" mode | ||
| UNABLE_TO_LAUNCH=Unable to launch App Engine server | ||
| STALE_RESOURCES_DETECTED=Stale resources detected | ||
| STALE_RESOURCES_LAUNCH_CONFIRMATION=Some recently-changed resources have not been published yet. Continue with launch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not yet been published?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a comment for "255" might be helpful
| SERVER_ALREADY_RUNNING_IN_MODE=Server is already running in "{0}" mode | ||
| UNABLE_TO_LAUNCH=Unable to launch App Engine server | ||
| STALE_RESOURCES_DETECTED=Stale resources detected | ||
| STALE_RESOURCES_LAUNCH_CONFIRMATION=Some recently-changed resources have not been published yet. Continue with launch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StatusUtil.info()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does a "private" config mean? So, if it's private, does this stop launching?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just wondering if this method can be called before some ResourceChangeJob is actually scheduled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. It may not… It should be safe to join on the AUTOBUILD job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
|
|
||
| @Override | ||
| protected void publishFinish(IProgressMonitor monitor) throws CoreException { | ||
| boolean allpublished = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allPublished
| boolean allpublished = true; | ||
| IServer server = getServer(); | ||
| IModule[] modules = server.getModules(); | ||
| for (int i = 0; i < modules.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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