Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Apex Programming

You're reading from   Learning Apex Programming Create business applications using Apex to extend and improve the usefulness of the Salesforce1 Platform

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781782173977
Length 302 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (11) Chapters Close

Preface 1. Apex Assumptions and Comparisons FREE CHAPTER 2. Apex Limits 3. More and Later 4. Triggers and Classes 5. Visualforce Development with Apex 6. Exposing Force.com to the World 7. Use Case – Integration with Google Calendar 8. Creating a Property Management Application 9. Test Coverage Index

Getting comfortable with Eclipse

You finally have the Force.com IDE installed, but there's a few more steps you need to take. It probably doesn't look like Eclipse has changed much, so let's fix that by performing the following steps:

  1. Click on the Window menu and navigate to Open Perspective | Other. A list of available perspectives will appear.
  2. Select the Force.com option and then click on OK.

    The layout of Eclipse should change slightly and also now display Force.com Start Page; you're finally home!

    Getting comfortable with Eclipse

    The Force.com perspective in Eclipse

Eclipse is highly customizable and has a long list of settings available from the Preferences menu available in the Window menu (the Eclipse menu on Mac). Before we get underway writing code, here are a few tweaks that we recommend you follow, which will help you have a better coding experience:

  • Show line numbers: This is an absolute must! Navigate to General | Editors | Text Editors and check the Show line numbers box.
  • Set default perspective: Ensure that Eclipse always starts out in the Force.com perspective. For this, navigate to General | Perspectives, select Force.com, and click on the Make Default button.
  • Colors and fonts: You might want to make things easier on the eyes. To do so, navigate to General | Appearance | Colors and Fonts.
  • Web browser: Everyone has a personal preference, but you might want to specify an alternate browser when opening web pages from Eclipse. To set this, navigate to General | Web Browser and select your browser.

In addition to these preferences, we also recommend moving the Outline view under Package Explorer. You can do so just by dragging it to the bottom half of Package Explorer. This will increase the size of the editor and make it easier to see more of your code.

If you're like us, you wouldn't like to type things over and over again. Eclipse comes with a Snippets feature that lets you save frequently used code blocks and then use them just by double-clicking on them. You can even use Merge Fields to represent variables that you specify upon use. To get started with your first Snippet, perform the following steps:

  1. Navigate to Window | Show View | Other….
  2. Type in Snippets in the filter box.
  3. Select the Snippets option and click on OK. The Snippets panel appears in the bottom portion of Workbench.
  4. Right-click on the Snippets panel and select Customize…. The Customize Palette window appears.
  5. Click on the New button and select New Category.
  6. Change the name of your new category to Apex and click on Apply.
  7. Right-click on the Apex category in the list and navigate to New | New Item.
  8. Click on the new Unnamed Template item.
  9. Change the name of your new item to System Debug.
  10. Change Description to Outputs to Debug Log.
  11. Click on the New button to create a new variable.
  12. Click on the new variable name and change it to Variable.
  13. Set Description to Variable Name or String.
  14. Type String in Default Value.
  15. Type the following line of code in the template:
    system.debug(${Variable});
  16. Click on Apply and then OK.

You just created your first Snippet. You can't use it just yet but go ahead and put a sticky on this page so that you can come back later and create more Snippets with useful code. In later chapters, when we are writing code, we'll use this Snippet.

Getting comfortable with Eclipse

Creating your first Snippet in Eclipse

You have been reading a chapter from
Learning Apex Programming
Published in: Jan 2015
Publisher:
ISBN-13: 9781782173977
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime