Java Code Examples for org.eclipse.core.runtime.Platform#getApplicationArgs()

The following examples show how to use org.eclipse.core.runtime.Platform#getApplicationArgs() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandLineArgsUtil.java    From MergeProcessor with Apache License 2.0 6 votes vote down vote up
/**
 * Parse all command line arguments
 */
public static void parseCommandLineArgs() {
	LogUtil.entering();

	String[] arguments = Platform.getApplicationArgs();
	for (String argument : arguments) {
		if (isUsageParameter(argument)) {
			parseUsageParameter();
		} else {
			LOGGER.fine(() -> String.format("Ignored unknown argument. argument=%s.", argument)); //$NON-NLS-1$
		}
	}

	if (printUsage) {
		printUsage();
	}

	LogUtil.exiting();
}
 
Example 2
Source File: ApplicationWorkbenchAdvisor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void postStartup() {
	super.postStartup();
	FileUtils.cleanCache();
	final String[] args = Platform.getApplicationArgs();
	if ( false ) {
		DEBUG.LOG("Arguments received by GAMA : " + Arrays.toString(args));
	}
	if ( args.length > 0 && args[0].contains("launcher.defaultAction") &&
		!args[0].contains("--launcher.defaultAction") ) {
		return;
	}
	if ( args.length >= 1 ) {

		if ( args[args.length - 1].endsWith(".gamr") ) {
			for ( final IEventLayerDelegate delegate : EventLayerStatement.delegates ) {
				if ( delegate.acceptSource(null, "launcher") ) {
					delegate.createFrom(null, args[args.length - 1], null);
				}
			}
		} else {
			WorkspaceModelsManager.instance.openModelPassedAsArgument(args[args.length - 1]);
		}
	}
}
 
Example 3
Source File: EclipseCommandLineUtils.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Checks whether specific application option was set. Options are set via Program arguments field of launch configuration, 
 * or, in production system - via xds-ide.ini. In xds-ide.ini program arguments are those that are specified before -vmargs option. 
 * Options specified after -vmargs are passed to the JVM.   
 * 
 * @param optionName - full option name, say "-perspective" or "--org.eclipse.equinox.p2.reconciler.dropins.directory".
 * @return
 */
public static boolean isApplicationArgSet(String optionName) {
	String[] args = Platform.getApplicationArgs();
	for (int i = 0; i < args.length; i++) {
		if (optionName.equalsIgnoreCase(args[i])) { //$NON-NLS-1$
			return true;
		}
	}
	return false;
}
 
Example 4
Source File: ApplicationConfiguration.java    From warcraft-remake with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Check if there is a project to import.
 */
private void checkProjectImport()
{
    final String[] args = Platform.getApplicationArgs();
    for (int i = 0; i < args.length; i++)
    {
        if (ApplicationConfiguration.ARG_IMPORT.equals(args[i]))
        {
            i++;
            if (i < args.length)
            {
                importProject(args[i]);

                final MapTileGame map = WorldModel.INSTANCE.getMap();
                map.create(Medias.create("map", "forest", "forest.png"));
                map.getFeature(MapTileGroup.class).loadGroups(Medias.create("map", "forest", "groups.xml"));
                map.getFeature(MapTileTransition.class)
                   .loadTransitions(Medias.create("map", "forest", "transitions.xml"));
                map.getFeature(MapTileCircuit.class)
                   .loadCircuits(Medias.create("map", "forest", "circuits.xml"));

                final GeneratorParameter parameters = new GeneratorParameter();
                parameters.add(new PrefMapSize(16, 16, 64, 64))
                          .add(new PrefMapFill(0))
                          .add(new PrefMapRegion(12, new TileArea(0, 0, 8, 64), 4, 60))
                          .add(new PrefMapRegion(12, new TileArea(56, 0, 64, 64), 4, 60))
                          .add(new PrefMapRegion(12, new TileArea(0, 0, 64, 8), 4, 60))
                          .add(new PrefMapRegion(12, new TileArea(0, 56, 64, 64), 4, 60))
                          .add(new PrefMapRegion(29, new TileArea(12, 12, 56, 56), 2, 250))
                          .add(new PrefMapRegion(12, new TileArea(24, 24, 40, 40), 2, 80))
                          .add(new PrefMapRegion(0, new TileArea(4, 4, 60, 60), 1, 100));

                final MapGenerator generator = new MapGeneratorImpl();
                final MapTileAppender appender = map.addFeatureAndGet(new MapTileAppenderModel());
                appender.append(generator.generateMap(parameters,
                                                      Arrays.asList(Medias.create("map",
                                                                                  "forest",
                                                                                  "forest.png")),
                                                      Medias.create("map", "forest", "sheets.xml"),
                                                      Medias.create("map", "forest", "groups.xml")),
                                0,
                                0);
                UtilPart.getPart(WorldPart.ID, WorldPart.class).update();
            }
        }
    }
}