mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Cosmetics.
This commit is contained in:
parent
652d4f7bc0
commit
fae217d744
3 changed files with 31 additions and 31 deletions
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.settings.model;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
|
|||
ACPathEntry(IPath path, int flags) {
|
||||
super(path.toString(), flags /*| RESOLVED*/);
|
||||
// fPath = path;
|
||||
// if(isValueWorkspacePath())
|
||||
// if (isValueWorkspacePath())
|
||||
// fFullPath = path;
|
||||
// else
|
||||
// fLocation = path;
|
||||
|
@ -70,9 +70,9 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
|
|||
|
||||
@Override
|
||||
public IPath getFullPath() {
|
||||
if(isValueWorkspacePath())
|
||||
if (isValueWorkspacePath())
|
||||
return new Path(getValue());
|
||||
if(isResolved()) {
|
||||
if (isResolved()) {
|
||||
IPath path = new Path(getValue());
|
||||
return fullPathForLocation(path);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
|
|||
(IResource[])ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(location)
|
||||
: (IResource[])ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(location);
|
||||
|
||||
if(rcs.length > 0)
|
||||
if (rcs.length > 0)
|
||||
return rcs[0].getFullPath();
|
||||
return null;
|
||||
}
|
||||
|
@ -96,12 +96,12 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
|
|||
|
||||
@Override
|
||||
public IPath getLocation() {
|
||||
if(!isValueWorkspacePath())
|
||||
if (!isValueWorkspacePath())
|
||||
return new Path(getValue());
|
||||
if(isResolved()){
|
||||
if (isResolved()){
|
||||
IPath path = new Path(getValue());
|
||||
IResource rc = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
|
||||
if(rc != null)
|
||||
if (rc != null)
|
||||
return rc.getLocation();
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.settings.model;
|
||||
|
||||
|
@ -17,7 +17,7 @@ public abstract class ACSettingEntry implements ICSettingEntry {
|
|||
private final int fFlags;
|
||||
private final String fName;
|
||||
|
||||
ACSettingEntry(String name, int flags){
|
||||
ACSettingEntry(String name, int flags) {
|
||||
fName = SafeStringInterner.safeIntern(name);
|
||||
fFlags = flags;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public abstract class ACSettingEntry implements ICSettingEntry {
|
|||
return checkFlags(READONLY);
|
||||
}
|
||||
|
||||
protected boolean checkFlags(int flags){
|
||||
protected boolean checkFlags(int flags) {
|
||||
return (fFlags & flags) == flags;
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,9 @@ public abstract class ACSettingEntry implements ICSettingEntry {
|
|||
if (fName == null) {
|
||||
if (other.fName != null)
|
||||
return false;
|
||||
} else if (!fName.equals(other.fName))
|
||||
} else if (!fName.equals(other.fName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -77,7 +78,7 @@ public abstract class ACSettingEntry implements ICSettingEntry {
|
|||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + fFlags;
|
||||
result = prime * result + ((fName == null) ? 0 : fName.hashCode());
|
||||
result = prime * result + (fName == null ? 0 : fName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -91,50 +92,49 @@ public abstract class ACSettingEntry implements ICSettingEntry {
|
|||
return equalsByName(entry);
|
||||
}
|
||||
|
||||
protected int getByNameMatchFlags(){
|
||||
return (fFlags & (~ (BUILTIN | READONLY | RESOLVED)));
|
||||
protected int getByNameMatchFlags() {
|
||||
return fFlags & ~(BUILTIN | READONLY | RESOLVED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equalsByName(ICSettingEntry entry) {
|
||||
if(entry == this)
|
||||
if (entry == this)
|
||||
return true;
|
||||
|
||||
if(!(entry instanceof ACSettingEntry))
|
||||
if (!(entry instanceof ACSettingEntry))
|
||||
return false;
|
||||
|
||||
ACSettingEntry e = (ACSettingEntry)entry;
|
||||
|
||||
if(getKind() != e.getKind())
|
||||
if (getKind() != e.getKind())
|
||||
return false;
|
||||
|
||||
if(getByNameMatchFlags()
|
||||
if (getByNameMatchFlags()
|
||||
!= e.getByNameMatchFlags())
|
||||
return false;
|
||||
|
||||
if(!fName.equals(e.fName))
|
||||
if (!fName.equals(e.fName))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public final int codeForNameKey(){
|
||||
public final int codeForNameKey() {
|
||||
return getKind() + getByNameMatchFlags() + fName.hashCode();
|
||||
}
|
||||
|
||||
public int codeForContentsKey(){
|
||||
public int codeForContentsKey() {
|
||||
return codeForNameKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String toString(){
|
||||
StringBuffer buf = new StringBuffer();
|
||||
public final String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append('[').append(LanguageSettingEntriesSerializer.kindToString(getKind())).append(']').append(' ');
|
||||
buf.append(contentsToString());
|
||||
buf.append(" ; flags: ").append(LanguageSettingEntriesSerializer.composeFlagsString(getFlags())); //$NON-NLS-1$
|
||||
buf.append("; flags: ").append(LanguageSettingEntriesSerializer.composeFlagsString(getFlags())); //$NON-NLS-1$
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
protected abstract String contentsToString();
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.settings.model;
|
||||
|
||||
|
@ -56,8 +56,9 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
|
|||
if (fValue == null) {
|
||||
if (other.fValue != null)
|
||||
return false;
|
||||
} else if (!fValue.equals(other.fValue))
|
||||
} else if (!fValue.equals(other.fValue)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -65,13 +66,13 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
|
|||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((fValue == null) ? 0 : fValue.hashCode());
|
||||
result = prime * result + (fValue == null ? 0 : fValue.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsByContents(ICSettingEntry entry) {
|
||||
if(!super.equalsByContents(entry))
|
||||
if (!super.equalsByContents(entry))
|
||||
return false;
|
||||
|
||||
return fValue.equals(((CMacroEntry)entry).fValue);
|
||||
|
@ -81,5 +82,4 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
|
|||
protected String contentsToString() {
|
||||
return new StringBuffer().append(getName()).append('=').append(fValue).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue