The Source for Java Technology Collaboration
User: Password:



Edgar Silva's Blog

August 2006 Archives


Enabling Syntax Highlight for Velocity Files in Eclipse

Posted by edgars on August 30, 2006 at 12:11 PM | Permalink | Comments (5)

Hi Forks,

I've been working with a new Greenbox module, which will allow Eclipse developers to use Greenbox Framework easier.

I that worked, I did a really nice thing, I associate a *.vm file with Java Editor, and in a few seconds I had Velocty Editor with All syntax highlight necessary to create and edit Velocity templates for Greenbox.

Take a look how to Enable it on your enviroment:

eclipse_velocity.png

I hope this could be as useful as it was to me!



AppFuse Article

Posted by edgars on August 30, 2006 at 07:26 AM | Permalink | Comments (0)

In that article,
Matt Raible, shows interesting reasons to use AppFuse.

In Brazil, a gret friend of mine : Paulo Jerônimo, which promotes very enthusiastics presentations in Brazil, in events such as JustJava(Biggest Brazilian Java Event) talking about AppFuse.

AppFuse is a really nice way to getting started a project, and there are a lot of people using it here in Brazil.

Mr. Raible, added Greenbox on Resources section, and We would like to say thanks by reference.

Hope you enjoy the article reading it here.



NetBeans Plugin: Janino Plugin

Posted by edgars on August 14, 2006 at 06:58 AM | Permalink | Comments (0)

A famous friend of mine Bruno , is leading a development here at Summa Technologies do Brasil.
He asked to me how easy or hard would be create a new Editor special for Janino in NetBeans, this editor should have sintax highlight, code-completion and so on, cause his team was in troubles to edit and to turn it fast and easy to edit.
After a couple of minutes and a good answer on NB-DEV-LIST EVERYTHING is ready to use.

Now my friends at Summa are happy with opportunity of to edit and create with a real productivity for Janino files using NetBeans.

If you want donwload it click here The following images shows Janino in action:

1

2

Hope this can be useful for anybody else.

Usign NetBeans Diff Module

Posted by edgars on August 03, 2006 at 12:51 PM | Permalink | Comments (0)

I am doing some related issues with Diff Module in Greenbox NetBeans Plugin.

Basically, when user generates a code by second time, the NetBeans will ask to him "Hey you did some changes in original file, would you like to see the diff between old file and new file you are generating?", If User presse "yes" button, The Diff module will appear to user.

To invoke the Diff Panel on NetBeans you can use something similar to following source code:

  DiffVisualizer diff = (DiffVisualizer) Lookup.getDefault().lookup(DiffVisualizer.class);
    DiffProvider dprov = (DiffProvider) Lookup.getDefault().lookup(DiffProvider.class);
    StreamSource src = (StreamSource) Lookup.getDefault().lookup(StreamSource.class);  
    DiffPresenter v = (DiffPresenter) Lookup.getDefault().lookup(DiffPresenter.class);
class MyInfo extends DiffPresenter.Info {
   private Difference[] differences; 
    
public MyInfo(String name1, String name2, String title1, String title2,
              String mimeType, boolean chooseProviders, boolean chooseVisualizers) {
    super(name1,name2,title1,title2,mimeType,chooseProviders,chooseVisualizers);
  }
  public void setDifferences(Difference[] adiff) {
     differences = adiff;
  }

  public Difference[] getDifferences() {
      return differences;
  }

  public Difference[] getInitialDifferences() {
      return differences;
  }

  public  Reader createFirstReader() throws FileNotFoundException {
    Reader f = new FileReader("/Users/edgarsilva/summa/dev/GreenboxBaseProject/web/WEB-INF/spring-context.xml");
    return f;
  }
  
  public  Reader createSecondReader() throws FileNotFoundException{
   
      
      String springContext = new String("");
      try {        
              springContext= ClassGeneratorBase.getInstance().generateSourceByTemplateName(getClasse(),"springContext",initializeGreenboxContextAndVariables(),"/templates");
      } catch (Exception e ) {
         e.printStackTrace();
      }
      
      return new StringReader(springContext); 
  }
    
    }
    
      MyInfo i = new MyInfo("old","new","old","new","text/xml",true,true);
        try {
            
            s1 =  new FileReader("/Users/edgarsilva/summa/dev/GreenboxBaseProject/web/WEB-INF/spring-context.xml");
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        }
            String springContext = new String("");
            try {        
                    springContext= ClassGeneratorBase.getInstance().generateSourceByTemplateName(getClasse(),"springContext",initializeGreenboxContextAndVariables(),"/templates");
            } catch (Exception e ) {
               e.printStackTrace();
            }
      
      s2 = new StringReader(springContext); 
    
 try {
    v = new DiffPresenter(i);
    
    v.setProvider(dprov);
    v.setVisualizer(diff);
    diffPanel.add(v,BorderLayout.CENTER);
      
 }catch (Exception e) {
    NbUtils.showMessage(e.getMessage());
 }

The main point, you should pay atention is the fact to extend the class DiffPresenter.Info , in order to allow it works correctlly.

Any different tip will be appreciated in the comments section.

The Following Image shows the results of this testing code:
diff

cya



Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds