Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext dynamic content assist without typing ctrl+space
icon7.gif  Xtext dynamic content assist without typing ctrl+space [message #1729723] Mon, 18 April 2016 13:17 Go to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Hi,

Can anybody suggest that how can I show proposals when I enter @ from keyboard automatically?

Re: Xtext dynamic content assist without typing ctrl+space [message #1729731 is a reply to message #1729723] Mon, 18 April 2016 14:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

do you mean something like

https://christiandietrich.wordpress.com/2011/09/19/xtext-content-assist-auto-activation/


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext dynamic content assist without typing ctrl+space [message #1729745 is a reply to message #1729731] Mon, 18 April 2016 16:04 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Hi Christian,

I saw your code. But my requirement is to show content proposal for some objects like
@app()->
@screen()-> etc..

My requirement is when I enter @app()-> or @screen()-> immediately I want to see the proposals for those objects. I written code for @app()-> like:

override configure(Binder binder) {
super.configure(binder); binder.bind(String).annotatedWith(Names.named((XtextContentAssistProcessor.COMPLETION_AUTO_ACTIVATION_CHARS))).toInstance("@app()->");
}

But how can I bind my custom proposals for it?

But I tried :

class JPLEditorProposalProvider extends AbstractJPLEditorProposalProvider {
val Set<String> FILTERED_KEYWORDS = Sets.newHashSet("text", "line", "class", "behavior", "style", "custom");
override completeAnnotation_JplId(EObject model,Assignment assignment,ContentAssistContext context,ICompletionProposalAcceptor acceptor) {
for(String str : FILTERED_KEYWORDS){
acceptor.accept(createCompletionProposal(str, str,null /*getBlackImage()*/, context));
}
//super.completeAnnotation_JplId(model, assignment, context, acceptor)
}
}

It's working fine if I type ctrl+space. But I want the set proposals right after I type @app()->

My grammar:
Annotation: '@app()->'jplId=ID;
Re: Xtext dynamic content assist without typing ctrl+space [message #1729746 is a reply to message #1729745] Mon, 18 April 2016 16:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Sry have no idea on that

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext dynamic content assist without typing ctrl+space [message #1729747 is a reply to message #1729745] Mon, 18 April 2016 16:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Ps why not auto activating on >

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext dynamic content assist without typing ctrl+space [message #1729751 is a reply to message #1729747] Mon, 18 April 2016 16:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
ps i just gave it a try with ">" and content assist is invoked after typing the >

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext dynamic content assist without typing ctrl+space [message #1729760 is a reply to message #1729751] Mon, 18 April 2016 17:18 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Yes it is working. Could you please tell me how I can use my proposals from another file?

Something like proposals.txt:

sysout : System.out.println();

Like this I have 100's of keys.
Re: Xtext dynamic content assist without typing ctrl+space [message #1729764 is a reply to message #1729760] Mon, 18 April 2016 17:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you are asking about reading stuff from file ?

there is no default hook for that but you may use

MydslActivator.getInstance().getBundle()s methods to load the file
(this is an eclipse hook not a xtext one)
http://blog.vogella.com/2010/07/06/reading-resources-from-plugin/

+ some caching/singleton


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Xtext # comment [message #1729930 is a reply to message #1729751] Wed, 20 April 2016 10:27 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Hi,

I have hash comment for my editor something like below and my terminal rule is terminal HASH_COMMENT: '#' !('\n' | '\r')*;

But it is not showing green color. I want to highlight in green color. If I use it with SL_COMMENT it is showing in green but I want to work with seperate terminal rule.

And I have contatination operator '##' for my editor test1 ## test2

#############################################################################
# Name: bch1132.jpl
# Purpose: This program is used to perform CADE batch input of ATTC records
# Date: 9/10/96
# Author: Chris Krum, Sesh
# Mdfd : Sesh
#############################################################################
# Name: b1132
# Purpose: this is the main routine for processing the CADE ATTC input data.
# this routine expects to find the data in a file named in the
# environment variable "BPS1132DATFILE"
# I am using a relatively odd "for loop" construct that needs some
# explanation. there are a few for loops that are designed to
# execute only once with no repetitions. I am using these to block
# together ascii file reads for the fields that occur on a given line
# of data. the reason I am doing this has to do with the structure of
# the CADE file. if a line in the CADE file represents 10 data fields
# and the last four are blank, the line is truncated at field 6 to
# save room. I am accomodating this by using the break command to
# skip over the unnecessary read statements to the end of the for
# loop and picking up with the read associated with the first field
# of the next line. I am also using one to jump to the end of the
# database transaction if there is an error.
# the following is the psuedo-code for the logic:
#------------------------------------------------------------------------------
# create temp table
# open CADE file
# read in first header record
# while not end of file
# reset detail variables
# check to see if there is a detail record for current header
# N reject complaint
# Y while there are still detail records
# perform edit checks on detail reject fields
# read in next detail record
# end while loop
# perform edit checks on header reject fields and
# create temp table entries for any rejects
# check to see if the complaint was rejected
# N perform field edit checks on header record and
# create temp table entries for each warning
# perform field edit checks on detail records and
# create temp table entries for each warning
# begin transaction
# check to see if issuing agency is "PPD"
# Y check to see if there is a matching ticket for this complaint
# Y update ticket status to "issued"
# N create a new ticket entry for this complaint
# call BPS1111A Identify Person On complaint
# call BPS1118 Locate Skeleton Complaint (PhaseII)
# call BPS1115 Create/Amend Case to determine case number
# create charge records
# determine primary charge for this complaint
# call BPS1115 Create/Amend Case to determine case type
# call BPS1116 Verify Arraignment Date
# perform database inserts for address records (see seperate logic)
# perform database inserts for phone records
# do arraignment date processing (see seperate logic)
# perform database inserts for complaint record
# perform database inserts for miscelaneous records
# end transaction
# reset header variables
# read in next header record
# end while loop
# call report writer
# drop temp table
#------------------------------------------------------------------------------
# Date: 9/10/96
# Author: Chris Krum
#------------------------------------------------------------------------------
# Description of variables:
#
# most of the variables in this process consist of their corresponding
# database fields with "b1132_" prepended.
# single_count: loop counter for loops that execute only once (see explanation
# above)
# count: generic loop counter
# array1, array2: used to pass variables to SPS0004
# b1132_in_off_id_1: flag to indicate an invalid officer id
# b1132_atleast_one: flag to indicate that there is a detail record
# to match the header record for the current
# complaint. (a header with no detail is invalid)
# b1132_i_file_handle - this is the CADE input file
# b1132_o_file_handle - this is an ascii file used to test to make sure
# that the input file is being read properly. if
# the file structure ever changes, uncomment the
# areas dealing with ascii output and you can check
# where the changes are.
# b1132_er_f_handle - same as above but for error messages.
# b1132_r_addr_ser_nbr - serial numbers of addresses to be stored in compl_info
# b1132_addr_ser_nbr record
# b1132_hearing_type - value returned by BPS1116 Verify Arraignment Date
# b1132_batch_id - holds the batch id to be added on the error report
# b1132_current_tag - each line of the CADE input file has the complaint number
# and issuing agency code tagged on the front
# b1132_blank_field - used to read in the two blank fields that occur in the
# CADE data file.
# b1132_io_result - used to test for EOF and EOL after each read
# b1132_hold_case_type - holds the case type returned by BPS1115
# b1132_compl_rej - used to indicate that the complaint was rejected
# b1132_hold_aka_nbr - holds the aka number returned by BPS1111A
# b1132_rj_no_detail - indicates whether the complaint should be rejected
# because there is a header but no detail
# b1132_per_nbr - number returned by BPS1111A Identify Person
# b1132_defendant - holds the person's last, first and middle names for reports
# b1132_case_nbr - value derived in BPS1115 Create/Ammend Case
# b1132_hold_addr_stat - indicates whether the address on complaint is Good
# or Bad
# b1132_hold_off_id - used to see if there is a ticket for this complaint
# b1132_rec_count - used to see how many records matched in a select
# b1132_today, b1132_now - these hold today's date and time
# b1132_arr_dt_ch_fg - returned by BPS1116 and tested in arraignment
# date processing
# century, year, month, day - used to hold the parts of the date from the input
# file
# hour, minute - used to hold the parts of the time from the input file
# b1132_h_chrg_nbr - used to generate the charge number to be inserted in
# the charge record
# b1132_r_phone_id - these two are used to find the last used phone id
# b1132_b_phone_id - number and calculate the next for the new phone
# b1132_law_off_cls - an array to hold the offense class of each charge
# to be inserted into the charge table
# b1132_by_date_ind - returned from BPS1116
# b1132_rt_elig_ind - an array to hold the victim's rights indicator
# to be inserted into each charge record
# b1132_law_cd_cat - holds the actual law category for each charge as opposed
# to the "as entered" value
# b1132_r_addr_nbr - these two are used to find the next address number
# b1132_b_addr_nbr - for the address on the current complaint
# b1132_reject_count - used on the totals report
###############################################################################
Re: Xtext # comment [message #1729931 is a reply to message #1729930] Wed, 20 April 2016 10:29 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
have a look at DefaultAntlrTokenToAttributeIdMapper

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:definition terminal STRING
Next Topic:Syntax Highlighting for One Particular keyword
Goto Forum:
  


Current Time: Thu Apr 18 15:02:41 GMT 2024

Powered by FUDForum. Page generated in 0.02267 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top