1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 19:25:38 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2015-01-08 11:07:01 -08:00
parent 07997cb72a
commit 2dbdd831ec
11 changed files with 24 additions and 62 deletions

View file

@ -361,8 +361,8 @@ public class CModelTests extends TestCase {
// bug 179474 // bug 179474
public void testSourceExclusionFilters_179474() throws Exception { public void testSourceExclusionFilters_179474() throws Exception {
ICProject testProject; ICProject testProject;
testProject=CProjectHelper.createCProject("bug179474", "none", IPDOMManager.ID_NO_INDEXER); testProject= CProjectHelper.createCProject("bug179474", "none", IPDOMManager.ID_NO_INDEXER);
if (testProject==null) if (testProject == null)
fail("Unable to create project"); fail("Unable to create project");
IFolder subFolder = testProject.getProject().getFolder("sub"); IFolder subFolder = testProject.getProject().getFolder("sub");

View file

@ -30,7 +30,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICProject extends IParent, IOpenable, ICElement { public interface ICProject extends IParent, IOpenable, ICElement {
/** /**
* Returns the <code>ICElement</code> corresponding to the given * Returns the <code>ICElement</code> corresponding to the given
* path, or <code>null</code> if no such * path, or <code>null</code> if no such
@ -67,8 +66,7 @@ public interface ICProject extends IParent, IOpenable, ICElement {
* Returns all of the existing source roots that exist * Returns all of the existing source roots that exist
* on the project, in the order they are defined by the ".cdtproject". * on the project, in the order they are defined by the ".cdtproject".
* *
* @return all of the existing package fragment roots that exist * @return all of the existing source roots
* on the classpath
* @exception CModelException if this element does not exist or if an * @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource * exception occurs while accessing its corresponding resource
*/ */
@ -243,5 +241,4 @@ public interface ICProject extends IParent, IOpenable, ICElement {
* exception occurs while accessing its corresponding resource * exception occurs while accessing its corresponding resource
*/ */
Object[] getNonCResources() throws CModelException; Object[] getNonCResources() throws CModelException;
} }

View file

@ -23,7 +23,7 @@ public class SourceEntry extends APathEntry implements ISourceEntry {
@Override @Override
public boolean equals (Object obj) { public boolean equals (Object obj) {
if (obj instanceof ISourceEntry) { if (obj instanceof ISourceEntry) {
ISourceEntry otherEntry = (ISourceEntry)obj; ISourceEntry otherEntry = (ISourceEntry) obj;
if (!super.equals(otherEntry)) { if (!super.equals(otherEntry)) {
return false; return false;
} }
@ -40,5 +40,4 @@ public class SourceEntry extends APathEntry implements ISourceEntry {
} }
return super.equals(obj); return super.equals(obj);
} }
} }

View file

@ -16,7 +16,6 @@ import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -104,7 +103,7 @@ public class BracketInserterTest extends TestCase {
private void setUpProject() throws CoreException { private void setUpProject() throws CoreException {
fProject= CProjectHelper.createCProject(getName(), "bin", IPDOMManager.ID_NO_INDEXER); fProject= CProjectHelper.createCProject(getName(), "bin", IPDOMManager.ID_NO_INDEXER);
ICContainer cContainer= CProjectHelper.addCContainer(fProject, SRC); ICContainer cContainer= CProjectHelper.addCContainer(fProject, SRC);
IFile file= EditorTestHelper.createFile((IContainer)cContainer.getResource(), TU_NAME, TU_CONTENTS, new NullProgressMonitor()); IFile file= EditorTestHelper.createFile(cContainer.getResource(), TU_NAME, TU_CONTENTS, new NullProgressMonitor());
assertNotNull(file); assertNotNull(file);
assertTrue(file.exists()); assertTrue(file.exists());
} }

View file

@ -14,7 +14,6 @@ package org.eclipse.cdt.ui.tests.text;
import junit.framework.TestCase; import junit.framework.TestCase;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
@ -102,7 +101,7 @@ public class HyperlinkTest extends TestCase {
super.setUp(); super.setUp();
project= CProjectHelper.createCCProject(super.getName(), "unused", IPDOMManager.ID_NO_INDEXER); project= CProjectHelper.createCCProject(super.getName(), "unused", IPDOMManager.ID_NO_INDEXER);
ICContainer cContainer= CProjectHelper.addCContainer(project, "src"); ICContainer cContainer= CProjectHelper.addCContainer(project, "src");
IFile file= EditorTestHelper.createFile((IContainer) cContainer.getResource(), fileName, code, new NullProgressMonitor()); IFile file= EditorTestHelper.createFile(cContainer.getResource(), fileName, code, new NullProgressMonitor());
assertNotNull(file); assertNotNull(file);
assertTrue(file.exists()); assertTrue(file.exists());

View file

@ -604,7 +604,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
List<ICElement> missingElements = new ArrayList<ICElement>(); List<ICElement> missingElements = new ArrayList<ICElement>();
try { try {
List<IResource> missingContainers = new ArrayList<IResource>(); List<IResource> missingContainers = new ArrayList<IResource>();
IResource[] allChildren = ((IContainer) container.getResource()).members(); IResource[] allChildren = container.getResource().members();
for (IResource child : allChildren) { for (IResource child : allChildren) {
if (!(child instanceof IContainer)) if (!(child instanceof IContainer))
continue; continue;

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry; import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry;
public class CPerspectiveFactory implements IPerspectiveFactory { public class CPerspectiveFactory implements IPerspectiveFactory {
/** /**
* Constructs a new Default layout engine. * Constructs a new Default layout engine.
*/ */
@ -96,6 +95,5 @@ public class CPerspectiveFactory implements IPerspectiveFactory {
for (int i = 0; i < wizIDs.length; ++i) { for (int i = 0; i < wizIDs.length; ++i) {
layout.addNewWizardShortcut(wizIDs[i]); layout.addNewWizardShortcut(wizIDs[i]);
} }
} }
} }

View file

@ -147,12 +147,12 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
String projPath= null; String projPath= null;
if (selectedElement instanceof IResource) { if (selectedElement instanceof IResource) {
IProject proj= ((IResource)selectedElement).getProject(); IProject proj= ((IResource) selectedElement).getProject();
if (proj != null) { if (proj != null) {
projPath= proj.getFullPath().makeRelative().toString(); projPath= proj.getFullPath().makeRelative().toString();
} }
} else if (selectedElement instanceof ICElement) { } else if (selectedElement instanceof ICElement) {
ICProject jproject= ((ICElement)selectedElement).getCProject(); ICProject jproject= ((ICElement) selectedElement).getCProject();
if (jproject != null) { if (jproject != null) {
projPath= jproject.getProject().getFullPath().makeRelative().toString(); projPath= jproject.getProject().getFullPath().makeRelative().toString();
} }
@ -336,7 +336,7 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
return; return;
} }
} }
ArrayList<IPathEntry> newEntries= new ArrayList<IPathEntry>(fEntries.length + 1); ArrayList<IPathEntry> newEntries= new ArrayList<>(fEntries.length + 1);
int projectEntryIndex= -1; int projectEntryIndex= -1;
for (int i= 0; i < fEntries.length; i++) { for (int i= 0; i < fEntries.length; i++) {
@ -355,7 +355,7 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
IPathEntry newEntry= CoreModel.newSourceEntry(path); IPathEntry newEntry= CoreModel.newSourceEntry(path);
Set<IPathEntry> modified= new HashSet<IPathEntry>(); Set<IPathEntry> modified= new HashSet<>();
if (fExcludeInOthersFields.isSelected()) { if (fExcludeInOthersFields.isSelected()) {
addExclusionPatterns(newEntry, newEntries, modified); addExclusionPatterns(newEntry, newEntries, modified);
newEntries.add(CoreModel.newSourceEntry(path)); newEntries.add(CoreModel.newSourceEntry(path));
@ -390,13 +390,13 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
} }
} }
private void addExclusionPatterns(IPathEntry newEntry, List<IPathEntry> existing, Set<IPathEntry> modifiedEntries) { private static void addExclusionPatterns(IPathEntry newEntry, List<IPathEntry> existing, Set<IPathEntry> modifiedEntries) {
IPath entryPath= newEntry.getPath(); IPath entryPath= newEntry.getPath();
for (int i= 0; i < existing.size(); i++) { for (int i= 0; i < existing.size(); i++) {
IPathEntry curr= existing.get(i); IPathEntry curr= existing.get(i);
IPath currPath= curr.getPath(); IPath currPath= curr.getPath();
if (curr.getEntryKind() == IPathEntry.CDT_SOURCE && currPath.isPrefixOf(entryPath)) { if (curr.getEntryKind() == IPathEntry.CDT_SOURCE && currPath.isPrefixOf(entryPath)) {
IPath[] exclusionFilters= ((ISourceEntry)curr).getExclusionPatterns(); IPath[] exclusionFilters= ((ISourceEntry) curr).getExclusionPatterns();
if (!CoreModelUtil.isExcludedPath(entryPath, exclusionFilters)) { if (!CoreModelUtil.isExcludedPath(entryPath, exclusionFilters)) {
IPath pathToExclude= entryPath.removeFirstSegments(currPath.segmentCount()).addTrailingSeparator(); IPath pathToExclude= entryPath.removeFirstSegments(currPath.segmentCount()).addTrailingSeparator();
IPath[] newExclusionFilters= new IPath[exclusionFilters.length + 1]; IPath[] newExclusionFilters= new IPath[exclusionFilters.length + 1];
@ -427,7 +427,6 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
} }
monitor.beginTask(NewFolderWizardMessages.NewSourceFolderWizardPage_operation, 3); monitor.beginTask(NewFolderWizardMessages.NewSourceFolderWizardPage_operation, 3);
try { try {
// IPath projPath= fCurrCProject.getProject().getFullPath();
String relPath= fRootDialogField.getText(); String relPath= fRootDialogField.getText();
IFolder folder= fCurrCProject.getProject().getFolder(relPath); IFolder folder= fCurrCProject.getProject().getFolder(relPath);
@ -438,7 +437,7 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
throw new InterruptedException(); throw new InterruptedException();
} }
if(CCorePlugin.getDefault().isNewStyleProject(fCurrCProject.getProject())){ if (CCorePlugin.getDefault().isNewStyleProject(fCurrCProject.getProject())) {
ICSourceEntry newEntry = new CSourceEntry(folder, null, 0); ICSourceEntry newEntry = new CSourceEntry(folder, null, 0);
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(fCurrCProject.getProject(), true); ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(fCurrCProject.getProject(), true);
addEntryToAllCfgs(des, newEntry, fIsProjectAsSourceFolder); addEntryToAllCfgs(des, newEntry, fIsProjectAsSourceFolder);
@ -453,23 +452,24 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
} }
} }
private void addEntryToAllCfgs(ICProjectDescription des, ICSourceEntry entry, boolean removeProj) throws WriteAccessException, CoreException{ private void addEntryToAllCfgs(ICProjectDescription des, ICSourceEntry entry, boolean removeProj)
throws WriteAccessException, CoreException{
ICConfigurationDescription cfgs[] = des.getConfigurations(); ICConfigurationDescription cfgs[] = des.getConfigurations();
for(ICConfigurationDescription cfg : cfgs){ for (ICConfigurationDescription cfg : cfgs) {
ICSourceEntry[] entries = cfg.getSourceEntries(); ICSourceEntry[] entries = cfg.getSourceEntries();
entries = addEntry(entries, entry, removeProj); entries = addEntry(entries, entry, removeProj);
cfg.setSourceEntries(entries); cfg.setSourceEntries(entries);
} }
} }
private ICSourceEntry[] addEntry(ICSourceEntry[] entries, ICSourceEntry entry, boolean removeProj){ private ICSourceEntry[] addEntry(ICSourceEntry[] entries, ICSourceEntry sourceEntry, boolean removeProj) {
Set<ICSourceEntry> set = new HashSet<ICSourceEntry>(); Set<ICSourceEntry> set = new HashSet<>();
for(ICSourceEntry se : entries){ for (ICSourceEntry entry : entries) {
if(removeProj && new Path(se.getValue()).segmentCount() == 1) if (removeProj && new Path(entry.getValue()).segmentCount() == 1)
continue; continue;
set.add(se); set.add(entry);
} }
set.add(entry); set.add(sourceEntry);
return set.toArray(new ICSourceEntry[set.size()]); return set.toArray(new ICSourceEntry[set.size()]);
} }

View file

@ -20,10 +20,6 @@ import org.eclipse.debug.core.sourcelookup.ISourceContainer;
* Director of the common source containers. * Director of the common source containers.
*/ */
public class CommonSourceLookupDirector extends CSourceLookupDirector { public class CommonSourceLookupDirector extends CSourceLookupDirector {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#setSourceContainers(org.eclipse.debug.core.sourcelookup.ISourceContainer[])
*/
@Override @Override
public void setSourceContainers(ISourceContainer[] containers) { public void setSourceContainers(ISourceContainer[] containers) {
try { try {

View file

@ -84,10 +84,6 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
super.dispose(); super.dispose();
} }
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#isComposite()
*/
@Override @Override
public boolean isComposite() { public boolean isComposite() {
return true; return true;
@ -95,16 +91,11 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
/** /**
* Returns whether referenced projects are considered. * Returns whether referenced projects are considered.
*
* @return whether referenced projects are considered
*/ */
public boolean isSearchReferencedProjects() { public boolean isSearchReferencedProjects() {
return fSearchReferencedProjects; return fSearchReferencedProjects;
} }
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getName()
*/
@Override @Override
public String getName() { public String getName() {
return fProject == null ? return fProject == null ?
@ -112,17 +103,11 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
NLS.bind(InternalSourceLookupMessages.SourceFoldersRelativePathSourceContainer_1, fProject.getName()); NLS.bind(InternalSourceLookupMessages.SourceFoldersRelativePathSourceContainer_1, fProject.getName());
} }
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
*/
@Override @Override
public ISourceContainerType getType() { public ISourceContainerType getType() {
return getSourceContainerType(TYPE_ID); return getSourceContainerType(TYPE_ID);
} }
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj != null && obj instanceof SourceFoldersRelativePathSourceContainer) { if (obj != null && obj instanceof SourceFoldersRelativePathSourceContainer) {
@ -132,17 +117,11 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
return false; return false;
} }
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override @Override
public int hashCode() { public int hashCode() {
return TYPE_ID.hashCode() * 31 + (fProject == null ? 0 : fProject.hashCode()); return TYPE_ID.hashCode() * 31 + (fProject == null ? 0 : fProject.hashCode());
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.sourcelookup.IMappingSourceContainer#getCompilationPath(java.lang.String)
*/
@Override @Override
public IPath getCompilationPath(String sourceName) { public IPath getCompilationPath(String sourceName) {
if (fProject == null) if (fProject == null)
@ -192,7 +171,7 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
ISourceRoot[] roots = cProject.getAllSourceRoots(); ISourceRoot[] roots = cProject.getAllSourceRoots();
List<ISourceContainer> list = new ArrayList<ISourceContainer>(roots.length); List<ISourceContainer> list = new ArrayList<ISourceContainer>(roots.length);
for (ISourceRoot root : roots) { for (ISourceRoot root : roots) {
IContainer folder = (IContainer) root.getResource(); IContainer folder = root.getResource();
ISourceContainer container = new CompilationDirectorySourceContainer(folder.getLocation(), false); ISourceContainer container = new CompilationDirectorySourceContainer(folder.getLocation(), false);
container.init(getDirector()); container.init(getDirector());
list.add(container); list.add(container);

View file

@ -33,11 +33,6 @@ import org.eclipse.core.resources.IResource;
* @since 7.1 * @since 7.1
*/ */
public class ToggleCBreakpointTester extends PropertyTester { public class ToggleCBreakpointTester extends PropertyTester {
/*
* (non-Javadoc)
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
*/
@Override @Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
// test for CEditor // test for CEditor