3333import org .eclipse .swt .SWT ;
3434import org .eclipse .swt .dnd .Clipboard ;
3535import org .eclipse .swt .dnd .TextTransfer ;
36+ import org .eclipse .swt .events .KeyAdapter ;
37+ import org .eclipse .swt .events .KeyEvent ;
3638import org .eclipse .swt .events .SelectionAdapter ;
3739import org .eclipse .swt .events .SelectionEvent ;
3840import org .eclipse .swt .graphics .Image ;
@@ -69,6 +71,7 @@ public class AbapGitDialogObjLog extends TitleAreaDialog implements IResourceCha
6971 private final Image successImage ;
7072 private final Image infoImage ;
7173 private Action actionCopy ;
74+ private Action actionCopyObjName ;
7275 private final static String ERROR_FLAG = "E" ; //$NON-NLS-1$
7376 private final static String WARNING_FLAG = "W" ; //$NON-NLS-1$
7477 private final static String INFO_FLAG = "I" ; //$NON-NLS-1$
@@ -348,6 +351,15 @@ public String getText(Object element) {
348351
349352 hookContextMenu (this .abapObjTable );
350353
354+ this .abapObjTable .getTree ().addKeyListener (new KeyAdapter () {
355+ @ Override
356+ public void keyPressed (KeyEvent event ) {
357+ if ((event .stateMask & SWT .CTRL ) != 0 && (event .keyCode == 'c' || event .keyCode == 'C' )) {
358+ copy ();
359+ }
360+ }
361+ });
362+
351363 createTableViewerColumn (Messages .AbapGitDialogImport_column_msg_type , 150 ).setLabelProvider (new ColumnLabelProvider () {
352364 @ Override
353365 public String getText (Object element ) {
@@ -481,12 +493,14 @@ private void fillContextMenu(IMenuManager manager) {
481493 return ;
482494 }
483495 menuManager .add (AbapGitDialogObjLog .this .actionCopy );
496+ menuManager .add (AbapGitDialogObjLog .this .actionCopyObjName );
484497 }
485498 });
486499
487500 }
488501
489502 private void makeActions () {
503+ //Generic action to copy row
490504 this .actionCopy = new Action () {
491505 public void run () {
492506 copy ();
@@ -496,6 +510,20 @@ public void run() {
496510 this .actionCopy .setToolTipText (Messages .AbapGitView_action_copy );
497511 this .actionCopy .setActionDefinitionId (ActionFactory .COPY .getCommandId ());
498512 this .actionCopy .setImageDescriptor (PlatformUI .getWorkbench ().getSharedImages ().getImageDescriptor (ISharedImages .IMG_TOOL_COPY ));
513+
514+ //Action to copy object name
515+ this .actionCopyObjName = new Action () {
516+ public void run () {
517+ Object firstElement = AbapGitDialogObjLog .this .tree .getViewer ().getStructuredSelection ().getFirstElement ();
518+ IAbapObject selectedAbapObj = (IAbapObject ) firstElement ;
519+
520+ final Clipboard clipboard = new Clipboard (AbapGitDialogObjLog .this .tree .getViewer ().getControl ().getDisplay ());
521+ clipboard .setContents (new String [] { selectedAbapObj .getName () }, new TextTransfer [] { TextTransfer .getInstance () });
522+ clipboard .dispose ();
523+ }
524+ };
525+ this .actionCopyObjName .setText (Messages .AbapGitView_action_copy_obj_name );
526+ this .actionCopyObjName .setToolTipText (Messages .AbapGitView_action_copy_obj_name );
499527 }
500528
501529 @ Override
0 commit comments