Changeset 642

Show
Ignore:
Timestamp:
04/17/08 07:30:14 (8 months ago)
Author:
markd
Message:

Mark ocurrances Listeneer... I forgot to submit this patch

Location:
org.cfeclipse.cfml/trunk/src/org/cfeclipse/cfml/editors/dnd
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • org.cfeclipse.cfml/trunk/src/org/cfeclipse/cfml/editors/dnd/SelectionCursorListener.java

    r2 r642  
    289289    } 
    290290     
    291  
     291    public void mouseDoubleClick(MouseEvent e) {         
     292        //see comment below 
     293    } 
     294/* 
     295 *  
     296 * Commented for now because denny is using doubleClick in MarkOccurrencesListener 
     297 *  
    292298    /** 
    293299     * Sent when a mouse button is pressed twice within the  
     
    297303     * 
    298304     * @see org.eclipse.swt.widgets.Display#getDoubleClickTime() 
    299      */ 
     305     *//* 
    300306    public void mouseDoubleClick(MouseEvent e) { 
    301307         
     
    352358 
    353359            startpos = this.fViewer.getSelectedRange().x; 
    354             selectWord(startpos); 
    355         } 
    356          
    357  
    358     } 
    359  
    360      
    361     protected boolean selectWord(int caretPos)  
    362         { 
     360            selectWord(startpos, e); 
     361        } 
     362         
     363 
     364    } 
     365 
     366     
     367        protected boolean selectWord(int caretPos, MouseEvent e) { 
    363368 
    364369                IDocument doc = this.fViewer.getDocument(); 
    365370                int startPos, endPos; 
    366                  
    367                 try  
    368                 { 
     371                String normalWordChars = "-"; 
     372                String breakWordChars = "_"; 
     373                String wordChars = normalWordChars; 
     374                String altWordChars = "-."; 
     375                String shiftWordChars = "-_"; 
     376                try { 
     377                        if ((e.stateMask == SWT.ALT || e.stateMask == SWT.SHIFT + SWT.ALT)) { 
     378                                wordChars = wordChars + altWordChars; 
     379                        } 
     380                        if ((e.stateMask == SWT.SHIFT || e.stateMask == SWT.SHIFT + SWT.ALT)) { 
     381                                wordChars = wordChars + shiftWordChars; 
     382                                breakWordChars = ""; 
     383                        } 
     384 
    369385                        int pos = caretPos; 
    370386                        char c; 
    371387 
    372                         while (pos >= 0) 
    373                         { 
     388                        while (pos >= 0) { 
    374389                                c = doc.getChar(pos); 
    375                                 if(!Character.isJavaIdentifierPart(c) && c != '-') 
     390                                if (breakWordChars.indexOf(c) >= 0 || !Character.isJavaIdentifierPart(c) && wordChars.indexOf(c) < 0) 
    376391                                        break; 
    377392                                --pos; 
     
    383398                        int length = doc.getLength(); 
    384399 
    385                         while (pos < length)  
    386                         { 
     400                        while (pos < length) { 
    387401                                c = doc.getChar(pos); 
    388                                 if(!Character.isJavaIdentifierPart(c) && c != '-') 
     402                                if (breakWordChars.indexOf(c) >= 0 || !Character.isJavaIdentifierPart(c) && wordChars.indexOf(c) < 0) 
    389403                                        break; 
    390404                                ++pos; 
     
    395409                        return true; 
    396410 
    397                 }  
    398                 catch (BadLocationException x)  
    399                 { 
    400                         //? 
     411                } catch (BadLocationException x) { 
     412                        // ? 
    401413                } 
    402414 
    403415                return false; 
    404416        } 
     417 
    405418 
    406419        private void selectRange(int startPos, int stopPos)  
     
    412425 
    413426     
    414      
     427*/     
    415428     
    416429