diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveRenameTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveRenameTest.java
index 57cbb37f25a..f0c424cfce4 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveRenameTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveRenameTest.java
@@ -56,7 +56,7 @@ public class MoveRenameTest extends ChangeGeneratorTest {
IASTDeclaration[] members = classSpecifier.getMembers();
ASTModification swap1 = new ASTModification(ASTModification.ModificationKind.REPLACE, members[1], members[2], null);
ASTModification swap2 = new ASTModification(ASTModification.ModificationKind.REPLACE, members[2], members[1], null);
- IASTName name =((CPPASTSimpleDeclaration)members[2]).getDeclarators()[0].getName();
+ IASTName name =((CPPASTSimpleDeclaration) members[2]).getDeclarators()[0].getName();
modStore.storeModification(null, swap1);
modStore.storeModification(null, swap2);
modStore.storeModification(swap1, new ASTModification(ASTModification.ModificationKind.REPLACE, name, new CPPASTName("d".toCharArray()), null)); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java
index 002705bf348..70bd98c4179 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java
@@ -12,6 +12,9 @@
*******************************************************************************/
package org.eclipse.cdt.core.model;
+import java.net.URI;
+import java.util.List;
+
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature;
@@ -59,9 +62,6 @@ import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import java.net.URI;
-import java.util.List;
-
/**
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
@@ -260,9 +260,8 @@ public class CoreModel {
IContentType contentType = CCorePlugin.getContentType(project, name);
if (contentType != null) {
String id = contentType.getId();
- if (CCorePlugin.CONTENT_TYPE_CHEADER.equals(id)) {
- return true;
- } else if (CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(id)) {
+ if (CCorePlugin.CONTENT_TYPE_CHEADER.equals(id) ||
+ CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(id)) {
return true;
}
}
@@ -567,16 +566,12 @@ public class CoreModel {
* folders are located with that project. That is, a source entry
* specifying the path {@code /P1/src} is only usable for project
* {@code P1}.
- *
- *
*
* Note that all sources/binaries inside a project are contributed as a
* whole through a project entry (see {@code newProjectEntry}).
* Particular source entries cannot be selectively exported.
- *
*
- * @param sourcePath
- * the project-relative path of a source folder
+ * @param sourcePath the project-relative path of a source folder
* @return a new source entry with not exclusion patterns
*
*/
@@ -596,7 +591,6 @@ public class CoreModel {
* folders are located with that project. That is, a source entry
* specifying the path {@code /P1/src} is only usable for project
* {@code P1}.
- *
*
* @param sourcePath
* the absolute project-relative path of a source folder
@@ -945,7 +939,6 @@ public class CoreModel {
* If the project's raw entries are later modified they can become out of
* date. Because of this, hanging on resolved pathentries is not
* recommended.
- *
*
* @return the resolved entries for the project
* @exception CModelException
@@ -963,7 +956,6 @@ public class CoreModel {
* If the project's raw entries are later modified they can become out of
* date. Because of this, hanging on resolved pathentries is not
* recommended.
- *
*
* @return the include entries for the translation unit
* @exception CModelException
@@ -981,7 +973,6 @@ public class CoreModel {
* If the project's raw entries are later modified they can become out of
* date. Because of this, hanging on resolved pathentries is not
* recommended.
- *
*
* @return the include file entries for the translation unit
* @exception CModelException
@@ -999,7 +990,6 @@ public class CoreModel {
* If the project's raw entries are later modified they can become out of
* date. Because of this, hanging on resolved pathentries is not
* recommended.
- *
*
* @return the resolved entries for the project
* @exception CModelException
@@ -1017,7 +1007,6 @@ public class CoreModel {
* If the project's raw entries are later modified they can become out of
* date. Because of this, hanging on resolved pathentries is not
* recommended.
- *
*
* @return the macro file entries for the translation unit
* @exception CModelException
@@ -1162,7 +1151,6 @@ public class CoreModel {
private CoreModel() {
}
-
/**
* Runs the given action as an atomic C model operation.
*
@@ -1173,13 +1161,11 @@ public class CoreModel {
* methods that modify C elements and only have element
* changed event notifications reported at the end of the entire
* batch.
- *
*
* If this method is called outside the dynamic scope of another such
* call, this method runs the action and then reports a single
* element changed event describing the net effect of all changes
* done to C elements by the action.
- *
*
* If this method is called in the dynamic scope of another such
* call, this method simply runs the action.
@@ -1187,7 +1173,7 @@ public class CoreModel {
*
* @param action the action to perform
* @param monitor a progress monitor, or {@code null} if progress
- * reporting and cancellation are not desired
+ * reporting and cancellation are not desired
* @exception CoreException if the operation failed.
* @since 2.1
*/
@@ -1204,28 +1190,24 @@ public class CoreModel {
* methods that modify C elements and only have element
* changed event notifications reported at the end of the entire
* batch.
- *
*
* If this method is called outside the dynamic scope of another such
* call, this method runs the action and then reports a single
* element changed event describing the net effect of all changes
* done to C elements by the action.
- *
*
* If this method is called in the dynamic scope of another such
* call, this method simply runs the action.
- *
*
* The supplied scheduling rule is used to determine whether this operation can be
* run simultaneously with workspace changes in other threads. See
- * {@code IWorkspace.run(...)} for more details.
- *
+ * {@link IWorkspace#run} for more details.
*
* @param action the action to perform
* @param rule the scheduling rule to use when running this operation, or
- * {@code null} if there are no scheduling restrictions for this operation.
+ * {@code null} if there are no scheduling restrictions for this operation.
* @param monitor a progress monitor, or {@code null} if progress
- * reporting and cancellation are not desired
+ * reporting and cancellation are not desired
* @exception CoreException if the operation failed.
* @since 3.0
*/
@@ -1234,7 +1216,7 @@ public class CoreModel {
if (workspace.isTreeLocked()) {
new BatchOperation(action).run(monitor);
} else {
- // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode
+ // Use IWorkspace.run(...) to ensure that a build will be done in autobuild mode.
workspace.run(new BatchOperation(action), rule, IWorkspace.AVOID_UPDATE, monitor);
}
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBuffer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBuffer.java
index a827dc798ac..06bc95cef85 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBuffer.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBuffer.java
@@ -6,11 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Rational Software - Initial API and implementation
+ * Rational Software - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.model;
-
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -18,7 +17,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
* A buffer contains the text contents of a resource. It is not language-specific.
* The contents may be in the process of being edited, differing from the actual contents of the
* underlying resource. A buffer has an owner, which is an
- * IOpenable
. If a buffer does not have an underlying resource,
+ * {@code IOpenable}. If a buffer does not have an underlying resource,
* saving the buffer has no effect. Buffers can be read-only.
*
* This interface is similar to the JDT IBuffer interface.
@@ -26,15 +25,14 @@ import org.eclipse.core.runtime.IProgressMonitor;
* @noextend This interface is not intended to be extended by clients.
*/
public interface IBuffer {
-
/**
* Adds the given listener for changes to this buffer.
- * Has no effect if an identical listener is already registered or if the buffer
- * is closed.
+ * Has no effect if an identical listener is already registered or if the buffer is closed.
*
* @param listener the listener of buffer changes
*/
public void addBufferChangedListener(IBufferChangedListener listener);
+
/**
* Appends the given character array to the contents of the buffer.
* This buffer will now have unsaved changes.
@@ -43,11 +41,12 @@ public interface IBuffer {
*
* Has no effect if this buffer is read-only.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
* @param text the given character array to append to contents of the buffer
*/
public void append(char[] text);
+
/**
* Appends the given string to the contents of the buffer.
* This buffer will now have unsaved changes.
@@ -56,11 +55,12 @@ public interface IBuffer {
*
* Has no effect if this buffer is read-only.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
- * @param text the String
to append to the contents of the buffer
+ * @param text the {@code String} to append to the contents of the buffer
*/
public void append(String text);
+
/**
* Closes the buffer. Any unsaved changes are lost. Reports a buffer changed event
* with a 0 offset and a 0 length. When this event is fired, the buffer should already
@@ -70,17 +70,19 @@ public interface IBuffer {
* attempt is made to close an already closed buffer, the second attempt has no effect.
*/
public void close();
+
/**
* Returns the character at the given position in this buffer.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
* @param position a zero-based source offset in this buffer
* @return the character at the given position in this buffer
*/
public char getChar(int position);
+
/**
- * Returns the contents of this buffer as a character array, or null
if
+ * Returns the contents of this buffer as a character array, or {@code null} if
* the buffer has not been initialized.
*
* Callers should make no assumption about whether the returned character array
@@ -88,77 +90,85 @@ public interface IBuffer {
* wishes to change this array, they should make a copy. Likewise, if the
* client wishes to hang on to the array in its current state, they should
* make a copy.
- *
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
* @return the characters contained in this buffer
*/
public char[] getCharacters();
+
/**
- * Returns the contents of this buffer as a String
. Like all strings,
- * the result is an immutable value object., It can also answer null
if
+ * Returns the contents of this buffer as a {@code String}. Like all strings,
+ * the result is an immutable value object., It can also answer {@code null} if
* the buffer has not been initialized.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
- * @return the contents of this buffer as a String
+ * @return the contents of this buffer as a {@code String}
*/
public String getContents();
+
/**
* Returns number of characters stored in this buffer.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
* @return the number of characters in this buffer
*/
public int getLength();
+
/**
* Returns the resource element owning of this buffer.
*
* @return the resource element owning this buffer
*/
public IOpenable getOwner();
+
/**
* Returns the given range of text in this buffer.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
* @param offset the zero-based starting offset
* @param length the number of characters to retrieve
* @return the given range of text in this buffer
*/
public String getText(int offset, int length);
+
/**
* Returns the underlying resource for which this buffer was opened,
- * or null
if this buffer was not opened on a resource.
+ * or {@code null} if this buffer was not opened on a resource.
*
- * @return the underlying resource for this buffer, or null
+ * @return the underlying resource for this buffer, or {@code null}
* if none.
*/
public IResource getUnderlyingResource();
+
/**
* Returns whether this buffer has been modified since it
* was opened or since it was last saved.
* If a buffer does not have an underlying resource, this method always
- * returns true
.
+ * returns {@code true}.
*
- * @return a boolean
indicating presence of unsaved changes (in
- * the absence of any underlying resource, it will always return true
).
+ * @return a {@code boolean} indicating presence of unsaved changes (in
+ * the absence of any underlying resource, it will always return {@code true}).
*/
public boolean hasUnsavedChanges();
+
/**
* Returns whether this buffer has been closed.
*
- * @return a boolean
indicating whether this buffer is closed.
+ * @return a {@code boolean} indicating whether this buffer is closed.
*/
public boolean isClosed();
+
/**
* Returns whether this buffer is read-only.
*
- * @return a boolean
indicating whether this buffer is read-only
+ * @return a {@code boolean} indicating whether this buffer is read-only
*/
public boolean isReadOnly();
+
/**
* Removes the given listener from this buffer.
* Has no affect if an identical listener is not registered or if the buffer is closed.
@@ -166,30 +176,33 @@ public interface IBuffer {
* @param listener the listener
*/
public void removeBufferChangedListener(IBufferChangedListener listener);
+
/**
* Replaces the given range of characters in this buffer with the given text.
- * position
and position + length
must be in the range [0, getLength()].
- * length
must not be negative.
+ * {@code position} and {@code position + length} must be in the range [0, getLength()].
+ * {@code length} must not be negative.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
* @param position the zero-based starting position of the affected text range in this buffer
* @param length the length of the affected text range in this buffer
* @param text the replacing text as a character array
*/
public void replace(int position, int length, char[] text);
+
/**
* Replaces the given range of characters in this buffer with the given text.
- * position
and position + length
must be in the range [0, getLength()].
- * length
must not be negative.
+ * {@code position} and {@code position + length} must be in the range [0, getLength()].
+ * {@code length} must not be negative.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
* @param position the zero-based starting position of the affected text range in this buffer
* @param length the length of the affected text range in this buffer
- * @param text the replacing text as a String
+ * @param text the replacing text as a {@code String}
*/
public void replace(int position, int length, String text);
+
/**
* Saves the contents of this buffer to its underlying resource. If
* successful, this buffer will have no unsaved changes.
@@ -198,61 +211,60 @@ public interface IBuffer {
* If the buffer does not have an underlying resource or is read-only, this
* has no effect.
*
- * The force
parameter controls how this method deals with
+ * The {@code force} parameter controls how this method deals with
* cases where the workbench is not completely in sync with the local file system.
- * If false
is specified, this method will only attempt
+ * If {@code false} is specified, this method will only attempt
* to overwrite a corresponding file in the local file system provided
* it is in sync with the workbench. This option ensures there is no
* unintended data loss; it is the recommended setting.
- * However, if true
is specified, an attempt will be made
+ * However, if {@code true} is specified, an attempt will be made
* to write a corresponding file in the local file system,
* overwriting any existing one if need be.
* In either case, if this method succeeds, the resource will be marked
* as being local (even if it wasn't before).
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
* @param progress the progress monitor to notify
- * @param force a boolean
flag indicating how to deal with resource
+ * @param force a {@code boolean} flag indicating how to deal with resource
* inconsistencies.
*
* @exception CModelException if an error occurs writing the buffer to
* the underlying resource
*
- * @see org.eclipse.core.resources.IFile#setContents(java.io.InputStream, boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.core.resources.IFile#setContents(java.io.InputStream, boolean, boolean, IProgressMonitor)
*/
public void save(IProgressMonitor progress, boolean force) throws CModelException;
+
/**
* Sets the contents of this buffer to the given character array.
* This buffer will now have unsaved changes.
* Any client can set the contents of the buffer, not just the owner of the buffer.
* Reports a buffer changed event.
*
- * Equivalent to replace(0,getLength(),contents)
.
- *
+ * Equivalent to {@code replace(0, getLength(), contents)}.
*
* Has no effect if this buffer is read-only.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
* @param contents the new contents of this buffer as a character array
*/
public void setContents(char[] contents);
+
/**
- * Sets the contents of this buffer to the given String
.
+ * Sets the contents of this buffer to the given {@code String}.
* This buffer will now have unsaved changes.
* Any client can set the contents of the buffer, not just the owner of the buffer.
* Reports a buffer changed event.
*
- * Equivalent to replace(0,getLength(),contents)
.
- *
+ * Equivalent to {@code replace(0, getLength(), contents)}.
*
* Has no effect if this buffer is read-only.
*
- * A RuntimeException
might be thrown if the buffer is closed.
+ * A {@code RuntimeException} might be thrown if the buffer is closed.
*
- * @param contents the new contents of this buffer as a String
+ * @param contents the new contents of this buffer as a {@code String}
*/
public void setContents(String contents);
-
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
index b3c53d1d21e..33289704a7e 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
@@ -373,18 +373,16 @@ public interface ICElement extends IAdaptable {
URI getLocationURI();
/**
- * Returns the underlying resource that contains
- * this element, or {@code null} if this element is not contained
- * in a resource.
+ * Returns the underlying resource that contains this element, or {@code null} if this element
+ * is not contained in a resource.
*
* @return the underlying resource, or {@code null} if none
*/
IResource getUnderlyingResource();
/**
- * Returns the Corresponding resource for
- * this element, or {@code null} if this element does not have
- * a corresponding resource.
+ * Returns the corresponding resource for this element, or {@code null} if this element
+ * does not have a corresponding resource.
*
* @return the corresponding resource, or {@code null} if none
*/
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java
index f3e2c3a17f1..222579a78f6 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java
@@ -48,7 +48,6 @@ import org.eclipse.core.resources.IResourceDelta;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICElementDelta {
-
/**
* Status constant indicating that the element has been added.
*/
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IPathEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IPathEntry.java
index ddfd5a02da3..64fc1306887 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IPathEntry.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IPathEntry.java
@@ -12,9 +12,7 @@ package org.eclipse.cdt.core.model;
import org.eclipse.core.runtime.IPath;
-
public interface IPathEntry {
-
/**
* Entry kind constant describing a path entry identifying a
* library. A library is an archive containing
@@ -104,5 +102,4 @@ public interface IPathEntry {
* @return IPath
*/
IPath getPath();
-
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceRoot.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceRoot.java
index 322ea6476db..8d90af80725 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceRoot.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceRoot.java
@@ -8,7 +8,6 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-
package org.eclipse.cdt.core.model;
import org.eclipse.core.resources.IResource;
@@ -25,5 +24,4 @@ public interface ISourceRoot extends ICContainer {
boolean isOnSourceEntry(IPath path);
boolean isOnSourceEntry(ICElement element);
-
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACExclusionFilterEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACExclusionFilterEntry.java
index 0da93430cc1..e533af3a967 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACExclusionFilterEntry.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACExclusionFilterEntry.java
@@ -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;
@@ -16,25 +16,26 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IPath;
public abstract class ACExclusionFilterEntry extends ACPathEntry implements ICExclusionPatternPathEntry {
- private final IPath[] exclusionPatterns;
private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray() }; //$NON-NLS-1$
- /** calculated value, does not have to be final */
+
+ private final IPath[] exclusionPatterns;
+ /** Calculated value, does not have to be final */
char[][] fullCharExclusionPatterns = UNINIT_PATTERNS;
ACExclusionFilterEntry(IPath path, IPath exclusionPatterns[] , int flags) {
super(path, flags);
- this.exclusionPatterns = exclusionPatterns != null ? (IPath[])exclusionPatterns.clone() : new IPath[0];
+ this.exclusionPatterns = exclusionPatterns != null ? (IPath[]) exclusionPatterns.clone() : new IPath[0];
}
ACExclusionFilterEntry(IFolder rc, IPath exclusionPatterns[], int flags) {
super(rc, flags);
- this.exclusionPatterns = exclusionPatterns != null ? (IPath[])exclusionPatterns.clone() : new IPath[0];
+ this.exclusionPatterns = exclusionPatterns != null ? (IPath[]) exclusionPatterns.clone() : new IPath[0];
}
ACExclusionFilterEntry(String value, IPath exclusionPatterns[], int flags) {
super(value, flags);
- this.exclusionPatterns = exclusionPatterns != null ? (IPath[])exclusionPatterns.clone() : new IPath[0];
+ this.exclusionPatterns = exclusionPatterns != null ? (IPath[]) exclusionPatterns.clone() : new IPath[0];
}
/**
@@ -51,7 +52,7 @@ public abstract class ACExclusionFilterEntry extends ACPathEntry implements ICEx
*/
@Override
public IPath[] getExclusionPatterns() {
- return exclusionPatterns.length != 0 ? (IPath[])exclusionPatterns.clone() : exclusionPatterns;
+ return exclusionPatterns.length != 0 ? (IPath[]) exclusionPatterns.clone() : exclusionPatterns;
}
/**
@@ -63,7 +64,7 @@ public abstract class ACExclusionFilterEntry extends ACPathEntry implements ICEx
int length = this.exclusionPatterns.length;
this.fullCharExclusionPatterns = new char[length][];
IPath path = getFullPath();
- if(path == null)
+ if (path == null)
path = getLocation();
IPath prefixPath = path.removeTrailingSeparator();
for (int i = 0; i < length; i++) {
@@ -98,7 +99,7 @@ public abstract class ACExclusionFilterEntry extends ACPathEntry implements ICEx
@Override
public boolean equalsByContents(ICSettingEntry entry) {
- if(!super.equalsByContents(entry))
+ if (!super.equalsByContents(entry))
return false;
ACExclusionFilterEntry otherEntry = (ACExclusionFilterEntry)entry;
@@ -108,12 +109,12 @@ public abstract class ACExclusionFilterEntry extends ACPathEntry implements ICEx
@Override
protected String contentsToString() {
String result = super.contentsToString();
- if(exclusionPatterns.length != 0){
- StringBuffer buf = new StringBuffer();
+ if (exclusionPatterns.length != 0) {
+ StringBuilder buf = new StringBuilder();
buf.append(result);
buf.append(" ; exclude: "); //$NON-NLS-1$
- for(int i = 0; i < exclusionPatterns.length; i++){
- if(i != 0)
+ for (int i = 0; i < exclusionPatterns.length; i++) {
+ if (i != 0)
buf.append(", "); //$NON-NLS-1$
buf.append(exclusionPatterns[i].toString());
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java
index 2313be46bfd..41bb6e2b2c2 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java
@@ -12,6 +12,12 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.model;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICElementVisitor;
@@ -33,12 +39,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.PlatformObject;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-
public abstract class CElement extends PlatformObject implements ICElement {
public static final char CEM_ESCAPE = '\\';
public static final char CEM_CPROJECT = '=';
@@ -214,7 +214,8 @@ public abstract class CElement extends PlatformObject implements ICElement {
public ICModel getCModel () {
ICElement current = this;
do {
- if (current instanceof ICModel) return (ICModel) current;
+ if (current instanceof ICModel)
+ return (ICModel) current;
} while ((current = current.getParent()) != null);
return null;
}
@@ -234,14 +235,13 @@ public abstract class CElement extends PlatformObject implements ICElement {
@Override
public IResource getUnderlyingResource() {
- IResource res = getResource();
- if (res == null) {
- ICElement p = getParent();
- if (p != null) {
- res = p.getUnderlyingResource();
- }
- }
- return res;
+ ICElement current = this;
+ do {
+ IResource res = getResource();
+ if (res != null)
+ return res;
+ } while ((current = current.getParent()) != null);
+ return null;
}
@Override
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModel.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModel.java
index fd58e94c1dd..bb14548d2a2 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModel.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModel.java
@@ -20,8 +20,6 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.internal.core.util.MementoTokenizer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
@@ -32,7 +30,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
public class CModel extends Openable implements ICModel {
- public CModel () {
+ public CModel() {
this(ResourcesPlugin.getWorkspace().getRoot());
}
@@ -56,9 +54,6 @@ public class CModel extends Openable implements ICModel {
return array;
}
- /**
- * ICModel#getCProject(String)
- */
@Override
public ICProject getCProject(String name) {
IProject project = ((IWorkspaceRoot) getResource()).getProject(name);
@@ -66,24 +61,17 @@ public class CModel extends Openable implements ICModel {
}
/**
- * Returns the active C project associated with the specified
- * resource, or null
if no C project yet exists
- * for the resource.
+ * Returns the active C project associated with the specified resource,
+ * or {@code null} if no C project yet exists for the resource.
*
- * @exception IllegalArgumentException if the given resource
- * is not one of an IProject, IFolder, or IFile.
+ * @exception IllegalArgumentException if the given resource is not one of
+ * an IProject, IFolder, or IFile.
*/
public ICProject getCProject(IResource resource) {
- switch (resource.getType()) {
- case IResource.FOLDER:
- return new CProject(this, ((IFolder) resource).getProject());
- case IResource.FILE:
- return new CProject(this, ((IFile) resource).getProject());
- case IResource.PROJECT:
- return new CProject(this, (IProject) resource);
- default:
+ IProject project = resource.getProject();
+ if (project == null)
throw new IllegalArgumentException("element.invalidResourceForProject"); //$NON-NLS-1$
- }
+ return new CProject(this, project);
}
/**
@@ -99,7 +87,7 @@ public class CModel extends Openable implements ICModel {
}
}
} catch (CModelException e) {
- // c model doesn't exist: cannot find any project
+ // C model doesn't exist: cannot find any project.
}
return null;
}
@@ -111,7 +99,7 @@ public class CModel extends Openable implements ICModel {
@Override
public void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
- String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
+ String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
if (elements != null && elements[0] != null && elements[0].getElementType() <= ICElement.C_UNIT) {
runOperation(new CopyResourceElementsOperation(elements, containers, replace), elements,
siblings, renamings, monitor);
@@ -123,7 +111,7 @@ public class CModel extends Openable implements ICModel {
@Override
public void delete(ICElement[] elements, boolean force, IProgressMonitor monitor)
- throws CModelException {
+ throws CModelException {
CModelOperation op;
if (elements != null && elements[0] != null && elements[0].getElementType() <= ICElement.C_UNIT) {
op = new DeleteResourceElementsOperation(elements, force);
@@ -135,7 +123,7 @@ public class CModel extends Openable implements ICModel {
@Override
public void move(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
- String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
+ String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
if (elements != null && elements[0] != null && elements[0].getElementType() <= ICElement.C_UNIT) {
runOperation(new MoveResourceElementsOperation(elements, containers, replace), elements,
siblings, renamings, monitor);
@@ -147,7 +135,7 @@ public class CModel extends Openable implements ICModel {
@Override
public void rename(ICElement[] elements, ICElement[] destinations, String[] renamings,
- boolean force, IProgressMonitor monitor) throws CModelException {
+ boolean force, IProgressMonitor monitor) throws CModelException {
CModelOperation op;
if (elements != null && elements[0] != null && elements[0].getElementType() <= ICElement.C_UNIT) {
op = new RenameResourceElementsOperation(elements, destinations, renamings, force);
@@ -158,7 +146,7 @@ public class CModel extends Openable implements ICModel {
}
/**
- * Configures and runs the MultiOperation
.
+ * Configures and runs the {@link MultiOperation}.
*/
protected void runOperation(MultiOperation op, ICElement[] elements, ICElement[] siblings,
String[] renamings, IProgressMonitor monitor) throws CModelException {
@@ -216,7 +204,7 @@ public class CModel extends Openable implements ICModel {
}
protected boolean computeChildren(OpenableInfo info, IResource res) throws CModelException {
- // determine my children
+ // Determine my children.
IWorkspaceRoot root = (IWorkspaceRoot) getResource();
IProject[] projects = root.getProjects();
for (IProject project : projects) {
@@ -233,12 +221,12 @@ public class CModel extends Openable implements ICModel {
public ICElement getHandleFromMemento(String token, MementoTokenizer memento) {
switch (token.charAt(0)) {
case CEM_CPROJECT:
- if (!memento.hasMoreTokens()) return this;
+ if (!memento.hasMoreTokens())
+ return this;
String projectName = memento.nextToken();
CElement project = (CElement) getCProject(projectName);
- if (project != null) {
+ if (project != null)
return project.getHandleFromMemento(memento);
- }
}
return null;
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
index 79b4c264882..74681e91cb9 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
@@ -103,7 +103,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
*/
final CModel cModel = new CModel();
- public static HashSet OptionNames = new HashSet(20);
+ public static HashSet OptionNames = new HashSet<>(20);
public static final int DEFAULT_CHANGE_EVENT = 0; // must not collide with ElementChangedEvent event masks
@@ -122,7 +122,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
* Queue of reconcile deltas on working copies that have yet to be fired.
* This is a table form IWorkingCopy to ICElementDelta
*/
- HashMap reconcileDeltas = new HashMap();
+ HashMap reconcileDeltas = new HashMap<>();
/**
* Turns delta firing on/off. By default it is on.
@@ -137,16 +137,16 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
/**
* A map from ITranslationUnit to IWorkingCopy of the shared working copies.
*/
- private Map> sharedWorkingCopies = new HashMap>();
+ private Map> sharedWorkingCopies = new HashMap<>();
/**
* Set of elements which are out of sync with their buffers.
*/
- protected Map elementsOutOfSynchWithBuffers = new HashMap(11);
+ protected Map elementsOutOfSynchWithBuffers = new HashMap<>(11);
/*
* Temporary cache of newly opened elements
*/
- private ThreadLocal