From 907f014df496d3fcdcc0d7d538cb886c0383ecf9 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Wed, 16 May 2012 10:15:06 +0400 Subject: [PATCH 01/12] initComponent() simplified --- .../impl/stores/ComponentStoreImpl.java | 34 ++++++------------- .../impl/stores/IComponentStore.java | 5 ++- .../com/intellij/mock/MockProjectStore.java | 2 +- 3 files changed, 14 insertions(+), 27 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java index ad9042e4212c..fdcbddded929 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java @@ -19,7 +19,6 @@ import com.intellij.diagnostic.IdeErrorsDialog; import com.intellij.diagnostic.PluginException; import com.intellij.ide.plugins.PluginManager; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.ex.ApplicationEx; import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.components.*; import com.intellij.openapi.components.impl.ComponentManagerImpl; @@ -66,39 +65,28 @@ abstract class ComponentStoreImpl implements IComponentStore { throw new UnsupportedOperationException("Method getDefaultsStorage is not supported in " + getClass()); } - public String initComponent(@NotNull final Object component, final boolean service) { - boolean isSerializable = component instanceof JDOMExternalizable || - component instanceof PersistentStateComponent || - component instanceof SettingsSavingComponent; - - if (!isSerializable) return null; + public void initComponent(@NotNull final Object component, final boolean service) { if (component instanceof SettingsSavingComponent) { SettingsSavingComponent settingsSavingComponent = (SettingsSavingComponent)component; mySettingsSavingComponents.add(settingsSavingComponent); } - final String[] componentName = {null}; - final Runnable r = new Runnable() { + boolean isSerializable = component instanceof JDOMExternalizable || + component instanceof PersistentStateComponent; + + if (!isSerializable) return; + + ApplicationManagerEx.getApplicationEx().runReadAction(new Runnable() { public void run() { if (component instanceof PersistentStateComponent) { - componentName[0] = initPersistentComponent((PersistentStateComponent)component, false); + initPersistentComponent((PersistentStateComponent)component, false); } - else if (component instanceof JDOMExternalizable) { - componentName[0] = initJdomExternalizable((JDOMExternalizable)component); + else { + initJdomExternalizable((JDOMExternalizable)component); } } - }; - - final ApplicationEx applicationEx = ApplicationManagerEx.getApplicationEx(); - if (applicationEx.isUnitTestMode()) { - r.run(); // Todo - } - else { - applicationEx.runReadAction(r); - } - - return componentName[0]; + }); } public boolean isSaving() { diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java index 30ff783c2cb6..016231565ea2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java @@ -28,12 +28,11 @@ import java.util.List; import java.util.Set; public interface IComponentStore { - @Nullable - String initComponent(Object component, boolean service); + + void initComponent(Object component, boolean service); void reinitComponents(Set componentNames, boolean reloadData); boolean isReloadPossible(Set componentNames); - void load() throws IOException, StateStorageException; boolean isSaving(); diff --git a/platform/testFramework/src/com/intellij/mock/MockProjectStore.java b/platform/testFramework/src/com/intellij/mock/MockProjectStore.java index af32d43cdc3b..77fe4db09da0 100644 --- a/platform/testFramework/src/com/intellij/mock/MockProjectStore.java +++ b/platform/testFramework/src/com/intellij/mock/MockProjectStore.java @@ -122,7 +122,7 @@ public class MockProjectStore implements IProjectStore { } @Override - public String initComponent(Object component, final boolean service) { + public void initComponent(Object component, final boolean service) { throw new UnsupportedOperationException("Method initComponent is not yet implemented in " + getClass().getName()); } From 5bba6722ed754bd2eb39c8b1c6a77b98a797d984 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Wed, 16 May 2012 10:48:38 +0400 Subject: [PATCH 02/12] cleanup --- .../intellij/openapi/fileEditor/ex/FileEditorManagerEx.java | 2 ++ .../openapi/fileEditor/impl/FileEditorManagerImpl.java | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/ex/FileEditorManagerEx.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/ex/FileEditorManagerEx.java index 27b97ae596e6..3d385a775947 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/ex/FileEditorManagerEx.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/ex/FileEditorManagerEx.java @@ -56,6 +56,7 @@ public abstract class FileEditorManagerEx extends FileEditorManager implements B * * @see EditorComposite#getPreferredFocusedComponent() */ + @Nullable public abstract JComponent getPreferredFocusedComponent(); @NotNull @@ -113,6 +114,7 @@ public abstract class FileEditorManagerEx extends FileEditorManager implements B public abstract boolean hasOpenedFile (); + @Nullable public abstract VirtualFile getCurrentFile(); @Nullable diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java index 200a0496a195..92168a1fb1a1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java @@ -49,7 +49,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.project.impl.ProjectImpl; import com.intellij.openapi.roots.ModuleRootAdapter; import com.intellij.openapi.roots.ModuleRootEvent; -import com.intellij.openapi.roots.ModuleRootListener; import com.intellij.openapi.startup.StartupManager; import com.intellij.openapi.util.*; import com.intellij.openapi.util.registry.Registry; @@ -1043,7 +1042,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec openFiles.addAll(Arrays.asList(each.getOpenFiles())); } - return VfsUtil.toVirtualFileArray(openFiles); + return VfsUtilCore.toVirtualFileArray(openFiles); } @NotNull @@ -1053,7 +1052,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec selectedFiles.addAll(Arrays.asList(each.getSelectedFiles())); } - return VfsUtil.toVirtualFileArray(selectedFiles); + return VfsUtilCore.toVirtualFileArray(selectedFiles); } @NotNull From 85b2a36cb83c78007121689b60de2116da932291 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Wed, 16 May 2012 13:36:31 +0400 Subject: [PATCH 03/12] moving heavy initialization to initComponent() --- .../util/indexing/FileBasedIndexImpl.java | 8 ++++ .../fileTypes/impl/FileTypeManagerImpl.java | 37 +++++++++---------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java index a5f15bf670d1..e2ae3217f0d8 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -271,6 +271,9 @@ public class FileBasedIndexImpl extends FileBasedIndex { } */ + } + + private void initExtensions() { try { final FileBasedIndexExtension[] extensions = Extensions.getExtensions(FileBasedIndexExtension.EXTENSION_POINT_NAME); for (FileBasedIndexExtension extension : extensions) { @@ -318,6 +321,9 @@ public class FileBasedIndexImpl extends FileBasedIndex { registerIndexableSet(new AdditionalIndexableFileSet(), null); } + catch (IOException e) { + throw new RuntimeException(e); + } finally { ShutDownTracker.getInstance().registerShutdownTask(new Runnable() { @Override @@ -329,6 +335,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { saveRegisteredIndices(myIndices.keySet()); myFlushingFuture = FlushingDaemon.everyFiveSeconds(new Runnable() { int lastModCount = 0; + @Override public void run() { if (lastModCount == myLocalModCount) { @@ -343,6 +350,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { @Override public void initComponent() { + initExtensions(); } @Nullable diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java index f80fe3b6269a..1898ea037391 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java @@ -105,12 +105,12 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME } private final MessageBus myMessageBus; - private static final Map ourStandardFileTypes = new LinkedHashMap(); + private final Map myStandardFileTypes = new LinkedHashMap(); @NonNls private static final String[] FILE_TYPES_WITH_PREDEFINED_EXTENSIONS = {"JSP", "JSPX", "DTD", "HTML", "Properties", "XHTML"}; private final SchemesManager mySchemesManager; @NonNls private static final String FILE_SPEC = "$ROOT_CONFIG$/filetypes"; - static { + private void initStandardFileTypes() { final FileTypeConsumer consumer = new FileTypeConsumer() { @Override public void consume(@NotNull FileType fileType) { @@ -129,25 +129,24 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME @Override public FileType getStandardFileTypeByName(@NotNull final String name) { - final StandardFileType type = ourStandardFileTypes.get(name); + final StandardFileType type = myStandardFileTypes.get(name); return type != null ? type.fileType : null; } private void register(final FileType fileType, final List fileNameMatchers) { - final StandardFileType type = ourStandardFileTypes.get(fileType.getName()); + final StandardFileType type = myStandardFileTypes.get(fileType.getName()); if (type != null) { for (FileNameMatcher matcher : fileNameMatchers) type.matchers.add(matcher); } else { - ourStandardFileTypes.put(fileType.getName(), new StandardFileType(fileType, fileNameMatchers)); + myStandardFileTypes.put(fileType.getName(), new StandardFileType(fileType, fileNameMatchers)); } } }; - final FileTypeFactory[] fileTypeFactories = Extensions.getExtensions(FileTypeFactory.FILE_TYPE_FACTORY_EP); - for (final FileTypeFactory factory : fileTypeFactories) { + for (final FileTypeFactory factory : Extensions.getExtensions(FileTypeFactory.FILE_TYPE_FACTORY_EP)) { try { - initFactory(consumer, factory); + factory.createFileTypes(consumer); } catch (final Error ex) { PluginManager.disableIncompatiblePlugin(factory, ex); @@ -155,10 +154,6 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME } } - private static void initFactory(final FileTypeConsumer consumer, final FileTypeFactory factory) { - factory.createFileTypes(consumer); - } - // ------------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------------- @@ -238,12 +233,6 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME fireFileTypesChanged(); } }, RoamingType.PER_USER); - for (final StandardFileType pair : ourStandardFileTypes.values()) { - registerFileTypeWithoutNotification(pair.fileType, pair.matchers); - } - if (loadAllFileTypes()) { - restoreStandardFileExtensions(); - } } private static void writeImportedExtensionsMap(final Element map, final ImportedFileType type) { @@ -264,7 +253,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME @Override @NotNull public FileType getStdFileType(@NotNull @NonNls String name) { - StandardFileType stdFileType = ourStandardFileTypes.get(name); + StandardFileType stdFileType = myStandardFileTypes.get(name); return stdFileType != null ? stdFileType.fileType : PlainTextFileType.INSTANCE; } @@ -289,6 +278,14 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME @Override public void initComponent() { + initStandardFileTypes(); + + for (final StandardFileType pair : myStandardFileTypes.values()) { + registerFileTypeWithoutNotification(pair.fileType, pair.matchers); + } + if (loadAllFileTypes()) { + restoreStandardFileExtensions(); + } } // ------------------------------------------------------------------------- @@ -722,7 +719,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME private void restoreStandardFileExtensions() { for (final String name : FILE_TYPES_WITH_PREDEFINED_EXTENSIONS) { - final StandardFileType stdFileType = ourStandardFileTypes.get(name); + final StandardFileType stdFileType = myStandardFileTypes.get(name); if (stdFileType != null) { FileType fileType = stdFileType.fileType; for (FileNameMatcher matcher : myPatternsTable.getAssociations(fileType)) { From 12d98770c5322bfbcd1764a41cf4bbae42cd63d8 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Wed, 16 May 2012 14:57:13 +0400 Subject: [PATCH 04/12] RelativeLayout --- .../RelativeLayoutResizeOperation.java | 37 ++++++--- .../layout/relative/AutoResizeSnapPoint.java | 44 +++++++---- .../layout/relative/ComponentSnapPoint.java | 68 ++++++++++++----- .../layout/relative/ContainerSnapPoint.java | 26 ++++--- .../relative/ResizeComponentSnapPoint.java | 75 +++++++++++++++++-- .../relative/ResizeContainerSnapPoint.java | 42 ++++++++--- .../layout/relative/ResizeSnapPoint.java | 40 ++++++++++ .../layout/relative/WrapSizeSnapPoint.java | 6 +- 8 files changed, 267 insertions(+), 71 deletions(-) create mode 100644 plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeSnapPoint.java diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/actions/RelativeLayoutResizeOperation.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/actions/RelativeLayoutResizeOperation.java index 5df6f63217b3..8e0543d25ed8 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/actions/RelativeLayoutResizeOperation.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/actions/RelativeLayoutResizeOperation.java @@ -55,8 +55,11 @@ public class RelativeLayoutResizeOperation implements EditOperation { private Rectangle myContainerBounds; private Dimension myWrapSize; - private List myHorizontalPoints; - private List myVerticalPoints; + private Side myResizeHorizontalSide; + private Side myResizeVerticalSide; + + private List myHorizontalPoints; + private List myVerticalPoints; private SnapPoint myHorizontalPoint; private SnapPoint myVerticalPoint; @@ -94,6 +97,7 @@ public class RelativeLayoutResizeOperation implements EditOperation { layer.add(myBoundsFeedback); int direction = myContext.getResizeDirection(); + if (direction == Position.EAST || direction == Position.SOUTH || direction == Position.SOUTH_EAST) { Rectangle bounds = myComponent.getBounds(myContext.getArea().getFeedbackLayer()); String width = myComponent.getTag().getAttributeValue("android:layout_width"); @@ -121,6 +125,19 @@ public class RelativeLayoutResizeOperation implements EditOperation { layer.add(myWrapFeedback); } + if ((direction & Position.NORTH) != 0) { + myResizeVerticalSide = Side.top; + } + if ((direction & Position.SOUTH) != 0) { + myResizeVerticalSide = Side.bottom; + } + if ((direction & Position.WEST) != 0) { + myResizeHorizontalSide = Side.left; + } + if ((direction & Position.EAST) != 0) { + myResizeHorizontalSide = Side.right; + } + myContainerBounds = myContainer.getBounds(layer); mySnapFeedback = new SnapPointFeedbackHost(); @@ -146,14 +163,14 @@ public class RelativeLayoutResizeOperation implements EditOperation { myHorizontalPoint = null; myVerticalPoint = null; - for (SnapPoint point : myHorizontalPoints) { - if (point.processBounds(myComponents, bounds, mySnapFeedback)) { + for (ResizeSnapPoint point : myHorizontalPoints) { + if (point.processBounds(myComponents, bounds, myResizeHorizontalSide, mySnapFeedback)) { myHorizontalPoint = point; break; } } - for (SnapPoint point : myVerticalPoints) { - if (point.processBounds(myComponents, bounds, mySnapFeedback)) { + for (ResizeSnapPoint point : myVerticalPoints) { + if (point.processBounds(myComponents, bounds, myResizeVerticalSide, mySnapFeedback)) { myVerticalPoint = point; break; } @@ -192,8 +209,8 @@ public class RelativeLayoutResizeOperation implements EditOperation { } private void createPoints() { - myHorizontalPoints = new ArrayList(); - myVerticalPoints = new ArrayList(); + myHorizontalPoints = new ArrayList(); + myVerticalPoints = new ArrayList(); List snapComponents = RelativeLayoutOperation.getSnapComponents(myContainer, myComponents); snapComponents.removeAll(myContext.getComponents()); @@ -207,7 +224,7 @@ public class RelativeLayoutResizeOperation implements EditOperation { } } - private void createPoints(List points, List snapComponents, boolean horizontal, int direction) { + private void createPoints(List points, List snapComponents, boolean horizontal, int direction) { for (RadComponent component : snapComponents) { points.add(new ResizeComponentSnapPoint((RadViewComponent)component, horizontal)); } @@ -218,7 +235,7 @@ public class RelativeLayoutResizeOperation implements EditOperation { points.add(new WrapSizeSnapPoint(myComponent, horizontal, myWrapSize)); } - points.add(new AutoResizeSnapPoint(myContainer, horizontal, direction)); + points.add(new AutoResizeSnapPoint(myContainer, horizontal)); } @Override diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/AutoResizeSnapPoint.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/AutoResizeSnapPoint.java index 2563f11eb425..29d18c04e532 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/AutoResizeSnapPoint.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/AutoResizeSnapPoint.java @@ -19,7 +19,6 @@ import com.intellij.android.designer.model.ModelParser; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.designer.designSurface.feedbacks.TextFeedback; import com.intellij.designer.model.RadComponent; -import com.intellij.designer.utils.Position; import com.intellij.openapi.application.ApplicationManager; import com.intellij.psi.xml.XmlTag; @@ -29,14 +28,13 @@ import java.util.List; /** * @author Alexander Lobas */ -public class AutoResizeSnapPoint extends SnapPoint { - private final int myDirection; +public class AutoResizeSnapPoint extends ResizeSnapPoint { private int myMargin; private int mySize; + private Side mySide; - public AutoResizeSnapPoint(RadViewComponent container, boolean horizontal, int direction) { + public AutoResizeSnapPoint(RadViewComponent container, boolean horizontal) { super(container, horizontal); - myDirection = direction; } @Override @@ -48,7 +46,7 @@ public class AutoResizeSnapPoint extends SnapPoint { feedback.append(", "); } - if ((myDirection & Position.EAST_WEST) != 0) { + if (mySide == Side.left || mySide == Side.right) { feedback.append("layout:width "); } else { @@ -60,13 +58,15 @@ public class AutoResizeSnapPoint extends SnapPoint { } @Override - public boolean processBounds(List components, Rectangle bounds, SnapPointFeedbackHost feedback) { - super.processBounds(components, bounds, feedback); + public boolean processBounds(List components, Rectangle bounds, Side resizeSide, SnapPointFeedbackHost feedback) { + super.processBounds(components, bounds, resizeSide, feedback); + + mySide = resizeSide; if (myHorizontal) { mySize = bounds.width; - if ((myDirection & Position.WEST) != 0) { + if (resizeSide == Side.left) { myMargin = bounds.x - myBounds.x; feedback.addVerticalLine(myBounds.x, myBounds.y, myBounds.height); feedback.addHorizontalArrow(myBounds.x, bounds.y + bounds.height / 2, myMargin); @@ -75,7 +75,7 @@ public class AutoResizeSnapPoint extends SnapPoint { else { mySize = bounds.height; - if ((myDirection & Position.NORTH) != 0) { + if (resizeSide == Side.top) { myMargin = bounds.y - myBounds.y; feedback.addHorizontalLine(myBounds.x, myBounds.y, myBounds.width); feedback.addVerticalArrow(bounds.x + bounds.width / 2, myBounds.y, myMargin); @@ -92,11 +92,29 @@ public class AutoResizeSnapPoint extends SnapPoint { public void run() { XmlTag tag = ((RadViewComponent)components.get(0)).getTag(); if (myMargin > 0) { - tag.setAttribute("android:layout_alignParent" + (myHorizontal ? "Left" : "Top"), "true"); - tag.setAttribute("android:layout_margin" + (myHorizontal ? "Left" : "Top"), Integer.toString(myMargin) + "dp"); + String attribute = myHorizontal ? "Left" : "Top"; + tag.setAttribute("android:layout_alignParent" + attribute, "true"); + tag.setAttribute("android:layout_margin" + attribute, Integer.toString(myMargin) + "dp"); + ModelParser.deleteAttribute(tag, "android:layout_align" + attribute); + + if (myHorizontal) { + ModelParser.deleteAttribute(tag, "android:layout_toRightOf"); + } + else { + ModelParser.deleteAttribute(tag, "android:layout_below"); + } } else { - ModelParser.deleteAttribute(tag, "android:layout_alignParent" + (myHorizontal ? "Right" : "Bottom")); + String attribute = myHorizontal ? "Right" : "Bottom"; + ModelParser.deleteAttribute(tag, "android:layout_alignParent" + attribute); + ModelParser.deleteAttribute(tag, "android:layout_align" + attribute); + + if (myHorizontal) { + ModelParser.deleteAttribute(tag, "android:layout_toLeftOf"); + } + else { + ModelParser.deleteAttribute(tag, "android:layout_above"); + } } tag.setAttribute("android:layout_" + (myHorizontal ? "width" : "height"), Integer.toString(mySize) + "dp"); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ComponentSnapPoint.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ComponentSnapPoint.java index 438548f31839..2c492b07680b 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ComponentSnapPoint.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ComponentSnapPoint.java @@ -28,7 +28,7 @@ import java.util.List; * @author Alexander Lobas */ public class ComponentSnapPoint extends SnapPoint { - protected Side myBeginSide; + private Side myBeginSide; private Side myEndSide; public ComponentSnapPoint(RadViewComponent component, boolean horizontal) { @@ -61,6 +61,10 @@ public class ComponentSnapPoint extends SnapPoint { int startX = myBounds.x - SNAP_SIZE; int endX = startX + 2 * SNAP_SIZE; + return processLeftLeft(startX, endX, targetBounds, feedback) || processLeftRight(startX, endX, targetBounds, feedback); + } + + protected boolean processLeftLeft(int startX, int endX, Rectangle targetBounds, SnapPointFeedbackHost feedback) { int targetX = targetBounds.x; if (startX <= targetX && targetX <= endX) { targetBounds.x = myBounds.x; @@ -69,7 +73,11 @@ public class ComponentSnapPoint extends SnapPoint { return true; } - targetX = targetBounds.x + targetBounds.width; + return false; + } + + protected boolean processLeftRight(int startX, int endX, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + int targetX = targetBounds.x + targetBounds.width; if (startX <= targetX && targetX <= endX) { targetBounds.x = myBounds.x - targetBounds.width; addVerticalFeedback(feedback, myBounds, targetBounds, true); @@ -84,6 +92,10 @@ public class ComponentSnapPoint extends SnapPoint { int startX = myBounds.x + myBounds.width - SNAP_SIZE; int endX = startX + 2 * SNAP_SIZE; + return processRightLeft(startX, endX, targetBounds, feedback) || processRightRight(startX, endX, targetBounds, feedback); + } + + protected boolean processRightLeft(int startX, int endX, Rectangle targetBounds, SnapPointFeedbackHost feedback) { int targetX = targetBounds.x; if (startX <= targetX && targetX <= endX) { targetBounds.x = myBounds.x + myBounds.width; @@ -92,7 +104,11 @@ public class ComponentSnapPoint extends SnapPoint { return true; } - targetX = targetBounds.x + targetBounds.width; + return false; + } + + protected boolean processRightRight(int startX, int endX, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + int targetX = targetBounds.x + targetBounds.width; if (startX <= targetX && targetX <= endX) { targetBounds.x = myBounds.x + myBounds.width - targetBounds.width; addVerticalFeedback(feedback, myBounds, targetBounds, false); @@ -107,6 +123,10 @@ public class ComponentSnapPoint extends SnapPoint { int startY = myBounds.y - SNAP_SIZE; int endY = startY + 2 * SNAP_SIZE; + return processTopTop(startY, endY, targetBounds, feedback) || processTopBottom(startY, endY, targetBounds, feedback); + } + + protected boolean processTopTop(int startY, int endY, Rectangle targetBounds, SnapPointFeedbackHost feedback) { int targetY = targetBounds.y; if (startY <= targetY && targetY <= endY) { targetBounds.y = myBounds.y; @@ -115,7 +135,11 @@ public class ComponentSnapPoint extends SnapPoint { return true; } - targetY = targetBounds.y + targetBounds.height; + return false; + } + + protected boolean processTopBottom(int startY, int endY, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + int targetY = targetBounds.y + targetBounds.height; if (startY <= targetY && targetY <= endY) { targetBounds.y = myBounds.y - targetBounds.height; addHorizontalFeedback(feedback, myBounds, targetBounds, true); @@ -130,6 +154,10 @@ public class ComponentSnapPoint extends SnapPoint { int startY = myBounds.y + myBounds.height - SNAP_SIZE; int endY = startY + 2 * SNAP_SIZE; + return processBottomTop(startY, endY, targetBounds, feedback) || processBottomBottom(startY, endY, targetBounds, feedback); + } + + protected boolean processBottomTop(int startY, int endY, Rectangle targetBounds, SnapPointFeedbackHost feedback) { int targetY = targetBounds.y; if (startY <= targetY && targetY <= endY) { targetBounds.y = myBounds.y + myBounds.height; @@ -138,7 +166,11 @@ public class ComponentSnapPoint extends SnapPoint { return true; } - targetY = targetBounds.y + targetBounds.height; + return false; + } + + protected boolean processBottomBottom(int startY, int endY, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + int targetY = targetBounds.y + targetBounds.height; if (startY <= targetY && targetY <= endY) { targetBounds.y = myBounds.y + myBounds.height - targetBounds.height; addHorizontalFeedback(feedback, myBounds, targetBounds, false); @@ -158,19 +190,7 @@ public class ComponentSnapPoint extends SnapPoint { public void execute(final List components) throws Exception { final String attribute; - if (myBeginSide == Side.left && myEndSide == Side.left) { - attribute = "android:layout_alignLeft"; - } - else if (myBeginSide == Side.right && myEndSide == Side.right) { - attribute = "android:layout_alignRight"; - } - else if (myBeginSide == Side.left && myEndSide == Side.right) { - attribute = "android:layout_toRightOf"; - } - else if (myBeginSide == Side.right && myEndSide == Side.left) { - attribute = "android:layout_toLeftOf"; - } - else if (myBeginSide == Side.top && myEndSide == Side.top) { + if (myBeginSide == Side.top && myEndSide == Side.top) { attribute = "android:layout_alignTop"; } else if (myBeginSide == Side.bottom && myEndSide == Side.bottom) { @@ -182,6 +202,18 @@ public class ComponentSnapPoint extends SnapPoint { else if (myBeginSide == Side.bottom && myEndSide == Side.top) { attribute = "android:layout_above"; } + else if (myBeginSide == Side.left && myEndSide == Side.left) { + attribute = "android:layout_alignLeft"; + } + else if (myBeginSide == Side.right && myEndSide == Side.right) { + attribute = "android:layout_alignRight"; + } + else if (myBeginSide == Side.left && myEndSide == Side.right) { + attribute = "android:layout_toRightOf"; + } + else if (myBeginSide == Side.right && myEndSide == Side.left) { + attribute = "android:layout_toLeftOf"; + } else { return; } diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ContainerSnapPoint.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ContainerSnapPoint.java index 64075d082afc..d00a7a1cdb9c 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ContainerSnapPoint.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ContainerSnapPoint.java @@ -29,7 +29,7 @@ import java.util.List; * @author Alexander Lobas */ public class ContainerSnapPoint extends SnapPoint { - protected Side mySide; + private Side mySide; public ContainerSnapPoint(RadViewComponent container, boolean horizontal) { super(container, horizontal); @@ -48,14 +48,14 @@ public class ContainerSnapPoint extends SnapPoint { if (mySide == Side.top) { return "alignParentTop"; } - else if (mySide == Side.left) { - return "alignParentLeft"; - } else if (mySide == Side.bottom) { return "alignParentBottom"; } + else if (mySide == Side.left) { + return "alignParentLeft"; + } else if (mySide == Side.right) { - return "alignParentTop"; + return "alignParentRight"; } else if (mySide == Side.center_horizontal) { return "centerHorizontal"; @@ -72,6 +72,10 @@ public class ContainerSnapPoint extends SnapPoint { mySide = null; + return processBounds(bounds, feedback); + } + + protected boolean processBounds(Rectangle bounds, SnapPointFeedbackHost feedback) { if (myHorizontal) { return processLeft(bounds, feedback) || processRight(bounds, feedback) || processHorizontalCenter(bounds, feedback); } @@ -79,7 +83,7 @@ public class ContainerSnapPoint extends SnapPoint { return processTop(bounds, feedback) || processBottom(bounds, feedback) || processVerticalCenter(bounds, feedback); } - private boolean processLeft(Rectangle targetBounds, SnapPointFeedbackHost feedback) { + protected final boolean processLeft(Rectangle targetBounds, SnapPointFeedbackHost feedback) { int startX = myBounds.x - SNAP_SIZE; int endX = startX + 2 * SNAP_SIZE; @@ -94,7 +98,7 @@ public class ContainerSnapPoint extends SnapPoint { return false; } - private boolean processRight(Rectangle targetBounds, SnapPointFeedbackHost feedback) { + protected final boolean processRight(Rectangle targetBounds, SnapPointFeedbackHost feedback) { int startX = myBounds.x + myBounds.width - SNAP_SIZE; int endX = startX + 2 * SNAP_SIZE; @@ -109,7 +113,7 @@ public class ContainerSnapPoint extends SnapPoint { return false; } - private boolean processTop(Rectangle targetBounds, SnapPointFeedbackHost feedback) { + protected final boolean processTop(Rectangle targetBounds, SnapPointFeedbackHost feedback) { int startY = myBounds.y - SNAP_SIZE; int endY = startY + 2 * SNAP_SIZE; @@ -124,7 +128,7 @@ public class ContainerSnapPoint extends SnapPoint { return false; } - private boolean processBottom(Rectangle targetBounds, SnapPointFeedbackHost feedback) { + protected final boolean processBottom(Rectangle targetBounds, SnapPointFeedbackHost feedback) { int startY = myBounds.y + myBounds.height - SNAP_SIZE; int endY = startY + 2 * SNAP_SIZE; @@ -139,7 +143,7 @@ public class ContainerSnapPoint extends SnapPoint { return false; } - protected boolean processHorizontalCenter(Rectangle targetBounds, SnapPointFeedbackHost feedback) { + private boolean processHorizontalCenter(Rectangle targetBounds, SnapPointFeedbackHost feedback) { int centerX = myBounds.x + myBounds.width / 2; int startX = centerX - SNAP_SIZE; @@ -156,7 +160,7 @@ public class ContainerSnapPoint extends SnapPoint { return false; } - protected boolean processVerticalCenter(Rectangle targetBounds, SnapPointFeedbackHost feedback) { + private boolean processVerticalCenter(Rectangle targetBounds, SnapPointFeedbackHost feedback) { int centerY = myBounds.y + myBounds.height / 2; int startY = centerY - SNAP_SIZE; diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeComponentSnapPoint.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeComponentSnapPoint.java index a8a239c52444..8ef19310c610 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeComponentSnapPoint.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeComponentSnapPoint.java @@ -17,42 +17,105 @@ package com.intellij.android.designer.designSurface.layout.relative; import com.intellij.android.designer.model.ModelParser; import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.designer.designSurface.feedbacks.TextFeedback; import com.intellij.designer.model.RadComponent; import com.intellij.openapi.application.ApplicationManager; import com.intellij.psi.xml.XmlTag; +import java.awt.*; import java.util.List; /** * @author Alexander Lobas */ -public class ResizeComponentSnapPoint extends ComponentSnapPoint { +public class ResizeComponentSnapPoint extends ResizeSnapPoint { + private Side mySide; + private ComponentSnapPoint mySnapPoint; + public ResizeComponentSnapPoint(RadViewComponent component, boolean horizontal) { super(component, horizontal); } + @Override + public void addTextInfo(TextFeedback feedback) { + mySnapPoint.addTextInfo(feedback); + } + + @Override + public boolean processBounds(List components, Rectangle bounds, Side resizeSide, SnapPointFeedbackHost feedback) { + super.processBounds(components, bounds, resizeSide, feedback); + + mySide = resizeSide; + + if (mySnapPoint == null) { + mySnapPoint = new ComponentSnapPoint(myComponent, myHorizontal) { + @Override + protected boolean processLeftLeft(int startX, int endX, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + return mySide == Side.left && super.processLeftLeft(startX, endX, targetBounds, feedback); + } + + @Override + protected boolean processLeftRight(int startX, int endX, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + return mySide == Side.right && super.processLeftRight(startX, endX, targetBounds, feedback); + } + + @Override + protected boolean processRightLeft(int startX, int endX, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + return mySide == Side.left && super.processRightLeft(startX, endX, targetBounds, feedback); + } + + @Override + protected boolean processRightRight(int startX, int endX, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + return mySide == Side.right && super.processRightRight(startX, endX, targetBounds, feedback); + } + + @Override + protected boolean processTopTop(int startY, int endY, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + return mySide == Side.top && super.processTopTop(startY, endY, targetBounds, feedback); + } + + @Override + protected boolean processTopBottom(int startY, int endY, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + return mySide == Side.bottom && super.processTopBottom(startY, endY, targetBounds, feedback); + } + + @Override + protected boolean processBottomTop(int startY, int endY, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + return mySide == Side.top && super.processBottomTop(startY, endY, targetBounds, feedback); + } + + @Override + protected boolean processBottomBottom(int startY, int endY, Rectangle targetBounds, SnapPointFeedbackHost feedback) { + return mySide == Side.bottom && super.processBottomBottom(startY, endY, targetBounds, feedback); + } + }; + } + + return mySnapPoint.processBounds(components, bounds, feedback); + } + @Override public void execute(final List components) throws Exception { - super.execute(components); + mySnapPoint.execute(components); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { XmlTag tag = ((RadViewComponent)components.get(0)).getTag(); - if (myBeginSide == Side.top) { + if (mySide == Side.top) { ModelParser.deleteAttribute(tag, "android:layout_alignParentTop"); ModelParser.deleteAttribute(tag, "android:layout_marginTop"); } - else if (myBeginSide == Side.bottom) { + else if (mySide == Side.bottom) { ModelParser.deleteAttribute(tag, "android:layout_alignParentBottom"); ModelParser.deleteAttribute(tag, "android:layout_marginBottom"); } - else if (myBeginSide == Side.left) { + else if (mySide == Side.left) { ModelParser.deleteAttribute(tag, "android:layout_alignParentLeft"); ModelParser.deleteAttribute(tag, "android:layout_marginLeft"); } - else if (myBeginSide == Side.right) { + else if (mySide == Side.right) { ModelParser.deleteAttribute(tag, "android:layout_alignParentRight"); ModelParser.deleteAttribute(tag, "android:layout_marginRight"); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeContainerSnapPoint.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeContainerSnapPoint.java index 5c6ea51cfb9e..324932c2891d 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeContainerSnapPoint.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeContainerSnapPoint.java @@ -17,6 +17,7 @@ package com.intellij.android.designer.designSurface.layout.relative; import com.intellij.android.designer.model.ModelParser; import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.designer.designSurface.feedbacks.TextFeedback; import com.intellij.designer.model.RadComponent; import com.intellij.openapi.application.ApplicationManager; import com.intellij.psi.xml.XmlTag; @@ -27,24 +28,41 @@ import java.util.List; /** * @author Alexander Lobas */ -public class ResizeContainerSnapPoint extends ContainerSnapPoint { +public class ResizeContainerSnapPoint extends ResizeSnapPoint { + private Side mySide; + private ContainerSnapPoint mySnapPoint; + public ResizeContainerSnapPoint(RadViewComponent container, boolean horizontal) { super(container, horizontal); } @Override - protected boolean processHorizontalCenter(Rectangle targetBounds, SnapPointFeedbackHost feedback) { - return false; + public void addTextInfo(TextFeedback feedback) { + mySnapPoint.addTextInfo(feedback); } @Override - protected boolean processVerticalCenter(Rectangle targetBounds, SnapPointFeedbackHost feedback) { - return false; + public boolean processBounds(List components, Rectangle bounds, Side resizeSide, SnapPointFeedbackHost feedback) { + mySide = resizeSide; + + if (mySnapPoint == null) { + mySnapPoint = new ContainerSnapPoint(myComponent, myHorizontal) { + @Override + protected boolean processBounds(Rectangle bounds, SnapPointFeedbackHost feedback) { + if (myHorizontal) { + return mySide == Side.left ? processLeft(bounds, feedback) : processRight(bounds, feedback); + } + return mySide == Side.top ? processTop(bounds, feedback) : processBottom(bounds, feedback); + } + }; + } + + return mySnapPoint.processBounds(components, bounds, feedback); } @Override public void execute(final List components) throws Exception { - super.execute(components); + mySnapPoint.execute(components); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override @@ -54,18 +72,22 @@ public class ResizeContainerSnapPoint extends ContainerSnapPoint { if (mySide == Side.top) { ModelParser.deleteAttribute(tag, "android:layout_alignTop"); ModelParser.deleteAttribute(tag, "android:layout_below"); - } - else if (mySide == Side.left) { - ModelParser.deleteAttribute(tag, "android:layout_alignBottom"); - ModelParser.deleteAttribute(tag, "android:layout_above"); + ModelParser.deleteAttribute(tag, "android:layout_marginTop"); } else if (mySide == Side.bottom) { + ModelParser.deleteAttribute(tag, "android:layout_alignBottom"); + ModelParser.deleteAttribute(tag, "android:layout_above"); + ModelParser.deleteAttribute(tag, "android:layout_marginBottom"); + } + else if (mySide == Side.left) { ModelParser.deleteAttribute(tag, "android:layout_alignLeft"); ModelParser.deleteAttribute(tag, "android:layout_toRightOf"); + ModelParser.deleteAttribute(tag, "android:layout_marginLeft"); } else if (mySide == Side.right) { ModelParser.deleteAttribute(tag, "android:layout_alignRight"); ModelParser.deleteAttribute(tag, "android:layout_toLeftOf"); + ModelParser.deleteAttribute(tag, "android:layout_marginRight"); } } }); diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeSnapPoint.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeSnapPoint.java new file mode 100644 index 000000000000..54d4b209947c --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ResizeSnapPoint.java @@ -0,0 +1,40 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.android.designer.designSurface.layout.relative; + +import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.designer.model.RadComponent; + +import java.awt.*; +import java.util.List; + +/** + * @author Alexander Lobas + */ +public abstract class ResizeSnapPoint extends SnapPoint { + public ResizeSnapPoint(RadViewComponent component, boolean horizontal) { + super(component, horizontal); + } + + @Override + public final boolean processBounds(List components, Rectangle bounds, SnapPointFeedbackHost feedback) { + throw new UnsupportedOperationException(); + } + + public boolean processBounds(List components, Rectangle bounds, Side resizeSide, SnapPointFeedbackHost feedback) { + return super.processBounds(components, bounds, feedback); + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/WrapSizeSnapPoint.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/WrapSizeSnapPoint.java index 3a7891d30a43..144efca6a457 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/WrapSizeSnapPoint.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/WrapSizeSnapPoint.java @@ -28,7 +28,7 @@ import java.util.List; /** * @author Alexander Lobas */ -public class WrapSizeSnapPoint extends SnapPoint { +public class WrapSizeSnapPoint extends ResizeSnapPoint { private final Dimension myWrapSize; public WrapSizeSnapPoint(RadViewComponent component, boolean horizontal, Dimension wrapSize) { @@ -43,8 +43,8 @@ public class WrapSizeSnapPoint extends SnapPoint { } @Override - public boolean processBounds(List components, Rectangle bounds, SnapPointFeedbackHost feedback) { - super.processBounds(components, bounds, feedback); + public boolean processBounds(List components, Rectangle bounds, Side resizeSide, SnapPointFeedbackHost feedback) { + super.processBounds(components, bounds, resizeSide, feedback); if (myHorizontal) { if (Math.abs(bounds.width - myWrapSize.width) < SNAP_SIZE) { From 2c8d4437b59923deffa594201bbb4f7f0b8d4f8a Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 16 May 2012 14:15:25 +0400 Subject: [PATCH 05/12] Fix literal keywords highlighting; cleanup --- .../ide/highlighter/JavaFileHighlighter.java | 1 + .../psi/impl/source/tree/ElementType.java | 19 ++++++++++--------- .../source/tree/java/ModifierListElement.java | 14 +++++++------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java b/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java index a2c2fde1d155..034f4a528aee 100644 --- a/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java +++ b/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java @@ -54,6 +54,7 @@ public class JavaFileHighlighter extends SyntaxHighlighterBase { ourMap2 = new HashMap(); fillMap(ourMap1, ElementType.KEYWORD_BIT_SET, SyntaxHighlighterColors.KEYWORD); + fillMap(ourMap1, ElementType.LITERAL_BIT_SET, SyntaxHighlighterColors.KEYWORD); fillMap(ourMap1, ElementType.OPERATION_BIT_SET, SyntaxHighlighterColors.OPERATION_SIGN); for (IElementType type : JavaDocTokenType.ALL_JAVADOC_TOKENS.getTypes()) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/ElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/ElementType.java index b506fd85e094..50646ca8f3ca 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/ElementType.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/ElementType.java @@ -21,9 +21,7 @@ import com.intellij.psi.PsiTypeElement; import com.intellij.psi.impl.source.PsiElementArrayConstructor; import com.intellij.psi.tree.TokenSet; -public interface ElementType extends JavaTokenType, JavaDocTokenType, - JavaElementType, JavaDocElementType { - +public interface ElementType extends JavaTokenType, JavaDocTokenType, JavaElementType, JavaDocElementType { TokenSet JAVA_WHITESPACE_BIT_SET = TokenSet.create(WHITE_SPACE); TokenSet JAVA_PLAIN_COMMENT_BIT_SET = TokenSet.create(END_OF_LINE_COMMENT, C_STYLE_COMMENT); @@ -32,13 +30,16 @@ public interface ElementType extends JavaTokenType, JavaDocTokenType, TokenSet JAVA_COMMENT_OR_WHITESPACE_BIT_SET = TokenSet.orSet(JAVA_WHITESPACE_BIT_SET, JAVA_COMMENT_BIT_SET); TokenSet KEYWORD_BIT_SET = TokenSet.create( - ABSTRACT_KEYWORD, ASSERT_KEYWORD, BOOLEAN_KEYWORD, BREAK_KEYWORD, BYTE_KEYWORD, CASE_KEYWORD, CATCH_KEYWORD, CHAR_KEYWORD, CLASS_KEYWORD, - CONST_KEYWORD, CONTINUE_KEYWORD, DEFAULT_KEYWORD, DO_KEYWORD, DOUBLE_KEYWORD, ELSE_KEYWORD, EXTENDS_KEYWORD, FINAL_KEYWORD, + ABSTRACT_KEYWORD, ASSERT_KEYWORD, BOOLEAN_KEYWORD, BREAK_KEYWORD, BYTE_KEYWORD, CASE_KEYWORD, CATCH_KEYWORD, CHAR_KEYWORD, + CLASS_KEYWORD, + CONST_KEYWORD, CONTINUE_KEYWORD, DEFAULT_KEYWORD, DO_KEYWORD, DOUBLE_KEYWORD, ELSE_KEYWORD, ENUM_KEYWORD, EXTENDS_KEYWORD, + FINAL_KEYWORD, FINALLY_KEYWORD, FLOAT_KEYWORD, FOR_KEYWORD, GOTO_KEYWORD, IF_KEYWORD, IMPLEMENTS_KEYWORD, IMPORT_KEYWORD, INSTANCEOF_KEYWORD, - INT_KEYWORD, INTERFACE_KEYWORD, LONG_KEYWORD, NATIVE_KEYWORD, NEW_KEYWORD, PACKAGE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, - SHORT_KEYWORD, SUPER_KEYWORD, SWITCH_KEYWORD, STRICTFP_KEYWORD, SYNCHRONIZED_KEYWORD, THIS_KEYWORD, THROW_KEYWORD, PROTECTED_KEYWORD, - TRANSIENT_KEYWORD, RETURN_KEYWORD, VOID_KEYWORD, STATIC_KEYWORD, WHILE_KEYWORD, TRY_KEYWORD, VOLATILE_KEYWORD, THROWS_KEYWORD, - ENUM_KEYWORD); + INT_KEYWORD, INTERFACE_KEYWORD, LONG_KEYWORD, NATIVE_KEYWORD, NEW_KEYWORD, PACKAGE_KEYWORD, PRIVATE_KEYWORD, PROTECTED_KEYWORD, + PUBLIC_KEYWORD, RETURN_KEYWORD, SHORT_KEYWORD, SUPER_KEYWORD, STATIC_KEYWORD, STRICTFP_KEYWORD, SWITCH_KEYWORD, SYNCHRONIZED_KEYWORD, + THIS_KEYWORD, THROW_KEYWORD, THROWS_KEYWORD, TRANSIENT_KEYWORD, TRY_KEYWORD, VOID_KEYWORD, VOLATILE_KEYWORD, WHILE_KEYWORD); + + TokenSet LITERAL_BIT_SET = TokenSet.create(TRUE_KEYWORD, FALSE_KEYWORD, NULL_KEYWORD); TokenSet OPERATION_BIT_SET = TokenSet.create( EQ, GT, LT, EXCL, TILDE, QUEST, COLON, PLUS, MINUS, ASTERISK, DIV, AND, OR, XOR, diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ModifierListElement.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ModifierListElement.java index 2ca740d55edb..aacf8d80f8ba 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ModifierListElement.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ModifierListElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,23 +20,23 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.PsiKeyword; import com.intellij.psi.PsiModifier; import com.intellij.psi.PsiModifierList; -import com.intellij.psi.impl.source.Constants; import com.intellij.psi.impl.source.SourceTreeToPsiMap; import com.intellij.psi.impl.source.tree.*; import com.intellij.psi.tree.ChildRoleBase; import com.intellij.util.containers.HashMap; +import org.jetbrains.annotations.Nullable; public class ModifierListElement extends CompositeElement { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.ModifierListElement"); public ModifierListElement() { - super(Constants.MODIFIER_LIST); + super(JavaElementType.MODIFIER_LIST); } @Override public TreeElement addInternal(TreeElement first, ASTNode last, ASTNode anchor, Boolean before) { - if (before == null){ - if (first == last && ElementType.KEYWORD_BIT_SET.contains(first.getElementType())){ + if (before == null) { + if (first == last && ElementType.KEYWORD_BIT_SET.contains(first.getElementType())) { anchor = getDefaultAnchor((PsiModifierList)SourceTreeToPsiMap.treeElementToPsi(this), (PsiKeyword)SourceTreeToPsiMap.treeElementToPsi(first)); before = Boolean.TRUE; @@ -68,11 +68,11 @@ public class ModifierListElement extends CompositeElement { ourModifierToOrderMap.put(PsiModifier.STRICTFP, 6); } + @Nullable private static ASTNode getDefaultAnchor(PsiModifierList modifierList, PsiKeyword modifier) { Integer order = ourModifierToOrderMap.get(modifier.getText()); if (order == null) return null; - for (ASTNode child = SourceTreeToPsiMap.psiElementToTree(modifierList).getFirstChildNode(); child != null; child = child.getTreeNext()) - { + for (ASTNode child = SourceTreeToPsiMap.psiToTreeNotNull(modifierList).getFirstChildNode(); child != null; child = child.getTreeNext()) { if (ElementType.KEYWORD_BIT_SET.contains(child.getElementType())) { Integer order1 = ourModifierToOrderMap.get(child.getText()); if (order1 == null) continue; From 5fb76fb0ccd5819290dcc465670233ed14b4b1e8 Mon Sep 17 00:00:00 2001 From: "Denis.Zhdanov" Date: Wed, 16 May 2012 11:44:48 +0400 Subject: [PATCH 06/12] Performance optimisation: *) caching last font and trying to reuse it during editor size recalculation (used to perform a call to the lock-protected font registry for every document symbol) *) register highlighters in bulk mode if necessary during indents pass processing; --- .../src/com/intellij/util/DocumentUtil.java | 54 +++++++++++++++++++ .../codeInsight/daemon/impl/IndentsPass.java | 20 ++++--- .../openapi/editor/impl/EditorImpl.java | 6 ++- 3 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 platform/core-impl/src/com/intellij/util/DocumentUtil.java diff --git a/platform/core-impl/src/com/intellij/util/DocumentUtil.java b/platform/core-impl/src/com/intellij/util/DocumentUtil.java new file mode 100644 index 000000000000..d24da8a3caef --- /dev/null +++ b/platform/core-impl/src/com/intellij/util/DocumentUtil.java @@ -0,0 +1,54 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util; + +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.editor.ex.DocumentEx; +import org.jetbrains.annotations.NotNull; + +/** + * Is intended to hold utility methods to use during {@link Document} processing. + * + * @author Denis Zhdanov + * @since 5/16/12 10:12 AM + */ +public class DocumentUtil { + + private DocumentUtil() { + } + + // TODO den add doc + public static void executeInBulk(@NotNull Document document, final boolean executeInBulk, @NotNull Runnable task) { + if (!(document instanceof DocumentEx)) { + task.run(); + return; + } + + DocumentEx documentEx = (DocumentEx)document; + if (executeInBulk == documentEx.isInBulkUpdate()) { + task.run(); + return; + } + + documentEx.setInBulkUpdate(executeInBulk); + try { + task.run(); + } + finally { + documentEx.setInBulkUpdate(!executeInBulk); + } + } +} diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/IndentsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/IndentsPass.java index fe17d35ddd9f..5ecaffe59ff1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/IndentsPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/IndentsPass.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ import com.intellij.openapi.util.Key; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiFile; import com.intellij.psi.tree.TokenSet; +import com.intellij.util.DocumentUtil; import com.intellij.util.containers.IntStack; import com.intellij.util.text.CharArrayUtil; import org.jetbrains.annotations.NotNull; @@ -231,8 +232,8 @@ public class IndentsPass extends TextEditorHighlightingPass implements DumbAware if (stamp != null && stamp.longValue() == nowStamp()) return; List oldHighlighters = myEditor.getUserData(INDENT_HIGHLIGHTERS_IN_EDITOR_KEY); - List newHighlighters = new ArrayList(); - MarkupModel mm = myEditor.getMarkupModel(); + final List newHighlighters = new ArrayList(); + final MarkupModel mm = myEditor.getMarkupModel(); int curRange = 0; @@ -264,9 +265,16 @@ public class IndentsPass extends TextEditorHighlightingPass implements DumbAware } } - for (; curRange < myRanges.size(); curRange++) { - newHighlighters.add(createHighlighter(mm, myRanges.get(curRange))); - } + final int startRangeIndex = curRange; + DocumentUtil.executeInBulk(myDocument, myRanges.size() > 10000, new Runnable() { + @Override + public void run() { + for (int i = startRangeIndex; i < myRanges.size(); i++) { + newHighlighters.add(createHighlighter(mm, myRanges.get(i))); + } + } + }); + myEditor.putUserData(INDENT_HIGHLIGHTERS_IN_EDITOR_KEY, newHighlighters); myEditor.putUserData(LAST_TIME_INDENTS_BUILT, nowStamp()); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index 533d365499d8..1ed0fe19cd1f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -6060,6 +6060,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi List softWraps = getSoftWrapModel().getRegisteredSoftWraps(); int softWrapsIndex = -1; + FontInfo lastFontInfo = null; for (int line = 0; line < lineCount; line++) { if (myLineWidths.getQuick(line) != -1) continue; if (line == lineCount - 1) { @@ -6158,7 +6159,10 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi } } else { - x += ComplementaryFontsRegistry.getFontAbleToDisplay(c, fontSize, fontType, fontName).charWidth(c); + if (lastFontInfo == null || !lastFontInfo.canDisplay(c)) { + lastFontInfo = ComplementaryFontsRegistry.getFontAbleToDisplay(c, fontSize, fontType, fontName); + } + x += lastFontInfo.charWidth(c); offset++; } } From c86d0be08c9a80f1af539b795b125ffe85e468de Mon Sep 17 00:00:00 2001 From: "Denis.Zhdanov" Date: Wed, 16 May 2012 13:30:33 +0400 Subject: [PATCH 07/12] IDEA-85100 Deleting wrapped lines with Ctrl+Y doen't work properly with "soft wrapped" lines More tests have been checked and added --- .../rearranger/RearrangerActionHandler.java | 48 ++++---- .../com/wrq/rearranger/entry/MethodEntry.java | 9 +- .../settings/CommentFillString.java | 22 +--- ...InitialisedByAnonymousClassAttribute.java} | 10 +- .../atomicAttributes/StaticAttribute.java | 4 +- .../attributeGroups/FieldAttributes.java | 36 +++--- .../attributeGroups/MethodAttributes.java | 3 +- .../wrq/rearranger/util/ModifierUtils.java | 2 +- .../com/wrq/rearranger/RearrangerTest.groovy | 103 +++++++----------- .../rearranger/NoRearrangementResult1.java | 1 + .../wrq/rearranger/RearrangementResult2.java | 1 + .../wrq/rearranger/RearrangementResult3.java | 1 + .../wrq/rearranger/RearrangementResult4.java | 1 + .../wrq/rearranger/RearrangementResult5.java | 1 + .../wrq/rearranger/RearrangementResult8.java | 2 +- .../com/wrq/rearranger/RearrangementTest.java | 1 + 16 files changed, 104 insertions(+), 141 deletions(-) rename plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/{InitToAnonClassAttribute.java => InitialisedByAnonymousClassAttribute.java} (82%) diff --git a/plugins/rearranger/src/com/wrq/rearranger/RearrangerActionHandler.java b/plugins/rearranger/src/com/wrq/rearranger/RearrangerActionHandler.java index 64a58b1ca43d..64650ce49bfe 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/RearrangerActionHandler.java +++ b/plugins/rearranger/src/com/wrq/rearranger/RearrangerActionHandler.java @@ -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 diff --git a/plugins/rearranger/src/com/wrq/rearranger/entry/MethodEntry.java b/plugins/rearranger/src/com/wrq/rearranger/entry/MethodEntry.java index 209c0e894f4c..7826d6946b24 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/entry/MethodEntry.java +++ b/plugins/rearranger/src/com/wrq/rearranger/entry/MethodEntry.java @@ -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 contents) - { + public void determineSettersAndMethodCalls(RearrangerSettings settings, List contents) { if (isGetter()) { if (settings.isKeepGettersSettersTogether()) { determineSetter(contents, settings); // link getters/setters via correspondingGetterSetter entries diff --git a/plugins/rearranger/src/com/wrq/rearranger/settings/CommentFillString.java b/plugins/rearranger/src/com/wrq/rearranger/settings/CommentFillString.java index f1992695517a..3f53ccec4557 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/settings/CommentFillString.java +++ b/plugins/rearranger/src/com/wrq/rearranger/settings/CommentFillString.java @@ -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(")*"); diff --git a/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitToAnonClassAttribute.java b/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitialisedByAnonymousClassAttribute.java similarity index 82% rename from plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitToAnonClassAttribute.java rename to plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitialisedByAnonymousClassAttribute.java index a13ada7458ea..31834a6d1d48 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitToAnonClassAttribute.java +++ b/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitialisedByAnonymousClassAttribute.java @@ -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; diff --git a/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/StaticAttribute.java b/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/StaticAttribute.java index 5c4b5f883f64..45af998af32b 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/StaticAttribute.java +++ b/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/StaticAttribute.java @@ -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 -------------------------- diff --git a/plugins/rearranger/src/com/wrq/rearranger/settings/attributeGroups/FieldAttributes.java b/plugins/rearranger/src/com/wrq/rearranger/settings/attributeGroups/FieldAttributes.java index c85fd2cc842a..241d188daf0e 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/settings/attributeGroups/FieldAttributes.java +++ b/plugins/rearranger/src/com/wrq/rearranger/settings/attributeGroups/FieldAttributes.java @@ -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()) && diff --git a/plugins/rearranger/src/com/wrq/rearranger/settings/attributeGroups/MethodAttributes.java b/plugins/rearranger/src/com/wrq/rearranger/settings/attributeGroups/MethodAttributes.java index 886ab1d6c46f..446b67be6c59 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/settings/attributeGroups/MethodAttributes.java +++ b/plugins/rearranger/src/com/wrq/rearranger/settings/attributeGroups/MethodAttributes.java @@ -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()) && diff --git a/plugins/rearranger/src/com/wrq/rearranger/util/ModifierUtils.java b/plugins/rearranger/src/com/wrq/rearranger/util/ModifierUtils.java index a72551d101b8..6744718c45fe 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/util/ModifierUtils.java +++ b/plugins/rearranger/src/com/wrq/rearranger/util/ModifierUtils.java @@ -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; } } diff --git a/plugins/rearranger/test/src/com/wrq/rearranger/RearrangerTest.groovy b/plugins/rearranger/test/src/com/wrq/rearranger/RearrangerTest.groovy index 66d7b516f84f..785e3354e59b 100644 --- a/plugins/rearranger/test/src/com/wrq/rearranger/RearrangerTest.groovy +++ b/plugins/rearranger/test/src/com/wrq/rearranger/RearrangerTest.groovy @@ -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(); diff --git a/plugins/rearranger/test/testData/com/wrq/rearranger/NoRearrangementResult1.java b/plugins/rearranger/test/testData/com/wrq/rearranger/NoRearrangementResult1.java index 8882b2f69480..c887abd0bf6f 100644 --- a/plugins/rearranger/test/testData/com/wrq/rearranger/NoRearrangementResult1.java +++ b/plugins/rearranger/test/testData/com/wrq/rearranger/NoRearrangementResult1.java @@ -5,6 +5,7 @@ package com.wrq.rearranger; /** public class comments. */ public class RearrangementTest { + /** field 1. */ private int field1; private int field2; diff --git a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult2.java b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult2.java index 1c4b9471883d..d426b6cc0cb3 100644 --- a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult2.java +++ b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult2.java @@ -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; diff --git a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult3.java b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult3.java index 3da9daf9be25..f84e4055218f 100644 --- a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult3.java +++ b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult3.java @@ -5,6 +5,7 @@ package com.wrq.rearranger; /** public class comments. */ public class RearrangementTest { + /** field 1. */ private int field1; private int field2; diff --git a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult4.java b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult4.java index 014128616905..12b241aa0be4 100644 --- a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult4.java +++ b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult4.java @@ -9,6 +9,7 @@ public class RearrangementTest { NoRearrangementTest() { // constructor body } + /** field 1. */ private int field1; private int field2; diff --git a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult5.java b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult5.java index a87994b91437..465a2760c659 100644 --- a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult5.java +++ b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult5.java @@ -9,6 +9,7 @@ class AnotherOuterClass { /** public class comments. */ public class RearrangementTest { + /** field 1. */ private int field1; private int field2; diff --git a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult8.java b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult8.java index 1e8111d0cc4b..6e9ec01a896c 100644 --- a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult8.java +++ b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult8.java @@ -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() { diff --git a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementTest.java b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementTest.java index 8882b2f69480..c887abd0bf6f 100644 --- a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementTest.java +++ b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementTest.java @@ -5,6 +5,7 @@ package com.wrq.rearranger; /** public class comments. */ public class RearrangementTest { + /** field 1. */ private int field1; private int field2; From 606cc65a4f90b76fbfe45dc862cbf855075f5a4e Mon Sep 17 00:00:00 2001 From: "Denis.Zhdanov" Date: Wed, 16 May 2012 15:21:17 +0400 Subject: [PATCH 08/12] IDEA-85100 Deleting wrapped lines with Ctrl+Y doen't work properly with "soft wrapped" lines More tests have been checked and added --- .../PrecedingCommentRuleInstance.java | 4 +- .../InitializerAttribute.java | 4 +- .../com/wrq/rearranger/RearrangerTest.groovy | 42 +++++++++---------- .../wrq/rearranger/RearrangementResult10.java | 4 +- 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/plugins/rearranger/src/com/wrq/rearranger/ruleinstance/PrecedingCommentRuleInstance.java b/plugins/rearranger/src/com/wrq/rearranger/ruleinstance/PrecedingCommentRuleInstance.java index bd1854a7ffa3..94aefa1a4ced 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/ruleinstance/PrecedingCommentRuleInstance.java +++ b/plugins/rearranger/src/com/wrq/rearranger/ruleinstance/PrecedingCommentRuleInstance.java @@ -26,9 +26,7 @@ import com.wrq.rearranger.settings.CommentRule; import java.util.List; /** Used to store a generated comment which is emitted based on whether it matches preceding rules. */ -public class PrecedingCommentRuleInstance - extends CommentRuleInstance -{ +public class PrecedingCommentRuleInstance extends CommentRuleInstance { public PrecedingCommentRuleInstance(final CommentRule commentRule) { super(commentRule); diff --git a/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitializerAttribute.java b/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitializerAttribute.java index 8b18576538b1..11951b82de8c 100644 --- a/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitializerAttribute.java +++ b/plugins/rearranger/src/com/wrq/rearranger/settings/atomicAttributes/InitializerAttribute.java @@ -25,9 +25,7 @@ import com.wrq.rearranger.ModifierConstants; import org.jdom.Element; /** Routines to handle a static initializer method. */ -public final class InitializerAttribute - extends AndNotAttribute -{ +public final class InitializerAttribute extends AndNotAttribute { // -------------------------- STATIC METHODS -------------------------- diff --git a/plugins/rearranger/test/src/com/wrq/rearranger/RearrangerTest.groovy b/plugins/rearranger/test/src/com/wrq/rearranger/RearrangerTest.groovy index 785e3354e59b..296c26c435d6 100644 --- a/plugins/rearranger/test/src/com/wrq/rearranger/RearrangerTest.groovy +++ b/plugins/rearranger/test/src/com/wrq/rearranger/RearrangerTest.groovy @@ -30,6 +30,7 @@ import com.wrq.rearranger.settings.attributeGroups.FieldAttributes import com.wrq.rearranger.settings.attributeGroups.MethodAttributes import org.jetbrains.annotations.NotNull import org.jetbrains.annotations.Nullable +import com.wrq.rearranger.settings.CommentRule /** JUnit tests for the rearranger plugin. */ class RearrangerTest extends LightCodeInsightFixtureTestCase { @@ -132,32 +133,29 @@ class RearrangerTest extends LightCodeInsightFixtureTestCase { 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) + def attributes = new MethodAttributes() + attributes.getterSetterMethodType = true + attributes.otherMethodType = true + attributes.constructorMethodType = false + attributes.sortOptions.byName = true + mySettings.addItem(attributes, 0) mySettings.keepGettersSettersTogether = false } } -// public final void testSimpleComment() throws Exception { -// configureByFile("/com/wrq/rearranger/RearrangementTest.java"); -// final PsiFile file = getFile(); -// final Document doc = PsiDocumentManager.getInstance(getProject()).getDocument(file); -// final FieldAttributes fa = new FieldAttributes(); -// fa.getPlAttr().setPlPublic(true); -// rs.addItem(fa, 0); -// final CommentRule c = new CommentRule(); -// c.setCommentText("// simple comment **********"); -// c.setEmitCondition(CommentRule.EMIT_IF_ITEMS_MATCH_PRECEDING_RULE); -// rs.addItem(c, 1); -// final RearrangerActionHandler rah = new RearrangerActionHandler(); -// rah.rearrangeDocument(getProject(), file, rs, doc); -// super.checkResultByFile("/com/wrq/rearranger/RearrangementResult10.java"); -// } -// + public final void testSimpleComment() throws Exception { + doTest('RearrangementTest', 'RearrangementResult10') { + def attributes = new FieldAttributes() + attributes.protectionLevelAttributes.plPublic = true + mySettings.addItem(attributes, 0) + + def comment = new CommentRule() + comment.commentText = '// simple comment **********' + comment.emitCondition = CommentRule.EMIT_IF_ITEMS_MATCH_PRECEDING_RULE + mySettings.addItem(comment, 1) + } + } + // /** // * Delete old comment and insert (identical) new one. This tests proper identification and deletion of old // * comments. diff --git a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult10.java b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult10.java index 07f2dd6cbab9..16d79b2352d6 100644 --- a/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult10.java +++ b/plugins/rearranger/test/testData/com/wrq/rearranger/RearrangementResult10.java @@ -11,8 +11,8 @@ public class RearrangementTest { /** field 1. */ private int field1; private int field2; - final int field5 = 5; - protected int field6 = 6; + final int field5 = 5; + protected int field6 = 6; /** method 1 comment. */ void method1() { From 53b5d08eb4f1533c4474387557b035c0421a01d1 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Wed, 16 May 2012 15:07:08 +0400 Subject: [PATCH 09/12] slim colors --- .../src/colorSchemes/all_hallows_eve.xml | 2492 ++++----------- colorSchemes/src/colorSchemes/blackboard.xml | 2471 ++++----------- colorSchemes/src/colorSchemes/cobalt.xml | 2580 ++++------------ colorSchemes/src/colorSchemes/monokai.xml | 2473 ++++----------- colorSchemes/src/colorSchemes/rails_casts.xml | 2718 ++++------------- colorSchemes/src/colorSchemes/twilight.xml | 2470 ++++----------- colorSchemes/src/colorSchemes/vibrant_ink.xml | 2482 ++++----------- 7 files changed, 4188 insertions(+), 13498 deletions(-) diff --git a/colorSchemes/src/colorSchemes/all_hallows_eve.xml b/colorSchemes/src/colorSchemes/all_hallows_eve.xml index 1c744668d830..2ff5c3a5253a 100644 --- a/colorSchemes/src/colorSchemes/all_hallows_eve.xml +++ b/colorSchemes/src/colorSchemes/all_hallows_eve.xml @@ -1,2937 +1,1685 @@ - - -