diff options
Diffstat (limited to 'bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction')
5 files changed, 0 insertions, 334 deletions
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/ContributedProcessorDescriptor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/ContributedProcessorDescriptor.java deleted file mode 100644 index be6df0f2fd..0000000000 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/ContributedProcessorDescriptor.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.ui.internal.correction; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; - -public class ContributedProcessorDescriptor { - private static final String CLASS = "class"; //$NON-NLS-1$ - - private IConfigurationElement fConfigurationElement; - private Object fProcessorInstance; - - public ContributedProcessorDescriptor(IConfigurationElement element) { - fConfigurationElement = element; - fProcessorInstance = null; - } - - public Object getProcessor() throws CoreException { - if (fProcessorInstance == null && fConfigurationElement != null) { - fProcessorInstance = fConfigurationElement.createExecutableExtension(CLASS); - } - return fProcessorInstance; - } -} diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickAssistProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickAssistProcessor.java deleted file mode 100644 index bbcad2ed77..0000000000 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickAssistProcessor.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.ui.internal.correction; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.wst.sse.ui.StructuredTextViewer; - - -public interface IQuickAssistProcessor { - /** - * Returns true if the processor can assist at the given offset. This test - * should be an optimistic guess and be extremly cheap. - */ - boolean canAssist(StructuredTextViewer viewer, int offset); - - /** - * Collects proposals for assistant at the given offset. - */ - ICompletionProposal[] getProposals(StructuredTextViewer viewer, int offset) throws CoreException; -} diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickFixProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickFixProcessor.java deleted file mode 100644 index 77441acf0b..0000000000 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickFixProcessor.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.ui.internal.correction; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.source.Annotation; - -public interface IQuickFixProcessor { - /** - * Returns true if the processor can fix the given problem. This test - * should be an optimistic guess and be extremly cheap. - */ - boolean canFix(Annotation annnotation); - - /** - * Collects proposals for fixing the given problem. - */ - ICompletionProposal[] getProposals(Annotation annnotation) throws CoreException; -} diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/NoModificationCompletionProposal.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/NoModificationCompletionProposal.java deleted file mode 100644 index 8989d94059..0000000000 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/NoModificationCompletionProposal.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.ui.internal.correction; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.wst.sse.ui.internal.SSEUIPlugin; - -public class NoModificationCompletionProposal implements ICompletionProposal { - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.ICompletionProposal#apply(org.eclipse.jface.text.IDocument) - */ - public void apply(IDocument document) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getAdditionalProposalInfo() - */ - public String getAdditionalProposalInfo() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getContextInformation() - */ - public IContextInformation getContextInformation() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getDisplayString() - */ - public String getDisplayString() { - return SSEUIPlugin.getResourceString("%NoModificationCompletionProposal.0"); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getImage() - */ - public Image getImage() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getSelection(org.eclipse.jface.text.IDocument) - */ - public Point getSelection(IDocument document) { - return null; - } - -} diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/StructuredCorrectionProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/StructuredCorrectionProcessor.java deleted file mode 100644 index e3734e3802..0000000000 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/StructuredCorrectionProcessor.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.ui.internal.correction; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.Position; -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.jface.text.source.Annotation; -import org.eclipse.jface.text.source.IAnnotationModel; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.texteditor.ITextEditor; -import org.eclipse.wst.sse.core.exceptions.SourceEditingRuntimeException; -import org.eclipse.wst.sse.ui.StructuredTextViewer; - - -public class StructuredCorrectionProcessor implements IContentAssistProcessor { - protected IAnnotationModel fAnnotationModel; - protected IQuickAssistProcessor fQuickAssistProcessor; - protected IQuickFixProcessor fQuickFixProcessor; - - public StructuredCorrectionProcessor(ITextEditor editor) { - IEditorInput input = ((IEditorPart) editor).getEditorInput(); - IAnnotationModel annotationModel = editor.getDocumentProvider().getAnnotationModel(input); - - fAnnotationModel = annotationModel; - } - - protected void addQuickAssistProposals(StructuredTextViewer viewer, ArrayList proposals, int documentOffset) { - try { - IQuickAssistProcessor processor = getQuickAssistProcessor(); - if (processor != null && processor.canAssist(viewer, documentOffset)) { - ICompletionProposal[] res = processor.getProposals(viewer, documentOffset); - if (res != null) { - for (int k = 0; k < res.length; k++) { - proposals.add(res[k]); - } - } - } - } catch (Exception e) { - throw new SourceEditingRuntimeException(); - } - } - - protected void addQuickFixProposals(StructuredTextViewer viewer, ArrayList proposals, int documentOffset) { - Iterator iter = fAnnotationModel.getAnnotationIterator(); - while (iter.hasNext()) { - Annotation annotation = (Annotation) iter.next(); - Position pos = fAnnotationModel.getPosition(annotation); - if (pos != null && documentOffset >= pos.offset && documentOffset <= pos.offset + pos.length) { - IQuickFixProcessor processor = getQuickFixProcessor(); - if (processor != null && processor.canFix(annotation)) { - try { - ICompletionProposal[] res = processor.getProposals(annotation); - if (res != null) { - for (int k = 0; k < res.length; k++) { - proposals.add(res[k]); - } - } - } catch (CoreException e) { - throw new SourceEditingRuntimeException(); - } - } - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, - * int) - */ - public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) { - ArrayList proposals = new ArrayList(); - - if (viewer instanceof StructuredTextViewer) { - addQuickFixProposals((StructuredTextViewer) viewer, proposals, documentOffset); - - if (proposals.isEmpty()) { - addQuickAssistProposals((StructuredTextViewer) viewer, proposals, documentOffset); - } - } - - if (proposals.isEmpty()) - proposals.add(new NoModificationCompletionProposal()); - - return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, - * int) - */ - public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() - */ - public char[] getCompletionProposalAutoActivationCharacters() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters() - */ - public char[] getContextInformationAutoActivationCharacters() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator() - */ - public IContextInformationValidator getContextInformationValidator() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage() - */ - public String getErrorMessage() { - return null; - } - - protected IQuickAssistProcessor getQuickAssistProcessor() { - return null; - } - - protected IQuickFixProcessor getQuickFixProcessor() { - return null; - } -} |