Xzajo's Weblog

All | Java | nbxdoclet | NetBeans | Personal | Project Extensions | Sun | Testing
« Previous day (Sep 19, 2006) | Main | Next day (Sep 20, 2006) »
20060920 Wednesday September 20, 2006

Command Line Parsing API in NetBeans Platform

Jaroslav Tulach integrated Command Line Parsing API to NetBeans platform this week. The API was already tested in DVB Central project.

I wrote simple OptionProcessor in few minutes:

import java.util.Collections;
import java.util.Map;
import java.util.Set;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.spi.sendopts.Env;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;

public class MyOptions  extends OptionProcessor {
    private static Option message = Option.requiredArgument(Option.NO_SHORT_NAME, "message");
    
    public Set

The MyOptions processor is register in META-INF/sevices. The registration can by done by META-INF/services browser. The MyOptions provider display first parameter of -message parameter in message dialog box. For Example

./netbeans --message Hello
shows Hello message.

Posted by xzajo ( Sep 20 2006, 12:25:45 AM CEST ) Permalink Comments [10]

Calendar

RSS Feeds

Search

Links

Navigation

Referers