Author: oberhack Date: Thu Aug 19 18:31:09 2004 New Revision: 36643 Added: avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/ avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/MetroEnvironment.java avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/RepositoryEnvironment.java avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/ServerEnvironment.java Modified: avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/templateengine/ProjectManager.java Log:
Added: avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/MetroEnvironment.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/MetroEnvironment.java Thu Aug 19 18:31:09 2004 @@ -0,0 +1,76 @@ +/* + + Copyright 2004. The Apache Software Foundation. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.metro.studio.eclipse.core.environment; + +import java.io.IOException; +import java.util.Properties; + +import org.apache.avalon.util.defaults.DefaultsBuilder; +import org.apache.metro.studio.eclipse.core.MetroStudioCore; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Metro Development Team </a> + * 19.08.2004 last change: + * + */ +public class MetroEnvironment +{ + private DefaultsBuilder merlinBuilder; + + private DefaultsBuilder avalonBuilder; + + /** + * + */ + public MetroEnvironment() + { + super(); + + try + { + merlinBuilder = new DefaultsBuilder("merlin", null); + avalonBuilder = new DefaultsBuilder("avalon", null); + } catch (Exception e) + { + MetroStudioCore + .log(e, "Error while reading the Avalon environment"); + } + } + + /** + * @return + */ + public String getMerlinHome() + { + String path; + try + { + Properties prop = merlinBuilder.getUserProperties(); + prop = merlinBuilder.getDirProperties(); + prop = merlinBuilder.getHomeProperties(); + + path = merlinBuilder.getHomeDirectory().getCanonicalPath(); + } catch (IOException e) + { + MetroStudioCore.log(e, + "Error while reading the Merlin Home Directory"); + return null; + } + return path; + } +} \ No newline at end of file Added: avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/RepositoryEnvironment.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/RepositoryEnvironment.java Thu Aug 19 18:31:09 2004 @@ -0,0 +1,38 @@ +/* + + Copyright 2004. The Apache Software Foundation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +*/ +package org.apache.metro.studio.eclipse.core.environment; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Metro Development Team</a> + * 19.08.2004 + * last change: + * + */ +public class RepositoryEnvironment +{ + + /** + * + */ + public RepositoryEnvironment() + { + super(); + // TODO Auto-generated constructor stub + } + +} Added: avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/ServerEnvironment.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/environment/ServerEnvironment.java Thu Aug 19 18:31:09 2004 @@ -0,0 +1,38 @@ +/* + + Copyright 2004. The Apache Software Foundation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +*/ +package org.apache.metro.studio.eclipse.core.environment; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Metro Development Team</a> + * 19.08.2004 + * last change: + * + */ +public class ServerEnvironment +{ + + /** + * + */ + public ServerEnvironment() + { + super(); + // TODO Auto-generated constructor stub + } + +} Modified: avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/templateengine/ProjectManager.java ============================================================================== --- avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/templateengine/ProjectManager.java (original) +++ avalon/trunk/central/laboratory/studio/eclipse/core/src/org/apache/metro/studio/eclipse/core/templateengine/ProjectManager.java Thu Aug 19 18:31:09 2004 @@ -22,6 +22,7 @@ import org.apache.metro.studio.eclipse.core.MetroStudioCore; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.JavaCore; @@ -33,13 +34,13 @@ */ public class ProjectManager { - final static String BASE = "org.apache.metro.studio.core"; + final public static String BASE = "org.apache.metro.studio.core"; - final static String BLOCK_NATURE_ID = BASE + ".blockNature"; + final public static String BLOCK_NATURE_ID = BASE + ".blockNature"; - final static String FACILITY_NATURE_ID = BASE + ".facilityNature"; + final public static String FACILITY_NATURE_ID = BASE + ".facilityNature"; - final static String KERNEL_NATURE_ID = BASE + ".kernelNature"; + final public static String KERNEL_NATURE_ID = BASE + ".kernelNature"; /** * @@ -148,5 +149,28 @@ { MetroStudioCore.log(e, "can't delete project"); } + } + + /** + * @param project + * @return + */ + public static IProjectNature getNature(IProject project) + { + IProjectNature nature = null; + try + { + nature = project.getNature(ProjectManager.BLOCK_NATURE_ID); + // TODO: check for other valid Metro natures + + } catch (CoreException e) + { + MetroStudioCore.log(e, "Core Exception while searching a nature"); + } + if(nature == null) + { + MetroStudioCore.log(null, "no valid Metro Nature found"); + } + return nature; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]