We can call below particular snippet from any plugin start() method.
final Bundle currentBundle = getBundle();
Job serviceJob = new Job("services starting...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
while (currentBundle.getState() != Bundle.ACTIVE) {
try {
Thread.sleep(1000); //wait for some time and then re-check
} catch (InterruptedException e) {
e.printStackTrace();
}
}
startService(); //service implemenation goes here - this what you wanted to do after plugin is active
return Status.OK_STATUS;
}
};
serviceJob.schedule();
final Bundle currentBundle = getBundle();
Job serviceJob = new Job("services starting...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
while (currentBundle.getState() != Bundle.ACTIVE) {
try {
Thread.sleep(1000); //wait for some time and then re-check
} catch (InterruptedException e) {
e.printStackTrace();
}
}
startService(); //service implemenation goes here - this what you wanted to do after plugin is active
return Status.OK_STATUS;
}
};
serviceJob.schedule();
No comments:
Post a Comment