Thursday, November 19, 2015

How to control eclipse Java formatter on or off

This you can be controlled from Eclipse preferences.

Eclipse preferences: Java > Code Style > Formatter. Click on "Edit" button, "Off/On Tags", check off "Enable Off/On tags".

How to use in the code:
// @formatter:off
...your code here won't be formatted
// @formatter:on




How to listen to Eclipse Log errors

Register a listener in your Core Plugin startup:

Platform.addLogListener(new MyLogListener());

Listen to the log:

import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;

public class MyLogListener implements ILogListener
{

@Override
public void logging(IStatus status, String plugin)
{
if (status.getCode() == IStatus.ERROR)
{
startJob(status);
}
}

private void startJob(final IStatus status)
{
Job job = new Job("Reporting error...")
{
@Override
protected IStatus run(IProgressMonitor monitor)
{
System.out.println("===============Studio error reporting starts==============");
String ticketMessage = status.getMessage();
System.out.println(ticketMessage);
Throwable exception = status.getException();
exception.printStackTrace();
 System.out.println("===============Studio error reporting ends==============");
return null;
}
};
job.schedule();
}

}

Tuesday, November 17, 2015

Semantic Versioning

http://semver.org

Given a version number MAJOR.MINOR.PATCH, increment the:
  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards-compatible manner, and
  3. PATCH version when you make backwards-compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.



Wednesday, November 11, 2015

How to change the default console output buffer size in Eclipse

Eclipse User:

In Window > Preferences > Run/Debug > Console there's a checkbox "Limit console output" and a textfield for entering the buffer size of the console. However, you can increase it up to 1000000

Eclipse Plugin Development:

To uncheck the console output limit:
IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
store.setDefault(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT, false);
To change only the buffer limit:
store.setDefault(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK, 500000);

Wednesday, October 21, 2015

How to merge the changes from your development branch to master/release branch

$ git checkout development
$ git merge -s ours release  //merge release into development and discard any changes on release branch
$ git checkout release
 $git merge development

Note: Very important point here is, we are completely discarding the changes which are made in release branch. Here we will just bring all the changes from development branch to release branch without having conflicts. If any conflicts during the merge it will take development changes and ignore the release changes if any.

This merge strategy can be used ONLY when you are sure that release branch does not have any additional git commits compared to development branch. 

If release branch is having specific commits and which are not there in development branch, then it's better to go always with the default merge strategy.

$ git checkout release
$ git merge development

Resolve any conflicts if any and commit it.






Monday, October 12, 2015

How to find the product code for the installed MSI file in windows

Run below command from power shell to see.

PS C:\Users\Admin> get-wmiobject -class Win32_Product


IdentifyingNumber : {32A3A4F4-B792-11D6-A78A-00B0D0170400}
Name              : Java SE Development Kit 7 Update 40
Vendor            : Oracle
Version           : 1.7.0.400
Caption           : Java SE Development Kit 7 Update 40

IdentifyingNumber : {32A3A4F4-B792-11D6-A78A-00B0D0170760}
Name              : Java SE Development Kit 7 Update 76
Vendor            : Oracle
Version           : 1.7.0.760
Caption           : Java SE Development Kit 7 Update 76

IdentifyingNumber : {32A3A4F4-B792-11D6-A78A-00B0D0170800}
Name              : Java SE Development Kit 7 Update 80
Vendor            : Oracle
Version           : 1.7.0.800
Caption           : Java SE Development Kit 7 Update 80

IdentifyingNumber : {64A3A4F4-B792-11D6-A78A-00B0D0170400}
Name              : Java SE Development Kit 7 Update 40 (64-bit)
Vendor            : Oracle
Version           : 1.7.0.400
Caption           : Java SE Development Kit 7 Update 40 (64-bit)

IdentifyingNumber : {64A3A4F4-B792-11D6-A78A-00B0D0170800}
Name              : Java SE Development Kit 7 Update 80 (64-bit)
Vendor            : Oracle
Version           : 1.7.0.800
Caption           : Java SE Development Kit 7 Update 80 (64-bit)


IdentifyingNumber  number represents the product code.