org.eclipse.pde.ds.ui_1.0.100.v20111213-1754

s, new DSCompletionProposal(
        model.getFactory().createImplementation(), offset, length), filter);
    }
    ICompletionProposal[] proposalsArray = new DSCompletionProposal[proposals
      .size()];
    for (int i = 0; i < proposalsArray.length; i++) {
      proposalsArray[i] = ((ICompletionProposal)proposals.get(i));
    }
    return proposalsArray;
  }
  
  private void addFilteredProposal(int offset, ArrayList proposals, DSCompletionProposal proposal, String filter)
  {
    if ((filter == null) || (filter.length() == 0)) {
      proposals.add(proposal);
    } else if (filter.regionMatches(true, 0, proposal.getDisplayString(), 0, 
      filter.length())) {
      proposals.add(proposal);
    }
  }
  
  private void addFilteredProposal(int offset, ArrayList proposals, DSAttrCompletionProposal proposal, String filter)
  {
    if ((filter == null) || (filter.length() == 0)) {
      proposals.add(proposal);
    } else if (filter.regionMatches(true, 0, proposal.getDisplayString(), 0, 
      filter.length())) {
      proposals.add(proposal);
    }
  }
  
  private int determineAssistType(IDocumentElementNode node, IDocument doc, int offset)
  {
    int len = node.getLength();
    int off = node.getOffset();
    if ((len == -1) || (off == -1)) {
      return 0;
    }
    offset -= off;
    if (offset > node.getXMLTagName().length() + 1) {
      try
      {
        String eleValue = doc.get(off, len);
        int ind = eleValue.indexOf('>');
        if ((ind > 0) && (eleValue.charAt(ind - 1) == '/')) {
          ind--;
        }
        if (offset <= ind)
        {
          if (canInsertAttrib(eleValue, offset)) {
            return 1;
          }
          return 0;
        }
        ind = eleValue.lastIndexOf('<');
        if ((ind == 0) && (offset == len - 1)) {
          return 3;
        }
        if ((ind + 1 < len) && (eleValue.charAt(ind + 1) == '/') && 
          (offset <= ind)) {
          return 2;
        }
      }
      catch (BadLocationException localBadLocationException) {}
    }
    return 0;
  }
  
  private boolean canInsertAttrib(String eleValue, int offset)
  {
    char c = eleValue.charAt(offset);
    
    return (offset - 1 >= 0) && (Character.isWhitespace(eleValue.charAt(offset - 1))) && ((Character.isWhitespace(c)) || (c == '/') || (c == '>'));
  }
  
  private String[] guessContentRequest(int[] offset, IDocument doc, boolean brokenModel)
  {
    StringBuffer nodeBuffer = new StringBuffer();
    StringBuffer attrBuffer = new StringBuffer();
    StringBuffer attrValBuffer = new StringBuffer();
    String node = null;
    String attr = null;
    String attVal = null;
    int quoteCount = 0;
    try
    {
      do
      {
        char c = doc.getChar(offset[0]);
        if (c == '"')
        {
          quoteCount++;
          nodeBuffer.setLength(0);
          attrBuffer.setLength(0);
          if (attVal == null)
          {
            offset[2] = offset[0];
            attVal = attrValBuffer.toString();
          }
        }
        else if (Character.isWhitespace(c))
        {
          nodeBuffer.setLength(0);
          if (attr == null)
          {
            offset[1] = offset[0];
            int attBuffLen = attrBuffer.length();
            if ((attBuffLen > 0) && 
              (attrBuffer.charAt(attBuffLen - 1) == '=')) {
              attrBuffer.setLength(attBuffLen - 1);
            }
            attr = attrBuffer.toString();
          }
        }
        else
        {
          if (c == '<')
          {
            node = nodeBuffer.toString();
            break;
          }
          if (c == '>') {
            return null;
          }
          attrValBuffer.insert(0, c);
          attrBuffer.insert(0, c);
          nodeBuffer.insert(0, c);
        }
      } while (tmp224_222[tmp224_223] -= 1 >= 0);
    }
    catch (BadLocationException localBadLocationException) {}
    if (node == null) {
      return null;
    }
    if (quoteCount % 2 == 0) {
      attVal = null;
    } else if (brokenModel) {
      return null;
    }
    return new String[] { node, attr, attVal };
  }
  
  private void assignRange(int offset)
  {
    fRange = fSourcePage.getRangeElement(offset, true);
    if (fRange == null) {
      return;
    }
    if ((fRange instanceof IDocumentAttributeNode))
    {
      if (((IDocumentAttributeNode)fRange).getNameOffset() == offset) {
        fRange = ((IDocumentAttributeNode)fRange)
          .getEnclosingElement();
      }
    }
    else if ((fRange instanceof IDocumentElementNode))
    {
      if (((IDocumentElementNode)fRange).getOffset() == offset) {
        fRange = ((IDocumentElementNode)fRange).getParentNode();
      }
    }
    else if (((fRange instanceof IDocumentTextNode)) && 
      (((IDocumentTextNode)fRange).getOffset() == offset)) {
      fRange = ((IDocumentTextNode)fRange).getEnclosingElement();
    }
  }
  
  public void dispose() {}
  
  protected ITextSelection getCurrentSelection()
  {
    ISelection sel = fSourcePage.getSelectionProvider().getSelection();
    if ((sel instanceof ITextSelection)) {
      return (ITextSelection)sel;
    }
    return null;
  }
  
  protected void flushDocument()
  {
    fSourcePage.getInputContext().flushEditorInput();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.contentassist.DSContentAssistProcessor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.contentassist;

import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;

public class DSContentAssistText
{
  private String fText;
  private int fStartOffset;
  
  private DSContentAssistText(String text, int startOffset)
  {
    fText = text;
    fStartOffset = startOffset;
  }
  
  public static DSContentAssistText parse(int offset, IDocument document)
  {
    boolean writeCAText = true;
    int lastCATextOffset = -1;
    StringBuffer buffer = new StringBuffer();
    int endOffset = offset - 1;
    if (offset <= 0) {
      return null;
    }
    try
    {
      currentChar = document.getChar(endOffset);
    }
    catch (BadLocationException localBadLocationException1)
    {
      char currentChar;
      return null;
    }
    char currentChar;
    if (isContentAssistText(currentChar))
    {
      buffer.append(currentChar);
      lastCATextOffset = endOffset;
    }
    else
    {
      return null;
    }
    for (int i = endOffset - 1; i > 0; i--)
    {
      try
      {
        currentChar = document.getChar(i);
      }
      catch (BadLocationException localBadLocationException2)
      {
        return null;
      }
      if (isContentAssistText(currentChar))
      {
        if (writeCAText)
        {
          buffer.append(currentChar);
          
          lastCATextOffset = i;
        }
      }
      else if (Character.isWhitespace(currentChar))
      {
        writeCAText = false;
      }
      else
      {
        if (currentChar == '>')
        {
          if (buffer.length() > 0) {
            return new DSContentAssistText(buffer.reverse().toString(), 
              lastCATextOffset);
          }
          return null;
        }
        return null;
      }
    }
    return null;
  }
  
  private static boolean isContentAssistText(char c)
  {
    if ((Character.isLetterOrDigit(c)) || (c == '.') || (c == '-') || 
      (c == '_') || (c == ':')) {
      return true;
    }
    return false;
  }
  
  public String getText()
  {
    return fText;
  }
  
  public int getStartOffset()
  {
    return fStartOffset;
  }
  
  public String toString()
  {
    return "Start Offset: " + fStartOffset + " Text: |" + fText + "|\n";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.contentassist.DSContentAssistText
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.contentassist;

import org.eclipse.jface.internal.text.html.BrowserInformationControl;
import org.eclipse.jface.text.AbstractReusableInformationControlCreator;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.swt.widgets.Shell;

class TypeCompletionProposal$1
  extends AbstractReusableInformationControlCreator
{
  final TypeCompletionProposal this$0;
  
  TypeCompletionProposal$1(TypeCompletionProposal paramTypeCompletionProposal)
  {
    this$0 = paramTypeCompletionProposal;
  }
  
  public IInformationControl doCreateInformationControl(Shell parent)
  {
    return new BrowserInformationControl(parent, 
      "org.eclipse.jface.dialogfont", false);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.contentassist.TypeCompletionProposal.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.contentassist;

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.internal.text.html.BrowserInformationControl;
import org.eclipse.jface.text.AbstractReusableInformationControlCreator;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension3;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension5;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;

public class TypeCompletionProposal
  implements ICompletionProposal, ICompletionProposalExtension3, ICompletionProposalExtension5
{
  protected String fReplacementString;
  protected Image fImage;
  protected String fDisplayString;
  protected int fBeginInsertPoint;
  protected int fLength;
  protected String fAdditionalInfo;
  private IInformationControlCreator fCreator;
  
  public TypeCompletionProposal(String replacementString, Image image, String displayString)
  {
    this(replacementString, image, displayString, 0, 0);
  }
  
  public TypeCompletionProposal(String replacementString, Image image, String displayString, int startOffset, int length)
  {
    Assert.isNotNull(replacementString);
    
    fReplacementString = replacementString;
    fImage = image;
    fDisplayString = displayString;
    fBeginInsertPoint = startOffset;
    fLength = length;
  }
  
  public void apply(IDocument document)
  {
    if (fLength == -1)
    {
      String current = document.get();
      fLength = current.length();
    }
    try
    {
      document.replace(fBeginInsertPoint, fLength, fReplacementString);
    }
    catch (BadLocationException localBadLocationException) {}
  }
  
  public String getAdditionalProposalInfo()
  {
    return null;
  }
  
  public IContextInformation getContextInformation()
  {
    return null;
  }
  
  public String getDisplayString()
  {
    return fDisplayString;
  }
  
  public Image getImage()
  {
    return fImage;
  }
  
  public Point getSelection(IDocument document)
  {
    if (fReplacementString.equals("\"\"")) {
      return new Point(fBeginInsertPoint + 1, 0);
    }
    return new Point(fBeginInsertPoint + fReplacementString.length(), 0);
  }
  
  public String getReplacementString()
  {
    return fReplacementString;
  }
  
  public Object getAdditionalProposalInfo(IProgressMonitor monitor)
  {
    return fAdditionalInfo;
  }
  
  public void setAdditionalProposalInfo(String info)
  {
    fAdditionalInfo = info;
  }
  
  public IInformationControlCreator getInformationControlCreator()
  {
    if (!BrowserInformationControl.isAvailable(null)) {
      return null;
    }
    if (fCreator == null) {
      fCreator = new AbstractReusableInformationControlCreator()
      {
        public IInformationControl doCreateInformationControl(Shell parent)
        {
          return new BrowserInformationControl(parent, 
            "org.eclipse.jface.dialogfont", false);
        }
      };
    }
    return fCreator;
  }
  
  public int getPrefixCompletionStart(IDocument document, int completionOffset)
  {
    return fBeginInsertPoint;
  }
  
  public CharSequence getPrefixCompletionText(IDocument document, int completionOffset)
  {
    return fReplacementString;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.contentassist.TypeCompletionProposal
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.contentassist;

import java.util.Collection;
import org.eclipse.jdt.core.CompletionProposal;
import org.eclipse.jdt.core.CompletionRequestor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.ui.ISharedImages;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.swt.graphics.Image;

class TypePackageCompletionProcessor$1$TypePackageCompletionRequestor
  extends CompletionRequestor
{
  final TypePackageCompletionProcessor this$0;
  private final Collection val$c;
  private final int val$startOffset;
  private final int val$length;
  private final int val$typeScope;
  
  public TypePackageCompletionProcessor$1$TypePackageCompletionRequestor(TypePackageCompletionProcessor paramTypePackageCompletionProcessor, Collection paramCollection, int paramInt1, int paramInt2, int paramInt3)
  {
    super(true);this$0 = paramTypePackageCompletionProcessor;val$c = paramCollection;val$startOffset = paramInt1;val$length = paramInt2;val$typeScope = paramInt3;
    setIgnored(8, false);
    setIgnored(9, false);
  }
  
  public void accept(CompletionProposal proposal)
  {
    ISharedImages images = JavaUI.getSharedImages();
    if (proposal.getKind() == 8)
    {
      String pkgName = new String(proposal.getCompletion());
      this$0.addProposalToCollection(val$c, val$startOffset, val$length, pkgName, 
        pkgName, images
        .getImage("org.eclipse.jdt.ui.package_obj.gif"));
    }
    else
    {
      boolean isInterface = Flags.isInterface(proposal.getFlags());
      String completion = new String(proposal.getCompletion());
      if (((isInterface) && (val$typeScope == 5)) || ((!isInterface) && (val$typeScope == 6)) || (completion.equals("Dummy2"))) {
        return;
      }
      int period = completion.lastIndexOf('.');
      String cName = null;String pName = null;
      if (period == -1)
      {
        cName = completion;
      }
      else
      {
        cName = completion.substring(period + 1);
        pName = completion.substring(0, period);
      }
      Image image = isInterface ? images
        .getImage("org.eclipse.jdt.ui.int_obj.gif") : 
        images.getImage("org.eclipse.jdt.ui.class_obj.gif");
      this$0.addProposalToCollection(val$c, val$startOffset, val$length, cName + 
        " - " + pName, 
        completion, image);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.contentassist.TypePackageCompletionProcessor.1.TypePackageCompletionRequestor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.contentassist;

import java.util.Collection;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.search.TypeNameRequestor;
import org.eclipse.jdt.ui.ISharedImages;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.swt.graphics.Image;

class TypePackageCompletionProcessor$1
  extends TypeNameRequestor
{
  final TypePackageCompletionProcessor this$0;
  private final Collection val$c;
  private final int val$startOffset;
  private final int val$length;
  
  TypePackageCompletionProcessor$1(TypePackageCompletionProcessor paramTypePackageCompletionProcessor, Collection paramCollection, int paramInt1, int paramInt2)
  {
    this$0 = paramTypePackageCompletionProcessor;val$c = paramCollection;val$startOffset = paramInt1;val$length = paramInt2;
  }
  
  public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path)
  {
    String cName = new String(simpleTypeName);
    String pName = new String(packageName);
    String label = cName + " - " + pName;
    String content = pName + "." + cName;
    ISharedImages images = JavaUI.getSharedImages();
    Image image = Flags.isInterface(modifiers) ? images
      .getImage("org.eclipse.jdt.ui.int_obj.gif") : 
      images.getImage("org.eclipse.jdt.ui.class_obj.gif");
    this$0.addProposalToCollection(val$c, val$startOffset, val$length, label, content, image);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.contentassist.TypePackageCompletionProcessor.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.contentassist;

import java.util.Comparator;
import org.eclipse.jface.text.contentassist.ICompletionProposal;

class TypePackageCompletionProcessor$2
  implements Comparator
{
  final TypePackageCompletionProcessor this$0;
  
  TypePackageCompletionProcessor$2(TypePackageCompletionProcessor paramTypePackageCompletionProcessor)
  {
    this$0 = paramTypePackageCompletionProcessor;
  }
  
  public int compare(Object arg0, Object arg1)
  {
    ICompletionProposal p1 = (ICompletionProposal)arg0;
    ICompletionProposal p2 = (ICompletionProposal)arg1;
    
    return getSortKey(p1).compareToIgnoreCase(getSortKey(p2));
  }
  
  protected String getSortKey(ICompletionProposal p)
  {
    return p.getDisplayString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.contentassist.TypePackageCompletionProcessor.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.contentassist;

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

abstract class TypePackageCompletionProcessor$ProposalGenerator
{
  final TypePackageCompletionProcessor this$0;
  
  TypePackageCompletionProcessor$ProposalGenerator(TypePackageCompletionProcessor paramTypePackageCompletionProcessor)
  {
    this$0 = paramTypePackageCompletionProcessor;
  }
  
  protected abstract ICompletionProposal generateClassCompletion(String paramString1, String paramString2, boolean paramBoolean);
  
  protected abstract ICompletionProposal generatePackageCompletion(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.contentassist.TypePackageCompletionProcessor.ProposalGenerator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.contentassist;

import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.CompletionRequestor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.core.search.TypeNameRequestor;
import org.eclipse.jdt.ui.ISharedImages;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.pde.internal.core.util.PDEJavaHelper;
import org.eclipse.swt.graphics.Image;

public abstract class TypePackageCompletionProcessor
  implements IContentAssistProcessor
{
  private String fErrorMessage;
  private SearchEngine fSearchEngine;
  private Comparator fComparator;
  
  public TypePackageCompletionProcessor()
  {
    fSearchEngine = new SearchEngine();
  }
  
  public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset)
  {
    return null;
  }
  
  public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset)
  {
    return null;
  }
  
  public char[] getCompletionProposalAutoActivationCharacters()
  {
    return null;
  }
  
  public char[] getContextInformationAutoActivationCharacters()
  {
    return null;
  }
  
  public IContextInformationValidator getContextInformationValidator()
  {
    return null;
  }
  
  public String getErrorMessage()
  {
    return fErrorMessage;
  }
  
  protected void generateTypePackageProposals(String currentContent, IProject project, Collection c, int startOffset, int typeScope)
  {
    generateTypePackageProposals(currentContent, project, c, startOffset, typeScope, false);
  }
  
  protected void generateTypePackageProposals(String currentContent, IProject project, Collection c, int startOffset, int typeScope, boolean replaceEntireContents)
  {
    currentContent = removeLeadingSpaces(currentContent);
    if ((c == null) || (currentContent.length() == 0)) {
      return;
    }
    int length = replaceEntireContents ? -1 : currentContent.length();
    generateProposals(currentContent, project, c, startOffset, length, typeScope);
  }
  
  private void generateProposals(String currentContent, IProject project, Collection c, int startOffset, int length, int typeScope)
  {
    try
    {
      ICompilationUnit unit = getWorkingCopy(project);
      if (unit == null)
      {
        generateTypeProposals(currentContent, project, c, startOffset, length, 1);
        return;
      }
      IBuffer buff = unit.getBuffer();
      buff.setContents("class Dummy2 { " + currentContent);
      
      CompletionRequestor req = new TypePackageCompletionProcessor.1.TypePackageCompletionRequestor(this, c, startOffset, length, typeScope);
      unit.codeComplete(15 + currentContent.length(), req);
      unit.discardWorkingCopy();
    }
    catch (JavaModelException localJavaModelException) {}
  }
  
  private ICompilationUnit getWorkingCopy(IProject project)
    throws JavaModelException
  {
    IPackageFragmentRoot[] roots = JavaCore.create(project).getPackageFragmentRoots();
    if (roots.length > 0)
    {
      IPackageFragment frag = null;
      for (int i = 0; i < roots.length; i++) {
        if ((roots[i].getKind() == 1) || (project.equals(roots[i].getCorrespondingResource())) || ((roots[i].isArchive()) && (!roots[i].isExternal())))
        {
          IJavaElement[] elems = roots[i].getChildren();
          if ((elems.length > 0) && (i < elems.length) && ((elems[i] instanceof IPackageFragment)))
          {
            frag = (IPackageFragment)elems[i];
            break;
          }
        }
      }
      if (frag != null) {
        return frag.getCompilationUnit("Dummy2.java").getWorkingCopy(new NullProgressMonitor());
      }
    }
    return null;
  }
  
  protected void generateTypeProposals(String currentContent, IProject project, Collection c, int startOffset, int length, int typeScope)
  {
    IJavaSearchScope scope = PDEJavaHelper.getSearchScope(project);
    char[] packageName = (char[])null;
    char[] typeName = (char[])null;
    int index = currentContent.lastIndexOf('.');
    if (index == -1)
    {
      typeName = currentContent.toCharArray();
    }
    else if (index + 1 == currentContent.length())
    {
      typeName = "".toCharArray();
      
      packageName = currentContent.substring(0, index).toCharArray();
    }
    else
    {
      typeName = currentContent.substring(index + 1).toCharArray();
      
      packageName = currentContent.substring(0, index).toCharArray();
    }
    try
    {
      TypeNameRequestor req = new TypeNameRequestor()
      {
        private final Collection val$c;
        private final int val$startOffset;
        private final int val$length;
        
        public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path)
        {
          String cName = new String(simpleTypeName);
          String pName = new String(packageName);
          String label = cName + " - " + pName;
          String content = pName + "." + cName;
          ISharedImages images = JavaUI.getSharedImages();
          Image image = Flags.isInterface(modifiers) ? images
            .getImage("org.eclipse.jdt.ui.int_obj.gif") : 
            images.getImage("org.eclipse.jdt.ui.class_obj.gif");
          addProposalToCollection(val$c, val$startOffset, val$length, label, content, image);
        }
      };
      fSearchEngine.searchAllTypeNames(packageName, 0, typeName, 1, typeScope, scope, req, 3, null);
    }
    catch (CoreException e)
    {
      fErrorMessage = e.getMessage();
    }
  }
  
  public void sortCompletions(ICompletionProposal[] proposals)
  {
    Arrays.sort(proposals, getComparator());
  }
  
  private Comparator getComparator()
  {
    if (fComparator == null) {
      fComparator = new Comparator()
      {
        public int compare(Object arg0, Object arg1)
        {
          ICompletionProposal p1 = (ICompletionProposal)arg0;
          ICompletionProposal p2 = (ICompletionProposal)arg1;
          
          return getSortKey(p1).compareToIgnoreCase(getSortKey(p2));
        }
        
        protected String getSortKey(ICompletionProposal p)
        {
          return p.getDisplayString();
        }
      };
    }
    return fComparator;
  }
  
  protected final String removeLeadingSpaces(String value)
  {
    char[] valueArray = value.toCharArray();
    for (int i = 0; i < valueArray.length; i++) {
      if (!Character.isWhitespace(valueArray[i])) {
        break;
      }
    }
    return i == valueArray.length ? "" : new String(valueArray, i, valueArray.length - i);
  }
  
  protected void addProposalToCollection(Collection c, int startOffset, int length, String label, String content, Image image)
  {
    TypeCompletionProposal proposal = new TypeCompletionProposal(content, image, label, startOffset, length);
    c.add(proposal);
  }
  
  abstract class ProposalGenerator
  {
    ProposalGenerator() {}
    
    protected abstract ICompletionProposal generateClassCompletion(String paramString1, String paramString2, boolean paramBoolean);
    
    protected abstract ICompletionProposal generatePackageCompletion(String paramString);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.contentassist.TypePackageCompletionProcessor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.dialogs;

import org.eclipse.pde.internal.ds.ui.editor.FormEntryAdapter;
import org.eclipse.pde.internal.ds.ui.parts.FormEntry;
import org.eclipse.pde.internal.ui.editor.IContextPart;
import org.eclipse.ui.forms.events.HyperlinkEvent;

class DSEditPropertiesDialog$1
  extends FormEntryAdapter
{
  final DSEditPropertiesDialog this$0;
  
  DSEditPropertiesDialog$1(DSEditPropertiesDialog paramDSEditPropertiesDialog, IContextPart $anonymous0)
  {
    super($anonymous0);this$0 = paramDSEditPropertiesDialog;
  }
  
  public void textValueChanged(FormEntry entry) {}
  
  public void textDirty(FormEntry entry) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    String value = DSEditPropertiesDialog.access$0(this$0).getValue();
    value = DSEditPropertiesDialog.access$1(this$0, value, false);
    if (value != null) {
      DSEditPropertiesDialog.access$0(this$0).setValue(value);
    }
  }
  
  public void browseButtonSelected(FormEntry entry)
  {
    DSEditPropertiesDialog.access$2(this$0, DSEditPropertiesDialog.access$0(this$0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.dialogs.DSEditPropertiesDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.dialogs;

import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

class DSEditPropertiesDialog$2
  extends ViewerFilter
{
  final DSEditPropertiesDialog this$0;
  private final IProject val$project;
  
  DSEditPropertiesDialog$2(DSEditPropertiesDialog paramDSEditPropertiesDialog, IProject paramIProject)
  {
    this$0 = paramDSEditPropertiesDialog;val$project = paramIProject;
  }
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    if ((element instanceof IProject)) {
      return ((IProject)element).equals(val$project);
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.dialogs.DSEditPropertiesDialog.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.dialogs;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;

class DSEditPropertiesDialog$3
  implements ISelectionStatusValidator
{
  final DSEditPropertiesDialog this$0;
  
  DSEditPropertiesDialog$3(DSEditPropertiesDialog paramDSEditPropertiesDialog)
  {
    this$0 = paramDSEditPropertiesDialog;
  }
  
  public IStatus validate(Object[] selection)
  {
    if ((selection != null) && 
      (selection.length > 0) && (
      ((selection[0] instanceof IFile)) || ((selection[0] instanceof IContainer)))) {
      return new Status(0, "org.eclipse.pde.ds.ui", 
        0, "", null);
    }
    return new Status(4, "org.eclipse.pde.ds.ui", 
      4, "", null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.dialogs.DSEditPropertiesDialog.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.dialogs;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.pde.internal.ds.core.IDSProperties;
import org.eclipse.pde.internal.ds.ui.Activator;
import org.eclipse.pde.internal.ds.ui.Messages;
import org.eclipse.pde.internal.ds.ui.SWTUtil;
import org.eclipse.pde.internal.ds.ui.editor.FormEntryAdapter;
import org.eclipse.pde.internal.ds.ui.editor.FormLayoutFactory;
import org.eclipse.pde.internal.ds.ui.editor.sections.DSPropertiesSection;
import org.eclipse.pde.internal.ds.ui.parts.FormEntry;
import org.eclipse.pde.internal.ds.ui.wizards.DSNewClassCreationWizard;
import org.eclipse.pde.internal.ui.editor.IContextPart;
import org.eclipse.pde.internal.ui.editor.PDEFormEditor;
import org.eclipse.pde.internal.ui.editor.PDEFormPage;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.forms.FormDialog;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;

public class DSEditPropertiesDialog
  extends FormDialog
{
  private IDSProperties fProperties;
  private DSPropertiesSection fPropertiesSection;
  private FormEntry fEntry;
  
  public DSEditPropertiesDialog(Shell parentShell, IDSProperties properties, DSPropertiesSection provideSection)
  {
    super(parentShell);
    fProperties = properties;
    fPropertiesSection = provideSection;
  }
  
  protected void createFormContent(IManagedForm mform)
  {
    mform.getForm().setText(Messages.DSEditPropertiesDialog_dialog_title);
    
    Composite container = mform.getForm().getBody();
    container.setLayout(new GridLayout());
    container.setLayoutData(new GridData(1808));
    FormToolkit toolkit = mform.getToolkit();
    toolkit.decorateFormHeading(mform.getForm().getForm());
    
    Composite entryContainer = toolkit.createComposite(container);
    entryContainer.setLayout(
      FormLayoutFactory.createSectionClientGridLayout(false, 3));
    entryContainer.setLayoutData(new GridData(1808));
    
    fEntry = new FormEntry(entryContainer, toolkit, 
      Messages.DSPropertiesDetails_entry, 
      Messages.DSPropertiesDetails_browse, false, 0);
    
    GridData gd = new GridData(768);
    widthHint = 20;
    horizontalSpan = 2;
    horizontalIndent = 3;
    
    toolkit.paintBordersFor(entryContainer);
    updateFields();
    
    setEntryListeners();
  }
  
  public boolean isHelpAvailable()
  {
    return false;
  }
  
  protected void buttonPressed(int buttonId)
  {
    switch (buttonId)
    {
    case 0: 
      handleOKPressed();
    }
    super.buttonPressed(buttonId);
  }
  
  private void handleOKPressed()
  {
    fEntry.commit();
    if (((!fEntry.getValue().equals("")) || (fProperties.getEntry() != null)) && 
      (!fEntry.getValue().equals(fProperties.getEntry()))) {
      fProperties.setEntry(fEntry.getValue());
    }
  }
  
  private void updateFields()
  {
    if (fProperties == null) {
      return;
    }
    if (fProperties.getEntry() == null) {
      fEntry.setValue("");
    } else {
      fEntry.setValue(fProperties.getEntry(), true);
    }
    fEntry.setEditable(true);
  }
  
  public void setEntryListeners()
  {
    fEntry.setFormEntryListener(new FormEntryAdapter(
      fPropertiesSection)
      {
        public void textValueChanged(FormEntry entry) {}
        
        public void textDirty(FormEntry entry) {}
        
        public void linkActivated(HyperlinkEvent e)
        {
          String value = fEntry.getValue();
          value = DSEditPropertiesDialog.this.handleLinkActivated(value, false);
          if (value != null) {
            fEntry.setValue(value);
          }
        }
        
        public void browseButtonSelected(FormEntry entry)
        {
          DSEditPropertiesDialog.this.doOpenSelectionDialog(fEntry);
        }
      });
  }
  
  private String handleLinkActivated(String value, boolean isInter)
  {
    IProject project = getProject();
    try
    {
      if ((project != null) && (project.hasNature("org.eclipse.jdt.core.javanature")))
      {
        IJavaProject javaProject = JavaCore.create(project);
        IJavaElement element = javaProject.findType(value.replace('$', 
          '.'));
        if (element != null)
        {
          JavaUI.openInEditor(element);
        }
        else
        {
          DSNewClassCreationWizard wizard = new DSNewClassCreationWizard(
            project, isInter, value);
          WizardDialog dialog = new WizardDialog(
            Activator.getActiveWorkbenchShell(), wizard);
          dialog.create();
          SWTUtil.setDialogSize(dialog, 400, 500);
          if (dialog.open() == 0) {
            return wizard.getQualifiedName();
          }
        }
      }
    }
    catch (PartInitException localPartInitException) {}catch (CoreException localCoreException) {}
    return null;
  }
  
  private IProject getProject()
  {
    PDEFormEditor editor = (PDEFormEditor)fPropertiesSection
      .getPage().getEditor();
    return editor.getCommonProject();
  }
  
  private void doOpenSelectionDialog(FormEntry entry)
  {
    IProject project = getProject();
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
      Activator.getActiveWorkbenchShell(), 
      new WorkbenchLabelProvider(), new WorkbenchContentProvider());
    dialog.setInput(project.getWorkspace());
    IResource resource = getFile();
    if (resource != null) {
      dialog.setInitialSelection(resource);
    }
    dialog.addFilter(new ViewerFilter()
    {
      private final IProject val$project;
      
      public boolean select(Viewer viewer, Object parentElement, Object element)
      {
        if ((element instanceof IProject)) {
          return ((IProject)element).equals(val$project);
        }
        return true;
      }
    });
    dialog.setAllowMultiple(false);
    dialog.setTitle(Messages.DSPropertiesDetails_dialogTitle);
    dialog.setMessage(Messages.DSPropertiesDetails_dialogMessage);
    dialog.setValidator(new ISelectionStatusValidator()
    {
      public IStatus validate(Object[] selection)
      {
        if ((selection != null) && 
          (selection.length > 0) && (
          ((selection[0] instanceof IFile)) || ((selection[0] instanceof IContainer)))) {
          return new Status(0, "org.eclipse.pde.ds.ui", 
            0, "", null);
        }
        return new Status(4, "org.eclipse.pde.ds.ui", 
          4, "", null);
      }
    });
    if (dialog.open() == 0)
    {
      IResource res = (IResource)dialog.getFirstResult();
      IPath path = res.getProjectRelativePath();
      if ((res instanceof IContainer)) {
        path = path.addTrailingSeparator();
      }
      String value = path.toString();
      fEntry.setValue(value);
    }
  }
  
  private IResource getFile()
  {
    String value = fEntry.getValue();
    if (value.length() == 0) {
      return null;
    }
    IProject project = getProject();
    IPath path = project.getFullPath().append(value);
    return project.getWorkspace().getRoot().findMember(path);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.dialogs.DSEditPropertiesDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.dialogs;

import org.eclipse.pde.internal.ds.ui.editor.FormEntryAdapter;
import org.eclipse.pde.internal.ds.ui.parts.FormEntry;
import org.eclipse.pde.internal.ui.editor.IContextPart;
import org.eclipse.ui.forms.events.HyperlinkEvent;

class DSEditPropertyDialog$1
  extends FormEntryAdapter
{
  final DSEditPropertyDialog this$0;
  
  DSEditPropertyDialog$1(DSEditPropertyDialog paramDSEditPropertyDialog, IContextPart $anonymous0)
  {
    super($anonymous0);this$0 = paramDSEditPropertyDialog;
  }
  
  public void textValueChanged(FormEntry entry) {}
  
  public void textDirty(FormEntry entry) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    String value = DSEditPropertyDialog.access$0(this$0).getValue();
    value = DSEditPropertyDialog.access$1(this$0, value, false);
    if (value != null) {
      DSEditPropertyDialog.access$0(this$0).setValue(value);
    }
  }
  
  public void browseButtonSelected(FormEntry entry)
  {
    DSEditPropertyDialog.access$2(this$0, DSEditPropertyDialog.access$0(this$0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ds.ui.editor.dialogs.DSEditPropertyDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ds.ui.editor.dialogs;

import org.eclipse.pde.internal.ds.ui.editor.FormEntryAdapter;
import org.eclipse.pde.internal.ds.ui.parts.FormEntry;
import org.eclipse.pde.internal.ui.editor.IContextPart;

class DSEditPropertyDialog$2
  extends FormEntryAdapter
{
  final DSEditPropertyDialog this$0;
  
  DSEditPropertyDialog$2(DSEditPropertyDialog param
1 2 3 4 5 6 7 8

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