mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 13:55:39 +02:00
Cosmetics.
This commit is contained in:
parent
ef4a520f87
commit
66e0db829f
1 changed files with 24 additions and 29 deletions
|
@ -10,7 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.model;
|
package org.eclipse.cdt.internal.core.model;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -28,7 +27,6 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
public abstract class Openable extends Parent implements IOpenable {
|
public abstract class Openable extends Parent implements IOpenable {
|
||||||
|
|
||||||
protected IResource resource;
|
protected IResource resource;
|
||||||
|
|
||||||
public Openable(ICElement parent, IPath path, int type) {
|
public Openable(ICElement parent, IPath path, int type) {
|
||||||
|
@ -78,7 +76,8 @@ public abstract class Openable extends Parent implements IOpenable {
|
||||||
* if successful, or false if an error is encountered while determining
|
* if successful, or false if an error is encountered while determining
|
||||||
* the structure of this element.
|
* the structure of this element.
|
||||||
*/
|
*/
|
||||||
protected abstract boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException;
|
protected abstract boolean buildStructure(OpenableInfo info, IProgressMonitor pm,
|
||||||
|
Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the buffer associated with this element, if any.
|
* Close the buffer associated with this element, if any.
|
||||||
|
@ -145,7 +144,6 @@ public abstract class Openable extends Parent implements IOpenable {
|
||||||
* @see org.eclipse.cdt.core.model.IOpenable#hasUnsavedChanges()
|
* @see org.eclipse.cdt.core.model.IOpenable#hasUnsavedChanges()
|
||||||
*/
|
*/
|
||||||
public boolean hasUnsavedChanges() throws CModelException{
|
public boolean hasUnsavedChanges() throws CModelException{
|
||||||
|
|
||||||
if (isReadOnly() || !isOpen()) {
|
if (isReadOnly() || !isOpen()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -155,8 +153,7 @@ public abstract class Openable extends Parent implements IOpenable {
|
||||||
}
|
}
|
||||||
// for roots and projects must check open buffers
|
// for roots and projects must check open buffers
|
||||||
// to see if they have an child with unsaved changes
|
// to see if they have an child with unsaved changes
|
||||||
if (fType == C_MODEL ||
|
if (fType == C_MODEL || fType == C_PROJECT) {
|
||||||
fType == C_PROJECT) {
|
|
||||||
Enumeration<IBuffer> openBuffers= getBufferManager().getOpenBuffers();
|
Enumeration<IBuffer> openBuffers= getBufferManager().getOpenBuffers();
|
||||||
while (openBuffers.hasMoreElements()) {
|
while (openBuffers.hasMoreElements()) {
|
||||||
IBuffer buffer= openBuffers.nextElement();
|
IBuffer buffer= openBuffers.nextElement();
|
||||||
|
@ -171,6 +168,7 @@ public abstract class Openable extends Parent implements IOpenable {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclasses must override as required.
|
* Subclasses must override as required.
|
||||||
*
|
*
|
||||||
|
@ -234,30 +232,28 @@ public abstract class Openable extends Parent implements IOpenable {
|
||||||
/**
|
/**
|
||||||
* Open the parent element if necessary.
|
* Open the parent element if necessary.
|
||||||
*/
|
*/
|
||||||
protected void openParent(CElementInfo childInfo, Map<ICElement, CElementInfo> newElements, IProgressMonitor pm) throws CModelException {
|
protected void openParent(CElementInfo childInfo, Map<ICElement, CElementInfo> newElements,
|
||||||
|
IProgressMonitor pm) throws CModelException {
|
||||||
Openable openableParent = (Openable) getOpenableParent();
|
Openable openableParent = (Openable) getOpenableParent();
|
||||||
if (openableParent != null && !openableParent.isOpen()){
|
if (openableParent != null && !openableParent.isOpen()){
|
||||||
openableParent.generateInfos(openableParent.createElementInfo(), newElements, pm);
|
openableParent.generateInfos(openableParent.createElementInfo(), newElements, pm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.model.CElement#generateInfos(java.lang.Object, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
|
|
||||||
*/
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.model.CElement#generateInfos(java.lang.Object, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
|
* @see org.eclipse.cdt.internal.core.model.CElement#generateInfos(java.lang.Object, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void generateInfos(CElementInfo info, Map<ICElement, CElementInfo> newElements, IProgressMonitor monitor) throws CModelException {
|
protected void generateInfos(CElementInfo info, Map<ICElement, CElementInfo> newElements,
|
||||||
|
IProgressMonitor monitor) throws CModelException {
|
||||||
if (CModelManager.VERBOSE){
|
if (CModelManager.VERBOSE){
|
||||||
System.out.println("OPENING Element ("+ Thread.currentThread()+"): " + this); //$NON-NLS-1$//$NON-NLS-2$
|
System.out.println("OPENING Element ("+ Thread.currentThread()+"): " + this); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
// open the parent if necessary
|
// open the parent if necessary
|
||||||
openParent(info, newElements, monitor);
|
openParent(info, newElements, monitor);
|
||||||
if (monitor != null && monitor.isCanceled()) return;
|
if (monitor != null && monitor.isCanceled())
|
||||||
|
return;
|
||||||
|
|
||||||
// puts the info before building the structure so that questions to the handle behave as if the element existed
|
// puts the info before building the structure so that questions to the handle behave as if the element existed
|
||||||
// (case of compilation units becoming working copies)
|
// (case of compilation units becoming working copies)
|
||||||
|
@ -275,7 +271,6 @@ public abstract class Openable extends Parent implements IOpenable {
|
||||||
|
|
||||||
// remove out of sync buffer for this element
|
// remove out of sync buffer for this element
|
||||||
CModelManager.getDefault().getElementsOutOfSynchWithBuffers().remove(this);
|
CModelManager.getDefault().getElementsOutOfSynchWithBuffers().remove(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,10 +301,10 @@ public abstract class Openable extends Parent implements IOpenable {
|
||||||
public SourceRoot getSourceRoot() {
|
public SourceRoot getSourceRoot() {
|
||||||
ICElement current = this;
|
ICElement current = this;
|
||||||
do {
|
do {
|
||||||
if (current instanceof SourceRoot) return (SourceRoot)current;
|
if (current instanceof SourceRoot)
|
||||||
|
return (SourceRoot) current;
|
||||||
current = current.getParent();
|
current = current.getParent();
|
||||||
} while (current != null);
|
} while (current != null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue