1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 04:15:35 +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
public void dispose() {
if (displayedConfig) forEach(ICPropertyTab.DISPOSE);
if (!isNewOpening)
handleResize(false); // save page size
isNewOpening = true;
// Remove this page from the property manager
CDTPropertyManager.remove(this);
// clear static variables
if (CDTPropertyManager.getPagesCount() == 0) {
resd = null;
cfgDescs = null;
}
}
}
/**
* The only method to be redefined in descendants
* @return

View file

@ -37,7 +37,10 @@ import org.eclipse.cdt.ui.CUIPlugin;
*
* When page's "performOK" called, it should call
* 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:
* getPagesCount()
@ -116,8 +119,17 @@ public class CDTPropertyManager {
prjd = null;
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
* @param p
@ -141,17 +153,14 @@ public class CDTPropertyManager {
public static boolean isSaveDone() { return saveDone; }
public static int getPagesCount() { return pages.size(); }
public static Object getPage(int index) { return pages.get(index); }
// Removes disposed items from list
static class DListener implements DisposeListener {
public void widgetDisposed(DisposeEvent e) {
Widget w = e.widget;
public static void dispose (Object w) {
if (pages.contains(w)) { // Widget ?
pages.remove(w);
} else { // Property Page ?
Iterator<Object> it = pages.iterator();
while (it.hasNext()) {
Object ob = it.next();
for (Object ob : pages) {
if (ob != null && ob instanceof PropertyPage) {
if (((PropertyPage)ob).getControl().equals(w)) {
pages.remove(ob);
@ -160,24 +169,17 @@ public class CDTPropertyManager {
}
}
}
if (pages.size() == 0) {
// if(!saveDone){
// if(prjd != null){
// saveDone = !prjd.isModified();
// }
// }
if (pages.isEmpty()) {
saveDone = true;
// if(saveDone){
project = null;
prjd = null;
saveDone = false;
// }
project = null;
prjd = null;
saveDone = false;
}
}
public void widgetDisposed(DisposeEvent e) {
dispose(e.widget);
}
}
}