facebook

Can’t get java template to work in myeclipse or eclipse Mac

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #325020 Reply

    I can’t get java templates to work. For example if an “if” statement is wanted I looked in Preferences–>Java–>Editor–>Templates–if and the check box is checked next to “if” and the Preview says

    if (${condition:var(boolean)}) {
        ${line_selection}${cursor}
    }
    

    I then edit a class and try to use the template.
    I have tried typing ‘if’ then pressing command+space and nothing happens.
    I have tried selecting the ‘if’ then pressing command+space and nothing happens.
    If I type ‘if’ then select it and press control+space the choice of ‘runnable’ is available and when chosen inserts the code

    new Runnable() {
        public void run() {
            if
        }
    

    Any suggestions?

    #325054 Reply

    support-tony
    Keymaster

    Zscipio,

    This functionality is base eclipse functionality, so you may get better support by posting in an eclipse user forum. However, I couldn’t replicate the problem with either eclipse or MyEclipse on Mac OS X Lion.

    Note that the content assist key combination is Ctrl-Space, which is not one of the combinations you mentioned. Command-Space opens the Mac Spotlight search box. If you select some text and then hit Ctrl-Space, the content assist operates in a different mode, though it’s hard to understand why it would offer Runnable, in your case. If you select a full if statement (or any other statement or block of statements) then a Runnable choice seems reasonable.

    Note that Ctrl-Space actually cycles through various sets of proposals. Note the message at the bottom of the pop-up which shows which set of proposals will come up next if you hit Ctrl-Space again.

    The key combinations can be changed in the preferences, so you might want to check that.

    #325159 Reply

    You reply gave me enough hints so that the Content Assist now works. But I don’t understand why the process works. I went into the templates and changed the “Context” value of the “if” template from “Java statements” to “Java”. What do the values in the “Context” column mean? The values in this column are:
    1. Java
    2. Java statements
    3. SWT statements
    4. Javadoc
    5. Java type members
    I have done a Google search on the meanings of the entries in the “Context” column but to no avail.

    Thank you for your help.

    #325180 Reply

    support-swapna
    Moderator
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Can’t get java template to work in myeclipse or eclipse Mac

You must be logged in to post in the forum log in