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

@ -12,17 +12,17 @@ package org.eclipse.cdt.core;
import java.util.EventObject; import java.util.EventObject;
public class CDescriptorEvent extends EventObject { public class CDescriptorEvent extends EventObject {
public static final int CDTPROJECT_CHANGED = 1; public static final int CDTPROJECT_CHANGED = 1;
public static final int CDTPROJECT_ADDED = 2; public static final int CDTPROJECT_ADDED = 2;
public static final int CDTPROJECT_REMOVED = 3; public static final int CDTPROJECT_REMOVED = 3;
public static final int OWNER_CHANGED = 0x10; public static final int OWNER_CHANGED = 0x10;
public static final int EXTENSION_CHANGED = 0x20; public static final int EXTENSION_CHANGED = 0x20;
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);
@ -32,12 +32,37 @@ public class CDescriptorEvent extends EventObject {
public ICDescriptor getDescriptor() { public ICDescriptor getDescriptor() {
return (ICDescriptor) getSource(); return (ICDescriptor) getSource();
} }
public int getType() { public int getType() {
return fType & FLAGS_MASK; return fType & FLAGS_MASK;
} }
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() & event.getFlags()) != event.getFlags()) {
} else if (ev.getFlags() != CDescriptorEvent.OWNER_CHANGED) { fOperationMap.put(event.getDescriptor(), new CDescriptorEvent(event.getDescriptor(), event.getType(), ev.getFlags() | event.getFlags()));
fOperationMap.put(event.getDescriptor(), event);
}
} }
} }
return; return;