| Summary: | When creating a connection to an unspecified other end, the new shape should be in edit mode | ||
|---|---|---|---|
| Product: | [Modeling] GMF-Runtime | Reporter: | Cherie Revells <crevells> |
| Component: | General | Assignee: | Cherie Revells <crevells> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P1 | CC: | min123 |
| Version: | 1.0 | ||
| Target Milestone: | 1.0 | ||
| Hardware: | PC | ||
| OS: | Windows 2000 | ||
| Whiteboard: | |||
|
Description
Cherie Revells
Do you know if there are any workarounds for this bug that I can use temporarily? Found a workaround:
In a custom ContainerNodeEditPolicy I overrided the following method:
protected Command getConnectionAndEndCommands(CreateConnectionRequest request) {
Command cmd = super.getConnectionAndEndCommands(request);
if (cmd instanceof CompoundCommand) {
CompoundCommand cc = (CompoundCommand) cmd;
List commands = cc.getCommands();
for (Iterator iter = commands.iterator(); iter.hasNext();) {
Command subCommand = (Command) iter.next();
if (subCommand instanceof EtoolsProxyCommand) {
ICommand iCmd = ((EtoolsProxyCommand) subCommand).getICommand();
if (iCmd instanceof CreateViewAndOptionallyElementCommand) {
CreateViewAndOptionallyElementCommand createView = (CreateViewAndOptionallyElementCommand) iCmd;
PerformDirectEditOnEndCommand perform = new PerformDirectEditOnEndCommand(createView, (IGraphicalEditPart) getHost());
cc.add(perform);
break;
}
}
}
}
return cmd;
}
I also added this private class:
private static class PerformDirectEditOnEndCommand extends Command {
private final CreateViewAndOptionallyElementCommand other;
private final IGraphicalEditPart part;
public PerformDirectEditOnEndCommand(CreateViewAndOptionallyElementCommand other, IGraphicalEditPart part) {
this.other = other;
this.part = part;
}
public void execute() {
View v = (View) other.getResult().getAdapter(View.class);
if (part != null) {
final IGraphicalEditPart node = (IGraphicalEditPart) part.findEditPart(null, ViewUtil.resolveSemanticElement(v));
if (node != null) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
node.performRequest(new Request(RequestConstants.REQ_DIRECT_EDIT));
}
});
}
}
}
}
This seems to work for me. (Sorry for the bad formatting)
I fixed this in the ConnectionCreationTool instead since this is where we have code already to perform direct edits. I modified ConnectionCreationTool so that all IPrimaryEditParts that have been created will be selected and priority will be given to the first shape created to be put into direct edit mode. [target cleanup] 1.0 RC was the original target milestone for this bug [GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug |