Commit 17dc6fc4 authored by Hafiz Muhammad Wahaj Aziz's avatar Hafiz Muhammad Wahaj Aziz
Browse files

samplingTime function in the data dictionary

refs 3055
parent 4dbfcb92
AF3ExpressionUIActivator.java b131774621ed831068be3b4083cb0732561fbe36 GREEN
ComplexDataDecoratedDialogCellEditor.java c6c535902246cf1f47740343c499562736940a39 GREEN
ComplexDataDialog.java d06b449493d822d94dc62c648f6dc6911bc4f4fc GREEN
ComplexDataDialogButtonEnableListener.java dd98e905f3c357f67027b30152633eab1f788b4c GREEN
......
DataDictionaryCompositor.java 9951980787647d17d27f1a20f958490aa864422f GREEN
EnumerationCompositor.java bfc5d4ef788b6e76d3f16d4ba7926fa490272135 GREEN
StructureCompositor.java a200beb852f09c1d13252617da0b8357913b6d3e GREEN
CompilerBasedConverterBase.java cf1737745985ba0bc49025e3650c4e484d608d99 GREEN
CompilerBasedValidatorBase.java cc85a078379e1d100b161a3b20077c76f884efa7 GREEN
ITermToStringConverter.java 4cdae5e64d59874fc96914c48f10b50c1085f7ec GREEN
StatementSequenceToStringConverter.java cbabe3afb663330ec29918b58848419e0eee2f7a GREEN
StringToIExpressionTermConverter.java ba881d520acbe27bc3a190bfc27cfb0aba487102 GREEN
StringToIStatementTermConverter.java 73c6a9c5e1973641e183b761129e6a9f9375d2b5 GREEN
StringToITermConverter.java 6a95bc2fb626e490285f1f2ac100bf50b559a1f7 GREEN
StringToIStatementTermConverter.java a25c55bf1746b435dd6c024745a8599c10469af3 GREEN
StringToITermConverter.java ade3d96872d7ba0172026e6dab354828406e9df9 GREEN
StringToStatementSequenceConverter.java 735ef72b206eaea90565de6429c1d392ee627bf2 GREEN
StringToStructureMemberOrParameterConverter.java 9e7ff9c4b24077d80c3e21b5838a5cf5117ae8fc GREEN
StringToTypeConverter.java 4d5a89af863e14e0b52806888dc2ae4f1b7c924f GREEN
......
DoubleToStringConverter.java 9d48f015708d7ddbb34f2810898c030fa326a828 GREEN
DoubleToStringConverter.java f27359e36edd1d7df2b02585ab23f2b2aa3737e7 GREEN
DoubleTypeIExpressionTermValidator.java 7920a9dc557742453c440a97f0e5ecd2aaaa8d7f GREEN
FloatToStringConverter.java 75d55727ef981aa5b0c3119129136a32647ca7d4 GREEN
IntToStringConverter.java c9ed1e946daee00f63b2e90329ee5bc2eca07732 GREEN
StringToDoubleConverter.java bb43827d6494b57a1d7f322557d9ff018ea02c05 GREEN
StringToDoubleConverter.java bb9867d6765454a5fe938dd78c50a72dab212f83 GREEN
StringToFloatConverter.java 5d3c494b7e9eb0afbf73e6e3036bb2fc1821f349 GREEN
StringToIExpressionTermValidator.java 7bf76356a0440f927fc9e2f24856624b4518a348 GREEN
StringToIExpressionTermValidatorBase.java b6eee920b72147284a038259b3d4d98dea98a17c GREEN
StringToIExpressionTermWithTypeCheckValidatorBase.java 77ca4c7ca59d2921f56efc2c210417b168f4fa22 GREEN
StringToIStatementTermValidator.java a12895c2d4f6d4d78168e3b1ffaa6b179ce11bf2 GREEN
StringToIStatementTermValidator.java 8a65c68cadd64db9715c3585e0899dda488a09e2 GREEN
StringToITermValidator.java 4e8e207428a25d28fa9bb3bd0f6cbf001d217dac GREEN
StringToIntConverter.java 89cfeb99e85c70607d1000e36de7cfc73c48af37 GREEN
StringToStatementSequenceValidator.java 2f672e06de45628c1e7d2ae688578279850c3bbd GREEN
......
DataDictionaryEditor.java 9c6cf513b97e2e47b1681bf3f872b9ffc6e7917c GREEN
DataDictionaryEditor.java 1692a9f5ebb1751d5f4bcf0e406cdf6816ebb2e3 GREEN
DataDictionaryEditorBinding.java 0afd69998e31b243361ecbbd6a4691f8ee72b3a9 GREEN
DataDictionaryEvaluatorBackend.java 8ac259f436097fdc51252be25ef7d134ae4a44ab GREEN
DataDictionaryEvaluatorBinding.java ed402d190105d8be10c1b126f98b3de447387033 GREEN
......
......@@ -25,15 +25,22 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EContentAdapter;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.StyledString.Styler;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Device;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.PlatformUI;
import org.fortiss.af3.expression.model.DataDictionary;
......@@ -43,6 +50,7 @@ import org.fortiss.af3.expression.model.definitions.FunctionDefinition;
import org.fortiss.af3.expression.model.definitions.Structure;
import org.fortiss.af3.expression.model.definitions.StructureMember;
import org.fortiss.af3.expression.model.definitions.TypeDefinition;
import org.fortiss.af3.expression.model.terms.UserdefinedFunction;
import org.fortiss.tooling.base.ui.dnd.jface.ViewerElementCompositionDropAdapter;
import org.fortiss.tooling.base.ui.viewers.IconNameLabelProvider;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
......@@ -113,15 +121,26 @@ public class DataDictionaryEditor extends EditorBase<DataDictionary> implements
return 0;
}
});
gui.getNameColumn().setLabelProvider(
new DecoratingStyledCellLabelProvider(new IconNameLabelProvider() {
/** {@inheritDoc} */
@Override
public StyledString getStyledText(Object element) {
StyledString styledString;
if(element instanceof FunctionDefinition) {
return new StyledString(IModelElementHandlerService.getInstance()
.getDescription((FunctionDefinition)element));
FunctionDefinition fun = (FunctionDefinition)element;
styledString =
new StyledString(IModelElementHandlerService.getInstance()
.getDescription(fun));
if(fun.getFunction().getName().equals("samplingTime")) {
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
colorRegistry.put(styledString.getString(), new RGB(0, 0, 255));
Styler styler =
StyledString.createColorRegistryStyler(
styledString.getString(), null);
styledString.setStyle(0, styledString.length(), styler);
}
return styledString;
}
return super.getStyledText(element);
}
......@@ -132,7 +151,9 @@ public class DataDictionaryEditor extends EditorBase<DataDictionary> implements
if(cell.getElement() instanceof StructureMember) {
cell.setText(((StructureMember)cell.getElement()).getType().toString());
} else if(cell.getElement() instanceof FunctionDefinition) {
cell.setText(((FunctionDefinition)cell.getElement()).getReturnType().toString());
FunctionDefinition fun = (FunctionDefinition)cell.getElement();
cell.setText(fun.getReturnType().toString());
setCellTextColor(cell, fun.getFunction().getName().equals("samplingTime"));
} else if(cell.getElement() instanceof Array) {
Array array = (Array)cell.getElement();
cell.setText(array.getType().toString() + "[" + array.getLength() + "]");
......@@ -147,7 +168,9 @@ public class DataDictionaryEditor extends EditorBase<DataDictionary> implements
if(cell.getElement() instanceof INamedCommentedElement) {
cell.setText(((INamedCommentedElement)cell.getElement()).getComment());
} else if(cell.getElement() instanceof FunctionDefinition) {
cell.setText(((FunctionDefinition)cell.getElement()).getFunction().getComment());
UserdefinedFunction fun = ((FunctionDefinition)cell.getElement()).getFunction();
cell.setText(fun.getComment());
setCellTextColor(cell, fun.getName().equals("samplingTime"));
} else {
cell.setText("");
}
......@@ -199,4 +222,16 @@ public class DataDictionaryEditor extends EditorBase<DataDictionary> implements
public List<EObject> getSelectedModelElementList() {
return getEObjectElements(gui.getTreeViewer().getSelection());
}
/** Set the foreground color of the provided {@link ViewerCell} */
private void setCellTextColor(ViewerCell cell, boolean isSamplingTimeFunction) {
Device device = Display.getCurrent();
if((isSamplingTimeFunction)) {
Color blue = new Color(device, 0, 0, 255);
cell.setForeground(blue);
} else {
Color black = new Color(device, 0, 0, 0);
cell.setForeground(black);
}
}
}
ArrayHandler.java 917373f9816054df5fe2b0c48ee2938db296a305 GREEN
DataDictionaryHandler.java d4ccdf891ecba1ff20e8a1dcb34d8d3f59fc34b6 GREEN
EnumerationHandler.java 623b5f1b50200f3c67e61e62915d5ef03dbc3caa GREEN
......
ArrayPropertySection.java 9a24775db5883b697f4ff0bf9afaadd2fb545130 GREEN
EnumPropertySection.java 5b97bc89c91e9783f502bac3108eb5f0bb8df0c1 GREEN
EnumerationMemberPropertySection.java 16924c0935d870f9000307e6638e8dfbe2558f3b GREEN
FunctionDefinitionPropertySection.java ca26ffa20b9a5ab55fd8cac39b411427a66cd0b0 GREEN
FunctionDefinitionPropertySection.java 7981613340f73a7bbc8be3fc5fa04a31de4c4694 GREEN
StructureMemberPropertySection.java 15a722dc3c3ae91a13486317ab21bdc6f256d111 GREEN
StructurePropertySection.java 5f3fbc222ca13b2c460dd5cd139c868115008553 GREEN
......@@ -270,5 +270,11 @@ public final class FunctionDefinitionPropertySection extends PropertySectionBase
new StatementSequenceToStringConverter(true),
new StringToStatementSequenceConverter(function),
new StringToStatementSequenceValidator(function), null);
if(nameText.getText().equals("samplingTime")) {
String samplingComment =
"Sampling time represents the time corresponding to an AF3 tick, it is used for different AF3 features like FMU generation.";
commentText.setText(samplingComment);
}
}
}
RenameContextMenu.java a9e68b03eca95cc8820d483d00682b20012e57c5 GREEN
RenameFunctionContextMenu.java c04c53c23743f3f77050dcadf203255e49450185 GREEN
RenameTypeContextMenu.java 8d4cdc3a835e78ebd575aacf14b1c429222444ad GREEN
......
CreateDataDictionaryStep.java f58d42cf357fcaf7d43ee935795386e6830f7736 GREEN
CreateEnumerationStep.java a1777b42bec96a28b91609cb4d3123db3938b9df GREEN
CreateStructureStep.java 029a57123900337dd8be7b76f51be82c4c78cba8 GREEN
......
ExpressionCompletionProposalUtils.java 00e035da86c93395544b7e9e5532ec59bfbdbcda GREEN
ExpressionFieldAssistUtils.java 001ad98ca629d2e5748c95c4e3aa899e4ed98e3b GREEN
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment