-
Notifications
You must be signed in to change notification settings - Fork 7
Ssks: modify Objectzustand_Besonders footnote #2264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TruongQuangSB
wants to merge
1
commit into
main
Choose a base branch
from
object-special-state-footnote-prefix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+49
−25
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| import java.util.Set; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import org.eclipse.emf.ecore.util.ExtendedMetaData; | ||
| import org.eclipse.set.core.services.Services; | ||
| import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; | ||
| import org.eclipse.set.model.planpro.BasisTypen.BasisTypenFactory; | ||
|
|
@@ -41,6 +42,7 @@ | |
| import org.eclipse.set.model.tablemodel.TablemodelFactory; | ||
| import org.eclipse.set.ppmodel.extensions.SignalRahmenExtensions; | ||
| import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
| import org.eclipse.xtext.xbase.lib.Pair; | ||
|
|
||
| import com.google.common.collect.Streams; | ||
|
|
||
|
|
@@ -256,7 +258,8 @@ public static String getPrefix(final Signal_Rahmen signalRahmen) { | |
| final List<String> signalBegriffe = Streams | ||
| .stream(SignalRahmenExtensions | ||
| .getSignalbegriffe(signalRahmen)) | ||
| .map(signalBegriff -> getPrefix(signalBegriff, false)) | ||
| .map(signalBegriff -> getPrefix(signalBegriff, false) | ||
| .getKey()) | ||
| .filter(Objects::nonNull) | ||
| .collect(Collectors.toSet()) | ||
| .stream() | ||
|
|
@@ -275,28 +278,40 @@ public static String getPrefix(final Signal_Rahmen signalRahmen) { | |
| * | ||
| * @param signalBegriff | ||
| * the signal begriff for which the prefix shall be generated | ||
| * @return the prefix or null if not possible to create prefix | ||
| * @return the signalbegriff name and the symbol | ||
| */ | ||
| public static String getPrefix(final Signal_Signalbegriff signalBegriff) { | ||
| public static Pair<String, String> getPrefix( | ||
| final Signal_Signalbegriff signalBegriff) { | ||
| return getPrefix(signalBegriff, true); | ||
| } | ||
|
|
||
| private static String getPrefix(final Signal_Signalbegriff signalBegriff, | ||
| private static Pair<String, String> getPrefix( | ||
| final Signal_Signalbegriff signalBegriff, | ||
| final boolean withSymbol) { | ||
| if (signalBegriff == null | ||
| || signalBegriff.getSignalbegriffID() == null) { | ||
| return null; | ||
| } | ||
| final Signalbegriff_ID_TypeClass signalBegriffId = signalBegriff | ||
| .getSignalbegriffID(); | ||
| // TODO: Properly determine name of Signalbegriff_ID | ||
| final String prefix = signalBegriffId.getClass() | ||
| .getSimpleName() | ||
| .replace("Impl", ""); //$NON-NLS-1$ //$NON-NLS-2$ | ||
| final String prefix = getSignalBregiffIDName(signalBegriffId) | ||
| .replace("_", " ");//$NON-NLS-1$ //$NON-NLS-2$ | ||
| if (withSymbol && signalBegriffId.getSymbol() != null) { | ||
| return prefix + " " + signalBegriffId.getSymbol(); //$NON-NLS-1$ | ||
| return new Pair<>(prefix, signalBegriffId.getSymbol()); | ||
| } | ||
| return new Pair<>(prefix, null); | ||
| } | ||
|
|
||
| private static String getSignalBregiffIDName( | ||
| final Signalbegriff_ID_TypeClass signalBegriffId) { | ||
| try { | ||
| return signalBegriffId.eClass() | ||
| .getEAnnotation(ExtendedMetaData.ANNOTATION_URI) | ||
| .getDetails() | ||
| .get("name"); //$NON-NLS-1$ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the name of SignalBegriff_ID is in Annotation |
||
| } catch (final Exception e) { | ||
| return signalBegriffId.eClass().getName(); | ||
| } | ||
| return prefix; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -311,12 +326,12 @@ private static String getPrefix(final Signal_Signalbegriff signalBegriff, | |
| * if no prefix should be added | ||
| * @return the extended footnotes | ||
| */ | ||
| public static List<Footnote> withPrefix(final List<Footnote> footnotes, | ||
| final String prefix) { | ||
| public static Iterable<Footnote> withPrefix( | ||
| final Iterable<Footnote> footnotes, final String prefix) { | ||
| if (prefix == null) { | ||
| return footnotes; | ||
| } | ||
| return footnotes.stream().map(footnote -> { | ||
| return Streams.stream(footnotes).map(footnote -> { | ||
| final Bearbeitungsvermerk bearbeitungsvermerk = createBearbeitungsvermerkWithoutGuid( | ||
| prefix + ": " //$NON-NLS-1$ | ||
| + footnote.getBearbeitungsvermerk() | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -472,7 +472,7 @@ class TableExtensions { | |
| // sort new and common together by text, then append old entries | ||
| val footnotes = (common + newF).sortBy[toText] + old.sortBy[toText] | ||
|
|
||
| return footnotes.distinctBy[toText -> bearbeitungsvermerk?.identitaet?.wert].indexed.map [ | ||
| return footnotes.distinctBy[toText].indexed.map [ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. filter the footnote with same content |
||
| value.index = key + 1 | ||
| return value | ||
| ] | ||
|
|
@@ -484,7 +484,9 @@ class TableExtensions { | |
|
|
||
| static def FootnoteInfo getFootnoteInfo(Table table, | ||
| Bearbeitungsvermerk bv) { | ||
| return table.allFootnotes.findFirst[bearbeitungsvermerk == bv] | ||
| return table.allFootnotes.findFirst[bearbeitungsvermerk?.identitaet?.wert == bv?.identitaet?.wert || | ||
| bv?.bearbeitungsvermerkAllg?.kommentar?.wert == toText | ||
| ] | ||
| } | ||
|
|
||
| static def FootnoteInfo getFootnoteInfo(EObject tableContent, Footnote fn) { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort footnote by index number