diff options
author | 2021-08-03 18:42:39 +0900 | |
---|---|---|
committer | 2021-08-06 19:32:38 +0900 | |
commit | be4f78978faba3d3ceb88df02a7f93a2e09ff1e0 (patch) | |
tree | 1f3f1a96251ac4f655c8a96fc33d5d4ee779cd06 /rba.tool.editor.ui/src/rba/tool/editor/ui/contentassist/RBAModelLastSegmentFinder.xtend | |
parent | 71ca7c6cab863767ef30c8bd05b2bbfda8731cb5 (diff) |
Initial commit
Bug-AGL: SPEC-4033
Signed-off-by: Kenji Hosokawa <khosokawa@jp.adit-jv.com>
Diffstat (limited to 'rba.tool.editor.ui/src/rba/tool/editor/ui/contentassist/RBAModelLastSegmentFinder.xtend')
-rw-r--r-- | rba.tool.editor.ui/src/rba/tool/editor/ui/contentassist/RBAModelLastSegmentFinder.xtend | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/rba.tool.editor.ui/src/rba/tool/editor/ui/contentassist/RBAModelLastSegmentFinder.xtend b/rba.tool.editor.ui/src/rba/tool/editor/ui/contentassist/RBAModelLastSegmentFinder.xtend new file mode 100644 index 0000000..e844018 --- /dev/null +++ b/rba.tool.editor.ui/src/rba/tool/editor/ui/contentassist/RBAModelLastSegmentFinder.xtend @@ -0,0 +1,31 @@ +package rba.tool.editor.ui.contentassist + +import org.eclipse.xtext.ui.editor.contentassist.FQNPrefixMatcher.LastSegmentFinder + +class RBAModelLastSegmentFinder implements LastSegmentFinder { + + override String getLastSegment(String fqn, char delimiter) { + if(fqn === null || fqn.length() == 0) { + return null; + } + + var lookForUppercase = false; + var lastDelimiterIndex = -1; + for (var int i = 0; i < fqn.length(); i.operator_plusPlus()) { + if(lookForUppercase) { + if(Character.isUpperCase(fqn.charAt(i))) { + return fqn.substring(i); + } + } + lookForUppercase = delimiter == fqn.charAt(i); + if(lookForUppercase) { + lastDelimiterIndex = i; + } + } + if(lastDelimiterIndex >= 0 && lastDelimiterIndex < fqn.length() - 1) { + return fqn.substring(lastDelimiterIndex + 1); + } + return null; + } + +} |