Running eclipse under Mac OS

Solution

#add optiopn to java args
-d32

Problem
java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
	at org.eclipse.swt.internal.Library.loadLibrary(Library.java:197)
	at org.eclipse.swt.internal.Library.loadLibrary(Library.java:174)
	at org.eclipse.swt.internal.C.<clinit>(C.java:21)
	at org.eclipse.swt.internal.cocoa.NSThread.isMainThread(NSThread.java:33)
	at org.eclipse.swt.graphics.Device.<init>(Device.java:116)
	at org.eclipse.swt.widgets.Display.<init>(Display.java:668)

Enable IP forwarding under Ubuntu

To enable ip forwarding from one interface to another you can use following commands:

iptables -A FORWARD -i ppp0 -o eth0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE 
sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

This code anables ip forwarding from eth0 to ppp0 interface-> ie from local network to private network

Integrating maven project into eclipse using m2eclipse and wtp

    To be ablerun maven web project inside eclipse you need install
  • m2eclipse core
  • m2eclipse wtp integration

Switching from one svn working copy to another

To switch you working copy from trunk to branch I recommend do following

#1 copy you working copy, because switching can be painfull
cp -r trunk branch
#2 run svn switch
svn switch https://svn.jboss.org/repos/jbosstools/branch branch

If repository has changed URL you can update localcopy using following command
svn switch --relocate https://old-url http://new-url 3.2.helios/

Usefull Eclipse Plugins for working with big ammount of code

On big project it's necessary to control quality of code and code coverage in testing time.
When amount of code is bigger then couple of classes, it very hard analyse the code manually.
So it's good to use some automatic tools for it. Code coverage and code checkers can be integrated into project build system or can be used as
eclipse plugins.

    For analysing structure of code can be used folowing plugins:
  • Check Style -FULL SHIT BY MY Opinion

JSF2 Validators in VPE

JSF2 Custom Element Validation has been to JBoss Developer Studio & JBoss Developer Tools

    possibilities of this functionality
  • validation and quick fix for jsf2 components library declaration
  • validation and quick fix for jsf2 custom component name
  • validation and quick fix for jsf2 custom component attributes

You can find more details here
More Information Here
Demo

Obtaining Selection from Eclipse workbench

The code for getting eclipse selection

ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
ISelection eclipseSelection = selectionService.getSelection();

Usefull Links
Eclipse Workbench: Using the Selection Service

Correct way return empty result (array and collection) from functions

If function return an empty array or collection, it should return an EMPTY object instead null, because the result can be used in other functions without checking for null. Foreach doesn't check it too.

//CORRECT
public char[] getCompletionProposalAutoActivationCharacters() {
	return new char[0];
}
//INCORRECT
public char[] getCompletionProposalAutoActivationCharacters() {
	return null;
}

//CORRECT
protected List<ICompletionProposal> computeCompletionProposals() {
	....
	return Collections.<ICompletionProposal>emptyList();
}
//INCORRECT

Customizing RichFaces calendar

Here is example automatic date changing in rich:calendar component. We add one month to user selected date

<rich:calendar  showWeekDaysBar="false" showFooter="false" 
datePattern="MM/yyyy" required="true" id="startDate"
ondateselected="if(event.rich.date!=null){event.rich.component.selectDate(event.rich.date.setMonth(event.rich.date.getMonth()+1));}"
requiredMessage="#{msgs.simulatedTabReportingStartMonthisRequed}"
value="#{simulationReportTabController.startDate}" >
</rich:calendar>

Adding Java support to firefox under ubuntu

To add java support for Ubuntu you need install java plugin

sudo apt-get install sun-java6-plugin

Syndicate content