Loading ...
Sorry, an error occurred while loading the content.

[Clip] Re: Clips for Java

Expand Messages
  • Wayne VanWeerthuizen
    ... H= Compile Java ;// Get rid of old error file, so we don t get misled by seeing it around ^!SET %ErrorFile%=^$GetStdErrorName$ ^!DestroyDoc ^%ErrorFile%
    Message 1 of 9 , Jan 6, 2000
    • 0 Attachment
      Clint Tredway <CTredway@...> wrote:

      >Wayne,
      >Can you resend those clips for java?

      H="Compile Java"
      ;// Get rid of old error file, so we don't get misled by seeing it around
      ^!SET %ErrorFile%=^$GetStdErrorName$
      ^!DestroyDoc ^%ErrorFile%
      ;// Make sure source code is saved
      ^!Save
      ^!Set %File%=^**
      ;// Prepare a place to put the command's output
      ^!Set %DocIndex%=^$GetDocIndex$
      ^!Toolbar "New Document"
      ;// Compile the java applet
      ^!InsertText ^$GetOutput("C:\JDK\BIN\JAVAC -deprecation" "^%File%")$
      ;// Close the file if command produced no output.
      ^!If ^$GetTextSize$ > 1 SKIP
      ^!Close DISCARD
      ;// Check for an error file
      ^!IFFILEEXIST "^%ErrorFile%" DISPLAYERROR
      ;// No errors to refocus on source code document
      ^!SetDocIndex ^%DocIndex%
      ^!GOTO END
      ;// Load and display errors
      :DISPLAYERROR
      ^!OPEN ^%ErrorFile%
      ^!SetWordWrap ON
      ^!SOUND SystemExclamation



      H="Jump to source line from error file"
      ;// Find the line number
      ^!Select LINE
      ^!Find ": " SH
      ^!Jump Select_Start
      ^!Set %Position%="^$GetRow$:^$GetCol$"
      ^!Find ":" BS
      ^!Jump Select_End
      ^!SelectTo ^%Position%
      ^!Set %Line%="^$GetSelection$"
      ;// Find the filename for the source code
      ^!Jump Select_Start
      ^!MoveCursor -1
      ^!Select BOL
      ^!Set %File%="^$GetSelection$"
      ;// Open the source file
      ^!Open ^%File%
      ;// Position Cursor on line
      ^!Jump ^%Line%


      --
      Wayne M. VanWeerthuizen
      Homepage: http://landru.myhome.net/wayne
    • Clint Tredway
      Thanks..... ... From: Wayne VanWeerthuizen [mailto:wayne@myhome.net] Sent: Thursday, January 06, 2000 10:33 AM To: ntb-clips@egroups.com Subject: [Clip] Re:
      Message 2 of 9 , Jan 6, 2000
      • 0 Attachment
        Thanks.....

        -----Original Message-----
        From: Wayne VanWeerthuizen [mailto:wayne@...]
        Sent: Thursday, January 06, 2000 10:33 AM
        To: ntb-clips@egroups.com
        Subject: [Clip] Re: Clips for Java


        Clint Tredway <CTredway@...> wrote:

        >Wayne,
        >Can you resend those clips for java?

        H="Compile Java"
        ;// Get rid of old error file, so we don't get misled by seeing it around
        ^!SET %ErrorFile%=^$GetStdErrorName$
        ^!DestroyDoc ^%ErrorFile%
        ;// Make sure source code is saved
        ^!Save
        ^!Set %File%=^**
        ;// Prepare a place to put the command's output
        ^!Set %DocIndex%=^$GetDocIndex$
        ^!Toolbar "New Document"
        ;// Compile the java applet
        ^!InsertText ^$GetOutput("C:\JDK\BIN\JAVAC -deprecation" "^%File%")$
        ;// Close the file if command produced no output.
        ^!If ^$GetTextSize$ > 1 SKIP
        ^!Close DISCARD
        ;// Check for an error file
        ^!IFFILEEXIST "^%ErrorFile%" DISPLAYERROR
        ;// No errors to refocus on source code document
        ^!SetDocIndex ^%DocIndex%
        ^!GOTO END
        ;// Load and display errors
        :DISPLAYERROR
        ^!OPEN ^%ErrorFile%
        ^!SetWordWrap ON
        ^!SOUND SystemExclamation



        H="Jump to source line from error file"
        ;// Find the line number
        ^!Select LINE
        ^!Find ": " SH
        ^!Jump Select_Start
        ^!Set %Position%="^$GetRow$:^$GetCol$"
        ^!Find ":" BS
        ^!Jump Select_End
        ^!SelectTo ^%Position%
        ^!Set %Line%="^$GetSelection$"
        ;// Find the filename for the source code
        ^!Jump Select_Start
        ^!MoveCursor -1
        ^!Select BOL
        ^!Set %File%="^$GetSelection$"
        ;// Open the source file
        ^!Open ^%File%
        ;// Position Cursor on line
        ^!Jump ^%Line%


        --
        Wayne M. VanWeerthuizen
        Homepage: http://landru.myhome.net/wayne

        ------------------------------------------------------------------------
        Looking for educational tools for you kids?

        Find everything you need at SmarterKids.com
        http://click.egroups.com/1/645/3/_/2798/_/947176405

        -- Create a poll/survey for your group!
        -- http://www.egroups.com/vote?listname=ntb-clips&m=1
      • Wayne VanWeerthuizen
        I ve updated a clip that may be helpful to other programmers. Its purpose is for when you are looking at a list of compilation errors (loaded as a NoteTab
        Message 3 of 9 , Jan 11, 2000
        • 0 Attachment
          I've updated a clip that may be helpful to other programmers. Its
          purpose is for when you are looking at a list of compilation errors
          (loaded as a NoteTab document) you can use the clip to quickly and
          easily open a NoteTab document to the specific line of source code to
          which the error output refers. Just have your cursor anywhere in the
          error message before using the clip. The clip was developed for use
          with "javac", but it should also work with the output produced by many
          compilers for other languages.

          Here is an example with a sample of error output from a Java applet I'm
          working on: If I put my cursor near either instance of the word "zero"
          (Actually, anywhere on those two lines) the clip below opens IPC.java
          and positions the cursor on line 6032.


          C:\JavaProg\IPC.java:6030: Invalid expression statement.
          if ( IPC.fiftyWidget == widget ) IPC.fiftyWidget == null;
          ^
          C:\JavaProg\IPC.java:6032: Undefined variable: zero
          if ( widget.getAnchorOfMouse( x, y ) >= zero )
          ^
          2 errors


          This update stops NoteTab from printing error messages if the clip is
          accidentally used on a document that does not contain error message
          output, and allows the cursor to be placed on any line of the error
          message, instead of just the first. I don't expect it will need any
          more updates, unless something needs to be changed to make it work
          better with the output of other compilers that I've not yet tested.

          Now, here is the clip:


          H="Jump to Line from Error Output"
          :Redo
          ^!FocusDoc
          ; Look from current cursor position for something resembling:
          ; <Path and Filename><colon><number><colon><space>
          ^!Select LINE
          ^!Find ": " SH
          ^!IfError Error
          ^!Jump Select_Start
          ^!Set %Position%="^$GetRow$:^$GetCol$"
          ^!Find ":" BS
          ^!IfError Error
          ^!Jump Select_End
          ^!SelectTo ^%Position%
          ^!Set %Line%="^$GetSelection$"
          ; Line Number has been found.
          ^!Jump Select_Start
          ^!MoveCursor -1
          ^!Select BOL
          ^!Set %File%="^$GetSelection$"
          ; Filename has been found.
          ^!Open ^%File%
          ^!Jump ^%Line%
          ^!Goto Exit
          ; If we had an error, it means a find failed, which means the
          ; cursor was not on the first line of an error message. We back
          ; up a line and try again. (The -2 is because the above code
          ; moves the cursor down a during the search line.)
          :Error
          ^!If ^$GetRow$ < 2 Exit
          ^!Jump -2
          ^!Goto Redo



          --
          Wayne M. VanWeerthuizen
          Homepage: http://landru.myhome.net/wayne
        • Jody
          Hi Wayne, [NTB] Re: Customization of Headers and Footers when Printing Here is a work around for you, not much of one, but it will work. The ^$GetText$ will
          Message 4 of 9 , Jan 11, 2000
          • 0 Attachment
            Hi Wayne,

            [NTB] Re: Customization of Headers and Footers when Printing

            Here is a work around for you, not much of one, but it will work.
            The ^$GetText$ will not work when certain functions are in the doc
            as you know.

            H=Print
            ; ^!IfTrue ^$IsEmpty(^$GetText$")$ Error
            ^!Set %FileName%=^##
            ; one line
            ^!Keyboard Ctrl+P &100 Shift+Tab Right Right Right Alt+T #^%FileName% Printed by Wayne# Enter
            ; ^!Goto End

            ; :Error
            ; ^!Info You must focus a document to print.

            Happy Clip'n!
            Jody

            http://www.sureword.com/notetab

            The NoteTab Clip List...
            mailto:Ntb-Clips-Subscribe@...
            mailto:Ntb-Clips-UnSubscribe@...
          Your message has been successfully submitted and would be delivered to recipients shortly.