|
TextDetail
. The description may be used e.g.
* for a tooltip text of a node.
*
* @param det detailed information about location of a matching string
* @return short description of a visual representation
*/
private static String getShortDesc(TextDetail det) {
int line = det.getLine();
int col = det.getColumn();
if (col > 0) {
/* line TextDetail
. The description may be printed e.g. to
* an OutputWindow.
*
* @param det detailed information about location of a matching string
* @return full description of a visual representation
*/
private static String getFullDesc(TextDetail det) {
String filename = det.getDataObject().getPrimaryFile().getNameExt();
String lineText = det.getLineText();
int line = det.getLine();
int col = det.getColumn();
if (col > 0) {
/* [true
if at least one node is activated and
* the first node is an instance of DetailNode
* (or its subclass), false
otherwise
*/
protected boolean enable(Node[] activatedNodes) {
return activatedNodes != null && activatedNodes.length != 0
&& activatedNodes[0] instanceof DetailNode;
}
/**
* Displays the matching string in a text editor.
* Works only if condition specified in method {@link #enable} is met,
* otherwise does nothing.
*/
protected void performAction(Node[] activatedNodes) {
if (enable(activatedNodes)) {
((DetailNode)activatedNodes[0]).gotoDetail();
}
}
/**
*/
protected boolean asynchronous() {
return false;
}
} // End of GotoDetailAction class.
/** Action on detail node which shows the text occurence. */
private static class ShowDetailAction extends NodeAction {
/** Gets name of the action. Implements superclass abstract method. */
public String getName() {
return NbBundle.getBundle(FullTextType.class).getString("LBL_ShowDetailAction");
}
/** Gets help context fot this action. Implements superclass abstract method. */
public HelpCtx getHelpCtx() {
return new HelpCtx(ShowDetailAction.class);
}
/** Tests wheter this action should be enables on specified activated nodes.
* Implements superclass abstract method. */
protected boolean enable(Node[] activatedNodes) {
if(activatedNodes == null || activatedNodes.length == 0)
return false;
if(activatedNodes[0] instanceof DetailNode)
return true;
return false;
}
/** Performs action on specified activated nodes. Implements superclass
* abstract method. */
protected void performAction(Node[] activatedNodes) {
if(activatedNodes == null || activatedNodes.length == 0)
return;
if(activatedNodes[0] instanceof DetailNode)
((DetailNode)activatedNodes[0]).showDetail();
}
/**
*/
protected boolean asynchronous() {
return false;
}
} // End of ShowDetailAction class.
/** Gets help context for this search type.
* Implements superclass abstract method. */
public HelpCtx getHelpCtx() {
return new HelpCtx(FullTextType.class);
}
}
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.search.types; import java.io.*; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.ResourceBundle; import java.util.regex.Matcher; import org.netbeans.modules.search.SearchDisplayer; import org.openide.filesystems.FileObject; import org.openide.loaders.DataObject; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.nodes.Node; import org.openide.util.actions.NodeAction; import org.openide.util.actions.SystemAction; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.windows.OutputEvent; import org.openide.windows.OutputListener; import org.openide.xml.XMLUtil; /** * Test DataObject primaryFile for line full-text match. * * @author Petr Kuzel * @author Marian Petras */ public class FullTextType extends TextType { private static final long serialVersionUID = 1L; //private static final long serialVersionUID = -8671182156199506714L; /** * Holds information about occurences of matching strings within individual * |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.