mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Discouraged access to EditorsPlugin. Added support for SharedTextColors to CDebugUIPlugin.
This commit is contained in:
parent
26c21da5a6
commit
bd4f3660ec
4 changed files with 104 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2006-02-27 Mikhail Khodjaiants
|
||||||
|
Discouraged access to EditorsPlugin.
|
||||||
|
Added support for SharedTextColors to CDebugUIPlugin.
|
||||||
|
+ SharedTextColors.java
|
||||||
|
* DisassemblyView.java
|
||||||
|
* CDebugUIPlugin.java
|
||||||
|
|
||||||
2006-02-27 Mikhail Khodjaiants
|
2006-02-27 Mikhail Khodjaiants
|
||||||
Bug 89429: replaced the usage of the internal SourceLookupUIUtils class by DebugUITools.
|
Bug 89429: replaced the usage of the internal SourceLookupUIUtils class by DebugUITools.
|
||||||
* AddSourceContainerDialog.java
|
* AddSourceContainerDialog.java
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2000, 2005 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -79,7 +79,6 @@ import org.eclipse.ui.IViewPart;
|
||||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
import org.eclipse.ui.editors.text.EditorsUI;
|
import org.eclipse.ui.editors.text.EditorsUI;
|
||||||
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
|
|
||||||
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
|
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
|
||||||
import org.eclipse.ui.texteditor.AnnotationPreference;
|
import org.eclipse.ui.texteditor.AnnotationPreference;
|
||||||
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
|
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
|
||||||
|
@ -667,7 +666,7 @@ public class DisassemblyView extends AbstractDebugEventHandlerView
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISharedTextColors getSharedColors() {
|
private ISharedTextColors getSharedColors() {
|
||||||
ISharedTextColors sharedColors= EditorsPlugin.getDefault().getSharedTextColors();
|
ISharedTextColors sharedColors = CDebugUIPlugin.getDefault().getSharedTextColors();
|
||||||
return sharedColors;
|
return sharedColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||||
import org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory;
|
import org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory;
|
||||||
import org.eclipse.cdt.debug.ui.sourcelookup.DefaultSourceLocator;
|
import org.eclipse.cdt.debug.ui.sourcelookup.DefaultSourceLocator;
|
||||||
import org.eclipse.cdt.debug.ui.sourcelookup.OldDefaultSourceLocator;
|
import org.eclipse.cdt.debug.ui.sourcelookup.OldDefaultSourceLocator;
|
||||||
|
import org.eclipse.cdt.internal.ui.editor.SharedTextColors;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -36,6 +37,7 @@ import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.model.IPersistableSourceLocator;
|
import org.eclipse.debug.core.model.IPersistableSourceLocator;
|
||||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
import org.eclipse.jface.preference.PreferenceConverter;
|
import org.eclipse.jface.preference.PreferenceConverter;
|
||||||
|
import org.eclipse.jface.text.source.ISharedTextColors;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
@ -61,6 +63,8 @@ public class CDebugUIPlugin extends AbstractUIPlugin {
|
||||||
|
|
||||||
private CDebugImageDescriptorRegistry fImageDescriptorRegistry;
|
private CDebugImageDescriptorRegistry fImageDescriptorRegistry;
|
||||||
|
|
||||||
|
private ISharedTextColors fSharedTextColors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor.
|
* The constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -268,9 +272,25 @@ public class CDebugUIPlugin extends AbstractUIPlugin {
|
||||||
*/
|
*/
|
||||||
public void stop( BundleContext context ) throws Exception {
|
public void stop( BundleContext context ) throws Exception {
|
||||||
CDebugCorePlugin.getDefault().removeCBreakpointListener( CBreakpointUpdater.getInstance() );
|
CDebugCorePlugin.getDefault().removeCBreakpointListener( CBreakpointUpdater.getInstance() );
|
||||||
|
if ( fSharedTextColors != null ) {
|
||||||
|
fSharedTextColors.dispose();
|
||||||
|
fSharedTextColors = null;
|
||||||
|
}
|
||||||
if ( fImageDescriptorRegistry != null ) {
|
if ( fImageDescriptorRegistry != null ) {
|
||||||
fImageDescriptorRegistry.dispose();
|
fImageDescriptorRegistry.dispose();
|
||||||
}
|
}
|
||||||
super.stop( context );
|
super.stop( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the shared text colors of this plug-in.
|
||||||
|
*
|
||||||
|
* @return the shared text colors
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public ISharedTextColors getSharedTextColors() {
|
||||||
|
if ( fSharedTextColors == null )
|
||||||
|
fSharedTextColors = new SharedTextColors();
|
||||||
|
return fSharedTextColors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue