1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.eclipse.common.util; |
17 | |
|
18 | |
import org.eclipse.core.resources.IProject; |
19 | |
import org.eclipse.core.resources.IWorkspaceRoot; |
20 | |
import org.eclipse.core.resources.ResourcesPlugin; |
21 | |
import org.eclipse.core.runtime.CoreException; |
22 | |
import org.eclipse.debug.core.ILaunch; |
23 | |
import org.eclipse.debug.core.ILaunchConfiguration; |
24 | |
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; |
25 | |
import org.seasar.eclipse.common.util.LogUtil; |
26 | |
import org.seasar.framework.util.StringUtil; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | 0 | public class LaunchUtil { |
33 | |
|
34 | |
public static IProject getProject(ILaunch launch) { |
35 | 0 | IProject result = null; |
36 | |
try { |
37 | 0 | ILaunchConfiguration config = launch.getLaunchConfiguration(); |
38 | 0 | String name = config.getAttribute( |
39 | |
IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); |
40 | 0 | if (StringUtil.isEmpty(name) == false) { |
41 | 0 | IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); |
42 | 0 | result = root.getProject(name); |
43 | |
} |
44 | 0 | } catch (CoreException e) { |
45 | 0 | LogUtil.log(ResourcesPlugin.getPlugin(), e); |
46 | 0 | } |
47 | 0 | return result; |
48 | |
} |
49 | |
} |