mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Revert "Temporarily restored compatibility with Eclipse 3.7."
This commit is contained in:
parent
789f315fce
commit
48eff8e4ae
9 changed files with 40 additions and 114 deletions
|
@ -28,6 +28,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
|||
import org.eclipse.jface.text.TextSelection;
|
||||
import org.eclipse.ltk.core.refactoring.Change;
|
||||
import org.eclipse.ltk.core.refactoring.Refactoring;
|
||||
import org.eclipse.ltk.core.refactoring.RefactoringContext;
|
||||
import org.eclipse.ltk.core.refactoring.RefactoringDescriptor;
|
||||
import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
|
||||
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
||||
|
@ -50,7 +51,6 @@ import org.eclipse.cdt.ui.testplugin.CTestPlugin;
|
|||
|
||||
import org.eclipse.cdt.internal.ui.refactoring.CRefactoring;
|
||||
import org.eclipse.cdt.internal.ui.refactoring.CRefactoringContext;
|
||||
import org.eclipse.cdt.internal.ui.refactoring.RefactoringContext;
|
||||
|
||||
/**
|
||||
* Common base for refactoring tests.
|
||||
|
@ -145,8 +145,6 @@ public abstract class RefactoringTestBase extends BaseTestCase {
|
|||
}
|
||||
|
||||
protected void assertRefactoringSuccess() throws Exception {
|
||||
if (historyScript != null)
|
||||
return; // History tests are temporarily disabled.
|
||||
executeRefactoring(true);
|
||||
compareFiles();
|
||||
}
|
||||
|
@ -217,9 +215,9 @@ public abstract class RefactoringTestBase extends BaseTestCase {
|
|||
for (RefactoringDescriptorProxy proxy : history.getDescriptors()) {
|
||||
RefactoringDescriptor descriptor = proxy.requestDescriptor(NULL_PROGRESS_MONITOR);
|
||||
RefactoringStatus status = new RefactoringStatus();
|
||||
// RefactoringContext context = descriptor.createRefactoringContext(status);
|
||||
// assertTrue(status.isOK());
|
||||
// executeRefactoring(context.getRefactoring(), context, false, expectedSuccess);
|
||||
RefactoringContext context = descriptor.createRefactoringContext(status);
|
||||
assertTrue(status.isOK());
|
||||
executeRefactoring(context.getRefactoring(), context, false, expectedSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,8 +103,8 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="[5.2.0,6.0.0)",
|
|||
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
|
||||
org.eclipse.help;bundle-version="[3.2.0,4.0.0)",
|
||||
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)",
|
||||
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0",
|
||||
org.eclipse.ltk.ui.refactoring;bundle-version="3.4.0",
|
||||
org.eclipse.ltk.core.refactoring;bundle-version="3.6.0",
|
||||
org.eclipse.ltk.ui.refactoring;bundle-version="3.6.0",
|
||||
org.eclipse.search;bundle-version="[3.2.0,4.0.0)",
|
||||
org.eclipse.ui;bundle-version="[3.3.0,4.0.0)",
|
||||
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.ltk.core.refactoring.RefactoringContext;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
|
|
|
@ -57,13 +57,13 @@ public abstract class CRefactoringDescriptor extends RefactoringDescriptor {
|
|||
@Override
|
||||
public abstract CRefactoring createRefactoring(RefactoringStatus status) throws CoreException;
|
||||
|
||||
// @Override
|
||||
// public CRefactoringContext createRefactoringContext(RefactoringStatus status) throws CoreException {
|
||||
// CRefactoring refactoring= createRefactoring(status);
|
||||
// if (refactoring == null)
|
||||
// return null;
|
||||
// return new CRefactoringContext(refactoring);
|
||||
// }
|
||||
@Override
|
||||
public CRefactoringContext createRefactoringContext(RefactoringStatus status) throws CoreException {
|
||||
CRefactoring refactoring= createRefactoring(status);
|
||||
if (refactoring == null)
|
||||
return null;
|
||||
return new CRefactoringContext(refactoring);
|
||||
}
|
||||
|
||||
protected ISelection getSelection() throws CoreException {
|
||||
ISelection selection;
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 Google, Inc 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:
|
||||
* Sergey Prigogin <eclipse.sprigogin@gmail.com> - [refactoring] Provide a way to implement refactorings that depend on resources that have to be explicitly released - https://bugs.eclipse.org/347599
|
||||
* IBM Corporation - bug fixes
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.refactoring;
|
||||
|
||||
import org.eclipse.ltk.core.refactoring.Refactoring;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Refactoring context is a disposable object that can be used by a refactoring to hold resources
|
||||
* that have to be explicitly released. The refactoring context is guaranteed to receive
|
||||
* a {@link #dispose()} call after the associated refactoring has finished or produced an error.
|
||||
* At this point, the refactoring context must release all resources and detach all listeners.
|
||||
* A refactoring context can only be disposed once; it cannot be reused.
|
||||
* </p>
|
||||
* <p>
|
||||
* This class is intended to be subclassed by clients wishing to implement new refactorings that
|
||||
* depend on resources that have to be explicitly released.
|
||||
* </p>
|
||||
*/
|
||||
public class RefactoringContext {
|
||||
private Refactoring fRefactoring;
|
||||
|
||||
/**
|
||||
* Creates a context for the given refactoring.
|
||||
*
|
||||
* @param refactoring The refactoring associated with the context. Cannot be <code>null</code>.
|
||||
* @throws NullPointerException if refactoring is <code>null</code>.
|
||||
*/
|
||||
public RefactoringContext(Refactoring refactoring) {
|
||||
if (refactoring == null)
|
||||
throw new NullPointerException();
|
||||
fRefactoring= refactoring;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the refactoring associated with the context.
|
||||
* <p>
|
||||
* The returned refactoring must be in an initialized state, i.e. ready to
|
||||
* be executed via {@link PerformRefactoringOperation}.
|
||||
* </p>
|
||||
* @return The refactoring associated with the context.
|
||||
* @nooverride This method is not intended to be re-implemented or extended by clients.
|
||||
*/
|
||||
public Refactoring getRefactoring() {
|
||||
return fRefactoring;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposes of the context. This method will be called exactly once during the life cycle
|
||||
* of the context after the associated refactoring has finished or produced an error.
|
||||
* <p>
|
||||
* Subclasses may extend this method (must call super).
|
||||
* </p>
|
||||
*/
|
||||
public void dispose() {
|
||||
if (fRefactoring == null)
|
||||
throw new IllegalStateException("dispose() called more than once."); //$NON-NLS-1$
|
||||
fRefactoring= null;
|
||||
}
|
||||
}
|
|
@ -40,14 +40,13 @@ public class ExtractConstantRefactoringDescriptor extends CRefactoringDescriptor
|
|||
|
||||
@Override
|
||||
public CRefactoring createRefactoring(RefactoringStatus status) throws CoreException {
|
||||
return null;
|
||||
// ISelection selection = getSelection();
|
||||
// ICProject project = getCProject();
|
||||
// ExtractConstantRefactoring refactoring =
|
||||
// new ExtractConstantRefactoring(getTranslationUnit(), selection, project);
|
||||
// ExtractConstantInfo info = refactoring.getRefactoringInfo();
|
||||
// info.setName(arguments.get(NAME));
|
||||
// info.setVisibility(VisibilityEnum.getEnumForStringRepresentation(arguments.get(VISIBILITY)));
|
||||
// return refactoring;
|
||||
ISelection selection = getSelection();
|
||||
ICProject project = getCProject();
|
||||
ExtractConstantRefactoring refactoring =
|
||||
new ExtractConstantRefactoring(getTranslationUnit(), selection, project);
|
||||
ExtractConstantInfo info = refactoring.getRefactoringInfo();
|
||||
info.setName(arguments.get(NAME));
|
||||
info.setVisibility(VisibilityEnum.getEnumForStringRepresentation(arguments.get(VISIBILITY)));
|
||||
return refactoring;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,15 +41,14 @@ public class ExtractFunctionRefactoringDescriptor extends CRefactoringDescriptor
|
|||
|
||||
@Override
|
||||
public CRefactoring createRefactoring(RefactoringStatus status) throws CoreException {
|
||||
return null;
|
||||
// ISelection selection = getSelection();
|
||||
// ICProject project = getCProject();
|
||||
// ExtractFunctionRefactoring refactoring =
|
||||
// new ExtractFunctionRefactoring(getTranslationUnit(), selection, project);
|
||||
// ExtractFunctionInformation info = refactoring.getRefactoringInfo();
|
||||
// info.setMethodName(arguments.get(NAME));
|
||||
// info.setVisibility(VisibilityEnum.getEnumForStringRepresentation(arguments.get(VISIBILITY)));
|
||||
// info.setReplaceDuplicates(Boolean.parseBoolean(arguments.get(REPLACE_DUPLICATES)));
|
||||
// return refactoring;
|
||||
ISelection selection = getSelection();
|
||||
ICProject project = getCProject();
|
||||
ExtractFunctionRefactoring refactoring =
|
||||
new ExtractFunctionRefactoring(getTranslationUnit(), selection, project);
|
||||
ExtractFunctionInformation info = refactoring.getRefactoringInfo();
|
||||
info.setMethodName(arguments.get(NAME));
|
||||
info.setVisibility(VisibilityEnum.getEnumForStringRepresentation(arguments.get(VISIBILITY)));
|
||||
info.setReplaceDuplicates(Boolean.parseBoolean(arguments.get(REPLACE_DUPLICATES)));
|
||||
return refactoring;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,12 +38,11 @@ public class ExtractLocalVariableRefactoringDescriptor extends CRefactoringDescr
|
|||
|
||||
@Override
|
||||
public CRefactoring createRefactoring(RefactoringStatus status) throws CoreException {
|
||||
return null;
|
||||
// ISelection selection = getSelection();
|
||||
// ICProject proj = getCProject();
|
||||
// ExtractLocalVariableRefactoring refactoring =
|
||||
// new ExtractLocalVariableRefactoring(getTranslationUnit(), selection, proj);
|
||||
// refactoring.getRefactoringInfo().setName(arguments.get(NAME));
|
||||
// return refactoring;
|
||||
ISelection selection = getSelection();
|
||||
ICProject proj = getCProject();
|
||||
ExtractLocalVariableRefactoring refactoring =
|
||||
new ExtractLocalVariableRefactoring(getTranslationUnit(), selection, proj);
|
||||
refactoring.getRefactoringInfo().setName(arguments.get(NAME));
|
||||
return refactoring;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,9 +37,8 @@ public class HideMethodRefactoringDescriptor extends CRefactoringDescriptor {
|
|||
|
||||
@Override
|
||||
public CRefactoring createRefactoring(RefactoringStatus status) throws CoreException {
|
||||
return null;
|
||||
// ISelection selection = getSelection();
|
||||
// ICProject proj = getCProject();
|
||||
// return new HideMethodRefactoring(getTranslationUnit(), selection, proj);
|
||||
ISelection selection = getSelection();
|
||||
ICProject proj = getCProject();
|
||||
return new HideMethodRefactoring(getTranslationUnit(), selection, proj);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue