Tuesday, November 4, 2008

Use of perspective extensions

Recently i came across this extension.Say u want to add an actionset/wizard shortcut or anything to an existing perspective without modifying the perspecive class , u can make use of this perspective extension...Will be very useful when u want to add ur custom actionsets/wizardshortcuts to standard perspectives like Java perspective..
Follow this link to learn perspective extensions.

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_perspectiveExtensions.html

Monday, September 8, 2008

Problems with enabling/disabling a button ???

I had big problem in solving problem with enabling/disabling a SWT button.my sample code is as follows:

checkButton = new Button(composite,SWT.NONE);
checkButton.setEnabled(false);
checkButton .addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
if(selection.size()!=0){
checkButton.setEnabled(true);
executeEditFuntionality();
}else{
checkButton.setEnabled(false);
}
}
});

To my surprise , when it enters else condition ,its disabling the button forever!!!i mean once its disabled..even if i select anything in viewer , button is not enabled.
I broke my head to solve this..did hours of googling and finally asked one of my genious team mate and he told me that i should be doing enabling/disabling of a widget in the viewers selection changed listener event..I tried that and to my surprise it worked..
below is the sample code

checkButton = new Button(composite,SWT.NONE);
checkButton.setEnabled(false);
checkButton .addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
if(selection.size()!=0){
executeEditFuntionality();
}else{
// do nothing
}
}
});

tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
if(selection.size()!=0){
editButton.setEnabled(true);
}else{
editButton.setEnabled(false);
}
}
});

Monday, August 25, 2008

Use of Progress View

When ever i update my code from repository , eclipse shows update status at the bottom right corner ...many times i was nt really sure whether its getting hanged or progressing...so wanted to find a way to see the progress of update task...In the list of views given by eclipse i observed progress view and when i opened it , its showing the progress of updates..then i realized i never used this view before...
If u want to see progress of any task eclipse is doing say updates, synchronizing or anything...u can see progress in this view...

Thursday, August 7, 2008

Ever dreamt of opening Views, Perspectives, Commands, etc. - by just typing their name

What i usually do to open any view or perspective or some other is like to go through steps Window/ShowView/MyView , just now realized that i wasted lot of time...Came to know from my lead that using Ctrl+3 keyboard Shortcut we can open them with out above steps..It seems this feature is introduced in Eclipse 3.3 M7 ...Make use of it...


The source link http://eclipsenuggets.blogspot.com/2007/05/quick-access-ctrl3-is-bliss-are-you-one.html

Monday, July 14, 2008

Automation of project and package creation in Ganemede!!!

I was going through eclipse blogs after a long time..Came to know from one such posts there, that Ganemede has a cool feature..Just copy few lines of code say this
System.out.println("coool");
Now go to package explorer view and paste , making sure that none of the projects are selected...
then u can see that project wud be created and ur code will be in a class with a main method enclosed which is ready to run...

Thursday, June 26, 2008

Examples on demand

I was going through MyEclipse article articles and found the concept of Examples on demand...We just have to click example and it gets checkedout into our workspace and surprisingly with all configurations...
see this

http://www.myeclipseide.com/documentation/quickstarts/eod_overview/

Wednesday, May 28, 2008

Adding action sets and wizards to perspective

Recently I had a requirement to add launch configuration to our custom perspective. Before looking into perspective source codes thats already there, i tried googling ...din get anything...then later I happened to see source code of Java Perspective and found out that we can add wizards,view shortcuts and action sets to our perspective like below:

// snippet code from JavaPerspectiveFactory class
public void createInitialLayout(IPageLayout layout) {

layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET); // line no A
layout.addActionSet(JavaUI.ID_ACTION_SET);

layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.JavaProjectWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$

}

Since my interest was to add launch configuration , I made use of line no A in my custom perspective and it served my purpose...