mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
add startup() and shtudown() methods.
This commit is contained in:
parent
6b356aa170
commit
febb3908e9
4 changed files with 53 additions and 4 deletions
|
@ -88,6 +88,20 @@ public class IndexModel {
|
||||||
manager.addAll();
|
manager.addAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void startup() {
|
||||||
|
manager.startup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void shutdown() {
|
||||||
|
manager.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize default index Model.
|
* Initialize default index Model.
|
||||||
*/
|
*/
|
||||||
|
@ -101,4 +115,5 @@ public class IndexModel {
|
||||||
|
|
||||||
private IndexModel () {
|
private IndexModel () {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class IndexManager implements IElementChangedListener {
|
||||||
return projectsMap;
|
return projectsMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void init () {
|
public void startup () {
|
||||||
requestList = new RequestList();
|
requestList = new RequestList();
|
||||||
projectsMap = Collections.synchronizedMap(new HashMap());
|
projectsMap = Collections.synchronizedMap(new HashMap());
|
||||||
CTagsRunner ctags = new CTagsRunner(this);
|
CTagsRunner ctags = new CTagsRunner(this);
|
||||||
|
@ -155,7 +155,9 @@ public class IndexManager implements IElementChangedListener {
|
||||||
|
|
||||||
public void clearRequestList(IResource resource) {
|
public void clearRequestList(IResource resource) {
|
||||||
if (resource instanceof IFile) {
|
if (resource instanceof IFile) {
|
||||||
|
if (requestList != null) {
|
||||||
requestList.removeItem(resource);
|
requestList.removeItem(resource);
|
||||||
|
}
|
||||||
} else if (resource instanceof IContainer) {
|
} else if (resource instanceof IContainer) {
|
||||||
try {
|
try {
|
||||||
IContainer container = (IContainer)resource;
|
IContainer container = (IContainer)resource;
|
||||||
|
@ -189,9 +191,11 @@ public class IndexManager implements IElementChangedListener {
|
||||||
public void addFile(IFile file) {
|
public void addFile(IFile file) {
|
||||||
if (CoreModel.getDefault().isTranslationUnit(file) &&
|
if (CoreModel.getDefault().isTranslationUnit(file) &&
|
||||||
IndexModel.getDefault().isEnabled(file.getProject())) {
|
IndexModel.getDefault().isEnabled(file.getProject())) {
|
||||||
|
if (requestList != null) {
|
||||||
requestList.addItem(file);
|
requestList.addItem(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger addition of the entire content of a project
|
* Trigger addition of the entire content of a project
|
||||||
|
@ -248,7 +252,6 @@ public class IndexManager implements IElementChangedListener {
|
||||||
public static IndexManager getDefault() {
|
public static IndexManager getDefault() {
|
||||||
if (indexManager == null) {
|
if (indexManager == null) {
|
||||||
indexManager = new IndexManager();
|
indexManager = new IndexManager();
|
||||||
indexManager.init();
|
|
||||||
// Register to the C Core Model for C specific changes.
|
// Register to the C Core Model for C specific changes.
|
||||||
CoreModel.getDefault().addElementChangedListener(indexManager);
|
CoreModel.getDefault().addElementChangedListener(indexManager);
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,6 +185,17 @@ public class CoreModel {
|
||||||
manager.removeElementChangedListener(listener);
|
manager.removeElementChangedListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Plugin#startup
|
||||||
|
*/
|
||||||
|
public void startup() {
|
||||||
|
manager.startup();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
manager.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
private CoreModel() {
|
private CoreModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -748,4 +748,24 @@ public class CModelManager implements IResourceChangeListener {
|
||||||
this.cache.removeInfo(element);
|
this.cache.removeInfo(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void startup() {
|
||||||
|
// Do any initialization.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void shutdown() {
|
||||||
|
// Do any shutdown of services.
|
||||||
|
BinaryRunner[] runners = (BinaryRunner[])binaryRunners.values().toArray(new BinaryRunner[0]);
|
||||||
|
for (int i = 0; i < runners.length; i++) {
|
||||||
|
if (runners[i].isAlive()) {
|
||||||
|
runners[i].interrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue