-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into carstenartur-patch-1
- Loading branch information
Showing
5 changed files
with
152 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...nit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/FixMethodOrderJUnitPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Carsten Hammer. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Carsten Hammer | ||
*******************************************************************************/ | ||
package org.sandbox.jdt.internal.corext.fix.helper; | ||
|
||
import java.util.Map.Entry; | ||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.core.dom.AST; | ||
import org.eclipse.jdt.core.dom.ASTNode; | ||
import org.eclipse.jdt.core.dom.Annotation; | ||
import org.eclipse.jdt.core.dom.CompilationUnit; | ||
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; | ||
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite; | ||
import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperationWithSourceRange; | ||
import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; | ||
import org.eclipse.text.edits.TextEditGroup; | ||
import org.sandbox.jdt.internal.common.HelperVisitor; | ||
import org.sandbox.jdt.internal.common.ReferenceHolder; | ||
import org.sandbox.jdt.internal.corext.fix.JUnitCleanUpFixCore; | ||
|
||
/** | ||
* | ||
* | ||
*/ | ||
public class FixMethodOrderJUnitPlugin extends AbstractTool<ReferenceHolder<Integer, JunitHolder>> { | ||
|
||
@Override | ||
public void find(JUnitCleanUpFixCore fixcore, CompilationUnit compilationUnit, | ||
Set<CompilationUnitRewriteOperationWithSourceRange> operations, Set<ASTNode> nodesprocessed) { | ||
ReferenceHolder<Integer, JunitHolder> dataholder= new ReferenceHolder<>(); | ||
HelperVisitor.callSingleMemberAnnotationVisitor("org.junit.FixMethodOrder", compilationUnit, dataholder, nodesprocessed, | ||
(visited, aholder) -> processFoundNodeRunWith(fixcore, operations, visited, aholder)); | ||
} | ||
|
||
private boolean processFoundNodeRunWith(JUnitCleanUpFixCore fixcore, | ||
Set<CompilationUnitRewriteOperationWithSourceRange> operations, Annotation node, | ||
ReferenceHolder<Integer, JunitHolder> dataholder) { | ||
|
||
return false; | ||
} | ||
|
||
@Override | ||
public void rewrite(JUnitCleanUpFixCore upp, final ReferenceHolder<Integer, JunitHolder> hit, | ||
final CompilationUnitRewrite cuRewrite, TextEditGroup group) { | ||
// ASTRewrite rewrite= cuRewrite.getASTRewrite(); | ||
// AST ast= cuRewrite.getRoot().getAST(); | ||
// ImportRewrite importrewriter= cuRewrite.getImportRewrite(); | ||
// for (Entry<Integer, JunitHolder> entry : hit.entrySet()) { | ||
//JunitHolder mh= entry.getValue(); | ||
// @SuppressWarnings("unused") | ||
// Annotation minv= mh.getAnnotation(); | ||
// } | ||
} | ||
|
||
@Override | ||
public String getPreview(boolean afterRefactoring) { | ||
if (afterRefactoring) { | ||
return """ | ||
@FixMethodOrder({ | ||
}) | ||
"""; //$NON-NLS-1$ | ||
} | ||
return """ | ||
@FixMethodOrder({ | ||
}) | ||
"""; //$NON-NLS-1$ | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "FixMethodOrder"; //$NON-NLS-1$ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...it_cleanup/src/org/sandbox/jdt/internal/ui/preferences/cleanup/CleanUpMessages.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP=JUNIT_CLEANUP | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_ASSERT=Assert | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_ASSUME=Assume | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_IGNORE=Ignore | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_TEST=Test | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_BEFORE=Before | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_AFTER=After | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_BEFORECLASS=BeforeClass | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_AFTERCLASS=AfterClass | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RULETEMPORARYFOLDER=Rule TemporaryFolder | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RULETESTNAME=Rule Testname | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_EXTERNALRESOURCE=ExternalResource | ||
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RUNWITH=RunWith | ||
JavaFeatureTabPage_GroupName_JUnit=JUnit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters