function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
icemft1976icemft1976 

APEX and Eclipse (Force IDE) - Snippets Panel?

I was just at the Tour de Force - I saw the "Build any UI for Any App Using Visualforce" demo and I'm wondering: how did the presenter store those code snippets? He was dragging and dropping them in, it looked like the library was inside Eclipse.

I've seen the Snippet window in Elicpse, but it looked like he was accessing a prebuilt library of snippets. I'd love to be able ot store my own code blocks, but I couldn't figure out how.

If anyone knows how to add them, I'd appreciate it (meanwhileI'll go search Eclipse's site)

Thanks

[Update]
Okay - I've managed to figure out that I needed to add a "category" to the Snippet window, then I can add items. I just added a new item and put the snippet code I want handy into the "template" text area and it seems to work.

Is there any reason to use the 'variables' options when adding a new 'template'? Thanks again!


Message Edited by icemft1976 on 04-24-2008 02:16 PM
Best Answer chosen by Admin (Salesforce Developers) 
rgard23rgard23

Thanks! I got that to work. I was having issues with the software updates in Eclipse but once I got around it was able to get the snippets as you said.

All Answers

Ron HessRon Hess
I don't use the variables option, just the paste feature

icemft1976icemft1976
Thanks, Ron.

As usual - I just needed to dig around a bit :) 

If you edit your existing snippet: create a new variable and input a value (say 'Status', 'Closed') - Eclipse then displays an option button to 'Insert variable placeholder' into your code. You can then use the 'insert' button to insert the variable in the appropriate locations of your code snippet.

I imagine the variables option would be useful if you were looking to paste a template, more than just a code block, but it does give you a nice ability to update your snippets on the fly -> b/c when you drag and drop a snippet in, Eclipse lets you edit the variable values (or just paste the code as is)


rgard23rgard23
I saw the same functionality at Dreamforce and thought it would be really useful. I'm a step behind though because I've never seen the snippet panel. Is that a plugin I need to add or is it already in my Eclipse and I just can't find it?
icemft1976icemft1976

Hi,

 

it's part of an add-in package called 'Web Tools'.

 

this blog post describes how to add it to Eclipse if you don't have it. (It also shows another tool that provides more advanced capabilities to make handy tools for Eclipse & looks pretty useful - but I haven't tried it). 

 

You might have the package already in your Eclipse build though, follow the instructions but check your 'update' tab (as opposed to the 'available software' tab) to see if you already have an entry under "WST ...."

 

Note that the current version of the package appears as Web Tools -> Web Tools Platform (WTP) 3.1.x in the 'available software' tab.... but the steps are the same. 

 

After it's installed - you open the Snippets panel by going to Window->Show View->Other->General->snippet

 

Good luck!

rgard23rgard23

Thanks! I got that to work. I was having issues with the software updates in Eclipse but once I got around it was able to get the snippets as you said.

This was selected as the best answer