1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

fixed event problem

This commit is contained in:
David Inglis 2004-04-07 19:53:27 +00:00
parent 310112d6cd
commit 9ae54e47ff
3 changed files with 44 additions and 14 deletions

View file

@ -1,3 +1,10 @@
2004-04-07 David Inglis
Fixed event problem
* src/org/eclipse/cdt/core/CDescriptorEvent.java
* src/org/eclipse/cdt/internal/core/CDescriptorManager.java
2004-04-07 Alain Magloire 2004-04-07 Alain Magloire
Using a complete parser is to heavy for the typeInfo Using a complete parser is to heavy for the typeInfo

View file

@ -22,7 +22,7 @@ public class CDescriptorEvent extends EventObject {
private static final int FLAGS_MASK = 0xf; private static final int FLAGS_MASK = 0xf;
private int fType; int fType;
public CDescriptorEvent(ICDescriptor descriptor, int type, int flags) { public CDescriptorEvent(ICDescriptor descriptor, int type, int flags) {
super(descriptor); super(descriptor);
@ -40,4 +40,29 @@ public class CDescriptorEvent extends EventObject {
public int getFlags() { public int getFlags() {
return fType & ~FLAGS_MASK; return fType & ~FLAGS_MASK;
} }
public String toString() {
StringBuffer buf = new StringBuffer();
switch (getType()) {
case CDTPROJECT_ADDED :
buf.append("CDTPROJECT_ADDED"); //$NON-NLS-1$
break;
case CDTPROJECT_REMOVED :
buf.append("CDTPROJECT_REMOVED"); //$NON-NLS-1$
break;
case CDTPROJECT_CHANGED :
buf.append("CDTPROJECT_CHANGED"); //$NON-NLS-1$
break;
}
if ( (getFlags() & OWNER_CHANGED) != 0 ) {
buf.append("[OWNER CHANGED]"); //$NON-NLS-1$
}
if ( (getFlags() & EXTENSION_CHANGED) != 0 ) {
buf.append("[EXTENSION CHANGED]"); //$NON-NLS-1$
}
if (getFlags() == 0) {
buf.append("[UNSPECIFIED]"); //$NON-NLS-1$
}
return buf.toString();
}
} }

View file

@ -304,18 +304,16 @@ public class CDescriptorManager implements ICDescriptorManager, IResourceChangeL
// OWNER_CHANGED // OWNER_CHANGED
// EXT_CHANGED // EXT_CHANGED
// other // other
if (event.getType() != CDescriptorEvent.CDTPROJECT_ADDED) { if (event.getType() == CDescriptorEvent.CDTPROJECT_ADDED) {
fOperationMap.put(event.getDescriptor(), event); fOperationMap.put(event.getDescriptor(), event);
} else if (event.getType() == CDescriptorEvent.CDTPROJECT_REMOVED) { } else if (event.getType() == CDescriptorEvent.CDTPROJECT_REMOVED) {
fOperationMap.put(event.getDescriptor(), event); fOperationMap.put(event.getDescriptor(), event);
} else { } else {
CDescriptorEvent ev = (CDescriptorEvent) fOperationMap.get(event.getDescriptor()); CDescriptorEvent ev = (CDescriptorEvent) fOperationMap.get(event.getDescriptor());
if (ev.getType() == CDescriptorEvent.CDTPROJECT_CHANGED) { if ( ev == null) {
if (ev.getFlags() == 0) {
fOperationMap.put(event.getDescriptor(), event); fOperationMap.put(event.getDescriptor(), event);
} else if (ev.getFlags() != CDescriptorEvent.OWNER_CHANGED) { } else if ((ev.getFlags() & event.getFlags()) != event.getFlags()) {
fOperationMap.put(event.getDescriptor(), event); fOperationMap.put(event.getDescriptor(), new CDescriptorEvent(event.getDescriptor(), event.getType(), ev.getFlags() | event.getFlags()));
}
} }
} }
return; return;