|
From: Markus B. <mba...@us...> - 2005-08-18 22:02:50
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11183/src/org/rubypeople/rdt/internal/ui/infoviews Modified Files: RIView.java Log Message: Applied patch from Khaled Agrama: return focuses list, horizontal scrollbar, splitter between list and result page Index: RIView.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RIView.java 17 Aug 2005 17:38:20 -0000 1.3 --- RIView.java 18 Aug 2005 22:02:10 -0000 1.4 *************** *** 14,23 **** import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; - import org.eclipse.swt.events.MouseAdapter; - import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; --- 14,24 ---- import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; + import org.eclipse.swt.custom.SashForm; + import org.eclipse.swt.events.FocusAdapter; + import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; *************** *** 40,48 **** private boolean riFound = false; private PageBook pageBook; ! private Composite panel; private Label interpreterNeededLabel, riNotFoundLabel; private Text searchStr; private List searchList; private Browser searchResult; private java.util.List possibleMatches = new ArrayList(); private SearchValue itemToSearch = new SearchValue(); --- 41,50 ---- private boolean riFound = false; private PageBook pageBook; ! private SashForm form; private Label interpreterNeededLabel, riNotFoundLabel; private Text searchStr; private List searchList; private Browser searchResult; + private String riCmd = null; private java.util.List possibleMatches = new ArrayList(); private SearchValue itemToSearch = new SearchValue(); *************** *** 67,85 **** riNotFoundLabel = new Label( pageBook, SWT.LEFT | SWT.TOP | SWT.WRAP ); riNotFoundLabel.setText( InfoViewMessages.getString( "RubyInformation.ri_not_found") ); ! ! panel = new Composite(pageBook, SWT.NONE); ! GridLayout layout = new GridLayout(); ! layout.numColumns = 2; ! panel.setLayout(layout); ! ! GridData data = new GridData(GridData.FILL_HORIZONTAL); ! data.grabExcessHorizontalSpace = true; ! panel.setLayoutData(data); ! // Search String searchStr = new Text(panel, SWT.BORDER); ! data = new GridData(); ! data.widthHint = 150; data.horizontalAlignment = SWT.FILL; searchStr.setLayoutData(data); --- 69,82 ---- riNotFoundLabel = new Label( pageBook, SWT.LEFT | SWT.TOP | SWT.WRAP ); riNotFoundLabel.setText( InfoViewMessages.getString( "RubyInformation.ri_not_found") ); ! ! form = new SashForm(pageBook, SWT.HORIZONTAL); ! ! Composite panel = new Composite(form, SWT.NONE); ! panel.setLayout(new GridLayout(1, false)); ! // Search String searchStr = new Text(panel, SWT.BORDER); ! GridData data = new GridData(); data.horizontalAlignment = SWT.FILL; searchStr.setLayoutData(data); *************** *** 92,96 **** public void keyPressed(KeyEvent e) { super.keyPressed(e); ! if (e.keyCode == 16777218) { // sorry didn't find the SWT constant for down arrow searchList.setFocus(); } else if (e.keyCode == SWT.ESC) { --- 89,93 ---- public void keyPressed(KeyEvent e) { super.keyPressed(e); ! if (e.keyCode == 16777218 || e.keyCode == 13) { // sorry didn't find the SWT constant for down arrow searchList.setFocus(); } else if (e.keyCode == SWT.ESC) { *************** *** 100,113 **** }); ! // Match text ! data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); ! data.verticalSpan = 3; ! searchResult = new Browser(panel, SWT.BORDER); ! searchResult.setLayoutData(data); ! ! searchList = new List(panel, SWT.BORDER | SWT.V_SCROLL); ! data = new GridData(GridData.FILL_VERTICAL); ! data.widthHint = 150; ! data.verticalSpan = 2; searchList.setLayoutData(data); searchList.addSelectionListener(new SelectionListener() { --- 97,102 ---- }); ! searchList = new List(panel, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); ! data = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL); searchList.setLayoutData(data); searchList.addSelectionListener(new SelectionListener() { *************** *** 117,125 **** public void widgetSelected(SelectionEvent e) { ! String[] selection = searchList.getSelection(); ! String searchText = (selection.length > 0) ? selection[0] : ""; ! synchronized(itemToSearch) { itemToSearch.set(searchText); } } }); runtimeListener = new RubyRuntime.Listener() { public void selectedInterpreterChanged() { --- 106,123 ---- public void widgetSelected(SelectionEvent e) { ! showSelectedItem(); ! } ! }); ! searchStr.addFocusListener(new FocusAdapter() { ! public void focusGained(FocusEvent e) { ! searchStr.selectAll(); } }); + + // search result + searchResult = new Browser(form, SWT.BORDER); + + form.setWeights(new int[]{1, 3}); + runtimeListener = new RubyRuntime.Listener() { public void selectedInterpreterChanged() { *************** *** 147,151 **** initSearchList(); if( riFound ){ ! pageBook.showPage(panel); } } --- 145,149 ---- initSearchList(); if( riFound ){ ! pageBook.showPage(form); } } *************** *** 154,157 **** --- 152,162 ---- } } + + private void showSelectedItem() { + String[] selection = searchList.getSelection(); + String searchText = (selection.length > 0) ? selection[0] : null; + synchronized(itemToSearch) { itemToSearch.set(searchText); } + } + public void dispose() { *************** *** 216,223 **** String possibleMatch = (String) iter.next(); if (possibleMatch.indexOf(text) > -1 ) { ! searchList.add(possibleMatch); } } if (searchList.getItemCount() > 0) searchList.setSelection(0); } --- 221,229 ---- String possibleMatch = (String) iter.next(); if (possibleMatch.indexOf(text) > -1 ) { ! searchList.add(possibleMatch); } } if (searchList.getItemCount() > 0) searchList.setSelection(0); + showSelectedItem(); } *************** *** 226,230 **** */ public void setFocus() { ! panel.setFocus(); } --- 232,236 ---- */ public void setFocus() { ! form.setFocus(); } |