Skip to main content

Posts

Open Eclipse RCP application as maximized

Open Eclipse RCP application as maximized Open File : ApplicationWorkbenchWindowAdvisor.java in you RCP application and override the method "postWindowOpen()" and write the code as mentioned below : @Override public void postWindowOpen() { super.postWindowOpen(); IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.getWindow().getShell().setMaximized( true ); } Following Books are good to refer :

Show Perspective switch bar in Eclipse RCP application

Show Perspective switch bar in Eclipse RCP application Open file ApplicationWorkbenchWindowAdvisor.java in your plug-in project. Override the method, preWindowOpen and as shown below, setShowPerspectiveBar as True. @Override public void preWindowOpen () { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setShowPerspectiveBar( true ); } Run your RCP application, and on Right side top, you will be able to see perspective Switch. Following Books are good to refer :

Create (pulldown) Menu in Toolbar in Eclipse RCP

Create (pulldown) Menu in Toolbar Step 1. Create Toolbar with PullDown Step 2. Create MenuContribution  Step 3. Add items to MenuContribution Step 4. Run the application Step 1. Create Toolbar with PullDown Create your Eclipse RCP application ( with mail template). Suppose open command id is "HarikrushnaVToolbar.open" then create a toolbar with command in it,  as shown below: now, convert the style to "pulldown". Now, if you run the application, you will see a pulldown button next to toolbar icon as follow : Step 2: Create MenuContribution Now, create a MenuContribution, which will define the items for pulldown menu. Define, locationURI to the same name as the menu:commandId , here we provide the LocationURI as "menu:HarikrushnaVToolbar.open" Also Define Class name as "AllMenuItems". Step 3. Add items to MenuContribution Click on " class ", you will see the...

Add Method Body Using EMF ( Add code inside EOperaion)

Add Method Body Using EMF ( Add code inside EOperaion ) Steps :  Create Ecore model with Code Create GenModel Verify generated Code 1. Create Ecore model with Code In RCP project create new Ecore model : Now, press on Next and give the name of the Ecore model. Here the name of the Ecore model is given as Office.ecore. Click on "Finish". It will create Ecore model in project. Now provide the name to the package. Here the name is given as "Office" Add a EClass to the package "Office" Give the name of the class as "Employee" Add attribute to the Employee class and give name. Add EOperation to the Class Employee. Give name as "calculateSalary" , set type as "EInt" to the EOperation. Add, EAnnotation to the EOperation "calculateSalary". In properties view, add source to "http://www.eclipse.org/emf/2002/GenModel" ...

Creating Image Registry in Eclipse RCP

Advantage of Creating Image Registry in Eclipse RCP Share the same image between different plugin. Don't dispose the image and keep it for another plugin. How to create Image Registry? Override the initializeImageRegistry method inside the Activator and you are ready to use t  public class Activator  {       public static final String MY_PLUGIN_ID = "org.harikrushnav.myplugin.name";       public static final String MY_IMAGE_ID = "myimage.save";     ....      @override       protected void initializeImageRegistry(ImageRegistry registry) {                Bundle bundle = Platform.getBundle(MY_PLUGIN_ID);          IPath path = new Path("icons/save_image.gif");          URL url = FileLocator.find(bundle, path, null);          ImageDescriptor desc = ImageDescriptor.createFrom...

Factory Design Pattern - Java

Factory Design Pattern Factory Design Pattern works as per it's name. As one Factory can generate various types of items but of a specific category. Like, Car Factory ( Nissan Car Factory ) can create cars like, Micra, Sunny, Evalia but it can't create Duster. Because,Duster can be created by Renault Car Factory. So, with the same concept, A company can create a various types of Employees. Like, Developer, Admin , Developer Manager. But, only Developer can be Dev Manager. Here is the Complete example of creating the Company with all the Employee details. Class Company.java /** * Parent Class of all Class. Employee is Base class of all types of Employee. * * @author Hari * */ abstract class Employee { public abstract void getMyDetails(); } /** * Admin is child class of the Employee class. * * @author Hari */ class Admin extends Employee { public void getMyDetails() { System.out.println("I'm admin"); } } /** * Develo...