mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-85100 Deleting wrapped lines with Ctrl+Y doen't work properly with "soft wrapped" lines
More tests have been checked and added
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
package com.wrq.rearranger;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataConstants;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
@@ -31,14 +31,12 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.wrq.rearranger.entry.ClassContentsEntry;
|
||||
import com.wrq.rearranger.popup.FileStructurePopup;
|
||||
import com.wrq.rearranger.rearrangement.Emitter;
|
||||
@@ -48,6 +46,8 @@ import com.wrq.rearranger.rearrangement.Spacer;
|
||||
import com.wrq.rearranger.ruleinstance.RuleInstance;
|
||||
import com.wrq.rearranger.settings.RearrangerSettings;
|
||||
import com.wrq.rearranger.util.CommentUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.dnd.DragSource;
|
||||
import java.util.List;
|
||||
@@ -71,9 +71,6 @@ public final class RearrangerActionHandler extends EditorActionHandler {
|
||||
return tabSize;
|
||||
}
|
||||
|
||||
public void setTabSize(int tabSize) {
|
||||
RearrangerActionHandler.tabSize = tabSize;
|
||||
}
|
||||
// -------------------------- OTHER METHODS --------------------------
|
||||
|
||||
public final void execute(final Editor editor, final DataContext context) {
|
||||
@@ -81,11 +78,14 @@ public final class RearrangerActionHandler extends EditorActionHandler {
|
||||
return;
|
||||
}
|
||||
LOG.debug("enter RearrangerActionHandler.execute()");
|
||||
final Project project = (Project)context.getData(DataConstants.PROJECT);
|
||||
final Document document = editor.getDocument();
|
||||
final PsiFile psiFile = getFile(editor, context);
|
||||
LOG.debug("suggested tool window = " +
|
||||
WindowManager.getInstance().suggestParentWindow(project));
|
||||
if (psiFile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Project project = PlatformDataKeys.PROJECT.getData(context);
|
||||
final Document document = editor.getDocument();
|
||||
LOG.debug("suggested tool window = " + WindowManager.getInstance().suggestParentWindow(project));
|
||||
LOG.debug("drag source image supported = " + DragSource.isDragImageSupported());
|
||||
if (!psiFile.getName().endsWith(".java")) {
|
||||
LOG.debug("not a .java file -- skipping " + psiFile.getName());
|
||||
@@ -109,15 +109,14 @@ public final class RearrangerActionHandler extends EditorActionHandler {
|
||||
);
|
||||
}
|
||||
|
||||
private static PsiFile getFile(final Editor editor,
|
||||
final DataContext context)
|
||||
{
|
||||
final Project project = (Project)context.getData(DataConstants.PROJECT);
|
||||
final Document document = editor.getDocument();
|
||||
final FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
|
||||
final VirtualFile virtualFile = fileDocumentManager.getFile(document);
|
||||
final PsiManager psiManager = PsiManager.getInstance(project);
|
||||
return psiManager.findFile(virtualFile);
|
||||
@Nullable
|
||||
private static PsiFile getFile(final Editor editor, final DataContext context) {
|
||||
final Project project = PlatformDataKeys.PROJECT.getData(context);
|
||||
if (project == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +151,7 @@ public final class RearrangerActionHandler extends EditorActionHandler {
|
||||
wb.whenTrue();
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
LOG.warn(e);
|
||||
}
|
||||
LOG.debug("end execute");
|
||||
}
|
||||
@@ -162,10 +161,11 @@ public final class RearrangerActionHandler extends EditorActionHandler {
|
||||
return file != null && file.isWritable();
|
||||
}
|
||||
|
||||
public final void rearrangeDocument(final Project project,
|
||||
final PsiFile psiFile,
|
||||
final RearrangerSettings settings,
|
||||
final Document document)
|
||||
@SuppressWarnings("MethodMayBeStatic")
|
||||
public final void rearrangeDocument(@NotNull final Project project,
|
||||
@NotNull final PsiFile psiFile,
|
||||
@NotNull final RearrangerSettings settings,
|
||||
@NotNull final Document document)
|
||||
{
|
||||
LOG.debug("enter rearrangeDocument");
|
||||
new CommentUtil(settings); // create CommentUtil singleton
|
||||
|
||||
@@ -45,10 +45,7 @@ import java.util.*;
|
||||
* Corresponds to a method in the source file.
|
||||
* Contains structures and logic to handle related method rearrangement.
|
||||
*/
|
||||
public class MethodEntry
|
||||
extends ClassContentsEntry
|
||||
implements RelatableEntry
|
||||
{
|
||||
public class MethodEntry extends ClassContentsEntry implements RelatableEntry {
|
||||
// ------------------------------ FIELDS ------------------------------
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#" + MethodEntry.class.getName());
|
||||
@@ -716,9 +713,7 @@ public class MethodEntry
|
||||
}
|
||||
}
|
||||
|
||||
public void determineSettersAndMethodCalls(RearrangerSettings settings,
|
||||
List<ClassContentsEntry> contents)
|
||||
{
|
||||
public void determineSettersAndMethodCalls(RearrangerSettings settings, List<ClassContentsEntry> contents) {
|
||||
if (isGetter()) {
|
||||
if (settings.isKeepGettersSettersTogether()) {
|
||||
determineSetter(contents, settings); // link getters/setters via correspondingGetterSetter entries
|
||||
|
||||
@@ -62,22 +62,6 @@ public class CommentFillString {
|
||||
this.fillString = fillString;
|
||||
}
|
||||
|
||||
public boolean isUseProjectWidthForFill() {
|
||||
return useProjectWidthForFill;
|
||||
}
|
||||
|
||||
public void setUseProjectWidthForFill(boolean useProjectWidthForFill) {
|
||||
this.useProjectWidthForFill = useProjectWidthForFill;
|
||||
}
|
||||
|
||||
public int getFillWidth() {
|
||||
return fillWidth;
|
||||
}
|
||||
|
||||
public void setFillWidth(int fillWidth) {
|
||||
this.fillWidth = fillWidth;
|
||||
}
|
||||
|
||||
public final boolean equals(final Object object) {
|
||||
if (!(object instanceof CommentFillString)) return false;
|
||||
final CommentFillString c = (CommentFillString)object;
|
||||
@@ -111,8 +95,8 @@ public class CommentFillString {
|
||||
|
||||
public final void writeExternal(final Element me) {
|
||||
me.setAttribute("fillString", CommentRule.escape(fillString));
|
||||
me.setAttribute("useProjectWidthForFill", "" + useProjectWidthForFill);
|
||||
me.setAttribute("fillWidth", "" + fillWidth);
|
||||
me.setAttribute("useProjectWidthForFill", String.valueOf(useProjectWidthForFill));
|
||||
me.setAttribute("fillWidth", String.valueOf(fillWidth));
|
||||
}
|
||||
|
||||
public final JPanel getCommentFillStringPanel() {
|
||||
@@ -180,7 +164,7 @@ public class CommentFillString {
|
||||
String fs = fillString;
|
||||
if (fs.length() == 0) fs = " ";
|
||||
final int length = fs.length();
|
||||
StringBuffer sb = new StringBuffer(length * (length + 1) / 2 + length * 3);
|
||||
StringBuilder sb = new StringBuilder(length * (length + 1) / 2 + length * 3);
|
||||
sb.append('(');
|
||||
sb.append(RegexUtil.escape(fs));
|
||||
sb.append(")*");
|
||||
|
||||
+5
-5
@@ -24,26 +24,26 @@ package com.wrq.rearranger.settings.atomicAttributes;
|
||||
import com.wrq.rearranger.ModifierConstants;
|
||||
import org.jdom.Element;
|
||||
|
||||
public final class InitToAnonClassAttribute extends AndNotAttribute {
|
||||
public final class InitialisedByAnonymousClassAttribute extends AndNotAttribute {
|
||||
|
||||
// -------------------------- STATIC METHODS --------------------------
|
||||
|
||||
public static InitToAnonClassAttribute readExternal(final Element item) {
|
||||
final InitToAnonClassAttribute result = new InitToAnonClassAttribute();
|
||||
public static InitialisedByAnonymousClassAttribute readExternal(final Element item) {
|
||||
final InitialisedByAnonymousClassAttribute result = new InitialisedByAnonymousClassAttribute();
|
||||
result.loadAttributes(item.getChild(result.getElementName()));
|
||||
return result;
|
||||
}
|
||||
|
||||
// --------------------------- CONSTRUCTORS ---------------------------
|
||||
|
||||
public InitToAnonClassAttribute() {
|
||||
public InitialisedByAnonymousClassAttribute() {
|
||||
super("initialized to anonymous class", ModifierConstants.INIT_TO_ANON_CLASS);
|
||||
}
|
||||
|
||||
// -------------------------- OTHER METHODS --------------------------
|
||||
|
||||
public final /*InitToAnonClassAttribute*/AtomicAttribute deepCopy() {
|
||||
final InitToAnonClassAttribute result = new InitToAnonClassAttribute();
|
||||
final InitialisedByAnonymousClassAttribute result = new InitialisedByAnonymousClassAttribute();
|
||||
result.value = value;
|
||||
result.invert = invert;
|
||||
return result;
|
||||
+1
-3
@@ -26,9 +26,7 @@ import org.jdom.Element;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
/** Routines to handle the 'static' modifier. */
|
||||
public final class StaticAttribute
|
||||
extends AndNotAttribute
|
||||
{
|
||||
public final class StaticAttribute extends AndNotAttribute {
|
||||
|
||||
// -------------------------- STATIC METHODS --------------------------
|
||||
|
||||
|
||||
+18
-18
@@ -23,7 +23,7 @@ package com.wrq.rearranger.settings.attributeGroups;
|
||||
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.wrq.rearranger.entry.RangeEntry;
|
||||
import com.wrq.rearranger.settings.atomicAttributes.InitToAnonClassAttribute;
|
||||
import com.wrq.rearranger.settings.atomicAttributes.InitialisedByAnonymousClassAttribute;
|
||||
import com.wrq.rearranger.settings.atomicAttributes.TransientAttribute;
|
||||
import com.wrq.rearranger.settings.atomicAttributes.TypeAttribute;
|
||||
import com.wrq.rearranger.settings.atomicAttributes.VolatileAttribute;
|
||||
@@ -40,17 +40,17 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
|
||||
// ------------------------------ FIELDS ------------------------------
|
||||
|
||||
private InitToAnonClassAttribute initToAnonClassAttr;
|
||||
private TransientAttribute transientAttr;
|
||||
private VolatileAttribute volatileAttr;
|
||||
private TypeAttribute typeAttr;
|
||||
private InitialisedByAnonymousClassAttribute myInitialisedByAnonymousClassAttr;
|
||||
private TransientAttribute transientAttr;
|
||||
private VolatileAttribute volatileAttr;
|
||||
private TypeAttribute typeAttr;
|
||||
|
||||
// -------------------------- STATIC METHODS --------------------------
|
||||
|
||||
public static /*FieldAttributes*/AttributeGroup readExternal(final Element item) {
|
||||
final FieldAttributes result = new FieldAttributes();
|
||||
CommonAttributes.readExternal(result, item);
|
||||
result.initToAnonClassAttr = InitToAnonClassAttribute.readExternal(item);
|
||||
result.myInitialisedByAnonymousClassAttr = InitialisedByAnonymousClassAttribute.readExternal(item);
|
||||
result.transientAttr = TransientAttribute.readExternal(item);
|
||||
result.volatileAttr = VolatileAttribute.readExternal(item);
|
||||
result.typeAttr = TypeAttribute.readExternal(item);
|
||||
@@ -60,7 +60,7 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
// --------------------------- CONSTRUCTORS ---------------------------
|
||||
|
||||
public FieldAttributes() {
|
||||
initToAnonClassAttr = new InitToAnonClassAttribute();
|
||||
myInitialisedByAnonymousClassAttr = new InitialisedByAnonymousClassAttribute();
|
||||
transientAttr = new TransientAttribute();
|
||||
volatileAttr = new VolatileAttribute();
|
||||
typeAttr = new TypeAttribute();
|
||||
@@ -68,8 +68,8 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
|
||||
// --------------------- GETTER / SETTER METHODS ---------------------
|
||||
|
||||
public InitToAnonClassAttribute getInitToAnonClassAttr() {
|
||||
return initToAnonClassAttr;
|
||||
public InitialisedByAnonymousClassAttribute getInitialisedByAnonymousClassAttr() {
|
||||
return myInitialisedByAnonymousClassAttr;
|
||||
}
|
||||
|
||||
private TransientAttribute getTransientAttr() {
|
||||
@@ -100,8 +100,8 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
else {
|
||||
sb.append("fields");
|
||||
}
|
||||
if (initToAnonClassAttr.isValue()) {
|
||||
if (!initToAnonClassAttr.isInvert()) {
|
||||
if (myInitialisedByAnonymousClassAttr.isValue()) {
|
||||
if (!myInitialisedByAnonymousClassAttr.isInvert()) {
|
||||
sb.append(" which are initialized to an anonymous class");
|
||||
}
|
||||
else {
|
||||
@@ -109,14 +109,14 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
}
|
||||
}
|
||||
if (getNameAttribute().isMatch()) {
|
||||
if (initToAnonClassAttr.isValue()) {
|
||||
if (myInitialisedByAnonymousClassAttr.isValue()) {
|
||||
sb.append(" and");
|
||||
}
|
||||
sb.append(' ');
|
||||
sb.append(getNameAttribute().getDescriptiveString());
|
||||
}
|
||||
if (typeAttr.isMatch()) {
|
||||
if (getNameAttribute().isMatch() || initToAnonClassAttr.isValue()) {
|
||||
if (getNameAttribute().isMatch() || myInitialisedByAnonymousClassAttr.isValue()) {
|
||||
sb.append(" and");
|
||||
}
|
||||
sb.append(' ');
|
||||
@@ -135,7 +135,7 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
public final /*FieldAttributes*/AttributeGroup deepCopy() {
|
||||
final FieldAttributes result = new FieldAttributes();
|
||||
deepCopyCommonItems(result);
|
||||
result.initToAnonClassAttr = (InitToAnonClassAttribute)initToAnonClassAttr.deepCopy();
|
||||
result.myInitialisedByAnonymousClassAttr = (InitialisedByAnonymousClassAttribute)myInitialisedByAnonymousClassAttr.deepCopy();
|
||||
result.transientAttr = (TransientAttribute)transientAttr.deepCopy();
|
||||
result.volatileAttr = (VolatileAttribute)volatileAttr.deepCopy();
|
||||
result.typeAttr = (TypeAttribute)typeAttr.deepCopy();
|
||||
@@ -146,7 +146,7 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
public final void writeExternal(@NotNull final Element parent) {
|
||||
final Element child = new Element("Field");
|
||||
writeExternalCommonAttributes(child);
|
||||
initToAnonClassAttr.appendAttributes(child);
|
||||
myInitialisedByAnonymousClassAttr.appendAttributes(child);
|
||||
transientAttr.appendAttributes(child);
|
||||
volatileAttr.appendAttributes(child);
|
||||
typeAttr.appendAttributes(child);
|
||||
@@ -161,7 +161,7 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
return super.equals(fa) &&
|
||||
transientAttr.equals(fa.transientAttr) &&
|
||||
volatileAttr.equals(fa.volatileAttr) &&
|
||||
initToAnonClassAttr.equals(fa.initToAnonClassAttr) &&
|
||||
myInitialisedByAnonymousClassAttr.equals(fa.myInitialisedByAnonymousClassAttr) &&
|
||||
typeAttr.equals(fa.typeAttr);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
constraints.insets = new Insets(5, 0, 0, 0);
|
||||
constraints.gridx = 0;
|
||||
constraints.gridy++;
|
||||
plPanel.add(getInitToAnonClassAttr().getAndNotPanel(), constraints);
|
||||
plPanel.add(getInitialisedByAnonymousClassAttr().getAndNotPanel(), constraints);
|
||||
constraints.gridy++;
|
||||
plPanel.add(getNameAttribute().getStringPanel(), constraints);
|
||||
constraints.gridy++;
|
||||
@@ -206,7 +206,7 @@ public final class FieldAttributes extends ItemAttributes {
|
||||
|
||||
public boolean isMatch(@NotNull RangeEntry rangeEntry) {
|
||||
return rangeEntry.getEnd() instanceof PsiField &&
|
||||
initToAnonClassAttr.isMatch(rangeEntry.getModifiers()) &&
|
||||
myInitialisedByAnonymousClassAttr.isMatch(rangeEntry.getModifiers()) &&
|
||||
transientAttr.isMatch(rangeEntry.getModifiers()) &&
|
||||
volatileAttr.isMatch(rangeEntry.getModifiers()) &&
|
||||
typeAttr.isMatch(rangeEntry.getType()) &&
|
||||
|
||||
+1
-2
@@ -629,8 +629,7 @@ public final class MethodAttributes
|
||||
// Start Methods of Interface IRule
|
||||
|
||||
public final boolean isMatch(@NotNull RangeEntry entry) {
|
||||
final boolean result = (entry.getEnd() instanceof PsiMethod ||
|
||||
entry.getEnd() instanceof PsiClassInitializer) &&
|
||||
final boolean result = (entry.getEnd() instanceof PsiMethod || entry.getEnd() instanceof PsiClassInitializer) &&
|
||||
super.isMatch(entry) &&
|
||||
abstractAttr.isMatch(entry.getModifiers()) &&
|
||||
overriddenAttr.isMatch(entry.getModifiers()) &&
|
||||
|
||||
@@ -42,7 +42,7 @@ public final class ModifierUtils {
|
||||
final String m = st.nextToken();
|
||||
for (int i = 1; i != 0; i <<= 1) {
|
||||
if (Modifier.toString(i).equals(m)) {
|
||||
mask = mask | i;
|
||||
mask |= i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,67 +100,48 @@ class RearrangerTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
// public final void testAnonClassInit() throws Exception {
|
||||
// configureByFile("/com/wrq/rearranger/RearrangementTest7.java");
|
||||
// final PsiFile file = getFile();
|
||||
// final Document doc = PsiDocumentManager.getInstance(getProject()).getDocument(file);
|
||||
// final FieldAttributes fa;
|
||||
// fa = new FieldAttributes();
|
||||
// fa.getInitToAnonClassAttr().setValue(true);
|
||||
// rs.addItem(fa, 0);
|
||||
// final RearrangerActionHandler rah = new RearrangerActionHandler();
|
||||
// rah.rearrangeDocument(getProject(), file, rs, doc);
|
||||
// super.checkResultByFile("/com/wrq/rearranger/RearrangementResult7.java");
|
||||
// }
|
||||
//
|
||||
// public final void testNameMatch() throws Exception {
|
||||
// configureByFile("/com/wrq/rearranger/RearrangementTest.java");
|
||||
// final PsiFile file = getFile();
|
||||
// final Document doc = PsiDocumentManager.getInstance(getProject()).getDocument(file);
|
||||
// final FieldAttributes fa;
|
||||
// fa = new FieldAttributes();
|
||||
// fa.getNameAttr().setMatch(true);
|
||||
// fa.getNameAttr().setExpression(".*5");
|
||||
// rs.addItem(fa, 0);
|
||||
// final MethodAttributes ma = new MethodAttributes();
|
||||
// ma.getNameAttr().setMatch(true);
|
||||
// ma.getNameAttr().setExpression(".*2");
|
||||
// rs.addItem(ma, 1);
|
||||
// final RearrangerActionHandler rah = new RearrangerActionHandler();
|
||||
// rah.rearrangeDocument(getProject(), file, rs, doc);
|
||||
// super.checkResultByFile("/com/wrq/rearranger/RearrangementResult8.java");
|
||||
// }
|
||||
//
|
||||
// public final void testStaticInitializer() throws Exception {
|
||||
// configureByFile("/com/wrq/rearranger/RearrangementTest8.java");
|
||||
// final PsiFile file = getFile();
|
||||
// final Document doc = PsiDocumentManager.getInstance(getProject()).getDocument(file);
|
||||
// final MethodAttributes ma;
|
||||
// ma = new MethodAttributes();
|
||||
// ma.getStaticInitAttr().setValue(true);
|
||||
// rs.addItem(ma, 0);
|
||||
// final RearrangerActionHandler rah = new RearrangerActionHandler();
|
||||
// rah.rearrangeDocument(getProject(), file, rs, doc);
|
||||
// super.checkResultByFile("/com/wrq/rearranger/RearrangementResult8A.java");
|
||||
// }
|
||||
//
|
||||
// public final void testAlphabetizingGSMethods() throws Exception {
|
||||
// configureByFile("/com/wrq/rearranger/RearrangementTest.java");
|
||||
// final PsiFile file = getFile();
|
||||
// final Document doc = PsiDocumentManager.getInstance(getProject()).getDocument(file);
|
||||
// final MethodAttributes ma;
|
||||
// ma = new MethodAttributes();
|
||||
// ma.setGetterSetterMethodType(true);
|
||||
// ma.setOtherMethodType(true);
|
||||
// ma.setConstructorMethodType(false);
|
||||
// ma.getSortAttr().setByName(true);
|
||||
// rs.addItem(ma, 0);
|
||||
// rs.setKeepGettersSettersTogether(false);
|
||||
// final RearrangerActionHandler rah = new RearrangerActionHandler();
|
||||
// rah.rearrangeDocument(getProject(), file, rs, doc);
|
||||
// super.checkResultByFile("/com/wrq/rearranger/RearrangementResult9.java");
|
||||
// }
|
||||
//
|
||||
public final void testAnonClassInit() throws Exception {
|
||||
doTest('RearrangementTest7', 'RearrangementResult7') {
|
||||
def attributes = new FieldAttributes()
|
||||
attributes.initialisedByAnonymousClassAttr.value = true
|
||||
mySettings.addItem(attributes, 0)
|
||||
}
|
||||
}
|
||||
|
||||
public final void testNameMatch() throws Exception {
|
||||
doTest('RearrangementTest', 'RearrangementResult8') {
|
||||
def fieldAttributes = new FieldAttributes()
|
||||
fieldAttributes.nameAttribute.match = true
|
||||
fieldAttributes.nameAttribute.expression = '.*5'
|
||||
mySettings.addItem(fieldAttributes, 0)
|
||||
|
||||
def methodAttributes = new MethodAttributes()
|
||||
methodAttributes.nameAttribute.match = true
|
||||
methodAttributes.nameAttribute.expression = '.*2'
|
||||
mySettings.addItem(methodAttributes, 1)
|
||||
}
|
||||
}
|
||||
|
||||
public final void testStaticInitializer() throws Exception {
|
||||
doTest('RearrangementTest8', 'RearrangementResult8A') {
|
||||
def methodAttributes = new MethodAttributes()
|
||||
methodAttributes.staticAttribute.value = true
|
||||
mySettings.addItem(methodAttributes, 0)
|
||||
}
|
||||
}
|
||||
|
||||
public final void testAlphabetizingGSMethods() throws Exception {
|
||||
doTest('RearrangementTest', 'RearrangementResult9') {
|
||||
def methodAttributes = new MethodAttributes()
|
||||
methodAttributes.getterSetterMethodType = true
|
||||
methodAttributes.otherMethodType = true
|
||||
methodAttributes.constructorMethodType = false
|
||||
methodAttributes.sortOptions.byName = true
|
||||
mySettings.addItem(methodAttributes, 0)
|
||||
mySettings.keepGettersSettersTogether = false
|
||||
}
|
||||
}
|
||||
|
||||
// public final void testSimpleComment() throws Exception {
|
||||
// configureByFile("/com/wrq/rearranger/RearrangementTest.java");
|
||||
// final PsiFile file = getFile();
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.wrq.rearranger;
|
||||
|
||||
/** public class comments. */
|
||||
public class RearrangementTest {
|
||||
|
||||
/** field 1. */
|
||||
private int field1;
|
||||
private int field2;
|
||||
|
||||
@@ -7,6 +7,7 @@ package com.wrq.rearranger;
|
||||
public class RearrangementTest {
|
||||
public static final int field3 = 3;
|
||||
public static final int field4 = 4;
|
||||
|
||||
/** field 1. */
|
||||
private int field1;
|
||||
private int field2;
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.wrq.rearranger;
|
||||
|
||||
/** public class comments. */
|
||||
public class RearrangementTest {
|
||||
|
||||
/** field 1. */
|
||||
private int field1;
|
||||
private int field2;
|
||||
|
||||
@@ -9,6 +9,7 @@ public class RearrangementTest {
|
||||
NoRearrangementTest() {
|
||||
// constructor body
|
||||
}
|
||||
|
||||
/** field 1. */
|
||||
private int field1;
|
||||
private int field2;
|
||||
|
||||
@@ -9,6 +9,7 @@ class AnotherOuterClass {
|
||||
|
||||
/** public class comments. */
|
||||
public class RearrangementTest {
|
||||
|
||||
/** field 1. */
|
||||
private int field1;
|
||||
private int field2;
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.wrq.rearranger;
|
||||
|
||||
/** public class comments. */
|
||||
public class RearrangementTest {
|
||||
final int field5 = 5;
|
||||
final int field5 = 5;
|
||||
|
||||
/** method 2 comment. */
|
||||
public void method2() {
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.wrq.rearranger;
|
||||
|
||||
/** public class comments. */
|
||||
public class RearrangementTest {
|
||||
|
||||
/** field 1. */
|
||||
private int field1;
|
||||
private int field2;
|
||||
|
||||
Reference in New Issue
Block a user