org.tizen.web.editor.css_2.0.0.201311011708

16:50:39.418 INFO  jd.cli.Main - Decompiling org.tizen.web.editor.css_2.0.0.201311011708.jar
package org.tizen.web.editor.css;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.tizen.web.editor.css";
  private static Activator plugin;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
    
    setInitialPreferences();
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static Activator getDefault()
  {
    return plugin;
  }
  
  protected void setInitialPreferences()
  {
    IPreferenceStore cssStore = getDefault().getPreferenceStore();
    cssStore.setDefault("org.tizen.web.editor.css.preference.CSSValidationPreferencePage.warning", true);
    cssStore.setDefault("org.tizen.web.editor.css.preference.CSSValidationPreferencePage.error", false);
    cssStore.setDefault("org.tizen.web.editor.css.preference.CSSValidationPreferencePage.exclude", "min, jquery, jqm-docs, phonegap, sencha, tizen-web-ui-fw, globalize, coderdeck, modernizr");
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    return imageDescriptorFromPlugin("org.tizen.web.editor.css", path);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.Activator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css;

import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.part.FileEditorInput;
import org.tizen.web.editor.css.handlers.CSSValidationHandler;

class CSSEditor$1
  implements IPropertyChangeListener
{
  CSSEditor$1(CSSEditor paramCSSEditor) {}
  
  public void propertyChange(PropertyChangeEvent event)
  {
    CSSValidationHandler.runValidation(((FileEditorInput)this$0.getEditorInput()).getFile(), this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.CSSEditor.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.tizen.web.editor.css.handlers.CSSValidationHandler;

public class CSSEditor
  extends StructuredTextEditor
{
  private final IPropertyChangeListener listener = new IPropertyChangeListener()
  {
    public void propertyChange(PropertyChangeEvent event)
    {
      CSSValidationHandler.runValidation(((FileEditorInput)getEditorInput()).getFile(), CSSEditor.this);
    }
  };
  
  public CSSEditor()
  {
    Activator.getDefault().getPreferenceStore().addPropertyChangeListener(listener);
  }
  
  public void dispose()
  {
    Activator.getDefault().getPreferenceStore().removePropertyChangeListener(listener);
    super.dispose();
  }
  
  protected void setHelpContextId(String helpContextId)
  {
    super.setHelpContextId("org.tizen.ide.web.css_editor_context");
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.CSSEditor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.tizen.web.editor.css.messages";
  public static String CSSValidationPreferencePage_INFO;
  public static String CSSValidationPreferencePage_0;
  public static String CSSValidationPreferencePage_2;
  public static String CSSValidationPreferencePage_3;
  public static String CSSValidationPreferencePage_8;
  public static String CSSValidationPreferencePage_ExcludeLabel;
  
  static
  {
    NLS.initializeMessages("org.tizen.web.editor.css.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.Messages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css;

public class PreferenceConstants
{
  public static final String DEFAULT_EXCLUDE_FILES = "min, jquery, jqm-docs, phonegap, sencha, tizen-web-ui-fw, globalize, coderdeck, modernizr";
  public static final String WARNING = "org.tizen.web.editor.css.preference.CSSValidationPreferencePage.warning";
  public static final String ERROR = "org.tizen.web.editor.css.preference.CSSValidationPreferencePage.error";
  public static final String EXCLUDE = "org.tizen.web.editor.css.preference.CSSValidationPreferencePage.exclude";
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.PreferenceConstants
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css;

public class ValidationConstants
{
  public static final String[] CSS3_VENDOR_PREFIXES = {
    "-moz-", 
    "-webkit-", 
    "-o-", 
    "-ms-" };
  public static final String[] CSS3_FEATURES = {
    "linear-gradient", 
    "text-overflow", 
    "word-wrap", 
    "zoom", 
    "pointer-events", 
    "transform", 
    "appearance", 
    "user-select", 
    "overflow-scrolling", 
    "box-orient", 
    "box-align", 
    "box-pack", 
    "filter", 
    "behavior", 
    "background-quantity", 
    "accelerator", 
    "background-position-", 
    "ime-mode", 
    "layout-", 
    "ruby-", 
    "text-underline-position", 
    "scrollbar-" };
  public static final String[] CSS3_IGNORE_ERROR_MESSAGES = {
    "box is not a display value", 
    "auto is not a outline-style", 
    "Parse Error", 
    "Unknown pseudo-element" };
  
  public static boolean isFiltered(String message)
  {
    if ((isCSS3VendorPrefixes(message)) || (isCSS3Features(message)) || (isCSS3IgnoreErrorMessages(message))) {
      return true;
    }
    return false;
  }
  
  public static boolean isCSS3VendorPrefixes(String message)
  {
    String[] arrayOfString;
    int j = (arrayOfString = CSS3_VENDOR_PREFIXES).length;
    for (int i = 0; i < j; i++)
    {
      String prefix = arrayOfString[i];
      if (message.contains(prefix)) {
        return true;
      }
    }
    return false;
  }
  
  public static boolean isCSS3Features(String message)
  {
    String[] arrayOfString;
    int j = (arrayOfString = CSS3_FEATURES).length;
    for (int i = 0; i < j; i++)
    {
      String feature = arrayOfString[i];
      if (message.contains(feature)) {
        return true;
      }
    }
    return false;
  }
  
  public static boolean isCSS3IgnoreErrorMessages(String message)
  {
    String[] arrayOfString;
    int j = (arrayOfString = CSS3_IGNORE_ERROR_MESSAGES).length;
    for (int i = 0; i < j; i++)
    {
      String ignoreMessage = arrayOfString[i];
      if (message.contains(ignoreMessage)) {
        return true;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.ValidationConstants
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css.handlers;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.part.FileEditorInput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.util.log.UserLogger;

public class CSSValidationHandler
  extends AbstractHandler
{
  protected static final Logger logger = LoggerFactory.getLogger(CSSValidationHandler.class);
  
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    UserLogger.event("check.css");
    
    ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
    logger.trace("Selection: {}", selection);
    if ((selection instanceof ITreeSelection))
    {
      Object object = ((IStructuredSelection)selection).getFirstElement();
      IFile file = (IFile)object;
      runValidation(file, null);
    }
    else
    {
      IEditorPart editor = HandlerUtil.getActiveEditor(event);
      FileEditorInput fileInput = (FileEditorInput)editor.getEditorInput();
      IFile file = fileInput.getFile();
      runValidation(file, editor);
    }
    return null;
  }
  
  /* Error */
  public static void runValidation(IFile file, IEditorPart editor)
  {
    // Byte code:
    //   0: aload_0
    //   1: ifnonnull +4 -> 5
    //   4: return
    //   5: aconst_null
    //   6: astore_2
    //   7: aconst_null
    //   8: astore_3
    //   9: aload_1
    //   10: ifnull +59 -> 69
    //   13: aload_1
    //   14: instanceof 96
    //   17: ifeq +52 -> 69
    //   20: aload_1
    //   21: checkcast 96	org/eclipse/ui/texteditor/ITextEditor
    //   24: invokeinterface 98 1 0
    //   29: astore 4
    //   31: aload 4
    //   33: aload_1
    //   34: invokeinterface 70 1 0
    //   39: invokeinterface 102 2 0
    //   44: astore 5
    //   46: aload 5
    //   48: invokeinterface 108 1 0
    //   53: invokestatic 114	org/tizen/common/util/StringUtil:toInputStream	(Ljava/lang/String;)Ljava/io/InputStream;
    //   56: astore_2
    //   57: new 120	java/io/InputStreamReader
    //   60: dup
    //   61: aload_2
    //   62: invokespecial 122	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   65: astore_3
    //   66: goto +17 -> 83
    //   69: new 120	java/io/InputStreamReader
    //   72: dup
    //   73: aload_0
    //   74: invokeinterface 125 1 0
    //   79: invokespecial 122	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   82: astore_3
    //   83: new 129	org/tizen/web/editor/css/nature/ValidationVisitor
    //   86: dup
    //   87: invokespecial 131	org/tizen/web/editor/css/nature/ValidationVisitor:<init>	()V
    //   90: astore 4
    //   92: aload 4
    //   94: aload_0
    //   95: invokevirtual 132	org/tizen/web/editor/css/nature/ValidationVisitor:validateFile	(Lorg/eclipse/core/resources/IFile;)Z
    //   98: ifeq +68 -> 166
    //   101: aload 4
    //   103: aload_0
    //   104: aload_3
    //   105: invokevirtual 136	org/tizen/web/editor/css/nature/ValidationVisitor:validateParser	(Lorg/eclipse/core/resources/IFile;Ljava/io/Reader;)V
    //   108: goto +58 -> 166
    //   111: astore 4
    //   113: getstatic 16	org/tizen/web/editor/css/handlers/CSSValidationHandler:logger	Lorg/slf4j/Logger;
    //   116: aload 4
    //   118: invokevirtual 140	org/eclipse/core/runtime/CoreException:getMessage	()Ljava/lang/String;
    //   121: aload 4
    //   123: invokeinterface 145 3 0
    //   128: iconst_2
    //   129: anewarray 149	java/lang/Object
    //   132: dup
    //   133: iconst_0
    //   134: aload_3
    //   135: aastore
    //   136: dup
    //   137: iconst_1
    //   138: aload_2
    //   139: aastore
    //   140: invokestatic 151	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   143: goto +38 -> 181
    //   146: astore 6
    //   148: iconst_2
    //   149: anewarray 149	java/lang/Object
    //   152: dup
    //   153: iconst_0
    //   154: aload_3
    //   155: aastore
    //   156: dup
    //   157: iconst_1
    //   158: aload_2
    //   159: aastore
    //   160: invokestatic 151	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   163: aload 6
    //   165: athrow
    //   166: iconst_2
    //   167: anewarray 149	java/lang/Object
    //   170: dup
    //   171: iconst_0
    //   172: aload_3
    //   173: aastore
    //   174: dup
    //   175: iconst_1
    //   176: aload_2
    //   177: aastore
    //   178: invokestatic 151	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   181: return
    // Line number table:
    //   Java source line #98	-> byte code offset #0
    //   Java source line #99	-> byte code offset #4
    //   Java source line #102	-> byte code offset #5
    //   Java source line #103	-> byte code offset #7
    //   Java source line #105	-> byte code offset #9
    //   Java source line #107	-> byte code offset #20
    //   Java source line #108	-> byte code offset #31
    //   Java source line #109	-> byte code offset #46
    //   Java source line #110	-> byte code offset #57
    //   Java source line #112	-> byte code offset #69
    //   Java source line #115	-> byte code offset #83
    //   Java source line #116	-> byte code offset #92
    //   Java source line #118	-> byte code offset #101
    //   Java source line #120	-> byte code offset #111
    //   Java source line #121	-> byte code offset #113
    //   Java source line #122	-> byte code offset #128
    //   Java source line #123	-> byte code offset #134
    //   Java source line #122	-> byte code offset #146
    //   Java source line #123	-> byte code offset #154
    //   Java source line #124	-> byte code offset #163
    //   Java source line #122	-> byte code offset #166
    //   Java source line #123	-> byte code offset #172
    //   Java source line #125	-> byte code offset #181
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	182	0	file	IFile
    //   0	182	1	editor	IEditorPart
    //   6	171	2	is	java.io.InputStream
    //   8	165	3	reader	java.io.Reader
    //   29	3	4	provider	org.eclipse.ui.texteditor.IDocumentProvider
    //   90	12	4	validation	org.tizen.web.editor.css.nature.ValidationVisitor
    //   111	11	4	e	org.eclipse.core.runtime.CoreException
    //   44	3	5	doc	org.eclipse.jface.text.IDocument
    //   146	18	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   9	108	111	org/eclipse/core/runtime/CoreException
    //   9	128	146	finally
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.handlers.CSSValidationHandler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css.nature;

import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;

public class CSSBuilder
  extends IncrementalProjectBuilder
{
  public static final String CSS_BUILDER = "org.tizen.web.editor.css.nature.CSSBuilder";
  
  protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor)
    throws CoreException
  {
    IProject project = getProject();
    switch (kind)
    {
    case 9: 
    case 10: 
      IResourceDelta delta = getDelta(project);
      if (delta != null) {
        validate(delta);
      } else {
        validate(project);
      }
      break;
    case 6: 
    case 15: 
      validate(project);
      break;
    case 7: 
    case 8: 
    case 11: 
    case 12: 
    case 13: 
    case 14: 
    default: 
      throw new CoreException(new Status(4, "org.tizen.web.editor.css", "CSS Build Error"));
    }
    return null;
  }
  
  private void validate(IResourceDelta delta)
    throws CoreException
  {
    ValidationVisitor validator = new ValidationVisitor();
    delta.accept(validator);
  }
  
  private void validate(IProject project)
    throws CoreException
  {
    ValidationVisitor validator = new ValidationVisitor();
    project.accept(validator);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.nature.CSSBuilder
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css.nature;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.runtime.CoreException;

public class CSSNature
  implements IProjectNature
{
  public static final String CSS_NATURE = "org.tizen.web.editor.css.nature.CSSNature";
  private IProject project;
  
  public void configure()
    throws CoreException
  {
    IProjectDescription description = getProject().getDescription();
    ICommand[] commands = description.getBuildSpec();
    
    boolean actualBuilderExist = false;
    for (int i = 0; i < commands.length; i++) {
      if (commands[i].getBuilderName().equals("org.tizen.web.editor.css.nature.CSSBuilder"))
      {
        actualBuilderExist = true;
        break;
      }
    }
    if (!actualBuilderExist)
    {
      ICommand[] newCommands = new ICommand[commands.length + 1];
      System.arraycopy(commands, 0, newCommands, 0, commands.length);
      ICommand webBuilderCommand = description.newCommand();
      webBuilderCommand.setBuilderName("org.tizen.web.editor.css.nature.CSSBuilder");
      newCommands[(newCommands.length - 1)] = webBuilderCommand;
      description.setBuildSpec(newCommands);
      getProject().setDescription(description, null);
    }
  }
  
  public void deconfigure()
    throws CoreException
  {}
  
  public IProject getProject()
  {
    return project;
  }
  
  public void setProject(IProject project)
  {
    this.project = project;
  }
  
  public static void addNature(IProject project)
  {
    if (!project.isAccessible()) {
      return;
    }
    try
    {
      IProjectDescription description = project.getDescription();
      
      String[] oldNatures = description.getNatureIds();
      String[] arrayOfString1;
      int j = (arrayOfString1 = oldNatures).length;
      for (int i = 0; i < j; i++)
      {
        String natureId = arrayOfString1[i];
        if (natureId.equals("org.tizen.web.editor.css.nature.CSSNature")) {
          return;
        }
      }
      List<String> newNatures = new ArrayList();
      newNatures.addAll(Arrays.asList(oldNatures));
      newNatures.add("org.tizen.web.editor.css.nature.CSSNature");
      
      description.setNatureIds((String[])newNatures.toArray(new String[newNatures.size()]));
      project.setDescription(description, null);
    }
    catch (CoreException ex)
    {
      ex.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.nature.CSSNature
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css.nature;

import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URI;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.preference.IPreferenceStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.util.StringUtil;
import org.tizen.web.editor.css.Activator;
import org.tizen.web.editor.css.ValidationConstants;
import org.w3c.css.css.StyleSheet;
import org.w3c.css.css.StyleSheetParser;
import org.w3c.css.parser.CssError;
import org.w3c.css.parser.CssParseException;
import org.w3c.css.parser.Errors;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.Warning;
import org.w3c.css.util.Warnings;

public class ValidationVisitor
  implements IResourceVisitor, IResourceDeltaVisitor
{
  public static final String CSS_MARKER_ID = "org.tizen.web.editor.css.marker";
  protected final Logger logger = LoggerFactory.getLogger(getClass());
  private IFile file = null;
  
  public boolean visit(IResource resource)
    throws CoreException
  {
    validate(resource);
    return true;
  }
  
  public boolean visit(IResourceDelta delta)
    throws CoreException
  {
    IResource resource = delta.getResource();
    int kind = delta.getKind();
    if (((kind & 0x1) != 0) || ((kind & 0x4) != 0)) {
      validate(resource);
    }
    return true;
  }
  
  /* Error */
  public void validate(IResource resource)
    throws CoreException
  {
    // Byte code:
    //   0: aload_1
    //   1: instanceof 70
    //   4: ifne +4 -> 8
    //   7: return
    //   8: aload_0
    //   9: aload_1
    //   10: checkcast 70	org/eclipse/core/resources/IFile
    //   13: putfield 35	org/tizen/web/editor/css/nature/ValidationVisitor:file	Lorg/eclipse/core/resources/IFile;
    //   16: aload_0
    //   17: getfield 35	org/tizen/web/editor/css/nature/ValidationVisitor:file	Lorg/eclipse/core/resources/IFile;
    //   20: invokeinterface 72 1 0
    //   25: astore_2
    //   26: ldc 76
    //   28: aload_2
    //   29: invokevirtual 78	java/lang/String:equalsIgnoreCase	(Ljava/lang/String;)Z
    //   32: ifne +4 -> 36
    //   35: return
    //   36: aload_0
    //   37: aload_0
    //   38: getfield 35	org/tizen/web/editor/css/nature/ValidationVisitor:file	Lorg/eclipse/core/resources/IFile;
    //   41: invokevirtual 84	org/tizen/web/editor/css/nature/ValidationVisitor:validateFile	(Lorg/eclipse/core/resources/IFile;)Z
    //   44: ifne +4 -> 48
    //   47: return
    //   48: aconst_null
    //   49: astore_3
    //   50: aconst_null
    //   51: astore 4
    //   53: aload_0
    //   54: getfield 35	org/tizen/web/editor/css/nature/ValidationVisitor:file	Lorg/eclipse/core/resources/IFile;
    //   57: invokeinterface 88 1 0
    //   62: astore_3
    //   63: new 92	java/io/InputStreamReader
    //   66: dup
    //   67: aload_3
    //   68: invokespecial 94	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   71: astore 4
    //   73: aload_0
    //   74: aload_0
    //   75: getfield 35	org/tizen/web/editor/css/nature/ValidationVisitor:file	Lorg/eclipse/core/resources/IFile;
    //   78: aload 4
    //   80: invokevirtual 97	org/tizen/web/editor/css/nature/ValidationVisitor:validateParser	(Lorg/eclipse/core/resources/IFile;Ljava/io/Reader;)V
    //   83: goto +24 -> 107
    //   86: astore 5
    //   88: iconst_2
    //   89: anewarray 3	java/lang/Object
    //   92: dup
    //   93: iconst_0
    //   94: aload_3
    //   95: aastore
    //   96: dup
    //   97: iconst_1
    //   98: aload 4
    //   100: aastore
    //   101: invokestatic 101	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   104: aload 5
    //   106: athrow
    //   107: iconst_2
    //   108: anewarray 3	java/lang/Object
    //   111: dup
    //   112: iconst_0
    //   113: aload_3
    //   114: aastore
    //   115: dup
    //   116: iconst_1
    //   117: aload 4
    //   119: aastore
    //   120: invokestatic 101	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   123: return
    // Line number table:
    //   Java source line #83	-> byte code offset #0
    //   Java source line #84	-> byte code offset #7
    //   Java source line #87	-> byte code offset #8
    //   Java source line #89	-> byte code offset #16
    //   Java source line #90	-> byte code offset #26
    //   Java source line #91	-> byte code offset #35
    //   Java source line #95	-> byte code offset #36
    //   Java source line #96	-> byte code offset #47
    //   Java source line #99	-> byte code offset #48
    //   Java source line #100	-> byte code offset #50
    //   Java source line #102	-> byte code offset #53
    //   Java source line #103	-> byte code offset #63
    //   Java source line #104	-> byte code offset #73
    //   Java source line #105	-> byte code offset #86
    //   Java source line #106	-> byte code offset #94
    //   Java source line #107	-> byte code offset #104
    //   Java source line #105	-> byte code offset #107
    //   Java source line #106	-> byte code offset #113
    //   Java source line #108	-> byte code offset #123
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	124	0	this	ValidationVisitor
    //   0	124	1	resource	IResource
    //   25	4	2	ext	String
    //   49	65	3	contents	java.io.InputStream
    //   51	67	4	reader	java.io.InputStreamReader
    //   86	19	5	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   53	86	86	finally
  }
  
  public boolean validateFile(IFile file)
  {
    if (file == null) {
      return false;
    }
    IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
    String excludeFiles = prefs.getString("org.tizen.web.editor.css.preference.CSSValidationPreferencePage.exclude");
    String[] files = StringUtil.split(excludeFiles, ",");
    for (int i = 0; i < files.length; i++) {
      if (file.getName().indexOf(files[i].trim()) != -1) {
        try
        {
          file.deleteMarkers("org.tizen.web.editor.css.marker", true, 2);
          return false;
        }
        catch (CoreException e)
        {
          logger.error("Error occured", e);
        }
      }
    }
    return true;
  }
  
  public void validateParser(IFile file, Reader reader)
  {
    this.file = file;
    
    StyleSheetParser parser = new StyleSheetParser();
    ApplContext ac = new ApplContext("en");
    try
    {
      file.deleteMarkers("org.tizen.web.editor.css.marker", true, 2);
      parser.parseStyleElement(ac, reader, null, null, file.getRawLocationURI().toURL(), 0);
    }
    catch (CoreException e)
    {
      logger.error("Error occured", e);
    }
    catch (MalformedURLException e)
    {
      logger.error("Error occured", e);
    }
    StyleSheet stylesheet = parser.getStyleSheet();
    Object localObject;
    int j = (localObject = stylesheet.getWarnings().getWarnings()).length;
    for (int i = 0; i < j; i++)
    {
      Warning warring = localObject[i];
      setMarker(warring);
    }
    j = (localObject = stylesheet.getErrors().getErrors()).length;
    for (i = 0; i < j; i++)
    {
      CssError csserror = localObject[i];
      setMarker(csserror);
    }
  }
  
  private void setMarker(Object obj)
  {
    if (file == null) {
      return;
    }
    Warning cssWarning = null;
    CssError cssError = null;
    if ((obj instanceof Warning)) {
      cssWarning = (Warning)obj;
    } else if ((obj instanceof CssError)) {
      cssError = (CssError)obj;
    } else {
      return;
    }
    IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
    boolean bWarning = prefs.getBoolean("org.tizen.web.editor.css.preference.CSSValidationPreferencePage.warning");
    boolean bError = prefs.getBoolean("org.tizen.web.editor.css.preference.CSSValidationPreferencePage.error");
    if ((bWarning) && (cssWarning != null) && (!ValidationConstants.isFiltered(cssWarning.getWarningMessage())))
    {
      setCSSMarker(cssWarning.getWarningMessage(), cssWarning.getLine(), 1, 1);
    }
    else if ((bError) && (cssError != null))
    {
      Throwable exception = cssError.getException();
      if ((exception instanceof CssParseException))
      {
        if (!ValidationConstants.isFiltered(((CssParseException)exception).getException().getLocalizedMessage())) {
          setCSSMarker(((CssParseException)exception).getException().getLocalizedMessage(), cssError.getLine(), 2, 2);
        }
      }
      else if (!ValidationConstants.isFiltered(cssError.getException().getLocalizedMessage())) {
        setCSSMarker(exception.getLocalizedMessage(), cssError.getLine(), 2, 2);
      }
    }
  }
  
  private void setCSSMarker(String message, int lineNumber, int severity, int priority)
  {
    try
    {
      IMarker marker = file.createMarker("org.tizen.web.editor.css.marker");
      marker.setAttribute("message", message);
      marker.setAttribute("lineNumber", lineNumber);
      marker.setAttribute("severity", severity);
      marker.setAttribute("priority", priority);
    }
    catch (CoreException e)
    {
      logger.error("Error occured", e);
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.nature.ValidationVisitor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css.preference;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.tizen.web.editor.css.Activator;
import org.tizen.web.editor.css.Messages;

public class CSSValidationPreferencePage
  extends PreferencePage
  implements IWorkbenchPreferencePage
{
  private BooleanFieldEditor warningField;
  private BooleanFieldEditor errorField;
  private StringFieldEditor excludeField;
  
  public void init(IWorkbench workbench)
  {
    setPreferenceStore(Activator.getDefault().getPreferenceStore());
  }
  
  protected Control createContents(Composite parent)
  {
    Composite result = new Composite(parent, 0);
    result.setFont(parent.getFont());
    
    GridLayout layout = new GridLayout();
    marginHeight = convertVerticalDLUsToPixels(7);
    marginWidth = 0;
    numColumns = 1;
    result.setLayout(layout);
    
    Group validationGroup = new Group(result, 0);
    validationGroup.setText(Messages.CSSValidationPreferencePage_8);
    GridLayout validationGroupLayout = new GridLayout();
    GridData validationGroupLayoutData = new GridData(768);
    validationGroup.setLayout(validationGroupLayout);
    validationGroup.setLayoutData(validationGroupLayoutData);
    
    Label lblInfo = new Label(validationGroup, 16384);
    lblInfo.setText(Messages.CSSValidationPreferencePage_INFO);
    lblInfo.setLayoutData(new GridData());
    
    Group validatorGroup = new Group(validationGroup, 0);
    validatorGroup.setText(Messages.CSSValidationPreferencePage_0);
    GridLayout validatorGroupLayout = new GridLayout();
    GridData validatorGroupLayoutGridData = new GridData(768);
    validatorGroup.setLayout(validatorGroupLayout);
    validatorGroup.setLayoutData(validatorGroupLayoutGridData);
    Composite validatorGroupInner = new Composite(validatorGroup, 0);
    validatorGroupInner.setLayoutData(new GridData());
    
    Composite excludeInner = new Composite(validationGroup, 0);
    GridData data = new GridData();
    widthHint = 500;
    excludeInner.setLayoutData(data);
    
    warningField = new BooleanFieldEditor("org.tizen.web.editor.css.preference.CSSValidationPreferencePage.warning", Messages.CSSValidationPreferencePage_2, validatorGroupInner);
    errorField = new BooleanFieldEditor("org.tizen.web.editor.css.preference.CSSValidationPreferencePage.error", Messages.CSSValidationPreferencePage_3, validatorGroupInner);
    excludeField = new StringFieldEditor("org.tizen.web.editor.css.preference.CSSValidationPreferencePage.exclude", Messages.CSSValidationPreferencePage_ExcludeLabel, excludeInner);
    
    setPreferenceStore();
    loadPreference();
    
    return result;
  }
  
  public boolean performOk()
  {
    storePreference();
    return super.performOk();
  }
  
  protected void performDefaults()
  {
    loadDefaultPreference();
    super.performDefaults();
  }
  
  private void setPreferenceStore()
  {
    IPreferenceStore ps = getPreferenceStore();
    warningField.setPreferenceStore(ps);
    errorField.setPreferenceStore(ps);
    excludeField.setPreferenceStore(ps);
  }
  
  private void loadPreference()
  {
    warningField.load();
    errorField.load();
    excludeField.load();
  }
  
  private void storePreference()
  {
    warningField.store();
    errorField.store();
    excludeField.store();
  }
  
  private void loadDefaultPreference()
  {
    warningField.loadDefault();
    errorField.loadDefault();
    excludeField.loadDefault();
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.preference.CSSValidationPreferencePage
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css.view;

import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.part.ViewPart;

public abstract class AbstractViewPart
  extends ViewPart
  implements IPartListener, IDocumentListener
{
  public void createPartControl(Composite parent)
  {
    getSite().getPage().addPartListener(this);
  }
  
  public void dispose()
  {
    getSite().getPage().removePartListener(this);
    
    removeDocumentListener();
    super.dispose();
  }
  
  public abstract void documentChanged();
  
  public abstract void addDocumentListener();
  
  public abstract void removeDocumentListener();
  
  public void partActivated(IWorkbenchPart part) {}
  
  public void partDeactivated(IWorkbenchPart part) {}
  
  public void partBroughtToTop(IWorkbenchPart part) {}
  
  public void partOpened(IWorkbenchPart part) {}
  
  public void partClosed(IWorkbenchPart part) {}
  
  public void documentAboutToBeChanged(DocumentEvent event) {}
  
  public void documentChanged(DocumentEvent event)
  {
    documentChanged();
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.editor.css.view.AbstractViewPart
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.editor.css.view;

import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.css.css.CssRuleList;
import org.w3c.css.css.CssStyleRule;
import org.w3c.css.css.StyleSheet;
import org.w3c.css.css.StyleSheetParser;
import org.w3c.css.util.ApplContext;

public class CSS2HTML
{
  protected static final Logger logger = LoggerFactory.getLogger(CSS2HTML.class);
  protected static final String REFINE_SELECTOR_REGEX = "[\\s]*([>\\+\\,])\\s";
  protected static final String[] IGNORE_SELECTORS = { "body", "table", "tr", "td", "th" };
  protected static final String HTML_TEMPLATE = "<!doctype html><html><head><title>CSS Preview</title><style type=\"text/css\"> {0} </style></head><body oncontextmenu=\"return false;\"> {1} </body></html>";
  protected static final String CLASSTAG_TEMPLATE = "<{0} class=\"{1}\">{2}</{0}>";
  protected static final String IDTAG_TEMPLATE = "<{0} id=\"{1}\">{2}</{0}>";
  protected static final String PRETAG_TEMPLATE = "<{0}>";
  protected static final String POSTTAG_TEMPLATE = "</{0}>";
  protected static final String BR = "<br>";
  protected static final String DIV = "div";
  
  public static String buildHTML(String cssSource)
  {
    List<String> selectors = new ArrayList();
    try
    {
      StyleSheetParser parser = new StyleSheetParser();
      ApplContext ac = new ApplContext("en");
      parser.parseStyleElement(ac, new StringReader(cssSource), null, null, new URL("http://127.0.0.1"), 0);
      
      StyleSheet stylesheet = parser.getStyleSheet();
      ArrayList<CssRuleList> cssrules = stylesheet.newGetRules();
      Iterator localIterator2;
      for (Iterator localIterator1 = cssrules.iterator(); localIterator1.hasNext(); localIterator2.hasNext())
      {
        CssRuleList cssRuleList = (CssRuleList)localIterator1.next();
        ArrayList<CssStyleRule> cssStyleRules = cssRuleList.getStyleRules();
        localIterator2 = cssStyleRules.iterator(); continue;CssStyleRule cssStyleRule = (CssStyleRule)localIterator2.next();
        
        String selector = cssStyleRule.getSelectors();
        boolean isSelector = true;
        String[] arrayOfString;
        int j = (arrayOfString = IGNORE_SELECTORS).length;
        for (int i = 0; i < j; i++)
        {
          String ignoreSelector = arrayOfString[i];
          if (selector.contentEquals(ignoreSelector))
          {
            isSelector = false;
            break;
          }
        }
        if (isSelector) {
          selectors.add(selector);
        }
      }
    }
    catch (MalformedURLException e)
    {
      logger.error(e.getMessage(), e);
    }
    return MessageFormat.format("<!doctype html><html><head><title>CSS Preview</title><style type=\"text/css\"> {0} </style></head><body oncontextmenu=\"return false;\"> {1} </body></html>", new Object[] { cssSource, createElementFromSelector(selectors) });
  }
  
  protected static String createElementFromSelector(List<String> selectors)
  {
    StringBuilder sb = new StringBuilder(2048);
    for (String selector : selectors)
    {
      List<CSSSelector> cssSelectors = new ArrayList();
      List<String> tagNames = new ArrayList();
      String resultRegExp = selector.replaceAll("[\\s]*([>\\+\\,])\\s", "$1");
      
      char[] refinedSelector = resultRegExp.toCharArray();
      StringBuilder tagName = new StringBuilder(1024);
      for (int i = 0; i < refinedSelector.length; i++)
      {
        CSSSelector cssSelector = getCSSSelector(Character.toString(refinedSelector[i]));
        if (cssSelector != null)
        {
          cssSelectors.add(cssSelector);
          tagNames.add(tagName.toString());
          tagName.delete(0, tagName.length());
        }
        else
        {
          tagName.append(refinedSelector[i]);
        }
        if (i == refinedSelector.length - 1) {
          tagNames.add(tagName.toString());
        }
      }
      if (cssSelectors.size() == 0)
      {
        createSimpleElement(sb, selector, CSSSelector.TYPE, (String)tagNames.get(0), "");
      }
      else if (cssSelectors.size() == 1)
      {
        createSimpleElement(sb, selector, (CSSSelector)cssSelectors.get(0), (String)tagNames.get(0), (String)tagNames.get(1));
      }
      else if (cssSelectors.size() > 1)
      {
        if (cssSelectors.contains(CSSSelector.UNIVERSAL)) {
          return sb.toString();
        }
        createMultipleElement(sb, selector, cssSelectors, tagNames);
      }
    }
    return sb.toString();
  }
  
  protected static CSSSelector getCSSSelector(String selectorPattern)
  {
    CSSSelector[] arrayOfCSSSelector;
    int j = (arrayOfCSSSelector = CSSSelector.values()).length;
    for (int i = 0; i < j; i++)
    {
      CSSSelector cssSelector = arrayOfCSSSelector[i];
      if (cssSelector.getPattern().equals(selectorPattern)) {
        return cssSelector;
      }
    }
    return null;
  }
  
  protected static void createSimpleElement(StringBuilder sb, String pattern, CSSSelector cssSelector, String firstTag, String secondTag)
  {
    String description = cssSelector.getDescription();
    switch (cssSelector)
    {
    case ADJACENT: 
      createFullElement(sb, null, null, firstTag);
      createFullElement(sb, pattern, description, secondTag);
      break;
    case ATTRIBUTE: 
      createFullElement(sb, pattern, description, "div");
      break;
    case CHILD: 
      createFullElement(sb, pattern, description, firstTag);
      break;
    case CLASS: 
    case DESCENDANT: 
      createPreElement(sb, firstTag);
      createFullElement(sb, pattern, description, secondTag);
      createPostElement(sb, firstTag);
      break;
    case GROUPING: 
      createFullElement(sb, null, null, firstTag);
      createFullElement(sb, pattern, description, secondTag);
      break;
    case PSEUDO: 
      if (secondTag.isEmpty()) {
        return;
      }
      if (!firstTag.isEmpty()) {
        sb.append(MessageFormat.format("<{0} class=\"{1}\">{2}</{0}>", new Object[] { firstTag, secondTag, description + pattern }));
      } else {
        sb.append(MessageFormat.format("<{0} class=\"{1}\">{2}</{0}>", new Object[] { "div", secondTag,
1 2

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd