Bug 552134: org.eclipse.rcp misses dependencies

Copy BoldStyleProvider from org.eclipse.jface.text to org.eclipse.jface
so that we don't need the dependency to org.eclipse.jface.text.

Change-Id: Iae9773786ed7d60c22376c5117b531277c243d64
Signed-off-by: Matthias Becker <ma.becker@sap.com>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/BoldStylerProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/BoldStylerProvider.java
new file mode 100644
index 0000000..cc97fcd
--- /dev/null
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/BoldStylerProvider.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2015, 2016 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.jface.viewers;
+
+import org.eclipse.jface.viewers.StyledString.Styler;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.TextStyle;
+
+
+/**
+ * Provides {@link Styler} that applies bold style on the given font.
+ *
+ * @since 3.18
+ */
+public final class BoldStylerProvider {
+
+	private Font fFont;
+
+	private Font fBoldFont;
+
+	private Styler fBoldStyler;
+
+	/**
+	 * Creates a {@link BoldStylerProvider} instance which uses the given <code>font</code>.
+	 *
+	 * @param font the font to use for creating the bold font
+	 */
+	public BoldStylerProvider(Font font) {
+		fFont= font;
+	}
+
+	/**
+	 * Disposes the bold font created for the styler.
+	 */
+	public void dispose() {
+		if (fBoldFont != null) {
+			fBoldFont.dispose();
+			fBoldFont= null;
+		}
+	}
+
+	/**
+	 * Returns a {@link Styler} that applies bold style to the given {@link TextStyle}'s font.
+	 *
+	 * @return a bold styler
+	 */
+	public Styler getBoldStyler() {
+		if (fBoldStyler == null) {
+			fBoldStyler= new Styler() {
+				@Override
+				public void applyStyles(TextStyle textStyle) {
+					textStyle.font= getBoldFont();
+				}
+			};
+		}
+		return fBoldStyler;
+	}
+
+	/**
+	 * Creates (if not already done) and returns the bold font used by the styler to apply the bold
+	 * style.
+	 *
+	 * <p>
+	 * <strong>Note:</strong> The callers must not cache and re-use the returned font outside the
+	 * current call.
+	 * </p>
+	 *
+	 * @return the bold font used by the styler
+	 */
+	public Font getBoldFont() {
+		if (fBoldFont == null) {
+			FontData[] data= fFont.getFontData();
+			for (FontData element : data) {
+				element.setStyle(SWT.BOLD);
+			}
+			fBoldFont= new Font(fFont.getDevice(), data);
+		}
+		return fBoldFont;
+	}
+
+	/**
+	 * Returns the font used by the styler to create the bold font.
+	 *
+	 * @return the font used for creating the bold font
+	 */
+	public Font getFont() {
+		return fFont;
+	}
+
+}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java
index f6728cb..1be8f64 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java
@@ -58,7 +58,7 @@
 import org.eclipse.jface.action.LegacyActionTools;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.text.contentassist.BoldStylerProvider;
+import org.eclipse.jface.viewers.BoldStylerProvider;
 import org.eclipse.jface.viewers.ContentViewer;
 import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
 import org.eclipse.jface.viewers.IColorProvider;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbookEditorsHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbookEditorsHandler.java
index 748687d..7992ef1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbookEditorsHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbookEditorsHandler.java
@@ -25,7 +25,7 @@
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer;
 import org.eclipse.e4.ui.workbench.swt.internal.copy.SearchPattern;
-import org.eclipse.jface.text.contentassist.BoldStylerProvider;
+import org.eclipse.jface.viewers.BoldStylerProvider;
 import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
 import org.eclipse.jface.viewers.StyledCellLabelProvider;
 import org.eclipse.jface.viewers.StyledString;
diff --git a/bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF
index ef036d3..0839dc9 100644
--- a/bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF
@@ -93,7 +93,6 @@
 Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.14.0,4.0.0)",
  org.eclipse.help;bundle-version="[3.2.0,4.0.0)",
  org.eclipse.jface;bundle-version="[3.15.0,4.0.0)",
- org.eclipse.jface.text;bundle-version="[3.15.200,4.0.0)",
  org.eclipse.swt;bundle-version="[3.107.0,4.0.0)",
  org.eclipse.jface.databinding;bundle-version="[1.3.0,2.0.0)",
  org.eclipse.core.databinding.property;bundle-version="[1.2.0,2.0.0)",