org.tizen.common.project_2.0.0.201311012034

16:49:51.989 INFO  jd.cli.Main - Decompiling org.tizen.common.project_2.0.0.201311012034.jar
package org.tizen.common.project;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.tizen.common.project";
  private static Activator plugin;
  
  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.common.project.Activator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.project;

public final class CommonProjectConstants
{
  public static final int PROJECT_NAME_MIN_LENGTH = 3;
  public static final int PROJECT_NAME_MAX_LENGTH = 50;
  public static final String PROJECT_NAME_PATTERN = "^[a-zA-Z][a-zA-Z0-9-\\.]{2,49}(?<!\\.)$";
  public static final String PROJECT_NAME_PATTERN_FOR_APPID = "^[0-9a-zA-Z]{1,52}$";
  public static final char[] INVALID_RESOURCE_CHARACTERS = { '`', '#', '$', ':' };
}

/* Location:
 * Qualified Name:     org.tizen.common.project.CommonProjectConstants
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.project.util;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.tizen.common.project.util.messages";
  public static String ValidationUtil_AlreadyExistProject;
  public static String ValidationUtil_InvalidProjectName;
  public static String ValidationUtil_InvalidProjectNameLength;
  public static String ValidationUtil_InvalidSegment;
  
  static
  {
    NLS.initializeMessages("org.tizen.common.project.util.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.project.util.Messages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.project.util;

import java.io.File;
import java.net.URI;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.osgi.util.NLS;
import org.tizen.common.project.CommonProjectConstants;
import org.tizen.common.util.Assert;
import org.tizen.common.util.FilenameUtil;

public abstract class ProjectValidationUtil
{
  public static boolean isValidName(String projectName)
  {
    Assert.notNull(projectName);
    
    return projectName.matches(CommonProjectConstants.PROJECT_NAME_PATTERN);
  }
  
  public static boolean isValidNameForAppID(String projectName)
  {
    Assert.notNull(projectName);
    
    return projectName.matches(CommonProjectConstants.PROJECT_NAME_PATTERN_FOR_APPID);
  }
  
  public static boolean isValidNameLength(String projectName)
  {
    Assert.notNull(projectName);
    
    int nameLength = projectName.length();
    
    return (3 <= nameLength) && (nameLength <= 50);
  }
  
  public static String getInvalidChar(URI location)
  {
    Assert.notNull(location);
    if ("file".equals(location.getScheme()))
    {
      IPath pathPart = new Path(location.getSchemeSpecificPart());
      String[] arrayOfString;
      int j = (arrayOfString = pathPart.segments()).length;
      for (int i = 0; i < j; i++)
      {
        String segment = arrayOfString[i];
        char[] arrayOfChar;
        int m = (arrayOfChar = CommonProjectConstants.INVALID_RESOURCE_CHARACTERS).length;
        for (int k = 0; k < m; k++)
        {
          char invalidChar = arrayOfChar[k];
          if (segment.indexOf(invalidChar) != -1) {
            return String.valueOf(invalidChar);
          }
        }
      }
    }
    return "";
  }
  
  public static boolean isExistProject(String name, URI location)
  {
    Assert.notNull(location);
    
    IProject handle = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
    if (handle.exists()) {
      return true;
    }
    File locationFile = new File(location);
    String projectPath = FilenameUtil.addTailingPath(locationFile.getAbsolutePath(), ".project");
    if ((locationFile.exists()) && (new File(projectPath).exists())) {
      return true;
    }
    return false;
  }
  
  public static String getValidatedMsgAboutLocation(String projectName, URI projectLocation)
  {
    if (!isValidNameLength(projectName)) {
      return NLS.bind(Messages.ValidationUtil_InvalidProjectNameLength, 
        Integer.valueOf(2), 
        Integer.valueOf(51));
    }
    if (!isValidName(projectName)) {
      return Messages.ValidationUtil_InvalidProjectName;
    }
    String invalidChar = getInvalidChar(projectLocation);
    if (!invalidChar.isEmpty()) {
      return NLS.bind(Messages.ValidationUtil_InvalidSegment, invalidChar);
    }
    if (isExistProject(projectName, projectLocation)) {
      return Messages.ValidationUtil_AlreadyExistProject;
    }
    return "";
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.project.util.ProjectValidationUtil
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
1

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