1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 13:55:39 +02:00

[244035] - applied patch for class cast exception

This commit is contained in:
Alena Laskavaia 2008-12-03 19:09:24 +00:00
parent 513bac33e5
commit 4eb977ee74
2 changed files with 31 additions and 27 deletions

View file

@ -909,6 +909,8 @@ implements
if (!isNewOpening) if (!isNewOpening)
handleResize(false); // save page size handleResize(false); // save page size
isNewOpening = true; isNewOpening = true;
// Remove this page from the property manager
CDTPropertyManager.remove(this);
// clear static variables // clear static variables
if (CDTPropertyManager.getPagesCount() == 0) { if (CDTPropertyManager.getPagesCount() == 0) {
resd = null; resd = null;

View file

@ -39,6 +39,9 @@ import org.eclipse.cdt.ui.CUIPlugin;
* manager's method * manager's method
* performOk() * performOk()
* *
* Registered pages can call {@link CDTPropertyManager#remove(Object)}
* to explicitly remove themselves from this manager.
*
* In addition, there are utility methods for pages: * In addition, there are utility methods for pages:
* getPagesCount() * getPagesCount()
* getPage() * getPage()
@ -118,6 +121,15 @@ public class CDTPropertyManager {
} }
} }
/**
* Explicitly remove the page from this CDTPropertyManager
* @param p
* @since 5.1
*/
public static void remove(Object p) {
DListener.dispose(p);
}
/** /**
* Performs mandatory saving * Performs mandatory saving
* @param p * @param p
@ -144,14 +156,11 @@ public class CDTPropertyManager {
// Removes disposed items from list // Removes disposed items from list
static class DListener implements DisposeListener { static class DListener implements DisposeListener {
public void widgetDisposed(DisposeEvent e) { public static void dispose (Object w) {
Widget w = e.widget;
if (pages.contains(w)) { // Widget ? if (pages.contains(w)) { // Widget ?
pages.remove(w); pages.remove(w);
} else { // Property Page ? } else { // Property Page ?
Iterator<Object> it = pages.iterator(); for (Object ob : pages) {
while (it.hasNext()) {
Object ob = it.next();
if (ob != null && ob instanceof PropertyPage) { if (ob != null && ob instanceof PropertyPage) {
if (((PropertyPage)ob).getControl().equals(w)) { if (((PropertyPage)ob).getControl().equals(w)) {
pages.remove(ob); pages.remove(ob);
@ -161,23 +170,16 @@ public class CDTPropertyManager {
} }
} }
if (pages.isEmpty()) {
if (pages.size() == 0) {
// if(!saveDone){
// if(prjd != null){
// saveDone = !prjd.isModified();
// }
// }
saveDone = true; saveDone = true;
// if(saveDone){
project = null; project = null;
prjd = null; prjd = null;
saveDone = false; saveDone = false;
// }
} }
} }
public void widgetDisposed(DisposeEvent e) {
dispose(e.widget);
}
} }
} }