NV2DPlugin plugin = (NV2DPlugin) j.next(); if(plugin.menu() != null) { System.out.println("Adding menu from module " + plugin.name()); menu.addModuleMenu(plugin.menu());
IOInterface io = (IOInterface) j.next(); io.initialize(null, _r, this); if(io.menu() != null) { _menu.addModuleMenu(io.menu());
	public void loadModules(String [] args) {		pm = new NPluginManager();		if(args.length < 2) {			System.err.println("Please provide a plugin directory");			errormsg();			return;		}		// load all the modules		pm.load(args[0]);		// select io module		String io_mod = args[1];		if(pm.type(io_mod) != NPluginLoader.PLUGIN_TYPE_IO) {			System.err.println("Could not find IO-Plugin '" + io_mod + "'");			errormsg();			return;		}		IOInterface io = pm.get(io_mod);		io.initialize(null, r, this);		System.out.println("Getting data through the [" + io_mod + "] IO-Plugin");		String [] io_args = new String[args.length - 2];		// fill out IO arguments (= all but first two)		for(int i = 2; i < args.length; i++) {			io_args[i - 2] = args[i];		}		String [] reqArgs = io.requiredArgs();		if(reqArgs.length != io_args.length) {			System.err.println("This IO-Plugin requires " + reqArgs.length + " arguments.");			for(int j = 0; j < reqArgs.length; j++) {				System.err.println("   [" + j + "] " + reqArgs[j]);			}			errormsg();			return;		}		try {			g = (Graph) io.getData(io_args);		} catch (IOException ioe) {			System.err.println("There was an error importing data from this IO-Plugin.");			System.err.print("-> " + ioe.toString());			errormsg();			return;		}		/* initialize modules */		pm.all_initialize(g, r, this);		/* add module UI to top level UI */		Iterator j = pm.iterator();		while(j.hasNext()) {			NV2DPlugin plugin = (NV2DPlugin) j.next();			if(plugin.menu() != null) {				System.out.println("Adding menu from module " + plugin.name());				menu.addModuleMenu(plugin.menu());			}		}		// finally, add module menu		if(io.menu() != null) {			menu.addModuleMenu(io.menu());		}		/* load data file if specified, otherwise query user for datafile */	}