diff --git a/editor.lib/apichanges.xml b/editor.lib/apichanges.xml --- a/editor.lib/apichanges.xml +++ b/editor.lib/apichanges.xml @@ -107,6 +107,53 @@ + + Moving find implementations to module editor.search + + + + + +

+ The search actions from ActionFactory where moved to editor.search module. DocumentFinder was removed as unused by new search implementation. +

+ +
+                    check-sigtest:
+                    [mkdir] Created dir: /home/mito/nb/develop/editor.lib/build/test/sigtest/results
+                    [sigtest] /home/mito/nb/develop/editor.lib/build/test/sigtest/results/org.netbeans.modules.editor.lib
+                    [sigtest] Packages: org.netbeans.editor.*, org.netbeans.editor.ext.*, org.netbeans.editor.view.spi.*, org.netbeans.lib.editor.hyperlink.spi.*, org.netbeans.lib.editor.view.*
+                    [sigtest]
+                    [sigtest] email: api-changes@netbeans.org
+                    [sigtest] SignatureTest report
+                    [sigtest] Base version: 3.34.0
+                    [sigtest] Tested version: 3.34.0
+                    [sigtest] Check mode: bin [throws removed]
+                    [sigtest] Constant checking: on
+                    [sigtest]
+                    [sigtest]
+                    [sigtest] Class org.netbeans.editor.ActionFactory$FindNextAction
+                    [sigtest]   "E1.2 - API type removed" : CLASS public static org.netbeans.editor.ActionFactory$FindNextAction
+                    [sigtest]
+                    [sigtest] Class org.netbeans.editor.ActionFactory$FindPreviousAction
+                    [sigtest]   "E1.2 - API type removed" : CLASS public static org.netbeans.editor.ActionFactory$FindPreviousAction
+                    [sigtest]
+                    [sigtest] Class org.netbeans.editor.ActionFactory$FindSelectionAction
+                    [sigtest]   "E1.2 - API type removed" : CLASS public static org.netbeans.editor.ActionFactory$FindSelectionAction
+                    [sigtest]
+                    [sigtest] Class org.netbeans.editor.ActionFactory$ToggleHighlightSearchAction
+                    [sigtest]   "E1.2 - API type removed" : CLASS public static org.netbeans.editor.ActionFactory$ToggleHighlightSearchAction
+                    [sigtest]
+                    [sigtest] Class org.netbeans.editor.DocumentFinder
+                    [sigtest]   "E1.2 - API type removed" : CLASS public org.netbeans.editor.DocumentFinder
+                    [sigtest]
+                    [sigtest] Class org.netbeans.editor.DocumentFinder$FindReplaceResult
+                    [sigtest]   "E1.2 - API type removed" : CLASS public static org.netbeans.editor.DocumentFinder$FindReplaceResult
+                    [sigtest]
+                    [sigtest] /home/mito/nb/develop/editor.lib/build/test/sigtest/results/org-netbeans-modules-editor-lib.xml: 1 failures in /home/mito/nb/develop/editor.lib/nbproject/org-netbeans-modules-editor-lib.sig
+                
+
+
Spelling error in the API corrected diff --git a/editor.lib/nbproject/project.properties b/editor.lib/nbproject/project.properties --- a/editor.lib/nbproject/project.properties +++ b/editor.lib/nbproject/project.properties @@ -42,7 +42,7 @@ javac.compilerargs=-Xlint:unchecked javac.source=1.6 -spec.version.base=3.34.0 +spec.version.base=3.35.0 is.autoload=true javadoc.arch=${basedir}/arch.xml diff --git a/editor.lib/src/org/netbeans/editor/ActionFactory.java b/editor.lib/src/org/netbeans/editor/ActionFactory.java --- a/editor.lib/src/org/netbeans/editor/ActionFactory.java +++ b/editor.lib/src/org/netbeans/editor/ActionFactory.java @@ -56,8 +56,6 @@ import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; -import java.util.Map; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.concurrent.atomic.AtomicBoolean; @@ -65,14 +63,11 @@ import java.util.logging.Logger; import javax.swing.Action; import javax.swing.ActionMap; -import javax.swing.ButtonModel; import javax.swing.Icon; import javax.swing.JCheckBoxMenuItem; import javax.swing.JEditorPane; import javax.swing.JMenuItem; import javax.swing.JToggleButton; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import javax.swing.plaf.TextUI; import javax.swing.text.BadLocationException; import javax.swing.text.Caret; @@ -100,13 +95,11 @@ import org.netbeans.modules.editor.indent.api.Reformat; import org.netbeans.modules.editor.lib.NavigationHistory; import org.netbeans.modules.editor.lib2.RectangularSelectionUtils; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport; import org.netbeans.modules.editor.lib2.view.DocumentView; import org.openide.util.ContextAwareAction; import org.openide.util.ImageUtilities; import org.openide.util.Lookup; import org.openide.util.NbBundle; -import org.openide.util.WeakListeners; import org.openide.util.actions.Presenter; /** @@ -1189,144 +1182,6 @@ } } - @EditorActionRegistration(name = BaseKit.findNextAction, - iconResource = "org/netbeans/modules/editor/resources/find_next.png") // NOI18N - public static class FindNextAction extends LocalBaseAction { - - static final long serialVersionUID =6878814427731642684L; - - public FindNextAction() { - super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); - } - - @Override - public void actionPerformed(ActionEvent evt, JTextComponent target) { - if (target != null) { - EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(target); - if (eui.getComponent().getClientProperty("AsTextField") == null) { //NOI18N - EditorFindSupport.getInstance().setFocusedTextComponent(eui.getComponent()); - } - openFindIfNecessary(eui, evt); - EditorFindSupport.getInstance().find(null, false); - } - } - } - - private static void openFindIfNecessary(EditorUI eui, ActionEvent evt) { - Object findWhat = EditorFindSupport.getInstance().getFindProperty(EditorFindSupport.FIND_WHAT); - if (findWhat == null || !(findWhat instanceof String) || ((String) findWhat).isEmpty()) { - - Action findAction = ((BaseKit) eui.getComponent().getUI().getEditorKit( - eui.getComponent())).getActionByName("find"); - if (findAction != null) { - findAction.actionPerformed(evt); - } - } - } - - @EditorActionRegistration(name = BaseKit.findPreviousAction, - iconResource = "org/netbeans/modules/editor/resources/find_previous.png") // NOI18N - public static class FindPreviousAction extends LocalBaseAction { - - static final long serialVersionUID =-43746947902694926L; - - public FindPreviousAction() { - super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); - } - - @Override - public void actionPerformed(ActionEvent evt, JTextComponent target) { - if (target != null) { - EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(target); - if (eui.getComponent().getClientProperty("AsTextField") == null) { //NOI18N - EditorFindSupport.getInstance().setFocusedTextComponent(eui.getComponent()); - } - openFindIfNecessary(eui, evt); - EditorFindSupport.getInstance().find(null, true); - } - } - } - - /** Finds either selection or if there's no selection it finds - * the word where the cursor is standing. - */ - @EditorActionRegistration(name = BaseKit.findSelectionAction, - iconResource = "org/netbeans/modules/editor/resources/find_selection.png") // NOI18N - public static class FindSelectionAction extends LocalBaseAction { - - static final long serialVersionUID =-5601618936504699565L; - - public FindSelectionAction() { - super(); - } - - @Override - public void actionPerformed(ActionEvent evt, JTextComponent target) { - if (target != null) { - EditorFindSupport findSupport = EditorFindSupport.getInstance(); - Caret caret = target.getCaret(); - int dotPos = caret.getDot(); - HashMap props = new HashMap(findSupport.createDefaultFindProperties()); - String searchWord = null; - boolean revert = false; - Boolean originalValue = null; - Map revertMap = (Map)props.get(EditorFindSupport.REVERT_MAP); - Boolean revertValue = revertMap != null ? (Boolean)revertMap.get(EditorFindSupport.FIND_WHOLE_WORDS) : null; - - if (Utilities.isSelectionShowing(caret)) { // valid selection - searchWord = target.getSelectedText(); - originalValue = (Boolean)props.put(EditorFindSupport.FIND_WHOLE_WORDS, Boolean.FALSE); - if (Boolean.FALSE.equals(revertValue)) { - revertMap.remove(EditorFindSupport.FIND_WHOLE_WORDS); - } else { - revert = !Boolean.FALSE.equals(originalValue); - } - } else { // no selection, get current word - try { - searchWord = Utilities.getIdentifier((BaseDocument)target.getDocument(), - dotPos); - originalValue = (Boolean)props.put(EditorFindSupport.FIND_WHOLE_WORDS, Boolean.TRUE); - if (Boolean.TRUE.equals(revertValue)) { - revertMap.remove(EditorFindSupport.FIND_WHOLE_WORDS); - } else { - revert = !Boolean.TRUE.equals(originalValue); - } - - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - - if (searchWord != null) { - int n = searchWord.indexOf( '\n' ); - if (n >= 0 ) - searchWord = searchWord.substring(0, n); - props.put(EditorFindSupport.FIND_WHAT, searchWord); - - if (revert){ - revertMap = new HashMap(); - revertMap.put(EditorFindSupport.FIND_WHOLE_WORDS, originalValue != null ? originalValue : Boolean.FALSE); - props.put(EditorFindSupport.REVERT_MAP, revertMap); - } - - props.put(EditorFindSupport.FIND_BLOCK_SEARCH, Boolean.FALSE); - props.put(EditorFindSupport.FIND_BLOCK_SEARCH_START, null); - props.put(EditorFindSupport.FIND_BLOCK_SEARCH_END, null); - - EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(target); - if (eui.getComponent().getClientProperty("AsTextField") == null) { //NOI18N - findSupport.setFocusedTextComponent(eui.getComponent()); - } - findSupport.putFindProperties(props); - if (findSupport.find(null, false)) { - findSupport.addToHistory(new EditorFindSupport.SPW((String) props.get(EditorFindSupport.FIND_WHAT), - (Boolean) props.get(EditorFindSupport.FIND_WHOLE_WORDS), (Boolean) props.get(EditorFindSupport.FIND_MATCH_CASE), (Boolean) props.get(EditorFindSupport.FIND_REG_EXP))); - } - } - } - } - } - // Cannot easily use EditorActionRegistration yet for toggle buttons public static class ToggleRectangularSelectionAction extends LocalBaseAction implements Presenter.Toolbar, ContextAwareAction, PropertyChangeListener { @@ -1401,103 +1256,6 @@ } -// suspending the use of EditorActionRegistration due to #167063 -// @EditorActionRegistration(name = BaseKit.toggleHighlightSearchAction, -// iconResource = "org/netbeans/modules/editor/resources/toggle_highlight.png") - public static class ToggleHighlightSearchAction extends LocalBaseAction implements Presenter.Toolbar { - - static final long serialVersionUID =4603809175771743200L; - - public ToggleHighlightSearchAction() { - super(BaseKit.toggleHighlightSearchAction, CLEAR_STATUS_TEXT); - putValue(Action.SMALL_ICON, ImageUtilities.loadImageIcon("org/netbeans/modules/editor/resources/toggle_highlight.png", false)); //NOI18N - putValue("noIconInMenu", Boolean.TRUE); // NOI18N - } - - public void actionPerformed(ActionEvent evt, JTextComponent target) { - if (target != null) { - Boolean cur = (Boolean)EditorFindSupport.getInstance().getFindProperty( - EditorFindSupport.FIND_HIGHLIGHT_SEARCH); - if (cur == null || cur.booleanValue() == false) { - cur = Boolean.TRUE; - } else { - cur = Boolean.FALSE; - } - EditorFindSupport.getInstance().putFindProperty( - EditorFindSupport.FIND_HIGHLIGHT_SEARCH, cur); - } - } - - public Component getToolbarPresenter() { - JToggleButton b = new MyGaGaButton(); - b.setModel(new HighlightButtonModel()); - b.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N - b.setAction(this); - - return b; - } - - private static final class HighlightButtonModel extends JToggleButton.ToggleButtonModel implements PropertyChangeListener { - - public HighlightButtonModel() { - EditorFindSupport efs = EditorFindSupport.getInstance(); - efs.addPropertyChangeListener(WeakListeners.propertyChange(this, efs)); - propertyChange(null); - } - - public void propertyChange(PropertyChangeEvent evt) { - if (evt == null || evt.getPropertyName() == null || evt.getPropertyName().equals(EditorFindSupport.FIND_HIGHLIGHT_SEARCH)) { - Boolean value = (Boolean) EditorFindSupport.getInstance().getFindProperty(EditorFindSupport.FIND_HIGHLIGHT_SEARCH); - setSelected(value == null ? false : value.booleanValue()); - } - } - } // End of HighlightButtonModel class - - private static final class MyGaGaButton extends JToggleButton implements ChangeListener { - - public MyGaGaButton() { - - } - - @Override - public void setModel(ButtonModel model) { - ButtonModel oldModel = getModel(); - if (oldModel != null) { - oldModel.removeChangeListener(this); - } - - super.setModel(model); - - ButtonModel newModel = getModel(); - if (newModel != null) { - newModel.addChangeListener(this); - } - - stateChanged(null); - } - - public void stateChanged(ChangeEvent evt) { - boolean selected = isSelected(); - super.setContentAreaFilled(selected); - super.setBorderPainted(selected); - } - - @Override - public void setBorderPainted(boolean arg0) { - if (!isSelected()) { - super.setBorderPainted(arg0); - } - } - - @Override - public void setContentAreaFilled(boolean arg0) { - if (!isSelected()) { - super.setContentAreaFilled(arg0); - } - } - } - } // End of ToggleHighlightSearchAction class - public static class UndoAction extends LocalBaseAction { static final long serialVersionUID =8628586205035497612L; diff --git a/editor.lib/src/org/netbeans/editor/BaseKit.java b/editor.lib/src/org/netbeans/editor/BaseKit.java --- a/editor.lib/src/org/netbeans/editor/BaseKit.java +++ b/editor.lib/src/org/netbeans/editor/BaseKit.java @@ -931,7 +931,6 @@ new PreviousWordAction(selectionPreviousWordAction), new ActionFactory.RemoveWordNextAction(), new ActionFactory.RemoveWordPreviousAction(), - new ActionFactory.ToggleHighlightSearchAction(), new ActionFactory.ToggleRectangularSelectionAction(), // Self test actions diff --git a/editor.lib/src/org/netbeans/editor/Bundle.properties b/editor.lib/src/org/netbeans/editor/Bundle.properties --- a/editor.lib/src/org/netbeans/editor/Bundle.properties +++ b/editor.lib/src/org/netbeans/editor/Bundle.properties @@ -92,9 +92,6 @@ escape=Simulate Escape Key fast-import=Fast Import try-catch=Surround With try-catch -find-next=Find Next Occurrence -find-previous=Find Previous Occurrence -find-selection=Find Selection find=Find first-non-white=Go to First Non-whitespace Char format=Format @@ -192,7 +189,6 @@ to-upper-case=To Uppercase toggle-case-identifier-begin=Switch Capitalization of Identifier toggle-case-word-begin=Switch Capitalization of Word -toggle-highlight-search=Toggle Highlight Search toggle-line-numbers=Toggle Line Numbers toggle-rectangular-selection=Toggle Rectangular Selection toggle-toolbar=Toggle Toolbar diff --git a/editor.lib/src/org/netbeans/editor/DocumentFinder.java b/editor.lib/src/org/netbeans/editor/DocumentFinder.java deleted file mode 100644 --- a/editor.lib/src/org/netbeans/editor/DocumentFinder.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - */ - -package org.netbeans.editor; - -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import org.netbeans.lib.editor.util.swing.DocumentUtilities; -import org.openide.DialogDisplayer; -import org.openide.ErrorManager; -import org.openide.NotifyDescriptor; -import org.openide.util.NbBundle; - -/** - * - * @author Martin Roskanin - * @deprecated Without any replacement. - */ -public class DocumentFinder -{ - /** - * Finds in document - * - * @param doc document where to find - * @param startOffset offset in the document where the search will start - * @param endOffset offset where the search will end with reporting - * that nothing was found. - * @param props find properties - */ - public static int[] find( - BaseDocument doc, int startOffset, int endOffset, Map props, - boolean oppositeDir - ) throws BadLocationException { - return org.netbeans.modules.editor.lib2.search.DocumentFinder.find(doc, startOffset, endOffset, props, oppositeDir); - } - - public static int[] findBlocks( - BaseDocument doc, int startOffset, int endOffset, - Map props, int blocks[] - ) throws BadLocationException { - return org.netbeans.modules.editor.lib2.search.DocumentFinder.findBlocks(doc, startOffset, endOffset, props, blocks); - } - - /** - * Finds the searching string and substitute replace expression in case of - * regexp backreferences. - * @return FindReplaceResult, that contains positions of found string and substituted replace expression - */ - public static FindReplaceResult findReplaceResult( - String replaceString, BaseDocument doc, int startOffset, int endOffset, - Map props, boolean oppositeDir - ) throws BadLocationException { - org.netbeans.modules.editor.lib2.search.DocumentFinder.FindReplaceResult result = - org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceResult( - replaceString, doc, startOffset, endOffset, props, oppositeDir); - - return new FindReplaceResult(result.getFoundPositions(), result.getReplacedString()); - } - - private DocumentFinder() { - - } - - public static class FindReplaceResult{ - private int[] positions; - private String replacedString; - - public FindReplaceResult(int[] positions, String replacedString){ - this.positions = positions; - this.replacedString = replacedString; - } - - public String getReplacedString(){ - return replacedString; - } - - public int[] getFoundPositions(){ - return positions; - } - } // End of FindReplaceResult class -} - - diff --git a/editor.lib2/nbproject/org-netbeans-modules-editor-lib2.sig b/editor.lib2/nbproject/org-netbeans-modules-editor-lib2.sig deleted file mode 100644 --- a/editor.lib2/nbproject/org-netbeans-modules-editor-lib2.sig +++ /dev/null @@ -1,336 +0,0 @@ -#Signature file v4.1 -#Version 1.61.1 - -CLSS public abstract interface java.io.Serializable - -CLSS public java.lang.Object -cons public init() -meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException -meth protected void finalize() throws java.lang.Throwable -meth public boolean equals(java.lang.Object) -meth public final java.lang.Class getClass() -meth public final void notify() -meth public final void notifyAll() -meth public final void wait() throws java.lang.InterruptedException -meth public final void wait(long) throws java.lang.InterruptedException -meth public final void wait(long,int) throws java.lang.InterruptedException -meth public int hashCode() -meth public java.lang.String toString() - -CLSS public abstract interface java.lang.annotation.Annotation -meth public abstract boolean equals(java.lang.Object) -meth public abstract int hashCode() -meth public abstract java.lang.Class annotationType() -meth public abstract java.lang.String toString() - -CLSS public abstract interface !annotation java.lang.annotation.Documented - anno 0 java.lang.annotation.Documented() - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE]) -intf java.lang.annotation.Annotation - -CLSS public abstract interface !annotation java.lang.annotation.Retention - anno 0 java.lang.annotation.Documented() - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE]) -intf java.lang.annotation.Annotation -meth public abstract java.lang.annotation.RetentionPolicy value() - -CLSS public abstract interface !annotation java.lang.annotation.Target - anno 0 java.lang.annotation.Documented() - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE]) -intf java.lang.annotation.Annotation -meth public abstract java.lang.annotation.ElementType[] value() - -CLSS public abstract interface java.util.EventListener - -CLSS public java.util.EventObject -cons public init(java.lang.Object) -fld protected java.lang.Object source -intf java.io.Serializable -meth public java.lang.Object getSource() -meth public java.lang.String toString() -supr java.lang.Object -hfds serialVersionUID - -CLSS public final org.netbeans.api.editor.DialogBinding -cons public init() -meth public static void bindComponentToDocument(javax.swing.text.Document,int,int,int,javax.swing.text.JTextComponent) -meth public static void bindComponentToDocument(javax.swing.text.Document,int,int,javax.swing.text.JTextComponent) -meth public static void bindComponentToFile(org.openide.filesystems.FileObject,int,int,int,javax.swing.text.JTextComponent) -meth public static void bindComponentToFile(org.openide.filesystems.FileObject,int,int,javax.swing.text.JTextComponent) -supr java.lang.Object -hfds LOG - -CLSS public final org.netbeans.api.editor.EditorActionNames -fld public final static java.lang.String gotoDeclaration = "goto-declaration" -fld public final static java.lang.String moveCodeElementDown = "move-code-element-down" -fld public final static java.lang.String moveCodeElementUp = "move-code-element-up" -fld public final static java.lang.String removeSurroundingCode = "remove-surrounding-code" -fld public final static java.lang.String toggleLineNumbers = "toggle-line-numbers" -fld public final static java.lang.String toggleNonPrintableCharacters = "toggle-non-printable-characters" -fld public final static java.lang.String toggleRectangularSelection = "toggle-rectangular-selection" -fld public final static java.lang.String toggleToolbar = "toggle-toolbar" -fld public final static java.lang.String transposeLetters = "transpose-letters" -fld public final static java.lang.String zoomTextIn = "zoom-text-in" -fld public final static java.lang.String zoomTextOut = "zoom-text-out" -supr java.lang.Object - -CLSS public abstract interface !annotation org.netbeans.api.editor.EditorActionRegistration - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE) - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE, METHOD]) -intf java.lang.annotation.Annotation -meth public abstract !hasdefault int menuPosition() -meth public abstract !hasdefault int popupPosition() -meth public abstract !hasdefault int toolBarPosition() -meth public abstract !hasdefault int weight() -meth public abstract !hasdefault java.lang.String iconResource() -meth public abstract !hasdefault java.lang.String menuPath() -meth public abstract !hasdefault java.lang.String menuText() -meth public abstract !hasdefault java.lang.String mimeType() -meth public abstract !hasdefault java.lang.String popupPath() -meth public abstract !hasdefault java.lang.String popupText() -meth public abstract !hasdefault java.lang.String preferencesKey() -meth public abstract !hasdefault java.lang.String shortDescription() -meth public abstract java.lang.String name() - -CLSS public abstract interface !annotation org.netbeans.api.editor.EditorActionRegistrations - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE) - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE, METHOD]) -intf java.lang.annotation.Annotation -meth public abstract org.netbeans.api.editor.EditorActionRegistration[] value() - -CLSS public final org.netbeans.api.editor.EditorRegistry -fld public final static java.lang.String COMPONENT_REMOVED_PROPERTY = "componentRemoved" -fld public final static java.lang.String FOCUSED_DOCUMENT_PROPERTY = "focusedDocument" -fld public final static java.lang.String FOCUS_GAINED_PROPERTY = "focusGained" -fld public final static java.lang.String FOCUS_LOST_PROPERTY = "focusLost" -fld public final static java.lang.String LAST_FOCUSED_REMOVED_PROPERTY = "lastFocusedRemoved" -meth public static java.util.List componentList() -meth public static javax.swing.text.JTextComponent focusedComponent() -meth public static javax.swing.text.JTextComponent lastFocusedComponent() -meth public static void addPropertyChangeListener(java.beans.PropertyChangeListener) -meth public static void removePropertyChangeListener(java.beans.PropertyChangeListener) -supr java.lang.Object -hfds LOG,USED_BY_CLONEABLE_EDITOR_PROPERTY,ignoredAncestorClass,items,pcs -hcls AncestorL,CloneableEditorUsageL,FocusL,Item,PackageAccessor,PropertyDocL - -CLSS public final org.netbeans.api.editor.EditorUtilities -meth public static javax.swing.Action getAction(javax.swing.text.EditorKit,java.lang.String) -supr java.lang.Object - -CLSS public final org.netbeans.api.editor.document.EditorDocumentUtils -meth public static void runExclusive(javax.swing.text.Document,java.lang.Runnable) -supr java.lang.Object - -CLSS public abstract interface org.netbeans.spi.editor.codegen.CodeGenerator -innr public abstract interface static Factory -meth public abstract java.lang.String getDisplayName() -meth public abstract void invoke() - -CLSS public abstract interface static org.netbeans.spi.editor.codegen.CodeGenerator$Factory - outer org.netbeans.spi.editor.codegen.CodeGenerator - anno 0 org.netbeans.spi.editor.mimelookup.MimeLocation(java.lang.Class instanceProviderClass=class org.netbeans.spi.editor.mimelookup.InstanceProvider, java.lang.String subfolderName="CodeGenerators") -meth public abstract java.util.List create(org.openide.util.Lookup) - -CLSS public abstract interface org.netbeans.spi.editor.codegen.CodeGeneratorContextProvider - anno 0 org.netbeans.spi.editor.mimelookup.MimeLocation(java.lang.Class instanceProviderClass=class org.netbeans.spi.editor.mimelookup.InstanceProvider, java.lang.String subfolderName="CodeGeneratorContextProviders") -innr public abstract interface static Task -meth public abstract void runTaskWithinContext(org.openide.util.Lookup,org.netbeans.spi.editor.codegen.CodeGeneratorContextProvider$Task) - -CLSS public abstract interface static org.netbeans.spi.editor.codegen.CodeGeneratorContextProvider$Task - outer org.netbeans.spi.editor.codegen.CodeGeneratorContextProvider -meth public abstract void run(org.openide.util.Lookup) - -CLSS public abstract interface org.netbeans.spi.editor.document.UndoableEditWrapper -meth public abstract javax.swing.undo.UndoableEdit wrap(javax.swing.undo.UndoableEdit,javax.swing.text.Document) - anno 0 org.netbeans.api.annotations.common.NonNull() - anno 1 org.netbeans.api.annotations.common.NonNull() - anno 2 org.netbeans.api.annotations.common.NonNull() - -CLSS public abstract interface org.netbeans.spi.editor.highlighting.HighlightAttributeValue<%0 extends java.lang.Object> -meth public abstract {org.netbeans.spi.editor.highlighting.HighlightAttributeValue%0} getValue(javax.swing.text.JTextComponent,javax.swing.text.Document,java.lang.Object,int,int) - -CLSS public final org.netbeans.spi.editor.highlighting.HighlightsChangeEvent -cons public init(org.netbeans.spi.editor.highlighting.HighlightsContainer,int,int) -meth public int getEndOffset() -meth public int getStartOffset() -supr java.util.EventObject -hfds endOffset,startOffset - -CLSS public abstract interface org.netbeans.spi.editor.highlighting.HighlightsChangeListener -intf java.util.EventListener -meth public abstract void highlightChanged(org.netbeans.spi.editor.highlighting.HighlightsChangeEvent) - -CLSS public abstract interface org.netbeans.spi.editor.highlighting.HighlightsContainer -fld public final static java.lang.String ATTR_EXTENDS_EMPTY_LINE = "org.netbeans.spi.editor.highlighting.HighlightsContainer.ATTR_EXTENDS_EMPTY_LINE" -fld public final static java.lang.String ATTR_EXTENDS_EOL = "org.netbeans.spi.editor.highlighting.HighlightsContainer.ATTR_EXTENDS_EOL" -meth public abstract org.netbeans.spi.editor.highlighting.HighlightsSequence getHighlights(int,int) -meth public abstract void addHighlightsChangeListener(org.netbeans.spi.editor.highlighting.HighlightsChangeListener) -meth public abstract void removeHighlightsChangeListener(org.netbeans.spi.editor.highlighting.HighlightsChangeListener) - -CLSS public final org.netbeans.spi.editor.highlighting.HighlightsLayer -meth public java.lang.String toString() -meth public static org.netbeans.spi.editor.highlighting.HighlightsLayer create(java.lang.String,org.netbeans.spi.editor.highlighting.ZOrder,boolean,org.netbeans.spi.editor.highlighting.HighlightsContainer) -supr java.lang.Object -hfds accessor,container,fixedSize,layerTypeId,zOrder -hcls PackageAccessor - -CLSS public abstract interface org.netbeans.spi.editor.highlighting.HighlightsLayerFactory -innr public final static Context -meth public abstract org.netbeans.spi.editor.highlighting.HighlightsLayer[] createLayers(org.netbeans.spi.editor.highlighting.HighlightsLayerFactory$Context) - -CLSS public final static org.netbeans.spi.editor.highlighting.HighlightsLayerFactory$Context - outer org.netbeans.spi.editor.highlighting.HighlightsLayerFactory -meth public javax.swing.text.Document getDocument() -meth public javax.swing.text.JTextComponent getComponent() -supr java.lang.Object -hfds component,document - -CLSS public abstract interface org.netbeans.spi.editor.highlighting.HighlightsSequence -fld public final static org.netbeans.spi.editor.highlighting.HighlightsSequence EMPTY -meth public abstract boolean moveNext() -meth public abstract int getEndOffset() -meth public abstract int getStartOffset() -meth public abstract javax.swing.text.AttributeSet getAttributes() - -CLSS public final org.netbeans.spi.editor.highlighting.ZOrder -fld public final static org.netbeans.spi.editor.highlighting.ZOrder BOTTOM_RACK -fld public final static org.netbeans.spi.editor.highlighting.ZOrder CARET_RACK -fld public final static org.netbeans.spi.editor.highlighting.ZOrder DEFAULT_RACK -fld public final static org.netbeans.spi.editor.highlighting.ZOrder SHOW_OFF_RACK -fld public final static org.netbeans.spi.editor.highlighting.ZOrder SYNTAX_RACK -fld public final static org.netbeans.spi.editor.highlighting.ZOrder TOP_RACK -meth public java.lang.String toString() -meth public org.netbeans.spi.editor.highlighting.ZOrder forPosition(int) -supr java.lang.Object -hfds COMPARATOR,LOG,position,rack - -CLSS public abstract org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer -cons protected init() -intf org.netbeans.spi.editor.highlighting.HighlightsContainer -meth protected final void fireHighlightsChange(int,int) -meth public abstract org.netbeans.spi.editor.highlighting.HighlightsSequence getHighlights(int,int) -meth public final void addHighlightsChangeListener(org.netbeans.spi.editor.highlighting.HighlightsChangeListener) -meth public final void removeHighlightsChangeListener(org.netbeans.spi.editor.highlighting.HighlightsChangeListener) -supr java.lang.Object -hfds listeners - -CLSS public final org.netbeans.spi.editor.highlighting.support.OffsetsBag -cons public init(javax.swing.text.Document) -cons public init(javax.swing.text.Document,boolean) -meth public org.netbeans.spi.editor.highlighting.HighlightsSequence getHighlights(int,int) -meth public void addAllHighlights(org.netbeans.spi.editor.highlighting.HighlightsSequence) -meth public void addHighlight(int,int,javax.swing.text.AttributeSet) -meth public void clear() -meth public void discard() -meth public void removeHighlights(int,int,boolean) -meth public void setHighlights(org.netbeans.spi.editor.highlighting.HighlightsSequence) -meth public void setHighlights(org.netbeans.spi.editor.highlighting.support.OffsetsBag) -supr org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer -hfds LOG,discardCaller,discardThreadId,docListener,document,lastAddIndex,lastMoveNextIndex,marks,mergeHighlights,version -hcls DocL,Mark,Seq - -CLSS public final org.netbeans.spi.editor.highlighting.support.PositionsBag -cons public init(javax.swing.text.Document) -cons public init(javax.swing.text.Document,boolean) -meth public org.netbeans.spi.editor.highlighting.HighlightsSequence getHighlights(int,int) -meth public void addAllHighlights(org.netbeans.spi.editor.highlighting.support.PositionsBag) -meth public void addHighlight(javax.swing.text.Position,javax.swing.text.Position,javax.swing.text.AttributeSet) -meth public void clear() -meth public void removeHighlights(int,int) -meth public void removeHighlights(javax.swing.text.Position,javax.swing.text.Position,boolean) -meth public void setHighlights(org.netbeans.spi.editor.highlighting.support.PositionsBag) -supr org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer -hfds LOG,attributes,document,marks,mergeHighlights,version -hcls Seq - -CLSS public abstract interface !annotation org.netbeans.spi.editor.mimelookup.MimeLocation - anno 0 java.lang.annotation.Documented() - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE]) -intf java.lang.annotation.Annotation -meth public abstract !hasdefault java.lang.Class instanceProviderClass() -meth public abstract java.lang.String subfolderName() - -CLSS public abstract interface org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor -innr public abstract interface static Factory -innr public final static Context -meth public abstract boolean beforeRemove(org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor$Context) throws javax.swing.text.BadLocationException -meth public abstract void afterRemove(org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor$Context) throws javax.swing.text.BadLocationException -meth public abstract void cancelled(org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor$Context) -meth public abstract void remove(org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor$Context) throws javax.swing.text.BadLocationException - -CLSS public final static org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor$Context - outer org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor -meth public boolean isBackwardDelete() -meth public int getOffset() -meth public java.lang.String getText() -meth public javax.swing.text.Document getDocument() -meth public javax.swing.text.JTextComponent getComponent() -supr java.lang.Object -hfds backwardDelete,component,document,offset,removedText - -CLSS public abstract interface static org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor$Factory - outer org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor -meth public abstract org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor createDeletedTextInterceptor(org.netbeans.api.editor.mimelookup.MimePath) - -CLSS public abstract interface org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor -innr public abstract interface static Factory -innr public final static MutableContext -innr public static Context -meth public abstract boolean beforeInsert(org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor$Context) throws javax.swing.text.BadLocationException -meth public abstract void afterInsert(org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor$Context) throws javax.swing.text.BadLocationException -meth public abstract void cancelled(org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor$Context) -meth public abstract void insert(org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor$MutableContext) throws javax.swing.text.BadLocationException - -CLSS public static org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor$Context - outer org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor -meth public int getBreakInsertOffset() -meth public int getCaretOffset() -meth public javax.swing.text.Document getDocument() -meth public javax.swing.text.JTextComponent getComponent() -supr java.lang.Object -hfds breakInsertOffset,caretOffset,component,document - -CLSS public abstract interface static org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor$Factory - outer org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor -meth public abstract org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor createTypedBreakInterceptor(org.netbeans.api.editor.mimelookup.MimePath) - -CLSS public final static org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor$MutableContext - outer org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor -meth public !varargs void setText(java.lang.String,int,int,int[]) -supr org.netbeans.spi.editor.typinghooks.TypedBreakInterceptor$Context -hfds breakInsertPosition,caretPosition,insertionText,reindentBlocks - -CLSS public abstract interface org.netbeans.spi.editor.typinghooks.TypedTextInterceptor -innr public abstract interface static Factory -innr public final static MutableContext -innr public static Context -meth public abstract boolean beforeInsert(org.netbeans.spi.editor.typinghooks.TypedTextInterceptor$Context) throws javax.swing.text.BadLocationException -meth public abstract void afterInsert(org.netbeans.spi.editor.typinghooks.TypedTextInterceptor$Context) throws javax.swing.text.BadLocationException -meth public abstract void cancelled(org.netbeans.spi.editor.typinghooks.TypedTextInterceptor$Context) -meth public abstract void insert(org.netbeans.spi.editor.typinghooks.TypedTextInterceptor$MutableContext) throws javax.swing.text.BadLocationException - -CLSS public static org.netbeans.spi.editor.typinghooks.TypedTextInterceptor$Context - outer org.netbeans.spi.editor.typinghooks.TypedTextInterceptor -meth public int getOffset() -meth public java.lang.String getText() -meth public javax.swing.text.Document getDocument() -meth public javax.swing.text.JTextComponent getComponent() -supr java.lang.Object -hfds component,document,offset,originallyTypedText - -CLSS public abstract interface static org.netbeans.spi.editor.typinghooks.TypedTextInterceptor$Factory - outer org.netbeans.spi.editor.typinghooks.TypedTextInterceptor -meth public abstract org.netbeans.spi.editor.typinghooks.TypedTextInterceptor createTypedTextInterceptor(org.netbeans.api.editor.mimelookup.MimePath) - -CLSS public final static org.netbeans.spi.editor.typinghooks.TypedTextInterceptor$MutableContext - outer org.netbeans.spi.editor.typinghooks.TypedTextInterceptor -meth public java.lang.String getText() -meth public void setText(java.lang.String,int) -supr org.netbeans.spi.editor.typinghooks.TypedTextInterceptor$Context -hfds caretPosition,insertionText -hcls Accessor - diff --git a/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/BlockHighlighting.java b/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/BlockHighlighting.java --- a/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/BlockHighlighting.java +++ b/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/BlockHighlighting.java @@ -55,7 +55,6 @@ import org.netbeans.api.editor.mimelookup.MimeLookup; import org.netbeans.api.editor.settings.AttributesUtilities; import org.netbeans.api.editor.settings.FontColorSettings; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport; import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; import org.netbeans.spi.editor.highlighting.HighlightsChangeListener; import org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer; @@ -83,7 +82,6 @@ this.bag = new PositionsBag(document); this.bag.addHighlightsChangeListener(this); - EditorFindSupport.getInstance().hookLayer(this, component); } public String getLayerTypeId() { diff --git a/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/Factory.java b/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/Factory.java --- a/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/Factory.java +++ b/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/Factory.java @@ -85,20 +85,6 @@ ); layers.add(HighlightsLayer.create( - BLOCK_SEARCH_LAYER, - ZOrder.SHOW_OFF_RACK.forPosition(100), - true, - new BlockHighlighting(BLOCK_SEARCH_LAYER, context.getComponent())) - ); - - layers.add(HighlightsLayer.create( - TextSearchHighlighting.LAYER_TYPE_ID, - ZOrder.SHOW_OFF_RACK.forPosition(200), - true, - new TextSearchHighlighting(context.getComponent())) - ); - - layers.add(HighlightsLayer.create( INC_SEARCH_LAYER, ZOrder.SHOW_OFF_RACK.forPosition(300), true, diff --git a/editor.lib2/src/org/netbeans/modules/editor/lib2/search/Bundle.properties b/editor.lib2/src/org/netbeans/modules/editor/lib2/search/Bundle.properties deleted file mode 100644 --- a/editor.lib2/src/org/netbeans/modules/editor/lib2/search/Bundle.properties +++ /dev/null @@ -1,100 +0,0 @@ -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. -# -# Oracle and Java are registered trademarks of Oracle and/or its affiliates. -# Other names may be trademarks of their respective owners. -# -# The contents of this file are subject to the terms of either the GNU -# General Public License Version 2 only ("GPL") or the Common -# Development and Distribution License("CDDL") (collectively, the -# "License"). You may not use this file except in compliance with the -# License. You can obtain a copy of the License at -# http://www.netbeans.org/cddl-gplv2.html -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the -# specific language governing permissions and limitations under the -# License. When distributing the software, include this License Header -# Notice in each file and include the License file at -# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the GPL Version 2 section of the License file that -# accompanied this code. If applicable, add the following below the -# License Header, with the fields enclosed by brackets [] replaced by -# your own identifying information: -# "Portions Copyrighted [year] [name of copyright owner]" -# -# Contributor(s): -# -# The Original Software is NetBeans. The Initial Developer of the Original -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun -# Microsystems, Inc. All Rights Reserved. -# -# If you wish your version of this file to be governed by only the CDDL -# or only the GPL Version 2, indicate your decision by adding -# "[Contributor] elects to include this software in this distribution -# under the [CDDL or GPL Version 2] license." If you do not indicate a -# single choice of license, a recipient has the option to distribute -# your version of this file under either the CDDL, the GPL Version 2 or -# to extend the choice of license to its licensees as provided above. -# However, if you add GPL Version 2 code and therefore, elected the GPL -# Version 2 license, then the option applies only if the new code is -# made subject to such option by the copyright holder. - - -#FindSupport related stuff -find-found=''{0}'' found at {1} -find-not-found=''{0}'' not found -find-wrap-start=End of the document reached. Continuing search from beginning. -find-wrap-end=Beginning of the document reached. Continuing search from end. -find-block-wrap-start=End of the selection reached. Continuing search from beginning. -find-block-wrap-end=Beginning of the selection reached. Continuing search from end. -find-items-replaced={0} of {1} items replaced -pattern-error-dialog-title=Regular Expression Error -pattern-error-dialog-content=Regular Expression Pattern Syntax Error: -pattern-error-missing-escape-hint=Hint: The $ character has to be escaped (\\$) when it is not followed by a numeric character in a regular expression. - -#FindDialogPanel -find-what=Find What: -find-what-mnemonic=F -ACSD_find-what= -find-replace-with=Replace With: -find-replace-with-mnemonic=l -ACSD_find-replace-with= -find-highlight-search=\ Highligh&t Results -find-highlight-search-tooltip=Highlights all occurrences of the searched text. -find-inc-search=\ &Incremental Search -find-inc-search-tooltip=Tries to find text as you type. -find-match-case=\ &Match Case -find-match-case-tooltip=Search the document only for text with the same capitalization. -find-smart-case=\ Smart Case -find-smart-case-mnemonic=S -find-smart-case-tooltip=Matches case if at least one character in the searched text is uppercase. -find-preserve-case=\ Preser&ve Case when Replacing -find-preserve-case-tooltip=Preserve case according to found instance of word. -find-whole-words=\ &Whole Words -find-whole-words-tooltip=Matches the searched text only to whole words in the document. -find-backward-search=\ Search &Backwards -find-backward-search-tooltip=Searches backwards from the current cursor position. -find-wrap-search=\ Wra&p Around -find-wrap-search-tooltip=Continues search from the beginning if end of the document is reached. -find-reg-exp=\ Regular &Expressions -find-reg-exp-tooltip=Uses regular expressions to search the document. -find-block-search=\ Sear&ch Selection -find-block-search-tooltip=Searches for occurrences in a selected block of text only. -ACSD_find= - -#FindDialogSupport -find-title=Find -replace-title=Replace -find-button-find=Find -find-button-find-mnemonic=D -find-button-replace=Replace -find-button-replace-mnemonic=R -find-button-replace-all=Replace All -find-button-replace-all-mnemonic=A -find-button-cancel=Close -ACSD_find-button-find= -ACSD_find-button-replace= -ACSD_find-button-replace-all= -ACSD_find-button-cancel= - diff --git a/editor.search/nbproject/project.properties b/editor.search/nbproject/project.properties --- a/editor.search/nbproject/project.properties +++ b/editor.search/nbproject/project.properties @@ -1,3 +1,3 @@ javac.source=1.6 javac.compilerargs=-Xlint -Xlint:-serial -spec.version.base=1.11.0 +spec.version.base=1.12.0 diff --git a/editor.search/nbproject/project.xml b/editor.search/nbproject/project.xml --- a/editor.search/nbproject/project.xml +++ b/editor.search/nbproject/project.xml @@ -37,7 +37,7 @@ 3 - 3.30.0 + 3.35.0 @@ -93,6 +93,14 @@ + org.openide.dialogs + + + + 7.29 + + + org.openide.filesystems diff --git a/editor.search/src/org/netbeans/modules/editor/search/Bundle.properties b/editor.search/src/org/netbeans/modules/editor/search/Bundle.properties --- a/editor.search/src/org/netbeans/modules/editor/search/Bundle.properties +++ b/editor.search/src/org/netbeans/modules/editor/search/Bundle.properties @@ -28,3 +28,15 @@ CTL_PreserveCase=Preser&ve Case TOOLTIP_PreserveCase=Preserve case according to found instance of word. (Auto -> Car, auto -> car, AUTO -> CAR) CTL_BackwardsReplace=Replace &Backwards + +#FindSupport related stuff +find-found=''{0}'' found at {1} +find-not-found=''{0}'' not found +find-wrap-start=End of the document reached. Continuing search from beginning. +find-wrap-end=Beginning of the document reached. Continuing search from end. +find-block-wrap-start=End of the selection reached. Continuing search from beginning. +find-block-wrap-end=Beginning of the selection reached. Continuing search from end. +find-items-replaced={0} of {1} items replaced +pattern-error-dialog-title=Regular Expression Error +pattern-error-dialog-content=Regular Expression Pattern Syntax Error: +pattern-error-missing-escape-hint=Hint: The $ character has to be escaped (\\$) when it is not followed by a numeric character in a regular expression. diff --git a/editor.lib2/src/org/netbeans/modules/editor/lib2/search/DocumentFinder.java b/editor.search/src/org/netbeans/modules/editor/search/DocumentFinder.java rename from editor.lib2/src/org/netbeans/modules/editor/lib2/search/DocumentFinder.java rename to editor.search/src/org/netbeans/modules/editor/search/DocumentFinder.java --- a/editor.lib2/src/org/netbeans/modules/editor/lib2/search/DocumentFinder.java +++ b/editor.search/src/org/netbeans/modules/editor/search/DocumentFinder.java @@ -42,7 +42,7 @@ * made subject to such option by the copyright holder. */ -package org.netbeans.modules.editor.lib2.search; +package org.netbeans.modules.editor.search; import java.util.Map; import java.util.MissingResourceException; diff --git a/editor.lib2/src/org/netbeans/modules/editor/lib2/search/EditorFindSupport.java b/editor.search/src/org/netbeans/modules/editor/search/EditorFindSupport.java rename from editor.lib2/src/org/netbeans/modules/editor/lib2/search/EditorFindSupport.java rename to editor.search/src/org/netbeans/modules/editor/search/EditorFindSupport.java --- a/editor.lib2/src/org/netbeans/modules/editor/lib2/search/EditorFindSupport.java +++ b/editor.search/src/org/netbeans/modules/editor/search/EditorFindSupport.java @@ -42,7 +42,7 @@ * made subject to such option by the copyright holder. */ -package org.netbeans.modules.editor.lib2.search; +package org.netbeans.modules.editor.search; import java.awt.Insets; import java.awt.Rectangle; @@ -73,7 +73,7 @@ import org.netbeans.modules.editor.lib2.DocUtils; import org.netbeans.modules.editor.lib2.highlighting.BlockHighlighting; import org.netbeans.modules.editor.lib2.highlighting.Factory; -import org.netbeans.modules.editor.lib2.search.DocumentFinder.FindReplaceResult; +import org.netbeans.modules.editor.search.DocumentFinder.FindReplaceResult; import org.openide.util.NbBundle; /** diff --git a/editor.search/src/org/netbeans/modules/editor/search/ReplaceBar.java b/editor.search/src/org/netbeans/modules/editor/search/ReplaceBar.java --- a/editor.search/src/org/netbeans/modules/editor/search/ReplaceBar.java +++ b/editor.search/src/org/netbeans/modules/editor/search/ReplaceBar.java @@ -51,7 +51,6 @@ import javax.swing.text.BadLocationException; import javax.swing.text.JTextComponent; import org.netbeans.editor.GuardedException; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport; import org.openide.awt.Mnemonics; import org.openide.util.NbBundle; diff --git a/editor.search/src/org/netbeans/modules/editor/search/SearchBar.java b/editor.search/src/org/netbeans/modules/editor/search/SearchBar.java --- a/editor.search/src/org/netbeans/modules/editor/search/SearchBar.java +++ b/editor.search/src/org/netbeans/modules/editor/search/SearchBar.java @@ -72,7 +72,6 @@ import org.netbeans.editor.BaseDocument; import org.netbeans.editor.BaseKit; import org.netbeans.editor.MultiKeymap; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport; import org.netbeans.modules.editor.search.SearchPropertiesSupport.SearchProperties; import org.openide.awt.CloseButtonFactory; import org.openide.awt.Mnemonics; @@ -185,7 +184,7 @@ leftSeparator.setOrientation(SwingConstants.VERTICAL); add(leftSeparator); - findPreviousButton = createFindButton("org/netbeans/modules/editor/resources/find_previous.png", "CTL_FindPrevious"); // NOI18N + findPreviousButton = createFindButton("org/netbeans/modules/editor/search/resources/find_previous.png", "CTL_FindPrevious"); // NOI18N findPreviousButton.addActionListener(new ActionListener() { @Override @@ -194,7 +193,7 @@ } }); add(findPreviousButton); - findNextButton = createFindButton("org/netbeans/modules/editor/resources/find_next.png", "CTL_FindNext"); // NOI18N + findNextButton = createFindButton("org/netbeans/modules/editor/search/resources/find_next.png", "CTL_FindNext"); // NOI18N findNextButton.addActionListener(new ActionListener() { @Override diff --git a/editor.search/src/org/netbeans/modules/editor/search/SearchNbEditorKit.java b/editor.search/src/org/netbeans/modules/editor/search/SearchNbEditorKit.java --- a/editor.search/src/org/netbeans/modules/editor/search/SearchNbEditorKit.java +++ b/editor.search/src/org/netbeans/modules/editor/search/SearchNbEditorKit.java @@ -43,8 +43,10 @@ import java.awt.Component; import java.awt.Container; +import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import javax.swing.Action; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JPanel; @@ -52,6 +54,7 @@ import javax.swing.text.JTextComponent; import org.netbeans.api.editor.EditorRegistry; import org.netbeans.api.editor.mimelookup.MimeRegistration; +import org.netbeans.editor.BaseKit; import org.netbeans.editor.EditorUI; import org.netbeans.editor.SideBarFactory; import org.netbeans.editor.ext.ExtKit; @@ -151,4 +154,16 @@ EditorRegistry.addPropertyChangeListener(searchAndReplaceBarPersistentListener); } } + + public static void openFindIfNecessary(EditorUI eui, ActionEvent evt) { + Object findWhat = EditorFindSupport.getInstance().getFindProperty(EditorFindSupport.FIND_WHAT); + if (findWhat == null || !(findWhat instanceof String) || ((String) findWhat).isEmpty()) { + + Action findAction = ((BaseKit) eui.getComponent().getUI().getEditorKit( + eui.getComponent())).getActionByName("find"); + if (findAction != null) { + findAction.actionPerformed(evt); + } + } + } } diff --git a/editor.search/src/org/netbeans/modules/editor/search/SearchPropertiesSupport.java b/editor.search/src/org/netbeans/modules/editor/search/SearchPropertiesSupport.java --- a/editor.search/src/org/netbeans/modules/editor/search/SearchPropertiesSupport.java +++ b/editor.search/src/org/netbeans/modules/editor/search/SearchPropertiesSupport.java @@ -45,7 +45,6 @@ import java.util.List; import java.util.Map; import java.util.prefs.Preferences; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport; import org.openide.util.NbPreferences; public final class SearchPropertiesSupport { diff --git a/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/TextSearchHighlighting.java b/editor.search/src/org/netbeans/modules/editor/search/TextSearchHighlighting.java rename from editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/TextSearchHighlighting.java rename to editor.search/src/org/netbeans/modules/editor/search/TextSearchHighlighting.java --- a/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/TextSearchHighlighting.java +++ b/editor.search/src/org/netbeans/modules/editor/search/TextSearchHighlighting.java @@ -42,10 +42,11 @@ * made subject to such option by the copyright holder. */ -package org.netbeans.modules.editor.lib2.highlighting; +package org.netbeans.modules.editor.search; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.event.DocumentEvent; @@ -53,16 +54,23 @@ import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; +import javax.swing.text.EditorKit; import javax.swing.text.JTextComponent; import javax.swing.text.SimpleAttributeSet; import org.netbeans.api.editor.mimelookup.MimeLookup; import org.netbeans.api.editor.mimelookup.MimePath; +import org.netbeans.api.editor.mimelookup.MimeRegistration; import org.netbeans.api.editor.settings.FontColorNames; import org.netbeans.api.editor.settings.FontColorSettings; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport; +import org.netbeans.modules.editor.lib2.highlighting.BlockHighlighting; +import static org.netbeans.modules.editor.lib2.highlighting.Factory.BLOCK_SEARCH_LAYER; +import static org.netbeans.modules.editor.lib2.highlighting.Factory.INC_SEARCH_LAYER; import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; import org.netbeans.spi.editor.highlighting.HighlightsChangeListener; +import org.netbeans.spi.editor.highlighting.HighlightsLayer; +import org.netbeans.spi.editor.highlighting.HighlightsLayerFactory; import org.netbeans.spi.editor.highlighting.HighlightsSequence; +import org.netbeans.spi.editor.highlighting.ZOrder; import org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer; import org.netbeans.spi.editor.highlighting.support.OffsetsBag; import org.openide.util.RequestProcessor; @@ -87,7 +95,7 @@ /** Creates a new instance of TextSearchHighlighting */ public TextSearchHighlighting(JTextComponent component) { // Determine the mime type - String mimeType = BlockHighlighting.getMimeType(component); + String mimeType = getMimeType(component); this.mimePath = mimeType == null ? MimePath.EMPTY : MimePath.parse(mimeType); this.component = component; @@ -187,4 +195,52 @@ AttributeSet attribs = fcs.getFontColors(FontColorNames.HIGHLIGHT_SEARCH_COLORING); return attribs == null ? SimpleAttributeSet.EMPTY : attribs; } + + /* package */ static String getMimeType(JTextComponent component) { + Document doc = component.getDocument(); + String mimeType = (String) doc.getProperty("mimeType"); //NOI18N + if (mimeType == null) { + EditorKit kit = component.getUI().getEditorKit(component); + if (kit != null) { + mimeType = kit.getContentType(); + } + } + return mimeType; + } + + @MimeRegistration(mimeType = "", service = HighlightsLayerFactory.class) + public static final class FactoryImpl implements HighlightsLayerFactory { + + public final class SearchBlockHighlighting extends BlockHighlighting { + public SearchBlockHighlighting(String layerId, JTextComponent component) { + super(layerId,component); + EditorFindSupport.getInstance().hookLayer(this, component); + } + } + + @Override + public HighlightsLayer[] createLayers(HighlightsLayerFactory.Context context) { + ArrayList layers = new ArrayList(); + layers.add(HighlightsLayer.create( + TextSearchHighlighting.LAYER_TYPE_ID, + ZOrder.SHOW_OFF_RACK.forPosition(200), + true, + new TextSearchHighlighting(context.getComponent()))); + + layers.add(HighlightsLayer.create( + BLOCK_SEARCH_LAYER, + ZOrder.SHOW_OFF_RACK.forPosition(100), + true, + new SearchBlockHighlighting(BLOCK_SEARCH_LAYER, context.getComponent()))); + + layers.add(HighlightsLayer.create( + INC_SEARCH_LAYER, + ZOrder.SHOW_OFF_RACK.forPosition(300), + true, + new SearchBlockHighlighting(INC_SEARCH_LAYER, context.getComponent()))); + + return layers.toArray(new HighlightsLayer[layers.size()]); + } + + } // End of FactoryImpl class } diff --git a/editor.search/src/org/netbeans/modules/editor/search/actions/Bundle.properties b/editor.search/src/org/netbeans/modules/editor/search/actions/Bundle.properties --- a/editor.search/src/org/netbeans/modules/editor/search/actions/Bundle.properties +++ b/editor.search/src/org/netbeans/modules/editor/search/actions/Bundle.properties @@ -1,4 +1,8 @@ replace=Replace replace_menu_text=R&eplace... find=Find -find_menu_text=&Find... \ No newline at end of file +find_menu_text=&Find... +find-next=Find Next Occurrence +find-previous=Find Previous Occurrence +find-selection=Find Selection +toggle-highlight-search=Toggle Highlight Search \ No newline at end of file diff --git a/editor.search/src/org/netbeans/modules/editor/search/actions/FindNextAction.java b/editor.search/src/org/netbeans/modules/editor/search/actions/FindNextAction.java new file mode 100644 --- /dev/null +++ b/editor.search/src/org/netbeans/modules/editor/search/actions/FindNextAction.java @@ -0,0 +1,76 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2013 Sun Microsystems, Inc. + */ +package org.netbeans.modules.editor.search.actions; + +import java.awt.event.ActionEvent; +import javax.swing.text.JTextComponent; +import org.netbeans.api.editor.EditorActionRegistration; +import org.netbeans.editor.BaseKit; +import org.netbeans.editor.EditorUI; +import org.netbeans.modules.editor.search.EditorFindSupport; +import org.netbeans.modules.editor.search.SearchNbEditorKit; +import org.netbeans.spi.editor.AbstractEditorAction; + +// NOI18N + +@EditorActionRegistration(name = BaseKit.findNextAction, iconResource = "org/netbeans/modules/editor/search/resources/find_next.png") // NOI18N +public class FindNextAction extends AbstractEditorAction { + static final long serialVersionUID = 6878814427731642684L; + + public FindNextAction() { + super(); + } + + @Override + public void actionPerformed(ActionEvent evt, JTextComponent target) { + if (target != null) { + EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(target); + if (eui.getComponent().getClientProperty("AsTextField") == null) { + //NOI18N + EditorFindSupport.getInstance().setFocusedTextComponent(eui.getComponent()); + } + SearchNbEditorKit.openFindIfNecessary(eui, evt); + EditorFindSupport.getInstance().find(null, false); + } + } + +} diff --git a/editor.search/src/org/netbeans/modules/editor/search/actions/FindPreviousAction.java b/editor.search/src/org/netbeans/modules/editor/search/actions/FindPreviousAction.java new file mode 100644 --- /dev/null +++ b/editor.search/src/org/netbeans/modules/editor/search/actions/FindPreviousAction.java @@ -0,0 +1,76 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2013 Sun Microsystems, Inc. + */ +package org.netbeans.modules.editor.search.actions; + +import java.awt.event.ActionEvent; +import javax.swing.text.JTextComponent; +import org.netbeans.api.editor.EditorActionRegistration; +import org.netbeans.editor.BaseKit; +import org.netbeans.editor.EditorUI; +import org.netbeans.modules.editor.search.EditorFindSupport; +import org.netbeans.modules.editor.search.SearchNbEditorKit; +import org.netbeans.spi.editor.AbstractEditorAction; + +// NOI18N + +@EditorActionRegistration(name = BaseKit.findPreviousAction, iconResource = "org/netbeans/modules/editor/search/resources/find_previous.png") // NOI18N +public class FindPreviousAction extends AbstractEditorAction { + static final long serialVersionUID = -43746947902694926L; + + public FindPreviousAction() { + super(); + } + + @Override + public void actionPerformed(ActionEvent evt, JTextComponent target) { + if (target != null) { + EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(target); + if (eui.getComponent().getClientProperty("AsTextField") == null) { + //NOI18N + EditorFindSupport.getInstance().setFocusedTextComponent(eui.getComponent()); + } + SearchNbEditorKit.openFindIfNecessary(eui, evt); + EditorFindSupport.getInstance().find(null, true); + } + } + +} diff --git a/editor.search/src/org/netbeans/modules/editor/search/actions/FindSelectionAction.java b/editor.search/src/org/netbeans/modules/editor/search/actions/FindSelectionAction.java new file mode 100644 --- /dev/null +++ b/editor.search/src/org/netbeans/modules/editor/search/actions/FindSelectionAction.java @@ -0,0 +1,135 @@ +package org.netbeans.modules.editor.search.actions; + +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2013 Sun Microsystems, Inc. + */ + + +import java.awt.event.ActionEvent; +import java.util.HashMap; +import java.util.Map; +import javax.swing.text.BadLocationException; +import javax.swing.text.Caret; +import javax.swing.text.JTextComponent; +import org.netbeans.api.editor.EditorActionRegistration; +import org.netbeans.editor.BaseDocument; +import org.netbeans.editor.BaseKit; +import org.netbeans.editor.EditorUI; +import org.netbeans.editor.Utilities; +import org.netbeans.modules.editor.search.EditorFindSupport; +import org.netbeans.modules.editor.search.SearchNbEditorKit; +import org.netbeans.spi.editor.AbstractEditorAction; + +/** Finds either selection or if there's no selection it finds + * the word where the cursor is standing. + */ +// NOI18N +@EditorActionRegistration(name = BaseKit.findSelectionAction, iconResource = "org/netbeans/modules/editor/search/resources/find_selection.png") // NOI18N +public class FindSelectionAction extends AbstractEditorAction { + static final long serialVersionUID = -5601618936504699565L; + + public FindSelectionAction() { + super(); + } + + @Override + public void actionPerformed(ActionEvent evt, JTextComponent target) { + if (target != null) { + EditorFindSupport findSupport = EditorFindSupport.getInstance(); + Caret caret = target.getCaret(); + int dotPos = caret.getDot(); + HashMap props = new HashMap(findSupport.createDefaultFindProperties()); + String searchWord = null; + boolean revert = false; + Boolean originalValue = null; + Map revertMap = (Map) props.get(EditorFindSupport.REVERT_MAP); + Boolean revertValue = revertMap != null ? (Boolean) revertMap.get(EditorFindSupport.FIND_WHOLE_WORDS) : null; + if (Utilities.isSelectionShowing(caret)) { + // valid selection + searchWord = target.getSelectedText(); + originalValue = (Boolean) props.put(EditorFindSupport.FIND_WHOLE_WORDS, Boolean.FALSE); + if (Boolean.FALSE.equals(revertValue)) { + revertMap.remove(EditorFindSupport.FIND_WHOLE_WORDS); + } else { + revert = !Boolean.FALSE.equals(originalValue); + } + } else { + // no selection, get current word + try { + searchWord = Utilities.getIdentifier((BaseDocument) target.getDocument(), dotPos); + originalValue = (Boolean) props.put(EditorFindSupport.FIND_WHOLE_WORDS, Boolean.TRUE); + if (Boolean.TRUE.equals(revertValue)) { + revertMap.remove(EditorFindSupport.FIND_WHOLE_WORDS); + } else { + revert = !Boolean.TRUE.equals(originalValue); + } + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + if (searchWord != null) { + int n = searchWord.indexOf('\n'); + if (n >= 0) { + searchWord = searchWord.substring(0, n); + } + props.put(EditorFindSupport.FIND_WHAT, searchWord); + if (revert) { + revertMap = new HashMap(); + revertMap.put(EditorFindSupport.FIND_WHOLE_WORDS, originalValue != null ? originalValue : Boolean.FALSE); + props.put(EditorFindSupport.REVERT_MAP, revertMap); + } + props.put(EditorFindSupport.FIND_BLOCK_SEARCH, Boolean.FALSE); + props.put(EditorFindSupport.FIND_BLOCK_SEARCH_START, null); + props.put(EditorFindSupport.FIND_BLOCK_SEARCH_END, null); + EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(target); + if (eui.getComponent().getClientProperty("AsTextField") == null) { + //NOI18N + findSupport.setFocusedTextComponent(eui.getComponent()); + } + findSupport.putFindProperties(props); + if (findSupport.find(null, false)) { + findSupport.addToHistory(new EditorFindSupport.SPW((String) props.get(EditorFindSupport.FIND_WHAT), (Boolean) props.get(EditorFindSupport.FIND_WHOLE_WORDS), (Boolean) props.get(EditorFindSupport.FIND_MATCH_CASE), (Boolean) props.get(EditorFindSupport.FIND_REG_EXP))); + } + } + } + } + +} diff --git a/editor.search/src/org/netbeans/modules/editor/search/actions/ToggleHighlightSearchAction.java b/editor.search/src/org/netbeans/modules/editor/search/actions/ToggleHighlightSearchAction.java new file mode 100644 --- /dev/null +++ b/editor.search/src/org/netbeans/modules/editor/search/actions/ToggleHighlightSearchAction.java @@ -0,0 +1,153 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2013 Sun Microsystems, Inc. + */ +package org.netbeans.modules.editor.search.actions; + +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import javax.swing.ButtonModel; +import javax.swing.JToggleButton; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.text.JTextComponent; +import org.netbeans.api.editor.EditorActionRegistration; +import org.netbeans.editor.BaseKit; +import org.netbeans.modules.editor.search.EditorFindSupport; +import org.netbeans.modules.editor.search.SearchNbEditorKit; +import org.netbeans.spi.editor.AbstractEditorAction; +import org.openide.util.WeakListeners; +import org.openide.util.actions.Presenter; + +// suspending the use of EditorActionRegistration due to #167063 + +// @EditorActionRegistration(name = BaseKit.toggleHighlightSearchAction, +@EditorActionRegistration(name = BaseKit.toggleHighlightSearchAction, iconResource = "org/netbeans/modules/editor/search/resources/toggle_highlight.png") // NOI18N +public class ToggleHighlightSearchAction extends AbstractEditorAction implements Presenter.Toolbar { + static final long serialVersionUID = 4603809175771743200L; + + + public ToggleHighlightSearchAction() { + super(); + putValue("noIconInMenu", Boolean.TRUE); // NOI18N + JToggleButton b = new MyGaGaButton(); + b.setModel(new HighlightButtonModel()); + b.setAction(this); + } + + public void actionPerformed(ActionEvent evt, JTextComponent target) { + if (target != null) { + Boolean cur = (Boolean) EditorFindSupport.getInstance().getFindProperty(EditorFindSupport.FIND_HIGHLIGHT_SEARCH); + if (cur == null || cur.booleanValue() == false) { + cur = Boolean.TRUE; + } else { + cur = Boolean.FALSE; + } + EditorFindSupport.getInstance().putFindProperty(EditorFindSupport.FIND_HIGHLIGHT_SEARCH, cur); + } + } + + public Component getToolbarPresenter() { + JToggleButton b = new MyGaGaButton(); + b.setModel(new HighlightButtonModel()); + b.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N + b.setAction(this); + return b; + } + + private static final class HighlightButtonModel extends JToggleButton.ToggleButtonModel implements PropertyChangeListener { + + public HighlightButtonModel() { + EditorFindSupport efs = EditorFindSupport.getInstance(); + efs.addPropertyChangeListener(WeakListeners.propertyChange(this, efs)); + propertyChange(null); + } + + public void propertyChange(PropertyChangeEvent evt) { + if (evt == null || evt.getPropertyName() == null || evt.getPropertyName().equals(EditorFindSupport.FIND_HIGHLIGHT_SEARCH)) { + Boolean value = (Boolean) EditorFindSupport.getInstance().getFindProperty(EditorFindSupport.FIND_HIGHLIGHT_SEARCH); + setSelected(value == null ? false : value.booleanValue()); + } + } + } // End of HighlightButtonModel class + + private static final class MyGaGaButton extends JToggleButton implements ChangeListener { + + public MyGaGaButton() { + } + + @Override + public void setModel(ButtonModel model) { + ButtonModel oldModel = getModel(); + if (oldModel != null) { + oldModel.removeChangeListener(this); + } + super.setModel(model); + ButtonModel newModel = getModel(); + if (newModel != null) { + newModel.addChangeListener(this); + } + stateChanged(null); + } + + public void stateChanged(ChangeEvent evt) { + boolean selected = isSelected(); + super.setContentAreaFilled(selected); + super.setBorderPainted(selected); + } + + @Override + public void setBorderPainted(boolean arg0) { + if (!isSelected()) { + super.setBorderPainted(arg0); + } + } + + @Override + public void setContentAreaFilled(boolean arg0) { + if (!isSelected()) { + super.setContentAreaFilled(arg0); + } + } + } + +} // End of ToggleHighlightSearchAction class diff --git a/editor.search/src/org/netbeans/modules/editor/search/completion/SearchCompletion.java b/editor.search/src/org/netbeans/modules/editor/search/completion/SearchCompletion.java --- a/editor.search/src/org/netbeans/modules/editor/search/completion/SearchCompletion.java +++ b/editor.search/src/org/netbeans/modules/editor/search/completion/SearchCompletion.java @@ -47,9 +47,9 @@ import javax.swing.text.Document; import javax.swing.text.JTextComponent; import org.netbeans.api.editor.mimelookup.MimeRegistration; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport.RP; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport.SPW; +import org.netbeans.modules.editor.search.EditorFindSupport; +import org.netbeans.modules.editor.search.EditorFindSupport.RP; +import org.netbeans.modules.editor.search.EditorFindSupport.SPW; import org.netbeans.modules.editor.search.SearchBar; import org.netbeans.modules.editor.search.SearchNbEditorKit; import org.netbeans.spi.editor.completion.CompletionProvider; diff --git a/editor.search/src/org/netbeans/modules/editor/search/layer.xml b/editor.search/src/org/netbeans/modules/editor/search/layer.xml --- a/editor.search/src/org/netbeans/modules/editor/search/layer.xml +++ b/editor.search/src/org/netbeans/modules/editor/search/layer.xml @@ -9,5 +9,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/editor/src/org/netbeans/modules/editor/resources/find_next.png b/editor.search/src/org/netbeans/modules/editor/search/resources/find_next.png rename from editor/src/org/netbeans/modules/editor/resources/find_next.png rename to editor.search/src/org/netbeans/modules/editor/search/resources/find_next.png diff --git a/editor/src/org/netbeans/modules/editor/resources/find_previous.png b/editor.search/src/org/netbeans/modules/editor/search/resources/find_previous.png rename from editor/src/org/netbeans/modules/editor/resources/find_previous.png rename to editor.search/src/org/netbeans/modules/editor/search/resources/find_previous.png diff --git a/editor/src/org/netbeans/modules/editor/resources/find_selection.png b/editor.search/src/org/netbeans/modules/editor/search/resources/find_selection.png rename from editor/src/org/netbeans/modules/editor/resources/find_selection.png rename to editor.search/src/org/netbeans/modules/editor/search/resources/find_selection.png diff --git a/editor/src/org/netbeans/modules/editor/resources/toggle_highlight.png b/editor.search/src/org/netbeans/modules/editor/search/resources/toggle_highlight.png rename from editor/src/org/netbeans/modules/editor/resources/toggle_highlight.png rename to editor.search/src/org/netbeans/modules/editor/search/resources/toggle_highlight.png diff --git a/editor.lib2/test/unit/src/org/netbeans/modules/editor/lib2/search/DocumentFinderTest.java b/editor.search/test/unit/src/org/netbeans/modules/editor/search/DocumentFinderTest.java rename from editor.lib2/test/unit/src/org/netbeans/modules/editor/lib2/search/DocumentFinderTest.java rename to editor.search/test/unit/src/org/netbeans/modules/editor/search/DocumentFinderTest.java --- a/editor.lib2/test/unit/src/org/netbeans/modules/editor/lib2/search/DocumentFinderTest.java +++ b/editor.search/test/unit/src/org/netbeans/modules/editor/search/DocumentFinderTest.java @@ -39,8 +39,10 @@ * * Portions Copyrighted 2011 Sun Microsystems, Inc. */ -package org.netbeans.modules.editor.lib2.search; +package org.netbeans.modules.editor.search; +import org.netbeans.modules.editor.search.DocumentFinder; +import org.netbeans.modules.editor.search.EditorFindSupport; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import java.util.HashMap; @@ -48,7 +50,7 @@ import javax.swing.JTextArea; import org.junit.Test; import static org.junit.Assert.*; -import org.netbeans.modules.editor.lib2.search.DocumentFinder.FindReplaceResult; +import org.netbeans.modules.editor.search.DocumentFinder.FindReplaceResult; /** * @author Milutin Kristofic diff --git a/editor.lib2/test/unit/src/org/netbeans/modules/editor/lib2/search/EditorFindSupportTest.java b/editor.search/test/unit/src/org/netbeans/modules/editor/search/EditorFindSupportTest.java rename from editor.lib2/test/unit/src/org/netbeans/modules/editor/lib2/search/EditorFindSupportTest.java rename to editor.search/test/unit/src/org/netbeans/modules/editor/search/EditorFindSupportTest.java --- a/editor.lib2/test/unit/src/org/netbeans/modules/editor/lib2/search/EditorFindSupportTest.java +++ b/editor.search/test/unit/src/org/netbeans/modules/editor/search/EditorFindSupportTest.java @@ -40,8 +40,9 @@ * Portions Copyrighted 2009 Sun Microsystems, Inc. */ -package org.netbeans.modules.editor.lib2.search; +package org.netbeans.modules.editor.search; +import org.netbeans.modules.editor.search.EditorFindSupport; import java.util.HashMap; import java.util.Map; import javax.swing.JTextArea; diff --git a/editor.search/test/unit/src/org/netbeans/modules/editor/search/SearchPropertiesSupportTest.java b/editor.search/test/unit/src/org/netbeans/modules/editor/search/SearchPropertiesSupportTest.java --- a/editor.search/test/unit/src/org/netbeans/modules/editor/search/SearchPropertiesSupportTest.java +++ b/editor.search/test/unit/src/org/netbeans/modules/editor/search/SearchPropertiesSupportTest.java @@ -43,7 +43,6 @@ import org.junit.Test; import static org.junit.Assert.*; -import org.netbeans.modules.editor.lib2.search.EditorFindSupport; import org.netbeans.modules.editor.search.SearchPropertiesSupport.SearchProperties; public class SearchPropertiesSupportTest { diff --git a/editor/src/org/netbeans/modules/editor/resources/layer.xml b/editor/src/org/netbeans/modules/editor/resources/layer.xml --- a/editor/src/org/netbeans/modules/editor/resources/layer.xml +++ b/editor/src/org/netbeans/modules/editor/resources/layer.xml @@ -72,23 +72,6 @@ - - - - - - - - - - - - - - - - - @@ -289,18 +272,6 @@ - - - - - - - - - - - -