From: bdragon.park Date: Wed, 21 Jun 2017 05:25:10 +0000 (+0900) Subject: RTSDK : Support distclean on clean action X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7849e75d75070e5b14cf54e0e5744f3387bfa743;p=sdk%2Fide%2Frt-ide-product.git RTSDK : Support distclean on clean action - Previous clean action only support "clean" command, but now support "clean" and "distclean" by checking on clean confirm dialog's check button - To use distclean, check the "Also delete all setting files. (Use distclean)" check button Signed-off-by: bdragon.park --- diff --git a/resources/scripts/build.xml b/resources/scripts/build.xml index 935282c..42b592d 100644 --- a/resources/scripts/build.xml +++ b/resources/scripts/build.xml @@ -13,5 +13,6 @@ + diff --git a/rt-ide/tizen.rt.product.meta/src/org/tizen/rt/product/meta/resources/buildSpec.xml b/rt-ide/tizen.rt.product.meta/src/org/tizen/rt/product/meta/resources/buildSpec.xml index d148004..a3d3856 100644 --- a/rt-ide/tizen.rt.product.meta/src/org/tizen/rt/product/meta/resources/buildSpec.xml +++ b/rt-ide/tizen.rt.product.meta/src/org/tizen/rt/product/meta/resources/buildSpec.xml @@ -16,9 +16,8 @@ - - - + + diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Messages.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Messages.java index 9ba402b..da1e01f 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Messages.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Messages.java @@ -90,6 +90,7 @@ public class Messages extends NLS { public static String CleanHandler_ConfirmTitle; public static String CleanHandler_ConfirmMessage; + public static String CleanHandler_UseDistClean; static { // initialize resource bundle diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/CleanCommand.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/CleanCommand.java index 34153f5..6e992f5 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/CleanCommand.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/CleanCommand.java @@ -43,6 +43,9 @@ import org.tizen.rt.ide.util.SDKUtil; */ 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 resultBuildExecute = new ArrayList(); /* @@ -54,12 +57,12 @@ public class CleanCommand extends AbstractCommand { 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()) { @@ -69,13 +72,13 @@ public class CleanCommand extends AbstractCommand { } Map macros = new HashMap(); - macros.put("PROJECT_PATH", activeProjectPath); + macros.put("PROJECT_PATH", activeProjectPath); //$NON-NLS-1$ Map 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$ diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/CommandManager.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/CommandManager.java index 9b72258..b8d4c8a 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/CommandManager.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/CommandManager.java @@ -155,15 +155,16 @@ public class CommandManager { * @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); } diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/handlers/CleanHandler.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/handlers/CleanHandler.java index 13219c1..5f647e9 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/handlers/CleanHandler.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/handlers/CleanHandler.java @@ -34,8 +34,9 @@ import org.eclipse.core.resources.IProject; 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; @@ -54,6 +55,7 @@ import org.tizen.rt.ide.util.ViewUtil; 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) @@ -66,12 +68,21 @@ public class CleanHandler extends AbstractHandler { 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() { @@ -79,7 +90,7 @@ public class CleanHandler extends AbstractHandler { 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 { diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/messages.properties b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/messages.properties index eb7259c..05bccc1 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/messages.properties +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/messages.properties @@ -54,3 +54,4 @@ RtosNewRtAppWizard_ERROR_DESCRIPTION_IS_EMPTY=Description must be specified CleanHandler_ConfirmTitle=Clean Project CleanHandler_ConfirmMessage=Are you sure you want to clean selected project? +CleanHandler_UseDistClean=Also delete all setting files. (Use distclean)