您的位置:首页 > 其它

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

2006-05-10 10:38 387 查看
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) {
if (status != null && status.isMultiStatus() && status == inputElement) {
return status.getChildren();
} else if (status != null && status == inputElement) {
return new Object[] {status};
}
return new Object[0];
}

public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// Do nothing.
}
});
dialog.setLabelProvider(new LabelProvider() {
public String getText(Object element) {
if (element instanceof IStatus) {
return ((IStatus)element).getMessage();
}
return null;
}
});
dialog.setBlockOnOpen(true);
dialog.setMessage(ValidationMessages.BatchValidationDelegate_errorMessage);

if (ListDialog.OK == dialog.open()) {
Set errorSelections = new HashSet();
if (!status.isMultiStatus()) {
IConstraintStatus cstatus = (IConstraintStatus)status;
errorSelections.add(cstatus.getTarget());
} else {
IStatus[] children = status.getChildren();
for (int i = 0; i<children.length; i++) {
IConstraintStatus cstatus = (IConstraintStatus)children[i];
errorSelections.add(cstatus.getTarget());
}
}
editor.setSelectionToViewer(errorSelections);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: