Monday, December 28, 2009

Eclipse - Customization using "plugin_customization.ini"


plugin_customization.ini is actually a file that can be used to set any Eclipse preference on startup.  Given that, the settings that can go in there are basically whatever preferences any plugin sets.  So, do you want to know where those settings are persisted in the client?  In the Notes data directory follow this path:
workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings
That directory contains all of the “.prefs” files for each and every plugin – ie. each one of those files is a preference store.  They are readable to the human eye in a text editor so crack one open in your favorite text editor.
Here is how it works;  we will use the preference setting :
com.ibm.notes.branding/enable.update.ui=true
The format of the entry is this:     <plugin id> / <setting> = <value>

So if you look for the file “com.ibm.notes.branding.prefs” and open it you will see all of the Eclipse preferences this plugin supports.  Usually these can be controlled by the Application | Preferences panels but some are only set in code.  Just depends if you want users changing them or not.

Here is  some of example for plugin_customization.ini

# plugin_customization.ini
# sets default values for plug-in-specific preferences
# keys are qualified by plug-in id
# e.g., com.example.acmeplugin/myproperty=myvalue

# show progress on startup
org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP=true

# new-style tabs by default
org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false


# show memory monitor by default
org.eclipse.ui/SHOW_MEMORY_MONITOR = true

#####################################Perspective#############################################################
# put the perspective switcher on the top right
org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight

# Property "org.eclipse.ui/defaultPerspectiveId" controls the
# perspective that the workbench opens initially
org.eclipse.ui/defaultPerspectiveId=com.khalid.perspectives.myPerspective

#sets of perspectives be closed/opened by actions
org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS =com.khalid.perspectives.myPerspective, org.eclipse.cdt.ui.CPerspective, org.python.pydev.ui.PythonPerspective

###################################################################################################


#############################################WELCOME(INTRO)########################################################
# Preference settings for universal intro pages (as of Eclipse 3.2)
#please see "http://www.eclipse.org/eclipse/platform-ua/proposals/shared-intro/shared-intro.htm"

#a unique identifier of the presentation theme to be used for this product.
org.eclipse.ui.intro/INTRO_THEME = org.eclipse.ui.intro.universal.circles

#a comma-separated list of root page identifiers that should be visible in the home page
org.eclipse.ui.intro.universal/INTRO_ROOT_PAGES = overview,firststeps

#a file name pointing at the XML file with the page layout settings org.eclipse.ui.intro.universal/INTRO_DATA = product:intro-data.xml

#the id of the page which will be shown when Eclipse starts the first time. org.eclipse.ui.intro/INTRO_START_PAGE = overview

#the id of the page which will be shown when the home button is pressed.org.eclipse.ui.intro/INTRO_HOME_PAGE = firststeps

#the id of the page which will be shown when welcome is displayed in a non-maximized form.org.eclipse.ui.intro/INTRO_STANDBY_PAGE =  firststeps
#######################################################################################################
plugin_customization.ini will be added under the "org.eclipse.core.runtime.products" extension as specified below

 <?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         id="khalidProduct"
         point="org.eclipse.core.runtime.products">
      <product
            application="org.eclipse.ui.ide.workbench"
            description="%productDesc"
            name="%productName">
         <property
               name="windowImages"
               value="icons/product.png,icons/About_Box_sdk.png,icons/About_Box_text_sdk.png,">
         </property>
          <property
               name="preferenceCustomization"
               value="plugin_customization.ini">
         </property>
    </extension>
    </plugin>

the property for the product is available under "org.eclipse.ui.branding.IProductConstants"
: