| /******************************************************************************* |
| * Copyright (c) 2003, 2004 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.wst.common.modulecore.util; |
| |
| import org.eclipse.core.resources.IProject; |
| import org.eclipse.wst.common.modulecore.ArtifactEditModel; |
| import org.eclipse.wst.common.modulecore.ModuleCoreNature; |
| import org.eclipse.wst.common.modulecore.WorkbenchModule; |
| import org.eclipse.wst.common.modulecore.impl.UnresolveableURIException; |
| |
| /** |
| * <p> |
| * The following class is experimental until fully documented. |
| * </p> |
| */ |
| public class ArtifactEdit { |
| |
| |
| public static ArtifactEdit INSTANCE = new ArtifactEdit(); |
| |
| /* |
| * Javadoc copied from interface. |
| */ |
| public ArtifactEditModel getModuleEditModelForRead(WorkbenchModule aModule, Object anAccessorKey) { |
| try { |
| IProject project = ModuleCore.INSTANCE.getContainingProject(aModule.getHandle()); |
| ModuleCoreNature nature = ModuleCoreNature.getModuleCoreNature(project); |
| return nature.getModuleEditModelForRead(aModule.getHandle(), anAccessorKey); |
| } catch (UnresolveableURIException uue) { |
| //Ignore |
| } |
| return null; |
| } |
| |
| public ArtifactEditModel getModuleEditModelForWrite(WorkbenchModule aModule, Object anAccessorKey) { |
| try { |
| IProject project = ModuleCore.INSTANCE.getContainingProject(aModule.getHandle()); |
| ModuleCoreNature nature = ModuleCoreNature.getModuleCoreNature(project); |
| return nature.getModuleEditModelForWrite(aModule.getHandle(), anAccessorKey); |
| } catch (UnresolveableURIException uue) { |
| //Ignore |
| } |
| return null; |
| |
| } |
| } |