org.eclipse.pde.core_3.7.1.v20120103_r372

ose	()V
    //   132: goto +40 -> 172
    //   135: astore 5
    //   137: aload_3
    //   138: ifnull +7 -> 145
    //   141: aload_3
    //   142: invokevirtual 171	java/io/BufferedInputStream:close	()V
    //   145: aload 5
    //   147: athrow
    //   148: aload_3
    //   149: ifnull +23 -> 172
    //   152: aload_3
    //   153: invokevirtual 171	java/io/BufferedInputStream:close	()V
    //   156: goto +16 -> 172
    //   159: astore_0
    //   160: aload_0
    //   161: invokestatic 192	org/eclipse/pde/internal/core/PDECore:log	(Ljava/lang/Throwable;)V
    //   164: goto +8 -> 172
    //   167: astore_0
    //   168: aload_0
    //   169: invokestatic 192	org/eclipse/pde/internal/core/PDECore:log	(Ljava/lang/Throwable;)V
    //   172: getstatic 170	org/eclipse/pde/internal/core/TargetWeaver:fgDevProperties	Ljava/util/Properties;
    //   175: areturn
    //   176: aconst_null
    //   177: areturn
    // Line number table:
    //   Java source line #62	-> byte code offset #0
    //   Java source line #63	-> byte code offset #6
    //   Java source line #64	-> byte code offset #12
    //   Java source line #65	-> byte code offset #22
    //   Java source line #67	-> byte code offset #28
    //   Java source line #68	-> byte code offset #39
    //   Java source line #69	-> byte code offset #44
    //   Java source line #70	-> byte code offset #55
    //   Java source line #71	-> byte code offset #64
    //   Java source line #72	-> byte code offset #71
    //   Java source line #74	-> byte code offset #73
    //   Java source line #75	-> byte code offset #89
    //   Java source line #76	-> byte code offset #99
    //   Java source line #77	-> byte code offset #101
    //   Java source line #81	-> byte code offset #106
    //   Java source line #82	-> byte code offset #110
    //   Java source line #78	-> byte code offset #117
    //   Java source line #79	-> byte code offset #119
    //   Java source line #81	-> byte code offset #124
    //   Java source line #82	-> byte code offset #128
    //   Java source line #80	-> byte code offset #135
    //   Java source line #81	-> byte code offset #137
    //   Java source line #82	-> byte code offset #141
    //   Java source line #83	-> byte code offset #145
    //   Java source line #81	-> byte code offset #148
    //   Java source line #82	-> byte code offset #152
    //   Java source line #83	-> byte code offset #156
    //   Java source line #86	-> byte code offset #159
    //   Java source line #87	-> byte code offset #160
    //   Java source line #88	-> byte code offset #167
    //   Java source line #89	-> byte code offset #168
    //   Java source line #93	-> byte code offset #172
    //   Java source line #95	-> byte code offset #176
    // Local variable table:
    //   start	length	slot	name	signature
    //   38	2	0	url	java.net.URL
    //   159	2	0	e	java.net.MalformedURLException
    //   167	2	0	e	java.io.IOException
    //   43	17	1	path	String
    //   63	19	2	file	File
    //   72	81	3	stream	java.io.BufferedInputStream
    //   99	3	4	e	java.io.FileNotFoundException
    //   117	3	4	e	java.io.IOException
    //   135	11	5	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   73	96	99	java/io/FileNotFoundException
    //   73	96	117	java/io/IOException
    //   73	106	135	finally
    //   117	124	135	finally
    //   28	156	159	java/net/MalformedURLException
    //   28	156	167	java/io/IOException
  }
  
  public static void weaveManifest(Dictionary manifest)
  {
    if ((manifest != null) && (fgIsDev))
    {
      Properties properties = getDevProperties();
      String id = (String)manifest.get("Bundle-SymbolicName");
      if (id != null)
      {
        int index = id.indexOf(';');
        if (index != -1) {
          id = id.substring(0, index);
        }
        String property = properties.getProperty(id, null);
        if (property != null) {
          manifest.put("Bundle-ClassPath", property);
        }
      }
    }
  }
  
  public static void weaveDevProperties(Properties properties)
  {
    if (fgIsDev)
    {
      Properties devProperties = getDevProperties();
      if (devProperties != null)
      {
        Set entries = devProperties.entrySet();
        Iterator iterator = entries.iterator();
        while (iterator.hasNext())
        {
          Map.Entry entry = (Map.Entry)iterator.next();
          properties.setProperty((String)entry.getKey(), (String)entry.getValue());
        }
      }
    }
  }
  
  public static String getWeavedSourceLibraryName(IPluginModelBase model, String libraryName)
  {
    if ((fgIsDev) && (!new File(libraryName).isAbsolute()))
    {
      Properties properties = getDevProperties();
      String id = null;
      if (model.getBundleDescription() != null) {
        id = model.getBundleDescription().getSymbolicName();
      }
      if (id != null)
      {
        String property = properties.getProperty(id, null);
        if (property != null) {
          return "";
        }
      }
    }
    return libraryName;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.TargetWeaver
 * 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.util.Enumeration;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.PluginRegistry;

public class TracingOptionsManager
{
  private Properties template;
  
  private void createTemplate()
  {
    template = new Properties();
    IPluginModelBase[] models = PluginRegistry.getAllModels();
    for (int i = 0; i < models.length; i++) {
      addToTemplate(models[i]);
    }
  }
  
  private void addToTemplate(IPluginModelBase model)
  {
    Properties modelOptions = getOptions(model);
    if (modelOptions == null) {
      return;
    }
    for (Enumeration keys = modelOptions.keys(); keys.hasMoreElements();)
    {
      String key = keys.nextElement().toString();
      String value = modelOptions.getProperty(key);
      if ((key != null) && (value != null)) {
        template.setProperty(key, value);
      }
    }
  }
  
  public Hashtable getTemplateTable(String pluginId)
  {
    if (template == null) {
      createTemplate();
    }
    Hashtable defaults = new Hashtable();
    for (Enumeration keys = template.keys(); keys.hasMoreElements();)
    {
      String key = keys.nextElement().toString();
      if (belongsTo(key, pluginId)) {
        defaults.put(key, template.get(key));
      }
    }
    return defaults;
  }
  
  private boolean belongsTo(String option, String pluginId)
  {
    IPath path = new Path(option);
    String firstSegment = path.segment(0);
    return pluginId.equalsIgnoreCase(firstSegment);
  }
  
  public Properties getTracingOptions(Map storedOptions)
  {
    Properties defaults = getTracingTemplateCopy();
    if (storedOptions != null)
    {
      Iterator iter = storedOptions.keySet().iterator();
      while (iter.hasNext())
      {
        String key = iter.next().toString();
        if (defaults.containsKey(key)) {
          defaults.setProperty(key, (String)storedOptions.get(key));
        }
      }
    }
    return defaults;
  }
  
  public Properties getTracingTemplateCopy()
  {
    if (template == null) {
      createTemplate();
    }
    return (Properties)template.clone();
  }
  
  /* Error */
  public static boolean isTraceable(IPluginModelBase model)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokeinterface 266 1 0
    //   6: astore_1
    //   7: aload_1
    //   8: ifnonnull +5 -> 13
    //   11: iconst_0
    //   12: ireturn
    //   13: new 100	java/io/File
    //   16: dup
    //   17: aload_1
    //   18: invokespecial 218	java/io/File:<init>	(Ljava/lang/String;)V
    //   21: astore_2
    //   22: aconst_null
    //   23: astore_3
    //   24: aconst_null
    //   25: astore 4
    //   27: aload_2
    //   28: invokevirtual 217	java/io/File:isDirectory	()Z
    //   31: ifeq +43 -> 74
    //   34: new 100	java/io/File
    //   37: dup
    //   38: aload_2
    //   39: ldc 1
    //   41: invokespecial 219	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   44: invokevirtual 216	java/io/File:exists	()Z
    //   47: istore 7
    //   49: aload_3
    //   50: ifnull +7 -> 57
    //   53: aload_3
    //   54: invokevirtual 224	java/io/InputStream:close	()V
    //   57: aload 4
    //   59: ifnull +12 -> 71
    //   62: aload 4
    //   64: invokevirtual 242	java/util/zip/ZipFile:close	()V
    //   67: goto +4 -> 71
    //   70: pop
    //   71: iload 7
    //   73: ireturn
    //   74: new 115	java/util/zip/ZipFile
    //   77: dup
    //   78: aload_2
    //   79: iconst_1
    //   80: invokespecial 243	java/util/zip/ZipFile:<init>	(Ljava/io/File;I)V
    //   83: astore 4
    //   85: aload 4
    //   87: ldc 1
    //   89: invokevirtual 245	java/util/zip/ZipFile:getEntry	(Ljava/lang/String;)Ljava/util/zip/ZipEntry;
    //   92: astore 5
    //   94: aload 5
    //   96: ifnull +93 -> 189
    //   99: aload 4
    //   101: aload 5
    //   103: invokevirtual 244	java/util/zip/ZipFile:getInputStream	(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream;
    //   106: astore_3
    //   107: goto +82 -> 189
    //   110: pop
    //   111: aload_3
    //   112: ifnull +7 -> 119
    //   115: aload_3
    //   116: invokevirtual 224	java/io/InputStream:close	()V
    //   119: aload 4
    //   121: ifnull +90 -> 211
    //   124: aload 4
    //   126: invokevirtual 242	java/util/zip/ZipFile:close	()V
    //   129: goto +82 -> 211
    //   132: pop
    //   133: goto +78 -> 211
    //   136: pop
    //   137: aload_3
    //   138: ifnull +7 -> 145
    //   141: aload_3
    //   142: invokevirtual 224	java/io/InputStream:close	()V
    //   145: aload 4
    //   147: ifnull +64 -> 211
    //   150: aload 4
    //   152: invokevirtual 242	java/util/zip/ZipFile:close	()V
    //   155: goto +56 -> 211
    //   158: pop
    //   159: goto +52 -> 211
    //   162: astore 6
    //   164: aload_3
    //   165: ifnull +7 -> 172
    //   168: aload_3
    //   169: invokevirtual 224	java/io/InputStream:close	()V
    //   172: aload 4
    //   174: ifnull +12 -> 186
    //   177: aload 4
    //   179: invokevirtual 242	java/util/zip/ZipFile:close	()V
    //   182: goto +4 -> 186
    //   185: pop
    //   186: aload 6
    //   188: athrow
    //   189: aload_3
    //   190: ifnull +7 -> 197
    //   193: aload_3
    //   194: invokevirtual 224	java/io/InputStream:close	()V
    //   197: aload 4
    //   199: ifnull +12 -> 211
    //   202: aload 4
    //   204: invokevirtual 242	java/util/zip/ZipFile:close	()V
    //   207: goto +4 -> 211
    //   210: pop
    //   211: aload_3
    //   212: ifnull +5 -> 217
    //   215: iconst_1
    //   216: ireturn
    //   217: iconst_0
    //   218: ireturn
    // Line number table:
    //   Java source line #91	-> byte code offset #0
    //   Java source line #92	-> byte code offset #7
    //   Java source line #93	-> byte code offset #11
    //   Java source line #95	-> byte code offset #13
    //   Java source line #96	-> byte code offset #22
    //   Java source line #97	-> byte code offset #24
    //   Java source line #99	-> byte code offset #27
    //   Java source line #100	-> byte code offset #34
    //   Java source line #111	-> byte code offset #49
    //   Java source line #112	-> byte code offset #53
    //   Java source line #113	-> byte code offset #57
    //   Java source line #114	-> byte code offset #62
    //   Java source line #115	-> byte code offset #70
    //   Java source line #100	-> byte code offset #71
    //   Java source line #102	-> byte code offset #74
    //   Java source line #103	-> byte code offset #85
    //   Java source line #104	-> byte code offset #94
    //   Java source line #105	-> byte code offset #99
    //   Java source line #107	-> byte code offset #110
    //   Java source line #111	-> byte code offset #111
    //   Java source line #112	-> byte code offset #115
    //   Java source line #113	-> byte code offset #119
    //   Java source line #114	-> byte code offset #124
    //   Java source line #115	-> byte code offset #132
    //   Java source line #108	-> byte code offset #136
    //   Java source line #111	-> byte code offset #137
    //   Java source line #112	-> byte code offset #141
    //   Java source line #113	-> byte code offset #145
    //   Java source line #114	-> byte code offset #150
    //   Java source line #115	-> byte code offset #158
    //   Java source line #109	-> byte code offset #162
    //   Java source line #111	-> byte code offset #164
    //   Java source line #112	-> byte code offset #168
    //   Java source line #113	-> byte code offset #172
    //   Java source line #114	-> byte code offset #177
    //   Java source line #115	-> byte code offset #185
    //   Java source line #117	-> byte code offset #186
    //   Java source line #111	-> byte code offset #189
    //   Java source line #112	-> byte code offset #193
    //   Java source line #113	-> byte code offset #197
    //   Java source line #114	-> byte code offset #202
    //   Java source line #115	-> byte code offset #210
    //   Java source line #118	-> byte code offset #211
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	219	0	model	IPluginModelBase
    //   6	12	1	location	String
    //   21	58	2	pluginLocation	File
    //   23	189	3	stream	InputStream
    //   25	178	4	jarFile	ZipFile
    //   92	10	5	manifestEntry	ZipEntry
    //   162	25	6	localObject	Object
    //   47	25	7	bool	boolean
    //   70	1	8	localIOException1	IOException
    //   110	1	9	localFileNotFoundException	FileNotFoundException
    //   132	1	10	localIOException2	IOException
    //   136	1	11	localIOException3	IOException
    //   158	1	12	localIOException4	IOException
    //   185	1	13	localIOException5	IOException
    //   210	1	14	localIOException6	IOException
    // Exception table:
    //   from	to	target	type
    //   49	67	70	java/io/IOException
    //   27	49	110	java/io/FileNotFoundException
    //   74	107	110	java/io/FileNotFoundException
    //   111	129	132	java/io/IOException
    //   27	49	136	java/io/IOException
    //   74	107	136	java/io/IOException
    //   137	155	158	java/io/IOException
    //   27	49	162	finally
    //   74	111	162	finally
    //   136	137	162	finally
    //   164	182	185	java/io/IOException
    //   189	207	210	java/io/IOException
  }
  
  public void reset()
  {
    template = null;
  }
  
  /* Error */
  private void save(String fileName, Properties properties)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_3
    //   2: new 103	java/io/FileOutputStream
    //   5: dup
    //   6: aload_1
    //   7: invokespecial 223	java/io/FileOutputStream:<init>	(Ljava/lang/String;)V
    //   10: astore_3
    //   11: aload_2
    //   12: aload_3
    //   13: ldc 2
    //   15: invokevirtual 239	java/util/Properties:store	(Ljava/io/OutputStream;Ljava/lang/String;)V
    //   18: aload_3
    //   19: invokevirtual 222	java/io/FileOutputStream:flush	()V
    //   22: goto +54 -> 76
    //   25: astore 4
    //   27: aload 4
    //   29: invokestatic 250	org/eclipse/pde/internal/core/PDECore:logException	(Ljava/lang/Throwable;)V
    //   32: aload_3
    //   33: ifnull +61 -> 94
    //   36: aload_3
    //   37: invokevirtual 221	java/io/FileOutputStream:close	()V
    //   40: goto +54 -> 94
    //   43: astore 6
    //   45: aload 6
    //   47: invokestatic 250	org/eclipse/pde/internal/core/PDECore:logException	(Ljava/lang/Throwable;)V
    //   50: goto +44 -> 94
    //   53: astore 5
    //   55: aload_3
    //   56: ifnull +17 -> 73
    //   59: aload_3
    //   60: invokevirtual 221	java/io/FileOutputStream:close	()V
    //   63: goto +10 -> 73
    //   66: astore 6
    //   68: aload 6
    //   70: invokestatic 250	org/eclipse/pde/internal/core/PDECore:logException	(Ljava/lang/Throwable;)V
    //   73: aload 5
    //   75: athrow
    //   76: aload_3
    //   77: ifnull +17 -> 94
    //   80: aload_3
    //   81: invokevirtual 221	java/io/FileOutputStream:close	()V
    //   84: goto +10 -> 94
    //   87: astore 6
    //   89: aload 6
    //   91: invokestatic 250	org/eclipse/pde/internal/core/PDECore:logException	(Ljava/lang/Throwable;)V
    //   94: return
    // Line number table:
    //   Java source line #126	-> byte code offset #0
    //   Java source line #128	-> byte code offset #2
    //   Java source line #129	-> byte code offset #11
    //   Java source line #130	-> byte code offset #18
    //   Java source line #131	-> byte code offset #25
    //   Java source line #132	-> byte code offset #27
    //   Java source line #135	-> byte code offset #32
    //   Java source line #136	-> byte code offset #36
    //   Java source line #137	-> byte code offset #43
    //   Java source line #138	-> byte code offset #45
    //   Java source line #133	-> byte code offset #53
    //   Java source line #135	-> byte code offset #55
    //   Java source line #136	-> byte code offset #59
    //   Java source line #137	-> byte code offset #66
    //   Java source line #138	-> byte code offset #68
    //   Java source line #140	-> byte code offset #73
    //   Java source line #135	-> byte code offset #76
    //   Java source line #136	-> byte code offset #80
    //   Java source line #137	-> byte code offset #87
    //   Java source line #138	-> byte code offset #89
    //   Java source line #141	-> byte code offset #94
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	95	0	this	TracingOptionsManager
    //   0	95	1	fileName	String
    //   0	95	2	properties	Properties
    //   1	80	3	stream	java.io.FileOutputStream
    //   25	3	4	e	IOException
    //   53	21	5	localObject	Object
    //   43	3	6	e	IOException
    //   66	3	6	e	IOException
    //   87	3	6	e	IOException
    // Exception table:
    //   from	to	target	type
    //   2	22	25	java/io/IOException
    //   32	40	43	java/io/IOException
    //   2	32	53	finally
    //   55	63	66	java/io/IOException
    //   76	84	87	java/io/IOException
  }
  
  public void save(String filename, Map map, HashSet selected)
  {
    Properties properties = getTracingOptions(map);
    for (Enumeration keys = properties.keys(); keys.hasMoreElements();)
    {
      String key = keys.nextElement().toString();
      Path path = new Path(key);
      if ((path.segmentCount() < 1) || (!selected.contains(path.segment(0).toString()))) {
        properties.remove(key);
      }
    }
    save(filename, properties);
  }
  
  public void save(String filename, Map map)
  {
    save(filename, getTracingOptions(map));
  }
  
  private Properties getOptions(IPluginModelBase model)
  {
    String location = model.getInstallLocation();
    if (location == null) {
      return null;
    }
    File pluginLocation = new File(location);
    InputStream stream = null;
    ZipFile jarFile = null;
    try
    {
      if (pluginLocation.isDirectory())
      {
        File file = new File(pluginLocation, ".options");
        if (file.exists()) {
          stream = new FileInputStream(file);
        }
      }
      else
      {
        jarFile = new ZipFile(pluginLocation, 1);
        ZipEntry manifestEntry = jarFile.getEntry(".options");
        if (manifestEntry != null) {
          stream = jarFile.getInputStream(manifestEntry);
        }
      }
      if (stream != null)
      {
        Properties modelOptions = new Properties();
        modelOptions.load(stream);
        return modelOptions;
      }
    }
    catch (FileNotFoundException e)
    {
      PDECore.logException(e);
    }
    catch (IOException e)
    {
      PDECore.logException(e);
    }
    finally
    {
      try
      {
        if (stream != null) {
          stream.close();
        }
        if (jarFile != null) {
          jarFile.close();
        }
      }
      catch (IOException e)
      {
        PDECore.logException(e);
      }
    }
    try
    {
      if (stream != null) {
        stream.close();
      }
      if (jarFile != null) {
        jarFile.close();
      }
    }
    catch (IOException e)
    {
      PDECore.logException(e);
    }
    return null;
  }
}

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

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Locale;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.pde.core.plugin.IPluginModelBase;

class UpdateManagerHelper$LocalSite
{
  private ArrayList fPlugins;
  private IPath fPath;
  
  public UpdateManagerHelper$LocalSite(IPath path)
  {
    if (path.getDevice() != null) {
      fPath = path.setDevice(path.getDevice().toUpperCase(Locale.ENGLISH));
    } else {
      fPath = path;
    }
    fPlugins = new ArrayList();
  }
  
  public IPath getPath()
  {
    return fPath;
  }
  
  public URL getURL()
    throws MalformedURLException
  {
    return new URL("file:" + fPath.removeTrailingSeparator());
  }
  
  public void add(IPluginModelBase model)
  {
    fPlugins.add(model);
  }
  
  public String[] getRelativePluginList()
  {
    String[] list = new String[fPlugins.size()];
    for (int i = 0; i < fPlugins.size(); i++)
    {
      IPluginModelBase model = (IPluginModelBase)fPlugins.get(i);
      IPath location = new Path(model.getInstallLocation());
      if (location.segmentCount() > 2) {
        location = location.removeFirstSegments(location.segmentCount() - 2);
      }
      list[i] = location.setDevice(null).makeRelative().toString();
    }
    return list;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.UpdateManagerHelper.LocalSite
 * 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.URL;
import java.util.ArrayList;
import java.util.Locale;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.internal.core.ifeature.IFeature;
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
import org.eclipse.update.configurator.ConfiguratorUtils;
import org.eclipse.update.configurator.IPlatformConfiguration;
import org.eclipse.update.configurator.IPlatformConfiguration.IFeatureEntry;
import org.eclipse.update.configurator.IPlatformConfiguration.ISiteEntry;
import org.eclipse.update.configurator.IPlatformConfiguration.ISitePolicy;

public class UpdateManagerHelper
{
  private static class LocalSite
  {
    private ArrayList fPlugins;
    private IPath fPath;
    
    public LocalSite(IPath path)
    {
      if (path.getDevice() != null) {
        fPath = path.setDevice(path.getDevice().toUpperCase(Locale.ENGLISH));
      } else {
        fPath = path;
      }
      fPlugins = new ArrayList();
    }
    
    public IPath getPath()
    {
      return fPath;
    }
    
    public URL getURL()
      throws MalformedURLException
    {
      return new URL("file:" + fPath.removeTrailingSeparator());
    }
    
    public void add(IPluginModelBase model)
    {
      fPlugins.add(model);
    }
    
    public String[] getRelativePluginList()
    {
      String[] list = new String[fPlugins.size()];
      for (int i = 0; i < fPlugins.size(); i++)
      {
        IPluginModelBase model = (IPluginModelBase)fPlugins.get(i);
        IPath location = new Path(model.getInstallLocation());
        if (location.segmentCount() > 2) {
          location = location.removeFirstSegments(location.segmentCount() - 2);
        }
        list[i] = location.setDevice(null).makeRelative().toString();
      }
      return list;
    }
  }
  
  public static void createPlatformConfiguration(File configLocation, IPluginModelBase[] models, IPluginModelBase brandingPlugin)
    throws CoreException
  {
    try
    {
      IPlatformConfiguration platformConfiguration = ConfiguratorUtils.getPlatformConfiguration(null);
      
      ArrayList sites = new ArrayList();
      for (int i = 0; i < models.length; i++)
      {
        IPath path = new Path(models[i].getInstallLocation()).removeLastSegments(2);
        addToSite(path, models[i], sites);
      }
      createConfigurationEntries(platformConfiguration, sites);
      if (brandingPlugin != null) {
        createFeatureEntries(platformConfiguration, brandingPlugin);
      }
      platformConfiguration.refresh();
      platformConfiguration.save(new URL("file:" + configLocation.getPath()));
    }
    catch (Exception e)
    {
      String message = e.getMessage();
      if ((message == null) || (message.length() == 0)) {
        message = PDECoreMessages.TargetPlatform_exceptionThrown;
      }
      throw new CoreException(new Status(4, "org.eclipse.pde.core", 4, message, e));
    }
  }
  
  private static void addToSite(IPath path, IPluginModelBase model, ArrayList sites)
  {
    if (path.getDevice() != null) {
      path = path.setDevice(path.getDevice().toUpperCase(Locale.ENGLISH));
    }
    for (int i = 0; i < sites.size(); i++)
    {
      LocalSite localSite = (LocalSite)sites.get(i);
      if (localSite.getPath().equals(path))
      {
        localSite.add(model);
        return;
      }
    }
    LocalSite localSite = new LocalSite(path);
    localSite.add(model);
    sites.add(localSite);
  }
  
  private static void createConfigurationEntries(IPlatformConfiguration config, ArrayList sites)
    throws CoreException, MalformedURLException
  {
    for (int i = 0; i < sites.size(); i++)
    {
      LocalSite localSite = (LocalSite)sites.get(i);
      String[] plugins = localSite.getRelativePluginList();
      
      int policy = 0;
      IPlatformConfiguration.ISitePolicy sitePolicy = config.createSitePolicy(policy, plugins);
      IPlatformConfiguration.ISiteEntry siteEntry = config.createSiteEntry(localSite.getURL(), sitePolicy);
      config.configureSite(siteEntry);
    }
    config.isTransient(true);
  }
  
  private static void createFeatureEntries(IPlatformConfiguration config, IPluginModelBase plugin)
    throws MalformedURLException
  {
    String id = plugin.getPluginBase().getId();
    IFeatureModel featureModel = PDECore.getDefault().getFeatureModelManager().findFeatureModel(id);
    if (featureModel != null)
    {
      IFeature feature = featureModel.getFeature();
      IPlatformConfiguration.IFeatureEntry featureEntry = config.createFeatureEntry(id, feature.getVersion(), id, plugin.getPluginBase().getVersion(), true, null, new URL[] { new URL("file:" + plugin.getInstallLocation()) });
      config.configureFeatureEntry(featureEntry);
    }
  }
}

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

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
import org.eclipse.pde.internal.core.project.PDEProject;

public class WorkspaceFeatureModelManager
  extends WorkspaceModelManager
{
  protected boolean isInterestingProject(IProject project)
  {
    return isFeatureProject(project);
  }
  
  protected void createModel(IProject project, boolean notify)
  {
    IFile featureXml = PDEProject.getFeatureXml(project);
    if (featureXml.exists())
    {
      WorkspaceFeatureModel model = new WorkspaceFeatureModel(featureXml);
      loadModel(model, false);
      if (fModels == null) {
        fModels = new HashMap();
      }
      fModels.put(project, model);
      if (notify) {
        addChange(model, 1);
      }
    }
  }
  
  protected void handleFileDelta(IResourceDelta delta)
  {
    IFile file = (IFile)delta.getResource();
    IProject project = file.getProject();
    IFile featureXml = PDEProject.getFeatureXml(project);
    if (file.equals(featureXml))
    {
      Object model = getModel(project);
      int kind = delta.getKind();
      if ((kind == 2) && (model != null))
      {
        removeModel(project);
      }
      else if ((kind == 1) || (model == null))
      {
        createModel(file.getProject(), true);
      }
      else if ((kind == 4) && ((0x100 & delta.getFlags()) != 0))
      {
        loadModel((IFeatureModel)model, true);
        addChange(model, 4);
      }
    }
  }
  
  protected void addListeners()
  {
    int event = 3;
    PDECore.getWorkspace().addResourceChangeListener(this, event);
  }
  
  protected void removeListeners()
  {
    PDECore.getWorkspace().removeResourceChangeListener(this);
    super.removeListeners();
  }
  
  protected IFeatureModel[] getFeatureModels()
  {
    initialize();
    return (IFeatureModel[])fModels.values().toArray(new IFeatureModel[fModels.size()]);
  }
  
  protected IFeatureModel getFeatureModel(IProject project)
  {
    return (IFeatureModel)getModel(project);
  }
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.pde.core.IModel;

class WorkspaceModelManager$ModelChange
{
  IModel model;
  int type;
  final WorkspaceModelManager this$0;
  
  public WorkspaceModelManager$ModelChange(WorkspaceModelManager paramWorkspaceModelManager, IModel model, int type)
  {
    this$0 = paramWorkspaceModelManager;
    this.model = model;
    this.type = type;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof ModelChange))
    {
      ModelChange change = (ModelChange)obj;
      IProject project = model.getUnderlyingResource().getProject();
      int type = type;
      return (model.getUnderlyingResource().getProject().equals(project)) && (this.type == type);
    }
    return false;
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.ListIterator;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.IModel;
import org.eclipse.pde.internal.core.project.PDEProject;
import org.eclipse.team.core.RepositoryProvider;

public abstract class WorkspaceModelManager
  extends AbstractModelManager
  implements IResourceChangeListener, IResourceDeltaVisitor
{
  public static boolean isPluginProject(IProject project)
  {
    if (project.isOpen()) {
      return (PDEProject.getManifest(project).exists()) || (PDEProject.getPluginXml(project).exists()) || (PDEProject.getFragmentXml(project).exists());
    }
    return false;
  }
  
  public static boolean isFeatureProject(IProject project)
  {
    return (project.isOpen()) && (PDEProject.getFeatureXml(project).exists());
  }
  
  public static boolean isBinaryProject(IProject project)
  {
    try
    {
      if (project.isOpen())
      {
        String binary = project.getPersistentProperty(PDECore.EXTERNAL_PROJECT_PROPERTY);
        if (binary != null)
        {
          RepositoryProvider provider = RepositoryProvider.getProvider(project);
          return (provider == null) || ((provider instanceof BinaryRepositoryProvider));
        }
      }
    }
    catch (CoreException e)
    {
      PDECore.logException(e);
    }
    return false;
  }
  
  public static boolean isUnsharedProject(IProject project)
  {
    return (RepositoryProvider.getProvider(project) == null) || (isBinaryProject(project));
  }
  
  class ModelChange
  {
    IModel model;
    int type;
    
    public ModelChange(IModel model, int type)
    {
      this.model = model;
      this.type = type;
    }
    
    public boolean equals(Object obj)
    {
      if ((obj instanceof ModelChange))
      {
        ModelChange change = (ModelChange)obj;
        IProject project = model.getUnderlyingResource().getProject();
        int type = type;
        return (model.getUnderlyingResource().getProject().equals(project)) && (this.type == type);
      }
      return false;
    }
  }
  
  protected Map fModels = null;
  private ArrayList fChangedModels;
  
  protected synchronized void initialize()
  {
    if (fModels != null) {
      return;
    }
    fModels = Collections.synchronizedMap(new HashMap());
    IProject[] projects = PDECore.getWorkspace().getRoot().getProjects();
    for (int i = 0; i < projects.length; i++) {
      if (isInterestingProject(projects[i])) {
        createModel(projects[i], false);
      }
    }
    addListeners();
  }
  
  protected abstract boolean isInterestingProject(IProject paramIProject);
  
  protected abstract void createModel(IProject paramIProject, boolean paramBoolean);
  
  protected abstract void addListeners();
  
  protected Object getModel(IProject project)
  {
    initialize();
    return fModels.get(project);
  }
  
  protected Object[] getModels()
  {
    initialize();
    return fModels.values().toArray();
  }
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    switch (event.getType())
    {
    case 1: 
      handleResourceDelta(event.getDelta());
      processModelChanges();
      break;
    case 2: 
      removeModel((IProject)event.getResource());
      processModelChanges();
    }
  }
  
  private void handleResourceDelta(IResourceDelta delta)
  {
    try
    {
      delta.accept(this);
    }
    catch (CoreException e)
    {
      PDECore.logException(e);
    }
  }
  
  public boolean visit(IResourceDelta delta)
    throws CoreException
  {
    if (delta != null)
    {
      IResource resource = delta.getResource();
      if (!resource.isDerived()) {
        switch (resource.getType())
        {
        case 8: 
          return true;
        case 4: 
          IProject project = (IProject)resource;
          if ((isInterestingProject(project)) && ((delta.getKind() == 1) || ((delta.getFlags() & 0x4000) != 0)))
          {
            createModel(project, true);
            return false;
          }
          if (delta.getKind() == 2)
          {
            removeModel(project);
            return false;
          }
          return true;
        case 2: 
          return isInterestingFolder((IFolder)resource);
        case 1: 
          if (isContentChange(delta))
          {
            handleFileDelta(delta);
            return false;
          }
          break;
        }
      }
    }
    return false;
  }
  
  private boolean isContentChange(IResourceDelta delta)
  {
    int kind = delta.getKind();
    return (kind == 1) || (kind == 2) || ((kind == 4) && ((delta.getFlags() & 0x100) != 0));
  }
  
  protected boolean isInterestingFolder(IFolder folder)
  {
    return false;
  }
  
  protected abstract void handleFileDelta(IResourceDelta paramIResourceDelta);
  
  protected Object removeModel(IProject project)
  {
    Object model = fModels != null ? fModels.remove(project) : null;
    addChange(model, 2);
    return model;
  }
  
  protected void addChange(Object model, int eventType)
  {
    if ((model instanceof IModel))
    {
      if (fChangedModels == null) {
        fChangedModels = new ArrayList();
      }
      ModelChange change = new ModelChange((IModel)model, eventType);
      if (!fChangedModels.contains(change)) {
        fChangedModels.add(change);
      }
    }
  }
  
  protected void processModelChanges()
  {
    processModelChanges("org.eclipse.pde.core.IModelProviderEvent", fChangedModels);
    fChangedModels = null;
  }
  
  protected void processModelChanges(String changeId, ArrayList changedModels)
  {
    if (changedModels == null) {
      return;
    }
    if (changedModels.size() == 0) {
      return;
    }
    ArrayList added = new ArrayList();
    ArrayList removed = new ArrayList();
    ArrayList changed = new ArrayList();
    for (ListIterator li = changedModels.listIterator(); li.hasNext();)
    {
      ModelChange change = (ModelChange)li.next();
      switch (type)
      {
      case 1: 
        added.add(model);
        break;
      case 2: 
        removed.add(model);
        break;
      case 4: 
        changed.add(model);
      }
    }
    int type = 0;
    if (added.size() > 0) {
      type |= 0x1;
    }
    if (removed.size() > 0) {
      type |= 0x2;
    }
    if (changed.size() > 0) {
      type |= 0x4;
    }
    if (type != 0) {
      createAndFireEvent(changeId, type, added, removed, changed);
    }
  }
  
  /* Error */
  protected void loadModel(IModel model, boolean reload)
  {
    // Byte code:
    //   0: aload_1
    //   1: invokeinterface 343 1 0
    //   6: checkcast 138	org/eclipse/core/resources/IFile
    //   9: astore_3
    //   10: aconst_null
    //   11: astore 4
    //   13: new 128	java/io/BufferedInputStream
    //   16: dup
    //   17: aload_3
    //   18: iconst_1
    //   19: invokeinterface 327 2 0
    //   24: invokespecial 282	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   27: astore 4
    //   29: iload_2
    //   30: ifeq +15 -> 45
    //   33: aload_1
    //   34: aload 4
    //   36: iconst_0
    //   37: invokeinterface 342 3 0
    //   42: goto +70 -> 112
    //   45: aload_1
    //   46: aload 4
    //   48: iconst_0
    //   49: invokeinterface 341 3 0
    //   54: goto +58 -> 112
    //   57: astore 5
    //   59: aload 5
    //   61: invokestatic 295	org/eclipse/pde/internal/core/PDECore:logException	(Ljava/lang/Throwable;)V
    //   64: aload 4
    //   66: ifnull +66 -> 132
    //   69: aload 4
    //   71: invokevirtual 283	java/io/InputStream:close	()V
    //   74: goto +58 -> 132
    //   77: astore 7
    //   79: aload 7
    //   81: invokestatic 294	org/eclipse/pde/internal/core/PDECore:log	(Ljava/lang/Throwable;)V
    //   84: goto +48 -> 132
    //   87: astore 6
    //   89: aload 4
    //   91: ifnull +18 -> 109
    //   94: aload 4
    //   96: invokevirtual 283	java/io/InputStream:close	()V
    //   99: goto +10 -> 109
    //   102: astore 7
    //   104: aload 7
    //   106: invokestatic 294	org/eclipse/pde/internal/core/PDECore:log	(Ljava/lang/Throwable;)V
    //   109: aload 6
    //   111: athrow
    //   112: aload 4
    //   114: ifnull +18 -> 132
    //   117: aload 4
    //   119: invokevirtual 283	java/io/InputStream:close	()V
    //   122: goto +10 -> 132
    //   125: astore 7
    //   127: aload 7
    //  
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