txt book

Thursday, March 24, 2011

Rethinking of the bookmark management

I've tried many (if not all) of the bookmark management applications, none of them is what I really want.
The things is that when you have several hundreds of bookmarks in the archive, it's very possible you never visit it again. What's the meaning to do the bookmark in this case?
So the answer from google is to search. The use case is like "I visited this website on that day, what was that again?".
Search is useful, but it cannot cover all the cases. So I still have another link on my homepage, maybe another in the firefox and so on.
There are some functionality the system want to provide:
  • To remember url
  • To recommend to you with new urls
  • Share your url with others
Till now, no ultimate solution.
If there is an ultimate solution, what would that be?
It would be like an assistant, knows all your history when you are using the internet (web, clients, mobile phone and so on) and add them to an archive. More than that, he/she will try to figure out what links you are about to visit again in the near future, and what links are just to remember. This is just the first step, let's see how long will we get there :D

Tuesday, July 20, 2010

Mylyn Bridge for EcoreTools Editor - 1

EcoreTools Diagram Editor is a GMF based editor for editing ecore files. I will implement a Mylyn Bridge for it.

After a long time of trying and testing, here are the things I've learned.
1. When implementing a bridge, it's a good idea to start with the EditingMonitor. Because the monitor does not need any other classes to support it, and you can directly see the result from the current context.

2. The next thing is to implement the StructureBridge and UIBridge. The main idea of the bridge is to create a mapping between objects and Strings(handles). When the mapping is created, Mylyn can deal with the Strings without worrying about the real objects. During implementation, it is always a good idea to learn from the existing implementations[1][2][3]. For EcoreTools Diagram Editor, there are a lot of generated files, I found org.eclipse.gmf.ecore.navigator.EcoreNavigatorContentProvider[4] useful to take a look at for the object mapping.

For now, my implementation is not complete, but it could work[5]. The next step is to make it better (mainly focus on UIBridge).

Thanks.
--
[1] http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.5/org.eclipse.mylyn.java/ui/3.2.0/org/eclipse/mylyn/internal/java/ui/JavaStructureBridge.java
[2] http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.5/org.eclipse.mylyn.ide/ant/3.2.0/org/eclipse/mylyn/internal/ide/ant/AntStructureBridge.java
[3] http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.5/org.eclipse.mylyn.resources/ui/3.2.0/org/eclipse/mylyn/internal/resources/ui/ResourceStructureBridge.java
[4] http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.5/org.eclipse.gmf.ecore/editor/2.1.0/org/eclipse/gmf/ecore/navigator/EcoreNavigatorContentProvider.java
[5] http://code.google.com/a/eclipselabs.org/p/mylyn-gmf-ui/source/browse/#svn/trunk/everyday.test/org.eclipselabs.mylyn.internal.ide.ecoretools

Friday, June 04, 2010

Say hi and the first post of GSoC: Mylyn Context + Zest test

Hi eclipse community! My name is Yongming Luo. I am from China. I am a participant for Google Summer of Code 2010. My topic is "Integrate GMF runtime with Mylyn task focused UI". So this series of blogs will share my explorations to this topic, with both success and failures. I am glad to here any comment from you.

In this post I want to show an experiment I did recently. Using eclipse zest to show the context information of the current task context.

Mylyn is a powerful tool to let the programmers focus on the things they are doing. One's focus interests are organized as tasks in workspace. For each task, there is a list which holds the related files and resources. What I want to do is to get the list and show them as a graph in a view. I by chance read something about eclipse zest toolkit[2], which is easy to use to implement the experiment, so I use zest in this post.

To get the current context in workspace, I use the following code[1]:
ContextCore.getContextManager().getActiveContext();

Context could change. To listen to this change, it's good to create a listener and add it to the context manager.
public class ContextListener extends AbstractContextListener{
 @Override
 public void contextChanged(ContextChangeEvent event) {
  super.contextChanged(event);
  switch(event.getEventKind()) {
  case PRE_ACTIVATED:
   ...
   break;
  case CLEARED:
   ...
   break;
  case DEACTIVATED:
   ...
  }
 }
}

Each task has a life-cycle, and fires several events to the listeners: PRE_ACTIVATED->ACTIVATED->DEACTIVATED. With these events we can do the modification to the graph view synchronously.

For the view, I simply use GraphNode class to present the java files in the context. Every time when there is a task switch or one task is cleared, I clear the view.

You can download the plug-in from svn:
svn checkout http://svn.codespot.com/a/eclipselabs.org/mylyn-gmf-ui/trunk/ mylyn-gmf-ui-read-only

or download it directly (org.eclipselabs.gsoc.test1.zip)
http://code.google.com/a/eclipselabs.org/p/mylyn-gmf-ui/downloads/list


This is an eclipse plug-in project, with dependencies from both mylyn and zest. You have to install them first to run the plug-in. The screen cast of the plug-in is like the following:

Details can be found in the comments of the code.
Thanks.
--
[1] http://www.vogella.de/blog/2009/10/05/modifying-mylyn-context/
[2] http://www.vogella.de/articles/EclipseZest/article.html

Tuesday, May 04, 2010

Add a new entry or modify the existing context menu of GMF editor

I want to add a new context menu entry to one of my diagram object. And I made it.The method is in GMF tutorial 3.
The further requirement is to combine the entry to the existing context menus. E.g. my "edit" options are part of the existing "edit" group.
The point is to find out the existing menus' ids.
So I take a look at the class "DiagramEditorContextMenuProvider" and print the menu ids out in the method "buildContextMenu". Here are the results:

umlAddGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=umlAddGroup)
addGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=addGroup)
navigateGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=navigateGroup)
navigateMenu,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginMenuManager@f65ce5
fileGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=fileGroup)
fileMenu,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginMenuManager@4cc81c
editGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=editGroup)
editMenu,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginMenuManager@e5ddd0
deleteFromDiagramAction,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginActionContributionItem(id=deleteFromDiagramAction)
deleteFromModelAction,org.eclipse.jface.action.ActionContributionItem(id=deleteFromModelAction)
findGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=findGroup)
filterFormatGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=filterFormatGroup)
selectMenu,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginMenuManager@145959c
toolbarArrangeAllAction,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginActionContributionItem(id=toolbarArrangeAllAction)
filtersMenu,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginMenuManager@1616dd6
viewGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=viewGroup)
restGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=restGroup)
additions,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=additions)
propertiesGroup,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginSeparator(id=propertiesGroup)
showPropertiesViewAction,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginActionContributionItem(id=showPropertiesViewAction)
properties,org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginActionContributionItem(id=properties)


Now we know that the path of the edit entry is editMenu/editGroup.

Also, you can remove the unused menu entries in the method "buildContextMenu".
E.g. I do something like this:
menu.remove("fileGroup");
menu.remove("fileMenu");
Then all the file group is gone.

Monday, May 03, 2010

Add the perspective bar to an rcp application

So far the easiest way I found is to add some code in the WorkbenchWindowAdvisor. As stated in here.
Is there a way to do that in an plug-in? I don't think so...

Friday, April 30, 2010

Hi Eclipse Community

This is the first post for Eclipse GSoC 2010.

Tuesday, April 27, 2010

One way to refresh the text editor in Eclipse

Finally I find the solution in the book "Eclipse Plugins". The code snippet is the following:
someEditor.getDocumentProvider().resetDocument(someEditor.getEditorInput());