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

Compiler warnings.

This commit is contained in:
Sergey Prigogin 2008-07-28 16:51:12 +00:00
parent 8517a2d791
commit b0780772c9
2 changed files with 69 additions and 71 deletions

View file

@ -25,7 +25,7 @@ public final class CExternalSetting implements ICExternalSetting {
private String[] fExtensions; private String[] fExtensions;
// private String fId; // private String fId;
public CExternalSetting(ICExternalSetting base){ public CExternalSetting(ICExternalSetting base) {
fLanguageIds = base.getCompatibleLanguageIds(); fLanguageIds = base.getCompatibleLanguageIds();
fContentTypeIds = base.getCompatibleContentTypeIds(); fContentTypeIds = base.getCompatibleContentTypeIds();
fExtensions = base.getCompatibleExtensions(); fExtensions = base.getCompatibleExtensions();
@ -34,28 +34,27 @@ public final class CExternalSetting implements ICExternalSetting {
initEntryStore(base.getEntries()); initEntryStore(base.getEntries());
} }
public CExternalSetting(ICExternalSetting base, ICSettingEntry entries[]){ public CExternalSetting(ICExternalSetting base, ICSettingEntry entries[]) {
this(base); this(base);
initEntryStore(entries); initEntryStore(entries);
} }
public CExternalSetting(String[] languageIDs, public CExternalSetting(String[] languageIDs, String[] contentTypeIds, String[] extensions,
String[] contentTypeIds, String[] extensions, ICSettingEntry[] entries) {
ICSettingEntry[] entries){ if (languageIDs != null)
if(languageIDs != null) fLanguageIds = languageIDs.clone();
fLanguageIds = (String[])languageIDs.clone(); if (contentTypeIds != null)
if(contentTypeIds != null) fContentTypeIds = contentTypeIds.clone();
fContentTypeIds = (String[])contentTypeIds.clone(); if (extensions != null)
if(extensions != null) fExtensions = extensions.clone();
fExtensions = (String[])extensions.clone();
initEntryStore(entries); initEntryStore(entries);
} }
private void initEntryStore(ICSettingEntry entries[]){ private void initEntryStore(ICSettingEntry entries[]) {
ICSettingEntry entry; ICSettingEntry entry;
for(int i = 0; i < entries.length; i++){ for (int i = 0; i < entries.length; i++) {
entry = entries[i]; entry = entries[i];
addEntry(entry); addEntry(entry);
@ -64,22 +63,22 @@ public final class CExternalSetting implements ICExternalSetting {
// trimToSize(); // trimToSize();
} }
private void addEntry(ICSettingEntry entry){ private void addEntry(ICSettingEntry entry) {
getEntriesSet(entry.getKind(), true).addEntry(entry); getEntriesSet(entry.getKind(), true).addEntry(entry);
} }
/* private void trimToSize(){ // private void trimToSize() {
int kinds[] = KindBasedStore.getSupportedKinds(); // int kinds[] = KindBasedStore.getSupportedKinds();
for(int i = 0; i < kinds.length; i++){ // for (int i = 0; i < kinds.length; i++) {
CEntriesSet set = getEntriesSet(kinds[i], false); // CEntriesSet set = getEntriesSet(kinds[i], false);
if(set != null) // if (set != null)
set.trimToSize(); // set.trimToSize();
} // }
} // }
*/
private CEntriesSet getEntriesSet(int kind, boolean create){ private CEntriesSet getEntriesSet(int kind, boolean create) {
CEntriesSet set = (CEntriesSet)fStore.get(kind); CEntriesSet set = (CEntriesSet)fStore.get(kind);
if(set == null && create){ if (set == null && create) {
set = new CEntriesSet(); set = new CEntriesSet();
fStore.put(kind, set); fStore.put(kind, set);
} }
@ -87,43 +86,43 @@ public final class CExternalSetting implements ICExternalSetting {
} }
public String[] getCompatibleContentTypeIds() { public String[] getCompatibleContentTypeIds() {
if(fContentTypeIds != null) if (fContentTypeIds != null)
return (String[])fContentTypeIds.clone(); return fContentTypeIds.clone();
return null; return null;
} }
public String[] getCompatibleExtensions() { public String[] getCompatibleExtensions() {
if(fExtensions != null) if (fExtensions != null)
return (String[])fExtensions.clone(); return fExtensions.clone();
return null; return null;
} }
public String[] getCompatibleLanguageIds() { public String[] getCompatibleLanguageIds() {
if(fLanguageIds != null) if (fLanguageIds != null)
return (String[])fLanguageIds.clone(); return fLanguageIds.clone();
return null; return null;
} }
public ICSettingEntry[] getEntries(int kind) { public ICSettingEntry[] getEntries(int kind) {
CEntriesSet set = getEntriesSet(kind, false); CEntriesSet set = getEntriesSet(kind, false);
if(set != null) if (set != null)
return set.toArray(); return set.toArray();
return new ICSettingEntry[0]; return new ICSettingEntry[0];
} }
// public String getId(){ // public String getId() {
// return fId; // return fId;
// } // }
public ICSettingEntry[] getEntries() { public ICSettingEntry[] getEntries() {
List result = new ArrayList(); List<ICSettingEntry> result = new ArrayList<ICSettingEntry>();
int kinds[] = KindBasedStore.getAllEntryKinds(); int kinds[] = KindBasedStore.getAllEntryKinds();
for(int i = 0; i < kinds.length; i++){ for (int i = 0; i < kinds.length; i++) {
CEntriesSet list = getEntriesSet(kinds[i], false); CEntriesSet list = getEntriesSet(kinds[i], false);
if(list != null) if (list != null)
result.addAll(Arrays.asList(list.toArray())); result.addAll(Arrays.asList(list.toArray()));
} }
return (ICSettingEntry[])result.toArray(new ICSettingEntry[result.size()]); return result.toArray(new ICSettingEntry[result.size()]);
} }
} }

View file

@ -35,115 +35,114 @@ public final class CProjectDescriptionEvent {
ICDescriptionDelta delta, ICDescriptionDelta delta,
ICProjectDescription newDes, ICProjectDescription newDes,
ICProjectDescription oldDes, ICProjectDescription oldDes,
ICProjectDescription appliedDes){ ICProjectDescription appliedDes) {
fType = type; fType = type;
fProjDelta = delta; fProjDelta = delta;
fNewDescription = newDes; fNewDescription = newDes;
fOldDescription = oldDes; fOldDescription = oldDes;
fAppliedDescription = appliedDes; fAppliedDescription = appliedDes;
if(fNewDescription != null){ if (fNewDescription != null) {
fProject = fNewDescription.getProject(); fProject = fNewDescription.getProject();
} else if(fOldDescription != null){ } else if (fOldDescription != null) {
fProject = fOldDescription.getProject(); fProject = fOldDescription.getProject();
} }
} }
public IProject getProject(){ public IProject getProject() {
return fProject; return fProject;
} }
public int getEventType(){ public int getEventType() {
return fType; return fType;
} }
public ICDescriptionDelta getProjectDelta(){ public ICDescriptionDelta getProjectDelta() {
return fProjDelta; return fProjDelta;
} }
public ICDescriptionDelta getActiveCfgDelta(){ public ICDescriptionDelta getActiveCfgDelta() {
if(fActiveCfgDelta == null){ if (fActiveCfgDelta == null) {
fActiveCfgDelta = getDelta(true); fActiveCfgDelta = getDelta(true);
} }
return fActiveCfgDelta; return fActiveCfgDelta;
} }
public ICDescriptionDelta getDefaultSettingCfgDelta(){ public ICDescriptionDelta getDefaultSettingCfgDelta() {
if(fIndexCfgDelta == null){ if (fIndexCfgDelta == null) {
fIndexCfgDelta = getDelta(false); fIndexCfgDelta = getDelta(false);
} }
return fIndexCfgDelta; return fIndexCfgDelta;
} }
private ICDescriptionDelta getDelta(boolean active){ private ICDescriptionDelta getDelta(boolean active) {
ICDescriptionDelta delta = null; ICDescriptionDelta delta = null;
switch(getEventType()){ switch(getEventType()) {
case LOADED: case LOADED:
case ABOUT_TO_APPLY: case ABOUT_TO_APPLY:
case APPLIED: case APPLIED:
case DATA_APPLIED: case DATA_APPLIED:
if(fProjDelta != null){ if (fProjDelta != null) {
ICProjectDescription oldDes = getOldCProjectDescription(); ICProjectDescription oldDes = getOldCProjectDescription();
ICProjectDescription newDes = getNewCProjectDescription(); ICProjectDescription newDes = getNewCProjectDescription();
if(oldDes == null){ if (oldDes == null) {
ICConfigurationDescription cfg = getCfg(newDes, active); ICConfigurationDescription cfg = getCfg(newDes, active);
if(cfg != null){ if (cfg != null) {
delta = findCfgDelta(fProjDelta, cfg.getId()); delta = findCfgDelta(fProjDelta, cfg.getId());
} }
} else if(newDes == null){ } else if (newDes == null) {
ICConfigurationDescription cfg = getCfg(oldDes, active); ICConfigurationDescription cfg = getCfg(oldDes, active);
if(cfg != null){ if (cfg != null) {
delta = findCfgDelta(fProjDelta, cfg.getId()); delta = findCfgDelta(fProjDelta, cfg.getId());
} }
} else { } else {
ICConfigurationDescription newCfg = getCfg(newDes, active); ICConfigurationDescription newCfg = getCfg(newDes, active);
ICConfigurationDescription oldCfg = getCfg(oldDes, active); ICConfigurationDescription oldCfg = getCfg(oldDes, active);
if(oldCfg == null){ if (oldCfg == null) {
if(newCfg != null){ if (newCfg != null) {
delta = new CProjectDescriptionDelta(newCfg, null); delta = new CProjectDescriptionDelta(newCfg, null);
} }
} else if (newCfg == null){ } else if (newCfg == null) {
delta = new CProjectDescriptionDelta(null, oldCfg); delta = new CProjectDescriptionDelta(null, oldCfg);
} else if (newCfg.getId().equals(oldCfg.getId())) {
delta = findCfgDelta(fProjDelta, newCfg.getId());
} else { } else {
if(newCfg.getId().equals(oldCfg.getId())){ delta = CProjectDescriptionManager.getInstance().createDelta(newCfg, oldCfg);
delta = findCfgDelta(fProjDelta, newCfg.getId());
} else {
delta = CProjectDescriptionManager.getInstance().createDelta(newCfg, oldCfg);
}
} }
} }
} }
break;
case COPY_CREATED: case COPY_CREATED:
break; break;
} }
return delta; return delta;
} }
private ICConfigurationDescription getCfg(ICProjectDescription des, boolean active){ private ICConfigurationDescription getCfg(ICProjectDescription des, boolean active) {
return active ? des.getActiveConfiguration() : des.getDefaultSettingConfiguration(); return active ? des.getActiveConfiguration() : des.getDefaultSettingConfiguration();
} }
private ICDescriptionDelta findCfgDelta(ICDescriptionDelta delta, String id){ private ICDescriptionDelta findCfgDelta(ICDescriptionDelta delta, String id) {
if(delta == null) if (delta == null)
return null; return null;
ICDescriptionDelta children[] = delta.getChildren(); ICDescriptionDelta children[] = delta.getChildren();
for(int i = 0; i < children.length; i++){ for (int i = 0; i < children.length; i++) {
ICSettingObject s = children[i].getNewSetting(); ICSettingObject s = children[i].getNewSetting();
if(s != null && id.equals(s.getId())) if (s != null && id.equals(s.getId()))
return children[i]; return children[i];
} }
return null; return null;
} }
public ICProjectDescription getOldCProjectDescription(){ public ICProjectDescription getOldCProjectDescription() {
return fOldDescription; return fOldDescription;
} }
public ICProjectDescription getNewCProjectDescription(){ public ICProjectDescription getNewCProjectDescription() {
return fNewDescription; return fNewDescription;
} }
public ICProjectDescription getAppliedCProjectDescription(){ public ICProjectDescription getAppliedCProjectDescription() {
return fAppliedDescription; return fAppliedDescription;
} }
} }