diff --git a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/WorkbenchToolkit.java b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/WorkbenchToolkit.java index 8a6734700..b49dc490e 100644 --- a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/WorkbenchToolkit.java +++ b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/WorkbenchToolkit.java @@ -22,7 +22,7 @@ public class WorkbenchToolkit { - public static IPreferenceStore getPrefernaceStore(){ + public static IPreferenceStore getPreferenceStore(){ IPreferenceStore preferenceStore = PlatformUI.getPreferenceStore(); return preferenceStore; } diff --git a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/ClientTrustStorePreferencePage.java b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/ClientTrustStorePreferencePage.java index f0ce4717c..063999848 100644 --- a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/ClientTrustStorePreferencePage.java +++ b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/ClientTrustStorePreferencePage.java @@ -28,7 +28,6 @@ import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.PlatformUI; -import org.wso2.developerstudio.eclipse.platform.ui.Activator; import org.wso2.developerstudio.eclipse.platform.ui.WorkbenchToolkit; public class ClientTrustStorePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { @@ -45,7 +44,7 @@ public ClientTrustStorePreferencePage() { @Override public void init(IWorkbench arg0) { - preferenceStore = WorkbenchToolkit.getPrefernaceStore(); + preferenceStore = WorkbenchToolkit.getPreferenceStore(); setPreferenceStore(preferenceStore); setDescription("WSO2 Developer Studio Custom Client Trust Store Preference."); diff --git a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/DeveloperPreferencePage.java b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/DeveloperPreferencePage.java index 3d5f6599c..6ec91713b 100644 --- a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/DeveloperPreferencePage.java +++ b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/DeveloperPreferencePage.java @@ -23,6 +23,7 @@ import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.PlatformUI; +import org.wso2.developerstudio.eclipse.platform.ui.WorkbenchToolkit; public class DeveloperPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { @@ -47,7 +48,7 @@ public void createFieldEditors() { @Override public void init(IWorkbench arg0) { - preferenceStore = PlatformUI.getPreferenceStore(); + preferenceStore = WorkbenchToolkit.getPreferenceStore(); setPreferenceStore(preferenceStore); preferenceStore.setDefault(PLUGIN_TEMPLATE_URL, PreferenceInitializer.KERNEL_SAMPLES_GIT); preferenceStore.setDefault(SHOW_HIDDEN_FEATURES, false); diff --git a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/PreferenceConstants.java b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/PreferenceConstants.java index cd6621cb3..c4e3b712a 100644 --- a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/PreferenceConstants.java +++ b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/PreferenceConstants.java @@ -59,23 +59,23 @@ public class PreferenceConstants { public static final String ELEVENPM = "23:00"; - public static final String UPDATE_DATE_INTERVAL = "UPDATE_INTAVAL"; - public static final String UPDATE_TIME_INTERVAL = "UPDATE_TIME_INTAVAL"; + public static final String UPDATE_DATE_INTERVAL = "UPDATE_INTAVAL_DATE"; + public static final String UPDATE_TIME_INTERVAL = "UPDATE_INTAVAL_TIME"; public static final String AUTOMATIC_UPDATE_STATUS = "AUTOMATIC_UPATE_STATUS"; - public static final String ENABLE_AUTOMATIC_UPDATES = "ENABLE_AUTOMATIC_UPDATES"; + public static final String ENABLE_AUTOMATIC_UPDATES = "ENABLING_DEVSTUDIO_AUTOMATIC_UPDATES"; public static final String DOWNLOAD_UPDATES = "&Install available updates automatically"; public static final String NOTIFY_ME_IF_UPDATES_AVAILABLE = "&Notify me when updates are available"; - public static final String UPDATE_NOTIFICATION_CONFIGURATION = "UPDATE_NOTIFICATION_CONFIGURATION"; + public static final String UPDATE_NOTIFICATION_CONFIGURATION = "UPDATE_INSTALLATION_PROCESS_CONFIGURATION"; public static final String INSTALL_AUTOMATICALLY = "AUTOMATIC"; public static final String NOTIFY_ME = "NOTIFY_ME"; public static final String RUN_ON_STARTUP = "&Check for Updates every time eclipse starts up"; public static final String SCHEDULE_UPDATER = "&Check for Updates at the configured time"; - public static final String UPDATE_RUNNING_CONFIGURATION = "UPDATE_RUNNING_CONFIGURATION"; + public static final String UPDATE_RUNNING_CONFIGURATION = "UPDATE_INSTALLATION_CONFIGURATION"; public static final String STARTUP = "STARTUP"; public static final String SCHEDULE = "SCHEDULE"; - public static final String RELESE_SITE_URL = "RELESE_SITE_URL"; + public static final String RELESE_SITE_URL = "RELEASE_SITE_URL"; public static final String UPDATE_SITE_URL = "UPDATE_SITE_URL"; } diff --git a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/UpdateCheckerPreferencePage.java b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/UpdateCheckerPreferencePage.java index 369926f65..9481b2bdc 100644 --- a/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/UpdateCheckerPreferencePage.java +++ b/plugins/org.wso2.developerstudio.eclipse.platform.ui/src/org/wso2/developerstudio/eclipse/platform/ui/preferences/UpdateCheckerPreferencePage.java @@ -46,9 +46,13 @@ public class UpdateCheckerPreferencePage extends FieldEditorPreferencePage imple private RadioGroupFieldEditor updateInstallationRadioBttn; private RadioGroupFieldEditor updateSchedulingRadioBttn; + public UpdateCheckerPreferencePage() { + super(GRID); + } + @Override - public void init(IWorkbench workbench) { - preferenceStore = WorkbenchToolkit.getPrefernaceStore(); + public void init(IWorkbench arg) { + preferenceStore = WorkbenchToolkit.getPreferenceStore(); setPreferenceStore(preferenceStore); setDescription("Set Preferences for WSO2 Developer Studio Updates and Install Process "); setPreferenceDefaults(preferenceStore); @@ -60,23 +64,28 @@ public static void setPreferenceDefaults(IPreferenceStore preferenceStore) { preferenceStore.setDefault(PreferenceConstants.UPDATE_RUNNING_CONFIGURATION, PreferenceConstants.STARTUP); preferenceStore.setDefault(PreferenceConstants.UPDATE_DATE_INTERVAL, PreferenceConstants.DEFAULT_SUNDAY); preferenceStore.setDefault(PreferenceConstants.UPDATE_TIME_INTERVAL, PreferenceConstants.DEFAULT_EIGHT_AM); + preferenceStore.setDefault(PreferenceConstants.UPDATE_NOTIFICATION_CONFIGURATION, + PreferenceConstants.NOTIFY_ME); preferenceStore.setDefault(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES, true); } @Override protected void createFieldEditors() { + + fieldEditorParent = getFieldEditorParent(); boolean isSchedulingEnabled = false; - BooleanFieldEditor enableAutomaticUpdates = new BooleanFieldEditor(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES, - "Check for updates Automatically", fieldEditorParent); - addField(enableAutomaticUpdates); - boolean isUpdatesEnabled = preferenceStore.getBoolean(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES); addBlankSeparator(fieldEditorParent); setSeparator(fieldEditorParent); + addField(new BooleanFieldEditor(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES, "Check for updates Automatically", + fieldEditorParent)); + setSeparator(fieldEditorParent); + + boolean isUpdatesEnabled = preferenceStore.getBoolean(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES); enableDisableSet = new Composite(fieldEditorParent, SWT.LEFT); - addBlankSeparator(enableDisableSet); + addBlankSeparator(enableDisableSet); updateSchedulingRadioBttn = new RadioGroupFieldEditor(PreferenceConstants.UPDATE_RUNNING_CONFIGURATION, "Automatic Updates Scheduling", 1, new String[][] { { PreferenceConstants.RUN_ON_STARTUP, PreferenceConstants.STARTUP }, @@ -90,7 +99,7 @@ protected void createFieldEditors() { isSchedulingEnabled = true; } - String[][] intervals = { { PreferenceConstants.DAILY, PreferenceConstants.DAILY }, + String[][] dayIntervals = { { PreferenceConstants.DAILY, PreferenceConstants.DAILY }, { PreferenceConstants.DEFAULT_SUNDAY, PreferenceConstants.DEFAULT_SUNDAY }, { PreferenceConstants.EVERY_MONDAY, PreferenceConstants.EVERY_MONDAY }, { PreferenceConstants.EVERY_TUESDAY, PreferenceConstants.EVERY_TUESDAY }, @@ -99,7 +108,7 @@ protected void createFieldEditors() { { PreferenceConstants.EVERY_FRIDAY, PreferenceConstants.EVERY_FRIDAY }, { PreferenceConstants.EVERY_SATURDAY, PreferenceConstants.EVERY_SATURDAY } }; intervalDayEditor = new ComboFieldEditor(PreferenceConstants.UPDATE_DATE_INTERVAL, "Check for updates ", - intervals, enableDisableSet); + dayIntervals, enableDisableSet); addField(intervalDayEditor); intervalDayEditor.setEnabled(isUpdatesEnabled && isSchedulingEnabled, enableDisableSet); @@ -127,15 +136,15 @@ protected void createFieldEditors() { { PreferenceConstants.NINEPM, PreferenceConstants.NINEPM }, { PreferenceConstants.TENPM, PreferenceConstants.TENPM }, { PreferenceConstants.ELEVENPM, PreferenceConstants.ELEVENPM } }; - intervalTimeEditor = new ComboFieldEditor(PreferenceConstants.UPDATE_TIME_INTERVAL, "", timeIntervals, + intervalTimeEditor = new ComboFieldEditor(PreferenceConstants.UPDATE_TIME_INTERVAL, "at", timeIntervals, enableDisableSet); - intervalTimeEditor.setEnabled(isUpdatesEnabled && isSchedulingEnabled, enableDisableSet); addField(intervalTimeEditor); + intervalTimeEditor.setEnabled(isUpdatesEnabled && isSchedulingEnabled, enableDisableSet); setSeparator(enableDisableSet); addBlankSeparator(enableDisableSet); updateInstallationRadioBttn = new RadioGroupFieldEditor(PreferenceConstants.UPDATE_NOTIFICATION_CONFIGURATION, - "Specify Update Schedule", 1, + "Specify Installation Preference", 1, new String[][] { { PreferenceConstants.NOTIFY_ME_IF_UPDATES_AVAILABLE, PreferenceConstants.NOTIFY_ME }, { PreferenceConstants.DOWNLOAD_UPDATES, PreferenceConstants.INSTALL_AUTOMATICALLY } }, enableDisableSet); @@ -165,6 +174,7 @@ private void addBlankSeparator(Composite parent) { label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 3, 1)); } + @Override public void propertyChange(PropertyChangeEvent event) { FieldEditor fe = (FieldEditor) event.getSource(); if (PreferenceConstants.ENABLE_AUTOMATIC_UPDATES.equals(fe.getPreferenceName())) { @@ -190,13 +200,10 @@ public void propertyChange(PropertyChangeEvent event) { } intervalDayEditor.setEnabled(isScheduler, enableDisableSet); intervalTimeEditor.setEnabled(isScheduler, enableDisableSet); + } else if (PreferenceConstants.UPDATE_DATE_INTERVAL.equals(fe.getPreferenceName())) { + } - setPreferenceDefaults(preferenceStore); super.propertyChange(event); } - public static void setAutomaticUpdatePreference(String value) { - preferenceStore.setDefault(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES, value); - } - } diff --git a/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/handler/StartupUpdateHandler.java b/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/handler/StartupUpdateHandler.java index ed9150fdc..e93d28dac 100644 --- a/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/handler/StartupUpdateHandler.java +++ b/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/handler/StartupUpdateHandler.java @@ -52,7 +52,6 @@ public void earlyStartup() { // check if user has set startup updates // Read updater preferences IPreferenceStore prefPage = PlatformUI.getPreferenceStore(); - UpdateCheckerPreferencePage.setPreferenceDefaults(prefPage); boolean isAutomaticUpdate = prefPage.getBoolean(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES); String updateRunConfig = prefPage.getString(PreferenceConstants.UPDATE_RUNNING_CONFIGURATION); if (updateRunConfig == null || updateRunConfig.isEmpty()) { diff --git a/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/job/UpdateMetaFileReaderJob.java b/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/job/UpdateMetaFileReaderJob.java index 98425b528..e7563f4cf 100644 --- a/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/job/UpdateMetaFileReaderJob.java +++ b/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/job/UpdateMetaFileReaderJob.java @@ -91,6 +91,7 @@ protected IStatus run(IProgressMonitor monitor) { downloadMetaFile(); Map availaleDevStudioFeatureVerions = new HashMap(); availaleDevStudioFeatureVerions = readMetaDataFiletoMap(); + deleteDownloadedTempFile(); if (availaleDevStudioFeatureVerions.isEmpty()) { log.error(Messages.UpdateCheckerJob_4); promptUserError(Messages.UpdateMetaFileReaderJob_3, ERROR_TITLE); @@ -128,6 +129,17 @@ protected IStatus run(IProgressMonitor monitor) { // installed return cancel } + private void deleteDownloadedTempFile() { + File downloadedMetaFile = new File(fileLoc); + File downloadedFolderLoc = new File(folderLoc); + if (downloadedMetaFile.exists()) { + downloadedMetaFile.delete(); + if (downloadedFolderLoc.exists()) { + downloadedFolderLoc.delete(); + } + } + } + /** * version would come as 4.0.0-201512221344 we need to create the * installable unit version object from the version string diff --git a/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/job/UpdateMetaFileReaderJobListener.java b/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/job/UpdateMetaFileReaderJobListener.java index ba6cd76c4..995cdb662 100644 --- a/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/job/UpdateMetaFileReaderJobListener.java +++ b/plugins/org.wso2.developerstudio.eclipse.updater/src/org/wso2/developerstudio/eclipse/updater/job/UpdateMetaFileReaderJobListener.java @@ -38,9 +38,6 @@ public class UpdateMetaFileReaderJobListener extends JobChangeAdapter { private static final String UPDATER_DIALOG_TITLE = Messages.UpdatemetaFileReaderJobListener_1; protected static final String YES = "Yes"; protected static final String NO = "No"; - protected static final String DAILY = "Daily"; - protected static final String WEEKLY = "Weekly"; - protected static final String MONTHLY = "Monthly"; private static org.wso2.developerstudio.eclipse.updater.job.UpdateMetaFileReaderJob UpdateMetaFileReaderJob; protected static IDeveloperStudioLog log = Logger.getLog(UpdaterPlugin.PLUGIN_ID);