Friday, March 14, 2008

Customizing editplus with java tools...

Customizing the applications to the way i need exactly had been an interest of me for a very long time..., I always feel that there is something always missing in the application that i'm using.., may be it is a ms word or photoshop or editplus or netbeans..
Then i felt that there is one way to go beyond this.., "plugins" or sometimes called extensions or user tools...
Here i'm going to give u a small example of how you can extend the functionality of editplus with the custom java plugins or tools that you write which makes ur life simpler...

Use Case: I'm going to use a simple use case which i felt was the most time consuming thing to do and which was a missing feature in the editplus.
Being a java developer most of the time i write a lot of System.out.println() (sop) statements in my java code which helps a lot in debugging and let me know how where my program is going.
At the same time it becomes a big burden for me when i have to remove these sops...
Here i'll give you an example of how you can remove the sop statments in a java source file with a custom tool..,in our case a simple java class file.(You can think of any other functionality that you might be concerned with may be adding or deleting content and anything more.., by allmeans you are playing with files...)

People who are familiar with editplus might be knowing how the editplus can be integrated with the java compiler and the java runtime.With the java compiler you can compile your java class file and with the java runtime you can actually run your compiled class file
more information on this please visit editplus faq:http://www.editplus.com/faq.html

Following are the snapshots on how you can do this..

In my scenario java is installed on my machine at the following location..
D:\Program Files\Java\jdk1.6.0_01
Location of javac.exe
D:\Program Files\Java\jdk1.6.0_01\bin\javac.exe
Location of java.exe
D:\Program Files\Java\jdk1.6.0_01\bin\java.exe

Java Compiler settings:

























Java Runtime settigs:


























These two settings help you compile a java src file and run it..., what we are looking for is writing a tool of our own and configure it with ediplus.
First we start with writing a java src file with exactly does the action we wanted to do.., place the whole logic in the main method and with the arguments if required.
Here im giving you the example i tried, the logic for my tool in RemoveSOP.java
(Click on the image for a better view to open it in a different window or tab)


/*
* RemoveSOP.java
*
* Created on March 15, 2008, 11:40 AM
*
* To change this template, choose Tools Template Manager
* and open the template in the editor.
*/

/**
*
* @author Bhasker
*/
import java.io.FileReader;
import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;

public class RemoveSOP {

/** Creates a new instance of RemoveSOP */
public RemoveSOP() {
}

public static void main(String[] args) throws IOException {
BufferedReader inputStream = null;
PrintWriter outputStream = null;

try {
inputStream =
new BufferedReader(new FileReader(args[0]));
outputStream =
new PrintWriter(new FileWriter(args[0]+"_Modified"));

String l;
while ((l = inputStream.readLine()) != null) {
//System.out.println(l);
if(l.contains("System.out.println(")){

while (!(l.contains(");"))){
l = inputStream.readLine();
}
}
else{
outputStream.println(l);
System.out.println(l);
}
}
} finally {
if (inputStream != null) {
inputStream.close();
}
if (outputStream != null) {
outputStream.close();
}

}
}

}

Here is how you configure the JavaTool class file with its editplus as a user tool...


Here is my java source file MyJavaSrcFile.java with which im going to test for my javaplugintool...



/*
* MyjavaSrcFile.java
*
* Created on March 15, 2008, 11:47 AM
*
* To change this template, choose Tools Template Manager
* and open the template in the editor.
*/

/**
*
* @author Bhasker
*/
public class MyjavaSrcFile {

/** Creates a new instance of MyjavaSrcFile */
public MyjavaSrcFile() {
}

public static void main(String args[]){

System.out.println("****************************************************************************\n" +
" xdebug : " + " Welcome to the dummy program... :D ");
int num1 = 4;
int num2 = 5;
int num3;

System.out.println("****************************************************************************\n" +
" xdebug : " + " Ready to do the multiplication of "+num1+" with " +
""+num2+" times");

System.out.println("Result ... : "+num1+" X "+num2+" = "+num1*num2+"\n");

num3 = num1*num2;

System.out.println("****************************************************************************\n" +
" xdebug : " + " Have a nice day good bye.... :) ");


}

}



The log is as follows...



/*
* MyjavaSrcFile.java
*
* Created on March 15, 2008, 11:47 AM
*
* To change this template, choose Tools Template Manager
* and open the template in the editor.
*/

/**
*
* @author Bhasker
*/
public class MyjavaSrcFile {

/** Creates a new instance of MyjavaSrcFile */
public MyjavaSrcFile() {
}

public static void main(String args[]){


int num1 = 4;
int num2 = 5;
int num3;




num3 = num1*num2;




}

}

With the my java source file opened i click on the java tool button or ctrl+ so as to run the tool on this file.This will create a new file +_Modifed with all the sops removed which i can replace the whole of the source in my file after i confirm the changes with a compare tool like beyond compare.

Here are the results that you can compare....
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikfE_wcTaH_no_CTSvPfL4Q-Zw_pVBJq5FA-O90mp8LE3eplJ9yWr34uLT4xG8RQX0Wtu5NqmLg8nK8sbwuHlKUVqr6Isy4DiZl9Nc4JmpwBDxb1fdJoHzp-mqyKnvkYhJLPZxp3JldTo/s1600-h/compare.PNG
























He he..,the sops are removed in just second....
I came to hear from ppl that there are something called macros which does the same work more simply..., I'm yet to make my hands dirty with that....
Also the way i mentioned is not just limited to java tools but you can configure any other exe or jar or any file in a similar way..


9 comments:

Anonymous said...

Appreciation is a wonderful thing...thanks for sharing kepp it up. Azkapc.com
EditPlus Crack
MacKeeper Crack
Kaspersky Total Security Crack
HitmanPro Crack
Hide All IP Crack

kickasscrack said...

This site have particular software articles which emits an impression of being a significant and significant for you individual, able software installation.This is the spot you can get helps for any software installation, usage and cracked.
kickasscrack.com
avs-video-editor-crack
editplus-crack
nero-burning-rom-crack

Malik Maahi said...

Thanks for sharing your knowledge to install & crack the Time Tables, but you need to update
it now. because there is a 2022 version available now:




edit-plus


ccleaner-pro


ispring-suite


teamviewer


nitro-pro

star girl said...

I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
Very interesting blog.
EditPlus Crack
CyberLink PowerDirector portable Crack
Deep Freeze Standard crack

kanju said...


I am very impressed with your post because this post is very beneficial for me and provide a new knowledge…
editplus-crack-with-product-code
download-superantispyware-crack
skype-crack
reimage-repair-pc-license-key

Muhammad Akbar said...



Guest blogging is crucial for SEO that's why this post Crack Pro Software provides a free best blog and article submission sites list with instant approval
editplus-crack

Crackglobal said...



I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
Very interesting blog.
editplus-crack
website-auto-traffic-generator-ultimate-crack
glary-utilities-pro-crack
gbwhatsapp-apk
apeaksoft-android-toolkit-crack
slimware-driverupdate-crack
winzip-pro-crack

Free Softwares Download said...

I am glad that the author could get out to share with you It is very useful. Try to keep on posting these kind of things. Thanks for sharing. website

9xcrack said...

Great work you done.
EditPlus crack 6/