poniedziałek, 12 maja 2014

How to lock IntelliJ IDEA on Unity launcher

Most straightforward way is running the IntelliJ from command line and once opened "right click" on icon appeared on the launcher and click "Lock to Launcher".

Now you can go to terminal (Ctrl+Atl+T) and edit newly created desktop file ~/.local/share/applications/jetbrains-idea-ce.desktop

The key point is to fix Exec entry - should be path to the ./idea.sh start script. Note that if you have not JAVA_HOME set in your environment, you need set one as shown below.
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=IntelliJ IDEA
Icon=jetbrains-idea-ce.png
Path=/home/krma/Downloads/idea-IC-135.690/bin
Exec=env JAVA_HOME=/usr/lib/jvm/java-8-oracle /home/krma/Downloads/idea-IC-135.690/bin/idea.sh
StartupNotify=false
StartupWMClass=jetbrains-idea-ce
OnlyShowIn=Unity;
X-UnityGenerated=true
That is basically all.

czwartek, 8 maja 2014

Eclipse PDE - all about Eclipse Commands

The goal of this site is gather most useful locationURI's one can like to attach custom command for Eclipse environment.

menu:org.eclipse.ui.views.ProblemView
menu:window?after=newEditor
popup:org.eclipse.ui.menus.showInMenu popup:#TextEditorContext?after=copy popup:#TextEditorContext?endof=group.find popup:#TextEditorContext?after=group.open popup:#TextEditorContext?after=group.edit

Useful commands

  • org.eclipse.ui.ide
    • org.eclipse.ui.edit.text.openLocalFile (Open a local file)
    • org.eclipse.ui.navigate.goToResource (Go to particulare resource in the active window)
    • org.eclipse.ui.navigate.openResource (Open an editor on a praticular resource)
      • handler: org.eclipse.ui.internal.ide.handlers.OpenResourceHandler
      • param: filePath
    • org.eclipse.ui.edit.addTask (Add a task)
      • defaultHandler:  no
    • org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals (Suggest possible fixes for a problem)
      • deafultHander: no
    • org.eclipse.ui.navigate.showResourceByPath (Show a resource in the Navigator given its path)
      • defaultHandler: org.eclipse.ui.internal.ide.handlers.ShowResourceByPathHandler
      • resourcePath
    • org.eclipse.ui.ide.copyBuildIdCommand (Copies the build id to the clipboard)
      • defaultHandler: org.eclipse.ui.internal.ide.commands.CopyBuildIdToClipboardHandler
  • org.eclipse.ui
    • org.eclipse.ui.newWizard (Open wizard)
      • param: newWizardId
    • org.eclipse.ui.file.import
      • param:  importWizardId
    • org.eclipse.ui.file.export
      • param: exportWizardId

Invoke programmatically

ICommandService commandService = (ICommandService) PlatformUI.getWorkbench()
                .getActiveWorkbenchWindow().getService(ICommandService.class);

IEvaluationService evaluationService = (IEvaluationService) PlatformUI.getWorkbench()
                .getActiveWorkbenchWindow().getService(IEvaluationService.class);
try {
 Command c = commandService.getCommand("org.eclipse.ui.newWizard");

 Map<String, String> params = new HashMap<String, String>();
 params.put("newWizardId", "mywizard.id");

 c.executeWithChecks(new ExecutionEvent(c, params, null, evaluationService.getCurrentState()));

} catch (Exception ex) {
 throw new RuntimeException("Open new wizard command not found");
}

 Menus


   
      
         
             
             
             
             
         
      
   



   
      
         
           
         
      
      
        
      
   



   
      
      
         
            
            
         
      
   



   


wtorek, 6 maja 2014

Ubuntu 14.04 - How to dock applications to the Unity launcher

There is a gsettings command which let us do the job.

First we need to retrieve current configuration.

gsettings get com.canonical.Unity.Launcher favorites

We should receive something like that:

['application://nautilus.desktop', 'application://firefox.desktop', 'application://ubuntu-software-center.desktop', 'application://unity-control-center.desktop', 'unity://running-apps', 'application://eclipse.desktop', 'unity://expo-icon', 'unity://devices']

Now we need to put our application (luna.desktop entry - should be created manually in well-known applications folder - eg. ~/.local/share/applications/luna.desktop)

gsettings set com.canonical.Unity.Launcher favorites ['application://nautilus.desktop', 'application://firefox.desktop', 'application://ubuntu-software-center.desktop', 'application://unity-control-center.desktop', 'unity://running-apps', 'application://eclipse.desktop', 'application://luna.desktop', 'unity://expo-icon', 'unity://devices']

New launcher item will appear immediately.