RE: jde-flymake

2004-03-13 Thread Sandip Chitale

Where to get jikes?

-Original Message-
From: Nascif Abousalh-Neto [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 08, 2004 6:51 AM
To: [EMAIL PROTECTED]
Subject: ANN: jde-flymake


Hi all,

I also posted an initial version of jde-flymake, which provides
extensions to Flymake (http://flymake.sourceforge.net/), an "on-the-fly
syntax checker for Emacs" created by Pavel Kobiakov.

Flymake comes with built-in support for Java but relies on Makefiles for
calling Jikes; this module relies instead on JDEE project variables,
removing the need to create Makefiles just for the purpose of using
Flymake.

NOTE: jde-flymake.el requires a patched version of flymake.el. The patch
have been submitted to the author. In the mean time you can get a
patched version on my download page.

Regards,
  Nascif

http://home.nc.rr.com/nascifandelaine/emacs.html



Two useful key bindings for jde mode

2003-03-01 Thread Sandip Chitale
Folks,
 
I thought you might find these useful.
 
The idea is that when you are changing the name of
a variable from say
 
bufferPosition
 
to
 
currentBufferPosition
 
using the default M-c binding (after inserting "current") is useless
because you will get
 
currentBufferposition.
 
With the following binding you will get
 
currentBufferPosition.
 
  (define-key jde-mode-map [(meta c)]
'(lambda () (interactive)   
(if (memq (get-char-property (point) 'face)
 '(font-lock-type-face
   font-lock-variable-name-face
   font-lock-function-name-face))
 (upcase-region (point) (1+ (point)))
  (capitalize-word 1)
  )
))
 
The idea is that when you are changing the name of
a variable from say
 
currentBufferPosition
 
to
 
bufferPosition
 
using the default M-l binding (after deleting "current") is useless
because you will get
 
bufferposition.
 
With the following binding you will get
 
bufferPosition.

  (define-key jde-mode-map [(meta l)]
'(lambda () (interactive)   
(if (memq (get-char-property (point) 'face)
   '(font-lock-type-face
  font-lock-function-name-face))
 (downcase-region (point) (1+ (point)))
  (downcase-word 1)
  )
))
 
 
 
enjoy,
sandip


Syntax error indication oon the fly....the beginning...

2003-02-22 Thread Sandip Chitale
Folks,
 
I had brought up this issue earlier...I took a first crack at
it.
It is still rough but with some expert help this could be completed...
Especially I need help with save-excursion and buffer selection etc...
 
For now -
 
1. Compile any java class such that it results in error messages
2. Switch to the *compilation* buffer
3. Invoke the following function animate-messages
 
(defun animate-messages()
  "Animate messages in *compilation* buffer."
  (interactive)
  (let* (
  (errorMarker (compilation-next-error-locus 1 t t))
  (compilation-error-overlay)
  )
(while errorMarker
  (let (
 (nextErrorMarker (compilation-next-error-locus 1 nil t))
 (errorBufferMarker (car errorMarker))
 errorString
 errorBegin
 errorEnd
 )
 (save-excursion
   (setq errorBegin (marker-position errorBufferMarker))
   (if nextErrorMarker
   (setq errorEnd (marker-position (car nextErrorMarker)))
 (setq errorEnd (point-max))
 )
   (setq errorString (buffer-substring errorBegin errorEnd))
   )
 (save-excursion
   (if (not (eq (current-buffer) (marker-buffer (cdr errorMarker
   (switch-to-buffer (marker-buffer (cdr errorMarker)))
 )
   (goto-char (marker-position (cdr errorMarker)))
   (if compilation-error-overlay
   (move-overlay compilation-error-overlay (line-beginning-position)
(line-end-position))
 (setq compilation-error-overlay
(make-overlay (line-beginning-position) (line-end-position)))
 )
   (overlay-put compilation-error-overlay 'face 'underline)
   (message errorString)
   (sit-for 3)
   )
 (setq errorMarker (compilation-next-error-locus 1 nil t))
 )
  )
(if compilation-error-overlay
 (delete-overlay compilation-error-overlay)
  )
(message "Done.")
)
  )
 
[NOTE: The above works for grep output also.]
 
4. This should animate the error messages i.e.
 
i. move the point to the location of error
ii. temporarily underline the line
iii. echo the error message in mini-buffer
 
What I want to do eventually is to hook this function to compilation
finish hook.
When there are compilation error messages the error messages are shown
in the
buffer with some overlay. The help-echo text property is used to show
the error meesage
in mini-buffer.
 
A background compilation may be invoked every so often or on demand
basis...
 
enjoy,
sandip

 
 


RE: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...

2003-02-19 Thread Sandip Chitale
A few more feature people might have missed are -

1. The output of the tool is hyperlinked. In other words by
putting the point on any java type in the output and hitting  key
Invokes the tool on that type.

2. It attempts to display values of static final variables (including
Private ones).

3. Additional bindings :

[(return)] 'jde-introspect-javatype-by-xref-at-point  ; run tool
on the class at point in the output buffer
[(control return)] 'jde-open-source-javatype-by-xref-at-point ; show
source of class at point in the output buffer
[(control shift return)] 'jde-help-javatype-by-xref-at-point  ; show
java doc of class at point in the output buffer
[(down-mouse-1)] 'jde-introspect-javatype-by-xref-at-point; mouse
based interface to above
[(C-down-mouse-1)] 'jde-open-source-javatype-by-xref-at-point ;
[(tab)] 'jde-introspect-next-ref  ; goto
next hyperlink 
[(shift tab)] 'jde-introspect-previous-ref; goto
previous hyperlink

Sandip

-Original Message-
From: Berndl, Klaus [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, February 19, 2003 2:07 AM
To: 'Sandip Chitale'; [EMAIL PROTECTED]
Subject: RE: Introspection based Java class browseralso demonstrates
alittle bit of java and lisp integration...


Hello,

attached is a small library ecb-jde.el which enables you to display the
contents of class at point in the method-window of ECB:

(defun ecb-jde-display-class-at-point ()
  "Displays in the ECB-methods-buffer the contents \(methods, attributes
etc...) of the class which contains the definition of the \"thing\"
under point \(this can be a variablename, classname, methodname,
attributename). This function needs the same requirements to work as the
method-completion feature of JDE \(see `jde-complete-at-point')!. The
source-file is searched first in `jde-sourcepath', then in
`jde-global-classpath', then in $CLASSPATH, then in current-directory."
  (interactive)
  ...
)

Just do:

1. Save ecb-jde.el somewhere in your load-path - probably best in the
   ecb-directory ;-)
2. Activate ECB
3. Open a java-source 
4. Load ecb-jde.el, e.g. with M-x load-library RET ecb RET
5. Try it.

Differences to Sandips code:

- uses ECB method-window to display the class-contents
- uses semantic for getting the contents of a class
- needs the source-file of the class to work

The first point can be seen as advantage or disadvantage ;-)

Especially the latter point is a disadvantage because it prevents from
working for classes which are only available as *.class-file or within a
jar-file...

But it demonstrates another elegant way of displaying things of a class
under point without needing java-introspection.

Klaus

-Original Message-
From: Sandip Chitale [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, February 19, 2003 7:32 AM
To: [EMAIL PROTECTED]
Subject: Introspection based Java class browseralso demonstrates
alittle bit of java and lisp integration...


>To use :
 
>1. unzip the attached zip at in the jde directory
>2. Just put the following in your .emacs

>(require 'jde-introspect)

>Now put the point anywhere in Java buffer where you would normally 
>invoke jde-complete functions. Then type (control c) (control v) (/) to

>see the java typeinfo buffer.
 
>For example:
 
>With point in the 'System' below :
>public class Foo {
> public static void main(String[] args) {
>  System.out.println(args.length);
> }
>}
>here is what you get in a temp buffer. All the java class names are 
>hyperlinks (activated by mouse or  key).
>class java.lang.System





Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...

2003-02-18 Thread Sandip Chitale
To use :
 
1. unzip the attached zip at in the jde directory
2. Just put the following in your .emacs

(require 'jde-introspect)

Now put the point anywhere in Java buffer where you would
normally invoke jde-complete functions. Then type
(control c) (control v) (/) to see the java typeinfo
buffer.
 
For example:
 
With point in the 'System' below :
public class Foo {
 public static void main(String[] args) {
  System.out.println(args.length);
 }
}
here is what you get in a temp buffer. All the java class names are
hyperlinks (activated by
mouse or  key).
class java.lang.System
/**
 * Constructors of class System
 **/
private   System()
/**
 * Methods of class System
 **/
public static native  void arraycopy(Object, int, Object, int,
int)
public static native  int identityHashCode(Object)
public static void exit(int)
public static void runFinalizersOnExit(boolean)
private staticvoid initializeSystemClass()
public static String setProperty(String, String)
private static native void registerNatives()
public static SecurityManager getSecurityManager()
staticClass getCallerClass()
public static void loadLibrary(String)
public static String getProperty(String)
public static String getProperty(String, String)
public static native  String mapLibraryName(String)
public static void load(String)
public static void setIn(InputStream)
public static void setOut(PrintStream)
public static void setErr(PrintStream)
private staticvoid checkIO()
private static native void setIn0(InputStream)
private static native void setOut0(PrintStream)
private static native void setErr0(PrintStream)
public static void setSecurityManager(SecurityManager)
private static synchronized   void setSecurityManager0(SecurityManager)
public static native  long currentTimeMillis()
private static native Properties initProperties(Properties)
public static Properties getProperties()
public static void setProperties(Properties)
public static String getenv(String)
public static void gc()
public static void runFinalization()
private staticInputStream nullInputStream() throws
NullPointerException
private staticPrintStream nullPrintStream() throws
NullPointerException
/**
 * Fields of class System
 **/
public final static   InputStream in 
public final static   PrintStream out 
public final static   PrintStream err 
private staticSecurityManager security 
private staticProperties props 
 



jde.zip
Description: Zip compressed data


CODE: some useful defuns

2003-02-08 Thread Sandip Chitale
Title: Message


(require 'jde-package)(defun jde-buffer-package-name ()  "Copy the buffer's package name to `kill-ring."  (interactive)  (let ( (package-name (jde-package-convert-directory-to-package (jde-package-best-package-candidate(jde-package-seach-package-directories )    (kill-new package-name)    (message package-name)    )  )(defun jde-buffer-class-name ()  "Copy the buffer's class name to `kill-ring."  (interactive)  (let ( (package-name (jde-package-convert-directory-to-package (jde-package-best-package-candidate(jde-package-seach-package-directories (class-name (file-name-sans-extension (file-name-nondirectory (buffer-file-name )    (cond  ((eq package-name jde-package-unknown-package-name) (progn (kill-new class-name) (message class-name))) ((= 0 (length package-name)) (progn (kill-new class-name) (message class-name))) (t (progn (kill-new (concat package-name "." class-name)) (message (concat package-name "." class-name )    )  ) Do people find this useful ? Are they worth integrating into JDEE ? sandip  


jde-gen-cflow-BLAH and c-indent-defun

2003-02-07 Thread Sandip Chitale
Title: Message



Folks,
 
Many of the 
jde-gen-cflow-BLAH templates call the the 
c-indent-defun
at the 
end.
 
I find it 
obstructive for following reasons...
 
1. I use 
jde-mode for editing JSP code. It works very 
well
after adding 
the following keyword regexps.
   (font-lock-add-keywords 'jde-mode '(   ("%>\\([^.]*?\\)<%" 1 font-lock-comment-face t)   ("<[^%].*?[^%]>" 0 jde-java-font-lock-bold-face t)   ("<[_a-zA-Z0-9]+:.*/?>" 0 font-lock-function-name-face t)   ("" 0 font-lock-function-name-face t)   ("<%@.*%>" 0 jde-java-font-lock-api-face t)   ("\\(<%=\\).*\\(%>\\)"    (1 jde-java-font-lock-bold-face t)    (2 jde-java-font-lock-bold-face t)    )   ("\\(<%@\\s +page\\s +\\)\\(import\\)\\(\\s *=\\s *\"\\)\\([,a-zA-Z._0-9*]+\\)\\(\"\\s *?%>\\)"    (1 jde-java-font-lock-api-face prepend)    (2 font-lock-keyword-face prepend)    (3 jde-java-font-lock-api-face prepend)    (4 jde-java-font-lock-package-face prepend)    (5 jde-java-font-lock-api-face prepend)    ) )   )
However after 
using jde-gen-cflow-BLAH my non-java code gets 
indented.
 
2. In a 
multi-developer scenario, where any fixed indentation style is 
not
followed and 
especially in bug fix mode... I want to only change 
the
line that I 
fix. I do not want to indent other people's code in the method 
body.
 
What will it 
take to make that optional (i.e. dependent on customization) 
?
 
In fact I see 
three different choices here.
 
1. Do not call 
c-indent-defun at all
2. Only call 
the indent on the lines that are result of the expansion of 
the
template.
3. The current 
behavior.
 
Anyone 
thoughts ?
 
-sandip


RE: Dead code detection?

2002-09-06 Thread Sandip Chitale

If you mean in JDEE when you say "if there is a way to detect
unused code" I do not think so. 

It could be done though, using semantic and static analysis.
I am not sure if semantic parses the method bodies though.
Some code may present itself as used but may not get actually
called e.g. overridden methods, classes loaded using Class.forName().

There are tools out there which will analyze the coverage.
There was one called JCover from sun labs.

-sandip

> -Original Message-
> From: otisg [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 06, 2002 8:38 AM
> To: [EMAIL PROTECTED]
> Subject: Dead code detection?
> 
> 
> Hello,
> 
> I was wondering if there is a way to detect
> unused code in a set of Java .java or .class
> files, using JDE.
> Unused code would be things such as
> variables that are never referenced, methods
> that are never called, classes that are
> never referenced nor instantiated, etc.
> 
> Thanks,
> Otis
> 
> 
> 
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 



RE: updating interfaces

2002-08-29 Thread Sandip Chitale

I think there is some code in jde-wiz-get-set-methods in jde-wiz.el
to check if getters and setters for a given property already exist
and not generate them again. A similar strategy could be applied to
achieve the result you want. It basically uses semantic.el.

-sandip


> -Original Message-
> From: matthew yee-king [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 29, 2002 4:12 AM
> To: [EMAIL PROTECTED]
> Subject: updating interfaces
> 
> 
> Hello
> 
> I would like to know if it is possible to update the set of method
> skeletons that are generated when implementing an interface.
> 
> i.e. 
> 
> I write an interface. 
> I write a class that implements that interface (when i create this
> class, all the required methods are generated for me by jde)
> i add a new method to the interface (bad practice maybe - but what if
> i'm just making loads of skeleton classes at the beginning of 
> a project?
> )
> - can i automatically add this new method to my class?
> 
> cheers
> 
> matthew
> 



RE: wrap compiler output lines

2002-08-28 Thread Sandip Chitale

Have you looked at the compilation-mode-hook and use the -
*Docstring*
hscroll-mode is an interactive compiled Lisp function in `hscroll'.
(hscroll-mode &optional ARG)

This function is obsolete.
Emacs now does hscrolling automatically, if `truncate-lines' is non-nil.
Also see `automatic-hscrolling'.
*Docstring*

Actually wrapping lines should have been the default (unless you are
settting
it otherwise in your .emacs).

HTH,
sandip

> -Original Message-
> From: Marcel Schepers [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 28, 2002 2:31 AM
> To: [EMAIL PROTECTED]
> Subject: wrap compiler output lines
> 
> 
> Does anyone know how to wrap the compiler output so that scrolling in 
> the output window wouldn't be necessary anymore?
> 
> Thanks,
> Marcel
> 



RE: Suppressing compilation buffer

2002-08-12 Thread Sandip Chitale

Can the 'compilation-old-error-list' or 'compilation-error-list' variables
be used to detect presence or absense of error messages in the compilation
buffer instead of string-match in the code below ?

Here are the doc strings for the variables -

compilation-old-error-list's value is nil

Documentation:
Value of `compilation-error-list' after errors were parsed.

Defined in `compile'.

compilation-error-list's value is nil

Documentation:
List of error message descriptors for visiting erring functions.
Each error descriptor is a cons (or nil).  Its car is a marker pointing to
an error message.  If its cdr is a marker, it points to the text of the
line the message is about.  If its cdr is a cons, it is a list
((DIRECTORY . FILE) LINE [COLUMN]).  Or its cdr may be nil if that
error is not interesting.

The value may be t instead of a list; this means that the buffer of
error messages should be reparsed the next time the list of errors is
wanted.

Some other commands (like `diff') use this list to control the error
message tracking facilities; if you change its structure, you should make
sure you also change those packages.  Perhaps it is better not to change
it at all.

Defined in `compile'.

regards,
sandip

--
Sandip V. Chitale   181, Metro Drive
Principal Software Engineer San Jose, CA 95110, USA
work:  (408) 535 1791   Suite 600
email: [EMAIL PROTECTED]  web: http://www.fairisaac.com

Original message:
-

I added this to my .emacs ... It displays the compile buffer for a few
seconds, but if there are no errors removes the compile buffer.


(defun my-jde-compile-fin-hook (buf str)
  " Removes the jde-compile window after a few seconds if no errors "
  (if (null (or (string-match ".*exited abnormally.*" str) 
(string-match ".*BUILD FAILED.*" str)))
  ;;no errors, make the compilation window go away in a few seconds
  (progn
(run-at-time
 "2 sec" nil 'delete-windows-on
 (get-buffer-create "*compilation*"))
(message "No compilation errors"))
;;there were errors, so jump to the first error
(next-error)))



Add the method to "jde-compile-finish-hook".

(jde-compile-finish-hook (quote (jde-compile-finish-refresh-speedbar
jde-compile-finish-flush-completion-cache my-jde-compile-fin-hook)))



Is there jde-make-finish-hook analogous to jde-compile-finish-hook

2002-08-01 Thread Sandip Chitale

If not, what is the best way to implement it ?



RE: compilation error

2002-06-06 Thread Sandip Chitale


> We do need to support spaces in the CLASSPATH (third-party
> libraries and all that), but I'd rather not see a lot of
> effort going into making JDEE support this when the
> workaround is simply to work in a directory other than
> "C:\Program Files" and
> "C:\Documents and Settings\xxx\My Documents"

I think the point is being missed here. It may not be in one's
control whether to work in classpath directories with spaces
in their names or not - pecisely because -

1. third-party libraries
2. conventions on MS Windows as to where apps are installed.
3. company installation standard
...

I think it should be supported, even though it may be tricky as one
is never sure as to how the quoting rules work precisely in the
cmd.exe. bash.exe quoting may be better documented. JDEE has to
support cmd.exe, bash.exe or any other shell.



RE: speedbar and auto-moving of my mouse pointer

2002-05-31 Thread Sandip Chitale



Yes...I experience this also...only after activating the ECB mode 
though...
 

  -Original Message-From: Jim Snyder 
  [mailto:[EMAIL PROTECTED]]Sent: Friday, May 31, 2002 8:03 
  AMTo: Paul KinnucanCc: [EMAIL PROTECTED]Subject: 
  speedbar and auto-moving of my mouse pointer
  Dear Paul...
   
  In my current version of JDEE, when I select a 
  .java file from the speedbar, jdee properly loads the file, however my mouse 
  cursor gets automatically moved to emacs' upper right corner. 
   
  Is this auto-moving of my mouse cursor part of 
  speedbar? If so, how can I turn it off?
   
  BTW, this happens when my X-server is either 
  linux redhat 7.2 and exceed 7.0 in which I've used for over the last 6 months 
  but this auto-moving has been occurring for the last 1-2 months.
   
   
  SunOS 5.8 Generic_108528-14 sun4u sparc 
  SUNW,Ultra-2
   
  EMACS 20.7.1
   
  JDE_ELIB_VERSION=1.0JDE_EIEIO_VERSION=0.17beta4JDE_ECB_VERSION=1.31JDE_COGRE_VERSION=0.2JDE_VERSION=2.2.9beta9.1JDE_SPEEDBAR_VERSION=0.14beta3JDE_SEMANTIC_VERSION=1.4beta14JDE_EDE_VERSION=1.0.beta2
   
  Thanks...Jim
   
  Jim SnyderChief 
  ScientistCopper Key Technologies402 High Point Dr., #201Cocoa, FL. 
  32926www.copperkey.com321.635.8194[EMAIL PROTECTED]


Ick - an Import Check tool...I know there is some interest in this in the jdee community...

2002-05-23 Thread Sandip Chitale

Ick, derived from Import Check, is an import management tool for Java
programs written in Java

http://www.ovmj.org/ick/



closing bracket automatically.

2002-04-05 Thread Sandip Chitale

Not a JDEE question really

Anyhow...here it goes...

(defun electric-open-delimeter ()
  "Automatically insert matching delimeter."
  (interactive)
  (self-insert-command 1)
  (let* ((arg (elt (recent-keys) 99))
(key-match (assoc arg '((?\( . ?\)) (?\{ . ?\}) (?\[ . ?\]) (?\" .
?\") (?\' . ?\') (?\< . ?\>
)
(if key-match
(progn
  (insert (cdr key-match))
  (backward-char)
  ) 
  )
)
  )
(local-set-key (kbd "(")  'electric-open-delimeter)
(local-set-key (kbd "{")  'electric-open-delimeter)
(local-set-key (kbd "[")  'electric-open-delimeter)
(local-set-key (kbd "\"") 'electric-open-delimeter)
(local-set-key (kbd "'")  'electric-open-delimeter)
(local-set-key (kbd "<")  'electric-open-delimeter)



FW: jde-open-class-source from field not classname

2002-04-03 Thread Sandip Chitale

Are you looking for the following ?
 
(jde-open-class-source (jde-complete-eval-type-of (car
(jde-complete-java-variable-at-point


> > > -Original Message-
> > > From: Ralph Jocham [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, April 03, 2002 2:57 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: jde-open-class-source from field not classname
> > > 
> > > 
> > > Hi All,
> > > c-c c-v c-y finds and opens the source from a class.
> > > For that you have to have the cursor over the
> > > classname.
> > > c-c c-v c-. works on a field, which is cool.
> > > Is it possible to have the c-c c-v c-y functionality
> > > when the cursor is on a field. I guess, since c-c c-v
> > > c-. does it already it should be possible.
> > > 
> > > Thanks,
> > > Ralph
> > > 
> > > __
> > > Do You Yahoo!?
> > > Yahoo! Tax Center - online filing with TurboTax
> > > http://taxes.yahoo.com/
> > > 
> > 
> 



RE: jde-open-class-source fails with full class name

2002-04-03 Thread Sandip Chitale

Here is my stab at fixing "jde-open-class-source fails with full class
name".
This also deals with some of the proposals I had made earlier.

(defun jde-normalize-class-name (class-name)
  "Normalize the class name by substituting / or \\ with ."
  (substitute ?. ?\\ (substitute ?. ?/ class-name))
)

(defun jde-open-class-source ( &optional unqual-class )
  "Displays source of the class whose name appears at point in the current
Java buffer. This command finds only classes that reside in the source paths
specified by `jde-db-source-directories'. You should provide a global
setting
for this variable in your .emacs file to accommodate source files that are
not associated with any project."
  (interactive)
  (condition-case err
  (let* ((unqualified-name 
  (jde-normalize-class-name (or unqual-class
  (read-from-minibuffer "Class: " (thing-at-point
'symbol)
 (class-names
  (if (position ?. unqualified-name)
  (list unqualified-name)
;;expand the names into full names, or a list of names
(jde-jeval-r 
 (concat 
  "jde.util.JdeUtilities.getQualifiedName(\"" 
  unqualified-name "\");"
 )
;;Check return value of QualifiedName
(if (or (eq class-names nil)
(not (listp class-names)))
(error "Cannot find %s" unqualified-name))
;; Turn off switching project settings to avoid 
;; resetting jde-db-source-directories.
(let ((old-value jde-project-context-switching-enabled-p))
  (setq jde-project-context-switching-enabled-p nil)
  ;;If the list is only one long
  (if (eq 1 (length class-names))
  ;;then show it
  (progn(other-window 1)
(jde-find-class-source (car class-names)))
  ;;else let the user choose
(let ((class (efc-query-options class-names "Which class?")))
  (if class
  (jde-find-class-source class
  (setq jde-project-context-switching-enabled-p old-value)))
(error
 (message "%s" (error-message-string err)



Re: jde-open-class-source fails with full class name

2002-04-02 Thread Sandip Chitale

This has troubled me also. I never got around to
raizing the issue or attempting to solve it.

In fact the jde-open-class-source when called
interactively should support all these forms -

Object   // search on classpath, prompt if multiple
java.lang.Object // bypass jde.util.JdeUtilities.getQualifiedName(String className)
java/lang/Object // 
java\lang\Object // the above two so that even file system based
 // typically cut from some other place.

or even

bar$innerClass
foo.baz.bar$innerClass
foo/baz/bar$innerClass
foo\baz\bar$innerClass

should also be supported. The function should
simpy locate the bar.java first and then go to innerClass
definition within it.

I will give it a try when I find time. Others are welcome
to try it.

-sandip

- Original Message - 
From: "Letourneau, Sylvain" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 7:25 PM
Subject: jde-open-class-source fails with full class name


> It seems that some functions call jde-open-class-source with a fully
> qualified class name as argument and that makes it fail with a "Cannot find
> %s" message.  
> 
> As an example, the error happens with jde-show-superclass-source when the
> super class is fully qualified (e.g.: class MyClass extends
> java.lang.Object).  I also noticed the same problem with ECB.
> 
> It seems that jde-open-class-source fails because
> jde.util.JdeUtilities.getQualifiedName(String className) returns nil when
> the input is already a fully qualified name. Is there already a fix for
> this?  If not, what would be the preferred fix: 
> 1) in jde-open-class-source (an extra check before calling getQualifiedName)
> 2) jde.util.JdeUtilities.getQualifiedName(String className) (a special
> processing when the given className contains ".")
> 3) other?
> 
> Thanks, 
> Sylvain
> 




RE: Compilation window

2002-04-02 Thread Sandip Chitale

compilation-scroll-output's value is nil

Documentation:
*Non-nil to scroll the *compilation* buffer window as output appears.

Setting it causes the compilation-mode commands to put point at the
end of their output window so that the end of the output is always
visible rather than the beginning.

> -Original Message-
> From: Molitor, Stephen [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 1:04 PM
> To: '[EMAIL PROTECTED]'
> Subject: Compilation window
> 
> 
> Not sure if this is a JDE question or not, but:
> 
> How do I get the cursor to always go to the end of the 
> compilation buffer
> when compiling?  I don't like having to do 'other-window, 
> 'end-of-buffer to
> see the end of the compilation messages.  Would 
> jde-compile-finish-hook be a
> good place to put this?
> 
> Thanks.
> 
> Steve Molitor
> [EMAIL PROTECTED]
> 



Some useful defuns...

2002-03-28 Thread Sandip Chitale

Some useful defuns...

(defun jde-show-superclass-source () 
  "Show the superclass source."
  (interactive)
  (let ((tokens (semantic-token-type-parent-superclass
(semantic-current-nonterminal-of-type 'type
(if tokens
(if (= (length tokens) 1)
(jde-show-class-source (car tokens))
  (jde-show-class-source (x-popup-menu t
(bookmark-menu-build-paned-menu "Super Class" tokens)))
  )
  (jde-show-class-source "Object")
  )
)
  )

(defun jde-show-interface-source () 
  "Show the interface source."
  (interactive)
  (let ((tokens (semantic-token-type-parent-implement
(semantic-current-nonterminal-of-type 'type
(if tokens
(if (= (length tokens) 1)
(jde-show-class-source (car tokens))
  (jde-show-class-source (x-popup-menu t
(bookmark-menu-build-paned-menu "Interface" tokens)))
  )
  )
)
  )

(define-key jde-mode-map [(control c) (control v) (control e)]
'jde-show-superclass-source)
(define-key jde-mode-map [(control c) (control v) (control i)]
'jde-show-interface-source)  



RE: placement of member variables in get-set generator

2001-12-20 Thread Sandip Chitale

Eric,

> -Original Message-
> From: Eric D. Friedman [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 20, 2001 8:24 AM
> To: JDE List
> Subject: placement of member variables in get-set generator
> 
> 
> 
> Does anyone have any idea what it would take to change M-x 
> jde-gen-get-set
> so that it would place the member variable at the top (or bottom) of
> the class but put the generated methods at point?

If I am not mistaken, the jde-gen-get-set does not generate the member
variables. Instead it generates the getters and setters based on existing
member variables. Did you mean to say that the wizard should *move*
the member variables to the top (or bottom) of the class in case they were
not already in
the right place ? I guess, what I am saying is that, this may not be
required as
the user can insert the member variables in the right place in the first
place.

Come to think about it there could be a separate command to move all (or by
accesor type)
the member variables to the top (or bottom) based on customizable setting.
There could
be other customizable ability sort/oragnize by name, or attributes like
'static', 'final'

What do people think ?

cheers,
-sandip



Rename the jde_meta.html buffer

2001-12-18 Thread Sandip Chitale

Folks,

Should the buffer corresponding to the temporary file "jde_meta.html"
be renamed to, say - "*jde_meta.html*" in the jde-help-show-class-member-doc
function in jde-help.el, so that many buffer cycling packages skip over that
buffer ?

-sandip



RE: How to set current working directory?

2001-10-05 Thread Sandip Chitale

Paul,

This is one of those bugs people have been complaining
about since Java came out. I am not sure what they mean by
"one more way for a multithreaded program to go awry, as
well as introduce incompatibilities". There are
multi-threaded non-java programs that work with System call
chdir() (or its equivalent). I don't get it. If it is
JVM implementation shortcoming they should fix it but
not call it an RFE (request for enhancement).

Being able to change the notion of current directory of the
process is fundamental concept in most modern OSes.

Here is the RFE that describes the problem -

http://developer.java.sun.com/developer/bugParade/bugs/4045688.html

There are more such issues in other area of Java i.e. AWT and Swing
(Drag and Drop and Clipboard etc) which frustrate me, because
it stops me from implementing apps in Java which are *atleast*
as good as apps written in other languages. The customers
don't care when one tells them JVM doesn't support something that's
why the functionality is missing...they say then use C/C++ or whatever
other language...

-sandip

> -Original Message-
> From: Paul Kinnucan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 05, 2001 4:38 AM
> To: [EMAIL PROTECTED]
> Subject: How to set current working directory?
> 
> 
> Hi all,
> 
> Is there any way to set the current working directory in 
> Java.  I want to be able to change the beanshell's current 
> directory to the directory of the current source buffer so I 
> don't need to specify the full path of the source file to be 
> compiled. The beanshell has a cd command but it does not 
> appear to work.
> 
> - Paul
> 



Problems with JDE 2.2.9beta1 and jde-db-debugger

2001-09-29 Thread Sandip Chitale

It seems jde-db-debugger is being defined as
a list as well as a class in jde-db.el

Here are the snippets -

(defcustom jde-db-debugger (list "jdb (new)")
  "Specify the debugger you want to use to debug Java programs.  Select
JDEbug, if you want to use the JDE's builtin debugger.  Select jdb
(new), if
:
:

and

(defclass jde-db-debugger ()
  ((name  :initarg :name
  :type string
  :initform "Java debugger"
  :documentation 
  "Name of this Java debugger.")

This causes the opening of a .java file to fail
with error message -

File mode specification error: (wrong-type-argument listp
jde-db-debugger)


-sandip

=
Sandip Chitale
Hall-of-fame @ http://www.jguru.com

Next statement is true.
Previous statement if false.

__
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com



RE: Highlight columns after `fill-column'

2001-08-22 Thread Sandip Chitale

Stephen,
Thanks.

Well I thought jde-java-font-lock was meant to -
(from the release notes of JDE 2.2.8beta5)

New font-lock setup policy.

  - If `jde-use-font-lock' is non-nil the JDE completely handles font
lock setup. It turns on font locking in `java-mode' if needed and
installs the extra level of fontification in
`java-font-lock-keywords-4'.

  - If `jde-use-font-lock' is nil the JDE  delegates
syntax coloring setup to standard `java-mode'.

So I thoght `font-lock-add-keywords' may not work when
"JDEE completely handles font lock setup".

I guess that is not the case. I have similarly verified that
it works even when jde-java-font-lock is non nil.

regards,
sandip


> -Original Message-
> From: Molitor, Stephen [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 22, 2001 12:27 PM
> To: 'Sandip Chitale'
> Subject: RE: Highlight columns after `fill-column'
> 
> 
> Sandip,
> 
> This is great, thanks!
> 
> What is the issue with jde-use-font-lock?  I have 
> jde-use-font-lock set to
> t, and it still seems to work for me.
> 
> Steve Molitor
> [EMAIL PROTECTED]
> 
> -Original Message-
> From: Sandip Chitale [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 22, 2001 1:36 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Highlight columns after `fill-column'
> 
> 
> Sorry for the garbled format. Here it is as an attachment
> 
> > -Original Message-
> > From: Sandip Chitale [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, August 22, 2001 11:26 AM
> > To: '[EMAIL PROTECTED]'
> > Cc: '[EMAIL PROTECTED]'
> > Subject: Highlight columns after `fill-column'
> > 
> > 
> > (JDE users: This assumes `jde-use-font-lock' is set to nil. 
> > Can someone
> > figure out how to make it work with 'jde-use-font-lock' is t).
> > 
> > Usage:
> > 
> > In your .emacs -
> > 
> > (require 'highlight-beyond-fill-column)
> > 
> > (font-lock-add-keywords 'java-mode
> > '(
> >   (find-after-fill-column 0 highlight prepend)
> >   )
> > )
> > 
> >
> 



RE: Highlight columns after `fill-column'

2001-08-22 Thread Sandip Chitale

Sorry for the garbled format. Here it is as an attachment

> -Original Message-
> From: Sandip Chitale [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 22, 2001 11:26 AM
> To: '[EMAIL PROTECTED]'
> Cc: '[EMAIL PROTECTED]'
> Subject: Highlight columns after `fill-column'
> 
> 
> (JDE users: This assumes `jde-use-font-lock' is set to nil. 
> Can someone
> figure out how to make it work with 'jde-use-font-lock' is t).
> 
> Usage:
> 
> In your .emacs -
> 
> (require 'highlight-beyond-fill-column)
> 
> (font-lock-add-keywords 'java-mode
>   '(
> (find-after-fill-column 0 highlight prepend)
> )
>   )
> 
>


 highlight-beyond-fill-column.el


Highlight columns after `fill-column'

2001-08-22 Thread Sandip Chitale

(JDE users: This assumes `jde-use-font-lock' is set to nil. Can someone
figure out how to make it work with 'jde-use-font-lock' is t).

Usage:

In your .emacs -

(require 'highlight-beyond-fill-column)

(font-lock-add-keywords 'java-mode
'(
  (find-after-fill-column 0 highlight prepend)
  )
)


;--- begin highlight-beyond-fill-column.el 
;-;;; highlight-beyond-fill-column.el --- font-lock-add-keywords aid for
Emacs

;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.

;; Author:  Sandip Chitale ([EMAIL PROTECTED])
;; Keywords:programming decipline convenience

;; Keywords:
;; Time-stamp:  Aug 22 2001 11:10 AM Pacific Daylight Time
;; Version: 1.0

;; This file is *NOT* (yet?) part of GNU Emacs.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;; Commentary:

;; This defines a function that can be used by `font-lock-add-keywords' to
find the columns
;; that are beyond `fill-column'.
;;
;; Installation:
;; Put the following in your .emacs
;;
;; (require 'highlight-beyond-fill-column)
;;
;; Example usage:
;; 
;; Setup java-mode
;; (font-lock-add-keywords 'java-mode
;;  '(
;;(find-after-fill-column 0 highlight prepend)
;;)
;;  )
; Setup emacs-lis[-mode
;; (font-lock-add-keywords 'emacs-lisp-mode
;;  '(
;;(find-after-fill-column 0 highlight prepend)
;;)
;;  )

;; This is based on initial code provided by Jim Janney
([EMAIL PROTECTED])

;;; Code:

(defun find-after-fill-column (limit)
  "A function that can be used by `font-lock-add-keywords' to find columns
that are
beyond the `fill-column'."
  (let (
; remember the point
(original-point (point))
)
; if already past the fill column start on next line
(if (> (current-column) fill-column)
(forward-line 1)
  )
(while (and (< (point) limit) ;
still within limit
(or (< (move-to-column fill-column) fill-column)  ; the
line has less than `fill-column' columns
(= (point) (line-end-position))   ; end
of line
)
)
  ; goto next line
  (forward-line 1)
  )

(if (>= (point) limit);
beyond limit
(progn 
  (goto-char original-point)  ;
restore point
  nil ;
return nil
  )
  (set-match-data (list (point-marker); set
match data
(progn 
  (end-of-line)
  (forward-char)  ; this
gives the highlight till the end of the window
  (point-marker)
  )
)
  )
  t)  ;
return t indicating that the match data was set
)
  )

(provide 'highlight-beyond-fill-column)
-- end highlight-beyond-fill-column.el 



RE: Limiting line length

2001-08-07 Thread Sandip Chitale

Here is a better regexp -

(font-lock-add-keywords
 'jde-mode
 '(("^\\(   \\|\\)\\(   \\|\\)\\(   \\|\\)\\(
\\|\\)\\(   \\|\\)\\(   \\|\\)\\(   \\|\\)\\(
\\|\\)\\(   \\|\\)\\(   \\|\\)\\(   \\|\\)\\(
\\|\\)\\(   \\|\\)\\(   \\|\\)\\(   \\|\\)\\(
\\|\\)\\(   \\|\\)\\(   \\|\\)\\(   \\|\\)\\(
\\|\\)\\(..*\\)$" 21 'jde-bug-breakpoint-marker t)
   )
 )


Assumes a fill column of 80 and tab width of 4.

HTH,
sandip
> -Original Message-
> From: Sandip Chitale [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 07, 2001 4:46 PM
> To: '[EMAIL PROTECTED]'
> Subject: Limiting line length
> 
> 
> Here is the simplest trick that does what people have been
> asking for i.e. limiting line length. I had a hunch that
> font-locking could be used for that.
> 
> The idea is to simply add the following regexp to the keyword list -
> 
> (font-lock-add-keywords
>  'jde-mode
>  '(
>  
> ("^...
> ..
> ...\\(..*\\)$" 1 jde-bug-breakpoint-marker t)
>)
>  )
> 
> (Note: there are eighty .s in the regexp)
> (Note: The font-lock-add-keywords needs to be called after 
> (require 'jde) in
> your .emacs)
>  
> Regexp experts will quickly notice that this works only if 
> the source is
> untabified. Is there a quick way to get around that problem ?
> 
> 
> Sandip V. Chitale 150, Almaden Blvd
> Software Architect  San Jose, CA, USA
> work:  (408) 535 1791 ext: 791
> email: [EMAIL PROTECTED]web:   http://www.brokat.com
> 



Limiting line length

2001-08-07 Thread Sandip Chitale

Here is the simplest trick that does what people have been
asking for i.e. limiting line length. I had a hunch that
font-locking could be used for that.

The idea is to simply add the following regexp to the keyword list -

(font-lock-add-keywords
 'jde-mode
 '(
 
("^.
...\\(..*\\)$" 1 jde-bug-breakpoint-marker t)
   )
 )

(Note: there are eighty .s in the regexp)
(Note: The font-lock-add-keywords needs to be called after (require 'jde) in
your .emacs)
 
Regexp experts will quickly notice that this works only if the source is
untabified. Is there a quick way to get around that problem ?


Sandip V. Chitale   150, Almaden Blvd
Software Architect  San Jose, CA, USA
work:  (408) 535 1791 ext: 791
email: [EMAIL PROTECTED]web:   http://www.brokat.com



RE: limiting line length

2001-07-30 Thread Sandip Chitale

Aaron,

Here is a slightly modified version of highline.el
which should do - "if the hilighting code 
would hilight all characters which are beyond the desired column
length regardless of the position of the cursor that would be 
fine"

Enjoy.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 30, 2001 8:54 AM
> To: Sandip Chitale
> Cc: burtonator; [EMAIL PROTECTED]
> Subject: Re: limiting line length
> 
> 
> 
> the code you sent works as described - thanks.
> but it doesn't do exactly what i am looking for, in that you can
> only tell if a line goes over the desired length if the cursor is 
> on the line.  i am looking for a way to show me all lines
> over the defined column limit at a glance.  if the hilighting code 
> would hilight all characters which are beyond the desired column
> length regardless of the position of the cursor that would be 
> fine, or 
> having a visual cue such as a line down the right side of the buffer
> at column 80, or anything else which was an easily detectable visual 
> cue.
> 
> thanks
> aaron
> 
> At Fri, 27 Jul 2001 20:15:10 -0700,
> Sandip Chitale wrote:
> > 
> > > > In fact putting the following lines in .emacs
> > > > 
> > > > ;; Highlight current line
> > > > (require 'highline)
> > > > (highline-mode-on)
> > > > 
> > > > and the following lines in jde-mode-hook
> > > > 
> > > >   (make-variable-buffer-local 'highline-line)
> > > >   (setq highline-line (cons fill-column 240))
> > > > 
> > > > did the trick.
> > > 
> 
> > It does not show a complete vertical line at 'fill-column'
> > but it does show a highlighted the part of the current line 
> which is longer
> > than 'fill-column'. Granted this is not exactly the same 
> thing as what was
> > originally asked for. Also this may be distracting to some people.
> > 
> > It works on my GNU Emacs.
> > 
> > -sandip
> > 
> 


 highline.el


Re: limiting line length

2001-07-27 Thread Sandip Chitale

> > In fact putting the following lines in .emacs
> > 
> > ;; Highlight current line
> > (require 'highline)
> > (highline-mode-on)
> > 
> > and the following lines in jde-mode-hook
> > 
> >   (make-variable-buffer-local 'highline-line)
> >   (setq highline-line (cons fill-column 240))
> > 
> > did the trick.
> 
> On what Emacsen?  GNU Emacs or XEmacs.  What I want is a long vertical line that
> goes down column 80.  This is impossible on GNU Emacs due to the way overlays
> are done.  The only way a horizontal line can work is if you make a overlay from
> the beginning-of-line to the end-of-line +1.

It does not show a complete vertical line at 'fill-column'
but it does show a highlighted the part of the current line which is longer
than 'fill-column'. Granted this is not exactly the same thing as what was
originally asked for. Also this may be distracting to some people.

It works on my GNU Emacs.

-sandip




RE: limiting line length

2001-07-27 Thread Sandip Chitale

In fact putting the following lines in .emacs

;; Highlight current line
(require 'highline)
(highline-mode-on)

and the following lines in jde-mode-hook

  (make-variable-buffer-local 'highline-line)
  (setq highline-line (cons fill-column 240))

did the trick.

-sandip

> -Original Message-
> From: Sandip Chitale 
> Sent: Friday, July 27, 2001 4:49 PM
> To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
> Subject: RE: limiting line length
> 
> 
> > >Or maybe just vertical line down the screen at char 80 to 
> > >let you know when a line is to long?
> > 
> > Does anyone know of a way to do this?
> 
> The highline.el has a customizable variable called 
> highline-line. Which seems to allow which part of the line
> to highlight. I guess it could be set to 'fill-column'
> value an you have what you want.
> 
> e.g. set highline-line to (fill-column . 240)
> 
> highline-line's Documentation:
> *Specify which part of line should be highlighted.
> 
> Valid values are:
> 
>t  mark up to end of line.
> 
>nilmark up to window border.  On 
> XEmacs, it behaves as t.
>   NOTE: Let me know, if you find a way to 
> mark up to
> window border on XEmacs.
> 
>INTEGERmark up from beginning of line to 
> column INTEGER or to
>   end of line if INTEGER exceeds line 
> length.  If INTEGER
>   is negative, the region marked starts 
> from end of line
>   instead of beginning of line.
> 
>(LOWER . UPPER)mark up the region from column LOWER to 
> column UPPER or
>   to end of line if UPPER exceeds line 
> length.  Nothing
>   happens if LOWER exceeds line length.
>   It must: 0 <= LOWER < UPPER.
> 
>(point . INTEGER)  mark up the region from column
>   (- (current-column) INTEGER) to column
>   (+ (current-column) INTEGER).  It never 
> goes beyond
>   beginning or end of line.
>   It must: INTEGER > 0.
> 
> Any other value is treated as t.
> 
> Here is the info on highline.el - 
> 
> ;;; highline.el --- Minor mode to highlight current line in buffer.
> 
> ;; Copyright (C) 2000,2001 Vinicius Jose Latorre
> 
> ;; Author:Vinicius Jose Latorre <[EMAIL PROTECTED]>
> ;; Maintainer:Vinicius Jose Latorre <[EMAIL PROTECTED]>
> ;; Keywords:  faces, frames, editing
> ;; Time-stamp:<2001/02/04 17:35:28 Vinicius>
> ;; Version:   3.1
> ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
> 
> 
> -sandip
> 



RE: limiting line length

2001-07-27 Thread Sandip Chitale

> >Or maybe just vertical line down the screen at char 80 to 
> >let you know when a line is to long?
> 
> Does anyone know of a way to do this?

The highline.el has a customizable variable called 
highline-line. Which seems to allow which part of the line
to highlight. I guess it could be set to 'fill-column'
value an you have what you want.

e.g. set highline-line to (fill-column . 240)

highline-line's Documentation:
*Specify which part of line should be highlighted.

Valid values are:

   tmark up to end of line.

   nil  mark up to window border.  On XEmacs, it behaves as
t.
NOTE: Let me know, if you find a way to mark up to
  window border on XEmacs.

   INTEGER  mark up from beginning of line to column INTEGER or
to
end of line if INTEGER exceeds line length.  If
INTEGER
is negative, the region marked starts from end of
line
instead of beginning of line.

   (LOWER . UPPER)  mark up the region from column LOWER to column UPPER
or
to end of line if UPPER exceeds line length.
Nothing
happens if LOWER exceeds line length.
It must: 0 <= LOWER < UPPER.

   (point . INTEGER)mark up the region from column
(- (current-column) INTEGER) to column
(+ (current-column) INTEGER).  It never goes beyond
beginning or end of line.
It must: INTEGER > 0.

Any other value is treated as t.

Here is the info on highline.el - 

;;; highline.el --- Minor mode to highlight current line in buffer.

;; Copyright (C) 2000,2001 Vinicius Jose Latorre

;; Author:  Vinicius Jose Latorre <[EMAIL PROTECTED]>
;; Maintainer:  Vinicius Jose Latorre <[EMAIL PROTECTED]>
;; Keywords:faces, frames, editing
;; Time-stamp:  <2001/02/04 17:35:28 Vinicius>
;; Version: 3.1
;; X-URL:   http://www.cpqd.com.br/~vinicius/emacs/


-sandip



RE: auto-gen get/set pairs for existing class variables

2001-07-27 Thread Sandip Chitale

In fact I had a suggestion in this respect-

The "jde-wiz-get-get-method" and "jde-wiz-get-set-method"
functions seem to have hardcoded in them the javadoc headers.
It will be a good idea if the functions from "jde-javadoc.el"
(specifically "jde-javadoc-function") were called instead,
so that the user's customizations are picked up.

-sandip


> -Original Message-
> From: Sandip Chitale [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 27, 2001 10:03 AM
> To: 'Max Rydahl Andersen'; [EMAIL PROTECTED]
> Subject: RE: auto-gen get/set pairs for existing class variables
> 
> 
> Well the jde-wiz-get-set-methods simply calls the 
> existing "jde-wiz-get-get-method" and "jde-wiz-get-set-method"
> functions. If the option is introduced it will be for those.
> 
> -sandip
> 
> > -Original Message-
> > From: Max Rydahl Andersen [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, July 27, 2001 2:36 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: auto-gen get/set pairs for existing class variables
> > 
> > 
> > All of this sounds great, but I have one small 
> suggestion/question :)
> > 
> > Is it not possible to optionally disable the generation of 
> the javadoc
> > comments for these set/gets methods ?
> > The set/get names kind of explain the meaning of the methods 
> > in 999 out of
> > 1000 cases :)
> > 
> > Max
> > 
> > "Sandip Chitale" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > ft.com...
> > > Please find attached is an enhanced(?) version of Javier's
> > > "jde-wiz-get-set-methods"
> > > prototype. Give it a try(at your own risk).
> > >
> > > Enhancements -
> > >
> > > 1. Do not ignore "non-public final" variables.
> > >Generate "accessors" for final variables if not 
> already defined.
> > >
> > > 2. Print a report of accessors and mutators
> > >
> > > E.g.
> > >
> > > Given a source file -
> > >
> > > public class GetSetMethodGeneratorTest {
> > >
> > > private int intVar;
> > > protected static int staticIntVar;
> > > static final int staticFinalIntVar;
> > >
> > > boolean booleanVar;
> > > private static boolean staticBooleanVar;
> > > protected static final boolean staticFinalBooleanVar;
> > >
> > > }// GetSetMethodGeneratorTest
> > >
> > > Running 'jde-wiz-get-set-methods' once gives this report in
> > > buffer named *jde-wiz-get-set-methods report for
> > GetSetMethodGeneratorTest*
> > > -
> > >
> > > Variable : (private) int intVar
> > > Accessor: [Added ]
> > > Mutator: [Added ]
> > > Variable : (protected static) int staticIntVar
> > > Accessor: [Added ]
> > > Mutator: [Added ]
> > > Variable : (static final) int staticFinalIntVar
> > > Accessor: [Added ]
> > > Mutator: [N/A   ] variable is final
> > > Variable : nil boolean booleanVar
> > > Accessor: [Added ]
> > > Mutator: [Added ]
> > > Variable : (private static) boolean staticBooleanVar
> > > Accessor: [Added ]
> > > Mutator: [Added ]
> > > Variable : (protected static final) boolean staticFinalBooleanVar
> > > Accessor: [Added ]
> > > Mutator: [N/A   ] variable is final
> > >
> > > The new source buffer looks like -
> > >
> > > public class GetSetMethodGeneratorTest {
> > >
> > > private int intVar;
> > > protected static int staticIntVar;
> > > static final int staticFinalIntVar;
> > >
> > > boolean booleanVar;
> > > private static boolean staticBooleanVar;
> > > protected static final boolean staticFinalBooleanVar;
> > >
> > >
> > > /**
> > > * Gets the value of intVar
> > > *
> > > * @return the value of intVar
> > > */
> > > public int getIntVar() {
> > > return this.intVar;
> > > }
> > >
> > > /**
> > > * Sets the value of intVar
> > > *
> > > * @param intVar Value to assign to this.intVar
> > > */
> > > public void setIntVar(int intVar) {
> > > this.intVar = intVar;
> > > }
> > >
> > > /**
> > > * Gets the value of staticIntVar
> > > *
> > > * @return the value of staticIntVar
> > > */
> > > public static int getS

RE: auto-gen get/set pairs for existing class variables

2001-07-27 Thread Sandip Chitale

Well the jde-wiz-get-set-methods simply calls the 
existing "jde-wiz-get-get-method" and "jde-wiz-get-set-method"
functions. If the option is introduced it will be for those.

-sandip

> -Original Message-
> From: Max Rydahl Andersen [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 27, 2001 2:36 AM
> To: [EMAIL PROTECTED]
> Subject: Re: auto-gen get/set pairs for existing class variables
> 
> 
> All of this sounds great, but I have one small suggestion/question :)
> 
> Is it not possible to optionally disable the generation of the javadoc
> comments for these set/gets methods ?
> The set/get names kind of explain the meaning of the methods 
> in 999 out of
> 1000 cases :)
> 
> Max
> 
> "Sandip Chitale" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> ft.com...
> > Please find attached is an enhanced(?) version of Javier's
> > "jde-wiz-get-set-methods"
> > prototype. Give it a try(at your own risk).
> >
> > Enhancements -
> >
> > 1. Do not ignore "non-public final" variables.
> >Generate "accessors" for final variables if not already defined.
> >
> > 2. Print a report of accessors and mutators
> >
> > E.g.
> >
> > Given a source file -
> >
> > public class GetSetMethodGeneratorTest {
> >
> > private int intVar;
> > protected static int staticIntVar;
> > static final int staticFinalIntVar;
> >
> > boolean booleanVar;
> > private static boolean staticBooleanVar;
> > protected static final boolean staticFinalBooleanVar;
> >
> > }// GetSetMethodGeneratorTest
> >
> > Running 'jde-wiz-get-set-methods' once gives this report in
> > buffer named *jde-wiz-get-set-methods report for
> GetSetMethodGeneratorTest*
> > -
> >
> > Variable : (private) int intVar
> > Accessor: [Added ]
> > Mutator: [Added ]
> > Variable : (protected static) int staticIntVar
> > Accessor: [Added ]
> > Mutator: [Added ]
> > Variable : (static final) int staticFinalIntVar
> > Accessor: [Added ]
> > Mutator: [N/A   ] variable is final
> > Variable : nil boolean booleanVar
> > Accessor: [Added ]
> > Mutator: [Added ]
> > Variable : (private static) boolean staticBooleanVar
> > Accessor: [Added ]
> > Mutator: [Added ]
> > Variable : (protected static final) boolean staticFinalBooleanVar
> > Accessor: [Added ]
> > Mutator: [N/A   ] variable is final
> >
> > The new source buffer looks like -
> >
> > public class GetSetMethodGeneratorTest {
> >
> > private int intVar;
> > protected static int staticIntVar;
> > static final int staticFinalIntVar;
> >
> > boolean booleanVar;
> > private static boolean staticBooleanVar;
> > protected static final boolean staticFinalBooleanVar;
> >
> >
> > /**
> > * Gets the value of intVar
> > *
> > * @return the value of intVar
> > */
> > public int getIntVar() {
> > return this.intVar;
> > }
> >
> > /**
> > * Sets the value of intVar
> > *
> > * @param intVar Value to assign to this.intVar
> > */
> > public void setIntVar(int intVar) {
> > this.intVar = intVar;
> > }
> >
> > /**
> > * Gets the value of staticIntVar
> > *
> > * @return the value of staticIntVar
> > */
> > public static int getStaticIntVar() {
> > return GetSetMethodGeneratorTest.staticIntVar;
> > }
> >
> > /**
> > * Sets the value of staticIntVar
> > *
> > * @param staticIntVar Value to assign to this.staticIntVar
> > */
> > public static void setStaticIntVar(int staticIntVar) {
> > GetSetMethodGeneratorTest.staticIntVar = staticIntVar;
> > }
> >
> > /**
> > * Gets the value of staticFinalIntVar
> > *
> > * @return the value of staticFinalIntVar
> > */
> > public static int getStaticFinalIntVar() {
> > return GetSetMethodGeneratorTest.staticFinalIntVar;
> > }
> >
> > /**
> > * Gets the value of booleanVar
> > *
> > * @return the value of booleanVar
> > */
> > public boolean isBooleanVar() {
> > return this.booleanVar;
> > }
> >
> > /**
> > * Sets the value of booleanVar
> > *
> > * @param booleanVar Value to assign to this.booleanVar
> > */
> > public void setBooleanVar(boolean booleanVar) {
> > this.booleanVar = booleanVar;
> > }
> >
> > /**
> > * Gets the value of staticBooleanVar
> > *
> > * @return the

RE: auto-gen get/set pairs for existing class variables

2001-07-26 Thread Sandip Chitale

Please find attached is an enhanced(?) version of Javier's
"jde-wiz-get-set-methods"
prototype. Give it a try(at your own risk).

Enhancements -

1. Do not ignore "non-public final" variables.
   Generate "accessors" for final variables if not already defined.

2. Print a report of accessors and mutators

E.g.

Given a source file -

public class GetSetMethodGeneratorTest {

private int intVar;
protected static int staticIntVar;
static final int staticFinalIntVar;

boolean booleanVar;
private static boolean staticBooleanVar;
protected static final boolean staticFinalBooleanVar;

}// GetSetMethodGeneratorTest

Running 'jde-wiz-get-set-methods' once gives this report in
buffer named *jde-wiz-get-set-methods report for GetSetMethodGeneratorTest*
-

Variable : (private) int intVar
Accessor: [Added ]
Mutator: [Added ]
Variable : (protected static) int staticIntVar
Accessor: [Added ]
Mutator: [Added ]
Variable : (static final) int staticFinalIntVar
Accessor: [Added ]
Mutator: [N/A   ] variable is final
Variable : nil boolean booleanVar
Accessor: [Added ]
Mutator: [Added ]
Variable : (private static) boolean staticBooleanVar
Accessor: [Added ]
Mutator: [Added ]
Variable : (protected static final) boolean staticFinalBooleanVar
Accessor: [Added ]
Mutator: [N/A   ] variable is final

The new source buffer looks like -

public class GetSetMethodGeneratorTest {

private int intVar;
protected static int staticIntVar;
static final int staticFinalIntVar;

boolean booleanVar;
private static boolean staticBooleanVar;
protected static final boolean staticFinalBooleanVar;


/**
 * Gets the value of intVar
 *
 * @return the value of intVar
 */
public int getIntVar() {
return this.intVar;
}

/**
 * Sets the value of intVar
 *
 * @param intVar Value to assign to this.intVar
 */
public void setIntVar(int intVar) {
this.intVar = intVar;
}

/**
 * Gets the value of staticIntVar
 *
 * @return the value of staticIntVar
 */
public static int getStaticIntVar() {
return GetSetMethodGeneratorTest.staticIntVar;
}

/**
 * Sets the value of staticIntVar
 *
 * @param staticIntVar Value to assign to this.staticIntVar
 */
public static void setStaticIntVar(int staticIntVar) {
GetSetMethodGeneratorTest.staticIntVar = staticIntVar;
}

/**
 * Gets the value of staticFinalIntVar
 *
 * @return the value of staticFinalIntVar
 */
public static int getStaticFinalIntVar() {
return GetSetMethodGeneratorTest.staticFinalIntVar;
}

/**
 * Gets the value of booleanVar
 *
 * @return the value of booleanVar
 */
public boolean isBooleanVar() {
return this.booleanVar;
}

/**
 * Sets the value of booleanVar
 *
 * @param booleanVar Value to assign to this.booleanVar
 */
public void setBooleanVar(boolean booleanVar) {
this.booleanVar = booleanVar;
}

/**
 * Gets the value of staticBooleanVar
 *
 * @return the value of staticBooleanVar
 */
public static boolean isStaticBooleanVar() {
return GetSetMethodGeneratorTest.staticBooleanVar;
}

/**
 * Sets the value of staticBooleanVar
 *
 * @param staticBooleanVar Value to assign to this.staticBooleanVar
 */
public static void setStaticBooleanVar(boolean staticBooleanVar) {
GetSetMethodGeneratorTest.staticBooleanVar =
staticBooleanVar;
}

/**
 * Gets the value of staticFinalBooleanVar
 *
 * @return the value of staticFinalBooleanVar
 */
public static boolean isStaticFinalBooleanVar() {
return GetSetMethodGeneratorTest.staticFinalBooleanVar;
}
}// GetSetMethodGeneratorTest

Running 'jde-wiz-get-set-methods' it again gives this report in
buffer named *jde-wiz-get-set-methods report for GetSetMethodGeneratorTest*
-

Variable : (private) int intVar
Accessor: [Exists]
Mutator: [Exists]
Variable : (protected static) int staticIntVar
Accessor: [Exists]
Mutator: [Exists]
Variable : (static final) int staticFinalIntVar
Accessor: [Exists]
Mutator: [N/A   ] variable is final
Variable : nil boolean booleanVar
Accessor: [Exists]
Mutator: [Exists]
Variable : (private static) boolean staticBooleanVar
Accessor: 

RE: auto-gen get/set pairs for existing class variables

2001-07-25 Thread Sandip Chitale

 
You are amazing man ! I tried it. It works in terms of
all the things I had mentioned -

1. non-public
2. "is" for boolean
3. static
4. do not generater if already defined.

Not done -

5. no "set" for final variables

Only thing that could be improved upon is
a variable selection UI. 

It could act as a quick look at
which variables have accessors
and mutators.

regards,
-sandip
-Original Message-
From: Javier Lopez
To: [EMAIL PROTECTED]
Sent: 7/25/01 8:28 PM
Subject: RE: auto-gen get/set pairs for existing class variables

I sent an old file by mistake, this is the right one.

Javier


> -Original Message-
> From: Javier Lopez [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 25, 2001 10:59 PM
> To: [EMAIL PROTECTED]
> Subject: RE: auto-gen get/set pairs for existing class variables
> 
> 
> Here is the prototype I promised.
> The method jde-wiz-get-set-methods
> will generate get/set method for all variables that
> are non public and non final declared in the current buffer.
> If the method is already defined in the buffer it won't be generated.
> The methods generated look like this
> 
>   /**
>* Gets the value of name
>*
>* @return the value of name
>*/
>   public String getName() {
> return this.name;
>   }
> 
>   /**
>* Sets the value of name
>*
>* @param name Value to assign to this.name
>*/
>   public void setName(String name) {
> this.name = name;
>   }
> 
> Javier
> 
> > -Original Message-
> > From: Javier Lopez [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, July 23, 2001 11:58 PM
> > To: Sandip Chitale; [EMAIL PROTECTED]
> > Subject: RE: auto-gen get/set pairs for existing class variables
> >
> >
> > if no one has started working on this I will try to get a prototype
> > working over the next few days. If someone already started 
> doing something
> > please let me know, so I do not want to replicate work.
> >
> > Javier
> >
> > > -Original Message-
> > > From: Sandip Chitale [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, July 23, 2001 2:58 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: auto-gen get/set pairs for existing class variables
> > >
> > >
> > > Shouldn't this be easy with Semantic.
> > > In fact, the function could show the list of
> > > non-public properties for which a getter/setter does not
> > > exist and let the user generate them in one shot
> > > e.g.
> > >
> > > Class Class1
> > >   TypeGetter
> > > Setter
> > > non-final non-public property1int [
> > > ]getProperty1
> > > [ ]setProperty1
> > > non-final non-public property2int
> > > getProperty2
> > > [ ]setProperty2
> > > final non-public property3int
[
> > > ]getProperty3
> > > non-final non-public property4boolean [
> > > ]isProperty4  [
> > > ]setProperty4
> > >
> > > Notice -
> > >
> > > . no "[ ]" for property2, if, say, getter already exists
> > > . missing "[ ]setProperty3" for final property3
> > > . isProperty4 instead of getProperty4 for boolean property4
> > > . auto insertion of static keyword for static properties
> > >
> > > etc. etc.
> > >
> > > Any takers ?
> > >
> > >
> > > Something similar exists in VAJ and its' cool !
> > >
> > >
> > > -sandip
> > >
> > > > -Original Message-
> > > > From: Daniel Hegyi [mailto:[EMAIL PROTECTED]]
> > > > Sent: Monday, July 23, 2001 11:43 AM
> > > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > > Subject: Re: auto-gen get/set pairs for existing class variables
> > > >
> > > >
> > > > >Is there a way to use the "Get/Set Pair..." template (or
another
> > > > >feature) to generate the get/set pairs for all class
> > > > variables already
> > > > >defined?
> > > > >
> > > > >I thought this feature existed, but must be dreaming (or maybe
a
> > > > >different tool?).  I also didn't see anythning in the docs nor
> > > > >archives that answered this.
> > > >
> > > > I agree. This feature would be very cool. It exists in some
> > > > other IDEs and
> > > > it is very handy.
> > > >
> > > > Daniel
> > > >
> > > >
_
> > > > Get your FREE download of MSN Explorer at
> > > > http://explorer.msn.com/intl.asp
> > > >
> > >
> >
> 
 <> 



RE: auto-gen get/set pairs for existing class variables

2001-07-23 Thread Sandip Chitale

Shouldn't this be easy with Semantic.
In fact, the function could show the list of
non-public properties for which a getter/setter does not
exist and let the user generate them in one shot
e.g.

Class Class1
TypeGetter
Setter
non-final non-public property1  int [ ]getProperty1
[ ]setProperty1
non-final non-public property2  intgetProperty2
[ ]setProperty2
final non-public property3  int [
]getProperty3   
non-final non-public property4  boolean [ ]isProperty4  [
]setProperty4

Notice -

. no "[ ]" for property2, if, say, getter already exists
. missing "[ ]setProperty3" for final property3
. isProperty4 instead of getProperty4 for boolean property4
. auto insertion of static keyword for static properties

etc. etc.

Any takers ?


Something similar exists in VAJ and its' cool !


-sandip

> -Original Message-
> From: Daniel Hegyi [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 23, 2001 11:43 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: auto-gen get/set pairs for existing class variables
> 
> 
> >Is there a way to use the "Get/Set Pair..." template (or another
> >feature) to generate the get/set pairs for all class 
> variables already
> >defined?
> >
> >I thought this feature existed, but must be dreaming (or maybe a
> >different tool?).  I also didn't see anythning in the docs nor
> >archives that answered this.
> 
> I agree. This feature would be very cool. It exists in some 
> other IDEs and 
> it is very handy.
> 
> Daniel
> 
> _
> Get your FREE download of MSN Explorer at 
> http://explorer.msn.com/intl.asp
> 



RE: Watches in JDEBug

2001-06-25 Thread sandip . chitale

Paul,

> >What's the best way to keep a watch of a variable or object 
> in JDEBug?
> >After expanding one of the local variables to the level I 
> want, it collaspes
> >again when I step to the next line.  I'd either like to keep 
> the variable
> >tree expanded, or set up a watch.  (Actually, both features 
> would be nice).
> 
> Keeping the tree expanded from step to step is a relatively difficult 
> programming problem and has the potential of greatly slowing 
> down stepping. 
> The JDE fetches the top-level values of the local variables 
> at each time 
> step. The JDE defers fetch the values of fields until you 
> expand the field. 
> Doing what you ask would require that the JDE keep for each 
> local variable 
> a record of the expanded state of its fields, including the states of 
> children. If you expand the fields, the JDE would have to 
> fetch the values 
> of all the expanded fields. This could be very time-consuming.

I had to do a similar exercise for one of my projects
in Java. The way I solved it was by keeping the old
tree model just long enough so that I could expand the new 
tree. This should be done only if the method context and stack
depth is still same (or if the this object is still same Object ID -
in JPDA terms). Also this should be done only if the command
was one of Step in, out, over or run to cursor within same method.

I am assuming there is an equivalent of tree model in
your implementation. Then you can copy the expansion states
into the new tree. This has some added benefits also -

- show variables that newly appear in the new scope in some fasion
  diffing the tree models
- show variables that have changed in a special face

> 
> As for watching a variable, there is a watch command on the 
> JDE menu. It 
> allows you to watch for access or modification of fields of 
> objects. I 
> don't think JPDA provides a means of monitoring local variables.
> 

See benefits above

-sandip



A simple repacement for `describe-bindings' function

2001-05-09 Thread Sandip Chitale

I thought I will share this with people on jde list. It helps
you quickly identify what key combinations are available.

(defun keytable (arg)
  "A simple repacement for `describe-bindings' function to print the key
bindings in a tabular form.
The `describe-bindings' function shows a single column of keys to their
bindings. The `keytable'
shows the same information in a tabular form. You can choose to display the
bindings using
only certain modifiers.

Bind \\[describe-bindings] to `keytable', which usually binds to
`describe-bindings', like so
\(global-set-key \(read-kbd-macro \"\\[describe-bindings]\"\) 'keytable\)
"
  (interactive "sEnter a modifier [a space separated C- S- M- A- or even
comibination like C-S- M-C-S-]:")
  (with-output-to-temp-buffer "*Key table*"
(princ (format "Major Mode: %s\nMinor Modes: %s\n" major-mode
minor-mode-alist))
(let* ((i 0)
(keys (list
"a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m"
"n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
"1" "2" "3" "4" "5" "6" "7" "8" "9" "0"
"" "" "" ""
"" "" "" ""
 "" "" ""
 "" "" "" "" "" "" "" "" "" ""
"" ""
 "`" "~" "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "_" "=" "+" "\\"
"|" "{" "[" "]" "}" ";" "'" ":" "\"" "<" ">" "," "." "/" "?"
 ))
(n (length keys))
(modifiers (list "" "C-" "M-" "S-" "M-C-" "S-C-"))
)
  (if (not (string= arg ""))
   (setq modifiers (split-string arg))
 )
  (setq k (length modifiers))
  (princ (format "_%-10.10s__" "__"))
  (let ((j 0))
 (while (< j k)
   (princ (format "_%-50.50s__"
"__"))
   (setq j (+ j 1))
   )
 )
  (princ "\n")
  (princ (format " %-10.10s |" "Key"))
  (let ((j 0))
 (while (< j k)
   (princ (format " %-50.50s |" (nth j modifiers)))
   (setq j (+ j 1))
   )
 )
  (princ "\n")
  (princ (format "_%-10.10s_|" "__"))
  (let ((j 0))
 (while (< j k)
   (princ (format "_%-50.50s_|"
"__"))
   (setq j (+ j 1))
   )
 )
  (princ "\n")
  (while (< i n)
 (princ (format " %-10.10s |" (nth i keys)))
 (let ((j 0))
   (while (< j k)
 (let* ((binding (key-binding (read-kbd-macro (concat (nth j modifiers)
(nth i keys)
 (binding-string "_")
 )
   (if (null binding)
()
  (if (eq binding 'self-insert-command)
  (setq binding-string (concat "'" (nth i keys) "'"))
(setq binding-string (format "%s" binding))
)
  )
   (setq binding-string (substring binding-string 0 (min (length
binding-string) 48)))
   (princ (format " %-50.50s |" binding-string))
   (setq j (+ j 1))
   )
 )
   )
 (princ "\n")
 (setq i (+ i 1))
 )
  (princ (format "_%-10.10s_|" "__"))
  (let ((j 0))
 (while (< j k)
   (princ (format "_%-50.50s_|"
"__"))
   (setq j (+ j 1))
   )
 )
  )
)
  (delete-window)
  (hscroll-mode)
  )
(global-set-key [(control h) (b)] 'keytable)

Hope this is useful to some people...
-sandip





RE: jde-import-find-and-import puts imports in wrong place

2001-05-08 Thread Sandip Chitale

> 
> How about making the regexp check to make sure the string isn't inside
> quotes?
> 

And not in comment...
And not in half complete comment

I think this is a classic problem which requires parsing and
not a simple regexp trickery, iff one wants to solve this
accurately. That is why I say 'Semantic' should be used.

my last comment on this issue... ;) :)

-sandip



RE: jde-import-find-and-import puts imports in wrong place

2001-05-08 Thread Sandip Chitale

 
> I think changing this line of code
> from  (list (cons "import[ ]+\\(.*\\)[ ]*;" 'backward)
> to (list (cons "^import[ ]+\\(.*\\)[ ]*;" 'backward)
> should do the trick for most cases. 

This assumes that the import statement starts at the beginning of line.
Granted that is the case most of the time. However for cases like -

/**/ import java.awt.*; /*
import java.awt.Component;
import java.awt.Container;
import java.awt.Font;
import java.awt.Window;
//*/

it wont. I use the above to achive quick switching between
import-on-demand and specific-import (inserting a slash
at the beginning of first line does the trick).

I think Senator/Semantic should be used if we want to solve
this most precisely. I do not have a clue though how to do it
...sorry.

-sandip



RE: jde-import-find-and-import puts imports in wrong place

2001-05-08 Thread Sandip Chitale

Yup... The problem seems to be here -

(defun jde-import-get-import-insertion-point ()
  (let ((ip-re
 (list (cons "import[ ]+\\(.*\\)[ ]*;" 'backward)
;* 'backward is the problem
   (cons "package[ \t]+\\(.*\\)[ \t]*;" 'backward)
   (cons "^$" 'forward)))
:
:---8<-- snipped -8<---
:
:
insertion-point))

In one of my programs I had to write "import" as "imp" + "ort" to beat
the wrong insertion.




Sandip V. Chitale   150, Almaden Blvd
work:  (408) 535 1791 ext: 791  San Jose, CA, USA
email: [EMAIL PROTECTED]8th floor, Cube 831
web:   http://L064-5440.blazesoft.com


> -Original Message-
> From: Schewe, Jon (MN65) [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 08, 2001 12:24 PM
> To: Jde List (E-mail)
> Subject: jde-import-find-and-import puts imports in wrong place
>
>
> This isn't a real big deal since it shouldn't come up much,
> but if you've
> got a java class which contains a string with an import
> statement inside it
> jde-import-find-and-import inserts the new import after this
> line rather
> than after the real import lines.
>
> So I've got a class with this in it:
> import javax.swing.JPanel;
> //more imports
> //new import should go here
>
> public class foo {
> //
>   /**
>* Get a panel that allows debugging through DynamicJava.
> The variable
>* plant is mapped to the current plant.
>*/
>   final public JPanel createDynamicJavaPanel() {
> final Interpreter interpreter = new TreeInterpreter(new
> JavaCCParserFactory());
> final JPanel panel = new JPanel(new BorderLayout());
>
> final StringBuffer message = new StringBuffer();
> message.append("The domain package is already imported
> and the following
> variables have been defined: ");
> message.append(System.getProperty("line.separator"));
> message.append("plant");
> message.append(System.getProperty("line.separator"));
> message.append("scheduler");
> message.append(System.getProperty("line.separator"));
>
> final JTextArea code = new JTextArea("/*" +
> message.toString() + "*/\n",
> 24, 80);
> panel.add(new JScrollPane(code), BorderLayout.CENTER);
> final JButton button = new JButton("Evaluate");
> button.addActionListener(new ActionListener() {
>   public void actionPerformed(final ActionEvent ae) {
> try {
>   interpreter.interpret(new StringReader(code.getText()),
> "topLevel");
> } catch (final InterpreterException e) {
>   System.err.println(e.getMessage());
>   e.printStackTrace();
> }
>   }
> });
> panel.add(button, BorderLayout.SOUTH);
>
> interpreter.defineVariable("plant", getPlant());
> interpreter.defineVariable("scheduler", getScheduler());
>
> try {
>   interpreter.interpret(new StringReader("import
> com.honeywell.sydneypoc.domain.*;"), "topLevel");
> //new import shows up here
> } catch (final InterpreterException e) {
>   System.err.println(e.getMessage());
>   e.printStackTrace();
> }
>
> return panel;
>   }
> //...
> }
>
> ---
> Jon Schewe | [EMAIL PROTECTED]
> *My views may not represent those of my employers
>
>




Re: Enhancement: smart clean/update imports

2001-04-28 Thread Sandip Chitale

Please read file:// as // in my email.
The stupid outlook add that no matter what I do.
- Original Message -
From: "Sandip Chitale" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: "Sandip Chitale" <[EMAIL PROTECTED]>
Sent: Saturday, April 28, 2001 10:46 AM
Subject: Enhancement: smart clean/update imports


> Nick,
>
> > There is also a utility function `jde-compile-finish-update-imports'
that
> is
> > suitable for inclusion in `jde-compile-finish-hook' so that imports are
> > updated automatically.
>
> The compile finish hook idea is fantastic. However it should not update
the
> file if the new import list matches the one in the file. Otherwise
> the .java file becomes out-of-date with respect to .class immediately
> and programs like make or ant will compile it again.
>
> Also setting the jde-import-package-begin-format to -
> "
> file://**/ import %s.*; /*
> "
>
> and
>
> jde-import-package-end-format to
> "file://*/
>
> "
>
> works beutifully.
>
> What you get is something like this -
>
> file://**/ import java.awt.*; /*
> import java.awt.BorderLayout;
> import java.awt.Component;
> import java.awt.Container;
> import java.awt.Window;
> file://*/
>
> Now say you start using bunch of other classes from java.awt you simply
> delete the first / to transform the import list to -
>
> /**/ import java.awt.*; /*
> import java.awt.BorderLayout;
> import java.awt.Component;
> import java.awt.Container;
> import java.awt.Window;
> file://*/
>
> Then you compile, the program compiles succesfully, the compile finish
hook
> runs and transformas the list to -
>
> file://**/ import java.awt.*; /*
> import java.awt.BorderLayout;
> import java.awt.Component;
> import java.awt.Container;
> import java.awt.List;
> import java.awt.ScrollPane;
> import java.awt.Toolkit;
> import java.awt.Window;
> file://*/
>
> [NOTE: Notice the comment switching]
>
> Cool for lazy programmers huh !
> Programmer friendly...maintainence friendly.
> No more import-on-demand...No more unused imports...
>
> Thanks for taking the effort to develope this.
>
> regards,
> -sandip
>




Enhancement: smart clean/update imports

2001-04-28 Thread Sandip Chitale

Nick,

> There is also a utility function `jde-compile-finish-update-imports' that
is
> suitable for inclusion in `jde-compile-finish-hook' so that imports are
> updated automatically.

The compile finish hook idea is fantastic. However it should not update the
file if the new import list matches the one in the file. Otherwise
the .java file becomes out-of-date with respect to .class immediately
and programs like make or ant will compile it again.

Also setting the jde-import-package-begin-format to -
"
//**/ import %s.*; /*
"

and

jde-import-package-end-format to
"//*/

"

works beutifully.

What you get is something like this -

//**/ import java.awt.*; /*
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Window;
//*/

Now say you start using bunch of other classes from java.awt you simply
delete the first / to transform the import list to -

/**/ import java.awt.*; /*
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Window;
//*/

Then you compile, the program compiles succesfully, the compile finish hook
runs and transformas the list to -

//**/ import java.awt.*; /*
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.List;
import java.awt.ScrollPane;
import java.awt.Toolkit;
import java.awt.Window;
file://*/

[NOTE: Notice the comment switching]

Cool for lazy programmers huh !
Programmer friendly...maintainence friendly.
No more import-on-demand...No more unused imports...

Thanks for taking the effort to develope this.

regards,
-sandip




Re: Emacs JDE problem (possible bug)

2001-04-28 Thread Sandip Chitale


- Original Message -
From: "David Fellows" <[EMAIL PROTECTED]>

> None of the world's existing prj.el files contains an invocation of
>  (jde-load-outer-project-file). In my understanding of your suggestion
> this would ensure that no search for outer prj.el files would occur.
> This is the reverse of current behaviour.  To maintain existing behaviour
> they will have to be modified.
>
> Perhaps the added flexibility of your scheme is worth the conversion cost,
> perhaps not.

Aha... I get it now. You are talking about the hierarchical prj.el files
that people
have set up since Paul introduced the features. I was thinking that has been
a
recent change and I am not sure how many people have setup their projects
that way yet.
Therefore few of the world's existing prj.el files will have to be
converted. One time
convertion filter could easily written to handle that.

First off I am not sure if people liked the idea of something like
(jde-load-outer-project-file).
Second it may be too late now.

Thanks for your clarification.

regards,
sandip

PS: Yup, how many time we have run into 'once it is out there - it is a
standard'.




Re: Emacs JDE problem (possible bug)

2001-04-27 Thread Sandip Chitale

>
> It has a severe backwards compatability problem.  All prj.el files
> everywhere except those that are at the root of project trees would have
> to have an explicit (jde-load-outer-project-file).  The alternatives only
> require those jde users who are running on networked Windows machines do
> something.

I don't see why this is not backward compatible :(

The (jde-load-outer-project-file) could load the
outer prj.el file only if one existed.
So having that call inserted by the prj.el file
generator (due to the customize setting set to
'at-the-beginning' by default) at the top of
prj.el file, will exactly do what Paul's current
implementation does.

Only for people wanting a custom behaviour will require some
more work...

-sandip





RE: Emacs JDE problem (possible bug)

2001-04-27 Thread Sandip Chitale

Folks,

> > #jde_filesystem_root_dir# in the directory that the user wants to be
> > considered the root directory of the mounted filesystem. 
> The JDE prj file
> > searching mechanism could then be modified to stop its 
> upwards search if it
> > finds this file.
> > 
> > What do you think?
> > 
> > - Paul
> 
> It looks like this kind of workaround is necessary.  It might 
> be cleaner
> if you added a variable to the prj.el file that could be set 
> to t to mark the 
> root project file rather than introduce an external file.  Then you
> can include it in your customization settings.  

I was suggesting a similar thing some time ago. Basically it will
be function something along the lines of (jde-load-outer-project-file).
Then user could call this function from anywhere (i.e. at the begining,
at the end, in the middle) of a project file. This
is somewhat like being able to call super.method() anyhere from the
overridden method. It is more flexible that way.

The customize could support an option where user gets to choose where
the call to (jde-load-outer-project-file) is generated in the prj.el.
The choices could be at-the-begining (default for
backword compatibility), at-the-end, explicit.
When the user chooses explicit then it is the user's responsibility
to insert the call in the prj.el file whereever they wish.

Does it make sense ?

Last time the suggestion got ignored ;)

Sandip V. Chitale   150, Almaden Blvd
work:  (408) 535 1791 ext: 791  San Jose, CA, USA
email: [EMAIL PROTECTED]8th floor, Cube 831
web:   http://L064-5440.blazesoft.com




RE: Couple of ideas

2001-04-23 Thread Sandip Chitale

Hello Guillaume,

> 
> Do you have ideas of what other errors could be detected 
> automatically? I
> could only think about unbalanced parenthesis. Maybe other 
> syntaxic error
> could be detected by syntaxic parser bundled with the JDE?

Well I can think of various others -

1. If a type name cannot be reached given the list of imports and
the package to which this buffer belongs (this could based on
failure of jde-import-find-and-import defun to import a class).

2. No return value statement in a non-void method.

3. Type mismatch in expressions. This should be possible due to
completion code (which can deduce the type of the expression).

In general if all of us think that this king of development environment
is useful, we can put our minds to it, we could come up
with a framework for doing increamental parsing and such.

The code-aid plugin of jedit has some features along these lines.

Most of my ideal set of features for a Java editor are already
satisfied by JDE. I will like to thank Paul K. for developing
such a wonderful tool.

> 
> Other ideas could possibly be obtained from java code audit 
> tools such as
> JTest (http://www.parasoft.com/products/jtest/) but I think 
> they work mainly
> on code which compiles. Consequently, error/warning they 
> submit are maybe
> less interesting during coding, but maybe in a later step? 
> There are such
> things as warning about missing code statement for a stream...

Yes.

Sandip V. Chitale   150, Almaden Blvd
work:  (408) 535 1791 ext: 791  San Jose, CA, USA
email: [EMAIL PROTECTED]8th floor, Cube 831
web:   http://L064-5440.blazesoft.com



Lisp/jde gurus please help ! - Get .class filename for a given java buffer

2001-04-17 Thread Sandip Chitale

Here is what I have so far. Is there a better way ?

(defun java-get-buffer-full-class-name ()
  "Get the buffers fully qualified class name."
  (interactive)
  (if (jde-parse-get-package-name)
  (concat (jde-parse-get-package-name) "." (class-from-file-name
(buffer-file-name)))
(class-from-file-name (buffer-file-name))
)
  )

(defun jde-db-search-classpath-dirs (file package)
  "Return the directory containing the class FILE for a class in PACKAGE."
  (catch 'found
(let ((len (length jde-global-classpath))
  (n 0))
  (while (< n len)
(let ((curr-dir
   (jde-normalize-path (elt jde-global-classpath n
  (cond
   ((jde-db-contains-file-p curr-dir file)
(throw 'found curr-dir))
   ((and (jde-db-contains-package-p curr-dir package)
 (jde-db-contains-file-p
  (expand-file-name (jde-db-pkg-to-path package) curr-dir) file))
(throw 'found
   (expand-file-name
   (jde-db-pkg-to-path package) curr-dir)
(setq n (1+ n))

(defun jde-find-class-class-file (class)
  "*Find the class file for a specified class.
CLASS is the fully qualified name of the class. This
function searchs the class paths specified by
`jde-global-classpath' for the source file
corresponding to CLASS. If it finds the source file,
it returns the file's path. Otherwise, it returns nil.
Adapted from `jde-find-class-source-file'."
  (string-match "^\\(\\(\\(\\w\\|[_]\\)*[.]\\)*\\)\\(\\(\\w\\|[_]\\)+$\\)"
class)
  (let* ((package-name
  (substring class (match-beginning 1) (match-end 1)))
 (class-name
  (substring class (match-beginning 4) (match-end 4)))
 (file-name (concat class-name ".class"))
 (source-dir (jde-db-search-classpath-dirs file-name package-name)))
 (if source-dir
 (expand-file-name file-name source-dir)
   (message "JDE error: Could not find class for %s. See
`jde-global-classpath' for more information." class)
   nil)))

(defun java-get-buffer-class-file-name ()
  ""
  (interactive)
  (message (jde-find-class-class-file (java-get-buffer-full-class-name)))
  )

Sandip V. Chitale   150, Almaden Blvd
work:  (408) 535 1791 ext: 791  San Jose, CA, USA
email: [EMAIL PROTECTED]8th floor, Cube 831
web:   http://L064-5440.blazesoft.com




RE: (Java Code using BCEL) Way to cleanup import statements?

2001-04-16 Thread Sandip Chitale

Here is the code for ImportsDumper using BCEL.
You will need BCEL library from http://bcel.sourceforge.net/
Is there a way in JDE to find the fully qualified
name of the class file for a given java buffer file name ?

May be a lisp guru can hook this up to the compilation-finish-hook
and update the imports list after succesful compile (!?)

Save it to BCELImportsDumper.java, compile and run...

//**/ import de.fub.bytecode.classfile.*; /*
import de.fub.bytecode.classfile.ClassParser;
import de.fub.bytecode.classfile.Constant;
import de.fub.bytecode.classfile.ConstantCP;
import de.fub.bytecode.classfile.ConstantClass;
import de.fub.bytecode.classfile.ConstantFieldref;
import de.fub.bytecode.classfile.ConstantInterfaceMethodref;
import de.fub.bytecode.classfile.ConstantMethodref;
import de.fub.bytecode.classfile.ConstantNameAndType;
import de.fub.bytecode.classfile.ConstantPool;
import de.fub.bytecode.classfile.ConstantUtf8;
import de.fub.bytecode.classfile.JavaClass;
import de.fub.bytecode.classfile.Utility;
//**/
//**/ import java.io.*; /*
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
//**/
//**/ import java.util.*; /*
import java.util.Iterator;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
//**/

/**
 * A simple utility to dump imports.
 * @author Sandip Chitale ([EMAIL PROTECTED])
 */
public class BCELImportsDumper {
public static void main(String args[]) {
if ( args.length == 0 ) {
usage();
System.exit(0);
}
dump(args);
// uncomment the following to make the program pause...
/*
try {
System.in.read();
} catch (Throwable t){
}
*/
System.exit(0);
}

public static void dump(String args[]) {
SortedSet normalizedFileList = new TreeSet();

SortedSet rootClassFileNameSet = new TreeSet();

// Build the rootClassFileNameSet
for (int  i = 0; i < args.length; i++) {

if (!args[i].endsWith(".class")) {
System.out.println(args[i] + " does not look like a 
.class file.
Skipping...");
continue;
}

File potentialClassFile = new File(args[i]);
if (!potentialClassFile.isFile() ) {
System.out.println(args[i] + " does not look like a 
file. Skipping...");
continue;
}

String rootClassFileName = args[i];
if ( rootClassFileName.indexOf("$") != -1 ) {
rootClassFileName = rootClassFileName.substring(0,
rootClassFileName.indexOf("$")) + ".class";
}
rootClassFileNameSet.add(rootClassFileName);
}

// Now process each file in the Set
Iterator iter = rootClassFileNameSet.iterator();
while ( iter.hasNext() ) {
String aRootClassFileName = (String) iter.next();
dumpImports(aRootClassFileName);
}
}

private static SortedSet getCandidateFiles(File aDir, String
aRootClassFileName)
{
SortedSet candidateFiles = new TreeSet();

// Add the main file
candidateFiles.add(aRootClassFileName);

// Strip .class and add a $
aRootClassFileName = aRootClassFileName.substring(0,
aRootClassFileName.length() - 6);

// Now get the list of files in the dir
String fileInDir[] = aDir.list();
for (int i = 0; i < fileInDir.length; i++) {
String aFileName = aDir.getPath() + File.separatorChar + 
fileInDir[i];

if ( !aFileName.endsWith(".class") ) {
continue;
}

File aFile = new File(aFileName);
if ( !aFile.isFile() ) {
continue;
}
if ( aFileName.startsWith(aRootClassFileName)) {
candidateFiles.add(aFileName);
}

}

return candidateFiles;
}

private static void usage()
{
System.out.println("Usage: java BCELImportsDumper ");
}

private static void dumpImports(String aRootClassFileName)
{
aRootClassFileName = new
File(aRootClassFileName).getAbsolutePath().replace('/'

RE: Way to cleanup import statements?

2001-04-16 Thread Sandip Chitale

Well, Scott Stanchfield had started some work on this -

http://www.javadude.com/tools/importifier/index.html

Also here is my post from few months ago -

 There is a perpetual controversy about wild card vs specific
 imports :

 import java.awt.*;

 vs

 import java.awt.Frame;
 import java.awt.Panel;

 etc.

 The information about which classes are statically linked
 is available in the .class file. This information could be
 used (post succesful compile) to modify the source file to
 expand/collapse the list of wildcard imports to the specific
 imports. And also get rid of unused imports.
 
 For example,

 Say, the programmer has the following import statement -

 import java.awt.*;
 import java.util.Vector;

 could be transformed to -

 //*@@*/ import java.awt.*; /* <--- commented out
 import java.awt.Frame;<--- compiler sees this next time
 import java.awt.Panel;<--- compiler sees this next time
 //*/
 import java.util.Vector;

 based on the information in .class file.
 (@@ is just an arbitrary pattern to indicate tool modified
 source. it could be any other token)
 (Notice only wild card import was transformed.)

 Further if the user adds some code which requires
 the java.awt.Dialog to be imported they could just delete
 the first slashe like this -

 /*@@*/ import java.awt.*;  /* <--- compiler sees this next time
   <--- now inside comment
 import java.awt.Frame;<--- now inside comment
 import java.awt.Panel;<--- now inside comment
 //*/  <--- now inside comment
 import java.util.Vector;

 and the cycle starts again. In an IDE like environment
 the compilation error clicking could be hooked up
 to do the fix interactively.

 Such an automated tool could forever put the wild card
 vs specific import controversy to rest.

 I have developed some code which dumps the imports using
 slightly modified version of Chuck McManis's dumClass
 utilities.

 http://www.mcmanis.com/~cmcmanis/java/dump/index.html

 However BCEL http://sourceforge.net/projects/bcel/
 or IBM's Byte Code Toolkit could be used instead.



HTH,
sandip

Sandip V. Chitale   150, Almaden Blvd
work:  (408) 535 1791 ext: 791  San Jose, CA, USA
email: [EMAIL PROTECTED]8th floor, Cube 831
web:   http://L064-5440.blazesoft.com




RE: PROPOSAL: Only save customized vars in project file

2001-03-29 Thread Sandip Chitale

Hello Nick,

This is great. I use to wonder about "why it was necessary to save *every*
jde
variable in the project file." too.
I have written a function to support nested projects. Here it is.

(defun jde-load-parent-project ()
  "Load the parent project if one exists."
  (let ((prj-file (jde-find-project-file (file-name-directory
  (directory-file-name
   (file-name-directory
(expand-file-name prj-file)
)
   )
  )
 )
  )
)
(if prj-file
(load-file prj-file)
  (message "No parent project found.")
  )
)
  )

One simply has to call this function in their prj.el to get the desired
effect.

If called at the beginning it lets the inner (lower) project override
the outer (upper) projects settings.

If called at the end it lets the outer (upper) project override
the inner (lower) projects settings.

The possibilities are endless

Anyways (IMHO) with your changes and the above function one should
have a powerful combination :)

Sandip V. Chitale
work:  (408) 535 1791
email: [EMAIL PROTECTED]
web:   http://www.brokat.com


> -Original Message-
> From: Nick Sieger [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 29, 2001 11:14 AM
> To: [EMAIL PROTECTED]
> Subject: PROPOSAL: Only save customized vars in project file
>
>
> My typical usage of the JDE is to have a custom-set-variables block in
> my .emacs that sets a bunch of defaults for the JDE, and then only
> override a couple of the jde variables in each of my projects
> (typically jde-global-classpath and a few others).  I always wondered
> why it was necessary to save *every* jde variable in the project file.
> For example, I can't see a use case for wanting to vary the
> keybindings from project to project.
>
> The patch for jde.el below allows one to save only those variables
> that have been customized at the project level in the project file.  I
> know in the past others have been clamoring for some sort of override
> feature.  This solution does not solve the situation where one would
> like to nest several project files, with each deeper project file
> overriding any found above it in the directory hierarchy.  But at
> least it enables users to customize the JDE on two levels - default
> and project - and make customizations at the default level without
> having to go update every project file if the change is orthogonal to
> customizations made in the project.
>
> I haven't been testing this code very long, but I wanted to get it out
> to others and see if it is viable.  To update your project files, it
> should be sufficient to simply load and re-save them after you've
> applied the patch to jde.el.  Comments?
>
> /Nick
>
> *** jde.el2001/03/29 06:19:15 1.154
> --- jde.el2001/03/29 19:05:27
> ***
> *** 997,1003 
> (interactive)
> (let ((prj-file (jde-find-project-file default-directory)))
>   (if prj-file
> ! (load-file prj-file)
> (jde-set-variables-init-value
>
>
> --- 997,1005 
> (interactive)
> (let ((prj-file (jde-find-project-file default-directory)))
>   (if prj-file
> ! (progn
> !   (jde-set-variables-init-value t) ; don't display reset message
> !   (load-file prj-file))
> (jde-set-variables-init-value
>
>
> ***
> *** 1061,1067 
>
>
>   (defun jde-save-variables (buffer)
> !   "Save all JDE variables in project file."
> (jde-save-delete 'jde-set-variables buffer)
> (let ((standard-output buffer))
>   (unless (bolp)
> --- 1063,1069 
>
>
>   (defun jde-save-variables (buffer)
> !   "Save all *customized* JDE variables in project file."
> (jde-save-delete 'jde-set-variables buffer)
> (let ((standard-output buffer))
>   (unless (bolp)
> ***
> *** 1072,1091 
>(lambda (symbol)
>  (when
>  (and (string-match "jde-" (symbol-name symbol))
> ! (get symbol 'custom-type))
>(let ((value (symbol-value symbol)))
>(princ "\n '(")
>(princ symbol)
>(princ " ")
>(prin1 (custom-quote value))
> !  ;; Check whether the user has changed the value of this
> !  ;; variable in a customization buffer. If so, save flag
> !  ;; so that custom knows that this value differs from
> !  ;; standard value.
> !  (if (get symbol 'customized-value)
> !  (princ " t)")
> !(princ ")"))
> !  )))
>   (jde-symbol-list))
> (princ ")")
> (save-excursion
> --- 1074,1087 
>(lambda (symbol)
>  (when
>  (and (string-match "jde-" (symbol-name symbol))
> ! (get symbol 'cu

RE: dependency building with JDE (again)

2001-03-23 Thread Sandip Chitale

> 
> >I can imagine a situation where you don't create a 
> >package based directory structure for your files but it 
> >should be possible to map the name found in the class 
> >file to the source files somehow in whatever configuration 
> >the source files are in. As long as you have the build 
> >structure in a directory. If you don't then this 
> >depend rebuild==full rebuild.
> >
> >I think I can prove that if necessary.
> 
> Spoke to soon - and without adequate thought:
> 
> Define a class a.Test and store it in file: b/Test.java
> Define a class b.Test and store it in file: a/Test.java
> 
> compile this and you get:
> 
> a/Test.java -> destination/b/Test.class
> b/Test.java -> destination/a/Test.class
> 
> naturally any system analysing the files will presume that b.Test
> relates to b/Test.java.
> 
> Whoops.

Fortunately :) a very unlikely scenario...unless the user is
modifying the package statments inside the source file but
forgetting to move the files.. :(

-sandip



RE: convert existing .java file?

2001-03-23 Thread Sandip Chitale

C-x h M-x indent-region Ret

HTH,
Sandip V. Chitale
work:  (408) 535 1791
email: [EMAIL PROTECTED]
web:   http://www.brokat.com

March 22.-28.2001 CeBIT 
Visit Brokat Technologies in Pavilion P32, our new location! 



> -Original Message-
> From: Sing HU [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 23, 2001 1:31 PM
> To: [EMAIL PROTECTED]
> Subject: convert existing .java file?
> 
> 
> I have set up my (defun my-jde-mode-hook ()
> the way I like it. Now when I load an existing .java file I notice
> that the jde options only apply to new code that I add to that file
> using emacs. 
> 
> How can I re-format the entire file so that the hook options can be
> applied to the entire file?
> 
> 
> 
> 
> --== Sent via Deja.com ==--
> http://www.deja.com/
> 
> 
> 



RE: dependency building with JDE (again)

2001-03-23 Thread Sandip Chitale

Nic,

I would like to add to some of what you have said

Nic Ferrier wrote:
> snip 8<-snip
> It struck me that there is a possible solution to this. When a class
> file is compiled with the -g switch the source file name that is was
> compiled from is embedded in the class (this is how the debugger knows
> which class file to load).
>

The name of the source file (without the directory part) is always stored
in the .class file whether or not you compile the source .java file
with -g option. The name of the java source file is stored
as a class file attribute. It is not required by the JVM Spec but is
true for most compilers (i.e. to store the source file name even if -g
was not specified).
(Reference -
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#79
868)

In fact you have to use -g:none to prevent the javac from storing that
attribute...

Here is the output from my JDK1.3 javac -

"
Usage: javac  
where possible options include:
  -gGenerate all debugging info
  -g:none   Generate no debugging info
  -g:{lines,vars,source}Generate only some debugging info
  snip 8<-snip
"

Mind you - this gives you only the name of the source file. Fortunately the
.class file also contains the information about the name of the package
to which this Class belongs. Putting these two pieces together it is
possible to come up with the name the source file relative to the
SOURCEPATH.
This assumes though that the user is following the same directory structure
for
the sources as for the packages of classes. I have known instances where
that was not being followed. This is a problem only for novice Java
programmers
though - because they soon learn that the tools like debuggers cannot find
their
source files. This has been a big problem for people coming from c/c++
environments.

This is one of the biggest point I wanted to make in my write-up earlier.

> It wouldn't be hard to adapt the debugger's strategy for finding a
> source file based on the class file to a rebuilder.
>
> This is what a rebuilder based on this would do:
>
> - create a list 'classeslist' of all the .class files in the
> destination directory
> - create an assoc-list 'sourceslist' of all the .source files in the
> source path
> - for each .class file in 'classeslist'
> - obtain the source file from the class file
> - get the source file name from the 'sourceslist'
> - compare the .class last modified time with the .java last
> modified time
> - add the .java to a list 'recompilelist' if the .class time is
> eariler
> - for each source file in the 'sourceslist' that isn't in the
> 'classeslist'
> - add the source file to the 'recompilelist'
> - compile all the files in 'recompilelist' with an @ list argument to
> the compiler
>
> I think this would work. It could be done in elisp (with a java tool
> [use the bsh?] to help extract the source file name for class files).


There are a few toolkits available to get the info from class files -

BECL- http://bcel.sourceforge.net/
IBM's BCT   -
http://www.alphaworks.ibm.com/aw.nsf/techmain/B1DD3263E75AD55C882568AC008364
A9?OpenDocument
C. Mcmanis's- http://www.mcmanis.com/~cmcmanis/java/dump/index.html

and others.


The above only deals with the out datedness of the class with respect
to it's source file. This does not deal with how other classes that
may depend on the class, that may have to be compiled.

The "Depend" optional task available with Ant does it the way it should
really be done. Read all about it at -

http://jakarta.apache.org/ant/manual/OptionalTasks/depend.html


Here is an excerpt from the web page -

"To determine the class dependencies, the depend task analyses the class
files of all class files passed to it. Depend does not parse your source
code in any way but relies upon the class references encoded into the class
files by the compiler. This is generally faster than parsing the Java
source."

Mind you - it is a separate task from the 'javac' task. In other words it
has nothing to do
with -depend flag of javac task or compiler.

I have heard that "Depend" task works very well for most cases.

I suspect that the Ant tasks can be run outside of Ant also (with some
tweacking). May be that's
what we need to do for adapting it for JDE ...

Hope this clarifies things...

-sandip




Q: jde-project-name - what is it for ?

2001-03-20 Thread Sandip Chitale

Folks,

I tried to look through the jde's .el files and tried
to look through the jde documentation. I could
not figure out the real purpose of jde-project-name ?
How is the variable jde-project-name really used ?
What is its relationship to the project file ?
What is the intended use of the variable ?

-sandip




RE: PROPOSAL: New Java Build Feature

2001-03-19 Thread Sandip Chitale

Folks,

Here are some of my observations with respect to compilation and
Java projects -

1. It is so obvious that sometime it is missed by many people
  The Java "import" statement imports the object form i.e. .class file
  and not .java file. This is unlike the C/C++ world whereby one
  "includes" .h files i.e. source form. This observation may seem
  trivial but is the reason why make like behavior was built into
  the Java compilers by Sun. The sad thing is that they have not kept
  the behavior consistent from one release of JDK to the other.

2. Even though it is a good practice to have one top level class per file
  it is not required by Java specifications. Some java compilers may warn
  about it though.

3. The restriction that the name of the top level public
  class has to match the name of the .java file helps somewhat. The class
  files for inner classes have name with same prefix as the name of the
outer
  class is also helpful. (OuterClass.class and OuterClass$*.class covers
  all the classes).

4. The package statement adds to the complications because it results in
  a directory hierarchy. This gives a lot of problems to the beginner
  because they may not start with the similar directory hierarchy for the
  sources. Also one has to remember to move the source file if one changes
the
  package statement inside the .java file.

5. The difference in javac's behavior when one uses or does not use
  the -d option is also confusing to many beginners. When one uses the -d
option
  javac will create a directory hierarchy under the output directory that
  patches the package statement inside the .java file vs. when one does not
  use the -d option javac puts the compiled classes in it's current
directory).

6. It is not always possible to predict the name of the source file based
  on the name of .class file in every legal case.

  If one is following a model whereby the .class files are in a different
  place than the .java file on has to provide the location of .java files
  in addition to CLASSPATH.

  Also just based on the name of the .java files one cannot predict the
names
  and locations of all the output .class files that may result from the
  compilation. It requires parsing of the .java file. That is why automated
  make file generation fails for Java. i.e. there is no equivalent of .c.o
rule
  for java.

What I am trying to point out is that any mechanism that builds a Java
system
has to take into account all these factors.

My 2 yens.
-sandip

Sandip V. Chitale
work:  (408) 535 1791
email: [EMAIL PROTECTED]
web:   http://www.brokat.com

March 22.-28.2001 CeBIT
Visit Brokat Technologies in Pavilion P32, our new location!



> -Original Message-
> From: Paul Kinnucan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 19, 2001 5:05 AM
> To: [EMAIL PROTECTED]
> Subject: PROPOSAL: New Java Build Feature
>
>
> Hi All,
>
> The JDE has a Java build feature that relies on javac
> dependency checking
> to rebuild a project. This feature has been broken by the
> reduced level of
> dependency checking in recent versions of javac.
>
> Lately I have begun using a new approach to using javac for
> building my
> Java projects that appears fast and perfectly reliable. I'm
> considering
> replacing the current Java build scheme with this new version
> and would
> like your feedback.
>
> The new approach relies on automatic creation of special
> classes, called
> compile masters, that reference every Java class in a
> project. The compile
> masters correspond to a makefile. The Java build algorithm creates a
> compile master in the root package and in each descendent
> package, thereby
> creating a hierarchy of compile masters that mirrors the
> package hierarchy.
> It then uses javac to compile the toplevel compile master.
> Compiling the
> root compile master causes javac to check every class in the
> project to
> ensure that it is current and recompile any classes that are
> not current.
>
> The benefits of this approach are:
>
> 1. No need for makefile.
>
> 2. Fast -- only one invocation of javac is needed to rebuild
> a project,
>no matter how big the project is.
>
> 3. Reliable -- every out-of-date class in the project is recompiled.
>
> The Java build feature would include a build-and-run command
> and would also
> allow you to specify multiple projects in a single build
> command to handle
> the cases where one project is dependent on classes in
> another project.
>
> Note that this new build would not replace the JDE's support
> for using make
> to build projects. You could continue to use make as an
> alternative to the
> Java build feature.
>
> What do you think of this proposal?
>
> - Paul
>




IDEA: completion framework and precompiled completion database...

2001-03-01 Thread Sandip Chitale

Folks,

JDE now supports code completion. That is fantastic.
However it does it based on Java reflection. Which means
that the classes have to be loaded into the Beanshell's
JVM for introspection. IMHO that is very inefficient for the
code which does not change e.g. Standard Java Class library.
Shouldn't it be possible to take a .jar file and create
a precompiled completion database for that file and use as
a fast access cache. This will work especially well on the
.jar or .zip files. That is because the validity of the
databse cache could be easily tested using a simple timestamp
comparison.

JDE will have to keep track of the mapping between .jar file
and the compiled database. A standalone tool could go through
all the classes in a .jar file and create such a database.

This is somewhat along the lines of TAGS file only for .classes.

Just and idea !

-sandip

Sandip V. Chitale
work:  (408) 535 1791
email: [EMAIL PROTECTED]
web:   http://www.blazesoftware.com

March 22.-28.2001 CeBIT 
Visit Brokat Technologies in Pavilion P32, our new location! 





Re: help with jde-import...

2001-02-23 Thread Sandip Chitale

Actually the compiled .class file (constant pool) is the best place
to find out which classes are actually imported. Thus parsing
the .class file(s) (post a successful compile) a tool could easily
come up with an expanded (i.e. no .* imports) and only necessary imports
list
and replace the imports section in the corresponding .java file.
[NOTE: I say .class files(s) to account for inner classes and non
public top level classes]

I had written one such utility in Java using Chuck McManis's
utilities http://professionals.com/~cmcmanis/java/dump/index.html for
parsing .class files. Other toolkits are also available to parse
the .class files -
http://www.alphaworks.ibm.com/aw.nsf/techmain/B1DD3263E75AD55C882568AC008364
A9?OpenDocument

I am not a lisp and jde expert. However some kind lisp/jde
Guru (Paul ?) could integrate this functionality into jde-post-compile-hook
(is there such a hook ?).

[NOTE: Well if you use the wonderful JDE, you never need to use wildcard
imports (due to jde-import-find-and-import function). However if you have
to work in an environment where not everyone uses JDE and Emacs for that
matter the use of wildcard imports is always prevalent (hey ! programmers
are lazy).
(IMHO - actually learning a tool like JDE is a sign of the ultimate lazy
programmer -
learn-the-tool-and-then-let-the-tool-do-the-horse-work-approach)].

I had suggested the following scheme such a tool could implement
for commenting out the wildcard imports -

There is a perpetual controversy over using a specific imports vs. wildcard
imports
i.e.

import java.util.ListResourceBundle; // good for maintainability, bad for
the lazy programmer
import java.util.Vector; // good for maintainability, bad for the lazy
programmer

vs.

import java.util.*; // bad for maintainability, good for the lazy programmer

Doing wildcard imports is easy for the original
coders but hard for the person who maintains the
code.

The usage will be something like this -

1. Developer uses a foo.* syntax for imports.

import foo.*;

2. After a successful compile the above mentioned
tool runs and converts the foo.* imports with specific
imports based on the information in .class file(s).
The tool comments out the .* import.

//**/ import foo.*; /*
import foo.Class1;
import foo.Class2;
//*/

3. Developer continues to work on the file.
4. Developer uses some new classes Class3 and Class4 which have not been
imported. Developer knows they are from foo package. S/he goes and
simply toggles the code block

/**/ import foo.*; /*
import foo.Class1;
import foo.Class2;
//*/

5. Compiles the code. After the successful compile
the tool runs again resulting in

//**/ import foo.*; /*
import foo.Class1;
import foo.Class2;
import foo.Class3;
import foo.Class4;
//*/

Any takers ?

--
Sandip V. Chitale
work:  (408) 535 1791
email: [EMAIL PROTECTED]
web:   http://www.blazesoftware.com

March 22.-28.2001 CeBIT
Visit Brokat Technologies in Pavilion P32, our new location!





font-lock-add-keywords issue

2001-02-22 Thread Sandip Chitale

I think I have found how to get the font-lock-add-keywords to work with
jde-mode.

Basically this need to be at the top level (i.e. not inside your
jde-mode-hook-function
and after the (require 'jde). Atleast that is how it started working for me.

It was not working when I set it inside the jde-mode-hook.

I am not an lisp and jde expert and I cannot tell the reason why it was not
working.

-sandip




hippie-expand

2001-02-01 Thread Sandip Chitale

Folks,

Some one was asking about being able to complete
paths in the customization buffer while setting global
classpath etc.

I want to bering to your attention the following -

hippie-expand is an interactive compiled Lisp function in `hippie-exp'.
(hippie-expand ARG)

Try to expand text before point, using multiple methods.
The expansion functions in `hippie-expand-try-functions-list' are
tried in order, until a possible expansion is found.  Repeated
application of `hippie-expand' inserts successively possible
expansions.
With a positive numeric argument, jumps directly to the ARG next
function in this list.  With a negative argument or just C-u,
undoes the expansion.

where -
hippie-expand-try-functions-list's value is
(try-complete-file-name-partially try-complete-file-name
try-expand-all-abbrevs try-expand-list try-expand-line try-expand-dabbrev
try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill
try-complete-lisp-symbol-partially try-complete-lisp-symbol)


Documentation:
The list of expansion functions tried in order by `hippie-expand'.
To change the behavior of `hippie-expand', remove, change the order of,
or insert functions in this list.

I bind it to the CTRL-TAB and it works great in any buffer.

(global-set-key [C-tab] 'hippie-expand)

HTH,
sandip