<command name="build" command="make V=1" curdir="${PROJECT_PATH}/os" shellcmd="true" />
<command name="buildWithToolchain" command=". ./setenv.sh ${TOOLCHAIN_PATH};cd ..;make V=1" curdir="${PROJECT_PATH}/os/tools" shellcmd="true" shell="/bin/bash" />
<command name="clean" command="make clean" curdir="${PROJECT_PATH}/os" shellcmd="true" />
+ <command name="distclean" command="make distclean" curdir="${PROJECT_PATH}/os" shellcmd="true" />
</build>
</sbi>
<param name="V" value="V=1"/>
</command>
<command name="buildWithToolchain" command=". ./setenv.sh ${TOOLCHAIN_PATH};cd ..;make V=1" path="os/tools" shellcmd="true" shell="/bin/bash"/>
- <command name="clean" command="make clean" path="os" shellcmd="true">
- <param name="clean" value="clean"/>
- </command>
+ <command name="clean" command="make clean" path="os" shellcmd="true"/>
+ <command name="distclean" command="make distclean" path="os" shellcmd="true"/>
</commands>
<executors> <!-- execute command sequentially on build -->
<executor name="linux default excutor" os="linux" bit="all">
public static String CleanHandler_ConfirmTitle;
public static String CleanHandler_ConfirmMessage;
+ public static String CleanHandler_UseDistClean;
static {
// initialize resource bundle
*/
public class CleanCommand extends AbstractCommand {
+ private static final String COMMAND_NAME_CLEAN = "clean"; //$NON-NLS-1$
+ private static final String COMMAND_NAME_DISTCLEAN = "distclean"; //$NON-NLS-1$
+
private List<String> resultBuildExecute = new ArrayList<String>();
/*
return "build.xml"; //$NON-NLS-1$
}
- protected int execute(IProject project, ConsoleManager consoleManager, IProgressMonitor monitor) {
+ protected int execute(IProject project, ConsoleManager consoleManager, IProgressMonitor monitor, boolean useDistClean) {
String activeProjectPath = project.getLocation().toString();
String sdkPath = SDKUtil.getSdkPath();
File buildScriptFile = new File(sdkPath, "rt-ide" + File.separator + "resources" + File.separator + "scripts"
- + File.separator + getScriptFileName());
+ + File.separator + getScriptFileName()); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (!buildScriptFile.exists()) {
buildScriptFile = new File(activeProjectPath, getScriptFileName());
if (!buildScriptFile.exists()) {
}
Map<String, String> macros = new HashMap<String, String>();
- macros.put("PROJECT_PATH", activeProjectPath);
+ macros.put("PROJECT_PATH", activeProjectPath); //$NON-NLS-1$
Map<String, BuildScript> scripts = getBuildScripts(buildScriptFile, macros);
ProcessBuilder pb = ProcUtil.genProcessBuilder(null);
- String buildCmdName = "clean";
+ String buildCmdName = useDistClean ? COMMAND_NAME_DISTCLEAN : COMMAND_NAME_CLEAN;
BuildScript script = scripts.get(buildCmdName);
if (script == null) {
consoleManager.println("Cannot found clean command : " + buildCmdName); //$NON-NLS-1$
* @param project selected project
* @param consoleManager ConsoleManager instance
* @param monitor progress monitor
+ * @param useDistClean
* @return success or not
*/
- public static boolean runClean(IProject project, ConsoleManager consoleManager, IProgressMonitor monitor) {
+ public static boolean runClean(IProject project, ConsoleManager consoleManager, IProgressMonitor monitor, boolean useDistClean) {
if (consoleManager == null) {
logger.error("ConsoleManager is null"); //$NON-NLS-1$
return false;
}
CleanCommand cleanCommand = new CleanCommand();
- int result = cleanCommand.execute(project, consoleManager, monitor);
+ int result = cleanCommand.execute(project, consoleManager, monitor, useDistClean);
return processResult(result, consoleManager);
}
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.progress.IProgressService;
import org.slf4j.Logger;
public class CleanHandler extends AbstractHandler {
private final Logger logger = LoggerFactory.getLogger(CleanHandler.class);
+ private static final String PREF_KEY_USE_DISTCLEAN = "PREF_KEY_USE_DISTCLEAN"; //$NON-NLS-1$
/*
* (non-Javadoc)
return null;
}
- boolean ok = MessageDialog.openQuestion(ViewUtil.getDisplay().getActiveShell(),
- Messages.CleanHandler_ConfirmTitle, Messages.CleanHandler_ConfirmMessage);
- if (!ok) {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(
+ ViewUtil.getDisplay().getActiveShell(),
+ Messages.CleanHandler_ConfirmTitle, Messages.CleanHandler_ConfirmMessage,
+ Messages.CleanHandler_UseDistClean, store.getBoolean(PREF_KEY_USE_DISTCLEAN),
+ store, PREF_KEY_USE_DISTCLEAN);
+ int returnCode = dialog.getReturnCode();
+
+ if (MessageDialogWithToggle.OK != returnCode) {
return null;
}
+ final boolean useDistClean = dialog.getToggleState();
+ store.setValue(PREF_KEY_USE_DISTCLEAN, useDistClean);
+
IWorkbench workbench = Activator.getDefault().getWorkbench();
IProgressService progressService = workbench.getProgressService();
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Clean Project", 3); //$NON-NLS-1$
- CommandManager.runClean(project, new ConsoleManager(true), monitor);
+ CommandManager.runClean(project, new ConsoleManager(true), monitor, useDistClean);
monitor.worked(1);
try {
CleanHandler_ConfirmTitle=Clean Project
CleanHandler_ConfirmMessage=Are you sure you want to clean selected project?
+CleanHandler_UseDistClean=Also delete all setting files. (Use distclean)