as3 script search fix when class filter is applied in tag tree, clear filter if the selected search result is currently not visible

This commit is contained in:
honfika@gmail.com
2016-03-12 14:31:35 +01:00
parent c48356fc08
commit 14ae76a269
3 changed files with 13 additions and 13 deletions

View File

@@ -319,7 +319,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
protected boolean search(ActionEvent evt, Boolean searchInText) {
if (swf != null) {
mainFrame.getPanel().searchInActionScriptOrText(searchInText);
mainFrame.getPanel().searchInActionScriptOrText(searchInText, swf);
return true;
}

View File

@@ -769,7 +769,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
enableDrop(true);
}
private void closeTagTreeSearch() {
public void closeTagTreeSearch() {
filterField.setText("");
doFilter();
searchPanel.setVisible(false);
@@ -1494,11 +1494,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (treePanelMode == TreePanelMode.TAG_TREE) {
TreeItem treeNode = (TreeItem) tagTree.getLastSelectedPathComponent();
if (treeNode == null) {
return swfs.get(0).get(0);
}
if (treeNode instanceof SWFList) {
if (treeNode == null || treeNode instanceof SWFList) {
return null;
}
@@ -1651,7 +1647,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
}
public void searchInActionScriptOrText(Boolean searchInText) {
public void searchInActionScriptOrText(Boolean searchInText, SWF swf) {
SearchDialog searchDialog = new SearchDialog(getMainFrame().getWindow(), false);
if (searchInText != null) {
if (searchInText) {
@@ -1664,7 +1660,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (searchDialog.showDialog() == AppDialog.OK_OPTION) {
final String txt = searchDialog.searchField.getText();
if (!txt.isEmpty()) {
final SWF swf = getCurrentSwf();
if (swf.isAS3()) {
getABCPanel();
} else {
@@ -1681,7 +1676,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
List<ABCPanelSearchResult> abcResult = null;
List<ActionSearchResult> actionResult = null;
if (swf.isAS3()) {
abcResult = getABCPanel().search(txt, ignoreCase, regexp, this);
abcResult = getABCPanel().search(swf, txt, ignoreCase, regexp, this);
} else {
actionResult = getActionPanel().search(txt, ignoreCase, regexp, this);
}

View File

@@ -182,7 +182,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
return mainPanel;
}
public List<ABCPanelSearchResult> search(final String txt, boolean ignoreCase, boolean regexp, CancellableWorker<Void> worker) {
public List<ABCPanelSearchResult> search(final SWF swf, final String txt, boolean ignoreCase, boolean regexp, CancellableWorker<Void> worker) {
List<String> ignoredClasses = new ArrayList<>();
List<String> ignoredNss = new ArrayList<>();
@@ -192,7 +192,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
if (txt != null && !txt.isEmpty()) {
searchPanel.setOptions(ignoreCase, regexp);
TagTreeModel ttm = (TagTreeModel) mainPanel.tagTree.getModel();
TreeItem scriptsNode = ttm.getScriptsNode(mainPanel.getCurrentSwf());
TreeItem scriptsNode = ttm.getScriptsNode(swf);
final List<ABCPanelSearchResult> found = new ArrayList<>();
if (scriptsNode instanceof ClassesListTreeModel) {
ClassesListTreeModel clModel = (ClassesListTreeModel) scriptsNode;
@@ -1088,7 +1088,12 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
public void hilightScript(ScriptPack pack) {
TagTreeModel ttm = (TagTreeModel) mainPanel.tagTree.getModel();
final TreePath tp = ttm.getTreePath(pack);
TreePath tp0 = ttm.getTreePath(pack);
if (tp0 == null) {
mainPanel.closeTagTreeSearch();
tp0 = ttm.getTreePath(pack);
}
final TreePath tp = tp0;
View.execInEventDispatchLater(() -> {
mainPanel.tagTree.setSelectionPath(tp);
mainPanel.tagTree.scrollPathToVisible(tp);