工作记录5月9日开始(不断更新中)

2006年5月9日
讨论了关于gmf的一些feature
2006年5月14日
1.阅读文章“Learn how to implement the Command pattern in Java ”
http://www.javaworld.com/javaworld/javatips/jw-javatip68.html
该文章主要讲了设计基于java语言特性的Command框架设计。

figure 1 关于Receiver和Invoker交互关系的序列图
The key idea here is that the concrete command registers itself with the Invoker and the Invoker calls it back, executing the command on the Receiver.

the Command pattern completely decouples the object that invokes the operation  from the ones having the knowledge to perform it. This gives us a lot of flexibility: the object issuing a request must know only how to issue it; it doesn't need to know how the request will be carried out.


2006年5月15日

eclipse newsgroup里面看到这样一个提问,也许对我们的项目有帮助:

How to call "Arrange all" during editor starts up?
When using ecore example editor to visualize ecore model, the diagram does not look nice when editor is up. The connections pass through the figures and very hard to read. Is there a way to invoke "Arrange all" function programmatically when editor is starting ?  Any help will be greatly appreciated.

答曰:
Never mind. I found a way to do this by sending an ArrangeRequest to diagram editpart in editor's initializeGraphicalViewer(). Hope this will help someone with similar question :)

Note
虽然说的不是太清楚,但是总算觉得有法可依了!

2006年5月19日
console窗口类
org.eclipse.ui.console.MessageConsole

A console that displays messages. A message console may have one or more streams connected to it (MessageConsoleStream). Text written to streams is buffered and processed in a Job by the console's document partitioner.

Clients may instantiate this class; not intended to be subclassed.


org.eclipse.ui.dialogs.ListDialog

A dialog that prompts for one element out of a list of elements. Uses IStructuredContentProvider to provide the elements and ILabelProvider to provide their labels.

实现:
 1 ListDialog dialog = new ListDialog(shell);
 2             dialog.setInput(status);
 3             dialog.setTitle(title);
 4             dialog.setContentProvider(new IStructuredContentProvider() {
 5                 public void dispose() {
 6                     // nothing to dispose
 7                 }
 8 
 9                 public Object[] getElements(Object inputElement) {
10                     if (status != null && status.isMultiStatus() && status == inputElement) {
11                         return status.getChildren();
12                     } else if (status != null && status == inputElement) {
13                         return new Object[] {status};
14                     }
15                     return new Object[0];
16                 }
17 
18                 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
19                     // Do nothing.
20                 }
21             });
22             dialog.setLabelProvider(new LabelProvider() {
23                 public String getText(Object element) {
24                     if (element instanceof IStatus) {
25                         return ((IStatus)element).getMessage();
26                     }
27                     return null;
28                 }
29             });
30             dialog.setBlockOnOpen(true);
31             dialog.setMessage(ValidationMessages.BatchValidationDelegate_errorMessage);
32             
33             if (ListDialog.OK == dialog.open()) {
34                 Set errorSelections = new HashSet();
35                 if (!status.isMultiStatus()) {
36                     IConstraintStatus cstatus = (IConstraintStatus)status;
37                     errorSelections.add(cstatus.getTarget());
38                 } else {
39                     IStatus[] children = status.getChildren();
40                     for (int i = 0; i<children.length; i++) {
41                         IConstraintStatus cstatus = (IConstraintStatus)children[i];
42                         errorSelections.add(cstatus.getTarget());
43                     }
44                 }
45                 editor.setSelectionToViewer(errorSelections);
46             }

posted @ 2006-05-10 10:38  Android,服务端,移动互联网  阅读(325)  评论(0编辑  收藏  举报