org.tizen.nativecommon_2.0.0.201310241731

16:50:13.680 INFO  jd.cli.Main - Decompiling org.tizen.nativecommon_2.0.0.201310241731.jar
package org.tizen.nativecommon;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.tizen.nativecommon";
  private static Activator plugin;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
    
    CodanSettings.disableCodeAnalysisProblems(CodanSettings.getCodanProblemIds("org.eclipse.cdt.codan.core.categories.CompilerErrors"));
    
    ProjectUtil.enableAutoBuild(false);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static Activator getDefault()
  {
    return plugin;
  }
  
  public static ImageDescriptor getImageDescriptorFromPlugin(String path)
  {
    return imageDescriptorFromPlugin("org.tizen.nativecommon", path);
  }
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;
import org.tizen.common.IApplicationConfiguration;

public class ApplicationConfiguration
  extends TizenNativeProject
  implements IApplicationConfiguration, IAdaptable
{
  public ApplicationConfiguration(IProject project)
  {
    super(project);
  }
  
  public Object getAdapter(Class adapter)
  {
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
  
  public String getBinaryName()
  {
    return ProjectUtil.getBinaryName(getProject());
  }
  
  public String generateAppId()
  {
    IXMLStore xmlManager = ProjectUtil.getXmlStore(getProject());
    String newAppId = null;
    if (xmlManager != null) {
      newAppId = xmlManager.generateAppId();
    }
    return newAppId;
  }
  
  public String getBuildArchitecture()
  {
    return ProjectUtil.getBuildArchitecture(getProject());
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.ApplicationConfiguration
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdapterFactory;
import org.tizen.common.IApplicationConfiguration;

public class ApplicationConfigurationAdapterFactory
  implements IAdapterFactory
{
  public Object getAdapter(Object adaptableObject, Class adapterType)
  {
    if (adapterType == IApplicationConfiguration.class) {
      return new ApplicationConfiguration((IProject)adaptableObject);
    }
    return null;
  }
  
  public Class[] getAdapterList()
  {
    return new Class[] { IApplicationConfiguration.class };
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.ApplicationConfigurationAdapterFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.codan.core.CodanRuntime;
import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemCategory;
import org.eclipse.cdt.codan.core.model.IProblemProfile;
import org.eclipse.cdt.codan.internal.core.model.CodanProblem;

public class CodanSettings
{
  public static final String CATEGORY_PROGRAMMING_PROBLEMS = "org.eclipse.cdt.codan.core.categories.ProgrammingProblems";
  public static final String CATEGORY_CODE_STYLE = "org.eclipse.cdt.codan.core.categories.CodeStyle";
  public static final String CATEGORY_COMPILER_ERRORS = "org.eclipse.cdt.codan.core.categories.CompilerErrors";
  public static final String CATEGORY_SECURITY = "org.eclipse.cdt.codan.core.categories.Security";
  public static final String[] CODAN_PROBLEMS_DISABLED = {
    "org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem", 
    "org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem", 
    "org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem", 
    "org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem", 
    "org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem", 
    "org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem", 
    "org.eclipse.cdt.codan.internal.checkers.InvalidArguments" };
  
  public static void disableCodeAnalysisProblems(String... ids)
  {
    checkCodeAnalysisProblems(false, ids);
  }
  
  public static void enableCodeAnalysisProblems(String... ids)
  {
    checkCodeAnalysisProblems(true, ids);
  }
  
  private static void checkCodeAnalysisProblems(boolean enabled, String... ids)
  {
    IProblemProfile profile = CodanRuntime.getInstance().getCheckersRegistry().getWorkspaceProfile();
    IProblem[] problems = profile.getProblems();
    String[] arrayOfString;
    int j = (arrayOfString = ids).length;
    for (int i = 0; i < j; i++)
    {
      String pid = arrayOfString[i];
      IProblem[] arrayOfIProblem1;
      int m = (arrayOfIProblem1 = problems).length;
      for (int k = 0; k < m; k++)
      {
        IProblem p = arrayOfIProblem1[k];
        if (p.getId().equals(pid))
        {
          ((CodanProblem)p).setEnabled(enabled);
          break;
        }
      }
    }
  }
  
  public static String[] getCodanProblemIds(String categoryId)
  {
    IProblemProfile profile = CodanRuntime.getInstance().getCheckersRegistry().getWorkspaceProfile();
    IProblem[] problems = profile.getProblems();
    List<String> ids = new ArrayList();
    if (problems != null)
    {
      IProblem[] arrayOfIProblem1;
      int j = (arrayOfIProblem1 = problems).length;
      for (int i = 0; i < j; i++)
      {
        IProblem p = arrayOfIProblem1[i];
        if ((categoryId == null) || (categoryId.equals(p.getParentCategory().getId()))) {
          ids.add(p.getId());
        }
      }
    }
    return (String[])ids.toArray(new String[0]);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.CodanSettings
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon;

import java.util.List;
import org.eclipse.core.resources.IFile;
import org.tizen.common.ITizenNativeXMLStore;
import org.tizen.common.TizenProjectType;

public abstract interface IXMLStore
  extends ITizenNativeXMLStore
{
  public abstract List<String> getIconFileList();
  
  @Deprecated
  public abstract void addAppIdList(List<String> paramList);
  
  public abstract boolean storeXml(IFile paramIFile);
  
  public abstract String getXMLDataId();
  
  public abstract String getVersion();
  
  public abstract String generateAppId();
  
  public abstract boolean resetAppId();
  
  public abstract TizenProjectType getApplicationType();
  
  public abstract List<String> getExecutableNames();
  
  public abstract boolean isImeCategory();
  
  public abstract boolean isSubMode();
  
  public abstract boolean isOspCompat();
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.IXMLStore
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.tizen.common.util.OSChecker;

public class PathUtil
{
  public static String convertMinGWPath(String path)
  {
    if (OSChecker.isLinux()) {
      return path;
    }
    if (OSChecker.isWindows())
    {
      if (path.matches("/[[a-z][A-Z]]/.*"))
      {
        char alphabet = path.charAt(1);
        return new Path(path.replaceFirst("/[[a-z][A-Z]]/", alphabet + ":/")).toOSString();
      }
      return new Path(path).toOSString();
    }
    return path;
  }
  
  public static boolean equalPath(IPath path1, IPath path2)
  {
    if ((path1.isAbsolute() != path2.isAbsolute()) || (path1.isUNC() != path2.isUNC())) {
      return false;
    }
    int i = path1.segmentCount();
    if (i != path2.segmentCount()) {
      return false;
    }
    boolean caseSensitive = !OSChecker.isWindows();
    do
    {
      if (caseSensitive ? 
        !path1.segment(i).equals(path2.segment(i)) : 
        !path1.segment(i).equalsIgnoreCase(path2.segment(i))) {
        return false;
      }
      i--;
    } while (i >= 0);
    if (path1.getDevice() == null) {
      return path2.getDevice() == null;
    }
    return path1.getDevice().equalsIgnoreCase(path2.getDevice());
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.PathUtil
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.internal.dtree.AbstractDataTreeNode;
import org.eclipse.core.internal.dtree.DeltaDataTree;
import org.eclipse.core.internal.events.BuildCommand;
import org.eclipse.core.internal.events.BuilderPersistentInfo;
import org.eclipse.core.internal.events.ResourceComparator;
import org.eclipse.core.internal.resources.ICoreConstants;
import org.eclipse.core.internal.resources.Project;
import org.eclipse.core.internal.resources.ProjectDescription;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.internal.watson.ElementTree;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;

public class ProjectDirtyChecker
{
  IProject project;
  List<String> deltaFilterDataList;
  
  public ProjectDirtyChecker(IProject project)
  {
    this.project = project;
  }
  
  public void setDeltaFilter(List<String> deltaFilterDataList)
  {
    this.deltaFilterDataList = deltaFilterDataList;
  }
  
  public boolean isDirtyProject()
  {
    if (getOldTree(project, getBuilder(project)) == null) {
      return true;
    }
    AbstractDataTreeNode deltaNode = getDeltaTreeNode();
    if (deltaNode != null)
    {
      AbstractDataTreeNode[] arrayOfAbstractDataTreeNode;
      int j = (arrayOfAbstractDataTreeNode = deltaNode.getChildren()).length;
      for (int i = 0; i < j; i++)
      {
        AbstractDataTreeNode node = arrayOfAbstractDataTreeNode[i];
        if (!isContainDeltaFilterDataList(node)) {
          return true;
        }
      }
      return false;
    }
    return false;
  }
  
  public AbstractDataTreeNode getDeltaTreeNode()
  {
    ElementTree oldTree = getOldTree(project, getBuilder(project));
    ElementTree currentTree = ((Workspace)project.getWorkspace()).getElementTree();
    AbstractDataTreeNode deltaNode = null;
    if (oldTree != null)
    {
      DeltaDataTree currentDelta = currentTree.getDataTree().forwardDeltaWith(oldTree.getDataTree(), ResourceComparator.getBuildComparator());
      deltaNode = currentDelta.findNodeAt(project.getFullPath());
    }
    return deltaNode;
  }
  
  private boolean isContainDeltaFilterDataList(AbstractDataTreeNode deltaNode)
  {
    String[] splitData = (String[])null;
    String deltaName = deltaNode.getName();
    for (String deltaFilterData : deltaFilterDataList)
    {
      splitData = deltaFilterData.split("/");
      if (splitData.length == 1)
      {
        if (deltaName.equals(splitData[0])) {
          return true;
        }
      }
      else if ((splitData.length > 1) && 
        (multiDepthChecker(splitData, deltaNode))) {
        return true;
      }
    }
    return false;
  }
  
  private boolean multiDepthChecker(String[] splitData, AbstractDataTreeNode deltaNode)
  {
    String deltaName = deltaNode.getName();
    AbstractDataTreeNode[] childrenNode = (AbstractDataTreeNode[])null;
    if (deltaName.equals(splitData[0])) {
      for (int i = 1; i < splitData.length; i++)
      {
        childrenNode = deltaNode.getChildren();
        for (int j = 0; j < childrenNode.length; j++)
        {
          if (childrenNode[j].getName().equals(splitData[i]))
          {
            deltaNode = childrenNode[j];
            break;
          }
          if (j == childrenNode.length - 1) {
            return false;
          }
        }
        if (i == splitData.length - 1) {
          return true;
        }
      }
    }
    return false;
  }
  
  private IncrementalProjectBuilder getBuilder(IProject targetProj)
  {
    ICommand[] commands = ((Project)targetProj).internalGetDescription().getBuildSpec(false);
    IncrementalProjectBuilder targetBuilder = (IncrementalProjectBuilder)((BuildCommand)commands[0]).getBuilders();
    return targetBuilder;
  }
  
  private ElementTree getOldTree(IProject targetProj, IncrementalProjectBuilder builder)
  {
    ElementTree oldTree = null;
    if (builder != null)
    {
      try
      {
        Class<?> c = Class.forName("org.eclipse.core.internal.events.InternalBuilder");
        Method m = c.getDeclaredMethod("getLastBuiltTree", new Class[0]);
        m.setAccessible(true);
        oldTree = (ElementTree)m.invoke(builder, new Object[0]);
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
    }
    else
    {
      ArrayList<?> infos = null;
      try
      {
        infos = (ArrayList)targetProj.getSessionProperty(ICoreConstants.K_BUILD_LIST);
      }
      catch (CoreException e)
      {
        e.printStackTrace();
      }
      BuilderPersistentInfo nameMatch = null;
      if (infos != null)
      {
        for (Iterator<?> it = infos.iterator(); it.hasNext();)
        {
          BuilderPersistentInfo info = (BuilderPersistentInfo)it.next();
          String builderName = null;
          try
          {
            builderName = targetProj.getDescription().getBuildSpec()[0].getBuilderName();
          }
          catch (CoreException e)
          {
            e.printStackTrace();
          }
          if ((info.getBuilderName().equals(builderName)) && 
            (nameMatch == null)) {
            nameMatch = info;
          }
        }
        if (nameMatch != null) {
          oldTree = nameMatch.getLastBuiltTree();
        }
      }
    }
    return oldTree;
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.ProjectDirtyChecker
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon;

import java.io.File;
import java.io.IOException;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.FileInfoMatcherDescription;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceDescription;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.ide.misc.FileInfoAttributesMatcher;
import org.eclipse.ui.internal.ide.misc.FileInfoAttributesMatcher.Argument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.TizenPlatformConstants;
import org.tizen.common.TizenProjectType;
import org.tizen.common.util.AdapterUtil;
import org.tizen.common.util.FilenameUtil;
import org.tizen.common.util.PluginUtil;
import org.tizen.nativecommon.build.CommonConfigurationManager;
import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativecommon.build.exception.SBIException;
import org.tizen.nativecommon.build.model.SBIModel;
import org.tizen.nativecommon.launch.CppProjectLaunchCommand;
import org.tizen.nativecommon.launch.IProjectLaunchCommand;
import org.tizen.nativecommon.launch.LaunchUtils;
import org.tizen.nativecommon.launch.TizenLaunchMessages;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.service.SyncResult;
import org.tizen.sdblib.service.SyncService;

public class ProjectUtil
{
  private static Logger logger = LoggerFactory.getLogger(ProjectUtil.class);
  public static final String CRASH_DIRNAME = "crash-info";
  public static final String FILTER_TPK_DIRECTORY = "*/.tpk";
  
  private static IProject getProject(Object[] elements)
  {
    Object[] arrayOfObject = elements;int j = elements.length;
    for (int i = 0; i < j; i++)
    {
      Object element = arrayOfObject[i];
      if ((element instanceof IAdaptable))
      {
        IResource r = (IResource)((IAdaptable)element)
          .getAdapter(IResource.class);
        if (r != null) {
          return r.getProject();
        }
      }
    }
    return null;
  }
  
  public static IProject getProject(Object sourcePart, Object selection)
  {
    IProject tempProj = null;
    if ((selection instanceof IStructuredSelection)) {
      tempProj = getProject(((IStructuredSelection)selection).toArray());
    }
    if ((tempProj == null) && 
      ((sourcePart instanceof IEditorPart))) {
      tempProj = getProject(new Object[] {((IEditorPart)sourcePart)
        .getEditorInput() });
    }
    if (tempProj == null) {
      return null;
    }
    IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(tempProj);
    if (info != null) {
      return tempProj;
    }
    return null;
  }
  
  public static IProject getProject()
  {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (page == null) {
      return null;
    }
    IEditorPart editorPart = page.getActiveEditor();
    ISelection selection = page.getSelection();
    
    return getProject(editorPart, selection);
  }
  
  public static IProject getProject(ILaunchConfiguration config)
    throws CoreException
  {
    IProject proj = null;
    if (config != null)
    {
      String projectName = config.getAttribute("org.eclipse.cdt.launch.PROJECT_ATTR", "");
      if (!"".equals(projectName)) {
        proj = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
      }
    }
    return proj;
  }
  
  public static IProject getProject(String projectName)
  {
    IProject proj = null;
    if (projectName != null) {
      proj = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    }
    return proj;
  }
  
  public static String getArtefactName(IProject project)
  {
    IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
    if (buildInfo != null)
    {
      IConfiguration configuration = buildInfo.getDefaultConfiguration();
      String artifactName = null;
      if (configuration != null)
      {
        artifactName = configuration.getArtifactName();
        if ("${ProjName}".equals(artifactName)) {
          return project.getName();
        }
        return artifactName;
      }
    }
    return null;
  }
  
  public static IConfiguration getDefaultConfiguration(IProject project)
  {
    IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
    if (buildInfo != null) {
      return buildInfo.getDefaultConfiguration();
    }
    return null;
  }
  
  public static String getArtifactExtension(IProject project)
  {
    IConfiguration configuration = getDefaultConfiguration(project);
    if (configuration != null) {
      return configuration.getArtifactExtension();
    }
    return null;
  }
  
  public static String getBinaryPrefix(IProject project)
  {
    IConfiguration configuration = getDefaultConfiguration(project);
    if (configuration != null)
    {
      String ext = getArtifactExtension(project);
      return configuration.getOutputPrefix(ext);
    }
    return null;
  }
  
  public static String getBuildArchitecture(IProject project)
  {
    IConfiguration configuration = getDefaultConfiguration(project);
    if (configuration != null) {
      return CommonConfigurationManager.getArchitecture(configuration);
    }
    return null;
  }
  
  public static String getBinaryName(IProject project)
  {
    return getBinaryName(project, true);
  }
  
  public static String getBinaryName(IProject project, boolean includeExt)
  {
    String binary = getArtefactName(project);
    if (binary == null) {
      return null;
    }
    String ext = getArtifactExtension(project);
    if ((ext != null) && (includeExt)) {
      binary = binary.concat(".").concat(ext);
    }
    String prefix = getBinaryPrefix(project);
    if (prefix != null) {
      binary = prefix.concat(binary);
    }
    return binary;
  }
  
  public static String getExecutableName(ILaunchConfiguration config)
    throws CoreException
  {
    IPath exeFile = CDebugUtils.verifyProgramPath(config);
    String exename = null;
    exename = exeFile.toFile().getName();
    return exename;
  }
  
  public static void refreshResources(IProject project)
    throws CoreException
  {
    if (!project.isSynchronized(2)) {
      project.refreshLocal(2, null);
    }
  }
  
  public static String getProjectArtefactType(IProject project)
  {
    IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
    if (info == null) {
      return null;
    }
    IConfiguration cfg = info.getDefaultConfiguration();
    if (cfg == null) {
      return null;
    }
    IManagedProject managedProject = cfg.getManagedProject();
    if (managedProject == null) {
      return null;
    }
    IProjectType projectType = managedProject.getProjectType();
    if (projectType == null) {
      return null;
    }
    IBuildPropertyValue buildArtefactType = projectType.getBuildArtefactType();
    if (buildArtefactType == null) {
      return null;
    }
    return buildArtefactType.getId();
  }
  
  public static TizenProjectType getTizenProjectType(IProject project)
  {
    IProjectLaunchCommand manifest = getProjectManifest(project);
    if (manifest != null) {
      return manifest.getNativeProjectType();
    }
    return null;
  }
  
  public static IProjectLaunchCommand getProjectManifest(IProject project)
  {
    IProjectLaunchCommand manifest = null;
    
    manifest = (IProjectLaunchCommand)AdapterUtil.getAdapter(project, CppProjectLaunchCommand.class);
    
    return manifest;
  }
  
  public static boolean enableAutoBuild(boolean enable)
    throws CoreException
  {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription desc = workspace.getDescription();
    boolean isAutoBuilding = desc.isAutoBuilding();
    if (isAutoBuilding != enable)
    {
      desc.setAutoBuilding(enable);
      workspace.setDescription(desc);
    }
    return isAutoBuilding;
  }
  
  public static void enableProjectAutoBuild(IProject project, boolean enable)
    throws CoreException
  {
    IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
    IConfiguration cfg = info.getDefaultConfiguration();
    if (cfg == null) {
      return;
    }
    IBuilder bldr = cfg.getEditableBuilder();
    bldr.setAutoBuildEnable(enable);
    bldr.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, "all");
    ManagedBuildManager.saveBuildInfo(project, true);
  }
  
  public static IXMLStore getXmlStore(IProject project)
  {
    return getXmlStore(project, "org.tizen.nativecpp.misc.core.NewAppXmlStore");
  }
  
  private static IXMLStore getXmlStore(IProject project, String loadClassId)
  {
    IXMLStore xmlManager = null;
    try
    {
      xmlManager = (IXMLStore)PluginUtil.loadClass("org.tizen.nativecommon.store", loadClassId);
    }
    catch (CoreException e)
    {
      logger.error("Exception occurred while creating class (extension point: org.tizen.nativecommon.store, class ID: " + loadClassId, e);
    }
    xmlManager.setProject(project);
    xmlManager.loadXml();
    return xmlManager;
  }
  
  public static String getLaunchConfigurationName(IProject project)
  {
    String configName = project.getName();
    if (ManagedBuildManager.getBuildInfo(project) != null) {
      configName = NLS.bind(TizenLaunchMessages.TizenMainTab_Configuration_name, getArtefactName(project), getDefaultConfiguration(project));
    }
    return configName;
  }
  
  public static boolean isApplicationProject(IProject project)
  {
    TizenProjectType prjType = getTizenProjectType(project);
    return prjType == null ? false : prjType.isNativeApplicationProject();
  }
  
  public static boolean isSharedLibraryProject(IProject project)
  {
    TizenProjectType prjType = getTizenProjectType(project);
    return prjType == null ? false : prjType.isNativeSharedLibraryProject();
  }
  
  public static boolean isStaticLibraryProject(IProject project)
  {
    TizenProjectType prjType = getTizenProjectType(project);
    return prjType == null ? false : prjType.isNativeStaticLibraryProject();
  }
  
  public static boolean isDebuggableProject(IProject project)
  {
    TizenProjectType prjType = getTizenProjectType(project);
    return prjType == null ? false : prjType.isNativeDebuggableProject();
  }
  
  public static IProject searchProject(String appid)
  {
    IProject project = null;
    if (appid != null)
    {
      IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
      ApplicationConfiguration config = null;
      String tmpId = null;
      IProject[] arrayOfIProject1;
      int j = (arrayOfIProject1 = projects).length;
      for (int i = 0; i < j; i++)
      {
        IProject proj = arrayOfIProject1[i];
        config = new ApplicationConfiguration(proj);
        tmpId = config.getAppId();
        if (appid.equals(tmpId))
        {
          project = proj;
          break;
        }
        if (appid.equals(proj.getName()))
        {
          project = proj;
          break;
        }
      }
    }
    return project;
  }
  
  public static String pullCSFile(IDevice device, String remoteCSPath)
    throws CoreException, IOException
  {
    String appid = "";
    String csLocalPath = null;
    if (remoteCSPath != null)
    {
      String csFile = FilenameUtil.getFilename(remoteCSPath);
      appid = getAppId(csFile);
      if (appid != null)
      {
        IProject project = searchProject(appid);
        if (project != null)
        {
          IFolder folder = project.getFolder("crash-info");
          if (!folder.exists()) {
            folder.create(true, true, null);
          }
          String csLocalDirPath = folder.getLocation().toOSString();
          csLocalPath = csLocalDirPath + File.separatorChar + csFile;
          SyncResult result = device.getSyncService().pull(device.getFileEntry(remoteCSPath), csLocalDirPath);
          if (result.isOk())
          {
            refreshResources(project);
            logger.info("Downloaded cs file: " + csLocalPath);
          }
          else
          {
            logger.error("Failed to pull file: " + csFile);
          }
        }
        else
        {
          logger.error("Failed to search a project: " + appid);
        }
      }
      else
      {
        logger.error("Failed to get app id from file name: " + csFile);
      }
    }
    return csLocalPath;
  }
  
  public static String getAppId(String csPath)
  {
    String appid = null;
    if ((csPath != null) && 
      ("cs".equals(FilenameUtil.getExtension(csPath))))
    {
      int s = csPath.indexOf("_");
      if (s > 0)
      {
        appid = csPath.substring(0, s);
        if (appid != null)
        {
          s = appid.indexOf(".");
          if (s > 0) {
            appid = csPath.substring(0, s);
          } else if (s == 0) {
            appid = null;
          }
        }
      }
    }
    return appid;
  }
  
  public static String getAppId(IProject project)
  {
    IXMLStore xmlManager = getXmlStore(project);
    String appId = null;
    if (xmlManager != null) {
      appId = xmlManager.getXMLDataId();
    }
    return appId;
  }
  
  public static boolean addFilter(IProject project, String pattern)
  {
    if ((project == null) || (pattern == null)) {
      return false;
    }
    FileInfoAttributesMatcher.Argument argument = new FileInfoAttributesMatcher.Argument();
    key = FileInfoAttributesMatcher.KEY_PROPJECT_RELATIVE_PATH;
    operator = FileInfoAttributesMatcher.OPERATOR_MATCHES;
    pattern = pattern;
    int type = 26;
    
    FileInfoMatcherDescription matcherDes = new FileInfoMatcherDescription("org.eclipse.ui.ide.multiFilter", FileInfoAttributesMatcher.encodeArguments(argument));
    try
    {
      project.createFilter(type, matcherDes, 0, new NullProgressMonitor());
    }
    catch (CoreException e)
    {
      logger.error("Cannot add resource filter", e);
      return false;
    }
    return true;
  }
  
  public static String getPackageFileName(IProject project, String ext)
  {
    IXMLStore xmlStore = getXmlStore(project);
    
    String appId = xmlStore.getXMLDataId();
    
    String version = xmlStore.getVersion();
    
    IConfiguration config = getDefaultConfiguration(project);
    SmartBuildInterface sbi = SmartBuildInterface.getInstance(project);
    String targetId = CommonConfigurationManager.getBuildTargetName(config);
    try
    {
      arch = sbi.getRootstrapArchitecture(targetId);
    }
    catch (SBIException e)
    {
      String arch;
      logger.error("Cannot find architecture in targetId", e);
      return null;
    }
    String arch;
    return String.format("%s-%s-%s.%s", new Object[] { appId, version, SBIModel.getBaseArchName(arch), ext });
  }
  
  public static String getAppDirectory(IProject project, IDevice device)
  {
    String appId = getAppId(project);
    if (appId == null) {
      return "";
    }
    return device.getAppInstallPath() + "/" + appId;
  }
  
  public static String getAppTmpDirectory(IProject project, IDevice device)
  {
    IProjectLaunchCommand manifest = getProjectManifest(project);
    if (manifest == null) {
      return "";
    }
    return TizenPlatformConstants.getAppTmpDirectory(device) + "/" + manifest.getPackageName();
  }
  
  public static String getRootTmpDirectory(IProject project)
  {
    IProjectLaunchCommand manifest = getProjectManifest(project);
    if (manifest == null) {
      return "";
    }
    return TizenPlatformConstants.TEMPORARY_DIR_PATH + "/" + manifest.getPackageName();
  }
  
  public static File findPackageFile(IDevice currentDevice, File searchPath, String ext, IProject project)
  {
    String packageFileName = getPackageFileName(project, ext);
    if (packageFileName == null) {
      return null;
    }
    String arch_type = packageFileName.split("-")[2];
    String arch = arch_type.split("\\.")[0];
    if (!LaunchUtils.isSameArch(currentDevice, arch))
    {
      logger.error("Archtecture of %d and %s is not same", packageFileName, currentDevice.toString());
      return null;
    }
    String projectFullPath = "";
    try
    {
      projectFullPath = FilenameUtil.getCanonicalPath(project.getLocation().toFile()) + "/";
    }
    catch (IOException e)
    {
      logger.error("Failed to get project's canonical path", e);
      return null;
    }
    String packageFileFullPath = projectFullPath + getDefaultConfiguration(project).getName() + "/" + packageFileName;
    
    File packageFile = new File(packageFileFullPath);
    return packageFile.exists() ? packageFile : null;
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.ProjectUtil
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon;

public class TizenNativeException
  extends Exception
{
  private static final long serialVersionUID = 7613337471602038311L;
  
  public TizenNativeException() {}
  
  public TizenNativeException(String message)
  {
    super(message);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.TizenNativeException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;
import org.tizen.common.ITizenNativeProject;
import org.tizen.common.TizenProjectType;

public class TizenNativeProject
  implements ITizenNativeProject, IAdaptable
{
  private IProject project;
  
  public TizenNativeProject(IProject project)
  {
    this.project = project;
  }
  
  public Object getAdapter(Class adapter)
  {
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
  
  public String getAppId()
  {
    return ProjectUtil.getAppId(getProject());
  }
  
  public String getPackageId()
  {
    return null;
  }
  
  public TizenProjectType getTizenProjectType()
  {
    return ProjectUtil.getTizenProjectType(project);
  }
  
  public List<String> getBuildConfigurations()
  {
    List<String> list = new ArrayList();
    IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
    
    IConfiguration[] configs = info.getManagedProject().getConfigurations();
    IConfiguration[] arrayOfIConfiguration1;
    int j = (arrayOfIConfiguration1 = configs).length;
    for (int i = 0; i < j; i++)
    {
      IConfiguration config = arrayOfIConfiguration1[i];
      list.add(config.getName());
    }
    return list;
  }
  
  public String getDefaultBuildConfiguration()
  {
    return ProjectUtil.getDefaultConfiguration(project).getName();
  }
  
  protected IProject getProject()
  {
    return project;
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.TizenNativeProject
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdapterFactory;
import org.tizen.common.ITizenNativeProject;

public class TizenNativeProjectAdapterFactory
  implements IAdapterFactory
{
  public Object getAdapter(Object adaptableObject, Class adapterType)
  {
    if (adapterType == ITizenNativeProject.class) {
      return new TizenNativeProject((IProject)adaptableObject);
    }
    return null;
  }
  
  public Class[] getAdapterList()
  {
    return new Class[] { TizenNativeProject.class };
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.TizenNativeProjectAdapterFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon.apihover;

import org.eclipse.cdt.ui.text.ICCompletionProposal;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;

public class APIAssistCompletionProposal
  implements ICCompletionProposal, ICompletionProposalExtension2
{
  private ICCompletionProposal m_Parent;
  private int m_iRelevance;
  private String m_strIdString;
  
  APIAssistCompletionProposal(ICCompletionProposal Parent, int iRelevance)
  {
    m_Parent = Parent;
    m_iRelevance = iRelevance;
    generateIdString(Parent.getDisplayString());
  }
  
  APIAssistCompletionProposal(ICCompletionProposal Parent)
  {
    m_Parent = Parent;
    m_iRelevance = Parent.getRelevance();
    generateIdString(Parent.getDisplayString());
  }
  
  public String getIdString()
  {
    return m_strIdString;
  }
  
  public int getRelevance()
  {
    return m_iRelevance;
  }
  
  public void apply(IDocument document)
  {
    m_Parent.apply(document);
  }
  
  public String getAdditionalProposalInfo()
  {
    return m_Parent.getAdditionalProposalInfo();
  }
  
  public IContextInformation getContextInformation()
  {
    return m_Parent.getContextInformation();
  }
  
  public String getDisplayString()
  {
    return m_Parent.getDisplayString();
  }
  
  public Image getImage()
  {
    return m_Parent.getImage();
  }
  
  public Point getSelection(IDocument document)
  {
    return m_Parent.getSelection(document);
  }
  
  private void generateIdString(String displayString)
  {
    m_strIdString = new String();
    try
    {
      m_strIdString = displayString.substring(0, displayString.indexOf('('));
      m_strIdString = m_strIdString.trim();
      m_strIdString = m_strIdString.replace(" ", "");
    }
    catch (Exception localException)
    {
      m_strIdString = m_Parent.getIdString();
    }
  }
  
  public void apply(ITextViewer viewer, char trigger, int stateMask, int offset)
  {
    if ((m_Parent instanceof ICompletionProposalExtension2))
    {
      ICompletionProposalExtension2 p = (ICompletionProposalExtension2)m_Parent;
      p.apply(viewer, trigger, stateMask, offset);
    }
    else if ((m_Parent instanceof ICompletionProposalExtension))
    {
      ICompletionProposalExtension p = (ICompletionProposalExtension)m_Parent;
      IDocument document = viewer.getDocument();
      p.apply(document, trigger, offset);
    }
  }
  
  public void selected(ITextViewer viewer, boolean smartToggle)
  {
    if ((m_Parent instanceof ICompletionProposalExtension2))
    {
      ICompletionProposalExtension2 p = (ICompletionProposalExtension2)m_Parent;
      p.selected(viewer, smartToggle);
    }
  }
  
  public void unselected(ITextViewer viewer)
  {
    if ((m_Parent instanceof ICompletionProposalExtension2))
    {
      ICompletionProposalExtension2 p = (ICompletionProposalExtension2)m_Parent;
      p.unselected(viewer);
    }
  }
  
  public boolean validate(IDocument document, int offset, DocumentEvent event)
  {
    if ((m_Parent instanceof ICompletionProposalExtension2))
    {
      ICompletionProposalExtension2 p = (ICompletionProposalExtension2)m_Parent;
      return p.validate(document, offset, event);
    }
    if ((m_Parent instanceof ICompletionProposalExtension))
    {
      ICompletionProposalExtension p = (ICompletionProposalExtension)m_Parent;
      return p.isValidFor(document, offset);
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecommon.apihover.APIAssistCompletionProposal
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecommon.apihover;

import java.util.LinkedList;
import org.eclipse.cdt.internal.ui.text.contentassist.DefaultProposalFilter;
import org.eclipse.cdt.ui.text.ICCompletionProposal;

public class APIAssistProposalFilter
  extends DefaultProposalFilter
{
  private static ICCompletionProposal IncreaseProposalRelevance(DispStringAnalyzer dsa, ICCompletionProposal proposal)
  {
    String[] TypeNames = ContextAPIAssist.m_TypeNames;
    if (TypeNames == null) {
      return new APIAssistCompletionProposal(proposal);
    }
    if (7 != dsa.setFunctionDisplayString4Analysis(proposal.getDisplayString())) {
      return new APIAssistCompletionProposal(proposal);
    }
    for (int 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

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