incubator-imperius-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: svn commit: r612031 [2/6] - in /incubator/imperius/trunk: ./ imperius-javasplextension/ imperius-javasplextension/META-INF/ imperius-javasplextension/src/ imperius-javasplextension/src/org/ imperius-javasplextension/src/org/apache/ imperius-javasplexte...
Date Tue, 15 Jan 2008 18:00:39 GMT
Hi Neeraj,

Just one observation on licenses. All editable files with  
"intellectual property" content need to have licenses as well, even  
pom.xml.

The license header for all xml files should have this just after the  
xml version="1.0" line.

<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you 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.
-->

Craig

On Jan 14, 2008, at 10:53 PM, jneeraj@apache.org wrote:

> Added: incubator/imperius/trunk/imperius-spleditorcore/pom.xml
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/pom.xml?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/pom.xml (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/pom.xml Mon Jan  
> 14 22:52:53 2008
> @@ -0,0 +1,240 @@
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
> " xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd 
> ">
> +	<modelVersion>4.0.0</modelVersion>
> +	<groupId>imperius</groupId>
> +	<artifactId>imperius-spleditorcore</artifactId>
> +	<packaging>jar</packaging>
> +	<version>1.0.0-SNAPSHOT</version>
> +	<name>imperius-spleditorcore</name>
> +	<dependencies>
> +		<dependency>
> +			<groupId>imperius</groupId>
> +			<artifactId>imperius-splcore</artifactId>
> +			<version>1.0.0-SNAPSHOT</version>
> +	    	</dependency>
> +		
> +		<!--<dependency>
> +			<groupId>imperius</groupId>
> +			<artifactId>imperius-splsimulation</artifactId>
> +			<version>1.0.0-SNAPSHOT</version>
> +		</dependency>-->
> +		<dependency>
> +			<groupId>antlr</groupId>
> +			<artifactId>antlr</artifactId>
> +			<version>2.7.7</version>
> +		</dependency>		
> +		<dependency>
> +			<groupId>org.eclipse.platform</groupId>
> +			<artifactId>org.eclipse.platform</artifactId>
> +			<version>[3.3.0,)</version>
> +
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.core</groupId>
> +			<artifactId>org.eclipse.core.runtime</artifactId>
> +			<version>[3.3.100,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.osgi</groupId>
> +			<artifactId>org.eclipse.osgi</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.equinox</groupId>
> +			<artifactId>org.eclipse.equinox.common</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.core</groupId>
> +			<artifactId>org.eclipse.core.jobs</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.core</groupId>
> +			<artifactId>org.eclipse.core.runtime.compatibility.registry</ 
> artifactId>
> +			<version>[3.2.100,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.equinox</groupId>
> +			<artifactId>org.eclipse.equinox.registry</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.equinox</groupId>
> +			<artifactId>org.eclipse.equinox.preferences</artifactId>
> +			<version>[3.2.100,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.core</groupId>
> +			<artifactId>org.eclipse.core.contenttype</artifactId>
> +			<version>[3.2.100,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.equinox</groupId>
> +			<artifactId>org.eclipse.equinox.app</artifactId>
> +			<version>[1.0.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.core</groupId>
> +			<artifactId>org.eclipse.core.resources</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.ui</groupId>
> +			<artifactId>org.eclipse.ui</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.swt</groupId>
> +			<artifactId>org.eclipse.swt</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.swt</groupId>
> +			<artifactId>org.eclipse.swt.win32.win32.x86</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.jface</groupId>
> +			<artifactId>org.eclipse.jface</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.core</groupId>
> +			<artifactId>org.eclipse.core.commands</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.ui</groupId>
> +			<artifactId>org.eclipse.ui.workbench</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.ui</groupId>
> +			<artifactId>org.eclipse.ui.views</artifactId>
> +			<version>[3.2.100,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.jface</groupId>
> +			<artifactId>org.eclipse.jface.text</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.text</groupId>
> +			<artifactId>org.eclipse.text</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.debug</groupId>
> +			<artifactId>org.eclipse.debug.core</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.jdt</groupId>
> +			<artifactId>org.eclipse.jdt.debug</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.jdt</groupId>
> +			<artifactId>org.eclipse.jdt.core</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.jdt</groupId>
> +			<artifactId>org.eclipse.jdt.compiler.apt</artifactId>
> +			<version>[1.0.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.jdt</groupId>
> +			<artifactId>org.eclipse.jdt.compiler.tool</artifactId>
> +			<version>[1.0.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.jdt</groupId>
> +			<artifactId>org.eclipse.jdt.ui</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.ui</groupId>
> +			<artifactId>org.eclipse.ui.ide</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.ui</groupId>
> +			<artifactId>org.eclipse.ui.editors</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.core</groupId>
> +			<artifactId>org.eclipse.core.filebuffers</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.debug</groupId>
> +			<artifactId>org.eclipse.debug.ui</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.emf</groupId>
> +			<artifactId>org.eclipse.emf.ecore</artifactId>
> +			<version>[2.2.3,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.emf</groupId>
> +			<artifactId>org.eclipse.emf.common</artifactId>
> +			<version>[2.2.2,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.ui</groupId>
> +			<artifactId>org.eclipse.ui.forms</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.emf</groupId>
> +			<artifactId>org.eclipse.emf.edit</artifactId>
> +			<version>[2.2.2,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.emf</groupId>
> +			<artifactId>org.eclipse.emf.ecore.change</artifactId>
> +			<version>[2.2.1,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.emf</groupId>
> +			<artifactId>org.eclipse.emf.edit.ui</artifactId>
> +			<version>[2.2.3,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.emf</groupId>
> +			<artifactId>org.eclipse.emf.common.ui</artifactId>
> +			<version>[2.2.1,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.team</groupId>
> +			<artifactId>org.eclipse.team.core</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>com.ibm.icu</groupId>
> +			<artifactId>com.ibm.icu</artifactId>
> +			<version>3.6.1</version>
> +		</dependency>
> +		<dependency>
> +			<groupId>org.eclipse.jdt</groupId>
> +			<artifactId>org.eclipse.jdt.launching</artifactId>
> +			<version>[3.3.0,)</version>
> +		</dependency>
> +	</dependencies>
> +	<build>
> +		<sourceDirectory>src</sourceDirectory>
> +		<plugins>
> +		      <plugin>
> +			<groupId>org.apache.maven.plugins</groupId>
> +			<artifactId>maven-jar-plugin</artifactId>
> +			<configuration>
> +				<includes>*.class,*.properties</includes>
> +			</configuration>
> +		      </plugin>
> +		 </plugins>
> +			
> +	</build>
> +</project>
> \ No newline at end of file
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/pom.xml
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/schema/ 
> binding.exsd
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/schema/binding.exsd?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/schema/ 
> binding.exsd (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/schema/ 
> binding.exsd Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,122 @@
> +<?xml version='1.0' encoding='UTF-8'?>
> +<!-- Schema file written by PDE -->
> +<schema targetNamespace="org.apache.imperius.spl.editor.tool">
> +<annotation>
> +      <appInfo>
> +         <meta.schema plugin="org.apache.imperius.spl.editor.tool"  
> id="binding" name="SPLBinder"/>
> +      </appInfo>
> +      <documentation>
> +         [Enter description of this extension point.]
> +      </documentation>
> +   </annotation>
> +
> +   <element name="extension">
> +      <complexType>
> +         <sequence>
> +            <element ref="spl"/>
> +         </sequence>
> +         <attribute name="point" type="string" use="required">
> +            <annotation>
> +               <documentation>
> +
> +               </documentation>
> +            </annotation>
> +         </attribute>
> +         <attribute name="id" type="string">
> +            <annotation>
> +               <documentation>
> +
> +               </documentation>
> +            </annotation>
> +         </attribute>
> +         <attribute name="name" type="string">
> +            <annotation>
> +               <documentation>
> +
> +               </documentation>
> +               <appInfo>
> +                  <meta.attribute translatable="true"/>
> +               </appInfo>
> +            </annotation>
> +         </attribute>
> +      </complexType>
> +   </element>
> +
> +   <element name="spl">
> +      <complexType>
> +         <sequence>
> +            <element ref="binder"/>
> +         </sequence>
> +      </complexType>
> +   </element>
> +
> +   <element name="binder">
> +      <complexType>
> +         <sequence>
> +         </sequence>
> +         <attribute name="name" type="string" use="required">
> +            <annotation>
> +               <documentation>
> +
> +               </documentation>
> +            </annotation>
> +         </attribute>
> +         <attribute name="class" type="string" use="required">
> +            <annotation>
> +               <documentation>
> +
> +               </documentation>
> +               <appInfo>
> +                  <meta.attribute kind="java"  
> basedOn 
> = 
> ":org.apache.imperius.spl.editor.tool.internal.client.IPolicyClient"/>
> +               </appInfo>
> +            </annotation>
> +         </attribute>
> +      </complexType>
> +   </element>
> +
> +   <annotation>
> +      <appInfo>
> +         <meta.section type="since"/>
> +      </appInfo>
> +      <documentation>
> +         [Enter the first release in which this extension point  
> appears.]
> +      </documentation>
> +   </annotation>
> +
> +   <annotation>
> +      <appInfo>
> +         <meta.section type="examples"/>
> +      </appInfo>
> +      <documentation>
> +         [Enter extension point usage example here.]
> +      </documentation>
> +   </annotation>
> +
> +   <annotation>
> +      <appInfo>
> +         <meta.section type="apiInfo"/>
> +      </appInfo>
> +      <documentation>
> +         [Enter API information here.]
> +      </documentation>
> +   </annotation>
> +
> +   <annotation>
> +      <appInfo>
> +         <meta.section type="implementation"/>
> +      </appInfo>
> +      <documentation>
> +         [Enter information about supplied implementation of this  
> extension point.]
> +      </documentation>
> +   </annotation>
> +
> +   <annotation>
> +      <appInfo>
> +         <meta.section type="copyright"/>
> +      </appInfo>
> +      <documentation>
> +
> +      </documentation>
> +   </annotation>
> +
> +</schema>
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/site.xml
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/site.xml?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/site.xml (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/site.xml Mon Jan  
> 14 22:52:53 2008
> @@ -0,0 +1,7 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<site>
> +   <feature url="features/ 
> org.apache.imperius.javaspl.feature_1.0.0.jar"  
> id="org.apache.imperius.javaspl.feature" version="1.0.0">
> +      <category name="SPL Editor"/>
> +   </feature>
> +   <category-def name="SPL Editor" label="SPL Editor"/>
> +</site>
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/site.xml
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/PluginActivator.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/PluginActivator.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/PluginActivator.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/PluginActivator.java Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,284 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +package org.apache.imperius.spl.editor.tool;
> +
> +import java.util.HashMap;
> +import java.util.Iterator;
> +import java.util.Map;
> +import java.util.MissingResourceException;
> +import java.util.Properties;
> +import java.util.ResourceBundle;
> +import java.util.SortedMap;
> +import java.util.TreeMap;
> +
> +import org.apache.imperius.spl.editor.tool.utils.PolicyPluginLogUtil;
> +import org.eclipse.core.resources.IProject;
> +import org.eclipse.core.resources.IWorkspace;
> +import org.eclipse.core.resources.ResourcesPlugin;
> +import org.eclipse.core.runtime.IConfigurationElement;
> +import org.eclipse.core.runtime.IExtension;
> +import org.eclipse.core.runtime.IExtensionPoint;
> +import org.eclipse.core.runtime.IExtensionRegistry;
> +import org.eclipse.core.runtime.Platform;
> +import org.eclipse.swt.widgets.Shell;
> +import org.eclipse.ui.IWorkbenchWindow;
> +import org.eclipse.ui.plugin.AbstractUIPlugin;
> +import org.osgi.framework.BundleContext;
> +
> +
> +/**
> + * The activator class controls the plug-in life cycle
> + */
> +public class PluginActivator extends AbstractUIPlugin {
> +
> +	// The plug-in ID
> +	public static final String PLUGIN_ID =  
> "org.apache.imperius.spl.editor.tool";
> +
> +	// The shared instance
> +	private static PluginActivator plugin;
> +
> +	private ResourceBundle resourceBundle;
> +
> +	// map object stores key as language name and value as class object
> +	private SortedMap extensionsMap;
> +	
> +	private String binderNames;
> +	
> +	private Map projectTypeMap = null;
> +	
> +	private Map customActionExprMap = null;
> +
> +	/**
> +	 * The constructor
> +	 */
> +	public PluginActivator() {
> +	}
> +
> +	/*
> +	 * (non-Javadoc)
> +	 *
> +	 * @see  
> org 
> .eclipse 
> .ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
> +	 */
> +	public void start(BundleContext context) throws Exception {
> +		super.start(context);
> +		plugin = this;
> +		try {
> +			extensionsMap = new TreeMap();
> +			projectTypeMap = new HashMap();
> +			customActionExprMap = new HashMap();
> +			setExtensionPointsInfo();
> +			setBindedLanguages();
> +			resourceBundle =  
> ResourceBundle 
> .getBundle("org.apache.imperius.spl.editor.tool.pluginResources");
> +		} catch (MissingResourceException me) {
> +			resourceBundle = null;
> +		} catch (Exception e) {
> +			e.printStackTrace();
> +		}
> +	}
> +
> +	/**
> +	 *
> +	 * @return
> +	 */
> +	public Map getLanguageBinders() {
> +		return extensionsMap;
> +	}
> +	
> +	public void setExtensionMap(String domain, Object classObj) {
> +		extensionsMap.put(domain, classObj);
> +	}
> +
> +	/**
> +	 *
> +	 * @return
> +	 */
> +	public String getBinderNames() {
> +		return binderNames;
> +	}
> +	
> +	private void setBindedLanguages() {
> +		String languageStr = "";
> +		if(extensionsMap != null && extensionsMap.size() > 0) {
> +			Iterator iteratorObj = extensionsMap.keySet().iterator();
> +			while(iteratorObj.hasNext()) {
> +				languageStr = languageStr + (String) iteratorObj.next() +  
> (iteratorObj.hasNext()?",":"");
> +			}
> +		}
> +		binderNames = languageStr;
> +	}
> +
> +	private void setExtensionPointsInfo() throws Exception {
> +		try {
> +			IExtensionRegistry registry = Platform.getExtensionRegistry();
> +			IExtensionPoint point =  
> registry 
> .getExtensionPoint("org.apache.imperius.spl.editor.tool.binding");
> +			if (point != null) {
> +				IExtension[] extensionArray = point.getExtensions();
> +				if (extensionArray != null && extensionArray.length > 0) {
> +					IExtension extension = null;
> +					for (int i = 0; i < extensionArray.length; i++) {
> +						extension = (IExtension) extensionArray[i];
> +						IConfigurationElement[] configElementArray =  
> extension.getConfigurationElements();
> +						if (configElementArray != null && configElementArray.length >  
> 0) {
> +							IConfigurationElement configElement = null;
> +							for (int j = 0; j < configElementArray.length; j++) {
> +								configElement = (IConfigurationElement)  
> configElementArray[j];
> +								IConfigurationElement[] configChildren =  
> configElement.getChildren();
> +								if (configChildren != null) {
> +									IConfigurationElement configChild = null;
> +									for (int k = 0; k < configChildren.length; k++) {
> +										configChild = configChildren[k];
> +										// 
> extensionsMap 
> .put 
> (configChild 
> .getAttribute("name"),configChild.createExecutableExtension("class"));
> +										 
> extensionsMap.put(configChild.getAttribute("name"),configChild);
> +									}
> +								}
> +							}
> +						}
> +					}
> +				} else {
> +					PolicyPluginLogUtil.logMessage("No extension points defined");
> +				}
> +			}
> +		} catch (Exception e) {
> +			e.printStackTrace();
> +			PolicyPluginLogUtil.logError(e);
> +			throw e;
> +		}
> +	}
> +	
> +	
> +	public BundleContext getBundleContext() {
> +		return super.getBundle().getBundleContext();
> +	}
> +
> +	/*
> +	 * (non-Javadoc)
> +	 *
> +	 * @see  
> org 
> .eclipse 
> .ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
> +	 */
> +	public void stop(BundleContext context) throws Exception {
> +		plugin = null;
> +		super.stop(context);
> +	}
> +
> +	/**
> +	 *
> +	 * @return the shared instance
> +	 */
> +	public static PluginActivator getDefault() {
> +		return plugin;
> +	}
> +
> +	/**
> +	 *
> +	 * @return
> +	 */
> +	public static IWorkspace getWorkspace() {
> +		return ResourcesPlugin.getWorkspace();
> +	}
> +
> +	/**
> +	 *
> +	 * @return
> +	 */
> +	public static IWorkbenchWindow getActiveWorkbenchWindow() {
> +		return plugin.getWorkbench().getActiveWorkbenchWindow();
> +	}
> +
> +	/**
> +	 *
> +	 * @return
> +	 */
> +	public static Shell getActiveWorkbenchShell() {
> +		IWorkbenchWindow window =  
> PluginActivator.getActiveWorkbenchWindow();
> +		return window == null ? null : window.getShell();
> +	}
> +
> +	/**
> +	 *
> +	 * @return
> +	 */
> +	public ResourceBundle getResourceBundle() {
> +		return resourceBundle;
> +	}
> +
> +	/**
> +	 * Function to get values from the resource bundle
> +	 */
> +	public String getMessage(String aKey) {
> +		String value = null;
> +		ResourceBundle bundle =  
> PluginActivator.getDefault().getResourceBundle();
> +		if (bundle != null) {
> +			try {
> +				value = bundle.getString(aKey);
> +			} catch (MissingResourceException me) {
> +				value = "!" + aKey + "!";
> +				PolicyPluginLogUtil.logMessage(me.getMessage());
> +			}
> +		} else {
> +			value = "!" + aKey + "!";
> +		}
> +		return value;
> +	}
> +	
> +	public String getProjectType(String projectName) {
> +		return (String)projectTypeMap.get(projectName);
> +	}
> +	
> +	public void setProjectType(String projectName, String value) {
> +		projectTypeMap.put(projectName, value);
> +	}
> +	
> +	public void loadCustomActions(IProject iProject, Properties  
> propsObj, String jarFileName) {
> +		try {
> +			Map innerMap = null;
> +			if(customActionExprMap.containsKey(iProject.getName())) {
> +				innerMap = (Map)customActionExprMap.get(iProject.getName());
> +				innerMap.put(jarFileName, propsObj);				
> +			} else {
> +				innerMap = new HashMap();
> +				innerMap.put(jarFileName, propsObj);
> +			}
> +			customActionExprMap.put(iProject.getName(), innerMap);
> +		} catch(Exception e) {
> +			PolicyPluginLogUtil.logError(e);
> +		}
> +		
> +	}
> +	
> +	public Map getCustomExprMap(String projectname) {
> +		return (Map)customActionExprMap.get(projectname);
> +	}
> +	
> +	public void setCustomExprMap(IProject aProject, Map innerMap) {
> +		customActionExprMap.put(aProject.getName(), innerMap);
> +	}
> +	
> +	
> +//	static
> +//	{
> +//		PluginActivator.getWorkspace().addResourceChangeListener(new  
> ClasspathChangeListener());
> +//		
> +//	}
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/PluginActivator.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> IPolicyFileValidator.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/builder/IPolicyFileValidator.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/IPolicyFileValidator.java  
> (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/IPolicyFileValidator.java  
> Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,33 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> + package org.apache.imperius.spl.editor.tool.internal.builder;
> +
> +import org.eclipse.core.resources.IFile;
> +
> +public interface IPolicyFileValidator {
> +	
> +	public void validatePolicyFile(IFile file);
> +
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> IPolicyFileValidator.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> IPolicyMarkerFactory.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/builder/IPolicyMarkerFactory.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/IPolicyMarkerFactory.java  
> (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/IPolicyMarkerFactory.java  
> Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,35 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +
> +package org.apache.imperius.spl.editor.tool.internal.builder;
> +
> +import org.eclipse.core.resources.IFile;
> +import org.eclipse.core.resources.IMarker;
> +import org.eclipse.core.runtime.CoreException;
> +
> +public interface IPolicyMarkerFactory {
> +
> +	IMarker createMarker(IFile file) throws CoreException;
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> IPolicyMarkerFactory.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> IPolicyStreamListener.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/builder/IPolicyStreamListener.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/IPolicyStreamListener.java  
> (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/IPolicyStreamListener.java  
> Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,30 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +package org.apache.imperius.spl.editor.tool.internal.builder;
> +
> +public interface IPolicyStreamListener {
> +
> +	public void listenToError(String s, Object object);
> +}
> \ No newline at end of file
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> IPolicyStreamListener.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/PolicyBuilder.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/builder/PolicyBuilder.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/PolicyBuilder.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/PolicyBuilder.java Mon Jan  
> 14 22:52:53 2008
> @@ -0,0 +1,245 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +
> +package org.apache.imperius.spl.editor.tool.internal.builder;
> +
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.List;
> +import java.util.Map;
> +
> +import org.apache.imperius.spl.editor.tool.PluginActivator;
> +import org.apache.imperius.spl.editor.tool.utils.PolicyCacheUtil;
> +import org.apache.imperius.spl.editor.tool.utils.PolicyPluginLogUtil;
> +import org.eclipse.core.resources.ICommand;
> +import org.eclipse.core.resources.IFile;
> +import org.eclipse.core.resources.IFolder;
> +import org.eclipse.core.resources.IProject;
> +import org.eclipse.core.resources.IProjectDescription;
> +import org.eclipse.core.resources.IResource;
> +import org.eclipse.core.resources.IResourceDelta;
> +import org.eclipse.core.resources.IResourceDeltaVisitor;
> +import org.eclipse.core.resources.IResourceProxy;
> +import org.eclipse.core.resources.IResourceProxyVisitor;
> +import org.eclipse.core.resources.IncrementalProjectBuilder;
> +import org.eclipse.core.runtime.CoreException;
> +import org.eclipse.core.runtime.IProgressMonitor;
> +import org.eclipse.jdt.core.JavaCore;
> +
> +
> +public class PolicyBuilder extends IncrementalProjectBuilder  
> implements IResourceDeltaVisitor {
> +
> +	public static final String SPL_BUILDER_ID =  
> PluginActivator.PLUGIN_ID+".splBuilder";
> +	
> +	private IFile resourceFile;
> +	
> +	private IPolicyFileValidator validator = null;
> +	
> +	/**
> +	 *
> +	 */
> +	public PolicyBuilder() {
> +		validator = new PolicyFileValidatorImpl();
> +	}
> +
> +	/**
> +	 * function to add builder to the project
> +	 *
> +	 * @param aProject
> +	 */
> +	public static void addBuilderToProject(IProject aProject) {
> +		if (aProject != null && aProject.isOpen()) {
> +			// get Project Description
> +			IProjectDescription projectDesc = null;
> +			try {
> +				projectDesc = aProject.getDescription();
> +			} catch (CoreException ce) {
> +				PolicyPluginLogUtil.logError("In addBuilderToProject() while  
> getting project description...", ce);				
> +			}
> +			
> +			// Look for builder already associated
> +			ICommand[] cmds = projectDesc.getBuildSpec();
> +			for (int i = 0; i < cmds.length; i++) {
> +				if (cmds[i].getBuilderName().equals(SPL_BUILDER_ID)) {
> +					return;
> +				}
> +			}
> +			
> +			// Associate this builder with project
> +			ICommand newCmd = projectDesc.newCommand();
> +			newCmd.setBuilderName(SPL_BUILDER_ID);
> +			List newCmds = new ArrayList(Arrays.asList(cmds));
> +			newCmds.add(newCmd);
> +			projectDesc.setBuildSpec((ICommand[]) newCmds.toArray(new  
> ICommand[0]));
> +			try {
> +				aProject.setDescription(projectDesc, null);
> +			} catch (CoreException ce) {
> +				ce.printStackTrace();
> +				PolicyPluginLogUtil.logError("In addBuilderToProject() while  
> setting project description...", ce);
> +			}
> +		}
> +	}
> +
> +	/**
> +	 * function that removes the project
> +	 * @param aProject
> +	 */
> +	public static void removeBuilderFromProject(IProject aProject) {
> +		if (aProject != null && aProject.isOpen()) {
> +			
> +			// get Project Description
> +			IProjectDescription projectDesc = null;
> +			try {
> +				projectDesc = aProject.getDescription();
> +			} catch (CoreException ce) {
> +				PolicyPluginLogUtil.logError("In removeBuilderFromProject()  
> while getting project description...", ce);				
> +			}
> +			
> +			// Look for builder already associated
> +			int iMatch = -1;
> +			ICommand[] cmds = projectDesc.getBuildSpec();
> +			for (int i = 0; i < cmds.length; i++) {
> +				if (cmds[i].getBuilderName().equals(SPL_BUILDER_ID)) {
> +					iMatch = i;
> +					break;
> +				}
> +			}
> +
> +			if (iMatch != -1) {
> +				List newCmds = new ArrayList(Arrays.asList(cmds));
> +				newCmds.remove(iMatch);
> +				projectDesc.setBuildSpec((ICommand[]) newCmds.toArray(new  
> ICommand[0]));
> +				try {
> +					aProject.setDescription(projectDesc, null);
> +				} catch (CoreException ce) {
> +					PolicyPluginLogUtil.logError("In removeBuilderFromProject()  
> while setting project description...", ce);					
> +				}
> +			}
> +		}
> +	}
> +
> +	/**
> +	 *
> +	 */
> +	protected IProject[] build(int aKind, Map anArgs, IProgressMonitor  
> aMonitor) throws CoreException {
> +		aMonitor.beginTask("monitoring build", 1);
> +		if(aKind == FULL_BUILD) {
> +			//do a full build of the project
> +//			fullBuild(aMonitor);
> +		} else {
> +			IResourceDelta delta = getDelta(getProject());
> +			if (delta == null) {
> +				//do a full build of the project
> +				fullBuild(aMonitor);
> +			} else {
> +				incrementalBuild(delta, aMonitor);
> +			}
> +		}
> +		aMonitor.done();
> +		return null;
> +	}
> +
> +	/**
> +	 *
> +	 * @param monitor
> +	 * @return
> +	 * @throws CoreException
> +	 */
> +	private IProject[] fullBuild(IProgressMonitor monitor) throws  
> CoreException {
> +		// call the cache util to load from cache
> +		PolicyCacheUtil cacheUtil = PolicyCacheUtil.getCacheUtilInstance();
> +		cacheUtil.initializeProjectCacheMap(getProject());
> +		
> +		getProject().accept(new IResourceProxyVisitor() {
> +			public boolean visit(IResourceProxy proxy) throws CoreException {
> +				if (proxy.getType() == IResource.FILE) {
> +					if (proxy.getName().toUpperCase().endsWith(".SPL")) {
> +						resourceFile = (IFile) proxy.requestResource();
> +						String relativePath =  
> resourceFile.getProjectRelativePath().toOSString();
> +						if(getProject().hasNature(JavaCore.NATURE_ID)) {
> +							if(relativePath.indexOf("bin") == -1) {
> +								validatePolicyFile(resourceFile);
> +							}
> +						} else {
> +							validatePolicyFile(resourceFile);
> +						}
> +					}
> +				}
> +				return true;
> +			}
> +		}, 0);
> +		return null;
> +	}
> +	
> +	public void validatePolicyFile(IFile resourceFile) {
> +		// parse the file
> +		validator.validatePolicyFile(resourceFile);
> +	}
> +
> +	protected void incrementalBuild(IResourceDelta delta,  
> IProgressMonitor monitor) throws CoreException {
> +	      // the visitor does the work.
> +	      delta.accept(this);
> +	   }
> +
> +	 public boolean visit(IResourceDelta aDelta) {
> +		 boolean visitChildren = false;
> +		 IResource resource = aDelta.getResource();
> +		 if(resource instanceof IProject) {
> +			 visitChildren = true;
> +		 } else if(resource instanceof IFolder) {
> +			 visitChildren = true;
> +		 } else if(resource instanceof IFile) {
> +			 IFile file = (IFile)resource;
> +			 String ext = file.getFileExtension();
> +			 if(file.exists() && ext != null && ext.equals("spl")) {
> +				 String relativePath =  
> file.getProjectRelativePath().toOSString();
> +				 switch(aDelta.getKind()) {
> +				 	case IResourceDelta.ADDED:
> +				 		break;
> +				 	case IResourceDelta.REMOVED:
> +				 		visitChildren = true;
> +				 		break;
> +				 	case IResourceDelta.CHANGED:
> +						try {
> +							if(getProject().hasNature(JavaCore.NATURE_ID)) {
> +								if(relativePath.indexOf("bin") == -1) {
> +									validatePolicyFile(file);
> +								}
> +							} else {
> +								validatePolicyFile(file);
> +							}
> +						} catch (CoreException e) {
> +							e.printStackTrace();
> +						}
> +						visitChildren = true;
> +						break;
> +				 	default:
> +				 		break;
> +				 }
> +			 }
> +		 }
> +		 return visitChildren;
> +	 }
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/PolicyBuilder.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/PolicyFileParser.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/builder/PolicyFileParser.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/PolicyFileParser.java  
> (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/PolicyFileParser.java Mon  
> Jan 14 22:52:53 2008
> @@ -0,0 +1,230 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +package org.apache.imperius.spl.editor.tool.internal.builder;
> +
> +import java.io.PrintStream;
> +import java.io.Reader;
> +import java.util.HashMap;
> +import java.util.Map;
> +
> +import org.apache.imperius.spl.editor.tool.PluginActivator;
> +import  
> org.apache.imperius.spl.editor.tool.internal.client.IPolicyClient;
> +import  
> org 
> .apache.imperius.spl.editor.tool.internal.client.IPolicyClientFactory;
> +import  
> org 
> .apache 
> .imperius.spl.editor.tool.internal.client.PolicyClientFactoryImpl;
> +import  
> org.apache.imperius.spl.editor.tool.internal.messages.PolicyMessages;
> +import  
> org 
> .apache 
> .imperius 
> .spl.editor.tool.ui.internal.contentoutline.IOutlineViewObserver;
> +import org.apache.imperius.spl.editor.tool.utils.PolicyPluginLogUtil;
> +import org.apache.imperius.spl.editor.tool.utils.SPLPolicyUtil;
> +import org.eclipse.core.resources.IFile;
> +import org.eclipse.core.resources.IMarker;
> +import org.eclipse.core.resources.IResource;
> +import org.eclipse.core.runtime.CoreException;
> +
> +import antlr.RecognitionException;
> +import antlr.collections.AST;
> +
> +import org.apache.imperius.spl.external.DataCollector;
> +import org.apache.imperius.spl.parser.compiler.SPLLexer;
> +import org.apache.imperius.spl.parser.compiler.SPLParser;
> +import org.apache.imperius.spl.parser.compiler.SPLTreeParser;
> +//import com.ibm.ac.spl.parser.compiler.symboltable.SPLSymbolTable;
> +import  
> org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
> +
> +
> +public class PolicyFileParser implements IPolicyStreamListener {
> +	
> +	private static PolicyFileParser policyParser = null;
> +	
> +	private IPolicyMarkerFactory policyMarkerFactory;
> +	
> +	private IFile resourceFile;
> +	
> +	public static boolean hasAnyErrorsMarked = false;
> +	
> +	private static String AST_NODE_CLASS =  
> "org.apache.imperius.spl.parser.compiler.ASTWithLineNumber";
> +	
> +	private Map observerList = null;
> +	
> +	private PolicyFileParser() {
> +		System.setErr(new PrintStream(new  
> PolicyMonitoredOutputStream(this)));
> +		policyMarkerFactory = new PolicyMarkerFactory();
> +		observerList = new HashMap();
> +	}
> +	
> +	public static PolicyFileParser getParserInstance() {
> +		if(policyParser==null) {
> +			policyParser = new PolicyFileParser();
> +		}
> +		return policyParser;
> +	}
> +	
> +//	public static void deleteMarkers(IProject aProject) {
> +//		try {
> +//			aProject.deleteMarkers(PolicyMarkerFactory.MARKER_ID, false,  
> IResource.DEPTH_INFINITE);
> +//			
> +//			PolicyFileParser.hasAnyErrorsMarked = false;
> +//		} catch (CoreException ce) {
> +//			 
> PolicyPluginLogUtil 
> .logError(PolicyMessages.getString("UNABLE_TO_DELETE_MARKER"), ce);
> +//		}
> +//	}	
> +
> +	public static void deleteMarkers(IFile aResourceFile) {
> +		try {
> +			aResourceFile.deleteMarkers(PolicyMarkerFactory.MARKER_ID,  
> false, IResource.DEPTH_INFINITE);
> +			PolicyFileParser.hasAnyErrorsMarked = false;
> +		} catch (CoreException ce) {
> +			 
> PolicyPluginLogUtil 
> .logError(PolicyMessages.getString("UNABLE_TO_DELETE_MARKER"), ce);
> +		}
> +	}	
> +
> +	public void parseFile(String fileName, IFile aResourceFile, Reader  
> fileReader) {
> +		try {
> +			this.resourceFile = aResourceFile;
> +			deleteMarkers(resourceFile);
> +			if (fileReader != null) {
> +				// Create a scanner that reads from the input stream passed to us
> +				SPLLexer lexer = new SPLLexer(fileReader);
> +				lexer.setFilename(fileName);
> +				// Create a parser that reads from the scanner
> +				SPLParser parser = new SPLParser(lexer);
> +				parser.setASTNodeClass(AST_NODE_CLASS);
> +				parser.setFilename(fileName);
> +				// start parsing at the compilationUnit rule
> +				parser.splpolicy();
> +				
> +				if(parser.getAST() != null) {
> +					// get AST Tree and traverse it
> +					IOutlineViewObserver observer = null;
> +					observer = (IOutlineViewObserver)observerList.get(fileName);
> +					if(observer != null) {
> +						observer.setAST(parser.getAST());
> +					}
> +//					 
> ((IOutlineViewObserver 
> )observerList.get(fileName)).setAST(parser.getAST());
> +				}
> +
> +				// if no errors present in the syntactic checks then only do  
> semantic checks
> +				if(!hasAnyErrorsMarked) {
> +				
> +					doTreeAction(fileName, parser.getAST(), parser.getTokenNames());
> +				}
> +			}
> +		} catch (Exception e) {
> +			e.printStackTrace();
> +		}
> +	}
> +	
> +	/**
> +	 *
> +	 * @param f
> +	 * @param t
> +	 * @param tokenNames
> +	 */
> +	public void doTreeAction(String f, AST t, String[] tokenNames) {
> +		if (t == null)
> +			return;
> +		SPLTreeParser tparse = new SPLTreeParser();
> +		
> +		tparse.setASTNodeClass(AST_NODE_CLASS);
> +		IPolicyClientFactory factory = new PolicyClientFactoryImpl();
> +		IPolicyClient policyClient = null;
> +		try {
> +			String domain =  
> PluginActivator 
> .getDefault().getProjectType(resourceFile.getProject().getName());
> +			policyClient = factory.getClient(domain);
> +			if(policyClient != null) {
> +				Object constructorParams = null;
> +				if("Java".equals(domain)) {
> +					constructorParams =  
> SPLPolicyUtil.createURLs(resourceFile.getProject());
> +				}
> +				DataCollector dc =  
> policyClient.getDataCollector(constructorParams);
> +				if(dc == null) {
> +					return;
> +				}
> +				SPLSymbolTable st=new SPLSymbolTable();
> +			//	SPLPolicyUtil.loadCustomClasses(resourceFile.getProject());
> +				tparse.splpolicy(t,dc,st);
> +			}
> +		} catch (RecognitionException e) {
> +			System.err.println(e.getMessage());
> +		} catch (Exception e) {
> +			e.printStackTrace();
> +		} catch (Throwable e) {
> +			e.printStackTrace();
> +		}
> +	}
> +	
> +	public void listenToError(String anErrorMsg, Object aStream) {
> +//		System.out.println("err-->"+anErrorMsg);
> +		if(anErrorMsg != null) {
> +			// syntactic errors: a.spl:4:1: expecting "Import", found 'mport'
> +			if(resourceFile != null) {
> +				if(anErrorMsg.indexOf(resourceFile.getName()) != -1) {
> +					if(anErrorMsg.indexOf(": ") != -1) {
> +						String lineStr = anErrorMsg.substring(0,anErrorMsg.indexOf(":  
> "));
> +						int line =  
> Integer.parseInt(lineStr.substring(lineStr.indexOf(":")+1,  
> lineStr.lastIndexOf(":")));
> +						String message = anErrorMsg.substring(anErrorMsg.indexOf(" "));
> +						createProblemMarker(line, message, 0);
> +					}
> +				}
> +
> +				// semantic errors: $SPLTreeParser$ Error at line no#22:Symbol  
> doesnot exist
> +				if(anErrorMsg.indexOf("$SPLTreeParser$") != -1) {
> +					if(anErrorMsg.indexOf(":") != -1) {
> +						String lineStr = anErrorMsg.substring(anErrorMsg.indexOf("#") 
> +1,anErrorMsg.indexOf(":"));
> +						int line = Integer.parseInt(lineStr);
> +						String message = anErrorMsg.substring(anErrorMsg.indexOf(":") 
> +1);
> +						createProblemMarker(line, message, 0);
> +					}
> +				}
> +				
> +//				if(anErrorMsg.indexOf("CIM_ERR_FAILED") != -1) {
> +//					//CIM_ERR_FAILED
> +//					createProblemMarker(1, anErrorMsg, 0);
> +//				}
> +			}
> +		}
> +	}
> +	
> +	private void createProblemMarker(int lineNo, String msg, int  
> severity) {
> +		try {
> +			IMarker marker = policyMarkerFactory.createMarker(resourceFile);
> +			marker.setAttribute(IMarker.LINE_NUMBER, lineNo);
> +			marker.setAttribute(IMarker.MESSAGE, msg);
> +			marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
> +			if(!hasAnyErrorsMarked) {
> +				hasAnyErrorsMarked = true;
> +			}
> +		} catch (CoreException e) {
> +			e.printStackTrace();
> +			PolicyPluginLogUtil.logError("Error while creating Marker", e);
> +		}
> +	}
> +
> +	public void addOutlineViewListener(String filename,  
> IOutlineViewObserver observer) {
> +		if(observerList == null) {
> +			observerList = new HashMap();
> +		}
> +		observerList.put(filename,observer);
> +	}
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/PolicyFileParser.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> PolicyFileValidatorImpl.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/builder/PolicyFileValidatorImpl.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/ 
> PolicyFileValidatorImpl.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/ 
> PolicyFileValidatorImpl.java Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,80 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +package org.apache.imperius.spl.editor.tool.internal.builder;
> +
> +import java.io.BufferedReader;
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.io.InputStreamReader;
> +import java.io.Reader;
> +
> +import org.eclipse.core.resources.IFile;
> +
> +public class PolicyFileValidatorImpl implements  
> IPolicyFileValidator {
> +	
> +	private IFile resourceFile;
> +	
> +	public PolicyFileValidatorImpl() {
> +		
> +	}
> +	
> +	private boolean isDataPresent(Reader in) {
> +		boolean flag = true;
> +		try {
> +			BufferedReader r = new BufferedReader(in);
> +			String str = null;
> +			while((str = r.readLine()) != null) {
> +//				if(str.length()>0) {
> +//					flag = true;
> +//					break;
> +//				}
> +				if(str.indexOf("<stmt") != -1) {
> +					flag = false;
> +					break;
> +				}
> +			}
> +		} catch (IOException e) {
> +			e.printStackTrace();
> +		}
> +		return flag;
> +	}
> +
> +	/**
> +	 *
> +	 */
> +	public void validatePolicyFile(IFile file) {
> +		try {
> +			resourceFile = file;
> +			InputStream is = resourceFile.getContents();
> +			boolean flag = isDataPresent(new InputStreamReader(is));
> +			if(flag) {
> +				 
> PolicyFileParser 
> .getParserInstance().parseFile(resourceFile.getName(), resourceFile,  
> new InputStreamReader(resourceFile.getContents()));
> +			}
> +		} catch (Exception e) {
> +			// TODO Auto-generated catch block
> +			e.printStackTrace();
> +		}		
> +	}
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> PolicyFileValidatorImpl.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> PolicyMarkerFactory.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/builder/PolicyMarkerFactory.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/PolicyMarkerFactory.java  
> (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/PolicyMarkerFactory.java  
> Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,41 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +
> +package org.apache.imperius.spl.editor.tool.internal.builder;
> +
> +import org.apache.imperius.spl.editor.tool.PluginActivator;
> +import org.eclipse.core.resources.IFile;
> +import org.eclipse.core.resources.IMarker;
> +import org.eclipse.core.runtime.CoreException;
> +
> +
> +public class PolicyMarkerFactory implements IPolicyMarkerFactory {
> +	
> +	public static final String MARKER_ID = PluginActivator.PLUGIN_ID 
> +".splMarker";
> +
> +	public IMarker createMarker(IFile file) throws CoreException  {
> +		return file.createMarker(MARKER_ID);
> +	}
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> PolicyMarkerFactory.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> PolicyMonitoredOutputStream.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/builder/PolicyMonitoredOutputStream.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/ 
> PolicyMonitoredOutputStream.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/builder/ 
> PolicyMonitoredOutputStream.java Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,82 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +package org.apache.imperius.spl.editor.tool.internal.builder;
> +
> +import java.io.ByteArrayOutputStream;
> +import java.io.IOException;
> +import java.io.OutputStream;
> +import java.util.Hashtable;
> +
> +
> +public class PolicyMonitoredOutputStream extends OutputStream {
> +
> +	private IPolicyStreamListener fListener;
> +	private Hashtable fBuffers;
> +	private boolean fSkip;
> +
> +	public PolicyMonitoredOutputStream(IPolicyStreamListener  
> aListener) {
> +		fBuffers = new Hashtable();
> +		fSkip = false;
> +		fListener = aListener;
> +	}
> +
> +	public void write(int aByte) throws IOException {
> +		byte c = (byte) aByte;
> +		if (c == 10 || c == 13) {
> +			if (!fSkip)
> +				processBuffer();
> +		} else {
> +			ByteArrayOutputStream buffer = getBuffer();
> +			buffer.write(aByte);
> +			if (buffer.size() > 1024)
> +				processBuffer();
> +		}
> +		fSkip = c == 13;
> +	}
> +
> +	public void flush() throws IOException {
> +		if (getBuffer().size() > 0)
> +			processBuffer();
> +	}
> +
> +	public void close() throws IOException {
> +		flush();
> +	}
> +
> +	protected void processBuffer() {
> +		fListener.listenToError(getBuffer().toString(), this);
> +		fBuffers.remove(Thread.currentThread());
> +	}
> +
> +	private ByteArrayOutputStream getBuffer() {
> +		Thread current = Thread.currentThread();
> +		ByteArrayOutputStream buffer = (ByteArrayOutputStream)  
> fBuffers.get(current);
> +		if (buffer == null) {
> +			buffer = new ByteArrayOutputStream();
> +			fBuffers.put(current, buffer);
> +		}
> +		return buffer;
> +	}
> +}
> \ No newline at end of file
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/builder/ 
> PolicyMonitoredOutputStream.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/client/IPolicyClient.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/client/IPolicyClient.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/client/IPolicyClient.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/client/IPolicyClient.java Mon Jan  
> 14 22:52:53 2008
> @@ -0,0 +1,61 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +
> +package org.apache.imperius.spl.editor.tool.internal.client;
> +
> +import java.util.Map;
> +
> +import  
> org.apache.imperius.spl.editor.tool.utils.AbstractClassDetails;
> +import org.eclipse.core.resources.IFile;
> +
> +import org.apache.imperius.spl.external.Actuator;
> +import org.apache.imperius.spl.external.DataCollector;
> +
> +public interface IPolicyClient {
> +	
> +	public void testConnection(Map connectionDetails) throws Exception;
> +	
> +	public Map getPolicyFiles() throws Exception;
> +	
> +	public void doDeployPolicy(IFile policyFile) throws Exception;
> +	
> +	public void doRunPolicy(IFile policyFile) throws Exception ;
> +	
> +	public DataCollector getDataCollector(Object constructorParams);
> +	
> +	public Actuator getActuator(Object fParams);
> +
> +	public AbstractClassDetails fetchClassDetails(Object classObj)  
> throws Exception;
> +	
> +	public String[] customOperators();
> +	
> +	public String[] customActions();
> +	
> +	public String[] customKeywords();
> +	
> +//	public void testDomainConfiguration() throws Exception;
> +//
> +//	public String getConfigInstructions();
> +}
> \ No newline at end of file
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/client/IPolicyClient.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/client/ 
> IPolicyClientFactory.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/client/IPolicyClientFactory.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/client/IPolicyClientFactory.java  
> (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/client/IPolicyClientFactory.java  
> Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,32 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +
> +package org.apache.imperius.spl.editor.tool.internal.client;
> +
> +
> +public interface IPolicyClientFactory {
> +
> +	public IPolicyClient getClient(String domain) throws Exception;
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/client/ 
> IPolicyClientFactory.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/client/ 
> PolicyClientFactoryImpl.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/client/PolicyClientFactoryImpl.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/client/ 
> PolicyClientFactoryImpl.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/client/ 
> PolicyClientFactoryImpl.java Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,57 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +
> +package org.apache.imperius.spl.editor.tool.internal.client;
> +
> +import org.apache.imperius.spl.editor.tool.PluginActivator;
> +import org.eclipse.core.runtime.IConfigurationElement;
> +
> +public class PolicyClientFactoryImpl implements  
> IPolicyClientFactory {
> +
> +	public PolicyClientFactoryImpl() {
> +
> +	}
> +
> +	public IPolicyClient getClient(String domain) throws Exception {
> +		IPolicyClient client = null;
> +		try {
> +			if (domain != null) {
> +				Object object =  
> PluginActivator.getDefault().getLanguageBinders().get(domain);
> +				if(object instanceof IPolicyClient) {
> +					client = (IPolicyClient)object;
> +				} else if(object instanceof IConfigurationElement){
> +					Object classObj =  
> ((IConfigurationElement)object).createExecutableExtension("class");
> +					PluginActivator.getDefault().setExtensionMap(domain,classObj);
> +					client = (IPolicyClient)classObj;
> +				}
> +			}
> +		} catch(Exception e) {
> +			// TODO Auto-generated catch block
> +			throw e;
> +		}
> +		return client;
> +	}
> +
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/client/ 
> PolicyClientFactoryImpl.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/messages/PolicyMessages.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/messages/PolicyMessages.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/messages/PolicyMessages.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/messages/PolicyMessages.java Mon  
> Jan 14 22:52:53 2008
> @@ -0,0 +1,55 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +package org.apache.imperius.spl.editor.tool.internal.messages;
> +
> +import java.util.MissingResourceException;
> +import java.util.ResourceBundle;
> +
> +import org.eclipse.osgi.util.NLS;
> +
> +public class PolicyMessages extends NLS {
> +	
> +	private static final String MSG_BUNDLE_NAME =  
> "org 
> .apache.imperius.spl.editor.tool.internal.messages.policymessages";
> +	
> +	private static final ResourceBundle RESOURCE_BUNDLE =  
> ResourceBundle.getBundle(MSG_BUNDLE_NAME);
> +
> +	public static String SPL_CUSTOM_ACTIONS = "SPL_CUSTOM_ACTIONS";
> +	
> +	public static String SPL_CUSTOM_EXPRESSIONS =  
> "SPL_CUSTOM_EXPRESSIONS";
> +	
> +	public static String SPL_CUSTOM_EXPR_FILE_NAME =  
> "customexpressions";
> +	
> +	private PolicyMessages() {
> +	}
> +
> +	public static String getString(String key) {
> +		try {
> +			return RESOURCE_BUNDLE.getString(key);
> +		} catch(MissingResourceException me) {
> +			return '!' + key + '!';
> +		}
> +	}
> +	
> +}
> \ No newline at end of file
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/messages/PolicyMessages.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/messages/ 
> policymessages.properties
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/messages/policymessages.properties?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/messages/policymessages.properties  
> (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/messages/policymessages.properties  
> Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,114 @@
> +#///*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +#/**
> +# * @author Naidu Javvadi <njavvadi@in.ibm.com>
> +# *
> +# */
> +
> +SPL_SUPPORTED_LANGUAGES = CIM,Java,XML
> +SPL_NEWPROJECT_WIZARD_TITLE = New SPL Project
> +SPL_PROJECT_CREATION = Create SPL project
> +SPL_DOMAIN_SELECTION_PAGE = Select SPL domain
> +SPL_DOMAIN_LANGUAGE_SELECTION = Select SPL language
> +SPL_DOMAIN_LANGUAGE_SELECTION_DESC = Select SPL binding
> +SPL_DOMAIN_SELECTION_LABEL = Select policy binding to project
> +SPL_PROJECT_PAGE_TITLE = SPL project creation page
> +SPL_NAME_FOR_NEW_PROJECT = Enter name for new project
> +SPL_FILE_CREATION = Creating SPL file
> +SPL_EDITOR_PAGE_WINDOW_TITLE = New SPL editor
> +OPENING_SPL_EDITOR = Opening file for editing...
> +SPL_WIZARD_PAGE_DESC = This wizard creates a new file with *.spl  
> extension that can be opened by a SPL editor.
> +SPL_TEMPLATE_SELECTION_PAGE_DESC = Select a default policy template
> +SPL_TEMPLATE_SELECTION_LABEL = Select policy template:
> +STR_POLICY_TEMPLATE_NAMES = default,policy group
> +SPL_TEMPLATE_PREVIEW_SECTION = Preview:
> +SPL_PROJECT = &Project:
> +SPL_BROWSE = Browse...
> +SPL_FILE_LABEL_NAME = &File name:
> +SPL_PROJECT_MUST_BE_SPECIFIED = Project must be specified
> +SPL_SELECT_NEW_FILE_CONTAINER = Select new file container
> +SPL_IMPORT_WIZARD_PAGE = import wizard page
> +SPL_IMPORT_WIZARD_PAGE_TITLE = Import policy file
> +SPL_IMPORT_WIZARD_PAGE_DESC = Import policy file
> +UNABLE_TO_DELETE_MARKER = Unable to delete markers
> +POLICY_DEPLOYMENT_STATUS = Deployment Status
> +POLICY_DEPLOYMENT_STATUS_MSG = Policy file deployed successfully.
> +POLICY_RUN_STATUS_MSG = Policy run success
> +POLICY_RUN_STATUS = Status
> +POLICY_KEYWORDS =  
> Import,Strategy,Declaration,Policy,Condition,Decision,PolicyGroup
> +POLICY_EXPRESSIONS =  
> stringLength,toUpper,toLower,concatenate,substring,matchesRegExp,leftSubstring,rightSubstring,middleSubstring,replaceSubstring,toUINT8,toSINT8,toSINT16,toUNIT16,toSINT32,toUNIT32,toSINT64,toUNIT64,toREAL64,toREAL32,toBoolean,word,startsWith,endsWith,contains,containsOnlyDigits,containsOnlyLetters,containsOnlyLettersOrDigits,like,min,max,remainder,power,abs,round,exp,log,sqrt,floor,ceiling,getDayOfMonth,getDayOfWeek,getDayOfWeekInMonth,getDayOfYear,getHour12,getHour24,getMillisecond,getMinute,getSecond,getWeekOfMonth,getWeekOfYear,getYear,toMilliseconds,isWithin,getMonth
> +POLICY_IMPORT_SELECTION_LABEL = Import policy file from
> +POLICY_IMPORT_SERVER_LABEL = Server
> +SPL_FILE_NAME_CANNOT_BE_BLANK = Policy file name can not be blank
> +SPL_FILE_ALREADY_EXISTS = File with this name already exists
> +SPL_FILE_EXTENSION_MUST_BE_SPECIFIED = File extension must be  
> specified
> +POLICY_BINDING_LABEL = Policy binding:
> +IMPORT_POLICY_SOURCE_DIRECTORY = Source:
> +IMPORT_POLICY_DESTINATION_DIRECTORY = Destination:
> +
> +SPL_IMPORT_CUSTOM_EXPRESSION_WINDOW_TITLE = Import Custom Types
> +SPL_IMPORT_CUSTOM_WIZARD_PAGE_NAME = Import custom types
> +SPL_IMPORT_CUSTOM_WIZARD_TITLE = Import Custom Types
> +SPL_IMPORT_CUSTOM_WIZARD_DESC = Import custom types jar file
> +SPL_IMPORT_CUSTOM_JAR_SELECTION_LABEL = Select Custom Jar :
> +
> +SPL_ENTRIES_LIST_OF_CUSTOM_JAR = List entries of jar
> +SPL_SELECT_PROJECT = Select Project
> +SPL_SELECT_CUSTOM_ACTIONS_JAR = Select Custom Actions Jar
> +SPL_NO_CLASSES_IN_CUSTOM_ACTIONS_JAR = No custom classes found in  
> the selected jar
> +SPL_NO_PROPERTIES_FILE_IN_CUSTOM_ACTIONS_JAR = No Custom properties  
> file found
> +SPL_CUSTOM_ACTION_JARS_LIST = List of custom action jars
> +
> +
> +# Error Messages
> +PROJECT_CONTAINS_ERROR_ = ISPL0001E Project creation contains errors
> +PROJECT_CREATION_LOCATION_ERROR_ = ISPL0002E Cannot create project  
> at specified location
> +CACHE_FILE_CREATION_ERROR_ = ISPL0003E Error while creating cache  
> file
> +SPL_FILE_CREATION_ERROR_ = ISPL0004E Error while creating file
> +CONTAINER_DOES_NOT_EXISTS_ERROR_ = ISPL0005E Container `{0}`  
> doesn't exists
> +FAILED_TO_OPEN_FILE_ERROR_ = ISPL0006E Failed to open newely  
> created SPL file
> +SPL_FILES_IMPORT_ERROR_ = ISPL0007E Error while importing policy file
> +SPL_FILE_CONTAINS_ERRORS = ISPL0008E Can not perform Action as  
> there are errors in current file
> +POLICY_DEPLOYMENT_ERROR_ = ISPL0009E Error while deploying policy  
> file
> +POLICY_RUN_ERROR_ = ISPL0010E Error while running policy file
> +FETCHING_CLASS_PROPERTIES_ERROR_ = ISPL0011E Error while fetching  
> class properties
> +NOT_SPL_PROJECT = Project is not of type SPL
> +SPL_JAR_FILE_IMPORT_ERROR_ = Error while importing custom  
> expression jar
> +
> +SPL_ERROR_LABEL_NAME = Error
> +STR_REMOVE_LABEL_NAME = Remove
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/messages/ 
> policymessages.properties
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/nature/PolicyNature.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/internal/nature/PolicyNature.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/nature/PolicyNature.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/internal/nature/PolicyNature.java Mon Jan  
> 14 22:52:53 2008
> @@ -0,0 +1,123 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +package org.apache.imperius.spl.editor.tool.internal.nature;
> +
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.List;
> +
> +import org.apache.imperius.spl.editor.tool.PluginActivator;
> +import  
> org.apache.imperius.spl.editor.tool.internal.builder.PolicyBuilder;
> +import org.apache.imperius.spl.editor.tool.utils.PolicyPluginLogUtil;
> +import org.eclipse.core.resources.IProject;
> +import org.eclipse.core.resources.IProjectDescription;
> +import org.eclipse.core.resources.IProjectNature;
> +import org.eclipse.core.runtime.CoreException;
> +import org.eclipse.core.runtime.IProgressMonitor;
> +
> +
> +public class PolicyNature implements IProjectNature {
> +
> +	private IProject splPolicyProject;
> +	public static final String SPL_NATURE_ID =  
> PluginActivator.PLUGIN_ID+".splNature";
> +
> +	public void configure() {
> +		PolicyBuilder.addBuilderToProject(splPolicyProject);
> +
> +//		new Job("Adding CIM SPL Project Nature") {
> +//			 protected IStatus run(IProgressMonitor mon) {
> +//				 try {
> +//					  
> cimsplProject 
> .build(CIMPolicyBuilder.FULL_BUILD,CIMPolicyBuilder.BUILDER_ID,  
> null, mon);
> +//				 } catch(CoreException ce) {
> +//				 }
> +//				 return Status.OK_STATUS;
> +//			 }
> +//		 }.schedule();
> +		
> +	}
> +
> +	/**
> +	 *
> +	 */
> +	public void deconfigure() {
> +		PolicyBuilder.removeBuilderFromProject(splPolicyProject);
> +	}
> +
> +	/**
> +	 *
> +	 */
> +	public IProject getProject() {
> +		return splPolicyProject;
> +	}
> +
> +	/**
> +	 *
> +	 */
> +	public void setProject(IProject aProject) {
> +		splPolicyProject = aProject;
> +	}
> +
> +	/**
> +	 *
> +	 * @param aProject
> +	 * @return
> +	 */
> +	public static boolean hasNature(IProject aProject) {
> +		boolean hasNature;
> +		try {
> +			hasNature = aProject.hasNature(SPL_NATURE_ID);
> +		} catch (CoreException ex) {
> +			hasNature = false;
> +			PolicyPluginLogUtil.logError("Error while checking Project has  
> nature", ex);
> +		}
> +		return hasNature;
> +	}
> +
> +	/**
> +	 *
> +	 * @param aProject
> +	 * @param aMonitor
> +	 */
> +	public static void addNature(IProject aProject, IProgressMonitor  
> aMonitor) {
> +		if (aProject != null) {
> +			try {
> +				if (!aProject.hasNature(SPL_NATURE_ID)) {
> +					IProjectDescription desc = aProject.getDescription();
> +					List natures = new  
> ArrayList(Arrays.asList(desc.getNatureIds()));
> +					natures.add(SPL_NATURE_ID);
> +					desc.setNatureIds((String[]) natures.toArray(new  
> String[natures.size()]));
> +					aProject.setDescription(desc, aMonitor);
> +				}
> +			} catch (CoreException e) {
> +				e.printStackTrace();
> +				PolicyPluginLogUtil.logError("Error while adding nature to  
> project", e);
> +			} catch (Exception e) {
> +				e.printStackTrace();
> +				PolicyPluginLogUtil.logError("Error while adding nature to  
> project", e);
> +			}
> +		}
> +	}
> +
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/internal/nature/PolicyNature.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/pluginResources.properties
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/pluginResources.properties?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/pluginResources.properties (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/pluginResources.properties Mon Jan 14  
> 22:52:53 2008
> @@ -0,0 +1,40 @@
> +#///*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +#/**
> +# * @author Naidu Javvadi <njavvadi@in.ibm.com>
> +# *
> +# */
> +
> +ContentAssistProposal.label=Content Assist@Ctrl+SPACE
> +ContentAssistProposal.tooltip=Content Assist
> +ContentAssistProposal.image=
> +ContentAssistProposal.description=Content Assist
> +
> +ContentAssistTip.label=Content Tip@Ctrl+SHIFT+SPACE
> +ContentAssistTip.tooltip=Content Tip
> +ContentAssistTip.image=
> +ContentAssistTip.description=Content Tip
> +
> +
> +CIMSPL_CACHE_FILE_NAME = .cimsplcache
> +SPL_OPTIONS_FILE_NAME = .splOptions
> +SPL_CUSTOM_EXPR_FILE_NAME = .customexpressions
> +
> +CONFIGURE_JAVA_PROJECTS = Java
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/pluginResources.properties
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/ui/IPolicyTokenColorManager.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/ui/IPolicyTokenColorManager.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/ui/IPolicyTokenColorManager.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/ui/IPolicyTokenColorManager.java Mon Jan 14  
> 22:52:53 2008
> @@ -0,0 +1,52 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +
> +package org.apache.imperius.spl.editor.tool.ui;
> +
> +import org.eclipse.jface.text.rules.IToken;
> +import org.eclipse.jface.util.PropertyChangeEvent;
> +import org.eclipse.swt.graphics.Color;
> +import org.eclipse.swt.graphics.RGB;
> +
> +
> +public interface IPolicyTokenColorManager {
> +	
> +	public static final RGB RGB_DEFAULT_COLOR = new RGB(0, 0, 0);
> +	public static final RGB RGB_KEYWORD_COLOR = new RGB(127, 0, 85);
> +	public static final RGB RGB_COMMENT_COLOR = new RGB(63, 127, 95);
> +	public static final RGB RGB_CONTENT_ASSIST_COLOR = new RGB(0, 191,  
> 255);
> +	
> +	
> +	public Color getColor(RGB rgb);
> +	
> +	public IToken getToken(String preferenceColorKey);
> +	
> +	public boolean affectsTextPresentation(PropertyChangeEvent event);
> +	
> +	public void handlePreferenceStoreChanged(PropertyChangeEvent event);
> +	
> +	public void dispose();
> +	
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/ui/IPolicyTokenColorManager.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/ui/PolicyEditor.java
> URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/imperius/spl/editor/tool/ui/PolicyEditor.java?rev=612031&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/ui/PolicyEditor.java (added)
> +++ incubator/imperius/trunk/imperius-spleditorcore/src/org/apache/ 
> imperius/spl/editor/tool/ui/PolicyEditor.java Mon Jan 14 22:52:53 2008
> @@ -0,0 +1,197 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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.
> + */
> +
> +/**
> + * @author Naidu Javvadi <njavvadi@in.ibm.com>
> + *
> + */
> +
> +
> +package org.apache.imperius.spl.editor.tool.ui;
> +
> +import java.util.ResourceBundle;
> +
> +import org.apache.imperius.spl.editor.tool.PluginActivator;
> +import  
> org.apache.imperius.spl.editor.tool.internal.builder.PolicyFileParser;
> +import  
> org 
> .apache 
> .imperius 
> .spl.editor.tool.ui.internal.contentoutline.PolicyOutlineViewPage;
> +import org.eclipse.core.resources.IFile;
> +import org.eclipse.core.runtime.CoreException;
> +import org.eclipse.core.runtime.IProgressMonitor;
> +import org.eclipse.jface.action.IAction;
> +import org.eclipse.jface.text.IDocument;
> +import org.eclipse.jface.util.PropertyChangeEvent;
> +import org.eclipse.ui.IEditorInput;
> +import org.eclipse.ui.IFileEditorInput;
> +import org.eclipse.ui.editors.text.TextEditor;
> +import org.eclipse.ui.texteditor.ContentAssistAction;
> +import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
> +import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
> +
> +
> +public class PolicyEditor extends TextEditor {
> +
> +	public static final String EDITOR_ID =  
> "org.apache.imperius.spl.editor.tool.ui.policyEditor";
> +	
> +	private IFile editorFile;
> +	
> +	private IPolicyTokenColorManager tokenColorMgr;
> +	
> +	private PolicyReconcilingStrategy fReconcilingStrategy = null;
> +	
> +	private ResourceBundle resourceBundle;
> +	
> +	private PolicyOutlineViewPage outlineViewPage = null;
> +	
> +	public PolicyEditor() {
> +		super();
> +		setEditorContextMenuId("#PolicyTextEditorContext");
> +		setRulerContextMenuId("#PolicyTextRulerContext");
> +		resourceBundle = PluginActivator.getDefault().getResourceBundle();
> +		tokenColorMgr =  
> PolicyTokenColorManagerImpl.getTokenColorManagerInstance();
> +		setDocumentProvider(new PolicyFileDocumentProvider());
> +		setSourceViewerConfiguration(new  
> PolicySourceViewerConfiguration(this));
> +		 
> setPreferenceStore(PluginActivator.getDefault().getPreferenceStore());
> +		fReconcilingStrategy = new PolicyReconcilingStrategy(this);
> +	}
> +
> +	/**
> +	 *
> +	 */
> +	protected void doSetInput(IEditorInput input) throws CoreException {
> +		super.doSetInput(input);
> +		editorFile = (IFile) ((IFileEditorInput)input).getFile();
> +		if(outlineViewPage != null)
> +			outlineViewPage.setInput(input);
> +	}
> +	
> +	/**
> +	 * Function returns document of the current editor
> +	 * @return
> +	 */
> +	public IDocument getDocument() {
> +		return getSourceViewer().getDocument();
> +	}
> +
> +	/**
> +	 *
> +	 * @return
> +	 */
> +	public IEditorInput getActiveEditorInput() {
> +		return super.getEditorInput();
> +	}
> +
> +	/**
> +	 *
> +	 * @return
> +	 */
> +	public IFile getActiveEditorFile() {
> +		return editorFile;
> +	}
> +
> +	/**
> +	 *
> +	 */
> +	public void doSaveAs() {
> +		super.doSaveAs();
> +		if(outlineViewPage != null) {
> +			outlineViewPage.updateOutlineView();
> +		}
> +	}
> +
> +	/**
> +	 *
> +	 */
> +	public void doSave(IProgressMonitor monitor) {
> +		super.doSave(monitor);
> +		if(outlineViewPage != null) {
> +			outlineViewPage.updateOutlineView();
> +		}		
> +	}
> +
> +	/**
> +	 *
> +	 */
> +	public void doRevertToSaved() {
> +		super.doRevertToSaved();
> +		if(outlineViewPage != null) {
> +			outlineViewPage.updateOutlineView();
> +		}		
> +	}
> +	
> +	/**
> +	 * Function that affects the text in the editor when preferences  
> is changed
> +	 */
> +	protected boolean affectsTextPresentation(PropertyChangeEvent  
> event) {
> +		return super.affectsTextPresentation(event) ||  
> tokenColorMgr.affectsTextPresentation(event);
> +	}
> +
> +	/**
> +	 * Function that affects the text in the editor when preferences  
> is changed
> +	 */
> +	protected void handlePreferenceStoreChanged(PropertyChangeEvent  
> event) {
> +		tokenColorMgr.handlePreferenceStoreChanged(event);
> +		super.handlePreferenceStoreChanged(event);
> +	}
> +	
> +	/**
> +	 *
> +	 * @return
> +	 */
> +	public PolicyReconcilingStrategy getReconcilingStrategy() {
> +		return fReconcilingStrategy;
> +	}
> +	
> +	/**
> +	 *
> +	 */
> +	protected void createActions() {
> +		super.createActions();
> +		IAction a = new	 
> ContentAssistAction(resourceBundle,"ContentAssistProposal.",this);
> +		 
> a 
> .setActionDefinitionId 
> (ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
> +		setAction("ContentAssist", a);
> +//		IAction a = new  TextOperationAction(resourceBundle,  
> "ContentAssistProposal.", this, 13);
> +//		 
> a 
> .setActionDefinitionId 
> ("org.eclipse.ui.edit.text.contentAssist.proposals");
> +//		setAction("ContentAssistProposal", a);
> +//		a = new TextOperationAction(resourceBundle,  
> "ContentAssistTip.", this, 14);
> +//		 
> a 
> .setActionDefinitionId 
> ("org.eclipse.ui.edit.text.contentAssist.contextInformation");
> +//		setAction("ContentAssistTip", a);
> +	}	
> +
> +	/**
> +	 * @param requiredClass
> +	 *
> +	 */
> +	public Object getAdapter(Class requiredClass) {
> +		if (IContentOutlinePage.class.equals(requiredClass)) {
> +			if (outlineViewPage == null) {
> +				outlineViewPage = new PolicyOutlineViewPage(this);
> +				 
> PolicyFileParser 
> .getParserInstance().addOutlineViewListener(editorFile.getName(),  
> outlineViewPage);
> +				if(getEditorInput() != null)
> +					outlineViewPage.setInput(getEditorInput());
> +				// check if any thing is present
> +				String editorContent = this.getDocument().get();
> +				if(!"".equals(editorContent)) {
> +					fReconcilingStrategy.parse();
> +				}
> +				return outlineViewPage;
> +			}
> +		}
> +		return super.getAdapter(requiredClass);
> +	}
> +}
>
> Propchange: incubator/imperius/trunk/imperius-spleditorcore/src/org/ 
> apache/imperius/spl/editor/tool/ui/PolicyEditor.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message