Implementing a "repeat command" function

I'm working on a text editor, with much the same functionality as vi. I'm kinda stuck on the "repeat last command" feature. My thought was to get the most recent undoable edit, and then call a redo on it, but that doesn't seem to be working. Any ideas?

I'm implementing undo/redo as outlined in this page
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html
which basically consists of...
1) create a new instance of UndoManager (defined in javax.swing.undo)
2) register the document object of the text area as an UndoableEditListener
3) implement undo and redo actions that extend AbstractAction (I copied these from the above page)
4) call the UndoManager's undo and redo methods from the undo and redo actions.
My idea for repeat was to call the UndoManager's editToBeUndone() method (the most recent edit) and call the redo() method of the UndoableEdit object that it returns. However, the editToBeUndone() method is protected, so I created a class that extends UndoManager and overrode the editToBeUndone() method as follows.
public UndoableEdit editToBeUndone(){
     return super.editToBeRedone();
This could be wrong, but I'm pretty sure I've done something similar before.
The other thing that could be a problem is the redo() method of the UndoableEdit class. In the API, it reads "Re-apply the edit, assuming that it has been undone." I don't really know what it means by, "assuming that it has been undone." Is there somewhere I can find a more detailed description? It doesn't throw a CannotRedoException.
What is an undoable edit and not undoable are (presumably) defined in javax.swing.undo also.
Thanks for your reply,
jt

Similar Messages

  • Error in  implementing the Export excel functionality

    Hi All,
    I have an issue an implementing the  "Exporting the Table data to Excel."
    My VC version is 7.0
    Portal version NW 2004s.
    By refering the following link, i have implemented Export To Excell functionality in VC.
    2) Another one that's in the Visual Composer WIKI:
    https://wiki.sdn.sap.com/wiki/display/VC/Exportingdatafrom+VC
    By refering to 7th page in the document. It is explained to add the data source object from the 'info' port and add the field called 'RAPTNAME'to the DATA source object.
    But the RFC object which i added to the story board, i havent find any 'info' port in my added RFC. But still i have added the data store object  and added field. then
    copied the following given formula in the document in  respective formula window ,Formula showin as valid. when i click on check button.
    copied formula :
    "pcd!3aportal_content!2fcom.sap.pct!2fplatform_a
    dd_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.b
    ex?QUERY=" & STORE@REPTNAME &
    "&BI_COMMAND_1-
    BI_COMMAND_TYPE=EXPORT&BI_COMMAND
    1-EXPORTFORMAT=XLS&BI_COMMAND_1-
    null="
    But when compile i have get any proble, when i deply it is giving the followin problem.
    Error in compiling Flex application: Error 1002: String literal was not properly terminated
    (D:\usr\sap\EPD\JC01\j2ee\cluster\server0\GUIMachine_Business_Packages\NewTestModel_28609\FLEX_COMPILATION_FOLEDR\AADMV.mxml:265)
    Error 1033: ')' expected
    (D:\usr\sap\EPD\JC01\j2ee\cluster\server0\GUIMachine_Business_Packages\NewTestModel_28609\FLEX_COMPILATION_FOLEDR\AADMV.mxml:266)
    Error 1205: The statement 'dd_ons' is incomplete.
    (D:\usr\sap\EPD\JC01\j2ee\cluster\server0\GUIMachine_Business_Packages\NewTestModel_28609\FLEX_COMPILATION_FOLEDR\AADMV.mxml:266)
    Error 1025: Left side of assignment operator must be variable or property.
    (D:\usr\sap\EPD\JC01\j2ee\cluster\server0\GUIMachine_Business_Packages\NewTestModel_28609\FLEX_COMPILATION_FOLEDR\AADMV.mxml:268)
    Error 1033: ':' expected
    can u tell me where is the problem
    My question is, Is that 'info' port is mandatory for implementing the export functionality?
    what is that 'info'port? what it contains?
    If i ask my ABAPER to add that 'info' port , he asked me , what is that, what  information i need to provide the to u in that?
    can any body provide information about 'info' port
    Regards
    Vijay

    Hi Benni,
    I am able to come out from the deployment error, i am able to run the application. After i run the application . once i click on the button 'ExportToExcel'  i am getting the following error.
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : N/A
    Component Name : N/A
    Could not find portal application com.sap.ip.bi.service.generic.
    Exception id: 05:32_01/05/07_0001_18800950
    See the details for the exception ID in the log file
    Can u please tell me what is the problem
    Regards
    Vijay

  • How do I repeat a function that starts immediately?

    Hi,
    I am using a Timer function to repeat a function however the function only begins (and repeats) after the period set eg. 5 seconds not immediately.
    Here is an example of the code:
    var myTimer:Timer = new Timer(2000,8);
    myTimer.addEventListener(TimerEvent.TIMER, timerListener);
    function timerListener (e:TimerEvent):void{
    trace("Timer is Triggered");
    myTimer.start();
    Is there any way to make the function start immediately then repeat?
    Thanks
    Chris

    after timer.start()
    add
    myTimer.dispatchEvent(new TimerEvent(TimerEvent.TIMER));
    this will trigger your function immediately

  • Implementation of type-ahead functionality in Endeca JSP Ref application

    Hi all,
    I am trying to implement the type-ahead functionality in Endeca jsp reference application which Oracle is shipping with it's products. The type-ahead functionality is not present by default. Can anyone help me to implement the same thing or provide sample code/strategy to achieve the desired results ?
    Basically typeahead functionality is present in Endeca Information's quick start's search box (EID) but not it JSP reference application .
    Waiting for the replies...
    Regards,
    Hoque

    Type-ahead functionality can mean different things and be implemented in different ways. It is usually based on what behavior your user-space would benefit from.
    In the commerce space, one popular use-case is to return Category matches based on what a user has started typing. Within Endeca, this boils down to doing a dimension search and having the Category dimension enabled for dimension search. If a user starts typing "cam", the type-ahead would then recommend:
    Category: Cameras
    You can match on multiple dimensions though, so long as they are enabled for dimension search. For example, if a user starts typing "ca", the type-ahead could return:
    Category: Cameras
    Brand: Canon
    Furthermore, this behavior can be extended by enabling Compound Dimension Search. Compound Dimension Search is enabled via a flag on the dgidx process and on your ENEQuery. It provides the following behavior. If a user searches for "canon cam", it would suggest:
    Category: Cameras + Brand: Canon
    Clicking on the type-ahead would return the intersection of Category = Cameras and Brand = Canon, eliminating a click if the user is after Canon brand Cameras.
    With regards to implementation, it basically boils down to an AJAX call to a service/URL that responds with dimension search results. Then populate an empty <div> with links.
    Other scenarios involve returning Product/Record matches instead of Dimension matches.
    Edited by: gose on Sep 11, 2012 8:31 AM

  • Implementing FTP SIZE command

    HI
    I am trying to implement the SIZE command in FTP. The RFC says that the return value of the SIZE command will depend on the current STRUCTURE , MODE and TYPE of data connection. However, it doenot say how . I have not been able to find anything on the net either. Does anyone have a working implementation of the SIZE command , taking into account all the above mentioned factors, or any idea of how the above factors affect the SIZE command return value? Any help would be highly appreciated.
    Thanks in Advance

    hi
    try getLocation() on each button. save this to file and when opening read the file applying the saved values to setLocation(...).
    try using perhaps property/value pairs for saving the values like this:
    firstbutton=0,0
    secondbutton=2,2
    then load this as a Properties object and apply the Point values
    Takis

  • Steps required to create apps to implement various web parts functionality

    I have office 365 E3 a/c.
    For a site we have to create few apps whoose required functionality is like
    1. Newsfeed Webpart
    2. Blog webpart (source is library)
    3. CQWP
    4. Carousel web part
    5. Calendar control
    Please tell all steps required to create apps for above mentioned functionality.
    What will be steps and plan for this?

    Hi,
    According to your post, my understanding is that you want to create apps to implement various web parts functionality.
    You can use CQWP in the SharePoint Online. You can refer to:
    When to use the Content Query Web Part or the Content Search Web Part in SharePoint - SharePoint Online for enterprises
    In addition, there are some great articles about other web part for your reference:
    Data Viewer App for SharePoint Online
    Corporate News App
    Creating a SharePoint Cloud Business App Step by Step!
    Blog - Deploy A LightSwitch Application To Office 365 / SharePoint Online (Provider Hosted)
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Repeat command in illustrator

    Hello,
    Is there a repeat command like the one you find in office (control+Y).
    My problem is that I have a bunch of objects in a page, each one is 100 pixels height, I want to change each one to 95.
    Any suggestions?
    By the way, is there any format painter like you have in office? The brush simbol.
    Thanks in advance!

    See this script: http://js4ai.blogspot.com/2012/01/set-all-things.html

  • Repeat on function in ME21N

    Hi,
    Could some one let me know how does this  Repeat On function work (available in account assignement tab) while creating Purchase order using T code ME21N ?
    Thanks
    ArunVijay D

    Hello,
      One of our users noticed that once the 'Repeat' option is turned on in ME21N on the Account Assignment tab, she cannot get it to turn off even for subsequent  purchase orders she creates.   One of our developers was able to duplicate this issue in our Develpment system as well.   We switch off the 'Repeat' (matchstick) under the Account Assignment tab for a line item, and then if we go to the next line, the 'Repeat' option shows as being on again.   Then if we create a second purchase order, this 'Repeat' option is automatically on also.
    We are on ERP 6.0 for EHP4 and have recently upgraded to Office 2007.
    Does anyone know how to turn this option off again so it doesn't automatically stay on for the user?  There doesn't seem to be any setting under the Personal Settings that would affect this.
    Thanks for any help on this.
    Cheryl
    Edited by: Cheryl Hellestad on Nov 3, 2010 5:32 PM

  • IPod repeat one function on the iPad is broken

    I have found that most of the time, the repeat one function when using the iPod function on my ipad just doesn't work. I know where the setting is (on the now playing page), and I select the little circle of two arrows with the 1 on it... and when it gets to the end of the song it goes right on to the next one- usually. Sometimes it works, I don't know why. I don't understand how hey screwed that up; it works just fine on my iPhone and every ipod I own.

    same here with iPad1 on 4.3.3.. quite annoying when you want one special song looping (e.g. as gaming background) - need to wait for the jump to the next song, jump back one manually, and then the loop works.
    I'll be experimenting around a bit to see whether it might depend on the song (file format, bought/ripped...), the issue seems too rare, at least Google turns up only a few hits, compared to other ipod bugs.

  • How to implement the barcode printing functionality working on the Prod.

    Hi,
    Can anyone help me "How to implement the barcode printing functionality working on the Prod".
    Thanks
    Gangadhara

    Check this link --> barcode

  • Mapping up arrow to repeat command on DBX

    Hi
    Anyone can help me how to map Up Arrow key to repeat commands when debugging using DBX on Solaris?
    Thanks

    This is a frequently asked question that I always thought
    was unsupported until today.
    # black magic to set arrow keys bindings
    # (thanks to Andrey Petrusenko for help)
    bind ^[[=prefix-1
    bind ^[[A=up-history
    bind ^[[B=down-history
    bind ^[[D=backward-char
    bind ^[[C=forward-char
    # clear screen on Ctrl-L
    bind -m ^L='/usr/bin/clear^J'

  • A non abstract child class must implement all pure virtual function of  parent abstract class in c++

    Hi,
    In Indesign SDK there is a class  IActionComponent having two pure virtual functions:
    virtual void
    UpdateActionStates(IActiveContext* ac, IActionStateList *listToUpdateGSysPoint mousePoint = kInvalidMousePoint, IPMUnknown* widget = nil) = 0;
    virtual void
    DoAction(IActiveContext* ac, ActionID actionID, GSysPoint mousePoint = kInvalidMousePoint, IPMUnknown* widget = nil)= 0;
    But, the child class
    class WIDGET_DECL CActionComponent : public IActionComponent
    implements only UpdateActionStates function and not DoAction function.
    There is no compilation error and the code is running fine..HOW
    Can some one please explain me?

    Oops!!! there is a small correction in my C++ program. The JunkMethod is being called from the constructor...like the following code.
    #include <iostream.h>
    #include <stdlib.h>
    class Base
        public:
            Base()
                cout<<"In Base Class constructor..."<<endl;
                JunkMethod();
            void JunkMethod()
                TestAbsFunc();
            virtual void TestAbsFunc()= 0;
    class TestAbstract:public Base
        public:
            TestAbstract()
                cout<<"In Extend Class constructor..."<<endl;
            void TestAbsFunc()
                cout<<"In TestAbsFunc...."<<endl;
    int main()
          TestAbstract test;
          return 0;
    }You can see the change in the constructor of the Base class. JunkMethod is being called, just to bluff the compiler to call the virtual method (so that it won't crib saying that abstract method cannot be called from the constructor). When Java is supporting this functionality without giving any errors, C++ gives errors when you call an abstract method from the constructor or fails to execute when I do some work around like this. Isn't it a drawback of abstract funcationality supported by C++ (I'm not sure if it's a drawback or not)
    Regards,
    Kalyan.

  • How to implement "First Page" command in WAD

    Hi there
    I have a bug in my code, in that if the user pages down a few times, then chooses to Display All Rows (option provided in dropdown), the code works correctly to display all rows, but starts at the point at which the user was ... not from row 1 as should be the case.
    In case this doesn't make sense :
    - Assume that the table shows 10 rows at a time
    - On first entry, rows 1-10 will be displayed
    - User presses the standard page-down button ... rows 11-20 now displayed
    - User now presses button to show all rows (say there are 30 rows in the query)
    - User now sees rows 11-30, with no paging functionality.
    I would like to add / insert an additional command which navigates to the first page, then shows all the rows, but I can't figure out how.
    I have tried setting DATA_ROW_FROM to 1, but that doesn't help.
    Please note that I can set the parameters to show all the rows, just need to be able to navigate to row 1 before I do that.
    Any ideas?
    Cheers,
    Andrew

    Come on ... nobody out there with an idea?

  • How to implement drag-and-drop functionality in xMII iGrid?

    Hi,
    Is it possible to implement the drag and drop functionality between two iGrids of xMII in an irpt page? If yes can anyone please explain how?
    Thanks in advance,
    Dipankar

    http://tool-man.org/examples/sorting.html
    You would have to be creative and do something like this.

  • How to implement the "add Phonetic" Function like indesign(japan edition)?

    In microsoft word, and adobe Indesign, in japanese edition,
    there is a very usefull function, that is "add phonetic", or "add ruby", to add phonetic at the top of words,
    I want to implement this function in Illustrator,
    but I don't have any idea how to do it.
    Can some one give me any prompt?

    for example:
    我  ====〉
    wo

Maybe you are looking for

  • T500 performanc​e loss and restart issue after low battery shutdown

    Hi, Some days ago I experienced a significant loss in performance of my T500. Unfortunately it seems to be a continuous loss and the games I play, e.g. empire total war that did run ok before are nearly unplayable at the moment. Additionally, when th

  • How to add two different page numbers in a single page

    How to add two different page numbers in a single page? One is for page number of the whole article, the other one is for page number for each chapter in the article.

  • 520 - Connection between mobile and computer

    I would like to upload music and videos to my Lumia 520. The OS on my computer (Windows XP SP3) always needs a support app., starts every kind of programs and doesn't recognize the mobile phone. Is it any opportunity to connect the phone to the noteb

  • Why is Siri not suported in New Zealand

    Why is Siri not suported in New Zealand

  • Help in BAPI_LIKP_PROCESS_MSG_DIRECT

    Hi,     I need to print a delivery. i have created a report program where user can select multiple delivery and click on print button. i need to print it using the BAPI_LIKP_PROCESS_MSG_DIRECT. Now every thing is working fine. but i am getting a popu