Sunday, September 6, 2015

How to get the Eclipse Installation location ?

Eclipse provided a direct API call for this.

Platform.getInstallLocation().getURL();

To get a string path:

Platform.getInstallLocation().getURL().getPath();

Wednesday, September 2, 2015

Undo a git rebase

Step 1: Identify the head commit of the branch till where you wanted to undo it.

$ git reflog
5621e87 HEAD@{0}: checkout: moving from TISTUD-7562 to development
7747926 HEAD@{1}: rebase -i (finish): returning to refs/heads/TISTUD-7562
7747926 HEAD@{2}: rebase -i (squash): TISTUD-7562:For limited plan billing is not opened via wizard
2101ed5 HEAD@{3}: rebase -i (start): checkout 5621e87fac883fca1783bb2f1b6f811422bdf289
0975830 HEAD@{4}: rebase: aborting
0975830 HEAD@{5}: reset: moving to HEAD@{1}
2101ed5 HEAD@{6}: rebase -i (start): checkout 5621e87fac883fca1783bb2f1b6f811422bdf289
0975830 HEAD@{7}: commit: TISTUD-7562:Avoiding multiple validations during the package launch actions from package explorer and app explorer.
2101ed5 HEAD@{8}: rebase finished: returning to refs/heads/TISTUD-7562
2101ed5 HEAD@{9}: rebase: TISTUD-7562:For limited plan billing is not opened via wizard


Here, I wanted to undo till HEAD@{7}

Step 2: Reset to required commit

git reset --hard HEAD@{7}

This will bring back all the changes which you are having at HEAD@{7} commit.

Thursday, July 9, 2015

Chaning git remote tracking repository or url

Here is the example.

$ git remote -v
origin  https://github.com/kolipakakondal/titanium_studio.git (fetch)
origin  https://github.com/kolipakakondal/titanium_studio.git (push)
upstream        https://github.com/appcelerator/titanium_studio_360.git (fetch)
upstream        https://github.com/appcelerator/titanium_studio_360.git (push)

Currently my 'upstream' branch is pointing to a wrong remote url, and I wanted to change it.

$ git remote set-url upstream https://github.com/appcelerator/titanium_studio.git
$ git remote -vorigin  https://github.com/kolipakakondal/titanium_studio.git (fetch)
origin  https://github.com/kolipakakondal/titanium_studio.git (push)
upstream        https://github.com/appcelerator/titanium_studio.git (fetch)
upstream        https://github.com/appcelerator/titanium_studio.git (push)

Wednesday, June 10, 2015

How to rebase your pull request

But, why ?

Your pull request(PR) might be pretty old and in mean time many people would have changed the same code. So you can't simply merge your PR into master branch because of the conflicts.

Step 1:
Fetch the latest code from remote master branch.
> git fetch upstream

here upstream is pointing to a remote repository.

Step 2:
If you have multiple commits, it's better to squash them. But it's an optional step.
>git merge-base <yourforkedbranch> <mainremotebranch>
Example: git merge-base TISTUD-9000 release

This will give the hash-id.
>git rebase --interactive <hash-id>

It will list down the commits, If you have more than one, you can replace 'pick' by 'squash' for commits expect first one.
Example:
pick 4455 
squash 5555
squash 85858

Step 3:
Run rebase command
>git rebase upstream/master

For sure, this will fail because of the conflicts. I mean, that's the main reason why we wanted to go for rebase here.

And once you resolve the conflicts continue with the rebase --continue.

Step 4: 
Update the pull request forcefully
>git push -f

or
> git push origin <yourbranch> -f

This is the crystal clear resource which will talk about this.


Thursday, May 28, 2015

How to specify to load a eclipse plugin only on 32 bit machine but not on 64 bit machine.

It’s simple, specify Eclipse-PlatformFilter flag in MANIFEST.MF file with the required criteria.

For example, I wanted to load my plugin only in 32 bit operating systems.
Eclipse-PlatformFilter: (osgi.os=win32)

for adding multiple conditions.
Eclipse-PlatformFilter: (& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))

The Framework supports filtering on the following system properties:
* osgi.nl - the platform language setting.
* osgi.os - the platform operating system.
* osgi.arch - the platform architecture.
* osgi.ws - the platform windowing system


Above example specify that, this bundle can only be resolved if the platform properties are osgi.ws=win32 and osgi.os=win32 and osgi.arch=x86. In other words a platform running on an x86 architecture, using a win32 operating system and the win32 windowing system.

We can find this property directly in plugin.xml file "Overview" tab.

Wednesday, May 13, 2015

Eclipse toolbar and menu bar group action id's

ICommonMenuConstants
IWorkbenchActionConstants
IIDEActionConstants


Few examples:
"group.new"
"group.goto"
"group.open"
"group.openWith"
"group.show"
"group.edit"
"group.reorganize"
"group.port"
"group.generate"
"group.search"
"group.build"
"additions"
"group.properties"

These will be used as a insertion points if you are contributing a new action/menu action/toolbar action.