new headless application example
[walaincubator.git] / com.ibm.wala.eclipse / src / com / ibm / wala / eclipse / headless / Main.java
blob4a5de1113bef2197bc06fd886f5b66d88915c976
1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package com.ibm.wala.eclipse.headless;
13 import org.eclipse.core.resources.IProject;
14 import org.eclipse.core.resources.IProjectDescription;
15 import org.eclipse.core.resources.IWorkspace;
16 import org.eclipse.core.resources.IWorkspaceRoot;
17 import org.eclipse.core.resources.ResourcesPlugin;
18 import org.eclipse.core.runtime.IPath;
19 import org.eclipse.core.runtime.IPlatformRunnable;
21 /**
22 * A dummy main class that runs WALA in a headless Eclipse platform.
24 * This is for expository purposes, and tests some WALA eclipse functionality.
26 * It appears (sigh) that IPlatformRunnable will be deprecated in Eclipse 3.3
27 * and replaced by IApplication. Oh well. Going with the 3.2 API for now.
29 * @author sjfink
32 public class Main implements IPlatformRunnable {
34 public Object run(Object args) throws Exception {
35 IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
36 IPath workspaceRootPath = workspaceRoot.getLocation();
37 System.out.println("workspace: " + workspaceRootPath.toOSString());
39 // IWorkspace workspace = ResourcesPlugin.getWorkspace();
41 IProject[] projects = workspaceRoot.getProjects();
42 for (int i = 0; i < projects.length; i++) {
43 IProjectDescription p = projects[i].getDescription();
44 System.out.println("project: " + p.getName());
46 return null;