Ant: Don't use AbstractUIPlugin#getDialogSettings
JavaDoc of this method says it should no longer be used. This is one
step further to remove Activators.
Change-Id: Ic6bc750e6db5ab69f66cd2bf536d89c2ebb7a951
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPlugin.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPlugin.java
index d578f65..e0880da 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPlugin.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPlugin.java
@@ -21,7 +21,6 @@
import org.eclipse.ant.internal.ui.editor.text.AntEditorDocumentProvider;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ImageRegistry;
@@ -161,22 +160,6 @@
return display;
}
- /**
- * Returns the {@link IDialogSettings} section with the given name. Creates a new section if one does not exist.
- *
- * @param name
- * @return the {@link IDialogSettings} section with the given name
- * @since 3.5.500
- */
- public IDialogSettings getDialogSettingsSection(String name) {
- IDialogSettings dialogSettings = getDialogSettings();
- IDialogSettings section = dialogSettings.getSection(name);
- if (section == null) {
- section = dialogSettings.addNewSection(name);
- }
- return section;
- }
-
@Override
protected ImageRegistry createImageRegistry() {
return AntUIImages.initializeImageRegistry();
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/AntView.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/AntView.java
index ca30d65..84e6ca4 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/AntView.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/AntView.java
@@ -24,7 +24,6 @@
import java.util.List;
import org.eclipse.ant.internal.core.IAntCoreConstants;
-import org.eclipse.ant.internal.ui.AntUIPlugin;
import org.eclipse.ant.internal.ui.IAntUIHelpContextIds;
import org.eclipse.ant.internal.ui.model.AntElementNode;
import org.eclipse.ant.internal.ui.model.AntModelContentProvider;
@@ -54,6 +53,7 @@
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -82,6 +82,7 @@
import org.eclipse.ui.part.ShowInContext;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.texteditor.IUpdate;
+import org.osgi.framework.FrameworkUtil;
/**
* A view which displays a hierarchical view of ant build files and allows the user to run selected targets from those files.
@@ -480,7 +481,7 @@
@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento);
- String persistedMemento = AntUIPlugin.getDefault().getDialogSettingsSection(getClass().getName()).get("memento"); //$NON-NLS-1$
+ String persistedMemento = getDialogSettingsSection(getClass().getName()).get("memento"); //$NON-NLS-1$
if (persistedMemento != null) {
try {
memento = XMLMemento.createReadRoot(new StringReader(persistedMemento));
@@ -498,6 +499,15 @@
}
}
+ private IDialogSettings getDialogSettingsSection(String name) {
+ IDialogSettings dialogSettings = PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(AntView.class)).getDialogSettings();
+ IDialogSettings section = dialogSettings.getSection(name);
+ if (section == null) {
+ section = dialogSettings.addNewSection(name);
+ }
+ return section;
+ }
+
/**
* Restore the viewer content that was persisted
*
@@ -571,7 +581,7 @@
}
try {
memento.save(writer);
- AntUIPlugin.getDefault().getDialogSettingsSection(getClass().getName()).put("memento", writer.getBuffer().toString()); //$NON-NLS-1$
+ getDialogSettingsSection(getClass().getName()).put("memento", writer.getBuffer().toString()); //$NON-NLS-1$
}
catch (IOException e) {
// don't do anything. Simply don't store the settings
diff --git a/ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF b/ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF
index cd2c367..1c95628 100644
--- a/ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF
+++ b/ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ant.ui; singleton:=true
-Bundle-Version: 3.7.1000.qualifier
+Bundle-Version: 3.7.1100.qualifier
Bundle-Activator: org.eclipse.ant.internal.ui.AntUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/ant/org.eclipse.ant.ui/pom.xml b/ant/org.eclipse.ant.ui/pom.xml
index 3537b19..5f88f30 100644
--- a/ant/org.eclipse.ant.ui/pom.xml
+++ b/ant/org.eclipse.ant.ui/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.ant</groupId>
<artifactId>org.eclipse.ant.ui</artifactId>
- <version>3.7.1000-SNAPSHOT</version>
+ <version>3.7.1100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<defaultSigning-excludeInnerJars>true</defaultSigning-excludeInnerJars>