VerifyEObjectHoverProvider.java
/**
* Copyright (c) 2004-2025 Carnegie Mellon University and others. (see Contributors file).
* All Rights Reserved.
*
* NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
* OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
* MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
*
* This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
* SPDX-License-Identifier: EPL-2.0
*
* Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
*
* This program includes and/or can make use of certain third party source code, object code, documentation and other
* files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
* configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
* conditions contained in any such Third Party Software or separate license file distributed with such Third Party
* Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party benefici-
* aries to this license with respect to the terms applicable to their Third Party Software. Third Party Software li-
* censes only apply to the Third Party Software and not any other portion of this program or this program as a whole.
*/
package org.osate.verify.ui.outline;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.ui.editor.hover.html.DefaultEObjectHoverProvider;
import org.osate.aadl2.ComponentClassifier;
import org.osate.alisa.common.common.Description;
import org.osate.alisa.common.util.CommonUtilExtension;
import org.osate.reqspec.reqSpec.Requirement;
import org.osate.reqspec.util.ReqSpecUtilExtension;
import org.osate.verify.internal.util.VerifyUtilExtension;
import org.osate.verify.verify.Claim;
import org.osate.verify.verify.VerificationActivity;
import org.osate.verify.verify.VerificationMethod;
@SuppressWarnings("all")
public class VerifyEObjectHoverProvider extends DefaultEObjectHoverProvider {
@Override
public String getHoverInfoAsHtml(final EObject o) {
boolean _matched = false;
if (o instanceof VerificationActivity) {
_matched=true;
final VerificationMethod vm = ((VerificationActivity)o).getMethod();
Claim _containingClaim = VerifyUtilExtension.getContainingClaim(o);
Requirement _requirement = null;
if (_containingClaim!=null) {
_requirement=_containingClaim.getRequirement();
}
ComponentClassifier _targetClassifier = null;
if (_requirement!=null) {
_targetClassifier=ReqSpecUtilExtension.targetClassifier(_requirement);
}
final ComponentClassifier target = _targetClassifier;
return this.vaText(vm, target);
}
if (!_matched) {
if (o instanceof VerificationMethod) {
_matched=true;
return this.vmText(((VerificationMethod)o));
}
}
if (!_matched) {
if (o instanceof Claim) {
_matched=true;
final Requirement req = ((Claim)o).getRequirement();
return this.reqText(req);
}
}
return super.getHoverInfoAsHtml(o);
}
public String vaText(final VerificationMethod vm, final ComponentClassifier target) {
String _elvis = null;
String _title = vm.getTitle();
if (_title != null) {
_elvis = _title;
} else {
_elvis = "";
}
final String z = _elvis;
String _elvis_1 = null;
Description _description = vm.getDescription();
String _text = null;
if (_description!=null) {
_text=CommonUtilExtension.toText(_description, target);
}
if (_text != null) {
_elvis_1 = _text;
} else {
_elvis_1 = "";
}
String zz = _elvis_1;
int _length = zz.length();
boolean _greaterThan = (_length > 0);
if (_greaterThan) {
zz = (": " + zz);
}
String _name = vm.getName();
String _plus = ("Method " + _name);
String _plus_1 = (_plus + ": ");
String _plus_2 = (_plus_1 + z);
final String res = (_plus_2 + zz);
return res;
}
public String vmText(final VerificationMethod vm) {
String _elvis = null;
String _title = vm.getTitle();
if (_title != null) {
_elvis = _title;
} else {
_elvis = "";
}
final String z = _elvis;
String _elvis_1 = null;
Description _description = vm.getDescription();
String _text = null;
if (_description!=null) {
_text=CommonUtilExtension.toText(_description, null);
}
if (_text != null) {
_elvis_1 = _text;
} else {
_elvis_1 = "";
}
String zz = _elvis_1;
int _length = zz.length();
boolean _greaterThan = (_length > 0);
if (_greaterThan) {
zz = (": " + zz);
}
String _name = vm.getName();
String _plus = ("Method " + _name);
String _plus_1 = (_plus + ": ");
String _plus_2 = (_plus_1 + z);
final String res = (_plus_2 + zz);
return res;
}
public String reqText(final Requirement req) {
String _elvis = null;
String _title = req.getTitle();
if (_title != null) {
_elvis = _title;
} else {
_elvis = "";
}
final String z = _elvis;
String _elvis_1 = null;
Description _description = req.getDescription();
String _text = null;
if (_description!=null) {
_text=CommonUtilExtension.toText(_description, ReqSpecUtilExtension.targetClassifier(req));
}
if (_text != null) {
_elvis_1 = _text;
} else {
_elvis_1 = "";
}
String zz = _elvis_1;
int _length = zz.length();
boolean _greaterThan = (_length > 0);
if (_greaterThan) {
zz = (": " + zz);
}
String _name = req.getName();
String _plus = ("Requirement " + _name);
String _plus_1 = (_plus + ": ");
String _plus_2 = (_plus_1 + z);
final String res = (_plus_2 + zz);
return res;
}
}