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 90225 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 V2
patch-201150_V2.txt (text/plain), 9.51 KB, created by
Paul Slauenwhite
on 2008-02-20 13:25:44 EST
(
hide
)
Description:
Patch V2
Filename:
MIME Type:
Creator:
Paul Slauenwhite
Created:
2008-02-20 13:25:44 EST
Size:
9.51 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 20 Feb 2008 18:24:08 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -9,13 +9,13 @@ > * Contributors: > * IBM Corporation - initial API and implementation > **********************************************************************/ >- > package org.eclipse.hyades.internal.execution.recorder.ui.views; > > import org.eclipse.core.resources.IResourceStatus; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.Status; > import org.eclipse.hyades.execution.recorder.IRecorderListenerFullFeedback; >+import org.eclipse.hyades.internal.execution.recorder.ui.CopyAction; > import org.eclipse.hyades.internal.execution.recorder.ui.RecorderUIUtility; > import org.eclipse.hyades.internal.execution.recorder.ui.actions.StopRecordingAction; > import org.eclipse.hyades.test.core.internal.resources.TestCorePluginResourceBundle; >@@ -25,6 +25,9 @@ > 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.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,17 +37,28 @@ > 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; > > /** >- * Recorder Control View for receiving feedback and controlling recorders during recording >- * @author Ernest Jessee >+ * Recorder Control View for receiving feedback and controlling recorders during recording. >+ * >+ * >+ * @author Ernest Jessee >+ * @author Paul E. Slauenwhite >+ * @author Paul Klicnik >+ * @version February 20, 2008 >+ * @since February 1, 2005 > */ > public class RecorderControlView extends ViewPart implements ITestgenListener, IRecorderListenerFullFeedback > { >@@ -68,6 +82,16 @@ > */ > public static RecorderControlView instance=null; > >+ /** >+ * Setup the clipboard >+ */ >+ private Clipboard clipboard = null; >+ >+ /** >+ * Create the action for copying >+ */ >+ private CopyAction copyAction = null; >+ > > /** > * the view's ID >@@ -81,7 +105,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 +144,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 ); >+ } > } > > /** >@@ -166,10 +241,6 @@ > { > IWorkbenchPage page = window.getActivePage(); > instance = (RecorderControlView)page.showView(ID); >-// >-// if(view != null){ >-//// ...do something >-// } > } > catch(Exception e) > { >@@ -257,7 +328,8 @@ > */ > public void setFocus() > { >- >+ setSelectedLines(); >+ copyAction.setEnabled( statusList.getSelection().length == 0 ? false : true ); > } > > /** >@@ -320,7 +392,6 @@ > recStatus.setText(str); > } > }); >- } >- >- } >+ } >+ } > } >Index: src-recorder/org/eclipse/hyades/internal/execution/recorder/ui/CopyAction.java >=================================================================== >RCS file: src-recorder/org/eclipse/hyades/internal/execution/recorder/ui/CopyAction.java >diff -N src-recorder/org/eclipse/hyades/internal/execution/recorder/ui/CopyAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-recorder/org/eclipse/hyades/internal/execution/recorder/ui/CopyAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,61 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * $Id$ >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.internal.execution.recorder.ui; >+ >+import org.eclipse.jface.action.Action; >+import org.eclipse.swt.dnd.Clipboard; >+import org.eclipse.swt.dnd.TextTransfer; >+import org.eclipse.swt.dnd.Transfer; >+ >+/** >+ * Generic copy action. >+ * >+ * >+ * @author Paul E. Slauenwhite >+ * @author Paul Klicnik >+ * @version February 20, 2008 >+ * @since February 20, 2008 >+ */ >+public class CopyAction extends Action{ >+ >+ private Clipboard clipboard = null; >+ private String[] selectedItems = null; >+ >+ public CopyAction( Clipboard clipboardVal ) { >+ >+ super(); >+ >+ 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