1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 12:55:40 +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

@ -905,17 +905,19 @@ implements
@Override @Override
public void dispose() { public void dispose() {
if (displayedConfig) forEach(ICPropertyTab.DISPOSE); if (displayedConfig) forEach(ICPropertyTab.DISPOSE);
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;
cfgDescs = null; cfgDescs = null;
} }
} }
/** /**
* The only method to be redefined in descendants * The only method to be redefined in descendants
* @return * @return

View file

@ -37,7 +37,10 @@ import org.eclipse.cdt.ui.CUIPlugin;
* *
* When page's "performOK" called, it should call * When page's "performOK" called, it should call
* 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()
@ -116,8 +119,17 @@ public class CDTPropertyManager {
prjd = null; prjd = null;
saveDone = false; saveDone = false;
} }
} }
/**
* 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
@ -141,17 +153,14 @@ public class CDTPropertyManager {
public static boolean isSaveDone() { return saveDone; } public static boolean isSaveDone() { return saveDone; }
public static int getPagesCount() { return pages.size(); } public static int getPagesCount() { return pages.size(); }
public static Object getPage(int index) { return pages.get(index); } public static Object getPage(int index) { return pages.get(index); }
// 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);
@ -160,24 +169,17 @@ public class CDTPropertyManager {
} }
} }
} }
if (pages.isEmpty()) {
if (pages.size() == 0) {
// if(!saveDone){
// if(prjd != null){
// saveDone = !prjd.isModified();
// }
// }
saveDone = true; saveDone = true;
project = null;
// if(saveDone){ prjd = null;
project = null; saveDone = false;
prjd = null;
saveDone = false;
// }
} }
} }
public void widgetDisposed(DisposeEvent e) {
dispose(e.widget);
}
} }
} }