mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
5c8b7da9f4
commit
085f428acb
1 changed files with 28 additions and 24 deletions
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -60,7 +59,7 @@ public class CModel extends Openable implements ICModel {
|
|||
* ICModel#getCProject(String)
|
||||
*/
|
||||
public ICProject getCProject(String name) {
|
||||
IProject project = ((IWorkspaceRoot)getResource()).getProject(name);
|
||||
IProject project = ((IWorkspaceRoot) getResource()).getProject(name);
|
||||
return CModelManager.getDefault().create(project);
|
||||
}
|
||||
|
||||
|
@ -73,13 +72,13 @@ public class CModel extends Openable implements ICModel {
|
|||
* is not one of an IProject, IFolder, or IFile.
|
||||
*/
|
||||
public ICProject getCProject(IResource resource) {
|
||||
switch(resource.getType()){
|
||||
switch (resource.getType()) {
|
||||
case IResource.FOLDER:
|
||||
return new CProject(this, ((IFolder)resource).getProject());
|
||||
return new CProject(this, ((IFolder) resource).getProject());
|
||||
case IResource.FILE:
|
||||
return new CProject(this, ((IFile)resource).getProject());
|
||||
return new CProject(this, ((IFile) resource).getProject());
|
||||
case IResource.PROJECT:
|
||||
return new CProject(this, (IProject)resource);
|
||||
return new CProject(this, (IProject) resource);
|
||||
default:
|
||||
throw new IllegalArgumentException("element.invalidResourceForProject"); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -110,9 +109,11 @@ public class CModel extends Openable implements ICModel {
|
|||
public void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
|
||||
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);
|
||||
runOperation(new CopyResourceElementsOperation(elements, containers, replace), elements,
|
||||
siblings, renamings, monitor);
|
||||
} else {
|
||||
runOperation(new CopyElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
|
||||
runOperation(new CopyElementsOperation(elements, containers, replace), elements, siblings,
|
||||
renamings, monitor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,9 +131,11 @@ public class CModel extends Openable implements ICModel {
|
|||
public void move(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
|
||||
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);
|
||||
runOperation(new MoveResourceElementsOperation(elements, containers, replace), elements,
|
||||
siblings, renamings, monitor);
|
||||
} else {
|
||||
runOperation(new MoveElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
|
||||
runOperation(new MoveElementsOperation(elements, containers, replace), elements, siblings,
|
||||
renamings, monitor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +153,8 @@ public class CModel extends Openable implements ICModel {
|
|||
/**
|
||||
* Configures and runs the <code>MultiOperation</code>.
|
||||
*/
|
||||
protected void runOperation(MultiOperation op, ICElement[] elements, ICElement[] siblings, String[] renamings, IProgressMonitor monitor) throws CModelException {
|
||||
protected void runOperation(MultiOperation op, ICElement[] elements, ICElement[] siblings,
|
||||
String[] renamings, IProgressMonitor monitor) throws CModelException {
|
||||
op.setRenamings(renamings);
|
||||
if (siblings != null) {
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
|
@ -184,10 +188,11 @@ public class CModel extends Openable implements ICModel {
|
|||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.model.Openable#buildStructure(org.eclipse.cdt.internal.core.model.OpenableInfo, org.eclipse.core.runtime.IProgressMonitor, java.util.Map, org.eclipse.core.resources.IResource)
|
||||
* @see Openable#buildStructure(OpenableInfo, IProgressMonitor, Map, IResource)
|
||||
*/
|
||||
@Override
|
||||
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException {
|
||||
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map<ICElement,
|
||||
CElementInfo> newElements, IResource underlyingResource) throws CModelException {
|
||||
boolean validInfo = false;
|
||||
try {
|
||||
IResource res = getResource();
|
||||
|
@ -206,12 +211,12 @@ public class CModel extends Openable implements ICModel {
|
|||
* @see org.eclipse.cdt.core.model.ICModel#getNonCResources()
|
||||
*/
|
||||
public Object[] getNonCResources() throws CModelException {
|
||||
return ((CModelInfo)getElementInfo()).getNonCResources();
|
||||
return ((CModelInfo) getElementInfo()).getNonCResources();
|
||||
}
|
||||
|
||||
protected boolean computeChildren(OpenableInfo info, IResource res) throws CModelException {
|
||||
// determine my children
|
||||
IWorkspaceRoot root = (IWorkspaceRoot)getResource();
|
||||
IWorkspaceRoot root = (IWorkspaceRoot) getResource();
|
||||
IProject[] projects = root.getProjects();
|
||||
for (IProject project : projects) {
|
||||
if (CoreModel.hasCNature(project) || CoreModel.hasCCNature(project)) {
|
||||
|
@ -219,7 +224,7 @@ public class CModel extends Openable implements ICModel {
|
|||
info.addChild(cproject);
|
||||
}
|
||||
}
|
||||
((CModelInfo)getElementInfo()).setNonCResources(null);
|
||||
((CModelInfo) getElementInfo()).setNonCResources(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -229,7 +234,7 @@ public class CModel extends Openable implements ICModel {
|
|||
case CEM_CPROJECT:
|
||||
if (!memento.hasMoreTokens()) return this;
|
||||
String projectName = memento.nextToken();
|
||||
CElement project = (CElement)getCProject(projectName);
|
||||
CElement project = (CElement) getCProject(projectName);
|
||||
if (project != null) {
|
||||
return project.getHandleFromMemento(memento);
|
||||
}
|
||||
|
@ -243,9 +248,8 @@ public class CModel extends Openable implements ICModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected char getHandleMementoDelimiter(){
|
||||
protected char getHandleMementoDelimiter() {
|
||||
Assert.isTrue(false, "Should not be called"); //$NON-NLS-1$
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue