Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 39576 Details for
Bug 126413
ShapeColorsAndFontsPropertySection.refresh and ColorsAndFontsPropertySection.refresh leak image handles
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Disposes Images
PropertiesViewCleanupR1.patch (text/plain), 13.19 KB, created by
Nicholas Doyle
on 2006-04-26 15:23:51 EDT
(
hide
)
Description:
Disposes Images
Filename:
MIME Type:
Creator:
Nicholas Doyle
Created:
2006-04-26 15:23:51 EDT
Size:
13.19 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.runtime.diagram.ui.properties >Index: src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ConnectionAppearancePropertySection.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui.properties/src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ConnectionAppearancePropertySection.java,v >retrieving revision 1.4 >diff -u -r1.4 ConnectionAppearancePropertySection.java >--- src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ConnectionAppearancePropertySection.java 28 Feb 2006 02:30:41 -0000 1.4 >+++ src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ConnectionAppearancePropertySection.java 26 Apr 2006 19:06:05 -0000 >@@ -128,7 +128,7 @@ > * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.AbstractNotationPropertiesSection#initializeControls(org.eclipse.swt.widgets.Composite) > */ > protected void initializeControls(Composite parent) { >- createPaintedSectionComposite(parent); >+ super.initializeControls(parent); > Composite groups = getWidgetFactory().createComposite(composite); > groups.setLayout(new GridLayout(2, false)); > createFontsAndColorsGroups(groups); >Index: src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ShapeColorsAndFontsPropertySection.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui.properties/src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ShapeColorsAndFontsPropertySection.java,v >retrieving revision 1.9 >diff -u -r1.9 ShapeColorsAndFontsPropertySection.java >--- src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ShapeColorsAndFontsPropertySection.java 28 Feb 2006 02:30:41 -0000 1.9 >+++ src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ShapeColorsAndFontsPropertySection.java 26 Apr 2006 19:06:05 -0000 >@@ -21,7 +21,6 @@ > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.ToolBar; > > /** > * Colors section to represent line, font and fill colors properties of a 2D shape >@@ -33,8 +32,8 @@ > extends ColorsAndFontsPropertySection { > > >- protected ToolBar createFontsGroup(Composite contents) { >- ToolBar toolBar = super.createFontsGroup(contents); >+ protected Composite createFontsGroup(Composite contents) { >+ Composite toolBar = super.createFontsGroup(contents); > > fillColorButton.addSelectionListener(new SelectionAdapter() { > >@@ -95,6 +94,7 @@ > DiagramUIPropertiesImages.DESC_FILL_COLOR > .getImageData(), fillColor).createImage(); > fillColorButton.setImage(overlyedImage); >+ overlyedImage.dispose(); > } > } > >Index: src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ColorsAndFontsPropertySection.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui.properties/src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ColorsAndFontsPropertySection.java,v >retrieving revision 1.13 >diff -u -r1.13 ColorsAndFontsPropertySection.java >--- src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ColorsAndFontsPropertySection.java 28 Feb 2006 02:30:41 -0000 1.13 >+++ src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/appearance/ColorsAndFontsPropertySection.java 26 Apr 2006 19:06:05 -0000 >@@ -38,11 +38,8 @@ > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CCombo; >-import org.eclipse.swt.events.PaintEvent; >-import org.eclipse.swt.events.PaintListener; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; >-import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.graphics.ImageData; > import org.eclipse.swt.graphics.PaletteData; >@@ -50,12 +47,10 @@ > import org.eclipse.swt.graphics.RGB; > import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.CoolBar; >-import org.eclipse.swt.widgets.CoolItem; > import org.eclipse.swt.widgets.Group; >-import org.eclipse.swt.widgets.ToolBar; >-import org.eclipse.swt.widgets.ToolItem; >+import org.eclipse.swt.widgets.Label; > import org.eclipse.ui.IWorkbenchPart; > > /** >@@ -89,7 +84,7 @@ > protected static final String FONTS_AND_COLORS_LABEL = DiagramUIPropertiesMessages. > FontAndColor_nameLabel; > >- protected ToolItem fillColorButton; >+ protected Button fillColorButton; > > protected RGB fillColor = null; > >@@ -99,9 +94,9 @@ > // font size drop down > private CCombo fontSizeCombo; > >- private ToolItem fontBoldButton; >+ private Button fontBoldButton; > >- private ToolItem fontItalicButton; >+ private Button fontItalicButton; > > /** > * An image descriptor that overlays two images: a basic icon and a thin >@@ -161,16 +156,14 @@ > /** the default preference color */ > protected static final RGB DEFAULT_PREF_COLOR = new RGB(0, 0, 0); > >- protected ToolItem fontColorButton; >+ protected Button fontColorButton; > >- protected ToolItem lineColorButton; >+ protected Button lineColorButton; > > protected RGB fontColor; > > protected RGB lineColor; > >- private CoolBar coolBar; >- > protected Group colorsAndFontsGroup; > > >@@ -179,7 +172,7 @@ > * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.AbstractNotationPropertiesSection#initializeControls(org.eclipse.swt.widgets.Composite) > */ > protected void initializeControls(Composite parent) { >- createPaintedSectionComposite(parent); >+ super.initializeControls(parent); > createFontsAndColorsGroups(composite); > } > >@@ -194,33 +187,15 @@ > GridLayout layout = new GridLayout(1, false); > colorsAndFontsGroup.setLayout(layout); > >- ToolBar toolBar = createFontsGroup(colorsAndFontsGroup); >+ /*Composite toolBar = */createFontsGroup(colorsAndFontsGroup); > >- CoolItem coolItem = new CoolItem(coolBar, SWT.NULL); >+ //CoolItem coolItem = new CoolItem(coolBar, SWT.NULL); > // set the control of the coolItem >- coolItem.setControl(toolBar); >+ //coolItem.setControl(toolBar); > // You have to specify the size >- Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT); >- Point coolSize = coolItem.computeSize(size.x, size.y); >- coolItem.setSize(coolSize); >- >- colorsAndFontsGroup.addPaintListener(new PaintListener() { >- >- public void paintControl(PaintEvent e) { >- Rectangle bounds = colorsAndFontsGroup.getClientArea(); >- GC gc = e.gc; >- >- gc.setForeground(gc.getBackground()); >- gc.setBackground(coolBar.getBackground()); >- >- gc.fillGradientRectangle(1, bounds.height / 2, >- bounds.width + 3, bounds.height - 14, true); >- >- } >- >- } >- >- ); >+ //Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT); >+ //Point coolSize = coolItem.computeSize(size.x, size.y); >+ //coolItem.setSize(coolSize); > > return colorsAndFontsGroup; > >@@ -232,7 +207,7 @@ > * @param parent - parent composite > * @return - font tool bar > */ >- protected ToolBar createFontsGroup(Composite parent) { >+ protected Composite createFontsGroup(Composite parent) { > Composite familySize = getWidgetFactory().createComposite(parent); > GridLayout layout = new GridLayout(2, false); > layout.horizontalSpacing = 0; >@@ -261,14 +236,15 @@ > } > }); > >- coolBar = new CoolBar(parent, SWT.BORDER); >- ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT); >+ Composite toolBar = new Composite(parent, SWT.SHADOW_NONE); >+ toolBar.setLayout(new GridLayout(7, false)); >+ toolBar.setBackground(parent.getBackground()); > >- fontBoldButton = new ToolItem(toolBar, SWT.CHECK); >+ fontBoldButton = new Button(toolBar, SWT.TOGGLE); > fontBoldButton.setImage(DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_BOLD)); > > >- fontItalicButton = new ToolItem(toolBar, SWT.CHECK ); >+ fontItalicButton = new Button(toolBar, SWT.TOGGLE ); > fontItalicButton.setImage(DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_ITALIC)); > > fontBoldButton.addSelectionListener(new SelectionAdapter() { >@@ -285,9 +261,9 @@ > } > }); > >- new ToolItem(toolBar, SWT.SEPARATOR); >+ new Label(toolBar, SWT.LEFT); > >- fontColorButton = new ToolItem(toolBar, SWT.DROP_DOWN); >+ fontColorButton = new Button(toolBar, SWT.PUSH); > fontColorButton.setImage(DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FONT_COLOR)); > > fontColorButton.addSelectionListener(new SelectionAdapter() { >@@ -297,9 +273,9 @@ > } > }); > >- new ToolItem(toolBar, SWT.SEPARATOR); >+ new Label(toolBar, SWT.LEFT); > >- lineColorButton = new ToolItem(toolBar, SWT.DROP_DOWN); >+ lineColorButton = new Button(toolBar, SWT.PUSH); > lineColorButton.setImage(DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_LINE_COLOR)); > > lineColorButton.addSelectionListener(new SelectionAdapter() { >@@ -309,7 +285,7 @@ > } > }); > >- fillColorButton = new ToolItem(toolBar, SWT.DROP_DOWN); >+ fillColorButton = new Button(toolBar, SWT.PUSH); > fillColorButton.setImage(DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FILL_COLOR)); > > fillColorButton.setEnabled(false); >@@ -375,7 +351,7 @@ > * color is set > * @return - new RGB color, or null if none selected > */ >- protected RGB changeColor(SelectionEvent event, ToolItem button, >+ protected RGB changeColor(SelectionEvent event, Button button, > String preferenceId, final String propertyId, String commandName, > ImageDescriptor imageDescriptor) { > >@@ -537,11 +513,13 @@ > DiagramUIPropertiesImages.DESC_FONT_COLOR.getImageData(), > fontColor).createImage(); > fontColorButton.setImage(overlyedImage); >+ overlyedImage.dispose(); > > overlyedImage = new ColorOverlayImageDescriptor( > DiagramUIPropertiesImages.DESC_LINE_COLOR.getImageData(), > lineColor).createImage(); > lineColorButton.setImage(overlyedImage); >+ overlyedImage.dispose(); > > executeAsReadAction(new Runnable() { > >Index: src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/AbstractNotationPropertiesSection.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui.properties/src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/AbstractNotationPropertiesSection.java,v >retrieving revision 1.6 >diff -u -r1.6 AbstractNotationPropertiesSection.java >--- src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/AbstractNotationPropertiesSection.java 28 Feb 2006 02:30:41 -0000 1.6 >+++ src/org/eclipse/gmf/runtime/diagram/ui/properties/sections/AbstractNotationPropertiesSection.java 26 Apr 2006 19:06:05 -0000 >@@ -21,13 +21,8 @@ > import org.eclipse.gmf.runtime.notation.View; > import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.viewers.ILabelProvider; >-import org.eclipse.swt.events.PaintEvent; >-import org.eclipse.swt.events.PaintListener; >-import org.eclipse.swt.graphics.GC; >-import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.layout.FormLayout; > import org.eclipse.swt.widgets.Composite; >-import org.eclipse.ui.forms.FormColors; > import org.eclipse.ui.views.properties.IPropertyDescriptor; > import org.eclipse.ui.views.properties.IPropertySource; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; >@@ -48,8 +43,6 @@ > > protected Composite composite; > >- protected PaintListener painter; >- > /** > * > * Get a label provider to do the translation Most entries on this page are >@@ -113,63 +106,9 @@ > * @param parent - parent composite > */ > protected void initializeControls(Composite parent) { >- createPaintedSectionComposite(parent); >- } >- >- /** >- * Create a composite for the section >- * >- * @param parent - parent widget to host the section's composite >- */ >- protected Composite createPaintedSectionComposite(Composite parent) { > composite = getWidgetFactory().createFlatFormComposite(parent); >- > FormLayout layout = (FormLayout) composite.getLayout(); > layout.spacing = 3; >- >- painter = createPainter(); >- composite.addPaintListener(painter); >- return composite; >- } >- >- /* >- * (non-Javadoc) >- * >- * @see org.eclipse.ui.views.properties.tabbed.ISection#dispose() >- */ >- public void dispose() { >- if (composite != null && ! composite.isDisposed() && painter != null) >- composite.removePaintListener(painter); >- super.dispose(); >- >- } >- >- /** >- * @return - create and return a painter for the section composite which >- * will do partial gradient color fill fopr the section widget >- */ >- protected PaintListener createPainter() { >- return new PaintListener() { >- >- public void paintControl(PaintEvent e) { >- Rectangle bounds = composite.getClientArea(); >- GC gc = e.gc; >- >- gc.setForeground(gc.getBackground()); >- gc.setBackground(getWidgetFactory().getColors().getColor( >- FormColors.TB_BG)); >- >- gc.fillGradientRectangle(4 + bounds.width / 2, 0, >- bounds.width / 2 - 9, bounds.height, false); >- >- gc.setForeground(getWidgetFactory().getColors().getColor( >- FormColors.TB_BORDER)); >- gc.drawLine(bounds.width - 5, 0, bounds.width - 5, >- bounds.height); >- } >- >- }; >- > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 126413
: 39576