Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 522807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:23:33+00:00 2026-05-13T08:23:33+00:00

Eclipse templates can automatically insert text and variables as you are coding. When variables

  • 0

Eclipse templates can automatically insert text and variables as you are coding. When variables are used with the ${variable} form, the value is inserted automatically.

My question is whether you can add sections to these templates conditionally. Can you have a method definition template that will fill in multiple variables and add local definitions of them, but only if they are filled in?

def method(${var1}, ${var2}, ${var3}):  
   self.${var1} = ${var1}  
   self.${var2} = ${var2}  
   self.${var3} = ${var3}  

So, the ${var2} and ${var3} local variables would only exist if their definitions existed in the method definition?

This question is specifically for Python development with PyDev but answers for other languages would be welcome too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:23:33+00:00Added an answer on May 13, 2026 at 8:23 am

    It can be done through Jython scripting in Pydev in the latest nightly build (which will be 1.5.4).

    See http://pydev.org/download.html for details on getting it.

    Shortly, you can define a variable in scripting and program it in Jython to be how you want it to be (and you can update the templates cache on the fly after creating your variable).

    There are some variables defined by default like that at: http://github.com/aptana/Pydev/blob/master/plugins/org.python.pydev.jython/jysrc/pytemplate_defaults.py

    That module has comments on how to proceed (and you can use that module as an example).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I set the format for the ${date} variable which can be used
You can create various Java code templates in Eclipse via Window > Preferences >
I've recently discovered that there are several useful templates (in Eclipse) that can be
How do I expand code templates in Eclipse when using the emacs keybindings? Is
We use .ftl files to create templates in Eclipse. Content assist for FreeMarker is
Does anyone know of a syntax highlight for Mako templates for Eclipse or for
The eclipse complain the following compilation error for play 2.0.1 The type play.api.templates.Html cannot
What are the tradeoffs of the Eclipse Snippets View vs. editor templates? Why were
Is there a way to automatically insert code into a method? I have the
Eclipse has a nifty feature which allows you to define templates for code. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.