I need an editor to be able to open a lot of Java and Python programs. Is it possible to get the class browser to work without creating a workspace or project for each file?
Unfortunately since the ctags builder is directly tied to the files contained in the project worksapce and the class browser is nothing but a display of the ctags information, there is no way to display information in the class browser without first creating a workspace
But the Zeus macro scripting does offer a semi-automatic work around. The following Lua macro:
Code: Select all
-- Name: Generic Workspace
--
-- Author: Jussi Jumppanen
--
-- Language: Lua Macro
--
-- Description: This simple Lua macro is designed to create a project
-- for nothing but the current file. To use this macro
-- will require the following once of initialisation:
--
-- 1) Run the macro to create the workspace
-- 2) Use the Workspace Open menu to open the newly
-- created Generic workspace
--
-- Once the workspace is created and is open all you need
-- do is open any file and run the macro. The macro will
-- recreate the workspace and upfate the class browser to
-- reflect the current file only.
function create_project_workspace(filename)
-- open the workspace file
file_workspace = io.open("c:\\temp\\generic.zwi", "w+")
if file_workspace ~= nil then
-- create the workspace file
file_workspace:write("<workspace name=\"Generic\">\n" )
file_workspace:write(" <mode></mode>\n" )
file_workspace:write(" <active>Generic</active>\n" )
file_workspace:write(" <project name=\"Generic\">c:\\temp\\generic.zpi</project>\n")
file_workspace:write("</workspace>\n" )
file_workspace:close()
-- open the project file
file_project = io.open("c:\\temp\\generic.zpi", "w+")
if file_project ~= nil then
-- create the project file
file_project:write("<!-- Generic project file for the Zeus for Windows editor.-->\n")
file_project:write("<project name=\"Generic\">\n" )
-- add the file to the workspace here
file_project:write(" <file>" .. filename .. "</file>\n" )
file_project:write("</project>\n" )
file_project:close()
else
-- failed to create file
message_box(1, "Error creating the 'c:\\temp\\generic.zpi' file")
end
else
-- failed to create file
message_box(1, "Error creating the 'c:\\temp\\generic.zwi' file")
end
end
function key_macro()
-- This macro will only work for document windows.
local document = is_document ()
if (document == 0) then
message("This macro only works for document files!")
beep()
return 1
end
-- get the current text details
local filename = macro_tag("$fn")
--
-- NOTE: Read the special initialistion section in the macro header
--
-- close the generic workspace
WorkspaceClose()
-- create an empty workspace
create_project_workspace(filename)
-- reload the newly generic workspace
WorkspaceReload01()
end
key_macro()
automatically creates a workspace containing nothing but the current file. If you
bind this macro to the keyboard you can update the class browser display with a single key press
Note:Unfortunately this macro is not as seamless as it should be and it does require minimal initialisation

For details see the header information of the macro source.
Ideally, I'd like the class browser to work as soon as I open a file.
In the process of writing of this macro I realised there is no way to open a named workspace using a scripting function. Unfortunately without such a function it is not possible to make the integration seamless
But I will make sure a new
workspace_open(filename) macro function is added, enabling a more seamless interface
Cheers Jussi