Bug 567591: [UI-Util] Make use of DialogSettingsProvider added to
Platform UI
Change-Id: Ib1e8a9d922202a45753aa836dfb81d1006657b8a
diff --git a/ecommons/org.eclipse.statet.ecommons.uimisc/src/org/eclipse/statet/ecommons/ui/dialogs/DialogUtils.java b/ecommons/org.eclipse.statet.ecommons.uimisc/src/org/eclipse/statet/ecommons/ui/dialogs/DialogUtils.java
index cc090b9..09759a3 100644
--- a/ecommons/org.eclipse.statet.ecommons.uimisc/src/org/eclipse/statet/ecommons/ui/dialogs/DialogUtils.java
+++ b/ecommons/org.eclipse.statet.ecommons.uimisc/src/org/eclipse/statet/ecommons/ui/dialogs/DialogUtils.java
@@ -17,6 +17,9 @@
import java.util.LinkedHashSet;
import java.util.List;
+import org.osgi.framework.Bundle;
+
+import org.eclipse.core.runtime.Plugin;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.util.Geometry;
import org.eclipse.swt.graphics.Point;
@@ -25,7 +28,7 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Monitor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.statet.jcommons.collections.ImCollections;
import org.eclipse.statet.jcommons.lang.NonNull;
@@ -45,9 +48,10 @@
private static final String[] EMPTY_ARRAY_SETTING= new String[0];
- public static IDialogSettings getDialogSettings(final AbstractUIPlugin plugin, final String dialogId) {
+ public static IDialogSettings getDialogSettings(final Bundle bundle, final String dialogId) {
final String sectionName= dialogId;
- final IDialogSettings settings= plugin.getDialogSettings();
+ final IDialogSettings settings= PlatformUI.getDialogSettingsProvider(bundle)
+ .getDialogSettings();
IDialogSettings section= settings.getSection(sectionName);
if (section == null) {
section= settings.addNewSection(sectionName);
@@ -55,6 +59,14 @@
return section;
}
+ public static IDialogSettings getDialogSettings(final Plugin plugin, final String dialogId) {
+ final Bundle bundle= plugin.getBundle();
+ if (bundle == null) {
+ throw new RuntimeException("plugin is not started.");
+ }
+ return getDialogSettings(bundle, dialogId);
+ }
+
public static IDialogSettings getSection(final IDialogSettings settings, final String sectionName) {
IDialogSettings section= settings.getSection(sectionName);
if (section == null) {