diff options
author | Matthias Villiger | 2014-06-04 08:43:01 +0000 |
---|---|---|
committer | Matthias Villiger | 2014-06-04 08:43:01 +0000 |
commit | a1ea856616dfc0af86f77bafc4ed2057f55780b8 (patch) | |
tree | c1a18afd7deb13a30320fc5c1c380784583e85f6 | |
parent | a25363d6450f518471e883a8c66a432c8e4ee7be (diff) | |
download | org.eclipse.scout.sdk-a1ea856616dfc0af86f77bafc4ed2057f55780b8.tar.gz org.eclipse.scout.sdk-a1ea856616dfc0af86f77bafc4ed2057f55780b8.tar.xz org.eclipse.scout.sdk-a1ea856616dfc0af86f77bafc4ed2057f55780b8.zip |
Launch classid validation async to not slowdown eclipse startup.
3 files changed, 17 insertions, 11 deletions
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/classid/ClassIdDuplicateResolution.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/classid/ClassIdDuplicateResolution.java index 5de518075..989519e5d 100644 --- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/classid/ClassIdDuplicateResolution.java +++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/classid/ClassIdDuplicateResolution.java @@ -97,7 +97,7 @@ public class ClassIdDuplicateResolution implements IMarkerResolution { catch (CoreException e) { //nop } - ClassIdValidationJob.execute(0); // the modification of the annotation does not cause an annotation modify event to be triggered + ClassIdValidationJob.executeAsync(0); // the modification of the annotation does not cause an annotation modify event to be triggered } }); j.schedule(); diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/classid/ClassIdValidationJob.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/classid/ClassIdValidationJob.java index fbe20b7cd..cd025eb21 100644 --- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/classid/ClassIdValidationJob.java +++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/classid/ClassIdValidationJob.java @@ -236,21 +236,27 @@ public final class ClassIdValidationJob extends JobEx { IAnnotation annotation = (IAnnotation) event.getElement(); if (annotation != null && annotation.getElementName().endsWith(Signature.getSimpleName(IRuntimeClasses.ClassId))) { if (TypeUtility.exists(event.getElement())) { - execute(0); + executeAsync(1000); } } } } } - public static synchronized void execute(long startDelay) { - // get the class id type outside of the job - // because with the job rule a search cannot be performed -> IllegalArgumentException: Attempted to beginRule - IType classId = TypeUtility.getType(IRuntimeClasses.ClassId); - if (TypeUtility.exists(classId)) { - Job.getJobManager().cancel(CLASS_ID_VALIDATION_JOB_FAMILY); - new ClassIdValidationJob(classId).schedule(startDelay); - } + public static synchronized void executeAsync(final long startDelay) { + new Job("schedule classid validation") { + @Override + protected IStatus run(IProgressMonitor monitor) { + // get the class id type outside of the validation job + // because with the job rule a search cannot be performed -> IllegalArgumentException: Attempted to beginRule + IType classId = TypeUtility.getType(IRuntimeClasses.ClassId); + if (TypeUtility.exists(classId)) { + Job.getJobManager().cancel(CLASS_ID_VALIDATION_JOB_FAMILY); + new ClassIdValidationJob(classId).schedule(startDelay); + } + return Status.OK_STATUS; + } + }.schedule(); } private static final class P_SchedulingRule implements ISchedulingRule { diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/internal/ScoutSdk.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/internal/ScoutSdk.java index bbec9ca0f..dcdaa1eb7 100644 --- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/internal/ScoutSdk.java +++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/internal/ScoutSdk.java @@ -51,7 +51,7 @@ public class ScoutSdk extends Plugin { // start class id validation ClassIdValidationJob.install(); - ClassIdValidationJob.execute(5000); + ClassIdValidationJob.executeAsync(5000); // DTO auto update m_autoUpdateManager = new DtoAutoUpdateManager(); |