Skip to content
Snippets Groups Projects
Commit b1ff679b authored by Luca Cristoforetti's avatar Luca Cristoforetti
Browse files

Improve handling of checkers execution

parent 026b1c3f
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ public abstract class Checker {
org.eclipse.uml2.uml.Package pack = EntityUtil.getInstance().getCurrentSystemView();
if(pack == null) {
IFile file = EntityUtil.getInstance().getCurrentIFile();
System.out.println("file: "+file);
logger.debug("file: "+file);
EntityUtil.getInstance().openCurrentModelIntoEditor(file);
}
......@@ -91,9 +91,8 @@ public abstract class Checker {
* Just runs the check() method and returns the scheduled job.
* @param pack
* @return
* @throws Exception
*/
public Job syncCheck(Package pack) throws Exception {
public Job syncCheck(Package pack) {
CheckerManager checkerManager = org.polarsys.chess.checkers.Activator.getCheckerManager();
IFile iFile = WorkspaceSynchronizer.getFile(pack.eResource());
......
......@@ -83,13 +83,14 @@ public class CheckerManager {
* Launches the check() of the various checkerContainers and waits for their finish.
* @param selectedCheckersTags
* @param pkg
* @throws Exception
* @return
*/
public void runSync(Set<String> selectedCheckersTags, Package pkg, IProgressMonitor monitor) throws Exception {
public List<Exception> runSync(Set<String> selectedCheckersTags, Package pkg, IProgressMonitor monitor) {
logger.debug("runSync");
final List<Exception> errors = new ArrayList<Exception>();
checkerStatus = new HashMap<String, Boolean>();
messages = new ArrayList<CheckerMessage>();
List<Job> jobs = new ArrayList<Job>();
final List<Job> jobs = new ArrayList<Job>();
for (CheckersContainer checkersContainer : checkersContainers) {
logger.debug("run checkersContainer");
jobs.addAll(checkersContainer.runSync(selectedCheckersTags, pkg));
......@@ -99,7 +100,6 @@ public class CheckerManager {
while(!allEnded) {
allEnded = true;
for (Entry<String, Boolean> entry : checkerStatus.entrySet()) {
logger.error("Checker name = " + entry.getKey() + " value = " + entry.getValue());
allEnded &= entry.getValue();
}
if (allEnded) break;
......@@ -107,10 +107,16 @@ public class CheckerManager {
for (Job job : jobs) {
job.cancel();
}
errors.add(new Exception("Esecuzione checker interrotta"));
break;
}
TimeUnit.SECONDS.sleep(5);
try {
TimeUnit.SECONDS.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return errors;
}
public void register(CheckersContainer checkersContainer) {
......
......@@ -55,9 +55,8 @@ public class CheckersContainer {
* Runs the check() of the selected checkers and returns the scheduled jobs.
* @param checkersTags
* @return the list of scheduled jobs
* @throws Exception
*/
public List<Job> runSync(Set<String> checkersTags, Package pkg) throws Exception {
public List<Job> runSync(Set<String> checkersTags, Package pkg) {
final List<Job> jobs = new ArrayList<Job>();
for (Checker checker : checkers) {
checkerManager.updateCheckerStatus(checker.unifiedName, false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment