Refactory: remove unused classes, imports, fields and methods.
authorincastrix <incastrix>
Wed, 23 Dec 2009 17:46:08 +0000 (17:46 +0000)
committerincastrix <incastrix>
Wed, 23 Dec 2009 17:46:08 +0000 (17:46 +0000)
net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierEngine.java [deleted file]
net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierProposal.java [deleted file]

diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierEngine.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierEngine.java
deleted file mode 100644 (file)
index 58d82e9..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package net.sourceforge.phpdt.internal.ui.text.template;
-
-import java.util.ArrayList;
-
-import net.sourceforge.phpdt.core.ICompilationUnit;
-import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitContextType;
-import net.sourceforge.phpdt.internal.corext.template.php.JavaContext;
-import net.sourceforge.phpdt.internal.corext.template.php.JavaContextType;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-import net.sourceforge.phpdt.internal.ui.text.java.IPHPCompletionProposal;
-import net.sourceforge.phpeclipse.ui.WebUI;
-//import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Region;
-import org.eclipse.swt.graphics.Point;
-
-public class IdentifierEngine {
-
-       /** The context type. */
-       private JavaContextType fContextType;
-
-       /** The result proposals. */
-       private ArrayList fProposals = new ArrayList();
-
-       /**
-        * Creates the template engine for a particular context type. See
-        * <code>TemplateContext</code> for supported context types.
-        */
-       public IdentifierEngine(JavaContextType contextType) {
-               // Assert.isNotNull(contextType);
-               fContextType = contextType;
-       }
-
-       /**
-        * Empties the collector.
-        * 
-        * @param viewer
-        *            the text viewer
-        * @param unit
-        *            the compilation unit (may be <code>null</code>)
-        */
-       public void reset() {
-               fProposals.clear();
-       }
-
-       /**
-        * Returns the array of matching templates.
-        */
-       public IPHPCompletionProposal[] getResults() {
-               return (IPHPCompletionProposal[]) fProposals
-                               .toArray(new IPHPCompletionProposal[fProposals.size()]);
-       }
-
-       /**
-        * Inspects the context of the compilation unit around
-        * <code>completionPosition</code> and feeds the collector with proposals.
-        * 
-        * @param viewer
-        *            the text viewer
-        * @param completionPosition
-        *            the context position in the document of the text viewer
-        * @param compilationUnit
-        *            the compilation unit (may be <code>null</code>)
-        */
-       public void complete(ITextViewer viewer, int completionPosition,
-                       Object[] identifiers, ICompilationUnit compilationUnit)
-       // hrows JavaModelException
-       {
-               IDocument document = viewer.getDocument();
-
-               if (!(fContextType instanceof CompilationUnitContextType))
-                       return;
-
-               Point selection = viewer.getSelectedRange();
-               // remember selected text
-               String selectedText = null;
-               if (selection.y != 0) {
-                       try {
-                               selectedText = document.get(selection.x, selection.y);
-                       } catch (BadLocationException e) {
-                       }
-               }
-
-               // ((CompilationUnitContextType)
-               // fContextType).setContextParameters(document, completionPosition,
-               // selection.y); //mpilationUnit);
-
-               // JavaContext context = (JavaContext) fContextType.createContext();
-               JavaContext context = (JavaContext) fContextType.createContext(
-                               document, completionPosition, selection.y, compilationUnit);
-               context.setVariable("selection", selectedText); //$NON-NLS-1$
-
-               int start = context.getStart();
-               int end = context.getEnd();
-               IRegion region = new Region(start, end - start);
-
-               // Template[] templates= Templates.getInstance().getTemplates();
-               String identifier = null;
-               int maxProposals = WebUI.MAX_PROPOSALS;
-
-               for (int i = 0; i != identifiers.length; i++) {
-                       identifier = (String) identifiers[i];
-                       if (context.canEvaluate(identifier)) {
-                               if (maxProposals-- < 0) {
-                                       return;
-                               }
-                               fProposals.add(new IdentifierProposal(identifier, context,
-                                               region, viewer, PHPUiImages.get(PHPUiImages.IMG_FUN),
-                                               PHPUiImages.get(PHPUiImages.IMG_VAR)));
-                       }
-               }
-       }
-
-}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierProposal.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierProposal.java
deleted file mode 100644 (file)
index 3f27aad..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-package net.sourceforge.phpdt.internal.ui.text.template;
-
-import net.sourceforge.phpdt.internal.corext.template.TemplateMessages;
-import net.sourceforge.phpdt.internal.corext.template.php.JavaContext;
-import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
-import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI;
-import net.sourceforge.phpeclipse.ui.WebUI;
-//import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.templates.TemplateContext;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * A PHP identifier proposal.
- */
-public class IdentifierProposal extends AbstractProposal {
-       private final TemplateContext fContext;
-
-       private final Image fImage_fun;
-
-       private final Image fImage_var;
-
-       private final IRegion fRegion;
-
-       private final String fTemplate;
-
-       public IdentifierProposal(String template, TemplateContext context,
-                       IRegion region, ITextViewer viewer, Image image_fun, Image image_var) {
-               super(viewer);
-               fTemplate = template;
-               fContext = context;
-
-               fImage_fun = image_fun;
-               fImage_var = image_var;
-               fRegion = region;
-       }
-
-       public void apply(IDocument document) {
-               try {
-                       int start = fRegion.getOffset();
-                       int end = fRegion.getOffset() + fRegion.getLength();
-                       document.replace(start, end - start, fTemplate);
-                       // translate positions
-                       LinkedPositionManager manager = new LinkedPositionManager(document);
-
-                       LinkedPositionUI editor = new LinkedPositionUI(fViewer, manager);
-                       editor.setFinalCaretOffset(fTemplate.length() + start);
-                       editor.enter();
-                       fSelectedRegion = editor.getSelectedRegion();
-               } catch (BadLocationException e) {
-                       WebUI.log(e);
-                       openErrorDialog(e);
-               }
-       }
-
-       public String getAdditionalProposalInfo() {
-               return textToHTML(fTemplate); 
-       }
-
-       public String getDisplayString() {
-               return fTemplate
-                               + TemplateMessages.getString("TemplateProposal.delimiter")
-                               + fTemplate; // $NON-NLS-1$
-       }
-
-       public Image getImage() {
-               if (fTemplate.charAt(0) == '$') {
-                       return fImage_var;
-               }
-               return fImage_fun;
-       }
-
-       public int getRelevance() {
-               if (fContext instanceof JavaContext) {
-                       JavaContext context = (JavaContext) fContext;
-                       switch (context.getCharacterBeforeStart()) {
-                       // high relevance after whitespace
-                       case ' ':
-                       case '\r':
-                       case '\n':
-                       case '\t':
-                               return 50;
-                       default:
-                               return 0;
-                       }
-               } else {
-                       return 50;
-               }
-       }
-}
\ No newline at end of file