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

adds further utility methods

refs 2334
parent 2c608748
No related branches found
No related tags found
No related merge requests found
......@@ -24,10 +24,12 @@ import java.util.List;
import java.util.function.Function;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.fortiss.tooling.kernel.extension.data.IConstraintViolation;
import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity;
import org.fortiss.tooling.kernel.model.constraints.ConstrainedWithChecksum;
......@@ -48,7 +50,7 @@ import org.fortiss.tooling.kernel.utils.EcoreUtils;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 8E535AAF5BE563F94B385D091D10B45E
* @ConQAT.Rating YELLOW Hash: 57BDB29B589BA33DA52FC4380EC8A7F2
*/
public class ConstraintsUIUtils {
......@@ -187,18 +189,29 @@ public class ConstraintsUIUtils {
public static void triggerMarkerRefresh(String id, IConstraintContainer cstrContainer) {
for(Constraint c : cstrContainer.getConstraints()) {
if(c.getConstraintTypeID().equals(id)) {
ConstraintsUIUtils.triggerMarkersRefresh(c);
triggerMarkersRefresh(c);
}
}
}
/**
* @param constraints
* Calls <code>triggerMarkersRefresh</code> on every constraint of
* <code>constraints</code>.
*/
public static void triggerMarkerRefresh(List<Constraint> constraints) {
for(Constraint c : constraints) {
triggerMarkersRefresh(c);
}
}
/**
* @param c
* @return Standard text describing the status of <code>c</code>.
*/
public static String getText(Constraint c) {
if(c == null) {
return "";
return "NOT APPLICABLE";
}
String mainMsg = "ERROR";
IConstraintVerificationStatus status =
......@@ -240,7 +253,7 @@ public class ConstraintsUIUtils {
public static Color getColor(Constraint c) {
Display display = Display.getCurrent();
if(c == null) {
return display.getSystemColor(SWT.COLOR_GRAY);
return display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
}
IConstraintVerificationStatus status =
IConstraintVerificationUIService.getInstance().getStatus(c);
......@@ -305,4 +318,20 @@ public class ConstraintsUIUtils {
return IConstraintVerificationUIService.getInstance().getStatus(constraint) != null;
}
/**
* Standard warning message to display when a resource-consuming check is activated for the
* first time.
*/
public static void displayTimeConsumptionWarning(String id) {
Display d = Display.getCurrent();
d = d == null ? Display.getDefault() : d;
Shell shell = d.getActiveShell();
String title = "Background operation about to start";
String msg = "AutoFOCUS will now go through your project to check that ";
msg += IConstraintVerificationUIService.getInstance().getDescription(id) + ". ";
msg += "This might slow down your system.\n\n";
msg += "Note that this is a one-time thing: once the check is activated, ";
msg += "subsequent runs should be unnoticed.";
MessageDialog.openWarning(shell, title, msg);
}
}
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