Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse plug-in IConsole vs View

My question: What is the advantage of using the Eclipse ConsoleManager class in opposite of putting my console in a view.

I have created my own console (a REPL) in java and would like to integrate it with Eclipse. I know of two ways to do so:

  • Create a plug-in view and just display my own textpane in it. Example code to start it:

    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().
        showView(REPL_PLUGIN_ID, project.getName(), IWorkbenchPage.VIEW_ACTIVATE);
    
  • Create a plug-in, implement the IConsole interface and add it using the ConsoleManager. Example code to start it:

    ConsolePlugin.getDefault().getConsoleManager().addConsoles(myConsoles)
    

Since I already implemented the Console I favor to the View part. I am not reluctant to implement the IConsole (and all the other interfaces that are required), however, I just don't see the advantages of it.

The Eclipse ConsoleManager must be there for a good reason, what is it? What would be the main reason/advantage to use it?

What I have found so far:

Advantages of implementing IConsole:

  • Support for default console buttons[3]

Disadvantages of implementing IConsole:

  • No (default?) support of rich text editing

I tried to make this question as clear as possible, yet if I can elaborate/clarify anything just let me know in a comment.

like image 995
JayL Avatar asked Jan 05 '14 16:01

JayL


2 Answers

The advantage is unified user experience. Eclipse has several generic views that users have become accustomed to: outline, properties, problems view, console etc. Imagine if everyone would add their own custom views instead of reusing existing ones. There would be an overflow of perspectives, each containing custom views for a specific task (or, alternatively, a single perspective crowded with custom views). So, if your console falls under the notion of console - task specific (text based) interaction containing only transient data - then you should probably implement your "view" as console.

like image 159
Martti Käärik Avatar answered Oct 15 '22 14:10

Martti Käärik


As the previously quoted wiki entry says the console view is primarily intended for simple ports of traditional code which uses System.out.print and the like.

A few plugins such as the SVN and CVS code use the Console view to provide the traditional output from commands but also provide additional views and dialogs which provide more or better information.

So if you are developing an Eclipse plugin from scratch I would say you create your own view(s). Hopefully you can provide more actions for manipulating your data than are available in the Console view. If appropriate you could also provide the console view like SVN does.

like image 26
greg-449 Avatar answered Oct 15 '22 12:10

greg-449