org.eclipse.pde.core_3.7.1.v20120103_r372

ory fFactory;
  
  public FileAdapter(FileAdapter parent, File file, IFileAdapterFactory factory)
  {
    fFile = file;
    fParent = parent;
    fFactory = factory;
  }
  
  public boolean isManifest()
  {
    String fileName = fFile.getName();
    return (fileName.equals("plugin.xml")) || (fileName.equals("fragment.xml")) || (fileName.equalsIgnoreCase("MANIFEST.MF"));
  }
  
  public boolean isSchema()
  {
    String fileName = fFile.getName().toLowerCase(Locale.ENGLISH);
    return fileName.endsWith(".exsd");
  }
  
  public FileAdapter getParent()
  {
    return fParent;
  }
  
  public void setEditorId(String editorId)
  {
    fEditorId = editorId;
  }
  
  public String getEditorId()
  {
    return fEditorId;
  }
  
  public File getFile()
  {
    return fFile;
  }
  
  public boolean isDirectory()
  {
    return fFile.isDirectory();
  }
  
  public boolean hasChildren()
  {
    if (!fFile.isDirectory()) {
      return false;
    }
    if (fChildren == null) {
      createChildren();
    }
    return fChildren.length > 0;
  }
  
  public Object[] getChildren()
  {
    if ((fFile.isDirectory()) && (fChildren == null)) {
      createChildren();
    }
    return fChildren != null ? fChildren : new Object[0];
  }
  
  private void createChildren()
  {
    File[] files = fFile.listFiles();
    fChildren = new Object[files.length];
    for (int i = 0; i < files.length; i++) {
      if (fFactory == null) {
        fChildren[i] = new FileAdapter(this, files[i], null);
      } else {
        fChildren[i] = fFactory.createAdapterChild(this, files[i]);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.FileAdapter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import java.util.Locale;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;

public abstract interface ICoreConstants
{
  public static final String PLATFORM_PATH = "platform_path";
  public static final String SAVED_PLATFORM = "saved_platform";
  public static final String TARGET_MODE = "target_mode";
  public static final String VALUE_USE_THIS = "useThis";
  public static final String VALUE_USE_OTHER = "useOther";
  public static final String CHECKED_PLUGINS = "checkedPlugins";
  public static final String VALUE_SAVED_NONE = "[savedNone]";
  public static final String VALUE_SAVED_ALL = "[savedAll]";
  public static final String VALUE_SAVED_SOME = "savedSome";
  public static final String P_SOURCE_LOCATIONS = "source_locations";
  public static final String P_EXT_LOCATIONS = "ext_locations";
  public static final String PROGRAM_ARGS = "program_args";
  public static final String VM_ARGS = "vm_args";
  public static final String VM_LAUNCHER_INI = "vm_launcher_ini";
  public static final String IMPLICIT_DEPENDENCIES = "implicit_dependencies";
  public static final String GROUP_PLUGINS_VIEW = "group_plugins";
  public static final String ADDITIONAL_LOCATIONS = "additional_locations";
  public static final String TARGET_PLATFORM_REALIZATION = "target_platform_realization";
  /**
   * @deprecated
   */
  public static final String POOLED_BUNDLES = "pooled_bundles";
  public static final String POOLED_URLS = "pooled_urls";
  public static final String EXTERNAL_FEATURES = "external_features";
  public static final String CHECKED_VERSION_PLUGINS = "checkedVersionPlugins";
  public static final String OS = "org.eclipse.pde.ui.os";
  public static final String WS = "org.eclipse.pde.ui.ws";
  public static final String NL = "org.eclipse.pde.ui.nl";
  public static final String ARCH = "org.eclipse.pde.ui.arch";
  public static final String OS_EXTRA = "org.eclipse.pde.os.extra";
  public static final String WS_EXTRA = "org.eclipse.pde.ws.extra";
  public static final String NL_EXTRA = "org.eclipse.pde.nl.extra";
  public static final String ARCH_EXTRA = "org.eclipse.pde.arch.extra";
  public static final String TARGET_JRE = "targetJRE";
  public static final String EXTENSION_NAME = "extension";
  public static final String PLUGIN_FILENAME_DESCRIPTOR = "plugin.xml";
  public static final String FEATURE_FILENAME_DESCRIPTOR = "feature.xml";
  public static final String FRAGMENT_FILENAME_DESCRIPTOR = "fragment.xml";
  public static final String BUNDLE_FILENAME_DESCRIPTOR = "META-INF/MANIFEST.MF";
  public static final String MANIFEST_FILENAME = "MANIFEST.MF";
  public static final String OPTIONS_FILENAME = ".options";
  public static final String MANIFEST_FILENAME_LOWER_CASE = "MANIFEST.MF".toLowerCase(Locale.ENGLISH);
  public static final String BUILD_FILENAME_DESCRIPTOR = "build.properties";
  public static final String TARGET30 = "3.0";
  public static final String TARGET31 = "3.1";
  public static final String TARGET32 = "3.2";
  public static final String TARGET33 = "3.3";
  public static final String TARGET34 = "3.4";
  public static final String TARGET35 = "3.5";
  public static final String TARGET36 = "3.6";
  public static final String TARGET37 = "3.7";
  public static final String EQUINOX = "Equinox";
  public static final String SELFHOSTING_BIN_EXCLUDES = "selfhosting.binExcludes";
  public static final String EQUINOX_PROPERTY = "pluginProject.equinox";
  public static final String EXTENSIONS_PROPERTY = "pluginProject.extensions";
  public static final String RESOLVE_WITH_REQUIRE_BUNDLE = "resolve.requirebundle";
  public static final String TARGET_PROFILE = "target.profile";
  public static final String MANIFEST_LAUNCH_SHORTCUTS = "manifest.launchShortcuts";
  public static final String MANIFEST_EXPORT_WIZARD = "manifest.exportWizard";
  public static final String PROVIDE_PACKAGE = "Provide-Package";
  public static final String REPROVIDE_ATTRIBUTE = "reprovide";
  public static final String OPTIONAL_ATTRIBUTE = "optional";
  public static final String REQUIRE_PACKAGES_ATTRIBUTE = "require-packages";
  public static final String SINGLETON_ATTRIBUTE = "singleton";
  public static final String PACKAGE_SPECIFICATION_VERSION = "specification-version";
  public static final String IMPORT_SERVICE = "Import-Service";
  public static final String EXPORT_SERVICE = "Export-Service";
  public static final String EXTENSIBLE_API = "Eclipse-ExtensibleAPI";
  public static final String PATCH_FRAGMENT = "Eclipse-PatchFragment";
  public static final String PLUGIN_CLASS = "Plugin-Class";
  public static final String ECLIPSE_AUTOSTART = "Eclipse-AutoStart";
  public static final String ECLIPSE_LAZYSTART = "Eclipse-LazyStart";
  public static final String ECLIPSE_JREBUNDLE = "Eclipse-JREBundle";
  public static final String ECLIPSE_BUDDY_POLICY = "Eclipse-BuddyPolicy";
  public static final String ECLIPSE_REGISTER_BUDDY = "Eclipse-RegisterBuddy";
  public static final String ECLIPSE_GENERIC_CAPABILITY = "Eclipse-GenericCapabilty";
  public static final String ECLIPSE_GENERIC_REQUIRED = "Eclipse-GenericRequire";
  public static final String PLATFORM_FILTER = "Eclipse-PlatformFilter";
  public static final String ECLIPSE_SOURCE_BUNDLE = "Eclipse-SourceBundle";
  public static final String ECLIPSE_SYSTEM_BUNDLE = "Eclipse-SystemBundle";
  public static final String ECLIPSE_BUNDLE_SHAPE = "Eclipse-BundleShape";
  public static final String ECLIPSE_SOURCE_REFERENCES = "Eclipse-SourceReferences";
  public static final String SERVICE_COMPONENT = "Service-Component";
  public static final String OSGI_SYSTEM_BUNDLE = "osgi.system.bundle";
  public static final String OSGI_OS = "osgi.os";
  public static final String OSGI_WS = "osgi.ws";
  public static final String OSGI_NL = "osgi.nl";
  public static final String OSGI_ARCH = "osgi.arch";
  public static final String OSGI_RESOLVE_OPTIONAL = "osgi.resolveOptional";
  public static final String OSGI_RESOLVER_MODE = "osgi.resolverMode";
  public static final String INTERNAL_DIRECTIVE = "x-internal";
  public static final String FRIENDS_DIRECTIVE = "x-friends";
  public static final String SHAPE_JAR = "jar";
  public static final String SHAPE_DIR = "dir";
  public static final String[] SHAPE_VALUES = { "dir", "jar" };
  public static final String[] TRANSLATABLE_HEADERS = { "Bundle-Vendor", "Bundle-Name", "Bundle-Description", "Bundle-Copyright", "Bundle-Category", "Bundle-ContactAddress" };
  public static final String[] EE_TOKENS = { "wassim", "zx", "bbauman", "cherie", "jlb", "cwindatt" };
  public static final String MANIFEST_FOLDER_NAME = "META-INF/";
  public static final String OSGI_INF_FOLDER_NAME = "OSGI-INF/";
  public static final String FEATURE_FOLDER_NAME = "features";
  public static final IPath MANIFEST_PATH = new Path("META-INF/MANIFEST.MF");
  public static final IPath PLUGIN_PATH = new Path("plugin.xml");
  public static final IPath FRAGMENT_PATH = new Path("fragment.xml");
  public static final IPath FEATURE_PATH = new Path("feature.xml");
  public static final IPath BUILD_PROPERTIES_PATH = new Path("build.properties");
  public static final IPath OSGI_INF_PATH = new Path("OSGI-INF/");
  public static final String EXTENSION_POINT_SOURCE = "org.eclipse.pde.core.source";
  public static final String EXTENSION_POINT_BUNDLE_IMPORTERS = "org.eclipse.pde.core.bundleImporters";
  public static final String TARGET_FILE_EXTENSION = "target";
  public static final String WORKSPACE_TARGET_HANDLE = "workspace_target_handle";
  public static final String NO_TARGET = "NO_TARGET";
  public static final String UTF_8 = "UTF-8";
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.ICoreConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import org.eclipse.pde.core.plugin.IPluginModelBase;

public abstract interface IExtensionDeltaEvent
{
  public static final int MODELS_ADDED = 1;
  public static final int MODELS_REMOVED = 2;
  public static final int MODELS_CHANGED = 4;
  
  public abstract IPluginModelBase[] getAddedModels();
  
  public abstract IPluginModelBase[] getChangedModels();
  
  public abstract IPluginModelBase[] getRemovedModels();
  
  public abstract int getEventTypes();
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IExtensionDeltaEvent
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

public abstract interface IExtensionDeltaListener
{
  public abstract void extensionsChanged(IExtensionDeltaEvent paramIExtensionDeltaEvent);
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IExtensionDeltaListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import org.eclipse.pde.internal.core.ifeature.IFeatureModel;

public abstract interface IFeatureModelDelta
{
  public static final int ADDED = 1;
  public static final int REMOVED = 2;
  public static final int CHANGED = 4;
  
  public abstract int getKind();
  
  public abstract IFeatureModel[] getAdded();
  
  public abstract IFeatureModel[] getRemoved();
  
  public abstract IFeatureModel[] getChanged();
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IFeatureModelDelta
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

public abstract interface IFeatureModelListener
{
  public abstract void modelsChanged(IFeatureModelDelta paramIFeatureModelDelta);
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IFeatureModelListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import java.io.File;

public abstract interface IFileAdapterFactory
{
  public abstract Object createAdapterChild(FileAdapter paramFileAdapter, File paramFile);
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IFileAdapterFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import org.eclipse.pde.core.IModelChangeProvider;

public abstract interface IModelChangeProviderExtension
  extends IModelChangeProvider
{
  public abstract void transferListenersTo(IModelChangeProviderExtension paramIModelChangeProviderExtension, IModelChangedListenerFilter paramIModelChangedListenerFilter);
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IModelChangeProviderExtension
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import org.eclipse.pde.core.IModelChangedListener;

public abstract interface IModelChangedListenerFilter
{
  public abstract boolean accept(IModelChangedListener paramIModelChangedListener);
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IModelChangedListenerFilter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

public abstract interface IPluginModelListener
{
  public abstract void modelsChanged(PluginModelDelta paramPluginModelDelta);
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IPluginModelListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.StateDelta;

public abstract interface IStateDeltaListener
{
  public abstract void stateResolved(StateDelta paramStateDelta);
  
  public abstract void stateChanged(State paramState);
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IStateDeltaListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import org.eclipse.pde.core.IEditableModel;

public abstract interface IWorkspaceModel
  extends IEditableModel
{
  public abstract void reload();
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.IWorkspaceModel
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import java.io.File;
import java.util.Enumeration;
import java.util.Properties;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IElementChangedListener;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaElementDelta;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.PluginRegistry;
import org.eclipse.pde.internal.core.project.PDEProject;

public class JavaElementChangeListener
  implements IElementChangedListener
{
  private static final String FILENAME = "clean-cache.properties";
  private Properties fTable = new Properties();
  
  public void start()
  {
    JavaCore.addElementChangedListener(this, 1);
    load();
  }
  
  public void elementChanged(ElementChangedEvent event)
  {
    handleDelta(event.getDelta());
  }
  
  public void shutdown()
  {
    JavaCore.removeElementChangedListener(this);
    save();
  }
  
  private void handleDelta(IJavaElementDelta delta)
  {
    IJavaElement element = delta.getElement();
    if ((element instanceof IJavaModel)) {
      handleChildDeltas(delta);
    } else if ((element instanceof IJavaProject))
    {
      if (isInterestingProject((IJavaProject)element)) {
        if (delta.getKind() == 4) {
          handleChildDeltas(delta);
        } else if (delta.getKind() == 1) {
          updateTable(element);
        }
      }
    }
    else if ((element instanceof IPackageFragmentRoot)) {
      handleChildDeltas(delta);
    }
  }
  
  private void handleChildDeltas(IJavaElementDelta delta)
  {
    IJavaElementDelta[] deltas = delta.getAffectedChildren();
    for (int i = 0; i < deltas.length; i++) {
      if (!ignoreDelta(deltas[i]))
      {
        if (isInterestingDelta(deltas[i]))
        {
          updateTable(deltas[i].getElement());
          break;
        }
        handleDelta(deltas[i]);
      }
    }
  }
  
  private boolean isInterestingDelta(IJavaElementDelta delta)
  {
    int kind = delta.getKind();
    boolean interestingKind = (kind == 1) || (kind == 2);
    
    IJavaElement element = delta.getElement();
    boolean interestingElement = ((element instanceof IPackageFragment)) || ((element instanceof IPackageFragmentRoot));
    if ((interestingElement) && (interestingKind)) {
      return true;
    }
    if ((kind == 4) && ((element instanceof IPackageFragmentRoot)))
    {
      IPackageFragmentRoot root = (IPackageFragmentRoot)element;
      return root.isArchive();
    }
    return false;
  }
  
  private boolean ignoreDelta(IJavaElementDelta delta)
  {
    try
    {
      IJavaElement element = delta.getElement();
      if ((element instanceof IPackageFragmentRoot))
      {
        IPackageFragmentRoot root = (IPackageFragmentRoot)element;
        IClasspathEntry entry = root.getRawClasspathEntry();
        if ((entry != null) && (entry.getEntryKind() == 5)) {
          return true;
        }
      }
    }
    catch (JavaModelException localJavaModelException) {}
    return false;
  }
  
  private boolean isInterestingProject(IJavaProject jProject)
  {
    IProject project = jProject.getProject();
    return (WorkspaceModelManager.isPluginProject(project)) && (!WorkspaceModelManager.isBinaryProject(project)) && (!PDEProject.getManifest(project).exists());
  }
  
  private void updateTable(IJavaElement element)
  {
    IJavaProject jProject = (IJavaProject)element.getAncestor(2);
    if (jProject != null)
    {
      IProject project = jProject.getProject();
      IPluginModelBase model = PluginRegistry.findModel(project);
      if (model != null)
      {
        String id = model.getPluginBase().getId();
        if (id != null) {
          fTable.put(id, Long.toString(System.currentTimeMillis()));
        }
      }
    }
  }
  
  /* Error */
  private void save()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 277	org/eclipse/pde/internal/core/JavaElementChangeListener:fTable	Ljava/util/Properties;
    //   4: invokevirtual 302	java/util/Properties:keys	()Ljava/util/Enumeration;
    //   7: astore_1
    //   8: goto +40 -> 48
    //   11: aload_1
    //   12: invokeinterface 328 1 0
    //   17: invokevirtual 294	java/lang/Object:toString	()Ljava/lang/String;
    //   20: astore_2
    //   21: aload_2
    //   22: invokestatic 310	org/eclipse/pde/core/plugin/PluginRegistry:findModel	(Ljava/lang/String;)Lorg/eclipse/pde/core/plugin/IPluginModelBase;
    //   25: astore_3
    //   26: aload_3
    //   27: ifnull +12 -> 39
    //   30: aload_3
    //   31: invokeinterface 342 1 0
    //   36: ifnonnull +12 -> 48
    //   39: aload_0
    //   40: getfield 277	org/eclipse/pde/internal/core/JavaElementChangeListener:fTable	Ljava/util/Properties;
    //   43: aload_2
    //   44: invokevirtual 304	java/util/Properties:remove	(Ljava/lang/Object;)Ljava/lang/Object;
    //   47: pop
    //   48: aload_1
    //   49: invokeinterface 327 1 0
    //   54: ifne -43 -> 11
    //   57: aconst_null
    //   58: astore_2
    //   59: new 131	java/io/FileOutputStream
    //   62: dup
    //   63: new 129	java/io/File
    //   66: dup
    //   67: aload_0
    //   68: invokespecial 314	org/eclipse/pde/internal/core/JavaElementChangeListener:getDirectory	()Ljava/io/File;
    //   71: ldc 2
    //   73: invokespecial 285	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   76: invokespecial 290	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   79: astore_2
    //   80: aload_0
    //   81: getfield 277	org/eclipse/pde/internal/core/JavaElementChangeListener:fTable	Ljava/util/Properties;
    //   84: aload_2
    //   85: ldc 1
    //   87: invokevirtual 305	java/util/Properties:store	(Ljava/io/OutputStream;Ljava/lang/String;)V
    //   90: aload_2
    //   91: invokevirtual 289	java/io/FileOutputStream:flush	()V
    //   94: goto +40 -> 134
    //   97: astore_3
    //   98: aload_3
    //   99: invokestatic 321	org/eclipse/pde/internal/core/PDECore:logException	(Ljava/lang/Throwable;)V
    //   102: aload_2
    //   103: ifnull +43 -> 146
    //   106: aload_2
    //   107: invokevirtual 288	java/io/FileOutputStream:close	()V
    //   110: goto +36 -> 146
    //   113: pop
    //   114: goto +32 -> 146
    //   117: astore 4
    //   119: aload_2
    //   120: ifnull +11 -> 131
    //   123: aload_2
    //   124: invokevirtual 288	java/io/FileOutputStream:close	()V
    //   127: goto +4 -> 131
    //   130: pop
    //   131: aload 4
    //   133: athrow
    //   134: aload_2
    //   135: ifnull +11 -> 146
    //   138: aload_2
    //   139: invokevirtual 288	java/io/FileOutputStream:close	()V
    //   142: goto +4 -> 146
    //   145: pop
    //   146: return
    // Line number table:
    //   Java source line #128	-> byte code offset #0
    //   Java source line #129	-> byte code offset #8
    //   Java source line #130	-> byte code offset #11
    //   Java source line #131	-> byte code offset #21
    //   Java source line #132	-> byte code offset #26
    //   Java source line #133	-> byte code offset #39
    //   Java source line #129	-> byte code offset #48
    //   Java source line #136	-> byte code offset #57
    //   Java source line #138	-> byte code offset #59
    //   Java source line #139	-> byte code offset #80
    //   Java source line #140	-> byte code offset #90
    //   Java source line #141	-> byte code offset #97
    //   Java source line #142	-> byte code offset #98
    //   Java source line #145	-> byte code offset #102
    //   Java source line #146	-> byte code offset #106
    //   Java source line #147	-> byte code offset #113
    //   Java source line #143	-> byte code offset #117
    //   Java source line #145	-> byte code offset #119
    //   Java source line #146	-> byte code offset #123
    //   Java source line #147	-> byte code offset #130
    //   Java source line #149	-> byte code offset #131
    //   Java source line #145	-> byte code offset #134
    //   Java source line #146	-> byte code offset #138
    //   Java source line #147	-> byte code offset #145
    //   Java source line #150	-> byte code offset #146
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	147	0	this	JavaElementChangeListener
    //   7	42	1	keys	Enumeration
    //   20	24	2	id	String
    //   58	81	2	stream	java.io.FileOutputStream
    //   25	6	3	model	IPluginModelBase
    //   97	2	3	e	java.io.IOException
    //   117	15	4	localObject	Object
    //   113	1	7	localIOException1	java.io.IOException
    //   130	1	8	localIOException2	java.io.IOException
    //   145	1	9	localIOException3	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   59	94	97	java/io/IOException
    //   102	110	113	java/io/IOException
    //   59	102	117	finally
    //   119	127	130	java/io/IOException
    //   134	142	145	java/io/IOException
  }
  
  private File getDirectory()
  {
    IPath path = PDECore.getDefault().getStateLocation().append(".cache");
    File directory = new File(path.toOSString());
    if ((!directory.exists()) || (!directory.isDirectory())) {
      directory.mkdirs();
    }
    return directory;
  }
  
  /* Error */
  private void load()
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_1
    //   2: new 129	java/io/File
    //   5: dup
    //   6: aload_0
    //   7: invokespecial 314	org/eclipse/pde/internal/core/JavaElementChangeListener:getDirectory	()Ljava/io/File;
    //   10: ldc 2
    //   12: invokespecial 285	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   15: astore_2
    //   16: aload_2
    //   17: invokevirtual 280	java/io/File:exists	()Z
    //   20: ifeq +61 -> 81
    //   23: aload_2
    //   24: invokevirtual 282	java/io/File:isFile	()Z
    //   27: ifeq +54 -> 81
    //   30: new 130	java/io/FileInputStream
    //   33: dup
    //   34: aload_2
    //   35: invokespecial 287	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   38: astore_1
    //   39: aload_0
    //   40: getfield 277	org/eclipse/pde/internal/core/JavaElementChangeListener:fTable	Ljava/util/Properties;
    //   43: aload_1
    //   44: invokevirtual 301	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   47: goto +34 -> 81
    //   50: pop
    //   51: aload_1
    //   52: ifnull +41 -> 93
    //   55: aload_1
    //   56: invokevirtual 286	java/io/FileInputStream:close	()V
    //   59: goto +34 -> 93
    //   62: pop
    //   63: goto +30 -> 93
    //   66: astore_3
    //   67: aload_1
    //   68: ifnull +11 -> 79
    //   71: aload_1
    //   72: invokevirtual 286	java/io/FileInputStream:close	()V
    //   75: goto +4 -> 79
    //   78: pop
    //   79: aload_3
    //   80: athrow
    //   81: aload_1
    //   82: ifnull +11 -> 93
    //   85: aload_1
    //   86: invokevirtual 286	java/io/FileInputStream:close	()V
    //   89: goto +4 -> 93
    //   92: pop
    //   93: return
    // Line number table:
    //   Java source line #161	-> byte code offset #0
    //   Java source line #163	-> byte code offset #2
    //   Java source line #164	-> byte code offset #16
    //   Java source line #165	-> byte code offset #30
    //   Java source line #166	-> byte code offset #39
    //   Java source line #168	-> byte code offset #50
    //   Java source line #171	-> byte code offset #51
    //   Java source line #172	-> byte code offset #55
    //   Java source line #174	-> byte code offset #62
    //   Java source line #169	-> byte code offset #66
    //   Java source line #171	-> byte code offset #67
    //   Java source line #172	-> byte code offset #71
    //   Java source line #174	-> byte code offset #78
    //   Java source line #176	-> byte code offset #79
    //   Java source line #171	-> byte code offset #81
    //   Java source line #172	-> byte code offset #85
    //   Java source line #174	-> byte code offset #92
    //   Java source line #177	-> byte code offset #93
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	94	0	this	JavaElementChangeListener
    //   1	85	1	is	java.io.FileInputStream
    //   15	20	2	file	File
    //   66	14	3	localObject	Object
    //   50	1	4	localIOException1	java.io.IOException
    //   62	1	5	localIOException2	java.io.IOException
    //   78	1	6	localIOException3	java.io.IOException
    //   92	1	7	localIOException4	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   2	47	50	java/io/IOException
    //   51	59	62	java/io/IOException
    //   2	51	66	finally
    //   67	75	78	java/io/IOException
    //   81	89	92	java/io/IOException
  }
  
  public void synchronizeManifests(File cacheDirectory)
  {
    Enumeration keys = fTable.keys();
    while (keys.hasMoreElements())
    {
      String id = keys.nextElement().toString();
      IPluginModelBase model = PluginRegistry.findModel(id);
      if (model != null)
      {
        File file = new File(cacheDirectory, id + "_" + model.getPluginBase().getVersion() + ".MF");
        if ((file.exists()) && (file.isFile()) && (file.lastModified() < Long.parseLong(fTable.get(id).toString()))) {
          file.delete();
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.JavaElementChangeListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.HostSpecification;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.PluginRegistry;
import org.eclipse.pde.internal.core.util.CoreUtility;

public class JavadocLocationManager
{
  public static final String JAVADOC_ID = "org.eclipse.pde.core.javadoc";
  private HashMap fLocations;
  
  public String getJavadocLocation(IPluginModelBase model)
  {
    File file = new File(model.getInstallLocation());
    if (file.isDirectory())
    {
      File doc = new File(file, "doc");
      if (new File(doc, "package-list").exists()) {
        return "file:/" + doc.getAbsolutePath();
      }
    }
    else if (CoreUtility.jarContainsResource(file, "doc/package-list", false))
    {
      return "jar:file:/" + file.getAbsolutePath() + "!/doc";
    }
    return getEntry(model);
  }
  
  private synchronized String getEntry(IPluginModelBase model)
  {
    initialize();
    BundleDescription desc = model.getBundleDescription();
    if (desc != null)
    {
      HostSpecification host = desc.getHost();
      String id = host == null ? desc.getSymbolicName() : host.getName();
      if (id != null)
      {
        Iterator iter = fLocations.keySet().iterator();
        while (iter.hasNext())
        {
          String location = iter.next().toString();
          Set set = (Set)fLocations.get(location);
          if (set.contains(id)) {
            return location;
          }
        }
      }
    }
    return null;
  }
  
  private synchronized void initialize()
  {
    if (fLocations != null) {
      return;
    }
    fLocations = new HashMap();
    
    IExtension[] extensions = PDECore.getDefault().getExtensionsRegistry().findExtensions("org.eclipse.pde.core.javadoc", false);
    for (int i = 0; i < extensions.length; i++)
    {
      IPluginModelBase base = PluginRegistry.findModel(extensions[i].getContributor().getName());
      if ((base != null) && (base.getUnderlyingResource() == null)) {
        processExtension(extensions[i], base);
      }
    }
  }
  
  private void processExtension(IExtension extension, IPluginModelBase base)
  {
    IConfigurationElement[] children = extension.getConfigurationElements();
    for (int i = 0; i < children.length; i++) {
      if (children[i].getName().equals("javadoc"))
      {
        String path = children[i].getAttribute("path");
        if (path != null) {
          try
          {
            new URL(path);
            processPlugins(path, children[i].getChildren());
          }
          catch (MalformedURLException localMalformedURLException1)
          {
            String attr = children[i].getAttribute("archive");
            boolean archive = attr == null ? false : "true".equals(attr);
            
            IPath modelPath = new Path(base.getInstallLocation());
            StringBuffer buffer = new StringBuffer();
            File file = modelPath.toFile();
            if (file.exists())
            {
              try
              {
                buffer.append(file.toURI().toURL());
              }
              catch (MalformedURLException localMalformedURLException2)
              {
                buffer.append("file:/");
                buffer.append(modelPath.toPortableString());
              }
              if (file.isFile())
              {
                buffer.append("!/");
                archive = true;
              }
            }
            buffer.append(path);
            if (archive)
            {
              buffer.insert(0, "jar:");
              if (buffer.indexOf("!") == -1) {
                buffer.append("!/");
              }
            }
            processPlugins(buffer.toString(), children[i].getChildren());
          }
        }
      }
    }
  }
  
  private void processPlugins(String path, IConfigurationElement[] plugins)
  {
    for (int i = 0; i < plugins.length; i++) {
      if (plugins[i].getName().equals("plugin"))
      {
        String id = plugins[i].getAttribute("id");
        if (id != null)
        {
          Set set = (Set)fLocations.get(path);
          if (set == null)
          {
            set = new HashSet();
            fLocations.put(path, set);
          }
          set.add(id);
        }
      }
    }
  }
  
  public synchronized void reset()
  {
    fLocations = null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.JavadocLocationManager
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.service.pluginconversion.PluginConversionException;
import org.eclipse.osgi.service.pluginconversion.PluginConverter;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.BundleSpecification;
import org.eclipse.osgi.service.resolver.HostSpecification;
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
import org.eclipse.osgi.service.resolver.PlatformAdmin;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.StateDelta;
import org.eclipse.osgi.service.resolver.StateHelper;
import org.eclipse.osgi.service.resolver.StateObjectFactory;
import org.eclipse.osgi.service.resolver.VersionConstraint;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.osgi.util.ManifestElement;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.internal.core.util.Headers;
import org.osgi.framework.BundleException;
import org.osgi.util.tracker.ServiceTracker;

public class MinimalState
{
  private PluginConverter fConverter = null;
  private boolean fEEListChanged = false;
  protected static boolean DEBUG = false;
  protected String fSystemBundle = "org.eclipse.osgi";
  
  static
  {
    DEBUG = (PDECore.getDefault().isDebugging()) && ("true".equals(Platform.getDebugOption("org.eclipse.pde.core/cache")));
    DIR = PDECore.getDefault().getStateLocation().toOSString();
  }
  
  protected static StateObjectFactory stateObjectFactory = Platform.getPlatformAdmin().getFactory();
  protected State fState;
  protected long fId;
  private String[] fExecutionEnvironments;
  private boolean fNoProfile;
  protected static String DIR;
  
  protected MinimalState(MinimalState state)
  {
    fState = stateObjectFactory.createState(fState);
    fState.setPlatformProperties(fState.getPlatformProperties());
    fState.setResolver(Platform.getPlatformAdmin().createResolver());
    fId = fId;
    fEEListChanged = fEEListChanged;
    fExecutionEnvironments = fExecutionEnvironments;
    fNoProfile = fNoProfile;
    fSystemBundle = fSystemBundle;
  }
  
  protected MinimalState() {}
  
  public void addBundle(IPluginModelBase model, boolean update)
  {
    if (model == null) {
      return;
    }
    BundleDescription desc = model.getBundleDescription();
    long bundleId = (desc == null) || (!update) ? -1L : desc.getBundleId();
    try
    {
      BundleDescription newDesc = addBundle(new File(model.getInstallLocation()), bundleId);
      model.setBundleDescription(newDesc);
      if ((newDesc == null) && (update)) {
        fState.removeBundle(desc);
      }
    }
    catch (IOException localIOException) {}catch (PluginConversionException localPluginConversionException) {}catch (CoreException e)
    {
      PDECore.log(e);
    }
  }
  
  public BundleDescription addBundle(IPluginModelBase model, long bundleId)
  {
    try
    {
      return addBundle(new File(model.getInstallLocation()), -1L);
    }
    catch (IOException localIOException) {}catch (PluginConversionException localPluginConversionException) {}catch (CoreException localCoreException) {}
    return null;
  }
  
  public BundleDescription addBundle(Dictionary manifest, File bundleLocation, long bundleId)
  {
    try
    {
      BundleDescription descriptor = stateObjectFactory.createBundleDescription(fState, manifest, bundleLocation.getAbsolutePath(), bundleId == -1L ? getNextId() : bundleId);
      if (bundleId == -1L) {
        fState.addBundle(descriptor);
      } else if (!fState.updateBundle(descriptor)) {
        fState.addBundle(descriptor);
      }
      return descriptor;
    }
    catch (BundleException localBundleException) {}catch (NumberFormatException localNumberFormatException) {}catch (IllegalArgumentException localIllegalArgumentException) {}
    return null;
  }
  
  public BundleDescription addBundle(File bundleLocation, long bundleId)
    throws PluginConversionException, CoreException, IOException
  {
    Dictionary manifest = loadManifest(bundleLocation);
    
    TargetWeaver.weaveManifest(manifest);
    boolean hasBundleStructure = (manifest != null) && (manifest.get("Bundle-SymbolicName") != null);
    if (!hasBundleStructure)
    {
      if ((!bundleLocation.isFile()) && (!new File(bundleLocation, "plugin.xml").exists()) && (!new File(bundleLocation, "fragment.xml").exists())) {
        return null;
      }
      PluginConverter converter = acquirePluginConverter();
      manifest = converter.convertManifest(bundleLocation, false, null, false, null);
      if ((manifest == null) || (manifest.get("Bundle-SymbolicName") == null)) {
        throw new CoreException(new Status(4, "org.eclipse.pde.core", 4, "Error parsing plug-in manifest file at " + bundleLocation.toString(), null));
      }
    }
    BundleDescription desc = addBundle(manifest, bundleLocation, bundleId);
    if ((desc != null) && ("true".equals(manifest.get("Eclipse-SystemBundle"))))
    {
      fEEListChanged = true;
      fSystemBundle = desc.getSymbolicName();
    }
    if (desc != null) {
      addAuxiliaryData(desc, manifest, hasBundleStructure);
    }
    return desc;
  }
  
  protected void addAuxiliaryData(BundleDescription desc, Dictionary manifest, boolean hasBundleStructure) {}
  
  protected void saveState(File dir)
  {
    saveState(fState, dir);
  }
  
  protected void saveState(State state, File dir)
  {
    try
    {
      if (!dir.exists()) {
        dir.mkdirs();
      }
      stateObjectFactory.writeState(state, dir);
    }
    catch (FileNotFoundException e)
    {
      PDECore.log(e);
    }
    catch (IOException e)
    {
      PDECore.log(e);
    }
  }
  
  public static Dictionary loadManifest(File bundleLocation)
    throws IOException
  {
    ZipFile jarFile = null;
    InputStream manifestStream = null;
    File file;
    try
    {
      extension = new Path(bundleLocation.getName()).getFileExtension();
      if ((extension != null) && (bundleLocation.isFile()))
      {
        jarFile = new ZipFile(bundleLocation, 1);
        ZipEntry manifestEntry = jarFile.getEntry("META-INF/MANIFEST.MF");
        if (manifestEntry != null) {
          manifestStream = jarFile.getInputStream(manifestEntry);
        }
      }
      else
      {
        file = new File(bundleLocation, "META-INF/MANIFEST.MF");
        if (file.exists()) {
          manifestStream = new FileInputStream(file);
        }
      }
    }
    catch (IOException localIOException1) {}
    if (manifestStream == null) {
      return null;
    }
    try
    {
      return (Dictionary)ManifestElement.parseBundleManifest(manifestStream, new Headers(10));
    }
    catch (BundleException localBundleException) {}finally
    {
     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

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-2019. Infinite Loop Ltd