diff options
author | cbridgha | 2006-03-06 15:46:39 +0000 |
---|---|---|
committer | cbridgha | 2006-03-06 15:46:39 +0000 |
commit | f02b1598fcb9888324642fb7a5d4e85068606649 (patch) | |
tree | be21a23ab7fc4d4dc404d9ad6d6835b2f25d5dc3 | |
parent | 4843c2035486b853a15a61fe9aa07274b9a22fbb (diff) | |
download | webtools.javaee-f02b1598fcb9888324642fb7a5d4e85068606649.tar.gz webtools.javaee-f02b1598fcb9888324642fb7a5d4e85068606649.tar.xz webtools.javaee-f02b1598fcb9888324642fb7a5d4e85068606649.zip |
[114446] Removing unused classes
4 files changed, 0 insertions, 592 deletions
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaInsertionHelper.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaInsertionHelper.java deleted file mode 100644 index abab902bb..000000000 --- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaInsertionHelper.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.common.jdt.internal.integration; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jdt.core.jdom.DOMFactory; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - - -/** - * @author DABERG - * - * This class is used by the Java snippet support to capture the insertionString that is to be - * inserted at the users selection point. It also provides the ability to define additional fields - * and methods to support the insertionString. - */ -public class JavaInsertionHelper { - protected DOMFactory domFactory = new DOMFactory(); - protected List fields; - protected List methods; - protected List imports; - protected String insertionString; - protected List extendedOperations; - - /** - * - */ - public JavaInsertionHelper() { - super(); - } - - /** - * @return - */ - public List getFields() { - return fields; - } - - /** - * @return - */ - public String getInsertionString() { - return insertionString; - } - - /** - * @return - */ - public List getMethods() { - return methods; - } - - /** - * This is required to be set by the client. This is the String that will be inserted at the - * users selection point. - * - * @param string - */ - public void setInsertionString(String string) { - insertionString = string; - } - - /** - * This is a utility method that will parse the methodString and create a IDOMMethod. The - * DOMFactory will be used to create the method. This new method will be added to the list of - * methods. - * - * @param methodString - * @see DOMFactory#createMethod(java.lang.String) - * @link org.eclipse.jdt.core.jdom.IDOMMethod - */ - public void addMethodFromSourceString(String methodString) { - if (methodString != null && methodString.length() > 0) { - if (methods == null) - methods = new ArrayList(); - methods.add(domFactory.createMethod(methodString)); - } - } - - /** - * This is a utility method that will parse the fieldString and create a IDOMField. The - * DOMFactory will be used to create the field. This new field will be added to the list of - * fields. - * - * @param fieldString - * @see DOMFactory#createField(java.lang.String) - * @link org.eclipse.jdt.core.jdom.IDOMField - */ - public void addFieldFromSourceString(String fieldString) { - if (fieldString != null && fieldString.length() > 0) { - if (fields == null) - fields = new ArrayList(); - fields.add(domFactory.createField(fieldString)); - } - } - - /** - * Add an import that is either the qualified name of a type or a package name with .* at the - * end. - * - * @param importString - */ - public void addImport(String importString) { - if (importString != null && importString.length() > 0) { - if (imports == null) - imports = new ArrayList(); - imports.add(importString); - } - } - - /** - * Return true if the insertionString is set and not a zero length. - * - * @return - */ - public boolean canInsertText() { - return insertionString != null && insertionString.length() > 0; - } - - /** - * @return - */ - public boolean hasFields() { - return fields != null && !fields.isEmpty(); - } - - /** - * @return - */ - public boolean hasMethods() { - return methods != null && !methods.isEmpty(); - } - - public boolean hasImports() { - return imports != null && !imports.isEmpty(); - } - - /** - * @return Returns the imports. - */ - public List getImportStatements() { - return imports; - } - - /** - * @return Returns the extendedOperations. - */ - public List getExtendedOperations() { - return extendedOperations; - } - - /** - * This method allows you to add additional operations which will be performed after this - * JavaInsertionHelper is processed by the JavaInsertionOperation. - * - * @param operation - * @link JavaInsertionOperation - */ - public void addExtendedOperation(IHeadlessRunnableWithProgress operation) { - if (operation != null) { - if (extendedOperations == null) - extendedOperations = new ArrayList(); - extendedOperations.add(operation); - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/common/jdt/internal/integration/ui/JavaInsertionOperation.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/common/jdt/internal/integration/ui/JavaInsertionOperation.java deleted file mode 100644 index 6ee2dd804..000000000 --- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/common/jdt/internal/integration/ui/JavaInsertionOperation.java +++ /dev/null @@ -1,251 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * Created on Mar 25, 2004 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.common.jdt.internal.integration.ui; - -import java.lang.reflect.InvocationTargetException; -import java.text.MessageFormat; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jdt.core.ToolFactory; -import org.eclipse.jdt.core.formatter.CodeFormatter; -import org.eclipse.jdt.core.jdom.IDOMField; -import org.eclipse.jdt.core.jdom.IDOMMethod; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jst.common.jdt.internal.integration.JavaInsertionHelper; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.TextEdit; -import org.eclipse.ui.IEditorInput; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - -/** - * @author DABERG - * - * To change the template for this generated type comment go to Window>Preferences>Java>Code - * Generation>Code and Comments - */ -public class JavaInsertionOperation implements IHeadlessRunnableWithProgress { - private static final String NEW_LINE = System.getProperty("line.separator"); //$NON-NLS-1$ - protected JavaInsertionHelper insertionHelper; - protected IEditorInput editorInput; - protected IDocument document; - protected ITextSelection textSelection; - protected IProgressMonitor monitor; - - /** - * - */ - public JavaInsertionOperation(JavaInsertionHelper insertionHelper, IEditorInput editorInput, IDocument document, ITextSelection textSelection) { - super(); - this.insertionHelper = insertionHelper; - this.editorInput = editorInput; - this.document = document; - this.textSelection = textSelection; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.IHeadlessRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) - */ - public void run(IProgressMonitor monitorArg) throws InvocationTargetException, InterruptedException { - this.monitor = monitorArg; - insertCodeSnippet(); - processJavaHelper(); - } - - /** - * - */ - protected void insertCodeSnippet() throws InvocationTargetException { - String replacementString = insertionHelper.getInsertionString(); - if (replacementString == null || replacementString.length() == 0) - return; - if (textSelection == null) - throw new RuntimeException("No text selection for inserting text."); //$NON-NLS-1$ - try { - document.replace(textSelection.getOffset(), textSelection.getLength(), replacementString); - } catch (BadLocationException e) { - throw new InvocationTargetException(e); - } - int start = textSelection.getStartLine(); - int lines = document.computeNumberOfLines(replacementString) + 1; - format(document, start, lines, 0); - } - - protected void processJavaHelper() { - ICompilationUnit cu = JavaUI.getWorkingCopyManager().getWorkingCopy(editorInput); - if (cu != null) { - IType type = null; - try { - type = cu.getTypes()[0]; - } catch (JavaModelException e) { - //Ignore - } - if (type != null) { - if (insertionHelper.hasFields()) - createFields(type, insertionHelper.getFields()); - if (insertionHelper.hasMethods()) - createMethods(type, insertionHelper.getMethods()); - if (insertionHelper.hasImports()) - createImports(cu, insertionHelper.getImportStatements()); - executeExtendedOperations(); - } - } - } - - /** - * - */ - private void executeExtendedOperations() { - List ops = insertionHelper.getExtendedOperations(); - if (ops != null) { - for (int i = 0; i < ops.size(); i++) - executedExtendedOperation((IHeadlessRunnableWithProgress) ops.get(i)); - } - } - - /** - * @param operation - */ - private void executedExtendedOperation(IHeadlessRunnableWithProgress operation) { - try { - operation.run(null); - } catch (Exception e) { - Logger log = Logger.getLogger(); - log.log("Executing extended operation failed: " + operation); //$NON-NLS-1$ - log.log(e); - } - } - - protected void createFields(IType aType, List fields) { - IDOMField field; - for (int i = 0; i < fields.size(); i++) { - field = (IDOMField) fields.get(i); - if (!aType.getField(field.getName()).exists()) { - try { - aType.createField(format(field.getContents(), 1, true), null, true, null); - } catch (JavaModelException e) { - Logger.getLogger().logError(e); - } - } - } - } - - /** - * @param wc - */ - protected void createMethods(IType aType, List methods) { - IDOMMethod method; - for (int i = 0; i < methods.size(); i++) { - method = (IDOMMethod) methods.get(i); - if (!aType.getMethod(method.getName(), getParamaterTypeSignatures(method)).exists()) { - try { - aType.createMethod(format(method.getContents(), 1, true), null, true, null); - } catch (JavaModelException e) { - Logger.getLogger().logError(e); - } - } - } - } - - protected void createImports(ICompilationUnit cu, List imports) { - String importStmt; - for (int i = 0; i < imports.size(); i++) { - importStmt = (String) imports.get(i); - if (!cu.getImport(importStmt).exists() && !importStmt.startsWith("java.lang")) { //$NON-NLS-1$ - try { - cu.createImport(importStmt, null, null); - } catch (JavaModelException e) { - Logger.getLogger().logError(e); - } - } - } - } - - protected String format(String contents, int indent, boolean ensureEndLineReturn) { - Document doc = new Document(contents); - int lines = doc.getNumberOfLines(); - format(doc, 0, lines - 1, indent); - String result = doc.get(); - if (ensureEndLineReturn) - result = ensureLineReturn(result); - return result; - } - - protected void format(IDocument documentArg, int startLine, int lines, int indent) { - try { - int end = documentArg.getLineOffset(startLine + lines); - int length = end - startLine; - CodeFormatter formatter = ToolFactory.createCodeFormatter(null); - TextEdit edit = formatter.format(CodeFormatter.K_UNKNOWN, documentArg.get(), startLine, length, indent, null); - if (edit != null) { - try { - edit.apply(documentArg); - } catch (MalformedTreeException e) { - //Ignore - } - } - } catch (BadLocationException e) { - Logger log = Logger.getLogger(); - log.log("Failed to format text."); //$NON-NLS-1$ - log.log(e); - } - } - - protected String formatString(String pattern, String[] arguments) { - return MessageFormat.format(pattern, arguments); - } - - /** - * @param result - * @return - */ - protected String ensureLineReturn(String aString) { - if (!aString.endsWith(NEW_LINE)) - return aString + NEW_LINE; - return aString; - } - - protected String[] getParamaterTypeSignatures(IDOMMethod aMethod) { - String[] result = null; - String[] parms = aMethod.getParameterTypes(); - if (parms != null) { - if (parms.length == 0) - result = parms; - else - result = new String[parms.length]; - boolean isResolved = false; - String parm; - for (int i = 0; i < parms.length; i++) { - parm = parms[i]; - isResolved = parm.indexOf('.') > 0; - result[i] = Signature.createTypeSignature(parm, isResolved); - } - } - return result; - } -} diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtensionHandlerReader.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtensionHandlerReader.java deleted file mode 100644 index f22afe439..000000000 --- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtensionHandlerReader.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * Created on Feb 5, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.servertarget; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IPluginRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.jem.util.RegistryReader; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; - -/** - * @author vijayb - * @deprecated - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class TargetRuntimeExtensionHandlerReader extends RegistryReader { - static TargetRuntimeExtensionHandlerReader instance = null; - protected ITargetRuntimeExtensionHandler targetRuntimeExtHandler; - protected String HANDLER_EXT_Id = "targetRuntimeExtensionHandler"; //$NON-NLS-1$ - protected TargetRuntimeExtension extension = null; - protected String HANDLER_CLASSNAME = "className"; //$NON-NLS-1$ - protected String HANDLER_GROUP_ID = "groupID"; //$NON-NLS-1$ - protected HashMap handlerExtensions = null; - - /** - * @param registry - * @param plugin - * @param extensionPoint - */ - public TargetRuntimeExtensionHandlerReader(IPluginRegistry registry, String plugin, String extensionPoint) { - super(plugin, extensionPoint); - } - - /** - * - */ - public TargetRuntimeExtensionHandlerReader() { - super(J2EEPlugin.PLUGIN_ID, "TargetRuntimeExtHandler"); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement) - */ - public boolean readElement(IConfigurationElement element) { - if (!element.getName().equals(HANDLER_EXT_Id)) - return false; - String group = element.getAttribute(HANDLER_GROUP_ID); - String className = element.getAttribute(HANDLER_CLASSNAME); - if (group == null) { - logMissingAttribute(element, "Missing group target runtime extension specification."); //$NON-NLS-1$ - return false; - } - try { - String pluginId = element.getDeclaringExtension().getNamespace(); - Plugin plugin = Platform.getPlugin(pluginId); - extension = new TargetRuntimeExtension(plugin, element, group, className); - addExtensionPoint(extension); - return true; - } catch (Exception ce) { - ce.printStackTrace(); - } - return false; - } - - /** - * Sets the extension point. - * - * @param extensions - * The extensions to set - */ - protected void addExtensionPoint(TargetRuntimeExtension newExtension) { - if (handlerExtensions == null) - handlerExtensions = new HashMap(); - Collection temp = null; - Object holder = handlerExtensions.get(newExtension.getGroupId()); - if (temp == null) { - temp = new ArrayList(); - temp.add(newExtension); - } else { - handlerExtensions.remove(newExtension.getGroupId()); - temp = (Collection) holder; - temp.add(newExtension); - } - handlerExtensions.put(newExtension.getGroupId(), temp); - } - - /** - * Gets the instance. - * - * @return Returns a TargetRuntimeExtensionHandlerReader - */ - public static TargetRuntimeExtensionHandlerReader getInstance() { - if (instance == null) - instance = new TargetRuntimeExtensionHandlerReader(); - return instance; - } - - public ITargetRuntimeExtensionHandler getEJBExtHandler() { - if (targetRuntimeExtHandler == null && handlerExtensions != null) { - TargetRuntimeExtension codegenExt = null; - ArrayList ibmExtensions = (ArrayList) handlerExtensions.get("IBM"); //$NON-NLS-1$ - if (ibmExtensions != null) { - for (int i = 0; i < ibmExtensions.size(); i++) { - Object obj = ibmExtensions.get(i); - if (obj instanceof TargetRuntimeExtension) { - codegenExt = (TargetRuntimeExtension) obj; - break; - } - } - } - if (codegenExt != null) { - IConfigurationElement cElement = codegenExt.configElement; - try { - targetRuntimeExtHandler = (ITargetRuntimeExtensionHandler) cElement.createExecutableExtension("run"); //$NON-NLS-1$ - } catch (Exception e) { - e.printStackTrace(); - } - } - } - return targetRuntimeExtHandler; - } -} diff --git a/plugins/org.eclipse.jst.j2ee/plugin.xml b/plugins/org.eclipse.jst.j2ee/plugin.xml index 6819c58e2..efdce307b 100644 --- a/plugins/org.eclipse.jst.j2ee/plugin.xml +++ b/plugins/org.eclipse.jst.j2ee/plugin.xml @@ -10,27 +10,6 @@ <!-- Codegen Contributions --> <!--============================--> -<!-- This extension-point sends notification to all extensions when J2EEModules are imported. - Each extension can specify a set of different module types to listen for or listen to them - all. The default is to receive notification for all module types. Notification is sent - to the specified class implementing org.eclipse.jst.j2ee.internal.J2EEModulePostImportHandler - - Both of the following examples register for notification for all J2EEModule types, the first - uses the defaults, while the second specifies each module type. To listen for only specific - module types, use the second example and specify only the types to listen to. - - <extension point="org.eclipse.jst.j2ee.internal.J2EEModulePostImport"> - <postImport className="org.eclipse.jst.j2ee.internal.tests.extensions.ModulePostImportTestDefault"></postImport> - </extension> - - <extension point="org.eclipse.jst.j2ee.internal.J2EEModulePostImport"> - <postImport className="org.eclipse.jst.j2ee.internal.tests.extensions.ModulePostImportTestAll"></postImport> - <module type="WEB"></module> - <module type="EJB"></module> - <module type="ApplicationClient"></module> - <module type="Connector"></module> - </extension> - --> <extension-point id="J2EEModulePostImport" name="J2EEModulePostImport" schema="schema/J2EEModulePostImport.exsd"/> <extension-point id="EARModuleExtension" name="EARModuleExtension" schema="schema/EARModuleExtension.exsd"/> |