org.netbeans.modules.cnd.api.model
Interface CsmModel
- All Known Subinterfaces:
- CsmModelAccessor.CsmModelEx
public interface CsmModel
Source model
getProject
CsmProject getProject(Object id)
- Parameters:
id - Netbeans project
projects
Collection<CsmProject> projects()
addModelListener
void addModelListener(CsmModelListener listener)
removeModelListener
void removeModelListener(CsmModelListener listener)
addProgressListener
void addProgressListener(CsmProgressListener listener)
removeProgressListener
void removeProgressListener(CsmProgressListener listener)
addModelStateListener
void addModelStateListener(CsmModelStateListener listener)
removeModelStateListener
void removeModelStateListener(CsmModelStateListener listener)
enqueue
void enqueue(Runnable task)
- Code model calls can be very expensive.
Therefore one can never call code model from event dispatching thread.
Moreover, to make code model able to effectively solve synchronization issues,
all callers shall use not their own threads but call enqueue method instead.
The method creates a thread and runs the given task in this thread.
Whether or not the thread be created immediately or the task
will be just enqueued and runned later on, depends on implementation.
- Parameters:
task - task to run
enqueue
void enqueue(Runnable task,
String name)
- Code model calls can be very expensive.
Therefore one can never call code model from event dispatching thread.
Moreover, to make code model able to effectively solve synchronization issues,
all callers shall use not their own threads but call enqueue method instead.
The method creates a thread and runs the given task in this thread.
Whether or not the thread be created immediately or the task
will be just enqueued and runned later on, depends on implementation.
We recommend using this method rather than one without
name parameter.
- Parameters:
task - task to runname - name that would be added to the thread name
findFile
CsmFile findFile(String absPath)
- Find project that contains file.
Returns CsmFile if project is found.
This function might be costly (this depends on the model state).
CAUTION: this method should never be called directly from the thread,
in which model notificatios (either CsmModelListener or CsmProgressListener) come.
These notifications come directly in parser thread or project initialization thread.
Calling findFile from these threads may cause deadlock.
TODO: add CsmFile[] findFiles(String absPath) since there might be multiple CsmFile instances,
associated with the same path, in the case the same file is included into different projects
- Parameters:
absPath - absolute file path
getState
CsmModelState getState()
- Returns the state of the model