Bug 577037 - Remove org.eclipse.ui dependency in
org.eclipse.pde.spy.preferences

preference spy should also be usable in e4 RCP applications, therefore
we should remove the IDE depencency.


Change-Id: Ifb34ddf1819ad72a0b64399a2ac2047c5534dfe5
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Reviewed-on: https://git.eclipse.org/r/c/pde/eclipse.pde.ui/+/187270
Tested-by: PDE Bot <pde-bot@eclipse.org>
diff --git a/ui/org.eclipse.pde.spy.preferences/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.spy.preferences/META-INF/MANIFEST.MF
index 7df620f..95c24d0 100644
--- a/ui/org.eclipse.pde.spy.preferences/META-INF/MANIFEST.MF
+++ b/ui/org.eclipse.pde.spy.preferences/META-INF/MANIFEST.MF
@@ -6,8 +6,7 @@
 Automatic-Module-Name: org.eclipse.pde.spy.preferences
 Bundle-RequiredExecutionEnvironment: JavaSE-11
 Bundle-Vendor: %provider-name
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
+Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.e4.ui.model.workbench;bundle-version="1.1.0",
  org.eclipse.e4.core.di;bundle-version="1.4.0",
  org.eclipse.e4.core.di.extensions;bundle-version="0.12.0",
@@ -21,9 +20,10 @@
  org.eclipse.jface.databinding;bundle-version="1.6.200",
  org.eclipse.e4.ui.services;bundle-version="1.1.0",
  org.eclipse.e4.ui.workbench;bundle-version="1.1.0",
- org.eclipse.ui,
  org.eclipse.core.runtime,
- org.eclipse.pde.spy.core;bundle-version="1.0.0"
+ org.eclipse.pde.spy.core;bundle-version="1.0.0",
+ org.eclipse.e4.ui.dialogs;bundle-version="1.3.0",
+ org.eclipse.jface;bundle-version="3.24.0"
 Import-Package: javax.annotation;version="1.3.5",
  javax.inject;version="1.0.0"
 Bundle-ActivationPolicy: lazy
diff --git a/ui/org.eclipse.pde.spy.preferences/plugin.xml b/ui/org.eclipse.pde.spy.preferences/plugin.xml
index 0db6573..96fd8e9 100644
--- a/ui/org.eclipse.pde.spy.preferences/plugin.xml
+++ b/ui/org.eclipse.pde.spy.preferences/plugin.xml
@@ -9,14 +9,6 @@
       </fragment>
    </extension>
    <extension
-         point="org.eclipse.ui.preferencePages">
-      <page
-            class="org.eclipse.pde.spy.preferences.preferencepage.TracePreferencePage"
-            id="org.eclipse.pde.spy.preferences.tracepreferencespage"
-            name="%name">
-      </page>
-   </extension>
-   <extension
 		 point="org.eclipse.pde.spy.core.spyPart">
       <spyPart
             description="%description"
diff --git a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/PreferenceSpyConfiguration.java b/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/PreferenceSpyConfiguration.java
index 125947d..4c4f295 100644
--- a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/PreferenceSpyConfiguration.java
+++ b/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/PreferenceSpyConfiguration.java
@@ -13,24 +13,22 @@
  *******************************************************************************/
 package org.eclipse.pde.spy.preferences;
 
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-import org.osgi.framework.FrameworkUtil;
 
 /**
  * Gives access to the scope preferences
  */
 public class PreferenceSpyConfiguration {
+	
+	private static String bundleId = "org.eclipse.pde.spy.preferences";
 
-	private static ScopedPreferenceStore preferenceStore;
+	private static IEclipsePreferences preferenceStore;
 
-	public static IPreferenceStore getPreferenceStore() {
+	public static IEclipsePreferences getPreferenceStore() {
 		// Create the preference store lazily.
 		if (preferenceStore == null) {
-			preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE,
-					FrameworkUtil.getBundle(PreferenceSpyConfiguration.class).getSymbolicName());
-
+			preferenceStore = 	InstanceScope.INSTANCE.getNode(bundleId);;
 		}
 		return preferenceStore;
 	}
diff --git a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/addon/PreferenceSpyAddon.java b/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/addon/PreferenceSpyAddon.java
index 31adce2..315003c 100644
--- a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/addon/PreferenceSpyAddon.java
+++ b/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/addon/PreferenceSpyAddon.java
@@ -13,7 +13,6 @@
  *******************************************************************************/
 package org.eclipse.pde.spy.preferences.addon;
 
-import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
 import org.eclipse.core.internal.preferences.EclipsePreferences;
@@ -29,8 +28,6 @@
 import org.eclipse.e4.core.di.extensions.Preference;
 import org.eclipse.e4.core.services.events.IEventBroker;
 import org.eclipse.e4.core.services.log.Logger;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.pde.spy.preferences.PreferenceSpyConfiguration;
 import org.eclipse.pde.spy.preferences.constants.PreferenceConstants;
 import org.eclipse.pde.spy.preferences.constants.PreferenceSpyEventTopics;
 import org.osgi.service.prefs.BackingStoreException;
@@ -114,14 +111,7 @@
 		}
 	}
 
-	@PostConstruct
-	public void initializeDefaultPreferences() {
-		IPreferenceStore store = PreferenceSpyConfiguration.getPreferenceStore();
-		store.setDefault(PreferenceConstants.TRACE_PREFERENCES, false);
-	}
-
 	private final class ChangedPreferenceListener implements IPreferenceChangeListener {
-
 		@Override
 		public void preferenceChange(PreferenceChangeEvent event) {
 			eventBroker.post(PreferenceSpyEventTopics.PREFERENCESPY_PREFERENCE_CHANGED, event);
diff --git a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/model/PreferenceEntryPatternFilter.java b/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/model/PreferenceEntryPatternFilter.java
index 00c62a7..e332f92 100644
--- a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/model/PreferenceEntryPatternFilter.java
+++ b/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/model/PreferenceEntryPatternFilter.java
@@ -13,8 +13,8 @@
  *******************************************************************************/
 package org.eclipse.pde.spy.preferences.model;
 
+import org.eclipse.e4.ui.dialogs.filteredtree.PatternFilter;
 import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.dialogs.PatternFilter;
 
 public class PreferenceEntryPatternFilter extends PatternFilter {
 
diff --git a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/parts/PreferenceSpyPart.java b/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/parts/PreferenceSpyPart.java
index 1d73e62..4d4d736 100644
--- a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/parts/PreferenceSpyPart.java
+++ b/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/parts/PreferenceSpyPart.java
@@ -28,6 +28,7 @@
 import org.eclipse.e4.core.di.annotations.Optional;
 import org.eclipse.e4.core.di.extensions.Preference;
 import org.eclipse.e4.ui.di.UIEventTopic;
+import org.eclipse.e4.ui.dialogs.filteredtree.FilteredTree;
 import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
 import org.eclipse.e4.ui.workbench.modeling.EModelService;
 import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
@@ -55,7 +56,6 @@
 import org.eclipse.swt.graphics.Font;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.dialogs.FilteredTree;
 
 public class PreferenceSpyPart {
 
@@ -72,8 +72,7 @@
 
 		PreferenceEntryPatternFilter patternFilter = new PreferenceEntryPatternFilter();
 		patternFilter.setIncludeLeadingWildcard(true);
-		filteredTree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, patternFilter,
-				true, true);
+		filteredTree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, patternFilter);
 
 		Tree table = filteredTree.getViewer().getTree();
 		table.setHeaderVisible(true);
diff --git a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/preferencepage/TracePreferencePage.java b/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/preferencepage/TracePreferencePage.java
deleted file mode 100644
index 439bfff..0000000
--- a/ui/org.eclipse.pde.spy.preferences/src/org/eclipse/pde/spy/preferences/preferencepage/TracePreferencePage.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 vogella GmbH.
- *
- * 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:
- *     Simon Scholz <simon.scholz@vogella.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.pde.spy.preferences.preferencepage;
-
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.pde.spy.preferences.PreferenceSpyConfiguration;
-import org.eclipse.pde.spy.preferences.constants.PreferenceConstants;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-public class TracePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
-	public TracePreferencePage() {
-		super(GRID);
-		setPreferenceStore(PreferenceSpyConfiguration.getPreferenceStore());
-		setDescription(Messages.TracePreferencePage_Settings_for_preference_spy);
-	}
-
-	/**
-	 * Creates the field editors
-	 */
-	@Override
-	public void createFieldEditors() {
-		addField(new BooleanFieldEditor(PreferenceConstants.TRACE_PREFERENCES, Messages.TracePreferencePage_Trace_preference_values,
-				getFieldEditorParent()));
-		addField(new BooleanFieldEditor(PreferenceConstants.HIERARCHICAL_LAYOUT, Messages.TracePreferencePage_Use_hierarchical_layout_in_the_tree,
-				getFieldEditorParent()));
-	}
-
-	@Override
-	public void init(IWorkbench workbench) {
-	}
-}