Search in sources :

Example 1 with Options

use of org.freeplane.main.application.CommandLineParser.Options in project freeplane by freeplane.

the class SingleInstanceManager method start.

public void start(String[] args) {
    final Options options = CommandLineParser.parse(args);
    final String[] filesToLoad = options.getFilesToOpenAsArray();
    if (isSingleInstanceMode && !options.hasMenuItemsToExecute()) {
        initLockFile();
        if (filesToLoad.length == 0 && !isSingleInstanceForceMode && checkIsMasterPresent()) {
            isMasterPresent = true;
            startStandAlone(filesToLoad);
        } else if (!startAsSlave(filesToLoad)) {
            if (!startAsMaster(filesToLoad)) {
                startStandAlone(filesToLoad);
            }
        }
    } else {
        startStandAlone(filesToLoad);
    }
}
Also used : Options(org.freeplane.main.application.CommandLineParser.Options)

Example 2 with Options

use of org.freeplane.main.application.CommandLineParser.Options in project freeplane by freeplane.

the class FreeplaneGUIStarter method createFrame.

public void createFrame(final String[] args) {
    Controller controller = Controller.getCurrentController();
    ModeController modeController = controller.getModeController(MModeController.MODENAME);
    controller.selectModeForBuild(modeController);
    Compat.macMenuChanges();
    new UserPropertiesUpdater().importOldDefaultStyle();
    EventQueue.invokeLater(new Runnable() {

        public void run() {
            final Options options = CommandLineParser.parse(args);
            viewController.init(Controller.getCurrentController());
            splash.toBack();
            final Frame frame = viewController.getFrame();
            final int extendedState = frame.getExtendedState();
            Container contentPane = viewController.getContentPane();
            contentPane.setVisible(false);
            splash.dispose();
            splash = null;
            frame.setVisible(true);
            if (extendedState != frame.getExtendedState()) {
                frame.setExtendedState(extendedState);
            }
            loadMaps(options.getFilesToOpenAsArray());
            focusCurrentView();
            viewController.getContentPane().setVisible(true);
            frame.toFront();
            startupFinished = true;
            System.setProperty("nonInteractive", Boolean.toString(options.isNonInteractive()));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            MenuUtils.executeMenuItems(options.getMenuItemsToExecute());
        }

        private void focusCurrentView() {
            final MapView currentMapView = (MapView) Controller.getCurrentController().getMapViewManager().getMapViewComponent();
            if (currentMapView != null) {
                viewController.focusTo(currentMapView);
            }
        }
    });
}
Also used : Options(org.freeplane.main.application.CommandLineParser.Options) JFrame(javax.swing.JFrame) Frame(java.awt.Frame) JRibbonFrame(org.pushingpixels.flamingo.api.ribbon.JRibbonFrame) Container(java.awt.Container) MapView(org.freeplane.view.swing.map.MapView) FModeController(org.freeplane.features.mode.filemode.FModeController) BModeController(org.freeplane.features.mode.browsemode.BModeController) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) FModeController(org.freeplane.features.mode.filemode.FModeController) TimeController(org.freeplane.features.time.TimeController) FilterController(org.freeplane.features.filter.FilterController) HelpController(org.freeplane.features.help.HelpController) MapController(org.freeplane.features.map.MapController) LogicalStyleFilterController(org.freeplane.features.styles.LogicalStyleFilterController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) TextController(org.freeplane.features.text.TextController) ModelessAttributeController(org.freeplane.features.attribute.ModelessAttributeController) PrintController(org.freeplane.features.print.PrintController) BModeController(org.freeplane.features.mode.browsemode.BModeController) FormatController(org.freeplane.features.format.FormatController) AddOnsController(org.freeplane.main.addons.AddOnsController) ResourceController(org.freeplane.core.resources.ResourceController) LinkController(org.freeplane.features.link.LinkController) FrameController(org.freeplane.features.ui.FrameController) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ScannerController(org.freeplane.features.format.ScannerController)

Example 3 with Options

use of org.freeplane.main.application.CommandLineParser.Options in project freeplane by freeplane.

the class CommandLineParserTest method testFilesOnly.

@Test
public void testFilesOnly() {
    final Options result = CommandLineParser.parse(someFiles);
    assertEquals(Arrays.asList(someFiles), result.getFilesToOpen());
    check(result, someFiles, emptyArray, false, false, false);
}
Also used : Options(org.freeplane.main.application.CommandLineParser.Options) Test(org.junit.Test)

Aggregations

Options (org.freeplane.main.application.CommandLineParser.Options)3 Container (java.awt.Container)1 Frame (java.awt.Frame)1 JFrame (javax.swing.JFrame)1 ResourceController (org.freeplane.core.resources.ResourceController)1 ModelessAttributeController (org.freeplane.features.attribute.ModelessAttributeController)1 FilterController (org.freeplane.features.filter.FilterController)1 FormatController (org.freeplane.features.format.FormatController)1 ScannerController (org.freeplane.features.format.ScannerController)1 HelpController (org.freeplane.features.help.HelpController)1 IconController (org.freeplane.features.icon.IconController)1 LinkController (org.freeplane.features.link.LinkController)1 MapController (org.freeplane.features.map.MapController)1 Controller (org.freeplane.features.mode.Controller)1 ModeController (org.freeplane.features.mode.ModeController)1 BModeController (org.freeplane.features.mode.browsemode.BModeController)1 FModeController (org.freeplane.features.mode.filemode.FModeController)1 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)1 PrintController (org.freeplane.features.print.PrintController)1 LogicalStyleFilterController (org.freeplane.features.styles.LogicalStyleFilterController)1