Bug 113594 - When creating a connection to an unspecified other end, the new shape should be in edit mode
Summary: When creating a connection to an unspecified other end, the new shape should ...
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 2000
: P1 major
Target Milestone: 1.0   Edit
Assignee: Cherie Revells CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-24 16:37 EDT by Cherie Revells CLA
Modified: 2008-08-13 13:04 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cherie Revells CLA 2005-10-24 16:37:44 EDT
To reproduce:
- Create a LED on a GMF logic diagram.
- Use connector handle or palette tool to create a note attachment from the LED 
to an unspecified target.
- Select Note.

RESULT:  Everything is created ok, but the note attachment is highlighted.  I 
think the new note created should be highlighted so that you can immediately 
enter text.  I think this would be the natural flow.
Comment 1 Min Idzelis CLA 2006-03-16 12:37:59 EST
Do you know if there are any workarounds for this bug that I can use temporarily?
Comment 2 Min Idzelis CLA 2006-03-16 13:47:45 EST
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)
Comment 3 Cherie Revells CLA 2006-04-19 10:28:18 EDT
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.
Comment 4 Richard Gronback CLA 2008-08-13 13:04:10 EDT
[target cleanup] 1.0 RC was the original target milestone for this bug
Comment 5 Eclipse Webmaster CLA 2010-07-19 12:30:27 EDT
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug