Skip to content

Commit

Permalink
Merge Develop into Freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
oberlehner authored Jan 20, 2025
2 parents e9cc3d5 + 5637d81 commit 31b502a
Show file tree
Hide file tree
Showing 40 changed files with 1,801 additions and 1,182 deletions.
26 changes: 26 additions & 0 deletions data/typelibrary/events-1.0.0/typelib/E_TRIG.fbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<FBType Name="E_TRIG" Comment="Trigger unconnected input events of the specified type inside a resource" >
<Identification Standard="61499-2">
</Identification>
<VersionInfo Version="1.0" Author="Mario Kastner" Date="2025-01-08">
</VersionInfo>
<CompilerInfo>
</CompilerInfo>
<InterfaceList>
<EventInputs>
<Event Name="REQ" Type="Event" Comment="Request trigger of unconnected event pins of type EVENTTYPE" >
<With Var="EVENTTYPE"/>
</Event>
</EventInputs>
<EventOutputs>
<Event Name="CNF" Type="Event" Comment="Confirmation of Requested Service" >
</Event>
</EventOutputs>
<InputVars>
<VarDeclaration Name="EVENTTYPE" Type="STRING" Comment="Event type to be triggered" InitialValue="'EInit'"/>
</InputVars>
</InterfaceList>
<Service RightInterface="RESOURCE" LeftInterface="APPLICATION">
</Service>
<Attribute Name="Documentation" Type="CDATA"><![CDATA[]]></Attribute>
</FBType>
19 changes: 19 additions & 0 deletions plugins/org.eclipse.fordiac.ide.debug.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,23 @@
</adapter>
</factory>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.eclipse.fordiac.ide.debug.ui.handler.ToggleBoolVariableHandler"
commandId="org.eclipse.fordiac.ide.application.commands.toggleBoolValue">
<activeWhen>
<with
variable="selection">
<iterate
ifEmpty="false"
operator="and">
<instanceof
value="org.eclipse.fordiac.ide.debug.EvaluatorDebugVariable">
</instanceof>
</iterate>
</with>
</activeWhen>
</handler>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2024 Martin Erich Jobst
* Copyright (c) 2024, 2025 Martin Erich Jobst
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -10,7 +10,7 @@
* Contributors:
* Martin Jobst - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.fordiac.ide.deployment.debug.ui.handler;
package org.eclipse.fordiac.ide.debug.ui.handler;

import java.util.stream.Stream;

Expand All @@ -19,27 +19,28 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.eclipse.fordiac.ide.deployment.debug.watch.IVarDeclarationWatch;
import org.eclipse.fordiac.ide.debug.EvaluatorDebugVariable;
import org.eclipse.fordiac.ide.model.data.BoolType;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.ISources;
import org.eclipse.ui.handlers.HandlerUtil;

public class ToggleBoolWatchHandler extends AbstractHandler {
public class ToggleBoolVariableHandler extends AbstractHandler {

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
getWatches(HandlerUtil.getCurrentStructuredSelection(event))
.forEachOrdered(ToggleBoolWatchHandler::toggleValue);
getVariables(HandlerUtil.getCurrentStructuredSelection(event))
.forEachOrdered(ToggleBoolVariableHandler::toggleValue);
return null;
}

private static void toggleValue(final IVarDeclarationWatch watch) {
if (watch.getInternalVariable().getType() instanceof BoolType) {
final String newValue = Boolean.parseBoolean(watch.getInternalValue().toString()) ? "FALSE" : "TRUE"; //$NON-NLS-1$ //$NON-NLS-2$
private static void toggleValue(final EvaluatorDebugVariable variable) {
if (variable.getInternalVariable().getType() instanceof BoolType) {
final String newValue = Boolean.parseBoolean(variable.getInternalVariable().getValue().toString()) ? "FALSE" //$NON-NLS-1$
: "TRUE"; //$NON-NLS-1$
try {
watch.setValue(newValue);
variable.setValue(newValue);
} catch (final DebugException e) {
ErrorDialog.openError(null, null, null, Status.error(e.getLocalizedMessage(), e));
}
Expand All @@ -50,14 +51,15 @@ private static void toggleValue(final IVarDeclarationWatch watch) {
public void setEnabled(final Object evaluationContext) {
setBaseEnabled(HandlerUtil.getVariable(evaluationContext,
ISources.ACTIVE_CURRENT_SELECTION_NAME) instanceof final IStructuredSelection selection
&& getWatches(selection).allMatch(ToggleBoolWatchHandler::isValidValue));
&& getVariables(selection).allMatch(ToggleBoolVariableHandler::isValidValue));
}

private static boolean isValidValue(final IVarDeclarationWatch watch) {
return watch.getInternalVariable().getType() instanceof BoolType;
private static boolean isValidValue(final EvaluatorDebugVariable variable) {
return variable.supportsValueModification() && variable.getInternalVariable().getType() instanceof BoolType;
}

private static Stream<IVarDeclarationWatch> getWatches(final IStructuredSelection selection) {
return selection.stream().filter(IVarDeclarationWatch.class::isInstance).map(IVarDeclarationWatch.class::cast);
private static Stream<EvaluatorDebugVariable> getVariables(final IStructuredSelection selection) {
return selection.stream().filter(EvaluatorDebugVariable.class::isInstance)
.map(EvaluatorDebugVariable.class::cast);
}
}
16 changes: 0 additions & 16 deletions plugins/org.eclipse.fordiac.ide.deployment.debug.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -512,22 +512,6 @@
</with>
</activeWhen>
</handler>
<handler
class="org.eclipse.fordiac.ide.deployment.debug.ui.handler.ToggleBoolWatchHandler"
commandId="org.eclipse.fordiac.ide.application.commands.toggleBoolValue">
<activeWhen>
<with
variable="selection">
<iterate
ifEmpty="false"
operator="and">
<instanceof
value="org.eclipse.fordiac.ide.deployment.debug.watch.IVarDeclarationWatch">
</instanceof>
</iterate>
</with>
</activeWhen>
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright (c) 2022, 2024 Primetals Technologies Austria GmbH
* Martin Erich Jobst
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Hesam Rezaee
* - initial API and implementation and/or initial documentation
* Martin Jobst
* - add global formatting from STFunctionFormatter
* - add formatting for package declaration and imports
*/
package org.eclipse.fordiac.ide.globalconstantseditor.formatting2;

import org.eclipse.fordiac.ide.globalconstantseditor.globalConstants.STGlobalConstsSource;
import org.eclipse.fordiac.ide.globalconstantseditor.globalConstants.STVarGlobalDeclarationBlock;
import org.eclipse.fordiac.ide.structuredtextcore.formatting2.STCoreFormatter;
import org.eclipse.xtext.formatting2.IFormattableDocument;

@SuppressWarnings("java:S100")
public class GlobalConstantsFormatter extends STCoreFormatter {
protected void _format(final STGlobalConstsSource source, final IFormattableDocument document) {
formatSource(source, document);
if (source.getName() != null) {
formatPackage(source, document);
}
formatImports(source.getImports(), document);
formatVarDeclarationBlocks(source.getElements(), document);
}

protected void _format(final STVarGlobalDeclarationBlock varDeclarationBlock, final IFormattableDocument document) {
formatVarDeclarationBlock(varDeclarationBlock, document, "VAR_GLOBAL"); //$NON-NLS-1$
}

@Override
public void format(final Object object, final IFormattableDocument document) {
switch (object) {
case final STGlobalConstsSource element -> _format(element, document);
case final STVarGlobalDeclarationBlock element -> _format(element, document);
case null, default -> super.format(object, document);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -734,3 +734,4 @@ _UI_SimpleECState_simpleFBType_feature = Simple FB Type
_UI_SimpleFBType_simpleECStates_feature = Simple EC States
_UI_TextFunction_varargs_feature = Varargs
_UI_TextMethod_varargs_feature = Varargs
_UI_Service_comment_feature = Comment
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.fordiac.ide.model.data.provider.FordiacEditPlugin;
Expand Down Expand Up @@ -76,6 +77,28 @@ protected void addServiceSequencePropertyDescriptor(Object object) {
LibraryElementPackage.Literals.SERVICE__SERVICE_SEQUENCE, true, false, true, null, null, null));
}

/**
* This adds a property descriptor for the Comment feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addCommentPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Service_comment_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Service_comment_feature", "_UI_Service_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
LibraryElementPackage.Literals.SERVICE__COMMENT,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}

/** This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.fordiac.ide.model.data.InternalDataType;
import org.eclipse.fordiac.ide.model.data.provider.FordiacEditPlugin;
import org.eclipse.fordiac.ide.model.datatype.helper.InternalAttributeDeclarations;
import org.eclipse.fordiac.ide.model.libraryElement.Attribute;
import org.eclipse.fordiac.ide.model.libraryElement.LibraryElementPackage;
import org.eclipse.fordiac.ide.model.libraryElement.TypedConfigureableObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference lib.ecore#//Service/rightInterface"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference lib.ecore#//Service/leftInterface"/>
<genFeatures children="true" createChild="true" propertySortChoices="true" ecoreFeature="ecore:EReference lib.ecore#//Service/serviceSequence"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute lib.ecore#//Service/comment"/>
<genOperations ecoreOperation="lib.ecore#//Service/getFBType" body="return (FBType) this.eContainer();"/>
</genClasses>
<genClasses ecoreClass="lib.ecore#//ServiceSequence">
Expand Down
2 changes: 2 additions & 0 deletions plugins/org.eclipse.fordiac.ide.model/model/lib.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,8 @@
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="comment" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"
defaultValueLiteral=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ServiceSequence" eSuperTypes="#//INamedElement #//ConfigurableObject">
<eOperations name="getService" lowerBound="1" eType="#//Service">
Expand Down
Loading

0 comments on commit 31b502a

Please sign in to comment.