org.eclipse.wst.jsdt.web.core_1.0.401.v201108152113_patch

16:49:20.978 INFO  jd.cli.Main - Decompiling org.eclipse.wst.jsdt.web.core_1.0.401.v201108152113_patch.jar
package org.eclipse.wst.jsdt.web.core.internal;

import java.io.PrintStream;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

public class IncrementalBuilder
  extends IncrementalProjectBuilder
{
  public IncrementalBuilder()
  {
    System.out.println("Unimplemented method:IncrementalProjectBuilder()");
  }
  
  protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
    throws CoreException
  {
    System.out.println("Unimplemented method:IncrementalBuilder.build");
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.IncrementalBuilder
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.jsdt.core.IIncludePathAttribute;
import org.eclipse.wst.jsdt.core.IIncludePathEntry;
import org.eclipse.wst.jsdt.core.JavaScriptCore;
import org.eclipse.wst.jsdt.internal.core.ClasspathEntry;
import org.eclipse.wst.jsdt.internal.core.JavaProject;
import org.eclipse.wst.jsdt.internal.core.util.Messages;
import org.eclipse.wst.jsdt.web.core.internal.project.ModuleSourcePathProvider;
import org.eclipse.wst.sse.core.indexing.AbstractIndexManager;

public class JSWebResourceEventManager
  extends AbstractIndexManager
{
  private static JSWebResourceEventManager INSTANCE;
  private static final String DOT_PROJECT_FILE_NAME = ".project";
  private IPath fWorkingLocation;
  
  private JSWebResourceEventManager()
  {
    super(Messages.build_analyzingDeltas, Messages.build_analyzingDeltas, JsCoreMessages.model_initialization, Messages.manager_filesToIndex);
  }
  
  public static JSWebResourceEventManager getDefault()
  {
    return INSTANCE != null ? INSTANCE : (INSTANCE = new JSWebResourceEventManager());
  }
  
  protected boolean isResourceToIndex(int type, IPath path)
  {
    return (type == 8) || (type == 4) || ((type == 1) && (".project".equals(path.lastSegment())));
  }
  
  protected void performAction(byte source, byte action, IResource resource, IPath movePath)
  {
    switch (action)
    {
    case 0: 
      if (resource.getName().equals(".project")) {
        updateClassPathEntries(resource.getProject());
      }
      break;
    }
  }
  
  protected IPath getWorkingLocation()
  {
    if (fWorkingLocation == null)
    {
      IPath workingLocation = 
        JsCorePlugin.getDefault().getStateLocation().append("resourceEventManager");
      
      File folder = new File(workingLocation.toOSString());
      if (!folder.isDirectory()) {
        try
        {
          folder.mkdir();
        }
        catch (SecurityException e)
        {
          Logger.logException(
          
            getName() + ": Error while creating state location: " + folder + " This renders the index manager irrevocably broken for this workspace session", 
            e);
        }
      }
      fWorkingLocation = workingLocation;
    }
    return fWorkingLocation;
  }
  
  private static void updateClassPathEntries(IProject project)
  {
    try
    {
      if ((project.hasNature("org.eclipse.wst.jsdt.core.jsNature")) && (ModuleCoreNature.isFlexibleProject(project)))
      {
        JavaProject jsProject = (JavaProject)JavaScriptCore.create(project);
        
        IIncludePathEntry[] oldEntries = jsProject.getRawIncludepath();
        List updatedEntries = new ArrayList();
        boolean updateIncludePath = false;
        for (int oldEntry = 0; oldEntry < oldEntries.length; oldEntry++)
        {
          IIncludePathAttribute[] entryAttributes = oldEntries[oldEntry].getExtraAttributes();
          
          boolean isProvidedEntry = false;
          for (int attribute = 0; attribute < entryAttributes.length; attribute++)
          {
            isProvidedEntry = (entryAttributes[attribute].getName().equals("provider")) && (entryAttributes[attribute].getValue().equals(ModuleSourcePathProvider.PROVIDER_ATTRIBUTE_KEY_VALUE));
            updateIncludePath |= isProvidedEntry;
            if (isProvidedEntry)
            {
              IPath[] nonRelativeExclusionPaths = oldEntries[oldEntry].getExclusionPatterns();
              for (int i = 0; i < nonRelativeExclusionPaths.length; i++) {
                nonRelativeExclusionPaths[i] = oldEntries[oldEntry].getPath().append(nonRelativeExclusionPaths[i]);
              }
              IPath[] nonRelativeInclusionPaths = oldEntries[oldEntry].getInclusionPatterns();
              for (int i = 0; i < nonRelativeInclusionPaths.length; i++) {
                nonRelativeInclusionPaths[i] = oldEntries[oldEntry].getPath().append(nonRelativeInclusionPaths[i]);
              }
              IResource[] roots = getRoots(project);
              IIncludePathEntry[] resolvedEntries = jsProject.getResolvedClasspath();
              for (int root = 0; root < roots.length; root++)
              {
                IPath rootPath = roots[root].getFullPath();
                
                boolean foundMatch = false;
                for (int k = 0; k < resolvedEntries.length; k++) {
                  if (resolvedEntries[k].getPath().equals(rootPath))
                  {
                    foundMatch = true;
                    break;
                  }
                }
                if (!foundMatch)
                {
                  List exclusionPatterns = new ArrayList();
                  for (int i = 0; i < nonRelativeExclusionPaths.length; i++)
                  {
                    IPath parentRelativeExclusionPattern = PathUtils.makePatternRelativeToParent(nonRelativeExclusionPaths[i], rootPath);
                    if (parentRelativeExclusionPattern != null) {
                      exclusionPatterns.add(parentRelativeExclusionPattern);
                    }
                  }
                  List inclusionPatterns = new ArrayList();
                  for (int i = 0; i < nonRelativeInclusionPaths.length; i++)
                  {
                    IPath parentRelativeInclusionPattern = PathUtils.makePatternRelativeToParent(nonRelativeInclusionPaths[i], rootPath);
                    if (parentRelativeInclusionPattern != null) {
                      inclusionPatterns.add(parentRelativeInclusionPattern);
                    }
                  }
                  IPath[] exclusionPaths = exclusionPatterns.isEmpty() ? ClasspathEntry.EXCLUDE_NONE : (IPath[])exclusionPatterns.toArray(new IPath[exclusionPatterns.size()]);
                  IPath[] inclusionPaths = inclusionPatterns.isEmpty() ? ClasspathEntry.INCLUDE_ALL : (IPath[])inclusionPatterns.toArray(new IPath[inclusionPatterns.size()]);
                  
                  IIncludePathEntry newEntry = JavaScriptCore.newSourceEntry(rootPath, inclusionPaths, exclusionPaths, null);
                  updatedEntries.add(newEntry);
                }
              }
            }
          }
          if (!isProvidedEntry) {
            updatedEntries.add(oldEntries[oldEntry]);
          }
        }
        if (updateIncludePath) {
          jsProject.setRawIncludepath((IIncludePathEntry[])updatedEntries.toArray(new IIncludePathEntry[updatedEntries.size()]), jsProject.getOutputLocation(), null);
        }
      }
    }
    catch (CoreException e)
    {
      Logger.logException("Error while updating JavaScript includepath", e);
    }
  }
  
  private static IResource[] getRoots(IProject project)
  {
    IVirtualFile root = ComponentCore.createFile(project, Path.ROOT);
    IResource[] underlyingResources = root.getUnderlyingResources();
    if ((underlyingResources == null) || (underlyingResources.length == 0)) {
      underlyingResources = new IResource[] { root.getUnderlyingResource() };
    }
    return underlyingResources;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.JSWebResourceEventManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal;

import org.eclipse.osgi.util.NLS;

public class JsCoreMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.jsdt.web.core.internal.JSPCorePluginResources";
  public static String JSP_Search;
  public static String JSPBatchValidator_0;
  public static String JSPDirectiveValidator_0;
  public static String JSPDirectiveValidator_1;
  public static String JSPDirectiveValidator_2;
  public static String JSPDirectiveValidator_3;
  public static String JSPDocumentLoader_1;
  public static String JSPEL_Syntax;
  public static String JSPEL_Token;
  public static String JSPFContentPropertiesManager_Problems_Updating;
  public static String JSPFContentPropertiesManager_Updating;
  public static String JSPIndexManager_0;
  public static String JSPIndexManager_2;
  public static String model_initialization;
  /**
   * @deprecated
   */
  public static String MESSAGE_JSP_VALIDATING_MESSAGE_UI_;
  
  static
  {
    NLS.initializeMessages("org.eclipse.wst.jsdt.web.core.internal.JSPCorePluginResources", JsCoreMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.JsCoreMessages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal;

import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.runtime.IProgressMonitor;

class JsCorePlugin$PluginInitializerJob$1$1
  implements IResourceChangeListener
{
  JsCorePlugin$PluginInitializerJob$1$1(JsCorePlugin.PluginInitializerJob.1 param1, IProgressMonitor paramIProgressMonitor) {}
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    JSWebResourceEventManager.getDefault().start(event.getDelta(), val$monitor);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.JsCorePlugin.PluginInitializerJob.1.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal;

import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.ISavedState;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

class JsCorePlugin$PluginInitializerJob$1
  implements IWorkspaceRunnable
{
  JsCorePlugin$PluginInitializerJob$1(JsCorePlugin.PluginInitializerJob paramPluginInitializerJob) {}
  
  public void run(final IProgressMonitor monitor)
    throws CoreException
  {
    ISavedState savedState = null;
    try
    {
      savedState = ResourcesPlugin.getWorkspace().addSaveParticipant("org.eclipse.wst.jsdt.web.core", new JsCorePlugin.SaveParticipant());
    }
    catch (CoreException e)
    {
      Logger.logException("JavaScript Web Core failed loading previously saved state; it will be recalculated for this workspace.", e);
    }
    if (savedState != null) {
      try
      {
        Thread.currentThread().setPriority(1);
      }
      finally
      {
        savedState.processResourceChangeEvents(new IResourceChangeListener()
        {
          public void resourceChanged(IResourceChangeEvent event)
          {
            JSWebResourceEventManager.getDefault().start(event.getDelta(), monitor);
          }
        });
      }
    } else {
      JSWebResourceEventManager.getDefault().start(null, monitor);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.JsCorePlugin.PluginInitializerJob.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal;

import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.ISavedState;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;

class JsCorePlugin$PluginInitializerJob
  extends Job
{
  JsCorePlugin$PluginInitializerJob()
  {
    super(JsCoreMessages.model_initialization);
    
    setUser(false);
    setSystem(true);
    setPriority(30);
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    IStatus status = Status.OK_STATUS;
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    try
    {
      IWorkspaceRunnable registerParticipant = new IWorkspaceRunnable()
      {
        public void run(final IProgressMonitor monitor)
          throws CoreException
        {
          ISavedState savedState = null;
          try
          {
            savedState = ResourcesPlugin.getWorkspace().addSaveParticipant("org.eclipse.wst.jsdt.web.core", new JsCorePlugin.SaveParticipant());
          }
          catch (CoreException e)
          {
            Logger.logException("JavaScript Web Core failed loading previously saved state; it will be recalculated for this workspace.", e);
          }
          if (savedState != null) {
            try
            {
              Thread.currentThread().setPriority(1);
            }
            finally
            {
              savedState.processResourceChangeEvents(new IResourceChangeListener()
              {
                public void resourceChanged(IResourceChangeEvent event)
                {
                  JSWebResourceEventManager.getDefault().start(event.getDelta(), monitor);
                }
              });
            }
          } else {
            JSWebResourceEventManager.getDefault().start(null, monitor);
          }
        }
      };
      workspace.run(registerParticipant, monitor);
    }
    catch (CoreException e)
    {
      status = e.getStatus();
    }
    return status;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.JsCorePlugin.PluginInitializerJob
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal;

import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.runtime.CoreException;

class JsCorePlugin$SaveParticipant
  implements ISaveParticipant
{
  public void doneSaving(ISaveContext context) {}
  
  public void prepareToSave(ISaveContext context)
    throws CoreException
  {}
  
  public void rollback(ISaveContext context) {}
  
  public void saving(ISaveContext context)
    throws CoreException
  {
    context.needDelta();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.JsCorePlugin.SaveParticipant
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal;

import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.resources.ISavedState;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.wst.jsdt.web.core.javascript.search.JsIndexManager;
import org.osgi.framework.BundleContext;

public class JsCorePlugin
  extends Plugin
{
  private static JsCorePlugin plugin;
  public static final String PLUGIN_ID = "org.eclipse.wst.jsdt.web.core";
  private Job fPluginInitializerJob;
  
  private static class PluginInitializerJob
    extends Job
  {
    PluginInitializerJob()
    {
      super();
      
      setUser(false);
      setSystem(true);
      setPriority(30);
    }
    
    protected IStatus run(IProgressMonitor monitor)
    {
      IStatus status = Status.OK_STATUS;
      IWorkspace workspace = ResourcesPlugin.getWorkspace();
      try
      {
        IWorkspaceRunnable registerParticipant = new IWorkspaceRunnable()
        {
          public void run(final IProgressMonitor monitor)
            throws CoreException
          {
            ISavedState savedState = null;
            try
            {
              savedState = ResourcesPlugin.getWorkspace().addSaveParticipant("org.eclipse.wst.jsdt.web.core", new JsCorePlugin.SaveParticipant());
            }
            catch (CoreException e)
            {
              Logger.logException("JavaScript Web Core failed loading previously saved state; it will be recalculated for this workspace.", e);
            }
            if (savedState != null) {
              try
              {
                Thread.currentThread().setPriority(1);
              }
              finally
              {
                savedState.processResourceChangeEvents(new IResourceChangeListener()
                {
                  public void resourceChanged(IResourceChangeEvent event)
                  {
                    JSWebResourceEventManager.getDefault().start(event.getDelta(), monitor);
                  }
                });
              }
            } else {
              JSWebResourceEventManager.getDefault().start(null, monitor);
            }
          }
        };
        workspace.run(registerParticipant, monitor);
      }
      catch (CoreException e)
      {
        status = e.getStatus();
      }
      return status;
    }
  }
  
  private static class SaveParticipant
    implements ISaveParticipant
  {
    public void doneSaving(ISaveContext context) {}
    
    public void prepareToSave(ISaveContext context)
      throws CoreException
    {}
    
    public void rollback(ISaveContext context) {}
    
    public void saving(ISaveContext context)
      throws CoreException
    {
      context.needDelta();
    }
  }
  
  /**
   * @deprecated
   */
  public static JsCorePlugin getDefault()
  {
    return plugin;
  }
  
  public JsCorePlugin()
  {
    plugin = this;
    fPluginInitializerJob = new PluginInitializerJob();
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    
    JsIndexManager.getInstance().initialize();
    
    fPluginInitializerJob.schedule(2000L);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    JsIndexManager.getInstance().shutdown();
    
    JSWebResourceEventManager.getDefault().stop();
    super.stop(context);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.JsCorePlugin
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal;

import com.ibm.icu.util.StringTokenizer;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.Bundle;

public class Logger
{
  public static final int ERROR = 4;
  public static final int ERROR_DEBUG = 204;
  public static final int INFO = 1;
  public static final int INFO_DEBUG = 201;
  public static final int OK = 0;
  public static final int OK_DEBUG = 200;
  private static final String PLUGIN_ID = "org.eclipse.wst.jsdt.web.core";
  private static final String TRACEFILTER_LOCATION = "/debug/tracefilter";
  public static final int WARNING = 2;
  public static final int WARNING_DEBUG = 202;
  
  protected static void _log(int level, String message, Throwable exception)
  {
    if (((level == 200) || (level == 201) || (level == 202) || (level == 204)) && 
      (!isDebugging())) {
      return;
    }
    int severity = 0;
    switch (level)
    {
    case 1: 
    case 201: 
      severity = 1;
      break;
    case 2: 
    case 202: 
      severity = 2;
      break;
    case 4: 
    case 204: 
      severity = 4;
    }
    message = message != null ? message : "null";
    Status statusObj = new Status(severity, "org.eclipse.wst.jsdt.web.core", severity, message, exception);
    Bundle bundle = Platform.getBundle("org.eclipse.wst.jsdt.web.core");
    if (bundle != null) {
      Platform.getLog(bundle).log(statusObj);
    }
  }
  
  protected static void _trace(String category, String message, Throwable exception)
  {
    if (isTracing(category))
    {
      message = message != null ? message : "null";
      Status statusObj = new Status(0, "org.eclipse.wst.jsdt.web.core", 0, message, exception);
      Bundle bundle = Platform.getBundle("org.eclipse.wst.jsdt.web.core");
      if (bundle != null) {
        Platform.getLog(bundle).log(statusObj);
      }
    }
  }
  
  public static boolean isDebugging()
  {
    return Platform.inDebugMode();
  }
  
  public static boolean isTracing(String category)
  {
    if (!isDebugging()) {
      return false;
    }
    String traceFilter = Platform.getDebugOption("org.eclipse.wst.jsdt.web.core/debug/tracefilter");
    if (traceFilter != null)
    {
      StringTokenizer tokenizer = new StringTokenizer(traceFilter, ",");
      while (tokenizer.hasMoreTokens())
      {
        String cat = tokenizer.nextToken().trim();
        if (category.equals(cat)) {
          return true;
        }
      }
    }
    return false;
  }
  
  public static void log(int level, String message)
  {
    _log(level, message, null);
  }
  
  public static void log(int level, String message, Throwable exception)
  {
    _log(level, message, exception);
  }
  
  public static void logException(String message, Throwable exception)
  {
    _log(4, message, exception);
  }
  
  public static void logException(Throwable exception)
  {
    _log(4, exception.getMessage(), exception);
  }
  
  public static void trace(String category, String message)
  {
    _trace(category, message, null);
  }
  
  public static void traceException(String category, String message, Throwable exception)
  {
    _trace(category, message, exception);
  }
  
  public static void traceException(String category, Throwable exception)
  {
    _trace(category, exception.getMessage(), exception);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.Logger
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal;

import java.io.File;
import org.eclipse.core.runtime.IPath;
import org.eclipse.wst.jsdt.core.compiler.CharOperation;

public class PathUtils
{
  private static final String STAR = "*";
  private static final String STAR_STAR = "**";
  
  public static int countPatternSegmentsThatMatchParent(IPath pattern, IPath parent)
  {
    int matchingSegments = 0;
    if ((pattern.segmentCount() != 1) || (
      (!pattern.segment(0).equals("**")) && (!pattern.segment(0).equals("*"))))
    {
      int patternSegmentIndex = 0;
      int parentSegmentIndex = 0;
      boolean starStarMode = false;
      while ((patternSegmentIndex < pattern.segmentCount()) && 
        (parentSegmentIndex < parent.segmentCount()))
      {
        String patternSegment = pattern.segment(patternSegmentIndex);
        String parentSegment = parent.segment(parentSegmentIndex);
        if (starStarMode)
        {
          if (pathSegmentMatchesPattern(patternSegment, parentSegment))
          {
            starStarMode = false;
            matchingSegments++;
            patternSegmentIndex++;
            parentSegmentIndex++;
          }
          else
          {
            parentSegmentIndex++;
          }
        }
        else if (patternSegment.equals("**"))
        {
          starStarMode = true;
          
          matchingSegments++;
          parentSegmentIndex++;
          for (int i = patternSegmentIndex + 1; i < pattern.segmentCount(); i++) {
            if ((!pattern.segment(i).equals("**")) && 
              (!pattern.segment(i).equals("*")))
            {
              patternSegmentIndex = i;
              break;
            }
          }
        }
        else
        {
          if ((!patternSegment.equals("*")) && 
            (!pathSegmentMatchesPattern(patternSegment, parentSegment))) {
            break;
          }
          matchingSegments++;
          patternSegmentIndex++;
          parentSegmentIndex++;
        }
      }
    }
    return matchingSegments;
  }
  
  public static IPath makePatternRelativeToParent(IPath pattern, IPath parent)
  {
    int matchedSegments = countPatternSegmentsThatMatchParent(pattern, parent);
    
    IPath relativePattern = null;
    if (matchedSegments != 0)
    {
      relativePattern = pattern.removeFirstSegments(matchedSegments);
      if (relativePattern.segmentCount() == 0) {
        relativePattern = null;
      } else {
        relativePattern.makeRelative();
      }
    }
    return relativePattern;
  }
  
  private static boolean pathSegmentMatchesPattern(String patternSegment, String segment)
  {
    return CharOperation.pathMatch(patternSegment.toCharArray(), segment.toCharArray(), 
      false, File.separatorChar);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.PathUtils
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal.modelhandler;

public abstract interface IWebDocumentChangeListener
  extends IWebResourceChangedListener
{
  public static final int BORING = 0;
  public static final int DIRTY_DOC = 1;
  public static final int DIRTY_MODEL = 2;
  
  public abstract int getIntrestLevelAtOffset(int paramInt);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.modelhandler.IWebDocumentChangeListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal.modelhandler;

public abstract interface IWebResourceChangedListener
{
  public abstract void resourceChanged();
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.modelhandler.IWebResourceChangedListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal.modelhandler;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.jsdt.web.core.internal.modelhandler.messages";
  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.eclipse.wst.jsdt.web.core.internal.modelhandler.messages");
  
  public static String getString(String key)
  {
    try
    {
      return RESOURCE_BUNDLE.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return '!' + key + '!';
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.modelhandler.Messages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal.modelhandler;

import java.util.ArrayList;

class WebResourceChangeHandler$ModelIrritantThread
  implements Runnable
{
  private WebResourceChangeHandler$ModelIrritantThread(WebResourceChangeHandler paramWebResourceChangeHandler) {}
  
  public void run()
  {
    signalAllDirtyModel();
  }
  
  public void signalAllDirtyModel()
  {
    for (int i = 0; i < WebResourceChangeHandler.access$0(this$0).size(); i++) {
      ((IWebResourceChangedListener)WebResourceChangeHandler.access$0(this$0).get(i)).resourceChanged();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.modelhandler.WebResourceChangeHandler.ModelIrritantThread
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal.modelhandler;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.wst.sse.core.internal.model.ModelLifecycleEvent;
import org.eclipse.wst.sse.core.internal.provisional.IModelLifecycleListener;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;

public class WebResourceChangeHandler
  implements IResourceChangeListener, IDocumentListener, IModelLifecycleListener
{
  private static Hashtable instances = new Hashtable();
  private static final boolean SIGNAL_MODEL = false;
  
  public static WebResourceChangeHandler getInstance(IStructuredModel xmlModel, IWebResourceChangedListener changeListener)
  {
    WebResourceChangeHandler handler = null;
    synchronized (instances)
    {
      Enumeration values = instances.elements();
      while (values.hasMoreElements())
      {
        Object model = values.nextElement();
        if (model == xmlModel) {
          handler = (WebResourceChangeHandler)instances.get(model);
        }
      }
      if (handler == null)
      {
        handler = new WebResourceChangeHandler();
        instances.put(handler, xmlModel);
      }
    }
    handler.initialize();
    fchangeListener.add(changeListener);
    return handler;
  }
  
  public void documentAboutToBeChanged(DocumentEvent event) {}
  
  private class ModelIrritantThread
    implements Runnable
  {
    private ModelIrritantThread() {}
    
    public void run()
    {
      signalAllDirtyModel();
    }
    
    public void signalAllDirtyModel()
    {
      for (int i = 0; i < fchangeListener.size(); i++) {
        ((IWebResourceChangedListener)fchangeListener.get(i)).resourceChanged();
      }
    }
  }
  
  private ArrayList fchangeListener = new ArrayList();
  private ModelIrritantThread irritator;
  
  public void documentChanged(DocumentEvent event)
  {
    irritator.signalAllDirtyModel();
  }
  
  public boolean equals(Object o)
  {
    return ((o instanceof WebResourceChangeHandler)) && (fchangeListener == fchangeListener);
  }
  
  public void finalize()
  {
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
    if (instances == null) {
      return;
    }
    Object o = null;
    synchronized (instances)
    {
      o = instances.get(this);
      instances.remove(this);
    }
    if (o != null)
    {
      IStructuredModel fXMLModel = (IStructuredModel)o;
      IStructuredDocument fJspDocument = fXMLModel.getStructuredDocument();
      if (fJspDocument != null) {
        fJspDocument.removeDocumentListener(this);
      }
    }
  }
  
  private IStructuredModel getModel()
  {
    if (instances == null) {
      return null;
    }
    return (IStructuredModel)instances.get(this);
  }
  
  private void initialize()
  {
    IStructuredModel xmlModel = getModel();
    ResourcesPlugin.getWorkspace().addResourceChangeListener(this, 1);
    xmlModel.addModelLifecycleListener(this);
    IStructuredDocument fJspDocument = xmlModel.getStructuredDocument();
    if (fJspDocument != null) {
      fJspDocument.addDocumentListener(this);
    }
    irritator = new ModelIrritantThread(null);
  }
  
  public void processPostModelEvent(ModelLifecycleEvent event)
  {
    if (irritator != null) {
      irritator.signalAllDirtyModel();
    }
    if (instances == null) {
      return;
    }
    if (event.getType() == 2) {
      synchronized (instances)
      {
        instances.remove(this);
      }
    }
  }
  
  public void processPreModelEvent(ModelLifecycleEvent event) {}
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    FileBuffers.getTextFileBufferManager().execute(irritator);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.modelhandler.WebResourceChangeHandler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal.project;

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.jsdt.internal.core.util.Messages;
import org.eclipse.wst.jsdt.web.core.internal.Logger;

class ConvertJob
  extends WorkspaceJob
{
  static final String JSDT_FACET = "wst.jsdt.web";
  private IProject fProject;
  private boolean fInstall = true;
  private boolean fUseExplicitWorkingCopy = false;
  
  ConvertJob(IProject project, boolean install, boolean useExplicitWorkingCopy)
  {
    super(Messages.converter_ConfiguringForJavaScript);
    fProject = project;
    fInstall = install;
    fUseExplicitWorkingCopy = useExplicitWorkingCopy;
  }
  
  public IStatus runInWorkspace(IProgressMonitor monitor)
    throws CoreException
  {
    try
    {
      IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet("wst.jsdt.web");
      IFacetedProject facetedProject = ProjectFacetsManager.create(fProject);
      if ((facetedProject != null) && (fProject.isAccessible()))
      {
        if (fInstall)
        {
          IProjectFacetVersion latestVersion = projectFacet.getLatestVersion();
          facetedProject.installProjectFacet(latestVersion, null, monitor);
        }
        if (fUseExplicitWorkingCopy)
        {
          IFacetedProjectWorkingCopy copy = facetedProject.createWorkingCopy();
          Set fixed = new HashSet(facetedProject.getFixedProjectFacets());
          fixed.add(projectFacet);
          copy.setFixedProjectFacets(fixed);
          copy.commitChanges(new NullProgressMonitor());
        }
        else
        {
          Set fixed = new HashSet(facetedProject.getFixedProjectFacets());
          if (!fixed.contains(projectFacet))
          {
            fixed.add(projectFacet);
            facetedProject.setFixedProjectFacets(fixed);
          }
        }
      }
    }
    catch (IllegalArgumentException localIllegalArgumentException) {}catch (Exception e)
    {
      Logger.logException(e);
    }
    return Status.OK_STATUS;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.project.ConvertJob
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal.project;

import java.util.Arrays;
import java.util.Collection;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent.Type;
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
import org.eclipse.wst.common.project.facet.core.events.IProjectFacetActionEvent;

public class FacetedProjectListener
  implements IFacetedProjectListener
{
  static final Collection INTERESTING_FACETS = Arrays.asList(new Object[] { "wst.web", "jst.web" });
  
  public void handleEvent(IFacetedProjectEvent event)
  {
    if (event.getType() == IFacetedProjectEvent.Type.POST_INSTALL)
    {
      IProjectFacetActionEvent actionEvent = (IProjectFacetActionEvent)event;
      if (INTERESTING_FACETS.contains(actionEvent.getProjectFacet().getId())) {
        new ConvertJob(event.getProject().getProject(), true, true).schedule(1000L);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.core.internal.project.FacetedProjectListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.core.internal.project;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.common.project.facet.core.IDelegate;

public class JsNatureInstaller
  implements IDelegate
{
  /* Error */
  public void execute(IProject project, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
    throws CoreException
  {
    // Byte code:
    //   0: aload 4
    //   2: ifnonnull +12 -> 14
    //   5: new 21	org/eclipse/core/runtime/NullProgressMonitor
    //   8: dup
    //   9: invokespecial 23	org/eclipse/core/runtime/NullProgressMonitor:<init>	()V
    //   12: astore 4
    //   14: aload 4
    //   16: ldc 24
    //   18: bipush 100
    //   20: invokeinterface 26 3 0
    //   25: aload_1
    //   26: invokestatic 32	org/eclipse/wst/jsdt/web/core/internal/project/JsWebNature:hasNature	(Lorg/eclipse/core/resources/IProject;)Z
    //   29: ifne +25 -> 54
    //   32: aload_0
    //   33: aload_1
    //   34: aload 4
    //   36: invokevirtual 38	org/eclipse/wst/jsdt/web/core/internal/project/JsNatureInstaller:installNature	(Lorg/eclipse/core/resources/IProject;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   39: goto +15 -> 54
    //   42: astore 5
    //   44: aload 4
    //   46: invokeinterface 42 1 0
    //   51: aload 5
    //   53: athrow
    //   54: aload 4
    //   56: invokeinterface 42 1 0
    //   61: return
    // Line number table:
    //   Java source line #31	-> byte code offset #0
    //   Java source line #32	-> byte code offset #5
    //   Java source line #34	-> byte code offset #14
    //   Java source line #36	-> byte code offset #25
    //   Java source line #37	-> byte code offset #32
    //   Java source line #38	-> byte code offset #42
    //   Java source line #39	-> byte code offset #44
    //   Java source line #40	-> byte code offset #51
    //   Java source line #39	-> byte code offset #54
    //   Java source line #41	-> byte code offset #61
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	62	0	this	JsNatureInstaller
    //   0	62	1	project	IProject
    //   0	62	2	fv	org.eclipse.wst.common.project.facet.core.IProjectFacetVersion
    //   0	62	3	config	Object
    //   0	62	4	monitor	IProgressMonitor
    //   42	10	5	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   25	42	42	finally
  }
  
  public void installNature(IProject project, IProgressMonitor monitor)
    throws CoreException
  {
    monitor.beginTask(Messages.getString("JsNatureInstaller.1"), 100);
    monitor.subTask(Messages.getString("JsNatureInstaller.2"));
    try
    {
      monitor.worked(20);
      JsWebNature jsNature = new JsWebNature(project, monitor);
      monitor.wo
1 2 3 4 5 6 7 8 9

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