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 12659 Details for
Bug 68031
Graphic is disposed error in Ctrl+e editor dropdown
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Workaround in jface
jface-workaround.diff (text/plain), 5.53 KB, created by
Billy Biggs
on 2004-06-22 12:25:23 EDT
(
hide
)
Description:
Workaround in jface
Filename:
MIME Type:
Creator:
Billy Biggs
Created:
2004-06-22 12:25:23 EDT
Size:
5.53 KB
patch
obsolete
>Index: src/org/eclipse/jface/viewers/TableViewer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java,v >retrieving revision 1.13 >diff -u -r1.13 TableViewer.java >--- src/org/eclipse/jface/viewers/TableViewer.java 17 Jun 2004 02:12:37 -0000 1.13 >+++ src/org/eclipse/jface/viewers/TableViewer.java 22 Jun 2004 16:15:26 -0000 >@@ -454,72 +454,93 @@ > */ > protected void internalRefresh(Object element, boolean updateLabels) { > tableViewerImpl.applyEditorValue(); >- if (element == null || equals(element, getRoot())) { >- // the parent >+ boolean usingMotif = "motif".equals(SWT.getPlatform());//$NON-NLS-1$ >+ try { >+ if (usingMotif) { >+ // This avoids a "graphic is disposed" error on Motif by not letting >+ // it redraw while we remove entries. Some items in this table are >+ // being removed and may have icons which may have already been >+ // disposed elsewhere. >+ table.setRedraw(false); >+ } >+ >+ if (element == null || equals(element, getRoot())) { >+ // the parent >+ >+ // in the code below, it is important to do all disassociates >+ // before any associates, since a later disassociate can undo an >+ // earlier associate >+ // e.g. if (a, b) is replaced by (b, a), the disassociate of b >+ // to item 1 could undo >+ // the associate of b to item 0. > >- // in the code below, it is important to do all disassociates >- // before any associates, since a later disassociate can undo an earlier associate >- // e.g. if (a, b) is replaced by (b, a), the disassociate of b to item 1 could undo >- // the associate of b to item 0. >- >- Object[] children = getSortedChildren(getRoot()); >- TableItem[] items = table.getItems(); >- int min = Math.min(children.length, items.length); >- for (int i = 0; i < min; ++i) { >- // if the element is unchanged, update its label if appropriate >- if (equals(children[i], items[i].getData())) { >- if (updateLabels) { >- updateItem(items[i], children[i]); >- } >- else { >- // associate the new element, even if equal to the old one, >- // to remove stale references (see bug 31314) >- associate(children[i], items[i]); >+ Object[] children = getSortedChildren(getRoot()); >+ TableItem[] items = table.getItems(); >+ int min = Math.min(children.length, items.length); >+ for (int i = 0; i < min; ++i) { >+ // if the element is unchanged, update its label if >+ // appropriate >+ if (equals(children[i], items[i].getData())) { >+ if (updateLabels) { >+ updateItem(items[i], children[i]); >+ } else { >+ // associate the new element, even if equal to the >+ // old one, >+ // to remove stale references (see bug 31314) >+ associate(children[i], items[i]); >+ } >+ } else { >+ // updateItem does an associate(...), which can mess up >+ // the associations if the order of elements has >+ // changed. >+ // E.g. (a, b) -> (b, a) first replaces a->0 with b->0, >+ // then replaces b->1 with a->1, but this actually >+ // removes b->0. >+ // So, if the object associated with this item has >+ // changed, >+ // just disassociate it for now, and update it below. >+ items[i].setText(""); //$NON-NLS-1$ >+ items[i].setImage(new Image[0]); >+ disassociate(items[i]); >+ } >+ } >+ >+ // dispose of all items beyond the end of the current elements >+ if (min < items.length) { >+ for (int i = items.length; --i >= min;) { >+ disassociate(items[i]); >+ } >+ table.remove(min, items.length - 1); >+ } >+ >+ // Workaround for 1GDGN4Q: ITPUI:WIN2000 - TableViewer icons get >+ // scrunched >+ if (table.getItemCount() == 0) { >+ table.removeAll(); >+ } >+ >+ // Update items which were removed above >+ for (int i = 0; i < min; ++i) { >+ if (items[i].getData() == null) { >+ updateItem(items[i], children[i]); >+ } > } >- } >- else { >- // updateItem does an associate(...), which can mess up >- // the associations if the order of elements has changed. >- // E.g. (a, b) -> (b, a) first replaces a->0 with b->0, then replaces b->1 with a->1, but this actually removes b->0. >- // So, if the object associated with this item has changed, >- // just disassociate it for now, and update it below. >- items[i].setText(""); //$NON-NLS-1$ >- items[i].setImage(new Image[0]); >- disassociate(items[i]); >- } >- } >- >- // dispose of all items beyond the end of the current elements >- if (min < items.length) { >- for (int i = items.length; --i >= min;) { >- disassociate(items[i]); >- } >- table.remove(min, items.length-1); >- } >- >- // Workaround for 1GDGN4Q: ITPUI:WIN2000 - TableViewer icons get scrunched >- if (table.getItemCount() == 0) { >- table.removeAll(); >- } > >- // Update items which were removed above >- for (int i = 0; i < min; ++i) { >- if (items[i].getData() == null) { >- updateItem(items[i], children[i]); >+ // add any remaining elements >+ for (int i = min; i < children.length; ++i) { >+ updateItem(new TableItem(table, SWT.NONE, i), children[i]); >+ } >+ } else { >+ Widget w = findItem(element); >+ if (w != null) { >+ updateItem(w, element); >+ } >+ } >+ } finally { >+ if (usingMotif) { >+ table.setRedraw(true); > } > } >- >- // add any remaining elements >- for (int i = min; i < children.length; ++i) { >- updateItem(new TableItem(table, SWT.NONE, i), children[i]); >- } >- } >- else { >- Widget w = findItem(element); >- if (w != null) { >- updateItem(w, element); >- } >- } > } > /** > * Removes the given elements from this table viewer.
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 68031
:
12659
|
12672