Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 90114 Details for
Bug 201150
Text in Recorder Control should be copyable.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch
patch-201150.txt (text/plain), 6.68 KB, created by
Paul Klicnik
on 2008-02-19 17:28:59 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Paul Klicnik
Created:
2008-02-19 17:28:59 EST
Size:
6.68 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.test.ui >Index: src-recorder/org/eclipse/hyades/internal/execution/recorder/ui/views/RecorderControlView.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src-recorder/org/eclipse/hyades/internal/execution/recorder/ui/views/RecorderControlView.java,v >retrieving revision 1.14 >diff -u -r1.14 RecorderControlView.java >--- src-recorder/org/eclipse/hyades/internal/execution/recorder/ui/views/RecorderControlView.java 3 May 2007 01:23:12 -0000 1.14 >+++ src-recorder/org/eclipse/hyades/internal/execution/recorder/ui/views/RecorderControlView.java 19 Feb 2008 22:24:32 -0000 >@@ -21,10 +21,16 @@ > import org.eclipse.hyades.test.core.internal.resources.TestCorePluginResourceBundle; > import org.eclipse.hyades.test.core.testgen.ITestgenListener; > import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; >+import org.eclipse.jface.action.Action; > import org.eclipse.jface.action.GroupMarker; > import org.eclipse.jface.action.ToolBarManager; > import org.eclipse.jface.dialogs.ErrorDialog; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.dnd.Clipboard; >+import org.eclipse.swt.dnd.TextTransfer; >+import org.eclipse.swt.dnd.Transfer; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; > import org.eclipse.swt.graphics.FontMetrics; > import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.GridData; >@@ -34,12 +40,17 @@ > import org.eclipse.swt.widgets.Canvas; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.List; >+import org.eclipse.swt.widgets.Listener; >+import org.eclipse.swt.widgets.Menu; >+import org.eclipse.swt.widgets.MenuItem; > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.actions.ActionFactory; > import org.eclipse.ui.part.ViewPart; > > /** >@@ -68,6 +79,16 @@ > */ > public static RecorderControlView instance=null; > >+ /** >+ * Setup the clipboard >+ */ >+ private Clipboard clipboard; >+ >+ /** >+ * Create the action for copying >+ */ >+ private CopyAction copyAction; >+ > > /** > * the view's ID >@@ -81,7 +102,7 @@ > /** > * @see ViewPart#createPartControl > */ >- public void createPartControl(Composite grandParent) >+ public void createPartControl(final Composite grandParent) > { > FontMetrics fm = new GC(grandParent).getFontMetrics(); > int heightHint = fm.getHeight() + fm.getAscent() + fm.getDescent(); >@@ -120,15 +141,66 @@ > recStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); > > >- statusList = new List(parent,SWT.V_SCROLL|SWT.H_SCROLL|SWT.READ_ONLY|SWT.BORDER); >+ statusList = new List(parent,SWT.V_SCROLL|SWT.H_SCROLL|SWT.READ_ONLY|SWT.BORDER|SWT.MULTI); > statusList.setLayoutData(new GridData(GridData.FILL_BOTH)); >- >- ToolBarManager toolbarManager = (ToolBarManager)getViewSite().getActionBars().getToolBarManager(); >+ >+ clipboard = new Clipboard(grandParent.getDisplay()); >+ copyAction = new CopyAction( clipboard ); >+ copyAction.setEnabled( false ); >+ statusList.addSelectionListener( new SelectionListener() { >+ public void widgetSelected(SelectionEvent e) { >+ /* A new selection has been made in the Recorder Control ... >+ * Update the selected lines */ >+ setSelectedLines(); >+ } >+ public void widgetDefaultSelected(SelectionEvent e) {} >+ }); >+ >+ /* Add the support for the context menu */ >+ statusList.addListener( SWT.MenuDetect, new Listener () { >+ public void handleEvent (Event event) { >+ Menu menu = new Menu( grandParent.getShell(), SWT.POP_UP ); > >+ MenuItem copyItem = new MenuItem( menu, SWT.PUSH ); >+ copyItem.setText( UiPluginResourceBundle.command_Copy ); >+ copyItem.addListener( SWT.Selection, new Listener () { >+ public void handleEvent (Event e) { >+ setSelectedLines(); >+ copyAction.run(); >+ } >+ }); >+ menu.setLocation( event.x, event.y ); >+ MenuItem selectAllItem = new MenuItem( menu, SWT.PUSH ); >+ selectAllItem.setText( UiPluginResourceBundle.command_SelectAll ); >+ selectAllItem.addListener( SWT.Selection, new Listener() { >+ public void handleEvent (Event e) { >+ statusList.selectAll(); >+ setSelectedLines(); >+ copyAction.setEnabled( true ); >+ } >+ }); >+ if ( statusList.getSelection().length == 0 ) { >+ copyAction.setEnabled( false ); >+ copyItem.setEnabled( false ); >+ } >+ menu.setVisible( true ); >+ } >+ }); >+ >+ getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction); >+ ToolBarManager toolbarManager = (ToolBarManager)getViewSite().getActionBars().getToolBarManager(); >+ > //add new items group > toolbarManager.add(new GroupMarker(STARTGROUP)); >- toolbarManager.add(new StopRecordingAction()); >- >+ toolbarManager.add(new StopRecordingAction()); >+ } >+ >+ private void setSelectedLines() { >+ if ( statusList != null && copyAction != null ) { >+ String[] statusLines = statusList.getSelection(); >+ copyAction.setSelectedStatusItems( statusLines ); >+ copyAction.setEnabled( statusLines.length == 0 ? false : true ); >+ } > } > > /** >@@ -257,7 +329,8 @@ > */ > public void setFocus() > { >- >+ setSelectedLines(); >+ copyAction.setEnabled( statusList.getSelection().length == 0 ? false : true ); > } > > /** >@@ -323,4 +396,36 @@ > } > > } >+ >+ class CopyAction extends Action { >+ private Clipboard clipboard; >+ private String[] selectedItems; >+ >+ public CopyAction( Clipboard clipboardVal ) { >+ super(); >+ if ( clipboardVal == null ) { >+ throw new IllegalArgumentException("Unable to perform copy action due to 'clipboard == null'"); //$NON-NLS-1$ >+ } >+ clipboard = clipboardVal; >+ } >+ >+ public void setSelectedStatusItems( String[] selectedItems ) { >+ this.selectedItems = selectedItems; >+ } >+ >+ public void run() { >+ /* Return if there are no selected items */ >+ if ( this.selectedItems.length == 0 ) return; >+ >+ /* Copy the items to the clipboard */ >+ StringBuffer status = new StringBuffer(); >+ for ( int i = 0; i < selectedItems.length; i++ ) >+ status.append( selectedItems[i] + "\n" ); >+ >+ clipboard.setContents( new String[] { status.toString() }, >+ new Transfer[] { TextTransfer.getInstance() }); >+ >+ } >+ >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 201150
:
90114
|
90225