diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SharedTextColors.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SharedTextColors.java deleted file mode 100644 index dc14db01941..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SharedTextColors.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.internal.ui.editor; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.jface.text.source.ISharedTextColors; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; - -/* - * @see org.eclipse.jface.text.source.ISharedTextColors - * @since 2.1 - */ -public class SharedTextColors implements ISharedTextColors { - - /** The display table. */ - private Map fDisplayTable; - - /** Creates an returns a shared color manager. */ - public SharedTextColors() { - super(); - } - - /* - * @see ISharedTextColors#getColor(RGB) - */ - public Color getColor(RGB rgb) { - if (rgb == null) - return null; - - if (fDisplayTable == null) - fDisplayTable= new HashMap(2); - - Display display= Display.getCurrent(); - - Map colorTable= (Map) fDisplayTable.get(display); - if (colorTable == null) { - colorTable= new HashMap(10); - fDisplayTable.put(display, colorTable); - } - - Color color= (Color) colorTable.get(rgb); - if (color == null) { - color= new Color(display, rgb); - colorTable.put(rgb, color); - } - - return color; - } - - /* - * @see ISharedTextColors#dispose() - */ - public void dispose() { - if (fDisplayTable != null) { - Iterator j= fDisplayTable.values().iterator(); - while (j.hasNext()) { - Iterator i= ((Map) j.next()).values().iterator(); - while (i.hasNext()) - ((Color) i.next()).dispose(); - } - } - } - -} - diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java index e08cf953c08..de5e32f0a1e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java @@ -83,7 +83,6 @@ import org.eclipse.cdt.internal.ui.buildconsole.BuildConsoleManager; import org.eclipse.cdt.internal.ui.editor.ASTProvider; import org.eclipse.cdt.internal.ui.editor.CDocumentProvider; import org.eclipse.cdt.internal.ui.editor.CustomBufferFactory; -import org.eclipse.cdt.internal.ui.editor.SharedTextColors; import org.eclipse.cdt.internal.ui.editor.WorkingCopyManager; import org.eclipse.cdt.internal.ui.editor.asm.AsmTextTools; import org.eclipse.cdt.internal.ui.refactoring.CTextFileChangeFactory; @@ -335,8 +334,6 @@ public class CUIPlugin extends AbstractUIPlugin { // ------ CUIPlugin - - private ISharedTextColors fSharedTextColors; private ImageDescriptorRegistry fImageDescriptorRegistry; private CEditorTextHoverDescriptor[] fCEditorTextHoverDescriptors; @@ -599,10 +596,9 @@ public class CUIPlugin extends AbstractUIPlugin { manager.unregisterAdapters(fCElementAdapterFactory); } + /** @deprecated Use {@link EditorsUI#getSharedTextColors()} instead. */ public ISharedTextColors getSharedTextColors() { - if (fSharedTextColors == null) - fSharedTextColors= new SharedTextColors(); - return fSharedTextColors; + return EditorsUI.getSharedTextColors(); } public void configurePluginDebugOptions(){ diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/SharedTextColors.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/SharedTextColors.java deleted file mode 100644 index 46b016c39fd..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/SharedTextColors.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.editors; - -import java.util.Iterator; -import org.eclipse.swt.widgets.Display; -import java.util.Map; -import java.util.HashMap; -import org.eclipse.swt.graphics.Color; -import org.eclipse.jface.text.source.ISharedTextColors; -import org.eclipse.swt.graphics.RGB; - -/* - * @see org.eclipse.jface.text.source.ISharedTextColors - * @since 2.1 - */ -class SharedTextColors implements ISharedTextColors { - - /** The display table. */ - private Map fDisplayTable; - - /** Creates an returns a shared color manager. */ - public SharedTextColors() { - super(); - } - - /* - * @see ISharedTextColors#getColor(RGB) - */ - public Color getColor(RGB rgb) { - if (rgb == null) - return null; - - if (fDisplayTable == null) - fDisplayTable= new HashMap(2); - - Display display= Display.getCurrent(); - - Map colorTable= (Map) fDisplayTable.get(display); - if (colorTable == null) { - colorTable= new HashMap(10); - fDisplayTable.put(display, colorTable); - } - - Color color= (Color) colorTable.get(rgb); - if (color == null) { - color= new Color(display, rgb); - colorTable.put(rgb, color); - } - - return color; - } - - /* - * @see ISharedTextColors#dispose() - */ - public void dispose() { - if (fDisplayTable != null) { - Iterator j= fDisplayTable.values().iterator(); - while (j.hasNext()) { - Iterator i= ((Map) j.next()).values().iterator(); - while (i.hasNext()) - ((Color) i.next()).dispose(); - } - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java index 4398765025b..4b378853e1f 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 QNX Software Systems and others. + * Copyright (c) 2004, 2008 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * Contributors: * QNX Software Systems - Initial API and implementation * ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981 + * Anton Leherbauer (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.debug.ui; @@ -43,6 +44,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -66,8 +68,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin { private CDebugImageDescriptorRegistry fImageDescriptorRegistry; - private ISharedTextColors fSharedTextColors; - /** * The constructor. */ @@ -276,10 +276,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin { */ public void stop( BundleContext context ) throws Exception { CDebugCorePlugin.getDefault().removeCBreakpointListener( CBreakpointUpdater.getInstance() ); - if ( fSharedTextColors != null ) { - fSharedTextColors.dispose(); - fSharedTextColors = null; - } if ( fImageDescriptorRegistry != null ) { fImageDescriptorRegistry.dispose(); } @@ -293,8 +289,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin { * @since 3.1 */ public ISharedTextColors getSharedTextColors() { - if ( fSharedTextColors == null ) - fSharedTextColors = CUIPlugin.getDefault().getSharedTextColors(); - return fSharedTextColors; + return EditorsUI.getSharedTextColors(); } }