Changeset 148:b3dec671d1f7

Show
Ignore:
Timestamp:
08/24/08 16:40:25 (5 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwtx/jface/text/AbstractHoverInformationControlManager.d

    r147 r148  
    211211 */ 
    212212abstract public class AbstractHoverInformationControlManager : AbstractInformationControlManager { 
    213      
     213 
    214214    /** 
    215215     * The  information control closer for the hover information. Closes the information control as 
     
    218218     */ 
    219219    class Closer : IInformationControlCloser, MouseListener, MouseMoveListener, ControlListener, KeyListener, SelectionListener, Listener { 
    220          
     220 
    221221        /** The closer's subject control */ 
    222222        private Control fSubjectControl; 
     
    278278                        hBar.addSelectionListener(this); 
    279279                } 
    280                  
     280 
    281281                fDisplay= fSubjectControl.getDisplay(); 
    282282                if (!fDisplay.isDisposed()) { 
    283283                    fDisplay.addFilter(DWT.Activate, this); 
    284284                    fDisplay.addFilter(DWT.MouseWheel, this); 
    285                      
     285 
    286286                    fDisplay.addFilter(DWT.FocusOut, this); 
    287                      
     287 
    288288                    fDisplay.addFilter(DWT.MouseDown, this); 
    289289                    fDisplay.addFilter(DWT.MouseUp, this); 
    290                      
     290 
    291291                    fDisplay.addFilter(DWT.MouseMove, this); 
    292292                    fDisplay.addFilter(DWT.MouseEnter, this); 
     
    305305            fIsActive= false; 
    306306 
    307             if cast(DEBUG) 
     307            if (DEBUG) 
    308308                System.out_.println("AbstractHoverInformationControlManager.Closer stopped"); //$NON-NLS-1$ 
    309309 
     
    327327                fDisplay.removeFilter(DWT.Activate, this); 
    328328                fDisplay.removeFilter(DWT.MouseWheel, this); 
    329                  
     329 
    330330                fDisplay.removeFilter(DWT.FocusOut, this); 
    331                  
     331 
    332332                fDisplay.removeFilter(DWT.MouseDown, this); 
    333333                fDisplay.removeFilter(DWT.MouseUp, this); 
    334                  
     334 
    335335                fDisplay.removeFilter(DWT.MouseMove, this); 
    336336                fDisplay.removeFilter(DWT.MouseEnter, this); 
     
    409409            hideInformationControl(); 
    410410        } 
    411          
     411 
    412412        /* 
    413413         * @see dwt.events.SelectionListener#widgetDefaultSelected(dwt.events.SelectionEvent) 
     
    415415        public void widgetDefaultSelected(SelectionEvent e) { 
    416416        } 
    417          
     417 
    418418        /* 
    419419         * @see dwt.widgets.Listener#handleEvent(dwt.widgets.Event) 
     
    441441                    } 
    442442                    break; 
    443                      
     443 
    444444                case DWT.MouseUp: 
    445445                case DWT.MouseDown: 
     
    467467                                        }); 
    468468                                    } 
    469                                      
     469 
    470470                                    // XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212392 : 
    471471                                    control.getShell().getDisplay().asyncExec(new class()  Runnable { 
     
    489489                        hideInformationControl(); 
    490490                    break; 
    491                      
     491 
    492492                case DWT.MouseMove: 
    493493                case DWT.MouseEnter: 
     
    500500        /** 
    501501         * Handle mouse movement events. 
    502          *  
     502         * 
    503503         * @param event the event 
    504504         * @since 3.4 
    505505         */ 
    506506        private void handleMouseMove(Event event) { 
    507 //          if cast(DEBUG) 
     507//          if (DEBUG) 
    508508//              System.out_.println("AbstractHoverInformationControl.Closer.handleMouseMove():" + event); //$NON-NLS-1$ 
    509              
     509 
    510510            if (!(event.widget instanceof Control)) 
    511511                return; 
    512512            Control eventControl= cast(Control) event.widget; 
    513              
     513 
    514514            //transform coordinates to subject control: 
    515515            Point mouseLoc= event.display.map(eventControl, fSubjectControl, event.x, event.y); 
    516              
     516 
    517517            if (fSubjectArea.contains(mouseLoc)) 
    518518                return; 
    519              
     519 
    520520            IInformationControl iControl= getCurrentInformationControl(); 
    521521            if (!hasInformationControlReplacer() || !canMoveIntoInformationControl(iControl)) { 
     
    527527                return; 
    528528            } 
    529              
     529 
    530530            IInformationControlExtension3 iControl3= cast(IInformationControlExtension3) iControl; 
    531531            Rectangle controlBounds= iControl3.getBounds(); 
     
    640640            if (fIsComputing || fIsInRestartMode || 
    641641                    (fSubjectControl !is null && !fSubjectControl.isDisposed() && fSubjectControl.getShell() !is fSubjectControl.getShell().getDisplay().getActiveShell())) { 
    642                 if cast(DEBUG) 
     642                if (DEBUG) 
    643643                    System.out_.println("AbstractHoverInformationControlManager...mouseHover: @ " + event.x + "/" + event.y + " : hover cancelled: fIsComputing= " + fIsComputing + ", fIsInRestartMode= " + fIsInRestartMode); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
    644644                return; 
    645645            } 
    646              
     646 
    647647            fIsInRestartMode= true; 
    648648            fIsComputing= true; 
     
    674674            if (fIsComputing) 
    675675                return; 
    676              
     676 
    677677            fIsInRestartMode= false; 
    678678            if (fSubjectControl !is null && !fSubjectControl.isDisposed()) { 
     
    780780     * The thread that delays replacing of the hover information control. 
    781781     * To be accessed in the UI thread only! 
    782      *  
     782     * 
    783783     * @since 3.4 
    784784     */ 
    785785    private Job fReplacingDelayJob; 
    786      
     786 
    787787    /** 
    788788     * The {@link ITextViewerExtension8.EnrichMode}, may be <code>null</code>. 
     
    790790     */ 
    791791    private EnrichMode fEnrichMode; 
    792      
     792 
    793793    /** 
    794794     * Indicates whether we have received a MouseDown event and are waiting for a MouseUp 
     
    797797     */ 
    798798    private bool fWaitForMouseUp= false; 
    799      
     799 
    800800    /** 
    801801     * Creates a new hover information control manager using the given information control creator. 
     
    813813     * Tests whether a given mouse location is within the keep-up zone. 
    814814     * The hover should not be hidden as long as the mouse stays inside this zone. 
    815      *  
     815     * 
    816816     * @param x the x coordinate, relative to the <em>subject control</em> 
    817817     * @param y the y coordinate, relative to the <em>subject control</em> 
     
    820820     * @param blowUp If <code>true</code>, then calculate for the closer, i.e. blow up the keepUp area. 
    821821     *        If <code>false</code>, then use tight bounds for hover detection. 
    822      *  
     822     * 
    823823     * @return <code>true</code> iff the mouse event occurred in the keep-up zone 
    824824     * @since 3.4 
     
    827827        if (subjectArea.contains(x, y)) 
    828828            return true; 
    829          
     829 
    830830        IInformationControl iControl= getCurrentInformationControl(); 
    831831        if (( cast(IInformationControlExtension5)iControl  && !(cast(IInformationControlExtension5) iControl).isVisible())) { 
     
    840840        if ( cast(IInformationControlExtension3)iControl ) { 
    841841            IInformationControlExtension3 iControl3= cast(IInformationControlExtension3) iControl; 
    842              
     842 
    843843            Rectangle iControlBounds= subjectControl.getDisplay().map(null, subjectControl, iControl3.getBounds()); 
    844844            Rectangle totalBounds= Geometry.copy(iControlBounds); 
     
    849849                Geometry.expand(totalBounds, margin, margin, margin, margin); 
    850850            } 
    851              
     851 
    852852            if (!blowUp) { 
    853853                if (iControlBounds.contains(x, y)) 
    854854                    return true; 
    855                  
     855 
    856856                if (subjectArea.y + subjectArea.height < iControlBounds.y) { 
    857857                    // special case for hover events: subjectArea totally above iControl: 
     
    872872                    } 
    873873                    return false; 
    874                      
     874 
    875875                } else if (iControlBounds.x + iControlBounds.width < subjectArea.x) { 
    876876                    // special case for hover events (e.g. in overview ruler): iControl totally left of subjectArea 
     
    888888                    } 
    889889                    return false; 
    890                      
     890 
    891891                } else if (subjectArea.x + subjectArea.width < iControlBounds.x) { 
    892892                    // special case for hover events (e.g. in annotation ruler): subjectArea totally left of iControl 
     
    906906                } 
    907907            } 
    908              
     908 
    909909            // FIXME: should maybe use convex hull, not bounding box 
    910910            totalBounds.add(subjectArea); 
     
    914914        return false; 
    915915    } 
    916      
     916 
    917917    /** 
    918918     * Tests whether the given information control allows the mouse to be moved 
    919919     * into it. 
    920      *  
     920     * 
    921921     * @param iControl information control or <code>null</code> if none 
    922922     * @return <code>true</code> if information control allows mouse move into 
     
    926926        return fEnrichMode !is null && canReplace(iControl); 
    927927    } 
    928      
     928 
    929929    /* 
    930930     * @see dwtx.jface.text.AbstractInformationControlManager#hideInformationControl() 
     
    939939     * control replacer has been set with 
    940940     * {@link #setInformationControlReplacer(InformationControlReplacer)} . 
    941      *  
     941     * 
    942942     * @param mode the enrich mode 
    943943     * @since 3.4 
     
    947947        fEnrichMode= mode; 
    948948    } 
    949      
     949 
    950950    /* 
    951951     * @see dwtx.jface.text.AbstractInformationControlManager#replaceInformationControl(bool) 
     
    955955        super.replaceInformationControl(takeFocus); 
    956956    } 
    957      
     957 
    958958    /** 
    959959     * Cancels the replacing delay job. 
     
    965965            bool cancelled= fReplacingDelayJob.cancel(); 
    966966            fReplacingDelayJob= null; 
    967 //          if cast(DEBUG) 
     967//          if (DEBUG) 
    968968//              System.out_.println("AbstractHoverInformationControlManager.cancelReplacingDelay(): cancelled=" + cancelled); //$NON-NLS-1$ 
    969969            return cancelled; 
    970970        } 
    971 //      if cast(DEBUG) 
     971//      if (DEBUG) 
    972972//          System.out_.println("AbstractHoverInformationControlManager.cancelReplacingDelay(): not delayed"); //$NON-NLS-1$ 
    973973        return true; 
    974974    } 
    975      
     975 
    976976    /** 
    977977     * Starts replacing the information control, considering the current 
     
    979979     * If set to {@link ITextViewerExtension8.EnrichMode#AFTER_DELAY}, this 
    980980     * method cancels previous requests and restarts the delay timer. 
    981      *  
     981     * 
    982982     * @param display the display to be used for the call to 
    983983     *        {@link #replaceInformationControl(bool)} in the UI thread 
     
    986986        if (fEnrichMode is EnrichMode.ON_CLICK) 
    987987            return; 
    988          
     988 
    989989        if (fReplacingDelayJob !is null) { 
    990990            if (fReplacingDelayJob.getState() !is Job.RUNNING) { 
     
    995995                            replaceInformationControl(false); 
    996996                    } else { 
    997 //                      if cast(DEBUG) 
     997//                      if (DEBUG) 
    998998//                          System.out_.println("AbstractHoverInformationControlManager.startReplaceInformationControl(): rescheduled"); //$NON-NLS-1$ 
    999999                        fReplacingDelayJob.schedule(HOVER_AUTO_REPLACING_DELAY); 
     
    10031003            return; 
    10041004        } 
    1005          
     1005 
    10061006        fReplacingDelayJob= new Job("AbstractHoverInformationControlManager Replace Delayer") { //$NON-NLS-1$ 
    10071007            public IStatus run(final IProgressMonitor monitor) { 
     
    10231023        fReplacingDelayJob.setSystem(true); 
    10241024        fReplacingDelayJob.setPriority(Job.INTERACTIVE); 
    1025 //      if cast(DEBUG) 
     1025//      if (DEBUG) 
    10261026//          System.out_.println("AbstractHoverInformationControlManager.startReplaceInformationControl(): scheduled"); //$NON-NLS-1$ 
    10271027        fReplacingDelayJob.schedule(HOVER_AUTO_REPLACING_DELAY); 
     
    11081108        return fHoverEventStateMask; 
    11091109    } 
    1110      
     1110 
    11111111    /** 
    11121112     * Returns an adapter that gives access to internal methods. 
    11131113     * <p> 
    11141114     * <strong>Note:</strong> This method is not intended to be referenced or overridden by clients.</p> 
    1115      *  
     1115     * 
    11161116     * @return the replaceable information control accessor 
    11171117     * @since 3.4 
  • dwtx/jface/text/templates/TemplateVariableResolver.d

    r133 r148  
    123123        if (binding is null) 
    124124            return new String[0]; 
    125         return new String[] { binding }
     125        return [ binding ]
    126126    } 
    127127 
  • dwtx/jface/text/templates/TextTemplateMessages.d

    r147 r148  
    4545class TextTemplateMessages { 
    4646 
    47     private static const String RESOURCE_BUNDLE= TextTemplateMessages.class.getName(); 
    48     private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); 
     47//     private static const String RESOURCE_BUNDLE= TextTemplateMessages.class.getName(); 
     48    private static ResourceBundle fgResourceBundle;//= ResourceBundle.getBundle(RESOURCE_BUNDLE); 
     49 
     50    static this() { 
     51        fgResourceBundle = ResourceBundle.getBundle( 
     52            getImportData!("dwtx.jface.text.templates.TextTemplateMessages.properties")); 
     53    } 
    4954 
    5055    private this() { 
     
    5560            return fgResourceBundle.getString(key); 
    5661        } catch (MissingResourceException e) { 
    57             return '!' + key + '!'; 
     62            return '!' ~ key ~ '!'; 
    5863        } 
    5964    } 
    6065 
    61     public static String getFormattedString(String key, Object arg) { 
    62         return MessageFormat.format(getString(key), new Object[] { arg }); 
    63     } 
    64  
    65  
    66     public static String getFormattedString(String key, Object[] args) { 
     66    public static String getFormattedString(String key, Object[] args... ) { 
    6767        return MessageFormat.format(getString(key), args); 
    6868    } 
  • dwtx/jface/text/templates/persistence/TemplatePersistenceMessages.d

    r147 r148  
    3030class TemplatePersistenceMessages { 
    3131 
    32     private static const String RESOURCE_BUNDLE= TemplatePersistenceMessages.class.getName(); 
    33     private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); 
     32//     private static const String RESOURCE_BUNDLE= TemplatePersistenceMessages.class.getName(); 
     33    private static ResourceBundle fgResourceBundle;//= ResourceBundle.getBundle(RESOURCE_BUNDLE); 
     34 
     35    static this() { 
     36        fgResourceBundle = ResourceBundle.getBundle( 
     37            getImportData!("dwtx.jface.text.templates.persistence.TemplatePersistenceMessages.properties")); 
     38    } 
    3439 
    3540    private this() { 
     
    4045            return fgResourceBundle.getString(key); 
    4146        } catch (MissingResourceException e) { 
    42             return '!' + key + '!'; 
     47            return '!' ~ key ~ '!'; 
    4348        } 
    4449    } 
    4550 
    46     public static String getFormattedString(String key, Object arg) { 
    47         return MessageFormat.format(getString(key), new Object[] { arg }); 
    48     } 
    49  
    50     public static String getFormattedString(String key, Object[] args) { 
     51    public static String getFormattedString(String key, Object[] args...) { 
    5152        return MessageFormat.format(getString(key), args); 
    5253    } 
  • dwtx/jface/text/templates/persistence/TemplateReaderWriter.d

    r145 r148  
    331331            Assert.isTrue(false); 
    332332        } catch (TransformerException e) { 
    333             if (e.getException() instanceof IOException
     333            if (cast(IOException)e.getException()
    334334                throw cast(IOException) e.getException(); 
    335335            Assert.isTrue(false); 
  • dwtx/jface/text/templates/persistence/TemplateStore.d

    r146 r148  
    6262     * Set to <code>true</code> if property change events should be ignored (e.g. during writing 
    6363     * to the preference store). 
    64      *  
     64     * 
    6565     * @since 3.2 
    6666     */ 
     
    6868    /** 
    6969     * The property listener, if any is registered, <code>null</code> otherwise. 
    70      *  
     70     * 
    7171     * @since 3.2 
    7272     */ 
     
    116116        loadCustomTemplates(); 
    117117    } 
    118      
     118 
    119119    /** 
    120120     * Starts listening for property changes on the preference store. If the configured preference 
     
    122122     * {@link #stopListeningForPreferenceChanges()} to remove any listener and stop the 
    123123     * auto-updating behavior. 
    124      *  
     124     * 
    125125     * @since 3.2 
    126126     */ 
     
    144144            fPreferenceStore.addPropertyChangeListener(fPropertyListener); 
    145145        } 
    146          
    147     } 
    148      
     146 
     147    } 
     148 
    149149    /** 
    150150     * Stops the auto-updating behavior started by calling 
    151151     * {@link #startListeningForPreferenceChanges()}. 
    152      *  
     152     * 
    153153     * @since 3.2 
    154154     */ 
     
    159159        } 
    160160    } 
    161      
     161 
    162162    /** 
    163163     * Handles an {@link IOException} thrown during reloading the preferences due to a preference 
    164164     * store update. The default is to write to stderr. 
    165      *  
     165     * 
    166166     * @param x the exception 
    167167     * @since 3.2 
     
    264264     * @param data the template to remove 
    265265     */ 
    266     public void delete(TemplatePersistenceData data) { 
     266    public void delete_(TemplatePersistenceData data) { 
    267267        if (data.isUserAdded()) 
    268268            fTemplates.remove(data);