org.tizen.nativeappcommon_2.0.0.201310101542

16:50:12.689 INFO  jd.cli.Main - Decompiling org.tizen.nativeappcommon_2.0.0.201310101542.jar
package org.tizen.nativeappcommon;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;

class Activator$1
  implements Runnable
{
  Activator$1(Activator paramActivator, String paramString, IStatus paramIStatus) {}
  
  public void run()
  {
    IWorkbenchWindow window = null;
    if (Activator.access$0() != null) {
      window = Activator.access$0().getWorkbench().getActiveWorkbenchWindow();
    }
    Shell shell = null;
    if (window != null) {
      shell = window.getShell();
    }
    ErrorDialog.openError(shell, "Error", val$mainMessage, val$status);
  }
}

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

import java.io.PrintStream;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.tizen.nativeappcommon.contentassist.AutoRefreshProvider;
import org.tizen.nativeappcommon.contentassist.RefreshResult;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.tizen.nativeappcommon";
  private static Activator plugin;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
    
    activateAutoRefreshProvider();
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static Activator getDefault()
  {
    return plugin;
  }
  
  private void activateAutoRefreshProvider()
  {
    if (new AutoRefreshProvider().installMonitor(
      ResourcesPlugin.getWorkspace().getRoot(), new RefreshResult()) == null)
    {
      logAndDisplayError("Cannot set auto refresh mode for Workspace: " + 
        ResourcesPlugin.getWorkspace().getRoot(), null);
      return;
    }
  }
  
  public void logAndDisplayError(String message, Exception e)
  {
    logError(message, e);
    displayError(message, e);
  }
  
  public void logError(String mainMessage, Exception exception)
  {
    log(4, mainMessage, exception);
  }
  
  public void displayError(final String mainMessage, Exception exception)
  {
    IStatus status;
    final IStatus status;
    if ((mainMessage == null) && ((exception instanceof CoreException))) {
      status = ((CoreException)exception).getStatus();
    } else {
      status = createStatus(4, exception == null ? mainMessage : null, exception);
    }
    Runnable runnable = new Runnable()
    {
      public void run()
      {
        IWorkbenchWindow window = null;
        if (Activator.plugin != null) {
          window = Activator.plugin.getWorkbench().getActiveWorkbenchWindow();
        }
        Shell shell = null;
        if (window != null) {
          shell = window.getShell();
        }
        ErrorDialog.openError(shell, "Error", mainMessage, status);
      }
    };
    if (plugin != null) {
      plugin.getWorkbench().getDisplay().syncExec(runnable);
    } else {
      runnable.run();
    }
  }
  
  public void log(int severity, String mainMessage, Exception exception)
  {
    IStatus status;
    IStatus status;
    if ((mainMessage == null) && ((exception instanceof CoreException))) {
      status = ((CoreException)exception).getStatus();
    } else {
      status = createStatus(severity, mainMessage, exception);
    }
    if (plugin != null) {
      plugin.getLog().log(status);
    } else {
      System.err.println(status.toString());
    }
  }
  
  private IStatus createStatus(int severity, String mainMessage, Exception exception)
  {
    IStatus status = new Status(severity, "org.tizen.nativeappcommon", 0, 
      mainMessage != null ? mainMessage : exception.getMessage(), 
      exception);
    return status;
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.refresh.IRefreshMonitor;
import org.eclipse.core.resources.refresh.IRefreshResult;
import org.eclipse.core.resources.refresh.RefreshProvider;

public class AutoRefreshProvider
  extends RefreshProvider
{
  public IRefreshMonitor installMonitor(IResource resource, IRefreshResult result)
  {
    return createPollingMonitor(resource);
  }
}

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

import org.eclipse.swt.events.VerifyEvent;

public abstract interface ISLPKeyListener
{
  public abstract void verifyKey(VerifyEvent paramVerifyEvent);
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.refresh.IRefreshMonitor;
import org.eclipse.core.resources.refresh.IRefreshResult;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.tizen.nativeappcommon.Activator;

public class RefreshResult
  implements IRefreshResult
{
  public void monitorFailed(IRefreshMonitor monitor, IResource resource)
  {
    monitor.unmonitor(resource);
    Activator.getDefault().logAndDisplayError("No auto refresh possible for resource: " + resource.getFullPath().toOSString(), null);
  }
  
  public void refresh(IResource resource)
  {
    try
    {
      resource.refreshLocal(1, null);
    }
    catch (CoreException localCoreException)
    {
      Activator.getDefault().logAndDisplayError("No auto refresh possible for resource: " + resource.getFullPath().toOSString(), null);
    }
  }
}

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

import org.eclipse.jface.text.ITextOperationTarget;
import org.eclipse.jface.text.source.ISourceViewer;

class SLPCEditor$SLPVerifyKeyListener$1
  extends Thread
{
  SLPCEditor$SLPVerifyKeyListener$1(SLPCEditor.SLPVerifyKeyListener paramSLPVerifyKeyListener) {}
  
  public void run()
  {
    try
    {
      sleep(200L);
    }
    catch (InterruptedException e)
    {
      e.printStackTrace();
    }
    SLPCEditor.access$0(SLPCEditor.SLPVerifyKeyListener.access$0(this$1)).getTextOperationTarget().doOperation(13);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.contentassist.SLPCEditor.SLPVerifyKeyListener.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.contentassist;

import org.eclipse.jface.text.ITextOperationTarget;
import org.eclipse.jface.text.ITextViewerExtension;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.widgets.Display;

class SLPCEditor$SLPVerifyKeyListener
  implements VerifyKeyListener
{
  private boolean fIsInstalled = false;
  private SLPKeyVerifier fSLPKeyVerifier;
  private String sPartitioningType;
  
  SLPCEditor$SLPVerifyKeyListener(SLPCEditor paramSLPCEditor) {}
  
  public void install()
  {
    ISourceViewer oSourceViewer = SLPCEditor.access$0(this$0);
    sPartitioningType = SLPCEditor.access$1(this$0).getConfiguredDocumentPartitioning(SLPCEditor.access$0(this$0));
    if ((!fIsInstalled) && ((oSourceViewer instanceof ITextViewerExtension)))
    {
      ((ITextViewerExtension)oSourceViewer).prependVerifyKeyListener(this);
      fIsInstalled = true;
    }
  }
  
  public void uninstall()
  {
    ISourceViewer oSourceViewer = SLPCEditor.access$0(this$0);
    if ((fIsInstalled) && ((oSourceViewer instanceof ITextViewerExtension)))
    {
      ((ITextViewerExtension)oSourceViewer).removeVerifyKeyListener(this);
      fIsInstalled = false;
    }
  }
  
  public void verifyKey(VerifyEvent event)
  {
    SLPCEditor.access$2(this$0).verifyKey(event);
    
    fSLPKeyVerifier = SLPKeyVerifier.getInstance();
    if (fSLPKeyVerifier.verifyKey(event, SLPCEditor.access$0(this$0), sPartitioningType, this$0))
    {
      Thread th = new Thread()
      {
        public void run()
        {
          try
          {
            sleep(200L);
          }
          catch (InterruptedException e)
          {
            e.printStackTrace();
          }
          SLPCEditor.access$0(this$0).getTextOperationTarget().doOperation(13);
        }
      };
      Display.getCurrent().asyncExec(th);
      return;
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.contentassist.SLPCEditor.SLPVerifyKeyListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.contentassist;

import java.util.StringTokenizer;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.ui.editor.CEditor;
import org.eclipse.cdt.internal.ui.text.CTextTools;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.IWorkingCopyManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.ITextOperationTarget;
import org.eclipse.jface.text.ITextViewerExtension;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;

public class SLPCEditor
  extends CEditor
{
  private SLPKeyProvider internalKeyProvider = SLPKeyProvider.getInstance();
  
  public SLPCEditor()
  {
    IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();
    
    StringBuffer proposalsFilter = new StringBuffer(store.getDefaultString("content_assist_proposal_filter"));
    
    StringTokenizer st = new StringTokenizer(proposalsFilter.toString(), ";");
    
    String pattern = "API-Assist-Proposal-Filter";
    
    int i = 0;
    while (st.hasMoreTokens())
    {
      String token = st.nextToken();
      if ((token.compareTo(pattern) == 0) && (i > 0))
      {
        proposalsFilter.replace(0, proposalsFilter.indexOf(";"), Integer.toString(i - 1));
        break;
      }
      i++;
    }
    store.setDefault("content_assist_proposal_filter", proposalsFilter.toString());
  }
  
  private SLPVerifyKeyListener fSLPVerifyKeyListener = new SLPVerifyKeyListener();
  private boolean fTUComputed;
  private ITranslationUnit fTU;
  
  class SLPVerifyKeyListener
    implements VerifyKeyListener
  {
    private boolean fIsInstalled = false;
    private SLPKeyVerifier fSLPKeyVerifier;
    private String sPartitioningType;
    
    SLPVerifyKeyListener() {}
    
    public void install()
    {
      ISourceViewer oSourceViewer = getSourceViewer();
      sPartitioningType = getSourceViewerConfiguration().getConfiguredDocumentPartitioning(getSourceViewer());
      if ((!fIsInstalled) && ((oSourceViewer instanceof ITextViewerExtension)))
      {
        ((ITextViewerExtension)oSourceViewer).prependVerifyKeyListener(this);
        fIsInstalled = true;
      }
    }
    
    public void uninstall()
    {
      ISourceViewer oSourceViewer = getSourceViewer();
      if ((fIsInstalled) && ((oSourceViewer instanceof ITextViewerExtension)))
      {
        ((ITextViewerExtension)oSourceViewer).removeVerifyKeyListener(this);
        fIsInstalled = false;
      }
    }
    
    public void verifyKey(VerifyEvent event)
    {
      internalKeyProvider.verifyKey(event);
      
      fSLPKeyVerifier = SLPKeyVerifier.getInstance();
      if (fSLPKeyVerifier.verifyKey(event, getSourceViewer(), sPartitioningType, SLPCEditor.this))
      {
        Thread th = new Thread()
        {
          public void run()
          {
            try
            {
              sleep(200L);
            }
            catch (InterruptedException e)
            {
              e.printStackTrace();
            }
            getSourceViewer().getTextOperationTarget().doOperation(13);
          }
        };
        Display.getCurrent().asyncExec(th);
        return;
      }
    }
  }
  
  public void createPartControl(Composite parent)
  {
    super.createPartControl(parent);
    fSLPVerifyKeyListener.install();
  }
  
  public void dispose()
  {
    if (fSLPVerifyKeyListener != null)
    {
      fSLPVerifyKeyListener.uninstall();
      fSLPVerifyKeyListener = null;
    }
    super.dispose();
  }
  
  protected void setPreferenceStore(IPreferenceStore store)
  {
    super.setPreferenceStore(store);
    CTextTools textTools = CUIPlugin.getDefault().getTextTools();
    setSourceViewerConfiguration(new SLPSourceViewerConfiguration(textTools.getColorManager(), store, this, "___c_partitioning"));
  }
  
  public ITranslationUnit getTranslationUnit()
  {
    if (!fTUComputed)
    {
      fTUComputed = true;
      fTU = CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(getEditorInput());
    }
    return fTU;
  }
}

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

import org.eclipse.jface.text.contentassist.ContentAssistant;

public class SLPContentAssistant
  extends ContentAssistant
{
  public SLPContentAssistant()
  {
    addCompletionListener(new SLPPopupProposalsSentinel(this));
  }
  
  public void hide()
  {
    super.hide();
  }
}

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

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.swt.events.VerifyEvent;

public class SLPKeyProvider
{
  private ListenerList keyListeners = new ListenerList(1);
  private static SLPKeyProvider instance = null;
  
  static SLPKeyProvider getInstance()
  {
    if (instance == null) {
      instance = new SLPKeyProvider();
    }
    return instance;
  }
  
  public void verifyKey(VerifyEvent event)
  {
    Object[] listeners = keyListeners.getListeners();
    for (int i = 0; i < listeners.length; i++) {
      if ((listeners[i] instanceof ISLPKeyListener)) {
        ((ISLPKeyListener)listeners[i]).verifyKey(event);
      }
    }
  }
  
  public void addKeyListener(ISLPKeyListener listener)
  {
    Assert.isLegal(listener != null);
    keyListeners.add(listener);
  }
  
  public void removeKeyListener(ISLPKeyListener listener)
  {
    keyListeners.remove(listener);
  }
}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
import org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistInvocationContext;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Point;
import org.tizen.nativecommon.apihover.IndexFinder;

public class SLPKeyVerifier
{
  private static SLPKeyVerifier theKeyVerifier = null;
  private HashSet<String> m_hsPrefixes;
  private int iCharCnt = 0;
  private char[] cBuff = new char[3];
  private static final String[] cppKeywords = {
    "bre", 
    "con", 
    "def", 
    "els", 
    "ext", 
    "for", 
    "reg", 
    "ret", 
    "siz", 
    "sta", 
    "str", 
    "swi", 
    "typ", 
    "uni", 
    "vol", 
    "whi", 
    "cat", 
    "ext", 
    "inl", 
    "new", 
    "try", 
    "usi", 
    "cla" };
  
  public static SLPKeyVerifier getInstance()
  {
    if (theKeyVerifier == null)
    {
      ArrayList<String> prefs = IndexFinder.getInstance().prefixes(1);
      theKeyVerifier = new SLPKeyVerifier(prefs);
    }
    return theKeyVerifier;
  }
  
  private SLPKeyVerifier(Collection<String> c)
  {
    m_hsPrefixes = new HashSet();
    m_hsPrefixes.addAll(c);
    m_hsPrefixes.addAll(Arrays.asList(cppKeywords));
  }
  
  public boolean verifyKey(VerifyEvent event, ISourceViewer oSourceViewer, String sPartitioningType, SLPCEditor editor)
  {
    if (!isTriggeringEnabled()) {
      return false;
    }
    if (character == '\b') {
      return handleBackspaceKeyword(event);
    }
    char[] aChar = new char[1];
    aChar[0] = character;
    if (Character.codePointAt(aChar, 0) == 0) {
      return false;
    }
    if (!isCLanguageKeywordChar(character))
    {
      iCharCnt = 0;
      return false;
    }
    if (iCharCnt < 3) {
      cBuff[iCharCnt] = character;
    }
    if ((++iCharCnt == 3) || ((iCharCnt == 2) && (cBuff[0] == 'N') && (cBuff[1] == '_')) || ((iCharCnt == 1) && (cBuff[0] == '_'))) {
      try
      {
        String contentType = 
          TextUtilities.getContentType(oSourceViewer.getDocument(), sPartitioningType, getSelectedRangex, true);
        if (contentType.contentEquals("__dftl_partition_content_type"))
        {
          CContentAssistInvocationContext context = new CContentAssistInvocationContext(oSourceViewer, 
            getSelectedRangex, 
            editor, true, true);
          IASTCompletionNode completionNode = context.getCompletionNode();
          context.dispose();
          if (completionNode != null) {
            return true;
          }
          return false;
        }
        return false;
      }
      catch (BadLocationException localBadLocationException)
      {
        return false;
      }
    }
    return false;
  }
  
  private boolean isCLanguageKeywordChar(char c)
  {
    return (Character.isLetterOrDigit(c)) || (c == '_');
  }
  
  private boolean handleBackspaceKeyword(VerifyEvent event)
  {
    Object o = event.getSource();
    if ((o instanceof StyledText))
    {
      StyledText styledText = (StyledText)o;
      int caretOffset = styledText.getCaretOffset();
      if (caretOffset <= 3)
      {
        if (caretOffset == 1)
        {
          iCharCnt = 0;
          return false;
        }
        if (caretOffset == 2)
        {
          String str = styledText.getText(0, 0);
          if (isCLanguageKeywordChar(str.charAt(0)))
          {
            cBuff[0] = str.charAt(0);
            iCharCnt = 1;
            return false;
          }
        }
        else if (caretOffset == 3)
        {
          String str = styledText.getText(0, 1);
          if ((isCLanguageKeywordChar(str.charAt(0))) && 
            (isCLanguageKeywordChar(str.charAt(1))))
          {
            cBuff[0] = str.charAt(0);
            cBuff[1] = str.charAt(1);
            iCharCnt = 2;
            return false;
          }
        }
      }
      else
      {
        String str = styledText.getText(caretOffset - 4, caretOffset - 2);
        if ((!isCLanguageKeywordChar(str.charAt(0))) && 
          (isCLanguageKeywordChar(str.charAt(1))) && 
          (isCLanguageKeywordChar(str.charAt(2))))
        {
          cBuff[0] = str.charAt(1);
          cBuff[1] = str.charAt(2);
          iCharCnt = 2;
          return false;
        }
      }
    }
    if (iCharCnt > 0) {
      iCharCnt -= 1;
    }
    return false;
  }
  
  private boolean isTriggeringEnabled()
  {
    boolean value = true;
    
    value = false;
    return value;
  }
}

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

import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.VerifyEvent;

class SLPPopupProposalsSentinel$PopupClosure
  extends Thread
  implements ISLPKeyListener
{
  int starter = -1;
  
  SLPPopupProposalsSentinel$PopupClosure(SLPPopupProposalsSentinel paramSLPPopupProposalsSentinel) {}
  
  public void run()
  {
    SLPKeyProvider.getInstance().removeKeyListener(this);
    if (SLPPopupProposalsSentinel.access$0(this$0) != null) {
      SLPPopupProposalsSentinel.access$0(this$0).hide();
    }
  }
  
  public void verifyKey(VerifyEvent event)
  {
    Object o = event.getSource();
    if ((o instanceof StyledText))
    {
      StyledText styledText = (StyledText)o;
      int caretOffset = styledText.getCaretOffset();
      if (starter == -1) {
        starter = caretOffset;
      }
      if (character == '\b') {
        caretOffset--;
      } else {
        caretOffset++;
      }
      if (caretOffset - starter < 0) {
        run();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.contentassist.SLPPopupProposalsSentinel.PopupClosure
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.contentassist;

import org.eclipse.jface.text.contentassist.ContentAssistEvent;
import org.eclipse.jface.text.contentassist.ICompletionListener;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.VerifyEvent;

public class SLPPopupProposalsSentinel
  implements ICompletionListener
{
  private SLPContentAssistant assistant = null;
  private PopupClosure popup = null;
  
  public SLPPopupProposalsSentinel(SLPContentAssistant assistant)
  {
    this.assistant = assistant;
  }
  
  public void assistSessionEnded(ContentAssistEvent event)
  {
    if (popup != null) {
      SLPKeyProvider.getInstance().removeKeyListener(popup);
    }
    popup = null;
  }
  
  public void assistSessionStarted(ContentAssistEvent event)
  {
    popup = new PopupClosure();
    SLPKeyProvider.getInstance().addKeyListener(popup);
  }
  
  public void selectionChanged(ICompletionProposal proposal, boolean smartToggle) {}
  
  class PopupClosure
    extends Thread
    implements ISLPKeyListener
  {
    int starter = -1;
    
    PopupClosure() {}
    
    public void run()
    {
      SLPKeyProvider.getInstance().removeKeyListener(this);
      if (assistant != null) {
        assistant.hide();
      }
    }
    
    public void verifyKey(VerifyEvent event)
    {
      Object o = event.getSource();
      if ((o instanceof StyledText))
      {
        StyledText styledText = (StyledText)o;
        int caretOffset = styledText.getCaretOffset();
        if (starter == -1) {
          starter = caretOffset;
        }
        if (character == '\b') {
          caretOffset--;
        } else {
          caretOffset++;
        }
        if (caretOffset - starter < 0) {
          run();
        }
      }
    }
  }
}

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

import org.eclipse.cdt.internal.ui.text.CSourceViewerScalableConfiguration;
import org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistProcessor;
import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference;
import org.eclipse.cdt.ui.text.IColorManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.texteditor.ITextEditor;

public class SLPSourceViewerConfiguration
  extends CSourceViewerScalableConfiguration
{
  public SLPSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore, ITextEditor editor, String partitioning)
  {
    super(colorManager, preferenceStore, editor, partitioning);
  }
  
  public IContentAssistant getContentAssistant(ISourceViewer sourceViewer)
  {
    if (getEditor() == null) {
      return null;
    }
    SLPContentAssistant slpContentAssistant = new SLPContentAssistant();
    slpContentAssistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    
    slpContentAssistant.setRestoreCompletionProposalSize(getSettings("completion_proposal_size"));
    
    setContentAssistProcessor(slpContentAssistant, "__dftl_partition_content_type");
    setContentAssistProcessor(slpContentAssistant, "__c_multiline_comment");
    setContentAssistProcessor(slpContentAssistant, "__c_singleline_comment");
    setContentAssistProcessor(slpContentAssistant, "__c_multiline_doc_comment");
    setContentAssistProcessor(slpContentAssistant, "__c_singleline_doc_comment");
    setContentAssistProcessor(slpContentAssistant, "__c_string");
    setContentAssistProcessor(slpContentAssistant, "__c_preprocessor");
    
    ContentAssistPreference.configure(slpContentAssistant, fPreferenceStore);
    slpContentAssistant.enableAutoInsert(false);
    
    setContentAssistantPreferences(slpContentAssistant, sourceViewer);
    
    return slpContentAssistant;
  }
  
  private void setContentAssistProcessor(SLPContentAssistant slpAssistant, String partion)
  {
    IContentAssistProcessor processor = new CContentAssistProcessor(getEditor(), slpAssistant, partion);
    slpAssistant.setContentAssistProcessor(processor, partion);
  }
  
  private void setContentAssistantPreferences(SLPContentAssistant slpAssistant, ISourceViewer sourceViewer)
  {
    slpAssistant.setContextInformationPopupOrientation(20);
    slpAssistant.setProposalPopupOrientation(10);
    slpAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.contentassist.SLPSourceViewerConfiguration
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages
{
  private static final String BUNDLE_NAME = "org.tizen.nativeappcommon.editors.common.messages";
  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.tizen.nativeappcommon.editors.common.messages");
  
  public static String getString(String key)
  {
    try
    {
      return RESOURCE_BUNDLE.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return null;
  }
}

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

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

public class XMLmanager
{
  private Document doc;
  
  public void writeXML(File file, Document doc)
  {
    try
    {
      DOMSource domsource = new DOMSource(doc);
      FileWriter fw = new FileWriter(file);
      StreamResult result = new StreamResult(fw);
      TransformerFactory tf = TransformerFactory.newInstance();
      
      tf.setAttribute("indent-number", new Integer(7));
      Transformer transformer = tf.newTransformer();
      transformer.setOutputProperty("indent", "yes");
      transformer.setOutputProperty("method", "xml");
      transformer.setOutputProperty("encoding", "utf-8");
      transformer.setOutputProperty("omit-xml-declaration", "yes");
      transformer.transform(domsource, result);
    }
    catch (TransformerConfigurationException e)
    {
      e.printStackTrace();
    }
    catch (TransformerException e)
    {
      e.printStackTrace();
    }
    catch (IOException e)
    {
      e.printStackTrace();
    }
  }
  
  public Document readXML(File file)
    throws ParserConfigurationException, SAXException, IOException
  {
    doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file);
    return doc;
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.editors.common.XMLmanager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common.autocomplete;

import org.eclipse.jface.fieldassist.IContentProposal;

class AutocompleteContentProposalProvider$1
  implements IContentProposal
{
  AutocompleteContentProposalProvider$1(AutocompleteContentProposalProvider paramAutocompleteContentProposalProvider, String paramString) {}
  
  public String getContent()
  {
    return val$proposal;
  }
  
  public String getDescription()
  {
    return null;
  }
  
  public String getLabel()
  {
    return null;
  }
  
  public int getCursorPosition()
  {
    return val$proposal.length();
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteContentProposalProvider.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common.autocomplete;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalProvider;

public class AutocompleteContentProposalProvider
  implements IContentProposalProvider
{
  protected String[] proposals = null;
  
  public AutocompleteContentProposalProvider(String[] proposals)
  {
    this.proposals = proposals;
  }
  
  public IContentProposal[] getProposals(String contents, int position)
  {
    List<IContentProposal> contentProposals = getMatchingProposals(proposals, contents);
    return (IContentProposal[])contentProposals.toArray(new IContentProposal[contentProposals.size()]);
  }
  
  public void setProposals(String[] items)
  {
    proposals = items;
  }
  
  protected List<IContentProposal> getMatchingProposals(String[] proposals, String contents)
  {
    List<IContentProposal> contentProposals = new ArrayList();
    String[] matchingProposals = matches(proposals, contents);
    for (int i = 0; i < matchingProposals.length; i++)
    {
      final String proposal = matchingProposals[i];
      contentProposals.add(new IContentProposal()
      {
        public String getContent()
        {
          return proposal;
        }
        
        public String getDescription()
        {
          return null;
        }
        
        public String getLabel()
        {
          return null;
        }
        
        public int getCursorPosition()
        {
          return proposal.length();
        }
      });
    }
    return contentProposals;
  }
  
  private String[] matches(String[] items, String prefix)
  {
    List<String> matches = new ArrayList();
    for (int i = 0; i < items.length; i++) {
      if (startsWithIgnoreCase(items[i], prefix)) {
        matches.add(items[i]);
      }
    }
    return (String[])matches.toArray(new String[matches.size()]);
  }
  
  private boolean startsWithIgnoreCase(String string, String prefix)
  {
    return string.toLowerCase().startsWith(prefix.toLowerCase());
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteContentProposalProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common.autocomplete;

public class AutocompleteInputContentProposalProvider
  extends AutocompleteContentProposalProvider
{
  public AutocompleteInputContentProposalProvider(String[] proposals)
  {
    super(proposals);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteInputContentProposalProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common.autocomplete;

import java.util.List;
import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;

public class AutocompleteSelectorContentProposalProvider
  extends AutocompleteContentProposalProvider
{
  private Control control = null;
  
  public AutocompleteSelectorContentProposalProvider(String[] proposals, Combo combo)
  {
    super(proposals);
    control = combo;
  }
  
  public AutocompleteSelectorContentProposalProvider(String[] proposals, Text text)
  {
    super(proposals);
    control = text;
  }
  
  public IContentProposal[] getProposals(String contents, int position)
  {
    List<IContentProposal> contentProposals = getMatchingProposals(proposals, contents);
    if (contentProposals.size() == 0) {
      if ((control instanceof Text)) {
        contentProposals = getContentProposals((Text)control);
      } else if ((control instanceof Combo)) {
        contentProposals = getContentProposals((Combo)control);
      }
    }
    return (IContentProposal[])contentProposals.toArray(new IContentProposal[contentProposals.size()]);
  }
  
  private List<IContentProposal> getContentProposals(Combo combo)
  {
    combo.setText(combo.getText().substring(0, combo.getText().length() - 1));
    combo.setSelection(new Point(combo.getText().length(), combo.getText().length()));
    return getMatchingProposals(proposals, combo.getText());
  }
  
  private List<IContentProposal> getContentProposals(Text text)
  {
    text.setText(text.getText().substring(0, text.getText().length() - 1));
    text.setSelection(new Point(text.getText().length(), text.getText().length()));
    return getMatchingProposals(proposals, text.getText());
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteSelectorContentProposalProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common.autocomplete;

import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;

public abstract class AutocompleteWidget
{
  protected AutocompleteContentProposalProvider provider = null;
  protected ContentProposalAdapter adapter = null;
  
  protected char[] getAutoactivationChars()
  {
    String lowercaseLetters = "abcdefghijklmnopqrstuvwxyz";
    String uppercaseLetters = lowercaseLetters.toUpperCase();
    String numbers = "0123456789";
    
    String delete = new String(new char[] { '\b' });
    String allChars = lowercaseLetters + uppercaseLetters + numbers + delete;
    return allChars.toCharArray();
  }
  
  protected KeyStroke getActivationKeystroke()
  {
    return KeyStroke.getInstance(new Integer(262144).intValue(), new Integer(32).intValue());
  }
  
  protected abstract AutocompleteContentProposalProvider getContentProposalProvider(String[] paramArrayOfString);
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteWidget
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common.autocomplete.combo;

import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.widgets.Combo;
import org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteContentProposalProvider;

final class AutocompleteCombo$ProposalUpdateFocusListener
  implements FocusListener
{
  private AutocompleteCombo$ProposalUpdateFocusListener(AutocompleteCombo paramAutocompleteCombo) {}
  
  public void focusGained(FocusEvent e)
  {
    AutocompleteCombo.access$0(this$0).setProposals(this$0.combo.getItems());
  }
  
  public void focusLost(FocusEvent e) {}
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.editors.common.autocomplete.combo.AutocompleteCombo.ProposalUpdateFocusListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common.autocomplete.combo;

import org.eclipse.jface.fieldassist.ComboContentAdapter;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.widgets.Combo;
import org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteContentProposalProvider;
import org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteWidget;

public abstract class AutocompleteCombo
  extends AutocompleteWidget
{
  private final class ProposalUpdateFocusListener
    implements FocusListener
  {
    private ProposalUpdateFocusListener() {}
    
    public void focusGained(FocusEvent e)
    {
      provider.setProposals(combo.getItems());
    }
    
    public void focusLost(FocusEvent e) {}
  }
  
  protected Combo combo = null;
  
  public AutocompleteCombo(Combo aCombo)
  {
    combo = aCombo;
    if (combo != null)
    {
      combo.addFocusListener(new ProposalUpdateFocusListener(null));
      
      provider = getContentProposalProvider(combo.getItems());
      adapter = new ContentProposalAdapter(combo, new ComboContentAdapter(), provider, getActivationKeystroke(), getAutoactivationChars());
      adapter.setProposalAcceptanceStyle(2);
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.editors.common.autocomplete.combo.AutocompleteCombo
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common.autocomplete.combo;

import org.eclipse.swt.widgets.Combo;
import org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteContentProposalProvider;
import org.tizen.nativeappcommon.editors.common.autocomplete.AutocompleteInputContentProposalProvider;

public class AutocompleteComboInput
  extends AutocompleteCombo
{
  public AutocompleteComboInput(Combo combo)
  {
    super(combo);
  }
  
  protected AutocompleteContentProposalProvider getContentProposalProvider(String[] proposals)
  {
    return new AutocompleteInputContentProposalProvider(proposals);
  }
}

/* Location:
 * Qualified Name:     org.tizen.nativeappcommon.editors.common.autocomplete.combo.AutocompleteComboInput
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.nativeappcommon.editors.common.autocomplete.combo;

import java.util.Arrays;
import java.util.List;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.widgets.Combo;

final class AutocompleteComboSelector$UpdateProposalListFocusListener
  implements FocusListener
{
  private AutocompleteComboSelector$UpdateProposalListFocusListener(AutocompleteComboSelector paramAutocompleteComboSelector) {}
  
  public void focusGained(FocusEvent e) {}
  
  public void focusLost(FocusEvent e)
  {
    Combo theCombo = (Combo)e.getSource();
    Li
1 2 3 4 5

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd