Skip to content
Snippets Groups Projects
Commit 1f947bac authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

adds "isTimeConsuming" to the service

refs 2620
parent 8786ca12
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ import org.fortiss.tooling.kernel.model.constraints.IConstraintVerificationStatu
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 1F0E49CC3578B200B75D53CB6DBEF041
* @ConQAT.Rating YELLOW Hash: 09EAC9DA831881A6C95D822B95E8A509
*/
public interface IConstraintVerifierUI {
......@@ -69,9 +69,17 @@ public interface IConstraintVerifierUI {
/** Returns the image descriptor to be used as icon image. */
public ImageDescriptor getIconImageDescriptor();
/**
* Way for the verifier to indicate that the verification is time consuming.
* This triggers a few goodies:
* - wait 1s before triggering the constraint autocheck (if relevant)
* - display a warning popup in case of first trigger of the verification
*/
public boolean isTimeConsuming();
/**
* True if this constraint shall be always activated (and therefore the user shall not be
* offered the possibility to control whether the constraint is active or not).
*/
boolean shouldBeManuallyActivated();
public boolean shouldBeManuallyActivated();
}
......@@ -55,7 +55,7 @@ import org.fortiss.tooling.kernel.utils.ConstraintsUtils;
* @author vincent
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: D5A45531D28ACC5C7D1A365EDC53E287
* @ConQAT.Rating YELLOW Hash: 0A04F194ACFB77D83D1C4B9E409761EE
*/
public class ConstraintVerifierUIBases {
......@@ -99,6 +99,12 @@ public class ConstraintVerifierUIBases {
return false;
}
/** {@inheritDoc} */
@Override
public boolean isTimeConsuming() {
return false;
}
/** Dialog presenting the error/failure and the possible fix(es). */
private static class FixDialog extends MessageDialog {
......@@ -236,16 +242,9 @@ public class ConstraintVerifierUIBases {
return Status.OK_STATUS;
}
};
// We wait 2s before starting the job because user modifications can go fast
latestJob.schedule(delayBeforeAutocheck() * 1000);
}
/**
* Delay before autocheck in seconds. Default is 0. For resource-consuming constraints
* should be higher, e.g. 1.
*/
protected int delayBeforeAutocheck() {
return 0;
// If the constraint is considered time consuming, we wait 1s before starting the job
// because user modifications can go faster than the check.
latestJob.schedule(isTimeConsuming() ? 1000 : 0);
}
/** {@inheritDoc} */
......
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