org.tizen.web.project.wizard_2.0.0.201311011708

16:50:45.444 INFO  jd.cli.Main - Decompiling org.tizen.web.project.wizard_2.0.0.201311011708.jar
package org.tizen.web.project.wizard;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.tizen.common.util.log.Logger;
import org.tizen.web.project.wizard.model.TizenModelAdapter;
import org.tizen.web.project.wizard.model.TizenTemplateLibrariesPool;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.tizen.web.project.wizard";
  private static Activator plugin;
  
  public Activator()
  {
    try
    {
      TizenModelAdapter.getInstance();
      TizenTemplateLibrariesPool.getLibrariesPool();
    }
    catch (Exception e)
    {
      Logger.log(e);
    }
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static Activator getDefault()
  {
    return plugin;
  }
}

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

import java.io.IOException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.web.project.configuration.ConfigurationException;
import org.tizen.web.project.wizard.extension.WebProjectCreator;
import org.tizen.web.project.wizard.operation.DefaultNatureOperation;

public class ConvertToProjectDescription
  implements IObjectActionDelegate
{
  private final Logger logger = LoggerFactory.getLogger(ConvertToProjectDescription.class);
  private IProject selectedProject;
  
  public void run(IAction action)
  {
    try
    {
      IProjectDescription newDes = ResourcesPlugin.getWorkspace().newProjectDescription(selectedProject.getName());
      selectedProject.setDescription(newDes, null);
      DefaultNatureOperation newNature = new DefaultNatureOperation();
      newNature.execute(null, selectedProject, null);
      
      WebProjectCreator creator = new WebProjectCreator(selectedProject);
      creator.initializeConfigurationForImport(null);
    }
    catch (CoreException e)
    {
      logger.error("Failed to convert", e);
    }
    catch (IOException e)
    {
      logger.error("Failed to convert", e);
    }
    catch (ConfigurationException e)
    {
      logger.error("Failed to convert", e);
    }
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IStructuredSelection))
    {
      Object selectedObject = ((IStructuredSelection)selection).getFirstElement();
      if ((selectedObject instanceof IProject)) {
        selectedProject = ((IProject)selectedObject);
      }
    }
  }
  
  public void setActivePart(IAction action, IWorkbenchPart targetPart) {}
}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.ConvertToProjectDescription
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard;

import org.eclipse.jst.jsp.core.internal.JSPCorePlugin;
import org.eclipse.ui.IStartup;

public class ProjectWizardStartup
  implements IStartup
{
  public void earlyStartup()
  {
    JSPCorePlugin.getDefault();
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.ProjectWizardStartup
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard;

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.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.tizen.common.util.FileUtil;
import org.tizen.web.project.builder.PackageChangeListener;
import org.tizen.web.project.initializer.WebLibraryLocation;

public class WebNavigatorContentProvider
  implements ITreeContentProvider, IResourceChangeListener
{
  private static final Object[] EMPTY_ARRAY = new Object[0];
  private PackageChangeListener pkgListener = new PackageChangeListener();
  
  public WebNavigatorContentProvider()
  {
    ResourcesPlugin.getWorkspace().addResourceChangeListener(this, 4);
    ResourcesPlugin.getWorkspace().addResourceChangeListener(pkgListener, 1);
  }
  
  public Object[] getChildren(Object parentElement)
  {
    return EMPTY_ARRAY;
  }
  
  public Object getParent(Object element)
  {
    return null;
  }
  
  public boolean hasChildren(Object element)
  {
    return false;
  }
  
  public Object[] getElements(Object inputElement)
  {
    return EMPTY_ARRAY;
  }
  
  public void dispose()
  {
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(pkgListener);
  }
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    try
    {
      IProject project = event.getResource().getProject();
      WebLibraryLocation libLocation = new WebLibraryLocation(project);
      IPath path = libLocation.getWorkingLibPath();
      FileUtil.recursiveDelete(path.toFile());
    }
    catch (IllegalStateException e)
    {
      e.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.WebNavigatorContentProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard;

import org.eclipse.ui.model.WorkbenchLabelProvider;

public class WebNavigatorLabelProvider
  extends WorkbenchLabelProvider
{}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.WebNavigatorLabelProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard;

 enum WidgetDropAssistant$WidgetDropStatus
{
  CANCEL,  OK,  DEFAULT,  NULL;
}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.WidgetDropAssistant.WidgetDropStatus
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard;

import java.io.File;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.navigator.CommonDropAdapter;
import org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant;
import org.tizen.common.util.FileUtil;
import org.tizen.web.project.wizard.ui.WebProjectImportWizard;

public class WidgetDropAssistant
  extends ResourceDropAdapterAssistant
{
  private static enum WidgetDropStatus
  {
    CANCEL,  OK,  DEFAULT,  NULL;
  }
  
  public Object canDrop(TransferData transferData)
  {
    Object data = FileTransfer.getInstance().nativeToJava(transferData);
    if ((data instanceof String[]))
    {
      String[] fileLocations = (String[])data;
      String[] arrayOfString1;
      int j = (arrayOfString1 = fileLocations).length;
      for (int i = 0; i < j; i++)
      {
        String fileLocation = arrayOfString1[i];
        File file = new File(fileLocation);
        if (file.exists())
        {
          String extension = FileUtil.getFileExtension(file.getName());
          if ("wgt".equalsIgnoreCase(extension))
          {
            if (fileLocations.length < 2) {
              return file;
            }
            return WidgetDropStatus.CANCEL;
          }
        }
      }
    }
    else
    {
      return WidgetDropStatus.NULL;
    }
    return WidgetDropStatus.DEFAULT;
  }
  
  public IStatus handleDrop(CommonDropAdapter dropAdapter, DropTargetEvent dropTargetEvent, Object target)
  {
    Object result = canDrop(dropAdapter.getCurrentTransfer());
    if ((result instanceof File))
    {
      createProject((File)result);
      return Status.OK_STATUS;
    }
    if (((result instanceof WidgetDropStatus)) && ((WidgetDropStatus)result == WidgetDropStatus.CANCEL)) {
      return Status.CANCEL_STATUS;
    }
    if (result == WidgetDropStatus.NULL) {
      return Status.CANCEL_STATUS;
    }
    return super.handleDrop(dropAdapter, dropTargetEvent, target);
  }
  
  private void createProject(File file)
  {
    WebProjectImportWizard wizard = new WebProjectImportWizard(file.getAbsolutePath());
    WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
    dialog.setBlockOnOpen(false);
    dialog.open();
  }
  
  public IStatus validateDrop(Object target, int operation, TransferData transferType)
  {
    Object result = canDrop(transferType);
    if (((result instanceof File)) || (
      ((result instanceof WidgetDropStatus)) && ((WidgetDropStatus)result == WidgetDropStatus.NULL))) {
      return Status.OK_STATUS;
    }
    return super.validateDrop(target, operation, transferType);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.WidgetDropAssistant
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard;

import org.eclipse.osgi.util.NLS;

public class WizardMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.tizen.web.project.wizard.messages";
  public static String TEMPLATE_FILE_NOT_FOUND;
  public static String TEMPLATE_PROJECT_NOT_FOUND;
  public static String UNKNOWN_EXCEPTION_TEMPLATE_LOAD;
  public static String FAIL_TO_LOAD_TEMPLATE_FILE;
  public static String NewWebAppProjectWizard_3;
  public static String NewWebAppProjectWizardPage_0;
  public static String NewWebAppProjectWizardPage_2;
  public static String NewWebAppProjectWizardPage_4;
  public static String NewWizardAddContentAssistOperationTask;
  public static String NewWizardAddNaturesOperationTask;
  public static String NewWizardCopyTemplateOperationTask;
  public static String NewWizardCreateOperationTask;
  public static String NewWizardErrorDialogDescription;
  public static String NewWizardErrorDialogTitle;
  public static String NewWizardExistProjectQuestionDialogDescription;
  public static String NewWizardExistProjectQuestionDialogTitle;
  public static String NewWizardMainPageDescription;
  public static String NewWizardMainPageName;
  public static String NewWizardMainPageTitle;
  public static String NewWizardOperationTask;
  public static String NewWizardOptionPageDescription;
  public static String NewWizardOptionPageName;
  public static String NewWizardOptionPageTitle;
  public static String NewWizardTitle;
  public static String UserTemplateExportWizard_DescriptionPageDescription;
  public static String UserTemplateExportWizard_DescriptionPageName;
  public static String UserTemplateExportWizard_ErrorDialogMsg;
  public static String UserTemplateExportWizard_ErrorDialogTitle;
  public static String UserTemplateExportWizard_FinishTask;
  public static String UserTemplateExportWizard_IconPageDescription;
  public static String UserTemplateExportWizard_IconPageName;
  public static String UserTemplateExportWizard_PageTitle;
  public static String UserTemplateExportWizard_TemplatePageDescription;
  public static String UserTemplateExportWizard_TemplatePageName;
  public static String UserTemplateExportWizard_Title;
  public static String UserTemplateExportWizardDescriptionPage_BrowseButton;
  public static String UserTemplateExportWizardDescriptionPage_DefaultDescription;
  public static String UserTemplateExportWizardDescriptionPage_DefaultName;
  public static String UserTemplateExportWizardDescriptionPage_DescriptionLabel;
  public static String UserTemplateExportWizardDescriptionPage_InvalidPreviewPathErrorMsg;
  public static String UserTemplateExportWizardDescriptionPage_NameLabel;
  public static String UserTemplateExportWizardDescriptionPage_NonameErrorMsg;
  public static String UserTemplateExportWizardDescriptionPage_PreviewFileDialog;
  public static String UserTemplateExportWizardDescriptionPage_PreviewLabel;
  public static String UserTemplateExportWizardIconPage_BrowseButton;
  public static String UserTemplateExportWizardIconPage_FileDialog;
  public static String UserTemplateExportWizardIconPage_IconSizeName;
  public static String UserTemplateExportWizardIconPage_InvalidPathErrorMsg;
  public static String UserTemplateExportWizardTemplatePage_AutoImportButton;
  public static String UserTemplateExportWizardTemplatePage_BrowseButton;
  public static String UserTemplateExportWizardTemplatePage_DefaultTemplateName;
  public static String UserTemplateExportWizardTemplatePage_DirDialog;
  public static String UserTemplateExportWizardTemplatePage_EmptyTextErrorMsg;
  public static String UserTemplateExportWizardTemplatePage_ExportLocationLabel;
  public static String UserTemplateExportWizardTemplatePage_InvalidPathErrorMsg;
  public static String UserTemplateExportWizardTemplatePage_SourceProjectLabel;
  public static String UserTemplateExportWizardTemplatePage_TemplateNameLabel;
  public static String UserTemplateExportWizardTemplatePage_AlreadyExistMsg;
  public static String UserTemplateExportWizardTemplatePage_InvalidName;
  public static String UserTemplateExportWizard_Task_CopyToLocation;
  public static String UserTemplateExportWizard_Task_CreateInformation;
  public static String UserTemplateExportWizard_Task_ImportTemplate;
  
  static
  {
    NLS.initializeMessages("org.tizen.web.project.wizard.messages", WizardMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.WizardMessages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard.cli.command;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.JarURLConnection;
import java.net.URL;
import java.text.MessageFormat;
import org.tizen.common.core.command.Command;
import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.core.command.Prompter;
import org.tizen.common.file.FileHandler;
import org.tizen.common.util.FileUtil;
import org.tizen.common.util.FilenameUtil;
import org.tizen.common.util.IOUtil;
import org.tizen.common.util.StringUtil;
import org.tizen.common.verrari.engine.freemarker.FreemarkerTemplateEngine;
import org.tizen.common.verrari.engine.freemarker.FreemarkerTemplateTransformer;
import org.tizen.common.verrari.model.ModelManager;
import org.tizen.common.verrari.template.InMemoryTemplate;
import org.tizen.common.verrari.template.TemplateManager;
import org.tizen.common.verrari.util.BufferFactory;

public class ProjectGenCommand
  implements Command<String>
{
  protected static final String DEFAULT_PROJECT_NAME = "HelloTizen";
  protected static final String DEFAULT_TEMPLATE_NAME = "Basic";
  protected String result;
  protected String projectName;
  protected String templateName;
  protected String targetPath;
  
  public String getResult()
  {
    return result;
  }
  
  public void setResult(String result)
  {
    this.result = result;
  }
  
  public String getProjectName()
  {
    if (StringUtil.isEmpty(projectName)) {
      setProjectName("HelloTizen");
    }
    return projectName;
  }
  
  public void setProjectName(String projectName)
  {
    this.projectName = projectName;
  }
  
  public String getTemplateName()
  {
    if (StringUtil.isEmpty(templateName)) {
      setTemplateName("Basic");
    }
    return templateName;
  }
  
  public void setTemplateName(String templateName)
  {
    this.templateName = templateName;
  }
  
  public String getTargetPath()
  {
    if (StringUtil.isEmpty(targetPath)) {
      setTargetPath(StringUtil.trimTrailingCharacter(System.getProperty("user.dir"), '.'));
    }
    return targetPath;
  }
  
  public void setTargetPath(String targetPath)
  {
    this.targetPath = targetPath;
  }
  
  public ProjectGenCommand()
  {
    projectName = "HelloTizen";
  }
  
  public ProjectGenCommand(String projectName)
  {
    this.projectName = projectName;
  }
  
  protected boolean ensureDirectoryExists(File f)
  {
    if (f == null) {
      return false;
    }
    return (f.exists()) || (f.mkdirs());
  }
  
  /* Error */
  public boolean copyJarResourcesRecursively(File destDir, JarURLConnection jarConnection)
    throws IOException
  {
    // Byte code:
    //   0: aload_1
    //   1: ifnull +7 -> 8
    //   4: aload_2
    //   5: ifnonnull +5 -> 10
    //   8: iconst_0
    //   9: ireturn
    //   10: aload_2
    //   11: invokevirtual 89	java/net/JarURLConnection:getJarFile	()Ljava/util/jar/JarFile;
    //   14: astore_3
    //   15: aload_3
    //   16: invokevirtual 95	java/util/jar/JarFile:entries	()Ljava/util/Enumeration;
    //   19: astore 4
    //   21: goto +229 -> 250
    //   24: aload 4
    //   26: invokeinterface 101 1 0
    //   31: checkcast 107	java/util/jar/JarEntry
    //   34: astore 5
    //   36: aload 5
    //   38: invokevirtual 109	java/util/jar/JarEntry:getName	()Ljava/lang/String;
    //   41: aload_2
    //   42: invokevirtual 112	java/net/JarURLConnection:getEntryName	()Ljava/lang/String;
    //   45: invokevirtual 115	java/lang/String:startsWith	(Ljava/lang/String;)Z
    //   48: ifeq +202 -> 250
    //   51: aload 5
    //   53: invokevirtual 109	java/util/jar/JarEntry:getName	()Ljava/lang/String;
    //   56: aload_2
    //   57: invokevirtual 112	java/net/JarURLConnection:getEntryName	()Ljava/lang/String;
    //   60: invokestatic 121	org/tizen/common/util/StringUtil:removeStart	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   63: astore 6
    //   65: new 74	java/io/File
    //   68: dup
    //   69: aload_1
    //   70: aload 6
    //   72: invokespecial 125	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   75: astore 7
    //   77: new 74	java/io/File
    //   80: dup
    //   81: aload 7
    //   83: invokevirtual 128	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   86: invokespecial 131	java/io/File:<init>	(Ljava/lang/String;)V
    //   89: astore 8
    //   91: aload 5
    //   93: invokevirtual 133	java/util/jar/JarEntry:isDirectory	()Z
    //   96: ifne +117 -> 213
    //   99: aload_0
    //   100: aload 8
    //   102: invokevirtual 136	java/io/File:getParentFile	()Ljava/io/File;
    //   105: invokevirtual 140	org/tizen/web/project/wizard/cli/command/ProjectGenCommand:ensureDirectoryExists	(Ljava/io/File;)Z
    //   108: ifne +34 -> 142
    //   111: new 87	java/io/IOException
    //   114: dup
    //   115: new 142	java/lang/StringBuilder
    //   118: dup
    //   119: ldc -112
    //   121: invokespecial 146	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   124: aload 8
    //   126: invokevirtual 136	java/io/File:getParentFile	()Ljava/io/File;
    //   129: invokevirtual 128	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   132: invokevirtual 147	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   135: invokevirtual 151	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   138: invokespecial 154	java/io/IOException:<init>	(Ljava/lang/String;)V
    //   141: athrow
    //   142: aload_3
    //   143: aload 5
    //   145: invokevirtual 155	java/util/jar/JarFile:getInputStream	(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream;
    //   148: astore 9
    //   150: new 159	java/io/FileOutputStream
    //   153: dup
    //   154: aload 8
    //   156: invokespecial 161	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   159: astore 10
    //   161: aload 9
    //   163: aload 10
    //   165: invokestatic 164	org/tizen/common/util/IOUtil:redirect	(Ljava/io/InputStream;Ljava/io/OutputStream;)V
    //   168: goto +25 -> 193
    //   171: astore 11
    //   173: iconst_2
    //   174: anewarray 3	java/lang/Object
    //   177: dup
    //   178: iconst_0
    //   179: aload 9
    //   181: aastore
    //   182: dup
    //   183: iconst_1
    //   184: aload 10
    //   186: aastore
    //   187: invokestatic 170	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   190: aload 11
    //   192: athrow
    //   193: iconst_2
    //   194: anewarray 3	java/lang/Object
    //   197: dup
    //   198: iconst_0
    //   199: aload 9
    //   201: aastore
    //   202: dup
    //   203: iconst_1
    //   204: aload 10
    //   206: aastore
    //   207: invokestatic 170	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   210: goto +40 -> 250
    //   213: aload_0
    //   214: aload 8
    //   216: invokevirtual 140	org/tizen/web/project/wizard/cli/command/ProjectGenCommand:ensureDirectoryExists	(Ljava/io/File;)Z
    //   219: ifne +31 -> 250
    //   222: new 87	java/io/IOException
    //   225: dup
    //   226: new 142	java/lang/StringBuilder
    //   229: dup
    //   230: ldc -112
    //   232: invokespecial 146	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   235: aload 7
    //   237: invokevirtual 128	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   240: invokevirtual 147	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   243: invokevirtual 151	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   246: invokespecial 154	java/io/IOException:<init>	(Ljava/lang/String;)V
    //   249: athrow
    //   250: aload 4
    //   252: invokeinterface 174 1 0
    //   257: ifne -233 -> 24
    //   260: iconst_1
    //   261: ireturn
    // Line number table:
    //   Java source line #208	-> byte code offset #0
    //   Java source line #209	-> byte code offset #8
    //   Java source line #212	-> byte code offset #10
    //   Java source line #214	-> byte code offset #15
    //   Java source line #215	-> byte code offset #24
    //   Java source line #216	-> byte code offset #36
    //   Java source line #217	-> byte code offset #51
    //   Java source line #219	-> byte code offset #65
    //   Java source line #221	-> byte code offset #77
    //   Java source line #222	-> byte code offset #91
    //   Java source line #223	-> byte code offset #99
    //   Java source line #224	-> byte code offset #111
    //   Java source line #226	-> byte code offset #142
    //   Java source line #227	-> byte code offset #150
    //   Java source line #230	-> byte code offset #161
    //   Java source line #231	-> byte code offset #171
    //   Java source line #232	-> byte code offset #179
    //   Java source line #233	-> byte code offset #190
    //   Java source line #231	-> byte code offset #193
    //   Java source line #232	-> byte code offset #199
    //   Java source line #235	-> byte code offset #213
    //   Java source line #236	-> byte code offset #222
    //   Java source line #214	-> byte code offset #250
    //   Java source line #241	-> byte code offset #260
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	262	0	this	ProjectGenCommand
    //   0	262	1	destDir	File
    //   0	262	2	jarConnection	JarURLConnection
    //   14	129	3	jarFile	java.util.jar.JarFile
    //   19	232	4	e	java.util.Enumeration<java.util.jar.JarEntry>
    //   34	110	5	entry	java.util.jar.JarEntry
    //   63	8	6	filename	String
    //   75	161	7	f	File
    //   89	126	8	fAbs	File
    //   148	52	9	entryInputStream	InputStream
    //   159	46	10	fileOutputStream	java.io.OutputStream
    //   171	20	11	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   161	171	171	finally
  }
  
  protected String templateNameforAddress(String name)
  {
    if ("Basic".equalsIgnoreCase(name)) {
      return "/templates/Tizen_Blank/project";
    }
    return null;
  }
  
  public URL getTemplateURL(String tempate_address)
  {
    return getClass().getResource(tempate_address);
  }
  
  public JarURLConnection getTemplateJarURL(URL url)
    throws IOException
  {
    if (url == null) {
      return null;
    }
    URL new_url = new URL("jar:" + url.getPath());
    JarURLConnection jurl = (JarURLConnection)new_url.openConnection();
    
    return jurl;
  }
  
  public void printInfo(Prompter prompter)
  {
    if ((prompter instanceof Prompter))
    {
      prompter.notify("Generate project name: " + getProjectName());
      prompter.notify("Generate project path: " + getTargetPath());
    }
  }
  
  public boolean isDirectoryExists(String path)
  {
    return new File(path).exists();
  }
  
  public String getDestDir()
  {
    String name = getProjectName();
    String path = getTargetPath();
    
    return FilenameUtil.addTailingPath(path, name);
  }
  
  public ByteArrayOutputStream createConfigXML()
    throws Exception
  {
    FreemarkerTemplateEngine engine = new FreemarkerTemplateEngine();
    TemplateManager templateProvider = new TemplateManager();
    engine.setTemplateProvider(templateProvider);
    
    InputStream inStream = getClass().getResource("/templates/engine/config/CONFIGBase").openStream();
    
    templateProvider.addTemplate("CONFIGBase", 
      new InMemoryTemplate(
      new FreemarkerTemplateTransformer().templateTranslate(FileUtil.readTextStream(inStream, null)).getBytes(), 
      "utf-8", 
      BufferFactory.getInstance()));
    
    IOUtil.tryClose(new Object[] {inStream });
    
    ModelManager modelManager = new ModelManager();
    modelManager.addModel("WidgetID", getProjectName());
    
    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
    engine.generate("CONFIGBase", modelManager, byteOut);
    
    return byteOut;
  }
  
  public void run(Executor executor, ExecutionContext context)
    throws Exception
  {
    try
    {
      FileHandler fileHandler = context.getFileHandler();
      
      String tname = getTemplateName();
      String taddr = templateNameforAddress(tname);
      if (taddr == null)
      {
        setResult(MessageFormat.format("failed\n[{0}] template is not supported", new Object[] { tname }));
        return;
      }
      URL url = getTemplateURL(taddr);
      JarURLConnection jurl = getTemplateJarURL(url);
      if (jurl == null)
      {
        setResult(MessageFormat.format("failed\n[{0}] template is not exist", new Object[] { tname }));
        return;
      }
      String destDir = getDestDir();
      
      fileHandler.makeDirectory(destDir);
      File destFile = new File(destDir);
      if (copyJarResourcesRecursively(destFile, jurl))
      {
        ByteArrayOutputStream oStream = createConfigXML();
        
        File configxml = new File(destDir + "/" + "config.xml");
        FileOutputStream foStream = new FileOutputStream(configxml);
        
        oStream.writeTo(foStream);
        
        IOUtil.tryClose(new Object[] {oStream, foStream });
        
        setResult("Success");
      }
      else
      {
        setResult("Failed");
      }
    }
    catch (Exception e)
    {
      setResult("failed\n" + e.getMessage());
      throw e;
    }
  }
  
  public void undo(Executor executor, ExecutionContext context)
    throws Exception
  {}
}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.cli.command.ProjectGenCommand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard.extension;

import org.eclipse.core.resources.IProject;

public abstract interface ITemplateContributor
{
  public abstract void addNature(IProject paramIProject);
  
  public abstract void doAfter(IProject paramIProject);
}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.extension.ITemplateContributor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard.extension;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.wst.css.core.internal.contentproperties.CSSContentProperties;

class WebProjectCreator$1
  extends Job
{
  WebProjectCreator$1(WebProjectCreator paramWebProjectCreator, String $anonymous0, IProject paramIProject)
  {
    super($anonymous0);
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    try
    {
      CSSContentProperties.setProperty("css-profile", 
        val$finalProject, "org.eclipse.wst.css.core.cssprofile.css3");
    }
    catch (CoreException e)
    {
      return e.getStatus();
    }
    return Status.OK_STATUS;
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.project.wizard.extension.WebProjectCreator.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.project.wizard.extension;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.FileInfoMatcherDescription;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceFilterDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.internal.ide.misc.FileInfoAttributesMatcher;
import org.eclipse.ui.internal.ide.misc.FileInfoAttributesMatcher.Argument;
import org.eclipse.wst.css.core.internal.contentproperties.CSSContentProperties;
import org.osgi.framework.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.util.Assert;
import org.tizen.common.util.ObjectUtil;
import org.tizen.web.common.WebCommonActivator;
import org.tizen.web.project.builder.WebNature;
import org.tizen.web.project.configuration.ConfigurationException;
import org.tizen.web.project.wizard.Activator;

public class WebProjectCreator
{
  protected static final Logger logger = LoggerFactory.getLogger(WebProjectCreator.class);
  protected final String DEFAULT_CONFIG_DIR_IN_PLUGIN;
  protected int totalTick = 100;
  protected IProject project = null;
  public static final String JSDTValidatorID = "org.eclipse.wst.jsdt.core.javascriptValidator";
  
  public WebProjectCreator(IProject project)
  {
    Assert.notNull(project);
    
    this.project = project;
    DEFAULT_CONFIG_DIR_IN_PLUGIN = new Path("config").append("Tizen").toPortableString();
  }
  
  public synchronized boolean makeWebProject(IProgressMonitor monitor)
  {
    monitor = (IProgressMonitor)ObjectUtil.nvl(new IProgressMonitor[] { monitor, new NullProgressMonitor() });
    
    monitor.beginTask("Make the web project", totalTick);
    int tick = totalTick / 6;
    try
    {
      handleMonitorCancel(monitor);
      
      getConfiguration(createSubMonitor(monitor, tick));
      handleMonitorCancel(monitor);
      
      initializeConfiguration(createSubMonitor(monitor, tick));
      handleMonitorCancel(monitor);
      
      addNaturesForValidation(createSubMonitor(monitor, tick));
      
      WebNature.addNature(project, null, createSubMonitor(monitor, tick));
      handleMonitorCancel(monitor);
      
      initializeJSLib(createSubMonitor(monitor, tick));
      handleMonitorCancel(monitor);
      
      addNatureForPrivilegeChecker(createSubMonitor(monitor, tick));
      handleMonitorCancel(monitor);
      
      return true;
    }
    catch (URISyntaxException e)
    {
      logger.error("Failed to process the URI", e);
    }
    catch (CoreException e)
    {
      logger.error("Failed to process the creation", e);
    }
    catch (ConfigurationException e)
    {
      logger.error("Failed to process the widget configuration", e);
    }
    catch (IOException e)
    {
      logger.error("Failed to process the resources", e);
    }
    finally
    {
      monitor.done();
    }
    return false;
  }
  
  public IResource findConfiguration()
  {
    return project.findMember("config.xml");
  }
  
  /* Error */
  public IResource getConfiguration(IProgressMonitor monitor)
    throws URISyntaxException, CoreException, IOException
  {
    // Byte code:
    //   0: iconst_2
    //   1: anewarray 69	org/eclipse/core/runtime/IProgressMonitor
    //   4: dup
    //   5: iconst_0
    //   6: aload_1
    //   7: aastore
    //   8: dup
    //   9: iconst_1
    //   10: new 71	org/eclipse/core/runtime/NullProgressMonitor
    //   13: dup
    //   14: invokespecial 73	org/eclipse/core/runtime/NullProgressMonitor:<init>	()V
    //   17: aastore
    //   18: invokestatic 74	org/tizen/common/util/ObjectUtil:nvl	([Ljava/lang/Object;)Ljava/lang/Object;
    //   21: checkcast 69	org/eclipse/core/runtime/IProgressMonitor
    //   24: astore_1
    //   25: aload_1
    //   26: ldc -93
    //   28: iconst_3
    //   29: invokeinterface 82 3 0
    //   34: aload_0
    //   35: invokevirtual 165	org/tizen/web/project/wizard/extension/WebProjectCreator:findConfiguration	()Lorg/eclipse/core/resources/IResource;
    //   38: astore_2
    //   39: aload_2
    //   40: ifnull +12 -> 52
    //   43: aload_2
    //   44: invokeinterface 167 1 0
    //   49: ifne +71 -> 120
    //   52: aload_0
    //   53: aload_0
    //   54: getfield 63	org/tizen/web/project/wizard/extension/WebProjectCreator:DEFAULT_CONFIG_DIR_IN_PLUGIN	Ljava/lang/String;
    //   57: invokevirtual 173	org/tizen/web/project/wizard/extension/WebProjectCreator:getRealEntry	(Ljava/lang/String;)Ljava/net/URI;
    //   60: astore_3
    //   61: aload_0
    //   62: getfield 36	org/tizen/web/project/wizard/extension/WebProjectCreator:project	Lorg/eclipse/core/resources/IProject;
    //   65: invokeinterface 177 1 0
    //   70: astore 4
    //   72: aload_3
    //   73: aload 4
    //   75: iconst_2
    //   76: aload_0
    //   77: aload_1
    //   78: iconst_1
    //   79: invokevirtual 90	org/tizen/web/project/wizard/extension/WebProjectCreator:createSubMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   82: invokestatic 181	org/tizen/common/util/EFSUtil:copy	(Ljava/net/URI;Ljava/net/URI;ILorg/eclipse/core/runtime/IProgressMonitor;)V
    //   85: aload_0
    //   86: getfield 36	org/tizen/web/project/wizard/extension/WebProjectCreator:project	Lorg/eclipse/core/resources/IProject;
    //   89: iconst_1
    //   90: aload_0
    //   91: aload_1
    //   92: iconst_1
    //   93: invokevirtual 90	org/tizen/web/project/wizard/extension/WebProjectCreator:createSubMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   96: invokeinterface 187 3 0
    //   101: aload_0
    //   102: invokevirtual 165	org/tizen/web/project/wizard/extension/WebProjectCreator:findConfiguration	()Lorg/eclipse/core/resources/IResource;
    //   105: astore_2
    //   106: goto +14 -> 120
    //   109: astore 5
    //   111: aload_1
    //   112: invokeinterface 116 1 0
    //   117: aload 5
    //   119: athrow
    //   120: aload_1
    //   121: invokeinterface 116 1 0
    //   126: aload_2
    //   127: areturn
    // Line number table:
    //   Java source line #193	-> byte code offset #0
    //   Java source line #195	-> byte code offset #25
    //   Java source line #197	-> byte code offset #34
    //   Java source line #199	-> byte code offset #39
    //   Java source line #201	-> byte code offset #52
    //   Java source line #202	-> byte code offset #61
    //   Java source line #205	-> byte code offset #72
    //   Java source line #206	-> byte code offset #85
    //   Java source line #208	-> byte code offset #101
    //   Java source line #210	-> byte code offset #109
    //   Java source line #211	-> byte code offset #111
    //   Java source line #212	-> byte code offset #117
    //   Java source line #211	-> byte code offset #120
    //   Java source line #214	-> byte code offset #126
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	128	0	this	WebProjectCreator
    //   0	128	1	monitor	IProgressMonitor
    //   38	89	2	config	IResource
    //   60	13	3	sourceURI	URI
    //   70	4	4	destinationURI	URI
    //   109	9	5	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   39	109	109	finally
  }
  
  /* Error */
  public void initializeConfiguration(IProgressMonitor monitor)
    throws ConfigurationException, IOException
  {
    // Byte code:
    //   0: iconst_2
    //   1: anewarray 69	org/eclipse/core/runtime/IProgressMonitor
    //   4: dup
    //   5: iconst_0
    //   6: aload_1
    //   7: aastore
    //   8: dup
    //   9: iconst_1
    //   10: new 71	org/eclipse/core/runtime/NullProgressMonitor
    //   13: dup
    //   14: invokespecial 73	org/eclipse/core/runtime/NullProgressMonitor:<init>	()V
    //   17: aastore
    //   18: invokestatic 74	org/tizen/common/util/ObjectUtil:nvl	([Ljava/lang/Object;)Ljava/lang/Object;
    //   21: checkcast 69	org/eclipse/core/runtime/IProgressMonitor
    //   24: astore_1
    //   25: aload_0
    //   26: getfield 36	org/tizen/web/project/wizard/extension/WebProjectCreator:project	Lorg/eclipse/core/resources/IProject;
    //   29: invokeinterface 195 1 0
    //   34: astore_2
    //   35: new 198	java/lang/StringBuilder
    //   38: dup
    //   39: aload_0
    //   40: invokevirtual 200	org/tizen/web/project/wizard/extension/WebProjectCreator:getWidgetURI	()Ljava/lang/String;
    //   43: invokestatic 203	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   46: invokespecial 209	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   49: aload_2
    //   50: invokevirtual 210	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   53: invokevirtual 213	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   56: astore_3
    //   57: aload_1
    //   58: ldc -40
    //   60: iconst_1
    //   61: invokeinterface 82 3 0
    //   66: new 218	org/tizen/web/project/configuration/WidgetConfigurator
    //   69: dup
    //   70: aload_0
    //   71: getfield 36	org/tizen/web/project/wizard/extension/WebProjectCreator:project	Lorg/eclipse/core/resources/IProject;
    //   74: invokespecial 220	org/tizen/web/project/configuration/WidgetConfigurator:<init>	(Lorg/eclipse/core/resources/IProject;)V
    //   77: astore 4
    //   79: aload 4
    //   81: aload_3
    //   82: invokevirtual 222	org/tizen/web/project/configuration/WidgetConfigurator:setId	(Ljava/lang/String;)V
    //   85: aload 4
    //   87: aload_2
    //   88: aconst_null
    //   89: invokevirtual 225	org/tizen/web/project/configuration/WidgetConfigurator:setName	(Ljava/lang/String;Ljava/lang/String;)V
    //   92: aload 4
    //   94: aload_2
    //   95: aconst_null
    //   96: fconst_0
   
1 2 3 4 5 6 7 8 9 10 11

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