diff options
author | Lars Vogel | 2020-09-29 08:31:23 +0000 |
---|---|---|
committer | Lars Vogel | 2020-11-04 14:50:52 +0000 |
commit | 96ed04c64d542a0c16496b03ae57c716bc140434 (patch) | |
tree | a1fa7f9838e8908444dc4adb24acc1381b95f92d | |
parent | 4dfe4721068594609b70c186360ec8e86ceec2ef (diff) | |
download | eclipse.platform.debug-96ed04c64d542a0c16496b03ae57c716bc140434.tar.gz eclipse.platform.debug-96ed04c64d542a0c16496b03ae57c716bc140434.tar.xz eclipse.platform.debug-96ed04c64d542a0c16496b03ae57c716bc140434.zip |
Bug 567432 - Remove external tools migration code from 2004Y20201104-1200I20201104-1800
Change-Id: Ia033d9a6a6256bb50f33cccddb69a054b4c2da6c
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
8 files changed, 5 insertions, 339 deletions
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java index aed44a3a8..c87bac400 100644 --- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java +++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java @@ -23,12 +23,9 @@ import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.DebugPlugin; @@ -246,44 +243,6 @@ public class BuilderCoreUtils { return folder; } - /** - * Migrates the launch configuration working copy, which is based on an old- - * style external tool builder, to a new, saved launch configuration. The - * returned launch configuration will contain the same attributes as the - * given working copy with the exception of the configuration name, which - * may be changed during the migration. The name of the configuration will - * only be changed if the current name is not a valid name for a saved - * config. - * - * @param workingCopy - * the launch configuration containing attributes from an - * old-style project builder. - * @return ILaunchConfiguration a new, saved launch configuration whose - * attributes match those of the given working copy as well as - * possible - * @throws CoreException - * if an exception occurs while attempting to save the new - * launch configuration - */ - public static ILaunchConfiguration migrateBuilderConfiguration( - IProject project, ILaunchConfigurationWorkingCopy workingCopy) - throws CoreException { - workingCopy.setContainer(getBuilderFolder(project, true)); - // Before saving, make sure the name is valid - String name = workingCopy.getName(); - name = name.replace('/', '.'); - if (name.charAt(0) == ('.')) { - name = name.substring(1); - } - IStatus status = ResourcesPlugin.getWorkspace().validateName(name, - IResource.FILE); - if (!status.isOK()) { - name = "ExternalTool"; //$NON-NLS-1$ - } - name = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(name); - workingCopy.rename(name); - return workingCopy.doSave(); - } /** * Converts the build types string into an array of build kinds. diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java index e0f4d21c8..039cd0a7e 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java @@ -82,20 +82,6 @@ public class BuilderUtils { } /** - * Returns whether the given configuration is an "unmigrated" builder. - * Unmigrated builders are external tools that are stored in an old format - * but have not been migrated by the user. Old format builders are always - * translated into launch config working copies in memory, but they're not - * considered "migrated" until the config has been saved and the project spec - * updated. - * @param config the config to examine - * @return whether the given config represents an unmigrated builder - */ - public static boolean isUnmigratedConfig(ILaunchConfiguration config) { - return BuilderCoreUtils.isUnmigratedConfig(config); - } - - /** * Converts the given config to a build command which is stored in the * given command. * @@ -154,25 +140,6 @@ public class BuilderUtils { return newWorkingCopy.doSave(); } - /** - * Migrates the launch configuration working copy, which is based on an old- - * style external tool builder, to a new, saved launch configuration. The - * returned launch configuration will contain the same attributes as the - * given working copy with the exception of the configuration name, which - * may be changed during the migration. The name of the configuration will - * only be changed if the current name is not a valid name for a saved - * config. - * - * @param workingCopy the launch configuration containing attributes from an - * old-style project builder. - * @return ILaunchConfiguration a new, saved launch configuration whose - * attributes match those of the given working copy as well as possible - * @throws CoreException if an exception occurs while attempting to save the - * new launch configuration - */ - public static ILaunchConfiguration migrateBuilderConfiguration(IProject project, ILaunchConfigurationWorkingCopy workingCopy) throws CoreException { - return BuilderCoreUtils.migrateBuilderConfiguration(project, workingCopy); - } /** * Converts the build types string into an array of diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java deleted file mode 100644 index 1c8043a5b..000000000 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2013 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.externaltools.internal.model; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; - -public class ExternalToolsPreferenceInitializer extends AbstractPreferenceInitializer { - - public ExternalToolsPreferenceInitializer() { - super(); - } - - @Override - public void initializeDefaultPreferences() { - IPreferenceStore prefs = ExternalToolsPlugin.getDefault().getPreferenceStore(); - prefs.setDefault(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION, true); - prefs.setDefault(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION, true); - } -} diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IPreferenceConstants.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IPreferenceConstants.java deleted file mode 100644 index c63cd7e74..000000000 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IPreferenceConstants.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.externaltools.internal.model; - - -/** - * Constants used to identify user preferences. - */ -public interface IPreferenceConstants { - - /** - * Boolean preference key which indicates whether or not the user should be prompted - * before an external tool project builder is migrated to the new builder format. - * This is used before an old-style (Eclipse 1.0 or 2.0) builder is migrated to - * the new format (launch configurations). - */ - String PROMPT_FOR_TOOL_MIGRATION = "externaltools.builders.promptForMigration"; //$NON-NLS-1$ - /** - * Boolean preference key which indicates whether or not the user should be prompted - * before a project is migrated tot he new builder handle format. - * This is used before an old-style (Eclipse 2.1) project handle is migrated - * from the old format (launch config handles) to the new format (path to the launch). - */ - String PROMPT_FOR_PROJECT_MIGRATION = "externaltools.builders.promptForProjectMigration"; //$NON-NLS-1$ -} diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java index 2bee78fc2..e07eab8a3 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java @@ -50,9 +50,7 @@ import org.eclipse.debug.ui.DebugUITools; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.IDialogConstants; 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.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.ICheckStateListener; @@ -84,7 +82,6 @@ import org.eclipse.ui.externaltools.internal.launchConfigurations.IgnoreWhiteSpa import org.eclipse.ui.externaltools.internal.model.BuilderUtils; import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds; -import org.eclipse.ui.externaltools.internal.model.IPreferenceConstants; import org.eclipse.ui.progress.IProgressService; /** @@ -214,15 +211,9 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta return; } - boolean projectNeedsMigration= false; for (ICommand command : commands) { String[] version= new String[] {IExternalToolConstants.EMPTY_STRING}; ILaunchConfiguration config = BuilderUtils.configFromBuildCommandArgs(project, command.getArguments(), version); - if (BuilderCoreUtils.VERSION_2_1.equals(version[0])) { - // Storing the .project file of a project with 2.1 configs, will - // edit the file in a way that isn't backwards compatible. - projectNeedsMigration= true; - } Object element= null; if (config != null) { if (!config.isWorkingCopy() && !config.exists()) { @@ -252,29 +243,6 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta viewer.setChecked(element, isEnabled(element)); } } - if (projectNeedsMigration) { - IPreferenceStore store= ExternalToolsPlugin.getDefault().getPreferenceStore(); - boolean prompt= store.getBoolean(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION); - boolean proceed= true; - if (prompt) { - Shell shell= getShell(); - if (shell == null) { - return; - } - MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(shell, ExternalToolsUIMessages.BuilderPropertyPage_0, ExternalToolsUIMessages.BuilderPropertyPage_1, ExternalToolsUIMessages.BuilderPropertyPage_2, false, null, null); - proceed= dialog.getReturnCode() == IDialogConstants.YES_ID; - store.setValue(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION, !dialog.getToggleState()); - } - if (!proceed) { - // Open the page read-only - viewer.getTable().setEnabled(false); - downButton.setEnabled(false); - editButton.setEnabled(false); - importButton.setEnabled(false); - newButton.setEnabled(false); - removeButton.setEnabled(false); - } - } } /** @@ -693,19 +661,6 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta Object data = selection.getData(); if (data instanceof ILaunchConfiguration) { ILaunchConfiguration config= (ILaunchConfiguration) data; - if (BuilderUtils.isUnmigratedConfig(config)) { - if (!shouldProceedWithMigration()) { - return; - } - try { - config= BuilderUtils.migrateBuilderConfiguration(getInputProject(), (ILaunchConfigurationWorkingCopy) config); - } catch (CoreException e) { - handleException(e); - return; - } - // Replace the working copy in the table with the migrated configuration - selection.setData(config); - } userHasMadeChanges= true; boolean wasAutobuilding= ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding(); try { @@ -736,32 +691,6 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta return Window.OK == dialog.open(); } - /** - * Prompts the user to proceed with the migration of a project builder from - * the old format to the new, launch configuration-based, format and returns - * whether or not the user wishes to proceed with the migration. - * - * @return boolean whether or not the user wishes to proceed with migration - */ - private boolean shouldProceedWithMigration() { - if (!ExternalToolsPlugin.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION)) { - // User has asked not to be prompted - return true; - } - Shell shell= getShell(); - if (shell == null) { - return false; - } - // Warn the user that editing an old config will cause storage migration. - MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(getShell(), - ExternalToolsUIMessages.BuilderPropertyPage_Migrate_project_builder_10, - ExternalToolsUIMessages.BuilderPropertyPage_Not_Support, - ExternalToolsUIMessages.BuilderPropertyPage_Prompt, - false, - ExternalToolsPlugin.getDefault().getPreferenceStore(), - IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION); - return dialog.getReturnCode() == IDialogConstants.YES_ID; - } /** * Handles unexpected internal exceptions @@ -988,17 +917,17 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } } catch (CoreException e1) { } - - if (!BuilderUtils.isUnmigratedConfig(config) && (config instanceof ILaunchConfigurationWorkingCopy)) { - ILaunchConfigurationWorkingCopy workingCopy= ((ILaunchConfigurationWorkingCopy) config); + if (config instanceof ILaunchConfigurationWorkingCopy) { + ILaunchConfigurationWorkingCopy workingCopy = ((ILaunchConfigurationWorkingCopy) config); // Save any changes to the config (such as enable/disable) if (workingCopy.isDirty()) { try { workingCopy.doSave(); } catch (CoreException e) { - Shell shell= getShell(); + Shell shell = getShell(); if (shell != null) { - MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_39, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_40, new String[] {workingCopy.getName()})); + MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_39, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_40, new String[] { + workingCopy.getName() })); } } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java deleted file mode 100644 index b3728dfbe..000000000 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - * Frederic Gurr - Fixed restore default behavior (bug 346082) - *******************************************************************************/ -package org.eclipse.ui.externaltools.internal.ui; - - -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; -import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds; -import org.eclipse.ui.externaltools.internal.model.IPreferenceConstants; - -/** - * Preference page that allows the user to customize external tools - */ -public class ExternalToolsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - - private Button promptForToolMigrationButton; - private Button promptForProjectMigrationButton; - - public ExternalToolsPreferencePage() { - setPreferenceStore(ExternalToolsPlugin.getDefault().getPreferenceStore()); - setDescription(ExternalToolsUIMessages.ExternalToolsPreferencePage_External_tool_project_builders_migration_2); - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - @Override - protected Control createContents(Composite parent) { - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IExternalToolsHelpContextIds.EXTERNAL_TOOLS_PREFERENCE_PAGE); - //The main composite - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.marginHeight=0; - layout.marginWidth=0; - composite.setLayout(layout); - composite.setFont(parent.getFont()); - - promptForToolMigrationButton= createCheckButton(composite, ExternalToolsUIMessages.ExternalToolsPreferencePage_Prompt_before_migrating_3, IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION); - promptForProjectMigrationButton= createCheckButton(composite, ExternalToolsUIMessages.ExternalToolsPreferencePage_1, IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION); - - applyDialogFont(composite); - - return composite; - } - - /** - * Returns a new check button with the given label for the given preference. - */ - private Button createCheckButton(Composite parent, String label, String preferenceKey) { - Button button= new Button(parent, SWT.CHECK | SWT.LEFT); - button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - button.setFont(parent.getFont()); - button.setText(label); - button.setSelection(getPreferenceStore().getBoolean(preferenceKey)); - return button; - } - - /** - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - @Override - public void init(IWorkbench workbench) { - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#performOk() - */ - @Override - public boolean performOk() { - getPreferenceStore().setValue(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION, promptForToolMigrationButton.getSelection()); - getPreferenceStore().setValue(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION, promptForProjectMigrationButton.getSelection()); - return super.performOk(); - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - @Override - protected void performDefaults() { - promptForToolMigrationButton.setSelection(getPreferenceStore().getDefaultBoolean(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION)); - promptForProjectMigrationButton.setSelection(getPreferenceStore().getDefaultBoolean(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION)); - super.performDefaults(); - } -} diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties index 6c8b79ce6..e28068367 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties @@ -49,10 +49,6 @@ FileSelectionDialog_Choose_Location_1=Choose Location FileSelectionDialog_Ok_2=OK FileSelectionDialog_Cancel_3=Cancel -ExternalToolsPreferencePage_External_tool_project_builders_migration_2=External tool project builders stored in an old format will be migrated to a new format when edited. Projects which store builders using an old format will be migrated whenever a change is made. Once migrated, project builders will not be understood by installations using these older formats. -ExternalToolsPreferencePage_Prompt_before_migrating_3=&Confirm before migrating external tool project builders for edit -ExternalToolsPreferencePage_1=C&onfirm before migrating projects to the new format - EditCommandDialog_0=Configure Builder EditCommandDialog_1=Run this builder: EditCommandDialog_2=After a "&Clean" diff --git a/org.eclipse.ui.externaltools/plugin.xml b/org.eclipse.ui.externaltools/plugin.xml index 3800d0d63..1809465e3 100644 --- a/org.eclipse.ui.externaltools/plugin.xml +++ b/org.eclipse.ui.externaltools/plugin.xml @@ -78,15 +78,6 @@ </command> </extension> <extension - point="org.eclipse.ui.preferencePages"> - <page - name="%PreferencePage.externalToolsPreferences" - category="org.eclipse.debug.ui.DebugPreferencePage" - class="org.eclipse.ui.externaltools.internal.ui.ExternalToolsPreferencePage" - id="org.eclipse.ui.externaltools.ExternalToolsPreferencePage"> - </page> - </extension> - <extension point="org.eclipse.ui.propertyPages"> <page name="%PropertyPage.externalToolsBuilders" @@ -198,9 +189,5 @@ id="org.eclipse.ui.externaltools.workingSetComparator"> </launchConfigurationComparator> </extension> - - <extension point="org.eclipse.core.runtime.preferences"> - <initializer class="org.eclipse.ui.externaltools.internal.model.ExternalToolsPreferenceInitializer"/> - </extension> </plugin> |