Software Engineering

by Kerem Kosaner

Eclipse Helios Released

Posted by keremkosaner on 5 July 2010

Helios is the simultaneous release of 39 Eclipse projects. In terms of statistics, the Helios release includes 33 million lines of code developed by about 500 Eclipse.org committers from 44 companies. The important thing to remember about Helios and Eclipse simultaneous releases in general is that even though it’s a simultaneous release, it doesn’t mean these projects are unified. Each project is a separate open source project within Eclipse.org, operating with its own project leadership, its own committers and its own development plan. The simultaneous-release concept is designed to provide a transparent and predictable development cycle.

REF, ECLIPSE.ORG

Posted in Software Development | Leave a Comment »

Eclipse RCP : Page Selection Listener Implementation

Posted by keremkosaner on 10 June 2010

For a view to consume the selection of another part, it must add a selection listener to the page so that when the active part changes or the selection in the active part changes, it can react by altering its own selection appropriately. The “org.eclipse.ui.ISelectionListener” interface is for listening to selection changes. This interface may be implemented by clients. When implemented it is notified when the selection has been changed.

To accomplish this, add a call at the end of the createPartControl() method to the following new hookPageSelection() method.

private ISelectionListener pageSelectionListener;

private void hookPageSelection() {
	
	pageSelectionListener = new ISelectionListener() {
		public void selectionChanged(IWorkbenchPart part,
				ISelection selection) {
			pageSelectionChanged(part, selection);
		}
	};
	
	getSite().getPage().addPostSelectionListener(pageSelectionListener);
}

protected void pageSelectionChanged(IWorkbenchPart part, ISelection selection) {
	
	if (part == this)
		return;
	if (!(selection instanceof IStructuredSelection))
		return;

	//HERE ; DO WHATEVER YOU WANT TO DO WHEN PAGE SELECTION CHANGED
}

Posted in Software Development | Leave a Comment »

Eclipse EMF : Read XMI Model Files

Posted by keremkosaner on 1 June 2010

XMI Files generated by Eclipse Modeling Framework can be read by using “org.eclipse.emf.ecore.resource.Resource” class. A resource of an appropriate type is created by a resource factory; a resource set indirectly creates a resource using such a factory. A resource is typically contained by a resource set, along with related resources. It has a URI representing it’s identity and that URI is used to determine where to save and load. It provides modeled contents, in fact, it provides even the tree of modeled contents, as well as diagnostics for errors and other problems. It may be unloaded to discard the contents and the load state can be queried. Modification can be tracked, but it’s expensive.

private static String DEFAULT_XMI_FOLDER 	= "C:\\";

private void doLoadXMIFromAbsolutePath(String xmiFileName) {
		
		URI uri = URI.createFileURI(DEFAULT_XMI_FOLDER + xmiFileName);

		Resource resource = new XMIResourceImpl();
	
		resource.unload();
		resource.setURI(uri);

		try {
			resource.load(null);
			
			//XMIModel : Create a class for XMI Model
			XMIModel model = (XMIModel) resource.getContents().get(0);
			
			//Iterate on the XMI Model or Convert it to a tree
			TreeViewer treeViewer;
			treeViewer.setInput(model);

		} catch (IOException e) {
			System.err.println("Exception occured while loading the resource file for configuration model: " + e.getMessage()); 
		}
}

Posted in Software Development | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.