1 11 package org.eclipse.jdt.internal.launching.environments; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IConfigurationElement; 15 import org.eclipse.jdt.core.IAccessRule; 16 import org.eclipse.jdt.core.IJavaProject; 17 import org.eclipse.jdt.internal.launching.LaunchingPlugin; 18 import org.eclipse.jdt.launching.IVMInstall; 19 import org.eclipse.jdt.launching.LibraryLocation; 20 import org.eclipse.jdt.launching.environments.IAccessRuleParticipant; 21 import org.eclipse.jdt.launching.environments.IExecutionEnvironment; 22 23 28 class AccessRuleParticipant implements IAccessRuleParticipant { 29 30 private IConfigurationElement fElement; 31 32 private IAccessRuleParticipant fDelegate; 33 34 42 AccessRuleParticipant(IConfigurationElement element) { 43 fElement = element; 44 } 45 46 49 public IAccessRule[][] getAccessRules(IExecutionEnvironment environment, IVMInstall vm, LibraryLocation[] libraries, IJavaProject project) { 50 try { 51 return getDelegate().getAccessRules(environment, vm, libraries, project); 52 } catch (CoreException e) { 53 LaunchingPlugin.log(e.getStatus()); 54 } 55 IAccessRule[][] rules = new IAccessRule[libraries.length][]; 56 for (int i = 0; i < rules.length; i++) { 57 rules[i] = new IAccessRule[0]; 58 } 59 return rules; 60 } 61 62 private IAccessRuleParticipant getDelegate() throws CoreException { 63 if (fDelegate == null) { 64 if (fElement.getName().equals(EnvironmentsManager.ENVIRONMENT_ELEMENT)) { 65 fDelegate = (IAccessRuleParticipant) fElement.createExecutableExtension(EnvironmentsManager.RULE_PARTICIPANT_ELEMENT); 66 } else { 67 fDelegate = (IAccessRuleParticipant) fElement.createExecutableExtension("class"); } 69 } 70 return fDelegate; 71 } 72 73 78 String getId() { 79 if (fElement.getName().equals(EnvironmentsManager.ENVIRONMENT_ELEMENT)) { 80 return fElement.getAttribute(EnvironmentsManager.RULE_PARTICIPANT_ELEMENT); 81 } else { 82 return fElement.getAttribute("id"); } 84 } 85 86 } 87 | Popular Tags |