diff options
Diffstat (limited to 'platform/lang-impl/src/com/intellij/openapi/editor')
6 files changed, 10 insertions, 59 deletions
diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectAllOccurrencesAction.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectAllOccurrencesAction.java index 3e284ff6b2cc..ae2a4dc0d53c 100644 --- a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectAllOccurrencesAction.java +++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectAllOccurrencesAction.java @@ -42,8 +42,6 @@ public class SelectAllOccurrencesAction extends EditorAction { @Override public void doExecute(final Editor editor, @Nullable Caret c, DataContext dataContext) { - if (executeEquivalentFindPanelAction(editor, dataContext)) return; - Caret caret = c == null ? editor.getCaretModel().getPrimaryCaret() : c; boolean wholeWordsSearch = false; @@ -88,10 +86,5 @@ public class SelectAllOccurrencesAction extends EditorAction { }, caretShiftFromSelectionStart); editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); } - - @Override - protected EditorHeaderAction getEquivalentFindPanelAction(EditorSearchComponent searchComponent) { - return new SelectAllAction(searchComponent); - } } } diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java index 7d3c408ee152..74390f15b149 100644 --- a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java +++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java @@ -40,8 +40,6 @@ public class SelectNextOccurrenceAction extends EditorAction { @Override public void doExecute(Editor editor, @Nullable Caret c, DataContext dataContext) { - if (executeEquivalentFindPanelAction(editor, dataContext)) return; - Caret caret = c == null ? editor.getCaretModel().getPrimaryCaret() : c; TextRange wordSelectionRange = getSelectionRange(editor, caret); boolean notFoundPreviously = getAndResetNotFoundStatus(editor); @@ -56,7 +54,7 @@ public class SelectNextOccurrenceAction extends EditorAction { FindModel model = getFindModel(selectedText, wholeWordSearch); - findManager.setFindWasPerformed(); + findManager.setSelectNextOccurrenceWasPerformed(); findManager.setFindNextModel(model); int searchStartOffset = notFoundPreviously ? 0 : caret.getSelectionEnd(); @@ -84,10 +82,5 @@ public class SelectNextOccurrenceAction extends EditorAction { } editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); } - - @Override - protected EditorHeaderAction getEquivalentFindPanelAction(EditorSearchComponent searchComponent) { - return new AddOccurrenceAction(searchComponent); - } } } diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectOccurrencesActionHandler.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectOccurrencesActionHandler.java index 7b189281dfd0..1858ef53b3f5 100644 --- a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectOccurrencesActionHandler.java +++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectOccurrencesActionHandler.java @@ -107,25 +107,4 @@ abstract public class SelectOccurrencesActionHandler extends EditorActionHandler model.setWholeWordsOnly(wholeWords); return model; } - - protected boolean executeEquivalentFindPanelAction(Editor editor, DataContext context) { - if (editor.getHeaderComponent() instanceof EditorSearchComponent) { - EditorSearchComponent searchComponent = (EditorSearchComponent)editor.getHeaderComponent(); - EditorHeaderAction action = getEquivalentFindPanelAction(searchComponent); - if (action != null) { - Presentation presentation = new Presentation(); - AnActionEvent event = new AnActionEvent(null, context, ActionPlaces.MAIN_MENU, presentation, ActionManager.getInstance(), 0); - action.update(event); - if (presentation.isEnabled()) { - action.actionPerformed(event); - return true; - } - } - } - return false; - } - - protected EditorHeaderAction getEquivalentFindPanelAction(EditorSearchComponent searchComponent) { - return null; - } } diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectPreviousOccurrenceAction.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectPreviousOccurrenceAction.java index fffff56b12dc..a5657ff89b27 100644 --- a/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectPreviousOccurrenceAction.java +++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectPreviousOccurrenceAction.java @@ -15,9 +15,6 @@ */ package com.intellij.openapi.editor.actions; -import com.intellij.find.EditorSearchComponent; -import com.intellij.find.editorHeaderActions.EditorHeaderAction; -import com.intellij.find.editorHeaderActions.RemoveOccurrenceAction; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Caret; import com.intellij.openapi.editor.Editor; @@ -38,8 +35,6 @@ public class UnselectPreviousOccurrenceAction extends EditorAction { @Override public void doExecute(Editor editor, @Nullable Caret caret, DataContext dataContext) { - if (executeEquivalentFindPanelAction(editor, dataContext)) return; - if (editor.getCaretModel().getCaretCount() > 1) { editor.getCaretModel().removeCaret(editor.getCaretModel().getPrimaryCaret()); } @@ -49,10 +44,5 @@ public class UnselectPreviousOccurrenceAction extends EditorAction { getAndResetNotFoundStatus(editor); editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); } - - @Override - protected EditorHeaderAction getEquivalentFindPanelAction(EditorSearchComponent searchComponent) { - return new RemoveOccurrenceAction(searchComponent); - } } } diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/richcopy/FontMapper.java b/platform/lang-impl/src/com/intellij/openapi/editor/richcopy/FontMapper.java index 4fec39342090..c5fd5592b634 100644 --- a/platform/lang-impl/src/com/intellij/openapi/editor/richcopy/FontMapper.java +++ b/platform/lang-impl/src/com/intellij/openapi/editor/richcopy/FontMapper.java @@ -16,10 +16,10 @@ package com.intellij.openapi.editor.richcopy; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.util.ReflectionUtil; import org.jetbrains.annotations.NotNull; import java.awt.*; -import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Locale; @@ -46,20 +46,18 @@ public class FontMapper { } Method findFontMethod = Class.forName("sun.font.FontManager").getMethod("findFont2D", String.class, int.class, int.class); for (String logicalFont : logicalFontsToMap) { - String physicalFont = null; Object font2D = findFontMethod.invoke(fontManager, logicalFont, Font.PLAIN, 0); if (font2D == null) { continue; } String fontClassName = font2D.getClass().getName(); + String physicalFont = null; if ("sun.font.CompositeFont".equals(fontClassName)) { // Windows and Linux case Object physicalFontObject = Class.forName("sun.font.CompositeFont").getMethod("getSlotFont", int.class).invoke(font2D, 0); physicalFont = (String)Class.forName("sun.font.Font2D").getMethod("getFamilyName", Locale.class).invoke(physicalFontObject, Locale.getDefault()); } else if ("sun.font.CFont".equals(fontClassName)) { // MacOS case - Field field = Class.forName("sun.font.CFont").getDeclaredField("nativeFontName"); - field.setAccessible(true); - physicalFont = (String)field.get(font2D); + physicalFont = ReflectionUtil.getField(Class.forName("sun.font.CFont"), font2D, String.class, "nativeFontName"); } if (physicalFont != null) { logicalToPhysicalMapping.put(logicalFont, physicalFont); diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/richcopy/TextWithMarkupProcessor.java b/platform/lang-impl/src/com/intellij/openapi/editor/richcopy/TextWithMarkupProcessor.java index 54406106b976..504496a27716 100644 --- a/platform/lang-impl/src/com/intellij/openapi/editor/richcopy/TextWithMarkupProcessor.java +++ b/platform/lang-impl/src/com/intellij/openapi/editor/richcopy/TextWithMarkupProcessor.java @@ -23,6 +23,7 @@ import com.intellij.ide.highlighter.HighlighterFactory; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.colors.EditorColorsScheme; +import com.intellij.openapi.editor.colors.FontPreferences; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.ex.DisposableIterator; import com.intellij.openapi.editor.ex.MarkupModelEx; @@ -418,7 +419,7 @@ public class TextWithMarkupProcessor extends CopyPastePostProcessor<RawTextWithM private MarkupIterator(@NotNull CharSequence charSequence, @NotNull RangeIterator rangeIterator, @NotNull EditorColorsScheme colorsScheme) { myRangeIterator = rangeIterator; - mySegmentIterator = new SegmentIterator(charSequence, colorsScheme.getEditorFontName(), colorsScheme.getEditorFontSize()); + mySegmentIterator = new SegmentIterator(charSequence, colorsScheme.getFontPreferences()); } public boolean atEnd() { @@ -812,8 +813,7 @@ public class TextWithMarkupProcessor extends CopyPastePostProcessor<RawTextWithM private static class SegmentIterator { private final CharSequence myCharSequence; - private final String myDefaultFontFamilyName; - private final int myFontSize; + private final FontPreferences myFontPreferences; private int myCurrentStartOffset; private int myCurrentOffset; @@ -822,10 +822,9 @@ public class TextWithMarkupProcessor extends CopyPastePostProcessor<RawTextWithM private String myCurrentFontFamilyName; private String myNextFontFamilyName; - private SegmentIterator(CharSequence charSequence, String defaultFontFamilyName, int fontSize) { + private SegmentIterator(CharSequence charSequence, FontPreferences fontPreferences) { myCharSequence = charSequence; - myDefaultFontFamilyName = defaultFontFamilyName; - myFontSize = fontSize; + myFontPreferences = fontPreferences; } public void reset(int startOffset, int endOffset, int fontStyle) { @@ -843,9 +842,8 @@ public class TextWithMarkupProcessor extends CopyPastePostProcessor<RawTextWithM myCurrentStartOffset = myCurrentOffset; for (; myCurrentOffset < myEndOffset; myCurrentOffset++) { FontInfo fontInfo = ComplementaryFontsRegistry.getFontAbleToDisplay(myCharSequence.charAt(myCurrentOffset), - myFontSize, myFontStyle, - myDefaultFontFamilyName); + myFontPreferences); String fontFamilyName = fontInfo.getFont().getFamily(); if (myCurrentFontFamilyName == null) { |