Save project before applying recipe. Try to use content from docs cache

This commit is contained in:
aboyko
2022-11-07 19:45:55 -05:00
parent b8d1670306
commit 1725d7f5a1
7 changed files with 196 additions and 150 deletions

View File

@@ -59,9 +59,9 @@ import org.springframework.ide.eclipse.boot.dash.model.RunState;
import org.springframework.ide.eclipse.boot.dash.model.remote.ChildBearing;
import org.springframework.ide.eclipse.boot.dash.model.remote.RefreshStateTracker;
import org.springframework.ide.eclipse.boot.dash.util.LineBasedStreamGobler;
import org.springframework.ide.eclipse.boot.launch.util.BootDebugUITools;
import org.springframework.ide.eclipse.boot.launch.util.PortFinder;
import org.springframework.ide.eclipse.boot.util.JavaProjectUtil;
import org.springsource.ide.eclipse.commons.core.CoreUtil;
import org.springsource.ide.eclipse.commons.core.pstore.PropertyStoreApi;
import org.springsource.ide.eclipse.commons.frameworks.core.util.JobUtil;
import org.springsource.ide.eclipse.commons.frameworks.core.util.StringUtils;
@@ -197,7 +197,7 @@ public class DockerApp extends AbstractDisposable implements App, ChildBearing,
DockerDeployment deployment = deployment();
RunState desiredRunState = deployment.getRunState();
if (desiredRunState.isActive()
&& !BootDebugUITools.promptForProjectSave(project)) {
&& !CoreUtil.promptForProjectSave(project)) {
return new CompletableFuture<Void>();
}
} catch (Exception e) {

View File

@@ -184,57 +184,4 @@ public class BootDebugUITools {
job.schedule();
}
/*
*
* The following constants are copied from LaunchConfigurationDelegate
*
*
*/
/**
* Constant to define debug.core for the status codes
*
* @since 3.2
*/
private static final String DEBUG_CORE = "org.eclipse.debug.core";
/**
* Constant to define debug.ui for the status codes
*
* @since 3.2
*/
private static final String DEBUG_UI = "org.eclipse.debug.ui";
/**
* Status code for which a UI prompter is registered.
*/
protected static final IStatus promptStatus = new Status(IStatus.INFO, DEBUG_UI, 200, "", null);
/**
* Status code for which a prompter will ask the user to save any/all of the dirty editors which have only to do
* with this launch (scoping them to the current launch/build)
*
* @since 3.2
*/
protected static final IStatus saveScopedDirtyEditors = new Status(IStatus.INFO, DEBUG_CORE, 222, "", null);
/**
* Derived from {@link LaunchConfigurationDelegate}
* @param project
* @return true if project was saved. False if canceled
* @throws Exception
*/
public static boolean promptForProjectSave(IProject project) throws Exception {
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
if(prompter != null) {
IProject[] projects = new IProject[] {project};
ILaunchConfiguration configuration = null;
if(!((Boolean)prompter.handleStatus(saveScopedDirtyEditors, new Object[]{configuration, projects})).booleanValue()) {
return false;
}
}
return true;
}
}