Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Partial fix for C-Build Console inability to copy contents to the clipboard

Added a selection changed listener to the textViewer managed by the C Build
View (BuildConsoleView.java).
This updates the state read by the tool bar menu items and now enables the
copy action when there is a selection made in the C-Build console.

Ctrl + A, now selects all text in the C-Build View
Ctrl + C, now copies the selection to the clipboard

Still working on enabling the popup menu.

-Judy


First diff ...
***
cvs diff -N -u "BuildConsoleAction.java"
  Index: BuildConsoleAction.java
  ===================================================================
  RCS file:
/home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BuildConsoleA
ction.java,v
  retrieving revision 1.1
  diff -u -r1.1 BuildConsoleAction.java
  --- BuildConsoleAction.java	26 Jun 2002 20:55:44 -0000	1.1
  +++ BuildConsoleAction.java	21 Oct 2002 20:18:39 -0000
  @@ -41,15 +41,12 @@
   	 * @see TextEditorAction
   	 */
   	public void update() {
  -
  -
  -		//boolean wasEnabled= isEnabled();
  +				
  +		boolean wasEnabled= isEnabled();
   		boolean isEnabled= (fOperationTarget != null &&
fOperationTarget.canDoOperation(fOperationCode));
  -		setEnabled(isEnabled);
  -
   
  -		/*if (wasEnabled != isEnabled) {
  -			firePropertyChange(ENABLED, wasEnabled ?
Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
  -		}*/
  +		if (wasEnabled != isEnabled) {
  +			setEnabled(isEnabled);
  +		}
   	}
   }

Second diff ...


***
cvs diff -N -u "BuildConsoleView.java"
  Index: BuildConsoleView.java
  ===================================================================
  RCS file:
/home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BuildConsoleV
iew.java,v
  retrieving revision 1.4
  diff -u -r1.4 BuildConsoleView.java
  --- BuildConsoleView.java	16 Oct 2002 20:14:22 -0000	1.4
  +++ BuildConsoleView.java	21 Oct 2002 20:19:36 -0000
  @@ -21,6 +21,8 @@
   import org.eclipse.jface.text.TextViewer;
   import org.eclipse.jface.util.IPropertyChangeListener;
   import org.eclipse.jface.util.PropertyChangeEvent;
  +import org.eclipse.jface.viewers.ISelectionChangedListener;
  +import org.eclipse.jface.viewers.SelectionChangedEvent;
   import org.eclipse.swt.SWT;
   import org.eclipse.swt.custom.StyledText;
   import org.eclipse.swt.graphics.Font;
  @@ -74,13 +76,25 @@
   
 
actionBars.setGlobalActionHandler(ITextEditorActionConstants.COPY,
fCopyAction);
 
actionBars.setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL,
fSelectAllAction);
  +		
  +		fTextViewer.addSelectionChangedListener(new
ISelectionChangedListener() {
  +            public void selectionChanged(SelectionChangedEvent e) {
  +                // ensures that the copyAction updates is doability when
the selections tate changes
  +                fCopyAction.update();
  +            }
  +        });
  +//		addTextListener(new ITextListener() {
  +//			public void textChanged(TextEvent event) {
  +//				fCopyAction.update();
  +//				fSelectAllAction.update();
  +//			}
  +//		});
   	}	
   		
   	/**
   	 * @see ViewPart#createPartControl
   	 */
   	public void createPartControl(Composite parent) {
  -		//fTextViewer= new TextViewer(parent,
SWT.V_SCROLL|SWT.H_SCROLL);
   		fTextViewer= new TextViewer(parent,
SWT.V_SCROLL|SWT.H_SCROLL|SWT.WRAP|SWT.MULTI);
 
fTextViewer.setDocument(CPlugin.getDefault().getConsoleDocument());
   		fTextViewer.addTextListener(new ITextListener() {


Back to the top