diff options
author | Elliott Baron <ebaron@fedoraproject.org> | 2010-06-26 22:27:34 -0400 |
---|---|---|
committer | Elliott Baron <ebaron@fedoraproject.org> | 2010-06-26 22:27:34 -0400 |
commit | 4e112eca7750a4f530c986be55c178c43c16d3ea (patch) | |
tree | db140c4fe4db9945502398e4869707ca0346353e /org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java | |
parent | aa73b3f2503808e4b4029a73368a75b258d6f0dc (diff) | |
download | codan-master.tar.gz codan-master.tar.xz codan-master.zip |
* org.eclipse.cdt.codan.checkers.ui: Updated.
* org.eclipse.cdt.codan.checkers: Updated.
* org.eclipse.cdt.codan.core: Updated.
* org.eclipse.cdt.codan.ui: Updated.
* org.eclipse.cdt.codan.core.cxx: Added.
* org.eclipse.cdt.codan.extension/META-INF/MANIFEST.MF: Import org.eclipse.cdt.codan.core.cxx.model.
* org.eclipse.cdt.codan.extension/src/org/eclipse/cdt/codan/extension/checkers/AbstractPropSimChecker.java: Superclass moved.
Diffstat (limited to 'org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java')
-rw-r--r-- | org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java deleted file mode 100644 index 5c28d53..0000000 --- a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Andrew Gvozdev - * 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: - * Andrew Gvozdev - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.codan.checkers.ui.quickfix; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.FindReplaceDocumentAdapter; -import org.eclipse.jface.text.IDocument; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IMarkerResolution; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.texteditor.ITextEditor; - -public class QuickFixAssignmentInCondition implements IMarkerResolution { - public String getLabel() { - return "Change to '=='"; - } - - public void run(IMarker marker) { - // See if there is an open editor on the file containing the marker - IWorkbenchWindow w = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow(); - if (w == null) { - return; - } - IWorkbenchPage page = w.getActivePage(); - if (page == null) { - return; - } - IFileEditorInput input = new FileEditorInput((IFile) marker - .getResource()); - IEditorPart editorPart = page.findEditor(input); - if (editorPart == null) { - // open an editor - try { - editorPart = IDE.openEditor(page, (IFile) marker.getResource(), - true); - } catch (PartInitException e) { - e.printStackTrace(); - } - } - if (editorPart == null) { - return; - } - if (editorPart instanceof ITextEditor) { - ITextEditor editor = (ITextEditor) editorPart; - IDocument doc = editor.getDocumentProvider().getDocument( - editor.getEditorInput()); - int line = marker.getAttribute(IMarker.LINE_NUMBER, -1) - 1; - FindReplaceDocumentAdapter dad = new FindReplaceDocumentAdapter(doc); - try { - dad.find(doc.getLineOffset(line), "=", /* forwardSearch */ - true, /* caseSensitive */false, - /* wholeWord */false, /* regExSearch */false); - dad.replace("==", /* regExReplace */false); - marker.delete(); - } catch (BadLocationException e) { - // TODO: log the error - e.printStackTrace(); - } catch (CoreException e) { - // TODO: log the error - e.printStackTrace(); - } - } - } -} |