org.eclipse.pde.ui.templates_3.4.400.v20110928-1516

16:47:32.773 INFO  jd.cli.Main - Decompiling org.eclipse.pde.ui.templates_3.4.400.v20110928-1516.jar
package org.eclipse.pde.internal.ui.templates;

import java.net.URL;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;

public class Activator
  extends AbstractUIPlugin
{
  private static Activator fInstance;
  
  public URL getInstallURL()
  {
    return getDefault().getBundle().getEntry("/");
  }
  
  public static Activator getDefault()
  {
    return fInstance;
  }
  
  public static String getPluginId()
  {
    return getDefault().getBundle().getSymbolicName();
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    fInstance = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    fInstance = null;
    super.stop(context);
  }
}

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

public abstract interface IHelpContextIds
{
  public static final String PREFIX = "org.eclipse.pde.doc.user.";
  public static final String TEMPLATE_EDITOR = "org.eclipse.pde.doc.user.template_editor";
  public static final String TEMPLATE_HELLO_WORLD = "org.eclipse.pde.doc.user.template_hello_world";
  public static final String TEMPLATE_INTRO = "org.eclipse.pde.doc.user.template_intro";
  public static final String TEMPLATE_HELP = "org.eclipse.pde.doc.user.template_help";
  public static final String TEMPLATE_MULTIPAGE_EDITOR = "org.eclipse.pde.doc.user.template_multipage_editor";
  public static final String TEMPLATE_NEW_WIZARD = "org.eclipse.pde.doc.user.template_new_wizard";
  public static final String TEMPLATE_POPUP_MENU = "org.eclipse.pde.doc.user.template_popup_menu";
  public static final String TEMPLATE_PREFERENCE_PAGE = "org.eclipse.pde.doc.user.template_preference_page";
  public static final String TEMPLATE_PROPERTY_PAGE = "org.eclipse.pde.doc.user.template_property_page";
  public static final String TEMPLATE_VIEW = "org.eclipse.pde.doc.user.template_view";
  public static final String TEMPLATE_BUILDER = "org.eclipse.pde.doc.user.template_builder";
  public static final String TEMPLATE_RCP_MAIL = "org.eclipse.pde.doc.user.rcp_mail";
  public static final String TEMPLATE_UNIVERSAL_WELCOME = "org.eclipse.pde.doc.user.template_universal_welcome";
  public static final String TEMPLATE_SPLASH_HANDLERS = "org.eclipse.pde.doc.user.splash_handlers";
}

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

import org.eclipse.osgi.util.NLS;

public class PDETemplateMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.pde.internal.ui.templates.pderesources";
  public static String HelpTemplate_sampleText;
  public static String HelpNewWizard_wiz;
  public static String EditorNewWizard_wtitle;
  public static String EditorTemplate_title;
  public static String EditorTemplate_desc;
  public static String EditorTemplate_packageName;
  public static String EditorTemplate_editorClass;
  public static String EditorTemplate_editorName;
  public static String EditorTemplate_fileExtension;
  public static String EditorTemplate_defaultEditorName;
  public static String HelloWorldNewWizard_wtitle;
  public static String HelloWorldTemplate_title;
  public static String HelloWorldTemplate_desc;
  public static String HelloRCPNewWizard_title;
  public static String HelloRCPTemplate_title;
  public static String HelloRCPTemplate_desc;
  public static String HelloRCPTemplate_appClass;
  public static String HelloNonUIRCPNewWizard_title;
  public static String HelloNonUIRCPTemplate_title;
  public static String HelloNonUIRCPTemplate_desc;
  public static String HelloNonUIRCPTemplate_appClass;
  public static String HelloNonUIRCPTemplate_messageText;
  public static String HelloNonUIRCPTemplate_defaultMessage;
  public static String HelloWorldTemplate_packageName;
  public static String HelloWorldTemplate_className;
  public static String HelloRCPTemplate_windowTitle;
  public static String HelloWorldTemplate_messageText;
  public static String HelloWorldTemplate_defaultMessage;
  public static String HelloWorldTemplate_sampleActionSet;
  public static String HelloWorldTemplate_sampleMenu;
  public static String HelloWorldTemplate_sampleAction;
  public static String HelloWorldCmdNewWizard_wtitle;
  public static String HelloWorldCmdTemplate_title;
  public static String HelloWorldCmdTemplate_desc;
  public static String HelloWorldCmdTemplate_packageName;
  public static String HelloWorldCmdTemplate_className;
  public static String HelloWorldCmdTemplate_messageText;
  public static String HelloWorldCmdTemplate_defaultMessage;
  public static String HelloWorldCmdTemplate_sampleCategory;
  public static String HelloWorldCmdTemplate_sampleMenu_name;
  public static String HelloWorldCmdTemplate_sampleMenu_mnemonic;
  public static String HelloWorldCmdTemplate_sampleAction_name;
  public static String HelloWorldCmdTemplate_sampleAction_mnemonic;
  public static String HelloWorldCmdTemplate_sampleAction_tooltip;
  public static String IntroNewWizard_wtitle;
  public static String IntroTemplate_title;
  public static String IntroTemplate_desc;
  public static String IntroTemplate_productName;
  public static String IntroTemplate_generate;
  public static String IntroTemplate_generateDynamicContent;
  public static String IntroTemplate_generateStaticContent;
  public static String SplashHandlersTemplate_descSplashHandlerOptions;
  public static String SplashHandlersTemplate_fieldAddSplash;
  public static String SplashHandlersTemplate_fieldClassName;
  public static String SplashHandlersTemplate_fieldJavaPackage;
  public static String SplashHandlersTemplate_fieldProductID;
  public static String SplashHandlersTemplate_fieldSplashScreenType;
  public static String SplashHandlersTemplate_titleSplashHandlerOptions;
  public static String ViewRCPNewWizard_title;
  public static String ViewRCPTemplate_title;
  public static String ViewRCPTemplate_desc;
  public static String ViewRCPTemplate_appClass;
  public static String ViewRCPTemplate_packageName;
  public static String ViewRCPTemplate_windowTitle;
  public static String MultiPageEditorNewWizard_wtitle;
  public static String MultiPageEditorTemplate_title;
  public static String MultiPageEditorTemplate_desc;
  public static String MultiPageEditorTemplate_packageName;
  public static String MultiPageEditorTemplate_className;
  public static String MultiPageEditorTemplate_contributor;
  public static String MultiPageEditorTemplate_editorName;
  public static String MultiPageEditorTemplate_defaultEditorName;
  public static String MultiPageEditorTemplate_extensions;
  public static String NewWizardTemplate_title;
  public static String NewWizardTemplate_desc;
  public static String NewWizardTemplate_packageName;
  public static String NewWizardTemplate_categoryId;
  public static String NewWizardTemplate_categoryName;
  public static String NewWizardTemplate_className;
  public static String NewWizardTemplate_pageClassName;
  public static String NewWizardTemplate_wizardName;
  public static String NewWizardTemplate_defaultName;
  public static String NewWizardTemplate_extension;
  public static String NewWizardTemplate_fileName;
  public static String PopupMenuNewWizard_wtitle;
  public static String PopupMenuTemplate_title;
  public static String PopupMenuTemplate_desc;
  public static String PopupMenuTemplate_targetClass;
  public static String PopupMenuTemplate_newAction;
  public static String PopupMenuTemplate_submenuName;
  public static String PopupMenuTemplate_defaultSubmenuName;
  public static String PopupMenuTemplate_actionLabel;
  public static String PopupMenuTemplate_defaultActionName;
  public static String PopupMenuTemplate_packageName;
  public static String PopupMenuTemplate_actionClass;
  public static String PopupMenuTemplate_enabledFor;
  public static String PopupMenuTemplate_singleSelection;
  public static String PopupMenuTemplate_multipleSelection;
  public static String PreferencePageTemplate_title;
  public static String PreferencePageTemplate_desc;
  public static String PreferencePageTemplate_packageName;
  public static String PreferencePageTemplate_className;
  public static String PreferencePageTemplate_pageName;
  public static String PreferencePageTemplate_defaultPageName;
  public static String PropertyPageNewWizard_wtitle;
  public static String PropertyPageTemplate_title;
  public static String PropertyPageTemplate_desc;
  public static String PropertyPageTemplate_packageName;
  public static String PropertyPageTemplate_pageClass;
  public static String PropertyPageTemplate_pageName;
  public static String PropertyPageTemplate_defaultPageName;
  public static String PropertyPageTemplate_targetClass;
  public static String PropertyPageTemplate_nameFilter;
  public static String ViewNewWizard_wtitle;
  public static String ViewTemplate_title0;
  public static String ViewTemplate_desc0;
  public static String ViewTemplate_packageName;
  public static String ViewTemplate_className;
  public static String ViewTemplate_name;
  public static String ViewTemplate_defaultName;
  public static String ViewTemplate_categoryId;
  public static String ViewTemplate_categoryName;
  public static String ViewTemplate_defaultCategoryName;
  public static String ViewTemplate_select;
  public static String ViewTemplate_table;
  public static String ViewTemplate_tree;
  public static String ViewTemplate_contextHelp;
  public static String ViewTemplate_addToPerspective;
  public static String ViewTemplate_addViewID;
  public static String HelpTemplate_title;
  public static String HelpTemplate_desc;
  public static String HelpTemplate_tocLabel;
  public static String HelpTemplate_isPrimary;
  public static String HelpTemplate_generateTest;
  public static String HelpTemplate_gettingStarted;
  public static String HelpTemplate_concepts;
  public static String HelpTemplate_tasks;
  public static String HelpTemplate_reference;
  public static String HelpTemplate_samples;
  public static String BuilderNewWizard_wtitle;
  public static String BuilderTemplate_title;
  public static String BuilderTemplate_desc;
  public static String BuilderTemplate_builderClass;
  public static String BuilderTemplate_builderId;
  public static String BuilderTemplate_builderName;
  public static String BuilderTemplate_natureClass;
  public static String BuilderTemplate_natureId;
  public static String BuilderTemplate_natureName;
  public static String BuilderTemplate_packageLabel;
  public static String BuilderTemplate_actionLabel;
  public static String BuilderTemplate_defaultBuilderName;
  public static String BuilderTemplate_defaultNatureName;
  public static String BuilderTemplate_markerName;
  public static String BuilderTemplate_generateAction;
  public static String DecoratorTemplate_title;
  public static String DecoratorTemplate_desc;
  public static String DecoratorTemplate_packageName;
  public static String DecoratorTemplate_placement;
  public static String DecoratorTemplate_resourceLabel;
  public static String DecoratorTemplate_readOnlyLabel;
  public static String DecoratorTemplate_decorateProject;
  public static String DecoratorTemplate_decorateReadOnly;
  public static String DecoratorTemplate_placementChoices;
  public static String DecoratorTemplate_decoratorClass;
  public static String ImportWizardTemplate_title;
  public static String ImportWizardTemplate_desc;
  public static String ImportWizardTemplate_packageName;
  public static String ImportWizardTemplate_wizardClass;
  public static String ImportWizardTemplate_wizardClassName;
  public static String ImportWizardTemplate_importWizardCategory;
  public static String ImportWizardTemplate_importWizardCategoryName;
  public static String ImportWizardTemplate_pageClass;
  public static String ImportWizardTemplate_pageClassName;
  public static String ImportWizardTemplate_wizardName;
  public static String ImportWizardTemplate_wizardDefaultName;
  public static String ImportWizardTemplate_filterChoices;
  public static String ImportWizardTemplate_filters;
  public static String ImportWizardTemplate_wizardDescription;
  public static String MailTemplate_title;
  public static String MailNewWizard_title;
  public static String MailTemplate_desc;
  public static String MailTemplate_productName;
  public static String MailTemplate_appClass;
  public static String MailTemplate_packageName;
  public static String HelloRCPTemplate_productBranding;
  public static String HelloOSGiNewWizard_title;
  public static String HelloOSGiTemplate_startMessage;
  public static String HelloOSGiTemplate_stopMessage;
  public static String HelloOSGiTemplate_pageTitle;
  public static String HelloOSGiTemplate_pageDescription;
  public static String HelloOSGiServiceTemplate_howdy;
  public static String HelloOSGiTemplate_goodbye;
  public static String HelloOSGiTemplate_hello;
  public static String UniversalWelcomeTemplate_key_directoryName;
  public static String UniversalWelcomeTemplate_key_targetPage;
  public static String UniversalWelcomeTemplate_page_Overview;
  public static String UniversalWelcomeTemplate_page_Tutorials;
  public static String UniversalWelcomeTemplate_page_FirstSteps;
  public static String UniversalWelcomeTemplate_page_Samples;
  public static String UniversalWelcomeTemplate_page_Whatsnew;
  public static String UniversalWelcomeTemplate_page_Migrate;
  public static String UniversalWelcomeTemplate_page_WebResources;
  public static String UniversalWelcomeTemplate_linkUrl;
  public static String HelloOSGiServiceTemplate_greeting;
  public static String HelloOSGiServiceTemplate_word1;
  public static String HelloOSGiServiceTemplate_word2;
  public static String HelloOSGiServiceTemplate_word3;
  public static String HelloOSGiServiceTemplate_pageDescription;
  public static String HelloOSGiServiceTemplate_pageTitle;
  public static String HelloOSGiServiceNewWizard_title;
  public static String DSTemplate_pageDescription;
  public static String DSTemplate_pageTitle;
  public static String DSTemplateWizard_title;
  public static String PerspectiveTemplate_title;
  public static String PerspectiveTemplate_desc;
  public static String PerspectiveTemplate_packageName;
  public static String PerspectiveTemplate_perspectiveClass;
  public static String PerspectiveTemplate_perspectiveClassName;
  public static String PerspectiveTemplate_perspective;
  public static String PerspectiveTemplate_perspectiveName;
  public static String PerspectiveTemplate_perspectiveShortcuts;
  public static String PerspectiveTemplate_showViewShortcuts;
  public static String PerspectiveTemplate_newWizardShortcuts;
  public static String PerspectiveTemplate_actionSets;
  public static String OSGiPreferencesServiceNewWizard_title;
  public static String OSGiPreferencesServiceTemplate_label;
  public static String OSGiPreferencesServiceTemplate_pageTitle;
  public static String OSGiPreferencesServiceTemplate_pageDescription;
  public static String OSGiPreferencesServiceTemplate_value;
  public static String OSGiSimpleLogServiceNewWizard_title;
  public static String OSGiSimpleLogServiceTemplate_logMessage;
  public static String OSGiSimpleLogServiceTemplate_pageDescription;
  public static String OSGiSimpleLogServiceTemplate_pageTitle;
  public static String OSGiSimpleLogServiceTemplate_startLogMessage;
  public static String OSGiSimpleLogServiceTemplate_stopLogMessage;
  public static String CommonNavigatorTemplate_viewId;
  public static String CommonNavigatorTemplate_viewName;
  public static String CommonNavigatorTemplate_addToPerspective;
  public static String CommonNavigatorTemplate_defaultViewName;
  public static String CommonNavigatorTemplate_pagedescription;
  public static String CommonNavigatorTemplate_pagetitle;
  public static String HelloServiceComponentTemplate_command;
  public static String HelloServiceComponentTemplate_commandTitle;
  public static String OSGiEventAdminTemplate_eventTopicTitle;
  public static String OSGiEventAdminTemplateWizard_title;
  public static String OSGiEventAdminTemplate_pageTitle;
  public static String OSGiEventAdminTemplate_pageDescription;
  
  static
  {
    NLS.initializeMessages("org.eclipse.pde.internal.ui.templates.pderesources", PDETemplateMessages.class);
  }
}

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

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Locale;
import java.util.ResourceBundle;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.pde.ui.templates.OptionTemplateSection;
import org.osgi.framework.Bundle;

public abstract class PDETemplateSection
  extends OptionTemplateSection
{
  public static final String KEY_PRODUCT_BRANDING = "productBranding";
  public static final String KEY_PRODUCT_NAME = "productName";
  public static final String VALUE_PRODUCT_ID = "product";
  public static final String VALUE_PRODUCT_NAME = "RCP Product";
  public static final String VALUE_PERSPECTIVE_NAME = "RCP Perspective";
  public static final String VALUE_APPLICATION_ID = "application";
  
  protected ResourceBundle getPluginResourceBundle()
  {
    Bundle bundle = Platform.getBundle(Activator.getPluginId());
    return Platform.getResourceBundle(bundle);
  }
  
  protected URL getInstallURL()
  {
    return Activator.getDefault().getInstallURL();
  }
  
  public URL getTemplateLocation()
  {
    try
    {
      String[] candidates = getDirectoryCandidates();
      for (int i = 0; i < candidates.length; i++) {
        if (Activator.getDefault().getBundle().getEntry(candidates[i]) != null) {
          return new URL(getInstallURL(), candidates[i]);
        }
      }
    }
    catch (MalformedURLException localMalformedURLException) {}
    return null;
  }
  
  private String[] getDirectoryCandidates()
  {
    double version = getTargetVersion();
    ArrayList result = new ArrayList();
    if (version >= 3.6D) {
      result.add("templates_3.6/" + getSectionId() + "/");
    }
    if (version >= 3.5D) {
      result.add("templates_3.5/" + getSectionId() + "/");
    }
    if (version >= 3.4D) {
      result.add("templates_3.4/" + getSectionId() + "/");
    }
    if (version >= 3.3D) {
      result.add("templates_3.3/" + getSectionId() + "/");
    }
    if (version >= 3.2D) {
      result.add("templates_3.2/" + getSectionId() + "/");
    }
    if (version >= 3.1D) {
      result.add("templates_3.1/" + getSectionId() + "/");
    }
    if (version >= 3.0D) {
      result.add("templates_3.0/" + getSectionId() + "/");
    }
    return (String[])result.toArray(new String[result.size()]);
  }
  
  public String[] getNewFiles()
  {
    return new String[0];
  }
  
  protected String getFormattedPackageName(String id)
  {
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < id.length(); i++)
    {
      char ch = id.charAt(i);
      if (buffer.length() == 0)
      {
        if (Character.isJavaIdentifierStart(ch)) {
          buffer.append(Character.toLowerCase(ch));
        }
      }
      else if ((Character.isJavaIdentifierPart(ch)) || (ch == '.')) {
        buffer.append(ch);
      }
    }
    return buffer.toString().toLowerCase(Locale.ENGLISH);
  }
  
  protected void generateFiles(IProgressMonitor monitor)
    throws CoreException
  {
    super.generateFiles(monitor);
    if (copyBrandingDirectory()) {
      super.generateFiles(monitor, Activator.getDefault().getBundle().getEntry("branding/"));
    }
  }
  
  protected boolean copyBrandingDirectory()
  {
    return getBooleanOption("productBranding");
  }
  
  protected void createBrandingOptions()
  {
    addOption("productBranding", PDETemplateMessages.HelloRCPTemplate_productBranding, false, 0);
  }
}

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

import org.eclipse.pde.internal.ui.templates.PDETemplateSection;

public abstract class BaseEditorTemplate
  extends PDETemplateSection
{
  public String getUsedExtensionPoint()
  {
    return "org.eclipse.ui.editors";
  }
  
  public String[] getNewFiles()
  {
    return new String[] { "icons/" };
  }
}

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

import org.eclipse.pde.internal.ui.templates.PDETemplateMessages;
import org.eclipse.pde.ui.IFieldData;
import org.eclipse.pde.ui.templates.ITemplateSection;
import org.eclipse.pde.ui.templates.NewPluginTemplateWizard;

public class BuilderNewWizard
  extends NewPluginTemplateWizard
{
  public void init(IFieldData data)
  {
    super.init(data);
    setWindowTitle(PDETemplateMessages.BuilderNewWizard_wtitle);
  }
  
  public ITemplateSection[] createTemplateSections()
  {
    return new ITemplateSection[] { new BuilderTemplate() };
  }
}

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

import java.io.File;
import java.util.ArrayList;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginElement;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.IPluginModelFactory;
import org.eclipse.pde.core.plugin.IPluginReference;
import org.eclipse.pde.internal.ui.templates.PDETemplateMessages;
import org.eclipse.pde.internal.ui.templates.PDETemplateSection;
import org.eclipse.pde.ui.IFieldData;
import org.eclipse.pde.ui.templates.BooleanOption;
import org.eclipse.pde.ui.templates.PluginReference;

public class BuilderTemplate
  extends PDETemplateSection
{
  private static final String KEY_BUILDER_CLASS_NAME = "builderClassName";
  private static final String KEY_BUILDER_ID = "builderId";
  private static final String KEY_BUILDER_NAME = "builderName";
  private static final String KEY_NATURE_CLASS_NAME = "natureClassName";
  private static final String KEY_NATURE_ID = "natureId";
  private static final String KEY_NATURE_NAME = "natureName";
  private static final String KEY_GEN_ACTION = "genAction";
  private BooleanOption actionOption;
  
  public BuilderTemplate()
  {
    setPageCount(1);
    createOptions();
  }
  
  public String getSectionId()
  {
    return "builder";
  }
  
  public int getNumberOfWorkUnits()
  {
    return super.getNumberOfWorkUnits() + 1;
  }
  
  private void createOptions()
  {
    addOption("packageName", PDETemplateMessages.BuilderTemplate_packageLabel, null, 0);
    
    addOption("builderClassName", PDETemplateMessages.BuilderTemplate_builderClass, "SampleBuilder", 0);
    addOption("builderId", PDETemplateMessages.BuilderTemplate_builderId, "sampleBuilder", 0);
    addOption("builderName", PDETemplateMessages.BuilderTemplate_builderName, PDETemplateMessages.BuilderTemplate_defaultBuilderName, 0);
    
    addOption("natureClassName", PDETemplateMessages.BuilderTemplate_natureClass, "SampleNature", 0);
    addOption("natureId", PDETemplateMessages.BuilderTemplate_natureId, "sampleNature", 0);
    addOption("natureName", PDETemplateMessages.BuilderTemplate_natureName, PDETemplateMessages.BuilderTemplate_defaultNatureName, 0);
    
    actionOption = ((BooleanOption)addOption("genAction", PDETemplateMessages.BuilderTemplate_generateAction, true, 0));
  }
  
  public void addPages(Wizard wizard)
  {
    WizardPage page = createPage(0, "org.eclipse.pde.doc.user.template_builder");
    page.setTitle(PDETemplateMessages.BuilderTemplate_title);
    page.setDescription(PDETemplateMessages.BuilderTemplate_desc);
    wizard.addPage(page);
    markPagesAdded();
  }
  
  public boolean isDependentOnParentWizard()
  {
    return true;
  }
  
  protected void initializeFields(IFieldData data)
  {
    String id = data.getId();
    initializeOption("packageName", getFormattedPackageName(id));
  }
  
  public void initializeFields(IPluginModelBase model)
  {
    String pluginId = model.getPluginBase().getId();
    initializeOption("packageName", getFormattedPackageName(pluginId));
  }
  
  public String getUsedExtensionPoint()
  {
    return "org.eclipse.core.resources.builders";
  }
  
  protected void updateModel(IProgressMonitor monitor)
    throws CoreException
  {
    IPluginBase plugin = model.getPluginBase();
    IPluginModelFactory factory = model.getPluginFactory();
    
    IPluginExtension extension1 = createExtension("org.eclipse.core.resources.builders", true);
    extension1.setId(getStringOption("builderId"));
    extension1.setName(getStringOption("builderName"));
    
    IPluginElement builder = factory.createElement(extension1);
    builder.setName("builder");
    builder.setAttribute("hasNature", "true");
    extension1.add(builder);
    
    IPluginElement run = factory.createElement(builder);
    run.setName("run");
    run.setAttribute("class", getStringOption("packageName") + 
      "." + getStringOption("builderClassName"));
    builder.add(run);
    if (!extension1.isInTheModel()) {
      plugin.add(extension1);
    }
    IPluginExtension extension2 = createExtension("org.eclipse.core.resources.natures", true);
    extension2.setId(getStringOption("natureId"));
    extension2.setName(getStringOption("natureName"));
    
    IPluginElement runtime = factory.createElement(extension2);
    runtime.setName("runtime");
    extension2.add(runtime);
    
    IPluginElement run2 = factory.createElement(runtime);
    run2.setName("run");
    run2.setAttribute("class", getStringOption("packageName") + 
      "." + getStringOption("natureClassName"));
    runtime.add(run2);
    
    IPluginElement builder2 = factory.createElement(extension2);
    builder2.setName("builder");
    builder2.setAttribute("id", model.getPluginBase().getId() + 
      "." + getStringOption("builderId"));
    extension2.add(builder2);
    if (!extension2.isInTheModel()) {
      plugin.add(extension2);
    }
    if (actionOption.isSelected())
    {
      IPluginExtension extension3 = createExtension("org.eclipse.ui.popupMenus", true);
      IPluginElement objectContribution = factory.createElement(extension3);
      objectContribution.setName("objectContribution");
      objectContribution.setAttribute("objectClass", 
        "org.eclipse.core.resources.IProject");
      objectContribution.setAttribute("adaptable", "true");
      objectContribution.setAttribute("nameFilter", "*");
      objectContribution.setAttribute("id", model.getPluginBase().getId() + 
        ".contribution1");
      extension3.add(objectContribution);
      
      IPluginElement action = factory.createElement(objectContribution);
      action.setName("action");
      action.setAttribute("label", PDETemplateMessages.BuilderTemplate_actionLabel);
      action.setAttribute("class", getStringOption("packageName") + 
        ".ToggleNatureAction");
      action.setAttribute("menubarPath", "additions");
      action.setAttribute("enablesFor", "+");
      action.setAttribute("id", model.getPluginBase().getId() + 
        ".addRemoveNatureAction");
      objectContribution.add(action);
      if (!extension3.isInTheModel()) {
        plugin.add(extension3);
      }
    }
    IPluginExtension extension4 = createExtension("org.eclipse.core.resources.markers", false);
    extension4.setId("xmlProblem");
    extension4.setName(PDETemplateMessages.BuilderTemplate_markerName);
    
    IPluginElement superElement = factory.createElement(extension4);
    superElement.setName("super");
    superElement.setAttribute("type", 
      "org.eclipse.core.resources.problemmarker");
    extension4.add(superElement);
    
    IPluginElement persistent = factory.createElement(extension4);
    persistent.setName("persistent");
    persistent.setAttribute("value", "true");
    extension4.add(persistent);
    if (!extension4.isInTheModel()) {
      plugin.add(extension4);
    }
  }
  
  public IPluginReference[] getDependencies(String schemaVersion)
  {
    ArrayList result = new ArrayList();
    result.add(new PluginReference("org.eclipse.core.resources", null, 0));
    if (schemaVersion != null) {
      result.add(new PluginReference("org.eclipse.core.runtime", null, 
        0));
    }
    if (actionOption.isSelected()) {
      result.add(new PluginReference("org.eclipse.ui", null, 0));
    }
    return (IPluginReference[])result.toArray(new IPluginReference[result.size()]);
  }
  
  protected String getFormattedPackageName(String id)
  {
    String packageName = super.getFormattedPackageName(id);
    if (packageName.length() != 0) {
      return packageName + ".builder";
    }
    return "builder";
  }
  
  protected boolean isOkToCreateFile(File sourceFile)
  {
    String fileName = sourceFile.getName();
    if (fileName.equals("ToggleNatureAction.java")) {
      return actionOption.isSelected();
    }
    return true;
  }
  
  public String getLabel()
  {
    return getPluginResourceString("newExtension.templates.builder.name");
  }
  
  public String getDescription()
  {
    return getPluginResourceString("newExtension.templates.builder.desc");
  }
}

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

import java.util.ArrayList;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginElement;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.IPluginModelFactory;
import org.eclipse.pde.core.plugin.IPluginReference;
import org.eclipse.pde.internal.ui.templates.PDETemplateMessages;
import org.eclipse.pde.internal.ui.templates.PDETemplateSection;
import org.eclipse.pde.ui.templates.BooleanOption;
import org.eclipse.pde.ui.templates.PluginReference;

public class CommonNavigatorTemplate
  extends PDETemplateSection
{
  public static final String KEY_VIEW_ID = "viewId";
  public static final String KEY_VIEW_NAME = "viewName";
  public static final String KEY_ADD_TO_PERSPECTIVE = "addToPerspective";
  private BooleanOption addToPerspective;
  private IPluginBase plugin;
  private IPluginModelFactory factory;
  private String viewId;
  
  public CommonNavigatorTemplate()
  {
    setPageCount(1);
    createOptions();
  }
  
  private void createOptions()
  {
    addOption("viewId", PDETemplateMessages.CommonNavigatorTemplate_viewId, "com.example.test", 0);
    addOption("viewName", PDETemplateMessages.CommonNavigatorTemplate_viewName, PDETemplateMessages.CommonNavigatorTemplate_defaultViewName, 0);
    addToPerspective = ((BooleanOption)addOption("addToPerspective", PDETemplateMessages.CommonNavigatorTemplate_addToPerspective, true, 0));
  }
  
  public String getSectionId()
  {
    return "commonNavigator";
  }
  
  protected void updateModel(IProgressMonitor monitor)
    throws CoreException
  {
    plugin = model.getPluginBase();
    factory = model.getPluginFactory();
    viewId = getStringOption("viewId");
    
    createView();
    createViewer();
    if (addToPerspective.isSelected()) {
      createAddToPerspective();
    }
  }
  
  private void createAddToPerspective()
    throws CoreException
  {
    IPluginExtension perspectiveExtension = createExtension("org.eclipse.ui.perspectiveExtensions", true);
    
    IPluginElement perspectiveElement = factory.createElement(perspectiveExtension);
    perspectiveElement.setName("perspectiveExtension");
    perspectiveElement.setAttribute("targetID", 
      "org.eclipse.ui.resourcePerspective");
    
    IPluginElement view = factory.createElement(perspectiveElement);
    view.setName("view");
    view.setAttribute("id", viewId);
    view.setAttribute("relative", "org.eclipse.ui.navigator.ProjectExplorer");
    view.setAttribute("relationship", "stack");
    view.setAttribute("ratio", "0.5");
    perspectiveElement.add(view);
    
    perspectiveExtension.add(perspectiveElement);
    if (!perspectiveExtension.isInTheModel()) {
      plugin.add(perspectiveExtension);
    }
  }
  
  private void createViewer()
    throws CoreException
  {
    IPluginExtension viewerExtension = createExtension("org.eclipse.ui.navigator.viewer", true);
    if (!viewerExtension.isInTheModel()) {
      plugin.add(viewerExtension);
    }
    createActionBinding(viewerExtension);
    createContentBinding(viewerExtension);
  }
  
  private void createContentBinding(IPluginExtension viewerExtension)
    throws CoreException
  {
    IPluginElement viewerContentBindingElement = factory.createElement(viewerExtension);
    viewerContentBindingElement.setName("viewerContentBinding");
    viewerContentBindingElement.setAttribute("viewerId", viewId);
    
    IPluginElement includesElement = factory.createElement(viewerContentBindingElement);
    includesElement.setName("includes");
    createChild(includesElement, "contentExtension", "pattern", "org.eclipse.ui.navigator.resourceContent");
    createChild(includesElement, "contentExtension", "pattern", "org.eclipse.ui.navigator.resources.filters.*");
    createChild(includesElement, "contentExtension", "pattern", "org.eclipse.ui.navigator.resources.linkHelper");
    createChild(includesElement, "contentExtension", "pattern", "org.eclipse.ui.navigator.resources.workingSets");
    
    viewerContentBindingElement.add(includesElement);
    viewerExtension.add(viewerContentBindingElement);
  }
  
  private void createActionBinding(IPluginExtension viewerExtension)
    throws CoreException
  {
    IPluginElement viewerActionBindingElement = factory.createElement(viewerExtension);
    viewerActionBindingElement.setName("viewerActionBinding");
    viewerActionBindingElement.setAttribute("viewerId", viewId);
    
    IPluginElement includesElement = factory.createElement(viewerActionBindingElement);
    includesElement.setName("includes");
    
    createChild(includesElement, "actionExtension", "pattern", "org.eclipse.ui.navigator.resources.*");
    
    viewerActionBindingElement.add(includesElement);
    viewerExtension.add(viewerActionBindingElement);
  }
  
  private void createChild(IPluginElement parent, String name, String attrName, String attrValue)
    throws CoreException
  {
    IPluginElement child = factory.createElement(parent);
    child.setName(name);
    child.setAttribute(attrName, attrValue);
    parent.add(child);
  }
  
  private void createView()
    throws CoreException
  {
    IPluginExtension viewExtension = createExtension("org.eclipse.ui.views", true);
    IPluginElement viewElement = factory.createElement(viewExtension);
    viewElement.setName("view");
    viewElement.setAttribute("id", viewId);
    viewElement.setAttribute("name", getStringOption("viewName"));
    viewElement.setAttribute("icon", "icons/sample.gif");
    
    viewElement.setAttribute("class", "org.eclipse.ui.navigator.CommonNavigator");
    viewExtension.add(viewElement);
    if (!viewExtension.isInTheModel()) {
      plugin.add(viewExtension);
    }
  }
  
  public String[] getNewFiles()
  {
    return new String[0];
  }
  
  public String getUsedExtensionPoint()
  {
    return "org.eclipse.ui.navigator.CommonNavigator";
  }
  
  public void addPages(Wizard wizard)
  {
    WizardPage page0 = createPage(0);
    page0.setTitle(PDETemplateMessages.CommonNavigatorTemplate_pagetitle);
    page0.setDescription(PDETemplateMessages.CommonNavigatorTemplate_pagedescription);
    wizard.addPage(page0);
    
    markPagesAdded();
  }
  
  public IPluginReference[] getDependencies(String schemaVersion)
  {
    ArrayList result = new ArrayList();
    result.add(new PluginReference("org.eclipse.core.resources", null, 0));
    result.add(new PluginReference("org.eclipse.ui.navigator", null, 0));
    result.add(new PluginReference("org.eclipse.ui.navigator.resources", null, 0));
    return (IPluginReference[])result.toArray(new IPluginReference[result.size()]);
  }
}

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

import java.io.File;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginElement;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.IPluginModelFactory;
import org.eclipse.pde.core.plugin.IPluginReference;
import org.eclipse.pde.internal.ui.templates.PDETemplateMessages;
import org.eclipse.pde.internal.ui.templates.PDETemplateSection;
import org.eclipse.pde.ui.IFieldData;
import org.eclipse.pde.ui.templates.BooleanOption;
import org.eclipse.pde.ui.templates.PluginReference;
import org.eclipse.pde.ui.templates.TemplateOption;

public class DecoratorTemplate
  extends PDETemplateSection
{
  public static final String DECORATOR_CLASS_NAME = "decoratorClassName";
  public static final String DECORATOR_ICON_PLACEMENT = "decoratorPlacement";
  public static final String DECORATOR_BLN_PROJECT = "decorateProjects";
  public static final String DECORATOR_BLN_READONLY = "decorateReadOnly";
  private WizardPage page;
  private TemplateOption packageOption;
  private TemplateOption classOption;
  private BooleanOption projectOption;
  private BooleanOption readOnlyOption;
  
  public DecoratorTemplate()
  {
    setPageCount(1);
    createOptions();
    alterOptionStates();
  }
  
  public IPluginReference[] getDependencies(String schemaVersion)
  {
    if (schemaVersion != null)
    {
      IPluginReference[] dep = new IPluginReference[1];
      dep[0] = new PluginReference("org.eclipse.core.resources", null, 0);
      return dep;
    }
    return super.getDependencies(schemaVersion);
  }
  
  public String getSectionId()
  {
    return "decorator";
  }
  
  public int getNumberOfWorkUnits()
  {
    return super.getNumberOfWorkUnits() + 1;
  }
  
  private void createOptions()
  {
    String[][] choices = fromCommaSeparated(PDETemplateMessages.DecoratorTemplate_placementChoices);
    
    addOption("decoratorPlacement", PDETemplateMessages.DecoratorTemplate_placement, choices, choices[0][0], 0);
    
    projectOption = ((BooleanOption)addOption("decorateProjects", PDETemplateMessages.DecoratorTemplate_decorateProject, true, 0));
    
    readOnlyOption = ((BooleanOption)addOption("decorateReadOnly", PDETemplateMessages.DecoratorTemplate_decorateReadOnly, false, 0));
    
    packageOption = addOption("packageName", PDETemplateMessages.DecoratorTe
1 2 3 4 5

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