@@ -9,13 +9,16 @@

import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.LinkedList;
import java.util.List;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import com.aptana.core.logging.IdeLog;
import com.aptana.editor.common.contentassist.MetadataReader;
import com.aptana.editor.html.HTMLPlugin;
import com.aptana.editor.html.contentassist.model.AttributeElement;
@@ -31,6 +34,49 @@
*/
public class HTMLMetadataReader extends MetadataReader
{
private enum Element
{
AVAILABILITY("availability"), //$NON-NLS-1$
HINT("hint"), //$NON-NLS-1$
DEPRECATED("deprecated"), //$NON-NLS-1$
DESCRIPTION("description"), //$NON-NLS-1$
REMARKS("remarks"), //$NON-NLS-1$
EXAMPLE("example"), //$NON-NLS-1$
VALUE("value"), //$NON-NLS-1$
SPECIFICATION("specification"), //$NON-NLS-1$
REFERENCE("reference"), //$NON-NLS-1$
EVENT_REF("event-ref"), //$NON-NLS-1$
EVENT("event"), //$NON-NLS-1$
ENTITY("entity"), //$NON-NLS-1$
ELEMENT("element"), //$NON-NLS-1$
BROWSER("browser"), //$NON-NLS-1$
ATTRIBUTE_REF("attribute-ref"), //$NON-NLS-1$
ATTRIBUTE("attribute"), //$NON-NLS-1$
UNDEFINED(null);

private String name;

private Element(String name)
{
this.name = name;
}

private static Element fromString(String name)
{
if (name != null)
{
for (Element b : Element.values())
{
if (name.equals(b.name))
{
return b;
}
}
}
return UNDEFINED;
}
}

private static final String HTML_METADATA_SCHEMA = "/metadata/HTMLMetadataSchema.xml"; //$NON-NLS-1$

private List<ElementElement> _elements = new LinkedList<ElementElement>();
@@ -51,6 +97,138 @@ public HTMLMetadataReader()
{
}

@Override
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes)
throws SAXException
{
super.startElement(namespaceURI, localName, qualifiedName, attributes);

switch (Element.fromString(localName))
{
case ATTRIBUTE:
enterAttribute(namespaceURI, localName, qualifiedName, attributes);
break;

case ATTRIBUTE_REF:
enterAttributeReference(namespaceURI, localName, qualifiedName, attributes);
break;

case BROWSER:
enterBrowser(namespaceURI, localName, qualifiedName, attributes);
break;

case ELEMENT:
enterElement(namespaceURI, localName, qualifiedName, attributes);
break;

case ENTITY:
enterEntity(namespaceURI, localName, qualifiedName, attributes);
break;

case EVENT:
enterEvent(namespaceURI, localName, qualifiedName, attributes);
break;

case EVENT_REF:
enterEventReference(namespaceURI, localName, qualifiedName, attributes);
break;

case REFERENCE:
enterReference(namespaceURI, localName, qualifiedName, attributes);
break;

case SPECIFICATION:
enterSpecification(namespaceURI, localName, qualifiedName, attributes);
break;

case VALUE:
enterValue(namespaceURI, localName, qualifiedName, attributes);
break;

case EXAMPLE:
case REMARKS:
case DESCRIPTION:
case DEPRECATED:
case HINT:
startTextBuffer(namespaceURI, localName, qualifiedName, attributes);
break;

case UNDEFINED:
IdeLog.logWarning(HTMLPlugin.getDefault(),
MessageFormat.format("Unable to convert element with name {0} to enum value", localName)); //$NON-NLS-1$
break;

default:
// do nothing
break;
}
}

@Override
public void endElement(String namespaceURI, String localName, String qualifiedName) throws SAXException
{
switch (Element.fromString(localName))
{
case ATTRIBUTE:
exitAttribute(namespaceURI, localName, qualifiedName);
break;

case AVAILABILITY:
exitAvailability(namespaceURI, localName, qualifiedName);
break;

case BROWSER:
exitBrowser(namespaceURI, localName, qualifiedName);
break;

case DEPRECATED:
exitDeprecated(namespaceURI, localName, qualifiedName);
break;

case DESCRIPTION:
exitDescription(namespaceURI, localName, qualifiedName);
break;

case ELEMENT:
exitElement(namespaceURI, localName, qualifiedName);
break;

case ENTITY:
exitEntity(namespaceURI, localName, qualifiedName);
break;

case EVENT:
exitEvent(namespaceURI, localName, qualifiedName);
break;

case EXAMPLE:
exitExample(namespaceURI, localName, qualifiedName);
break;

case HINT:
exitHint(namespaceURI, localName, qualifiedName);
break;

case REMARKS:
exitRemarks(namespaceURI, localName, qualifiedName);
break;

case VALUE:
exitValue(namespaceURI, localName, qualifiedName);
break;

case UNDEFINED:
IdeLog.logWarning(HTMLPlugin.getDefault(),
MessageFormat.format("Unable to convert element with name {0} to enum value", localName)); //$NON-NLS-1$
break;

default:
// do nothing
break;
}
super.endElement(namespaceURI, localName, qualifiedName);
}

/**
* start processing a class element
*
@@ -21,7 +21,9 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import com.aptana.core.logging.IdeLog;
import com.aptana.core.util.StringUtil;
import com.aptana.editor.common.contentassist.MetadataReader;
import com.aptana.editor.js.JSPlugin;
@@ -44,6 +46,55 @@
*/
public class JSMetadataReader extends MetadataReader
{
private enum Element
{
JAVASCRIPT("javascript"), //$NON-NLS-1$
VALUE("value"), //$NON-NLS-1$
TYPE_MAP("type-map"), //$NON-NLS-1$
SPECIFICATION("specification"), //$NON-NLS-1$
RETURN_TYPE("return-type"), //$NON-NLS-1$
REFERENCE("reference"), //$NON-NLS-1$
PROPERTY("property"), //$NON-NLS-1$
PARAMETER("parameter"), //$NON-NLS-1$
MIXINS("mixins"), //$NON-NLS-1$
MIXIN("mixin"), //$NON-NLS-1$
METHOD("method"), //$NON-NLS-1$
CONSTRUCTOR("constructor"), //$NON-NLS-1$
EXCEPTION("exception"), //$NON-NLS-1$
RETURN_DESCRIPTION("return-description"), //$NON-NLS-1$
REMARKS("remarks"), //$NON-NLS-1$
EXAMPLE("example"), //$NON-NLS-1$
DESCRIPTION("description"), //$NON-NLS-1$
DEPRECATED("deprecated"), //$NON-NLS-1$
CONSTRUCTORS("constructors"), //$NON-NLS-1$
CLASS("class"), //$NON-NLS-1$
BROWSER("browser"), //$NON-NLS-1$
ALIAS("alias"), //$NON-NLS-1$
UNDEFINED(null);

private String name;

private Element(String name)
{
this.name = name;
}

private static Element fromString(String name)
{
if (name != null)
{
for (Element b : Element.values())
{
if (name.equals(b.name))
{
return b;
}
}
}
return UNDEFINED;
}
}

static final Pattern DOT_PATTERN = Pattern.compile("\\."); //$NON-NLS-1$
static final Pattern WHITESPACE_PATTERN = Pattern.compile("\\s+"); //$NON-NLS-1$
static final Pattern PROPERTY_TYPE_DELIMITER_PATTERN = Pattern.compile("\\s*\\|\\s*"); //$NON-NLS-1$
@@ -73,6 +124,171 @@ public JSMetadataReader()
{
}

@Override
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes)
throws SAXException
{
super.startElement(namespaceURI, localName, qualifiedName, attributes);

switch (Element.fromString(localName))
{
case ALIAS:
enterAlias(namespaceURI, localName, qualifiedName, attributes);
break;

case BROWSER:
enterBrowser(namespaceURI, localName, qualifiedName, attributes);
break;

case CLASS:
enterClass(namespaceURI, localName, qualifiedName, attributes);
break;

case CONSTRUCTORS:
enterConstructors(namespaceURI, localName, qualifiedName, attributes);
break;

case DEPRECATED:
case DESCRIPTION:
case EXAMPLE:
case REMARKS:
case RETURN_DESCRIPTION:
startTextBuffer(namespaceURI, localName, qualifiedName, attributes);
break;

case EXCEPTION:
enterException(namespaceURI, localName, qualifiedName, attributes);
break;

case CONSTRUCTOR:
case METHOD:
enterMethod(namespaceURI, localName, qualifiedName, attributes);
break;

case MIXIN:
enterMixin(namespaceURI, localName, qualifiedName, attributes);
break;

case MIXINS:
enterMixins(namespaceURI, localName, qualifiedName, attributes);
break;

case PARAMETER:
enterParameter(namespaceURI, localName, qualifiedName, attributes);
break;

case PROPERTY:
enterProperty(namespaceURI, localName, qualifiedName, attributes);
break;

case REFERENCE:
enterReference(namespaceURI, localName, qualifiedName, attributes);
break;

case RETURN_TYPE:
enterReturnType(namespaceURI, localName, qualifiedName, attributes);
break;

case SPECIFICATION:
enterSpecification(namespaceURI, localName, qualifiedName, attributes);
break;

case TYPE_MAP:
enterTypeMap(namespaceURI, localName, qualifiedName, attributes);
break;

case VALUE:
enterValue(namespaceURI, localName, qualifiedName, attributes);
break;

case UNDEFINED:
IdeLog.logWarning(JSPlugin.getDefault(),
MessageFormat.format("Unable to convert element with name {0} to enum value", localName)); //$NON-NLS-1$
break;

default:
// do nothing
break;
}
}

@Override
public void endElement(String namespaceURI, String localName, String qualifiedName) throws SAXException
{
switch (Element.fromString(localName))
{
case BROWSER:
exitBrowser(namespaceURI, localName, qualifiedName);
break;

case CLASS:
exitClass(namespaceURI, localName, qualifiedName);
break;

case CONSTRUCTORS:
exitConstructors(namespaceURI, localName, qualifiedName);
break;

case DEPRECATED:
exitDeprecated(namespaceURI, localName, qualifiedName);
break;

case DESCRIPTION:
exitDescription(namespaceURI, localName, qualifiedName);
break;

case EXAMPLE:
exitExample(namespaceURI, localName, qualifiedName);
break;

case EXCEPTION:
exitException(namespaceURI, localName, qualifiedName);
break;

case JAVASCRIPT:
exitJavaScript(namespaceURI, localName, qualifiedName);
break;

case METHOD:
case CONSTRUCTOR:
exitMethod(namespaceURI, localName, qualifiedName);
break;

case PARAMETER:
exitParameter(namespaceURI, localName, qualifiedName);
break;

case PROPERTY:
exitProperty(namespaceURI, localName, qualifiedName);
break;

case REMARKS:
exitRemarks(namespaceURI, localName, qualifiedName);
break;

case RETURN_DESCRIPTION:
exitReturnDescription(namespaceURI, localName, qualifiedName);
break;

case RETURN_TYPE:
exitReturnType(namespaceURI, localName, qualifiedName);
break;

case VALUE:
exitValue(namespaceURI, localName, qualifiedName);
break;
case UNDEFINED:
IdeLog.logWarning(JSPlugin.getDefault(),
MessageFormat.format("Unable to convert element with name {0} to enum value", localName)); //$NON-NLS-1$
break;

default:
// do nothing
break;
}
super.endElement(namespaceURI, localName, qualifiedName);
}

/**
* start processing an alias element
*
@@ -9,14 +9,17 @@

import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import com.aptana.core.logging.IdeLog;
import com.aptana.core.util.StringUtil;
import com.aptana.editor.common.contentassist.MetadataReader;
import com.aptana.editor.js.JSPlugin;
@@ -37,6 +40,44 @@

public class VSDocReader extends MetadataReader
{
private enum Element
{
SUMMARY("summary"), //$NON-NLS-1$
PRIVATE("private"), //$NON-NLS-1$
EXAMPLE("example"), //$NON-NLS-1$
USER_AGENT("userAgent"), //$NON-NLS-1$
SEEALSO("seealso"), //$NON-NLS-1$
SEE("see"), //$NON-NLS-1$
RETURNS("returns"), //$NON-NLS-1$
PARAM("param"), //$NON-NLS-1$
PARA("para"), //$NON-NLS-1$
EXCEPTION("exception"), //$NON-NLS-1$
DOCS("docs"), //$NON-NLS-1$
UNDEFINED(null);

private String name;

private Element(String name)
{
this.name = name;
}

private static Element fromString(String name)
{
if (name != null)
{
for (Element b : Element.values())
{
if (name.equals(b.name))
{
return b;
}
}
}
return UNDEFINED;
}
}

private static final String METADATA_SCHEMA_XML = "/metadata/VSDocSchema.xml"; //$NON-NLS-1$

private String _summary;
@@ -56,6 +97,105 @@ public VSDocReader()
this._typeParser = new SDocParser();
}

@Override
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes)
throws SAXException
{
super.startElement(namespaceURI, localName, qualifiedName, attributes);

switch (Element.fromString(localName))
{
case DOCS:
enterDocs(namespaceURI, localName, qualifiedName, attributes);
break;

case EXCEPTION:
enterException(namespaceURI, localName, qualifiedName, attributes);
break;

case PARA:
enterPara(namespaceURI, localName, qualifiedName, attributes);
break;

case PARAM:
enterParam(namespaceURI, localName, qualifiedName, attributes);
break;

case RETURNS:
enterReturns(namespaceURI, localName, qualifiedName, attributes);
break;

case SEE:
case SEEALSO:
enterSee(namespaceURI, localName, qualifiedName, attributes);
break;

case USER_AGENT:
enterUserAgent(namespaceURI, localName, qualifiedName, attributes);
break;

case EXAMPLE:
case PRIVATE:
case SUMMARY:
startTextBuffer(namespaceURI, localName, qualifiedName, attributes);
break;

case UNDEFINED:
IdeLog.logWarning(JSPlugin.getDefault(),
MessageFormat.format("Unable to convert element with name {0} to enum value", localName)); //$NON-NLS-1$
break;

default:
// do nothing
break;
}
}

@Override
public void endElement(String namespaceURI, String localName, String qualifiedName) throws SAXException
{
switch (Element.fromString(localName))
{
case DOCS:
exitDocs(namespaceURI, localName, qualifiedName);
break;

case EXAMPLE:
exitExample(namespaceURI, localName, qualifiedName);
break;

case EXCEPTION:
exitException(namespaceURI, localName, qualifiedName);
break;

case PARAM:
exitParam(namespaceURI, localName, qualifiedName);
break;

case PRIVATE:
exitPrivate(namespaceURI, localName, qualifiedName);
break;

case RETURNS:
exitReturns(namespaceURI, localName, qualifiedName);
break;

case SUMMARY:
exitSummary(namespaceURI, localName, qualifiedName);
break;

case UNDEFINED:
IdeLog.logWarning(JSPlugin.getDefault(),
MessageFormat.format("Unable to convert element with name {0} to enum value", localName)); //$NON-NLS-1$
break;

default:
// do nothing
break;
}
super.endElement(namespaceURI, localName, qualifiedName);
}

/**
* process docs element
*
@@ -12,6 +12,7 @@
import net.contentobjects.jnotify.JNotifyListener;

import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;

import com.aptana.filewatcher.poller.PollingNotifier;

@@ -25,36 +26,25 @@ private synchronized static IJNotify instance()
{
if (_instance == null)
{
String className = null;
if (Platform.OS_LINUX.equals(Platform.getOS()))
{
try
{
_instance = (IJNotify) Class.forName("net.contentobjects.jnotify.linux.JNotifyAdapterLinux") //$NON-NLS-1$
.newInstance();
}
catch (Throwable e)
{
FileWatcherPlugin.log(e);
}
className = "net.contentobjects.jnotify.linux.JNotifyAdapterLinux"; //$NON-NLS-1$
}
else if (Platform.OS_WIN32.equals(Platform.getOS()))
{
try
{
_instance = (IJNotify) Class.forName("net.contentobjects.jnotify.win32.JNotifyAdapterWin32") //$NON-NLS-1$
.newInstance();
}
catch (Throwable e)
{
FileWatcherPlugin.log(e);
}
className = "net.contentobjects.jnotify.win32.JNotifyAdapterWin32"; //$NON-NLS-1$
}
else if (Platform.OS_MACOSX.equals(Platform.getOS()))
{
className = "net.contentobjects.jnotify.macosx.JNotifyAdapterMacOSX"; //$NON-NLS-1$
}
if (className != null)
{
try
{
_instance = (IJNotify) Class
.forName("net.contentobjects.jnotify.macosx.JNotifyAdapterMacOSX").newInstance(); //$NON-NLS-1$
Bundle b = FileWatcherPlugin.getDefault().getBundle();
_instance = (IJNotify) b.loadClass(className).newInstance();
}
catch (Throwable e)
{
@@ -23,4 +23,3 @@ Export-Package: com.aptana.json,
Bundle-ClassPath: libs/jaxen-1.1.2.jar,
.
Eclipse-ExtensibleAPI: true
Eclipse-BuddyPolicy: dependent
@@ -7,8 +7,6 @@
 */
package com.aptana.sax;

import java.lang.reflect.Method;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

@@ -49,22 +47,6 @@
*/
String getName();

/**
* Return the Method to call when entering this element
*
* @return The Method to invoke. This value can be null if there is no OnEnter event handler associated with this
* element
*/
Method getOnEnterMethod();

/**
* Return the Method to call when exiting this element
*
* @return The Method to invoke. This value can be null if there is no OnExit event handler associated with this
* element
*/
Method getOnExitMethod();

/**
* getOwningSchema
*
@@ -88,20 +70,6 @@
*/
boolean hasAttribute(String name);

/**
* Determine if this element has an associated OnEnter handler
*
* @return Returns true if this element has an OnEnter handler
*/
boolean hasOnEnterMethod();

/**
* Determine if this element has an associated OnExit handler
*
* @return Returns true if this element has an OnExit handler
*/
boolean hasOnExitMethod();

/**
* Determine if this element expects text as a child node or not
*
@@ -184,26 +152,6 @@
*/
void setHasText(boolean value);

/**
* Set the method to call after entering this element
*
* @param onEnterMethod
* The name of the method to call on the schema's handler object when we enter this element
* @throws NoSuchMethodException
* @throws SecurityException
*/
void setOnEnter(String onEnterMethod) throws SecurityException, NoSuchMethodException;

/**
* Set the method to call before exiting this element
*
* @param onExitMethod
* The name of the method to call on the schema's handler object when we exit this element
* @throws NoSuchMethodException
* @throws SecurityException
*/
void setOnExit(String onExitMethod) throws SecurityException, NoSuchMethodException;

/**
* @see java.lang.Object#toString()
*/
@@ -28,8 +28,6 @@
private Stack<ISchemaElement> _elementStack; // $codepro.audit.disable declareAsInterface
private ISchemaElement _currentElement;

private Object _handler;
private Class<?> _handlerClass;
private boolean _allowFreeformMarkup;

/**
@@ -42,16 +40,6 @@ public boolean allowFreeformMarkup()
return this._allowFreeformMarkup;
}

/**
* Get the Class of the handler object used for element transition event handling
*
* @return The handler object's class
*/
public Class<?> getHandlerClass()
{
return this._handlerClass;
}

/**
* Get the SchemaElement that serves as the root of this schema state machine
*
@@ -116,17 +104,8 @@ public void setRootElement(String name)
* @param handler
* The handler to be used for event callbacks
*/
public Schema(Object handler)
public Schema()
{
// set the handler
this._handler = handler;

// cache the handler's class
if (handler != null)
{
this._handlerClass = handler.getClass();
}

this._elementsByName = new HashMap<String, ISchemaElement>();
this._elementStack = new Stack<ISchemaElement>();
this._rootElement = new SchemaElement(this, "#document"); //$NON-NLS-1$
@@ -222,13 +201,6 @@ public void moveTo(String namespaceURI, String localName, String qualifiedName,

// validate attributes on the new element
this._currentElement.validateAttributes(attributes);

// fire the associated onEnter method
if (this._handler != null && this._currentElement.hasOnEnterMethod())
{
this._currentElement.getOnEnterMethod().invoke(this._handler, // $codepro.audit.disable com.instantiations.assist.eclipse.analysis.audit.rule.preferInterfacesToReflection
new Object[] { namespaceURI, localName, qualifiedName, attributes });
}
}

/**
@@ -295,18 +267,11 @@ public void buildErrorMessage(SourcePrinter writer, String localName, Attributes
* @throws InvocationTargetException
* @throws IllegalAccessException
* @throws IllegalArgumentException
* @throws SAXException
*/
public void exitElement(String namespaceURI, String localName, String qualifiedName)
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SAXException
{
// fire the associated onExit method
if (this._handler != null && this._currentElement.hasOnExitMethod())
{
this._currentElement.getOnExitMethod().invoke(this._handler, // $codepro.audit.disable
// com.instantiations.assist.eclipse.analysis.audit.rule.preferInterfacesToReflection
new Object[] { namespaceURI, localName, qualifiedName });
}

// get new current element
this._currentElement = this._elementStack.pop();
}

Large diffs are not rendered by default.

@@ -7,7 +7,6 @@
*/
package com.aptana.sax;

import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -25,10 +24,6 @@
*/
public class SchemaElement implements ISchemaElement
{
private static final Class<?>[] enterSignature = new Class[] { String.class, String.class, String.class,
Attributes.class };
private static final Class<?>[] exitSignature = new Class[] { String.class, String.class, String.class };

private String _name;
private Schema _owningSchema;
private Map<String, ISchemaElement> _transitions;
@@ -38,8 +33,6 @@ public class SchemaElement implements ISchemaElement

private String _instanceAttributes;

private Method _onEnter;
private Method _onExit;
private boolean _hasText;

/**
@@ -168,24 +161,6 @@ public String getName()
return this._name;
}

/*
* (non-Javadoc)
* @see com.aptana.sax.ISchemaElement#getOnEnterMethod()
*/
public Method getOnEnterMethod()
{
return this._onEnter;
}

/*
* (non-Javadoc)
* @see com.aptana.sax.ISchemaElement#getOnExitMethod()
*/
public Method getOnExitMethod()
{
return this._onExit;
}

/*
* (non-Javadoc)
* @see com.aptana.sax.ISchemaElement#getOwningSchema()
@@ -215,24 +190,6 @@ public boolean hasAttribute(String name)
return this._attributes.containsKey(name);
}

/*
* (non-Javadoc)
* @see com.aptana.sax.ISchemaElement#hasOnEnterMethod()
*/
public boolean hasOnEnterMethod()
{
return this._onEnter != null;
}

/*
* (non-Javadoc)
* @see com.aptana.sax.ISchemaElement#hasOnExitMethod()
*/
public boolean hasOnExitMethod()
{
return this._onExit != null;
}

/*
* (non-Javadoc)
* @see com.aptana.sax.ISchemaElement#hasText()
@@ -358,46 +315,6 @@ public void setHasText(boolean value)
this._hasText = value;
}

/*
* (non-Javadoc)
* @see com.aptana.sax.ISchemaElement#setOnEnter(java.lang.String)
*/
public void setOnEnter(String onEnterMethod) throws SecurityException, NoSuchMethodException
{
Class<?> handlerClass = this.getOwningSchema().getHandlerClass();

if (handlerClass != null)
{
// this._onEnter = handlerClass.getDeclaredMethod(onEnterMethod,
// enterSignature);
this._onEnter = handlerClass.getMethod(onEnterMethod, enterSignature);
}
else
{
this._onEnter = null;
}
}

/*
* (non-Javadoc)
* @see com.aptana.sax.ISchemaElement#setOnExit(java.lang.String)
*/
public void setOnExit(String onExitMethod) throws SecurityException, NoSuchMethodException
{
Class<?> handlerClass = this.getOwningSchema().getHandlerClass();

if (handlerClass != null)
{
// this._onExit = handlerClass.getDeclaredMethod(onExitMethod,
// exitSignature);
this._onExit = handlerClass.getMethod(onExitMethod, exitSignature);
}
else
{
this._onExit = null;
}
}

/*
* (non-Javadoc)
* @see com.aptana.sax.ISchemaElement#toString()
@@ -56,7 +56,7 @@ public ValidatingReader(Schema schema)
// make sure we have a valid schema
if (schema == null)
{
schema = new Schema(this); // $codepro.audit.disable questionableAssignment
schema = new Schema(); // $codepro.audit.disable questionableAssignment
}

this._schema = schema;
@@ -95,7 +95,7 @@ public class SnippetPopupDialog extends PopupDialog
{
private static final String SNIPPETS_POPUP_SETTINGS = "snippets.popup.settings"; //$NON-NLS-1$
private ToolBar toolbar;
private Control positionTarget, sizeTarget;
private Control positionTarget;
private List<Image> toolbarImages = new ArrayList<Image>();
private SnippetElement snippet;
private ColorManager colorManager;
@@ -117,12 +117,11 @@ public class SnippetPopupDialog extends PopupDialog
private Composite mainComp;
private Composite snippetComp;

public SnippetPopupDialog(Shell shell, SnippetElement snippet, Control positionTarget, Control sizeTarget)
public SnippetPopupDialog(Shell shell, SnippetElement snippet, Control positionTarget)
{
super(shell, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true, false, false, false, snippet.getDisplayName(),
null);
super(shell, PopupDialog.INFOPOPUP_SHELLSTYLE, true, true, false, false, false, snippet
.getDisplayName(), null);
this.positionTarget = positionTarget;
this.sizeTarget = sizeTarget;
this.snippet = snippet;
colorManager = new ColorManager();
tabChar = Platform.getOS().equals(Platform.OS_MACOSX) ? "\u21E5" : "\u00bb"; //$NON-NLS-1$ //$NON-NLS-2$
@@ -514,9 +513,9 @@ protected void adjustBounds()
{
getShell().pack();
popupSize = getShell().getSize();
if (popupSize.x > 300)
if (popupSize.x > 500)
{
popupSize.x = 300;
popupSize.x = 500;
}

if (popupSize.y > sizeSize.y)
@@ -525,11 +524,21 @@ protected void adjustBounds()
}

// On OSX, compensate for the always visible horizontal scroll bar
ScrollBar horizontalBar = snippetViewer.getTextWidget().getHorizontalBar();
if (Platform.OS_MACOSX.equals(Platform.getOS()) && horizontalBar != null)
if (Platform.OS_MACOSX.equals(Platform.getOS()))
{
int height = horizontalBar.getSize().y;
popupSize.y += height;
ScrollBar horizontalBar = snippetViewer.getTextWidget().getHorizontalBar();
if (horizontalBar != null)
{
int height = horizontalBar.getSize().y;
popupSize.y += height;
}

ScrollBar verticalBar = snippetViewer.getTextWidget().getVerticalBar();
if (verticalBar != null)
{
int width = verticalBar.getSize().x;
popupSize.x += width;
}
}
}

@@ -48,8 +48,6 @@
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.DragSourceListener;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.ExpandEvent;
import org.eclipse.swt.events.ExpandListener;
import org.eclipse.swt.events.MouseAdapter;
@@ -72,11 +70,9 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.ExpandBar;
import org.eclipse.swt.widgets.ExpandItem;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.IEditorPart;
@@ -502,14 +498,9 @@ public void widgetSelected(SelectionEvent e)
@Override
public void widgetSelected(SelectionEvent e)
{
if (snippetDialog != null)
{
snippetDialog.close();
snippetDialog = null;
}
closeSnippetDialog();

snippetDialog = new SnippetPopupDialog(UIUtils.getActiveShell(), snippet, toolbar,
scrolledComposite);
snippetDialog = new SnippetPopupDialog(getShell(), snippet, toolbar);
snippetDialog.open();
}

@@ -761,6 +752,14 @@ protected Font getFont()
return font;
}

synchronized private void closeSnippetDialog()
{
if (snippetDialog != null)
{
snippetDialog.close();
snippetDialog = null;
}
}
/**
* Create contents of the view part.
*
@@ -15,7 +15,6 @@
import com.aptana.editor.css.CSSSourcePartitionScannerTest;
import com.aptana.editor.css.internal.build.CSSTaskDetectorTest;
import com.aptana.editor.css.internal.text.CSSFoldingComputerTest;
import com.aptana.editor.css.validator.CSSValidatorTest;
import com.aptana.editor.css.validator.ValidatorTests;

public class AllTests
@@ -76,7 +76,7 @@ protected ValidatingReader createReader(String schemaResource) throws SchemaInit
InputStream schemaStream = this.getInputStream(schemaResource);
ValidatingReader reader = new ValidatingReader();

reader._schema = SchemaBuilder.fromXML(schemaStream, reader);
reader._schema = SchemaBuilder.fromXML(schemaStream);

return reader;
}