org.tizen.nativecpp.apichecker.ui_2.0.0.201311042022

16:50:15.590 INFO  jd.cli.Main - Decompiling org.tizen.nativecpp.apichecker.ui_2.0.0.201311042022.jar
package org.tizen.nativecpp.apichecker.internal.ui;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;

public class APCUIActivator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.tizen.nativecpp.apichecker.ui";
  private static APCUIActivator plugin;
  private IPreferenceStore preferenceCoreStore;
  
  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 APCUIActivator getDefault()
  {
    return plugin;
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    return imageDescriptorFromPlugin("org.tizen.nativecpp.apichecker.ui", path);
  }
  
  public static void log(IStatus status)
  {
    getDefault().getLog().log(status);
  }
  
  public static void log(Throwable e)
  {
    log(new Status(4, "org.tizen.nativecpp.apichecker.ui", 1, "Internal Error", e));
  }
  
  public static void log(String message)
  {
    log(new Status(4, "org.tizen.nativecpp.apichecker.ui", 1, message, null));
  }
  
  public IPreferenceStore getCorePreferenceStore()
  {
    if (preferenceCoreStore == null) {
      preferenceCoreStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.tizen.nativecpp.apichecker.core");
    }
    return preferenceCoreStore;
  }
  
  public IPreferenceStore getPreferenceStore(IProject project)
  {
    ProjectScope ps = new ProjectScope(project);
    ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, "org.tizen.nativecpp.apichecker.ui");
    scoped.setSearchContexts(new IScopeContext[] { ps, InstanceScope.INSTANCE });
    return scoped;
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.APCUIActivator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui;

import org.eclipse.osgi.util.NLS;

public class UIMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.tizen.nativecpp.apichecker.internal.ui.messages";
  public static String Title_RunningAnalysis;
  public static String Title_Error;
  public static String Title_Warning;
  public static String Error_ApiListDoesNotExist;
  public static String Message_WaitingIndexing;
  public static String Properties_Launching;
  public static String Properties_LaunchingWithBuild;
  public static String Properties_LaunchingWhileEditing;
  public static String Properties_ApiCheck;
  public static String Properties_ApiCheck_PrivateApi;
  public static String Properties_ApiCheck_PartnerApi;
  public static String Properties_ApiCheck_IncompatibleApi;
  public static String Properties_ApiCheck_ApiVersion;
  public static String Properties_ApiCheck_DeprecatedApi;
  public static String Properties_ApiCheck_FinalApi;
  public static String Properties_PrivilegeCheck;
  public static String Properties_PrivilegeCheck_Undefined;
  public static String Properties_PrivilegeCheck_Unused;
  public static String Quickfix_UnusedPrivilege;
  public static String Quickfix_UndefinedPrivilege;
  public static String Message_for_OspCompatMode;
  public static String Message_Halt_for_OspCompatMode;
  
  static
  {
    NLS.initializeMessages("org.tizen.nativecpp.apichecker.internal.ui.messages", UIMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.UIMessages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.viewers.ISelection;

class APCheck$1
  extends CheckerJob
{
  APCheck$1(APCheck paramAPCheck, String $anonymous0, IProject $anonymous1, ISelection $anonymous2, boolean $anonymous3, boolean $anonymous4, String $anonymous5)
  {
    super($anonymous0, $anonymous1, $anonymous2, $anonymous3, $anonymous4, $anonymous5);
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    return super.run(monitor);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.APCheck.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.tizen.nativecpp.apichecker.core.utils.WorkspaceUtils;
import org.tizen.nativecpp.apichecker.internal.ui.APCUIActivator;
import org.tizen.nativecpp.apichecker.internal.ui.UIMessages;

public class APCheck
  implements IObjectActionDelegate
{
  private ISelection sel;
  private IProject prj;
  
  public void setActivePart(IAction action, IWorkbenchPart targetPart) {}
  
  public void run(IAction action)
  {
    Job job = new CheckerJob(UIMessages.Title_RunningAnalysis, prj, sel, true, true, WorkspaceUtils.getActiveId())
    {
      protected IStatus run(IProgressMonitor monitor)
      {
        return super.run(monitor);
      }
    };
    job.setUser(true);
    job.schedule();
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    sel = selection;
    if ((selection instanceof ITextSelection))
    {
      IWorkbenchWindow activeWW = APCUIActivator.getDefault().getWorkbench()
        .getActiveWorkbenchWindow();
      IProject activeProject = null;
      if (activeWW != null)
      {
        IWorkbenchPage activeP = activeWW.getActivePage();
        if (activeP != null)
        {
          IEditorPart ep = activeP.getActiveEditor();
          if (ep != null)
          {
            IEditorInput ei = ep.getEditorInput();
            if ((ei != null) && 
              ((ei instanceof IFileEditorInput))) {
              activeProject = 
                ((IFileEditorInput)ei).getFile().getProject();
            }
          }
        }
      }
      if (activeProject != null) {
        prj = activeProject;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.APCheck
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.viewers.ISelection;

class ApiCheck$1
  extends CheckerJob
{
  ApiCheck$1(ApiCheck paramApiCheck, String $anonymous0, IProject $anonymous1, ISelection $anonymous2, boolean $anonymous3, boolean $anonymous4, String $anonymous5)
  {
    super($anonymous0, $anonymous1, $anonymous2, $anonymous3, $anonymous4, $anonymous5);
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    return super.run(monitor);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.ApiCheck.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.tizen.nativecpp.apichecker.core.utils.WorkspaceUtils;
import org.tizen.nativecpp.apichecker.internal.ui.APCUIActivator;
import org.tizen.nativecpp.apichecker.internal.ui.UIMessages;

public class ApiCheck
  implements IObjectActionDelegate
{
  private ISelection sel;
  private IProject prj;
  
  public void setActivePart(IAction action, IWorkbenchPart targetPart) {}
  
  public void run(IAction action)
  {
    Job job = new CheckerJob(UIMessages.Title_RunningAnalysis, prj, sel, true, false, WorkspaceUtils.getActiveId())
    {
      protected IStatus run(IProgressMonitor monitor)
      {
        return super.run(monitor);
      }
    };
    job.setUser(true);
    job.schedule();
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    sel = selection;
    if ((selection instanceof ITextSelection))
    {
      IWorkbenchWindow activeWW = APCUIActivator.getDefault().getWorkbench().getActiveWorkbenchWindow();
      IProject activeProject = null;
      if (activeWW != null)
      {
        IWorkbenchPage activeP = activeWW.getActivePage();
        if (activeP != null)
        {
          IEditorPart ep = activeP.getActiveEditor();
          if (ep != null)
          {
            IEditorInput ei = ep.getEditorInput();
            if ((ei != null) && 
              ((ei instanceof IFileEditorInput))) {
              activeProject = 
                ((IFileEditorInput)ei).getFile().getProject();
            }
          }
        }
      }
      if (activeProject != null) {
        prj = activeProject;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.ApiCheck
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.tizen.nativecpp.apichecker.internal.ui.UIMessages;

class CheckerJob$1
  implements Runnable
{
  CheckerJob$1(CheckerJob paramCheckerJob, Shell paramShell, String paramString) {}
  
  public synchronized void run()
  {
    MessageBox dialog = new MessageBox(val$shell, 2);
    dialog.setText(val$projectName);
    dialog.setMessage(UIMessages.Message_for_OspCompatMode);
    dialog.open();
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.CheckerJob.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import org.eclipse.jface.dialogs.MessageDialog;
import org.tizen.nativecpp.apichecker.internal.ui.UIMessages;

class CheckerJob$2
  implements Runnable
{
  CheckerJob$2(CheckerJob paramCheckerJob) {}
  
  public synchronized void run()
  {
    MessageDialog.openWarning(null, UIMessages.Title_Warning, UIMessages.Message_WaitingIndexing);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.CheckerJob.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import org.eclipse.jface.dialogs.MessageDialog;
import org.tizen.nativecpp.apichecker.internal.ui.UIMessages;

class CheckerJob$3
  implements Runnable
{
  CheckerJob$3(CheckerJob paramCheckerJob) {}
  
  public synchronized void run()
  {
    MessageDialog.openError(null, UIMessages.Title_Error, UIMessages.Error_ApiListDoesNotExist);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.CheckerJob.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICContainer;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.tizen.nativecpp.apichecker.core.APCManager;
import org.tizen.nativecpp.apichecker.core.APCRuntime;
import org.tizen.nativecpp.apichecker.core.IBuilder;
import org.tizen.nativecpp.apichecker.core.model.UnusedPrivileges;
import org.tizen.nativecpp.apichecker.core.utils.CheckerUtils;
import org.tizen.nativecpp.apichecker.core.utils.ReporterOfUnusedPrivileges;
import org.tizen.nativecpp.apichecker.core.utils.WorkspaceUtils;
import org.tizen.nativecpp.apichecker.internal.ui.UIMessages;
import org.tizen.nativecpp.misc.core.NewAppXmlStore;
import org.tizen.nativecpp.misc.core.TizenManifestModel;

public abstract class CheckerJob
  extends Job
{
  private ISelection sel;
  private IProject prj;
  private boolean doApiCheck;
  private boolean doPrivilegeCheck;
  private String viewId;
  
  public CheckerJob(String name, IProject prj, ISelection sel, boolean doApiCheck, boolean doPrivilegeCheck, String viewId)
  {
    super(name);
    this.prj = prj;
    this.sel = sel;
    this.doApiCheck = doApiCheck;
    this.doPrivilegeCheck = doPrivilegeCheck;
    if (viewId != null) {
      this.viewId = viewId;
    } else {
      this.viewId = "org.eclipse.ui.views.ProblemView";
    }
  }
  
  private boolean isOspCompatProject(IProject project)
  {
    NewAppXmlStore appXmlStore = new NewAppXmlStore(project);
    appXmlStore.loadXml();
    boolean isOspCompatMode = appXmlStore.getModel().getOspCompat();
    if (isOspCompatMode)
    {
      final String projectName = project.getName();
      IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
      if (window == null)
      {
        IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
        window = windows[0];
      }
      final Shell shell = window.getShell();
      
      Display.getDefault().syncExec(new Runnable()
      {
        public synchronized void run()
        {
          MessageBox dialog = new MessageBox(shell, 2);
          dialog.setText(projectName);
          dialog.setMessage(UIMessages.Message_for_OspCompatMode);
          dialog.open();
        }
      });
      return true;
    }
    return false;
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    IProject project = null;
    
    Set<String> enabledCheckers = new HashSet();
    if (doApiCheck) {
      enabledCheckers.addAll(CheckerUtils.getAllApiCheckerIDs());
    }
    if (doPrivilegeCheck)
    {
      enabledCheckers.add("org.tizen.nativecpp.apichecker.internal.checkers.UndefinedPrivilegeProblem");
      
      APCManager.getInstance().enableUnusedPrivilegeCheck();
    }
    try
    {
      IStatus localIStatus;
      if (((sel instanceof IStructuredSelection)) && (((IStructuredSelection)sel).size() > 0))
      {
        IStructuredSelection ss = (IStructuredSelection)sel;
        int count = ss.size();
        monitor.beginTask(getName(), count * 100);
        for (Iterator iterator = ss.iterator(); iterator.hasNext();)
        {
          Object obj = iterator.next();
          if (monitor.isCanceled()) {
            return Status.CANCEL_STATUS;
          }
          if (((obj instanceof IProject)) || ((obj instanceof ICContainer)))
          {
            IResource targetRes = null;
            if ((obj instanceof IProject))
            {
              project = (IProject)obj;
              targetRes = (IResource)obj;
              if (doPrivilegeCheck) {
                enabledCheckers.add("org.tizen.nativecpp.apichecker.internal.checkers.UnusedPrivilegeProblem");
              }
            }
            else
            {
              project = ((ICContainer)obj).getCProject().getProject();
              targetRes = ((ICContainer)obj).getResource();
            }
            boolean isProjectIndexed = CCorePlugin.getIndexManager().isProjectIndexed(CoreModel.getDefault().create(project));
            if (isProjectIndexed)
            {
              SubProgressMonitor subMon = new SubProgressMonitor(monitor, 100);
              
              UnusedPrivileges newUnusedPrivs = null;
              if ((doPrivilegeCheck) && 
                (enabledCheckers.contains("org.tizen.nativecpp.apichecker.internal.checkers.UnusedPrivilegeProblem")))
              {
                newUnusedPrivs = new UnusedPrivileges(project);
                APCManager.getInstance().putUnusedPrivileges(project, newUnusedPrivs);
              }
              ReporterOfUnusedPrivileges.clearPrivilegeMarkers(project);
              
              APCRuntime.getInstance().getBuilder().processResource(targetRes, enabledCheckers, subMon);
              if ((doPrivilegeCheck) && 
                (enabledCheckers.contains("org.tizen.nativecpp.apichecker.internal.checkers.UnusedPrivilegeProblem")) && (!monitor.isCanceled())) {
                ReporterOfUnusedPrivileges.reportProblems(targetRes, newUnusedPrivs);
              }
              if (subMon.isCanceled()) {
                return Status.CANCEL_STATUS;
              }
            }
          }
          else if ((obj instanceof ITranslationUnit))
          {
            ITranslationUnit tu = (ITranslationUnit)obj;
            project = tu.getCProject().getProject();
            IResource targetRes = tu.getResource();
            if (CCorePlugin.getIndexManager().isProjectIndexed(tu.getCProject()))
            {
              SubProgressMonitor subMon = new SubProgressMonitor(monitor, 100);
              
              enabledCheckers.remove("org.tizen.nativecpp.apichecker.internal.checkers.UnusedPrivilegeProblem");
              
              APCRuntime.getInstance().getBuilder().processResource(targetRes, enabledCheckers, subMon);
              if (subMon.isCanceled()) {
                return Status.CANCEL_STATUS;
              }
            }
          }
          if (monitor.isCanceled()) {
            return Status.CANCEL_STATUS;
          }
        }
      }
      else
      {
        monitor.beginTask(getName(), 100);
        if ((prj != null) && (CCorePlugin.getIndexManager().isProjectIndexed(CoreModel.getDefault().create(prj))))
        {
          IResource res = prj;
          UnusedPrivileges newUnusedPrivs = null;
          if (doPrivilegeCheck)
          {
            ReporterOfUnusedPrivileges.clearPrivilegeMarkers(prj);
            
            newUnusedPrivs = new UnusedPrivileges(prj);
            APCManager.getInstance().putUnusedPrivileges(prj, newUnusedPrivs);
            
            enabledCheckers.add("org.tizen.nativecpp.apichecker.internal.checkers.UnusedPrivilegeProblem");
          }
          APCRuntime.getInstance().getBuilder().processResource(res, enabledCheckers, monitor);
          if (monitor.isCanceled()) {
            return Status.CANCEL_STATUS;
          }
          if (doPrivilegeCheck) {
            ReporterOfUnusedPrivileges.reportProblems(res, newUnusedPrivs);
          }
        }
      }
    }
    finally
    {
      APCManager.getInstance().disableUnusedPrivilegeCheck();
    }
    APCManager.getInstance().disableUnusedPrivilegeCheck();
    
    WorkspaceUtils.showView("org.eclipse.ui.views.ProblemView");
    WorkspaceUtils.showView(viewId);
    
    return Status.OK_STATUS;
  }
  
  public boolean shouldSchedule()
  {
    if (!CCorePlugin.getIndexManager().isIndexerIdle())
    {
      Display.getDefault().syncExec(new Runnable()
      {
        public synchronized void run()
        {
          MessageDialog.openWarning(null, UIMessages.Title_Warning, UIMessages.Message_WaitingIndexing);
        }
      });
      return false;
    }
    if (!APCManager.getInstance().hasXMLs())
    {
      Display.getDefault().syncExec(new Runnable()
      {
        public synchronized void run()
        {
          MessageDialog.openError(null, UIMessages.Title_Error, UIMessages.Error_ApiListDoesNotExist);
        }
      });
      return false;
    }
    if (((sel instanceof IStructuredSelection)) && (((IStructuredSelection)sel).size() > 0))
    {
      IStructuredSelection ss = (IStructuredSelection)sel;
      
      Iterator iterator = ss.iterator();
      while (
        iterator.hasNext())
      {
        Object obj = iterator.next();
        if ((obj instanceof IProject))
        {
          if (isOspCompatProject((IProject)obj)) {
            return false;
          }
        }
        else if ((obj instanceof ICContainer))
        {
          if (isOspCompatProject(((ICContainer)obj).getCProject().getProject())) {
            return false;
          }
        }
        else if ((obj instanceof ITranslationUnit))
        {
          ITranslationUnit tu = (ITranslationUnit)obj;
          if (isOspCompatProject(tu.getCProject().getProject())) {
            return false;
          }
        }
      }
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.CheckerJob
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.viewers.ISelection;

class PrivilegeCheck$1
  extends CheckerJob
{
  PrivilegeCheck$1(PrivilegeCheck paramPrivilegeCheck, String $anonymous0, IProject $anonymous1, ISelection $anonymous2, boolean $anonymous3, boolean $anonymous4, String $anonymous5)
  {
    super($anonymous0, $anonymous1, $anonymous2, $anonymous3, $anonymous4, $anonymous5);
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    return super.run(monitor);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.PrivilegeCheck.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.actions;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.tizen.nativecpp.apichecker.core.utils.WorkspaceUtils;
import org.tizen.nativecpp.apichecker.internal.ui.APCUIActivator;
import org.tizen.nativecpp.apichecker.internal.ui.UIMessages;

public class PrivilegeCheck
  implements IObjectActionDelegate
{
  private ISelection sel;
  private IProject prj;
  
  public void setActivePart(IAction action, IWorkbenchPart targetPart) {}
  
  public void run(IAction action)
  {
    Job job = new CheckerJob(UIMessages.Title_RunningAnalysis, prj, sel, false, true, WorkspaceUtils.getActiveId())
    {
      protected IStatus run(IProgressMonitor monitor)
      {
        return super.run(monitor);
      }
    };
    job.setUser(true);
    job.schedule();
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    sel = selection;
    if ((selection instanceof ITextSelection))
    {
      IWorkbenchWindow activeWW = APCUIActivator.getDefault().getWorkbench().getActiveWorkbenchWindow();
      IProject activeProject = null;
      if (activeWW != null)
      {
        IWorkbenchPage activeP = activeWW.getActivePage();
        if (activeP != null)
        {
          IEditorPart ep = activeP.getActiveEditor();
          if (ep != null)
          {
            IEditorInput ei = ep.getEditorInput();
            if ((ei != null) && 
              ((ei instanceof IFileEditorInput))) {
              activeProject = 
                ((IFileEditorInput)ei).getFile().getProject();
            }
          }
        }
      }
      if (activeProject != null) {
        prj = activeProject;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.actions.PrivilegeCheck
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.properties;

import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.dialogs.PropertyPage;
import org.tizen.nativecpp.apichecker.core.xmlstore.CheckerPropertyStore;
import org.tizen.nativecpp.apichecker.internal.ui.UIMessages;
import org.tizen.nativecpp.misc.core.NewAppXmlStore;
import org.tizen.nativecpp.misc.core.TizenManifestModel;

public class APCPropertyPage
  extends PropertyPage
{
  private Group fLaunchingGroup;
  private Button fLaunchingWithBuildButton;
  private Button fLaunchingWhileEditingButton;
  private Group fApiCheckGroup;
  private Button fIncompatibleApiCheckButton;
  private Button fApiVersionCheckButton;
  private Button fDeprecatedApiCheckButton;
  private Button fFinalApiCheckButton;
  private Group fPrivilegeCheckGroup;
  private Button fUndefinedPrivilegeCheckButton;
  private Button fUnusedPrivilegeCheckButton;
  private boolean isOspCompatMode;
  
  public APCPropertyPage()
  {
    noDefaultAndApplyButton();
  }
  
  protected Control createContents(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setFont(parent.getFont());
    
    GridLayout layout = new GridLayout();
    numColumns = 1;
    verticalSpacing = 10;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(1808));
    
    NewAppXmlStore appXmlStore = new NewAppXmlStore(getProject());
    appXmlStore.loadXml();
    isOspCompatMode = appXmlStore.getModel().getOspCompat();
    if (isOspCompatMode)
    {
      Label sysrootLabel = new Label(composite, 0);
      sysrootLabel.setText(UIMessages.Message_for_OspCompatMode);
      sysrootLabel.setLayoutData(new GridData());
    }
    else
    {
      fLaunchingGroup = new Group(composite, 0);
      layout = new GridLayout(1, false);
      verticalSpacing = 5;
      marginHeight = 5;
      fLaunchingGroup.setLayout(layout);
      GridData gd = new GridData(768);
      fLaunchingGroup.setLayoutData(gd);
      fLaunchingGroup.setText(UIMessages.Properties_Launching);
      
      fLaunchingWithBuildButton = new Button(fLaunchingGroup, 32);
      fLaunchingWithBuildButton.setText(UIMessages.Properties_LaunchingWithBuild);
      fLaunchingWithBuildButton.setLayoutData(new GridData(768));
      
      fLaunchingWhileEditingButton = new Button(fLaunchingGroup, 32);
      fLaunchingWhileEditingButton.setText(UIMessages.Properties_LaunchingWhileEditing);
      fLaunchingWhileEditingButton.setLayoutData(new GridData(768));
      
      fApiCheckGroup = new Group(composite, 0);
      layout = new GridLayout(1, false);
      fApiCheckGroup.setLayout(layout);
      gd = new GridData(768);
      fApiCheckGroup.setLayoutData(gd);
      fApiCheckGroup.setText(UIMessages.Properties_ApiCheck);
      
      fIncompatibleApiCheckButton = new Button(fApiCheckGroup, 32);
      fIncompatibleApiCheckButton.setText(UIMessages.Properties_ApiCheck_IncompatibleApi);
      fIncompatibleApiCheckButton.setLayoutData(new GridData(768));
      
      fApiVersionCheckButton = new Button(fApiCheckGroup, 32);
      fApiVersionCheckButton.setText(UIMessages.Properties_ApiCheck_ApiVersion);
      fApiVersionCheckButton.setLayoutData(new GridData(768));
      
      fDeprecatedApiCheckButton = new Button(fApiCheckGroup, 32);
      fDeprecatedApiCheckButton.setText(UIMessages.Properties_ApiCheck_DeprecatedApi);
      fDeprecatedApiCheckButton.setLayoutData(new GridData(768));
      
      fFinalApiCheckButton = new Button(fApiCheckGroup, 32);
      fFinalApiCheckButton.setText(UIMessages.Properties_ApiCheck_FinalApi);
      fFinalApiCheckButton.setLayoutData(new GridData(768));
      
      fPrivilegeCheckGroup = new Group(composite, 0);
      layout = new GridLayout(1, false);
      fPrivilegeCheckGroup.setLayout(layout);
      gd = new GridData(768);
      fPrivilegeCheckGroup.setLayoutData(gd);
      fPrivilegeCheckGroup.setText(UIMessages.Properties_PrivilegeCheck);
      
      fUndefinedPrivilegeCheckButton = new Button(fPrivilegeCheckGroup, 32);
      fUndefinedPrivilegeCheckButton.setText(UIMessages.Properties_PrivilegeCheck_Undefined);
      fUndefinedPrivilegeCheckButton.setLayoutData(new GridData(768));
      
      fUnusedPrivilegeCheckButton = new Button(fPrivilegeCheckGroup, 32);
      fUnusedPrivilegeCheckButton.setText(UIMessages.Properties_PrivilegeCheck_Unused);
      fUnusedPrivilegeCheckButton.setLayoutData(new GridData(768));
      
      loadData();
    }
    return null;
  }
  
  protected void loadData()
  {
    CheckerPropertyStore store = new CheckerPropertyStore(getProject());
    
    fLaunchingWithBuildButton.setSelection(store.doesCheckerLaunchWithBuild());
    fLaunchingWhileEditingButton.setSelection(store.doesCheckerLaunchWhileEditing());
    
    fIncompatibleApiCheckButton.setSelection(store.isIncompatibleApiCheckerEnabled());
    fApiVersionCheckButton.setSelection(store.isApiVersionCheckerEnabled());
    fDeprecatedApiCheckButton.setSelection(store.isDeprecatedApiCheckerEnabled());
    fFinalApiCheckButton.setSelection(store.isFinalApiCheckerEnabled());
    
    fUndefinedPrivilegeCheckButton.setSelection(store.isUndefinedPrivilegeCheckerEnabled());
    fUnusedPrivilegeCheckButton.setSelection(store.isUnusedPrivilegeCheckerEnabled());
  }
  
  protected boolean storeData()
  {
    if (isOspCompatMode) {
      return true;
    }
    CheckerPropertyStore store = new CheckerPropertyStore(getProject());
    if (fLaunchingWithBuildButton.getSelection()) {
      store.setCheckerLaunchWithBuild(true);
    } else {
      store.setCheckerLaunchWithBuild(false);
    }
    if (fLaunchingWhileEditingButton.getSelection()) {
      store.setCheckerLaunchWhileEditing(true);
    } else {
      store.setCheckerLaunchWhileEditing(false);
    }
    if (fIncompatibleApiCheckButton.getSelection()) {
      store.setIncompatibleApiCheckerEnabled(true);
    } else {
      store.setIncompatibleApiCheckerEnabled(false);
    }
    if (fApiVersionCheckButton.getSelection()) {
      store.setApiVersionCheckerEnabled(true);
    } else {
      store.setApiVersionCheckerEnabled(false);
    }
    if (fDeprecatedApiCheckButton.getSelection()) {
      store.setDeprecatedApiCheckerEnabled(true);
    } else {
      store.setDeprecatedApiCheckerEnabled(false);
    }
    if (fFinalApiCheckButton.getSelection()) {
      store.setFinalApiCheckerEnabled(true);
    } else {
      store.setFinalApiCheckerEnabled(false);
    }
    if (fUndefinedPrivilegeCheckButton.getSelection()) {
      store.setUndefinedPrivilegeCheckerEnabled(true);
    } else {
      store.setUndefinedPrivilegeCheckerEnabled(false);
    }
    if (fUnusedPrivilegeCheckButton.getSelection()) {
      store.setUnusedPrivilegeCheckerEnabled(true);
    } else {
      store.setUnusedPrivilegeCheckerEnabled(false);
    }
    return store.store();
  }
  
  public IProject getProject()
  {
    Object element = getElement();
    if (element != null)
    {
      if ((element instanceof IProject))
      {
        IResource f = (IResource)element;
        return f.getProject();
      }
      if ((element instanceof ICProject)) {
        return ((ICProject)element).getProject();
      }
    }
    return null;
  }
  
  public void performApply()
  {
    storeData();
  }
  
  public boolean performOk()
  {
    return storeData();
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativecpp.apichecker.internal.ui.properties.APCPropertyPage
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativecpp.apichecker.internal.ui.quickfix;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.tizen.nativecpp.apichecker.internal.ui.UIMessages;
import org.tizen.nativecpp.misc.core.NewAppXmlStore;
import org.tizen.nativecpp.misc.core.TizenManifestModel;
import org.tizen.nativecpp.misc.editor.ManifestEditor;
import org.tizen.nativecpp.misc.editor.PrivilegePage;

public class QuickFixForUndefinedPrivilege
  implements IMarkerResolution
{
  private String label;
  private String privilege;
  
  public QuickFixForUndefinedPrivilege(String privilege)
  {
    if (privilege == null) {
      return;
    }
    this.privilege = privilege;
    label = NLS.bind(UIMessages.Quickfix_UndefinedPrivilege, privilege);
  }
  
  public String getLabel()
  {
    return label;
  }
  
  public void run(IMarker marker)
  {
    boolean result = true;
    IProject prj = null;
    if ((marker.getResource() instanceof IFile))
    {
      IFile file = (IFile)marker.getResource();
      prj = file.getProject();
    }
    else if ((marker.getResource() instanceof IProject))
    {
      prj = (IProject)marker.getResource();
    }
    else
    {
      result = false;
      MessageDialog.openError(null, "Quick Fix for Undefined Privilege", 
        "Wrong project");
    }
    if ((result) && (prj != null))
    {
      boolean isManifestEditorOpened = false;
      
      List<String> privileges = null;
      if (privilege.contains(" and "))
      {
        privileges = new ArrayList();
        StringTokenizer tokenizer = new StringTokenizer(privilege, " ,");
        while (tokenizer.hasMoreTokens())
        {
          String token = tokenizer.nextToken().trim();
          if (!token.equals("and")) {
            privileges.add(token);
          }
        }
      }
      IWorkbench workbench = PlatformUI.getWorkbench();
      IWorkbenchWindow active = workbench.getActiveWorkbenchWindow();
      Object localObject;
      int j;
      int i;
      if (active != null)
      {
        IWorkbenchPage[] pages = active.getPages();
        j = (localObject = pages).length;
        for (i = 0; i < j; i++)
        {
          IWorkbenchPage page = localObject[i];
          if (page != null)
          {
            IEditorReference[] editorRefs = page.getEditorReferences();
            IEditorReference[] arrayOfIEditorReference1;
            int m = (arrayOfIEditorReference1 = editorRefs).length;
            for (int k = 0; k < m; k++)
            {
              IEditorReference editorRef = arrayOfIEditorReference1[k];
              String editorId = editorRef.getId();
              if (editorId.equals("org.tizen.nativecpp.misc.ManifestEditor"))
              {
                IEditorPart editorPart = editorRef.getEditor(true);
                
                ManifestEditor manifestEditor = (ManifestEditor)editorPart;
                
                IProject ePrj = manifestEditor.getProject();
                if ((ePrj != null) && (prj.getName().equals(ePrj.getName())))
                {
                  if (privileges == null)
                  {
                    manifestEditor.getModel().addPrivilege(privilege);
                    manifestEditor.getPrivilegePage().firePrivilegeAdded(privilege);
                  }
                  else
                  {
                    for (int i = 0; i < privileges.size(); i++)
                    {
                      manifestEditor.getModel().addPrivilege((String)privileges.get(i));
                      manifestEditor.getPrivilegePage().firePrivilegeAdded((String)privileges.get(i));
                    }
                  }
                  manifestEditor.getPrivilegePage().update(manifestEditor.getModel());
                  manifestEditor.getPrivilegePage().setDirty(true);
                  manifestEditor.doSave(null);
                  
                  isManifestEditorOpened = true;
                }
              }
            }
          }
        }
      }
      if (!isManifestEditorOpened)
      {
        NewAppXmlStore appXmlStore = new NewAppXmlStore(prj);
        appXmlStore.loadXml();
        if (privileges == null) {
          appXmlStore.getModel().addPrivilege(privilege);
        } else {
          for (int i = 0; i < privileges.size(); i++) {
            appXmlStore.getModel().addPrivilege((String)privileges.get(i));
          }
        }
        appXmlStore.storeXml();
      }
      try
      {
        marker.delete();
      }
      catch (CoreException e)
      {
        e.printStackTrace();
      }
      IMarker[] markers = (IMarker[])null;
      try
      {
        markers = prj.findMarkers("org.eclipse.core.resources.problemmarker", true, 2);
        if (markers != null)
        {
          j = (localObject = markers).length;
          for (i = 0; i < j; i++)
          {
            IMarker testMarker = localObject[i];
            if (testMarker != null)
            {
              String type = testMarker.getType();
              if ((type != null) && (type.equals("org.tizen.nativecpp.apichecker.core.UndefinedPrivilegeProblem")))
              {
                String testPrivilege = (String)testMarker.getAttribute("privilege");
                if (privileges == null)
                {
                  if (testPrivilege.equals(privilege)) {
                    testMarker.delete();
                  }
                }
                else {
                  for (int i = 0; i < privileges.size(); i++) {
                    if (testPrivilege.equals(privileges.get(i))) {
                      testMarker.delete();
                    }
                  }
                }
              }
            }
          }
        }
      }
    
1 2

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