+ Start a Discussion

Creating scontrols with Eclipse 3.1

Maybe I'm missing something obvious here, but it sure is frustrating.  I'm using OSX 10.4.7 and Eclipse 3.1.  I have java 1.4.2 and 1.5 loaded (which might be a problem, but I wouldn't think so).  I can successfully create an AppExchange project and successfully download all current scontrols.  I can update them and save changes and they work.

Problem comes in when I try to create a NEW scontrol using Eclipse.  I create a new file and immediately get "An unexpected error was thrown while trying to open the S-Control." along with a java.lang.NullPointerException.  This is a new scontrol, doesn't exist in salesforce yet.  Is there another way I'm supposed to create them?

Then it actually does create the file locally to the workspace.  Great, I'll build it anyway.  I added a simple html tag and one word, test, updated the properties with the scontrol name and try to save.  "Field integrity exception occurred, check your merge field definitions." and another NullPointerException.  I didn't use any merge fields!

Fine.  I'll just create what I need in a text editor and create the scontrol the old fashioned way by pasting it into the salesforce UI.  Then I can refresh the AppExchange project and at least maintain it with Eclipse, right?  Well the context menu "Refresh" does absolutely nothing.  I have to create a new project and start all over, and then I have the new scontrol available in Eclipse.

So what's going on?  BTW I've tried 3.2 with the latest beta version of the plugin, but that just flat doesn't even allow a connection to the soap endpoint.

I want to use this.  It's very cool.  Help!

hi lithe951 -

some plugins (like myEclipse) conflict with the AppExchange Toolkit and can cause these types of problems.  you may want to try installing the AppExchange Toolkit vs. a clean install of Eclipse if you haven't already done so.
Well I just tried a brand-new download of Eclipse.  The only things I did were download the 3.1.2 patch that allows it to run on an Intel Mac, and set up AppExchange per the toolkit.  Same problem when trying to create an scontrol.  Am I doing this correctly, or is this user error?

  1. Right-click on the "Scontrols" folder within my project and select New=>File
  2. Name the file "TestControl.htm.scf" and click Finish
  3. Immediate error as noted above
What's the deal?

BTW the patch I mentioned is found here:


Without it, Eclipse won't run on an Intel Mac running Tiger (OS X 10.4.7).  It might cause the problem, but if so, why does Eclipse work fine updating existing scontrols?

Hmm - i'm running Eclipse with a similar config on my intel Mac..
This is lame, but it always works:

1. Go to Salesforce - Setup - Create S-control
2. Create the S-Control with a Title, a minimal description, and anything you want in the Body.  ("Peanuts" works fine.)
3. Save it, then go to Eclipse
4. Under your Project for this account, Right click SControls -> AppExchange -> Synch Folder

And your new S-Control will come up with the "Peanuts" Body.

Afterwards it works fine.  I don't know why it doesn't always seem to work from Eclipse, but this works fine and sometimes it's best to move on to the problem at hand.  :-)

Best, Steve.

Well that worked.  Although my heart jumped into my throat for a second when it started deleting everything!  Panic...did I have a backup...yes...whew.  Then it all came back nicely. :)

The workaround works, but I still should be able to create an scontrol from Eclipse, no?  At least this gets me functional, thanks Steve.

BTW when I chose the Sync Folder, it started deleting all the local files and then downloaded everything from salesforce.  This doesn't look like a "sync" to me.  Is it really the case that choosing Sync actually just copies whatever is in salesforce, one-direction only, and salesforce is the master for scontrols?

Just want to be sure I understand the function so I use it properly.  If this is the case, it shouldn't be called "sync" should it?  :)

Ok, must be user error.  I just tried right-click on the Scontrols folder and chose AppExchange => New Scontrol and it worked.  I could swear this option was not there in my previous install, so maybe the reload worked.  Oh well, it works great now!

Chirag MehtaChirag Mehta

Good ..

So Following are threee things  can be done from Eclipse

1. Creation of New Scontrol

Right-click on the Scontrols folder and chose AppExchange => New Scontrol and it worked

2. Synchronising the Scontrols from SFDC to Eclipse

Under your Project for this account, Right click SControls -> AppExchange -> Synch Folder

3.Preview the Scontrol in Eclipse itself

Select the preview tab under the Scontrol Code

There are 3 tabs under Scontrol Code Code /  Properties / Preview

Message Edited by Chirag Mehta on 10-31-2006 09:21 PM

Chirag, I've been having similar problems to lithe951 with Eclipse, and 2 of the 3 points that you list do not work for me.  So I just thought I'd list some issues here in case it helps anyone else.
First of all, I think that AppExchange Toolkit for Eclipse is a real boon.  Saves loads of time and effort editing and uploading sControls.  Well worth spending the time setting up.  So thanks to whoever it is that has developed this useful tool :smileyhappy: - this is all intended as constructive feedback.
I downloaded and installed Eclipse v3.1.2 fresh yesterday and then ran the download of the AppExchange Toolkit for Eclipse as described at  http://adnsandbox.com/appexchange/updates .  I made no other changes.  So I have a pretty clean install of Eclipse. (Having said that, I did first install v3.2.1, the latest release, then uninstalled that, see below for why).
1. If I right-click on the Scontrols folder and chose AppExchange => New Scontrol, as mentoned above, it does not work for me, no new scontrol is added, eve if I refresh the screen, or restart eclipse.  And if I go to my browser to check my list of sControls under Setup=>Build=>Custom S-controls, the new sControl has not been added.  Not even if I "Synch Folder". 
2. Similarly, renaming sControls by right-clicking the filename in the leftbar and choosing Refactor=>Rename.. did not work for me.  It appears to accept the rename in the leftbar, but then eclipse still opens the renamed scontrol with its old name, even if you close then reopen the renamed file.  And in the browser, the file is not renamed under Setup=>Build=>Custom S-controls.  Closing and re-opening the project doesn't fix it, nor does "Synch Folder", nor does restarting Eclipse.
3. Re the "Synch Folder" command - as mentioned above, I think it might be better if this were re-named.  Maybe to "reload all files from sf server" ? - because it appears to delete everything on the client side before downloading.  Also, because this appears to delete all local Eclipse copies of sControls, I'd suggest an "are you sure" confirmation.

4. The docs at http://www.salesforce.com/developer/projects_toolkits.jsp point you to http://adnsandbox.com/appexchange/updates/ for Eclipse install instructions, and that page mentions that eclipse 3.1 or later is OK, but in fact the current version of the AppExchange extensions only work on v3.1 of Eclipse, not the current Eclipse v3.2.  Apparently a version of  AppExchange Toolkit is in the pipeline that you can use with Eclipse 3.2.

5. On a related subject to point 2, the current Eclipse 3.1  AppExchange Toolkit only supports v7 of the API.  Version 8 support will follow, possibly in the release for eclipse v3.2 (?)
6. This might be an obvious point, but the preview tab only seems to work for sControls that are self-contained HTML or JS.  Inline scontrols don't work in preview, because they are out of the context of the page that they were designed to be embedded within.  Also, merge fields won't work, and you might have to include login calls in your JS to make your Ajax JS code work. (All this stems from the same reason why a standalone page based on Ajax toolkit will not work without modification.)