mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Merge branch 'master' of github.com:sleuthkit/autopsy
This commit is contained in:
commit
bdb112bdad
@ -57,7 +57,7 @@ class GetAllFilesContentVisitor extends GetFilesContentVisitor {
|
|||||||
|
|
||||||
String query = "SELECT * FROM tsk_files WHERE fs_obj_id = " + fs.getId()
|
String query = "SELECT * FROM tsk_files WHERE fs_obj_id = " + fs.getId()
|
||||||
+ " AND (meta_type = " + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG.getMetaType()
|
+ " AND (meta_type = " + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG.getMetaType()
|
||||||
+ ") AND (known != " + FileKnown.KNOWN.toLong() + ") AND (size > 0)";
|
+ ") AND (size > 0)";
|
||||||
try {
|
try {
|
||||||
ResultSet rs = sc.runQuery(query);
|
ResultSet rs = sc.runQuery(query);
|
||||||
List<FsContent> contents = sc.resultSetToFsContents(rs);
|
List<FsContent> contents = sc.resultSetToFsContents(rs);
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
|
||||||
import org.sleuthkit.datamodel.File;
|
|
||||||
import org.sleuthkit.datamodel.FileSystem;
|
|
||||||
import org.sleuthkit.datamodel.FsContent;
|
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
|
||||||
import org.sleuthkit.datamodel.TskData;
|
|
||||||
import org.sleuthkit.datamodel.TskData.FileKnown;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Visitor for getting all the files to try to index from any Content object.
|
|
||||||
* Currently gets all non-zero files.
|
|
||||||
* TODO should be moved to utility module (needs resolve cyclic deps)
|
|
||||||
*/
|
|
||||||
class GetAllFilesContentVisitor extends GetFilesContentVisitor {
|
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(GetAllFilesContentVisitor.class.getName());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<FsContent> visit(File file) {
|
|
||||||
return Collections.singleton((FsContent) file);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<FsContent> visit(FileSystem fs) {
|
|
||||||
// Files in the database have a filesystem field, so it's quick to
|
|
||||||
// get all the matching files for an entire filesystem with a query
|
|
||||||
|
|
||||||
SleuthkitCase sc = Case.getCurrentCase().getSleuthkitCase();
|
|
||||||
|
|
||||||
String query = "SELECT * FROM tsk_files WHERE fs_obj_id = " + fs.getId()
|
|
||||||
+ " AND (meta_type = " + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG.getMetaType()
|
|
||||||
+ ") AND (known != " + FileKnown.KNOWN.toLong() + ") AND (size > 0)";
|
|
||||||
try {
|
|
||||||
ResultSet rs = sc.runQuery(query);
|
|
||||||
List<FsContent> contents = sc.resultSetToFsContents(rs);
|
|
||||||
Statement s = rs.getStatement();
|
|
||||||
rs.close();
|
|
||||||
if (s != null) {
|
|
||||||
s.close();
|
|
||||||
}
|
|
||||||
return contents;
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
logger.log(Level.WARNING, "Couldn't get all files in FileSystem", ex);
|
|
||||||
return Collections.EMPTY_SET;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import org.sleuthkit.datamodel.Content;
|
|
||||||
import org.sleuthkit.datamodel.ContentVisitor;
|
|
||||||
import org.sleuthkit.datamodel.Directory;
|
|
||||||
import org.sleuthkit.datamodel.File;
|
|
||||||
import org.sleuthkit.datamodel.FileSystem;
|
|
||||||
import org.sleuthkit.datamodel.FsContent;
|
|
||||||
import org.sleuthkit.datamodel.Image;
|
|
||||||
import org.sleuthkit.datamodel.TskException;
|
|
||||||
import org.sleuthkit.datamodel.Volume;
|
|
||||||
import org.sleuthkit.datamodel.VolumeSystem;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Abstract visitor for getting all the files from content
|
|
||||||
* TODO should be moved to utility module (needs resolve cyclic deps)
|
|
||||||
*/
|
|
||||||
public abstract class GetFilesContentVisitor implements ContentVisitor<Collection<FsContent>> {
|
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(GetFilesContentVisitor.class.getName());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public abstract Collection<FsContent> visit(File file);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public abstract Collection<FsContent> visit(FileSystem fs);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<FsContent> visit(Directory drctr) {
|
|
||||||
return getAllFromChildren(drctr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<FsContent> visit(Image image) {
|
|
||||||
return getAllFromChildren(image);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<FsContent> visit(Volume volume) {
|
|
||||||
return getAllFromChildren(volume);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<FsContent> visit(VolumeSystem vs) {
|
|
||||||
return getAllFromChildren(vs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Aggregate all the matches from visiting the children Content objects of the
|
|
||||||
* one passed
|
|
||||||
* @param parent
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected Collection<FsContent> getAllFromChildren(Content parent) {
|
|
||||||
Collection<FsContent> all = new ArrayList<FsContent>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
for (Content child : parent.getChildren()) {
|
|
||||||
all.addAll(child.accept(this));
|
|
||||||
}
|
|
||||||
} catch (TskException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Error getting Content children", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the part of a file name after (not including) the last '.' and
|
|
||||||
* coerced to lowercase.
|
|
||||||
* @param fileName
|
|
||||||
* @return the file extension, or an empty string if there is none
|
|
||||||
*/
|
|
||||||
protected static String getExtension(String fileName) {
|
|
||||||
int lastDot = fileName.lastIndexOf(".");
|
|
||||||
|
|
||||||
if (lastDot >= 0) {
|
|
||||||
return fileName.substring(lastDot + 1, fileName.length()).toLowerCase();
|
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
|
||||||
import org.sleuthkit.datamodel.File;
|
|
||||||
import org.sleuthkit.datamodel.FileSystem;
|
|
||||||
import org.sleuthkit.datamodel.FsContent;
|
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
|
||||||
import org.sleuthkit.datamodel.TskData.FileKnown;
|
|
||||||
import org.sleuthkit.datamodel.TskData;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Visitor for getting all the files to try to index from any Content object.
|
|
||||||
* Currently gets all the non-zero sized files with a file extensions that match a list of
|
|
||||||
* document types that Tika/Solr-Cell supports.
|
|
||||||
*/
|
|
||||||
class GetIngestableFilesContentVisitor extends GetFilesContentVisitor {
|
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(GetIngestableFilesContentVisitor.class.getName());
|
|
||||||
|
|
||||||
private static final String[] supportedExtensions = KeywordSearchIngestService.ingestibleExtensions;
|
|
||||||
// the full predicate of a SQLite statement to match supported extensions
|
|
||||||
private static final String extensionsLikePredicate;
|
|
||||||
|
|
||||||
static {
|
|
||||||
// build the query fragment for matching file extensions
|
|
||||||
|
|
||||||
StringBuilder likes = new StringBuilder("0");
|
|
||||||
|
|
||||||
for (String ext : supportedExtensions) {
|
|
||||||
likes.append(" OR (name LIKE '%.");
|
|
||||||
likes.append(ext);
|
|
||||||
likes.append("')");
|
|
||||||
}
|
|
||||||
|
|
||||||
extensionsLikePredicate = likes.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<FsContent> visit(File file) {
|
|
||||||
String extension = getExtension(file.getName());
|
|
||||||
if (Arrays.asList(supportedExtensions).contains(extension)) {
|
|
||||||
return Collections.singleton((FsContent) file);
|
|
||||||
} else {
|
|
||||||
return Collections.EMPTY_LIST;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<FsContent> visit(FileSystem fs) {
|
|
||||||
// Files in the database have a filesystem field, so it's quick to
|
|
||||||
// get all the matching files for an entire filesystem with a query
|
|
||||||
|
|
||||||
SleuthkitCase sc = Case.getCurrentCase().getSleuthkitCase();
|
|
||||||
|
|
||||||
String query = "SELECT * FROM tsk_files WHERE fs_obj_id = " + fs.getId()
|
|
||||||
+ " AND (" + extensionsLikePredicate + ")"
|
|
||||||
+ " AND (known != " + FileKnown.KNOWN.toLong() + ")"
|
|
||||||
+ " AND (meta_type = " + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG.getMetaType() + ")"
|
|
||||||
+ " AND (size > 0)";
|
|
||||||
try {
|
|
||||||
ResultSet rs = sc.runQuery(query);
|
|
||||||
List<FsContent> contents = sc.resultSetToFsContents(rs);
|
|
||||||
final Statement s = rs.getStatement();
|
|
||||||
rs.close();
|
|
||||||
if (s != null) {
|
|
||||||
s.close();
|
|
||||||
}
|
|
||||||
return contents;
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
logger.log(Level.WARNING, "Couldn't get all files in FileSystem", ex);
|
|
||||||
return Collections.EMPTY_SET;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,307 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Toolkit;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.WindowAdapter;
|
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import javax.swing.AbstractAction;
|
|
||||||
import javax.swing.JDialog;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.SwingWorker;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
|
||||||
import org.openide.util.lookup.ServiceProvider;
|
|
||||||
import org.sleuthkit.autopsy.casemodule.AddImageAction;
|
|
||||||
import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException;
|
|
||||||
import org.sleuthkit.datamodel.Content;
|
|
||||||
import org.sleuthkit.datamodel.FsContent;
|
|
||||||
import org.sleuthkit.datamodel.Image;
|
|
||||||
import org.sleuthkit.datamodel.TskException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action adds all supported files from the given Content object and its
|
|
||||||
* children to the Solr index.
|
|
||||||
*/
|
|
||||||
public class IndexContentFilesAction extends AbstractAction {
|
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(IndexContentFilesAction.class.getName());
|
|
||||||
private static final int MAX_STRING_EXTRACT_SIZE = 10 * (1 << 10) * (1 << 10);
|
|
||||||
private Content c;
|
|
||||||
private String name;
|
|
||||||
private Server.Core solrCore;
|
|
||||||
|
|
||||||
public enum IngestStatus {
|
|
||||||
|
|
||||||
NOT_INGESTED, INGESTED, EXTRACTED_INGESTED, SKIPPED_EXTRACTION,};
|
|
||||||
//keep track of ingest status for various types of content
|
|
||||||
//could also be useful for reporting
|
|
||||||
private Map<Long, IngestStatus> ingestStatus;
|
|
||||||
private int problemFilesCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New action
|
|
||||||
* @param c source Content object to get files from
|
|
||||||
* @param name name to refer to the source by when displaying progress
|
|
||||||
*/
|
|
||||||
public IndexContentFilesAction(Content c, String name) {
|
|
||||||
this(c, name, KeywordSearch.getServer().getCore());
|
|
||||||
}
|
|
||||||
|
|
||||||
IndexContentFilesAction(Content c, String name, Server.Core solrCore) {
|
|
||||||
super("Index files...");
|
|
||||||
this.c = c;
|
|
||||||
this.name = name;
|
|
||||||
this.solrCore = solrCore;
|
|
||||||
ingestStatus = new HashMap<Long, IngestStatus>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
|
|
||||||
// create the popUp window to display progress
|
|
||||||
String title = "Indexing files in " + name;
|
|
||||||
|
|
||||||
final JFrame frame = new JFrame(title);
|
|
||||||
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window modal
|
|
||||||
|
|
||||||
// initialize panel
|
|
||||||
final IndexProgressPanel panel = new IndexProgressPanel();
|
|
||||||
|
|
||||||
final SwingWorker task = new SwingWorker<Integer, String>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Integer doInBackground() throws Exception {
|
|
||||||
Ingester ingester = solrCore.getIngester();
|
|
||||||
|
|
||||||
this.publish("Categorizing files to index. ");
|
|
||||||
|
|
||||||
GetFilesContentVisitor ingestableV = new GetIngestableFilesContentVisitor();
|
|
||||||
GetFilesContentVisitor allV = new GetAllFilesContentVisitor();
|
|
||||||
|
|
||||||
Collection<FsContent> ingestableFiles = c.accept(ingestableV);
|
|
||||||
Collection<FsContent> allFiles = c.accept(allV);
|
|
||||||
|
|
||||||
//calculate non ingestable Collection (complement of allFiles / ingestableFiles
|
|
||||||
//TODO implement a facility that selects different categories of FsContent
|
|
||||||
Collection<FsContent> nonIngestibleFiles = new LinkedHashSet<FsContent>();
|
|
||||||
|
|
||||||
for (FsContent fs : allFiles) {
|
|
||||||
if (! ingestableFiles.contains(fs) ) {
|
|
||||||
nonIngestibleFiles.add(fs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// track number complete or with errors
|
|
||||||
problemFilesCount = 0;
|
|
||||||
ingestStatus.clear();
|
|
||||||
|
|
||||||
//work on known files first
|
|
||||||
Collection<FsContent> ingestFailedFiles = processIngestible(ingester, ingestableFiles);
|
|
||||||
nonIngestibleFiles.addAll(ingestFailedFiles);
|
|
||||||
|
|
||||||
//work on unknown files
|
|
||||||
//TODO should be an option somewhere in GUI (known vs unknown files)
|
|
||||||
processNonIngestible(ingester, nonIngestibleFiles);
|
|
||||||
|
|
||||||
ingester.commit();
|
|
||||||
|
|
||||||
//signal a potential change in number of indexed files
|
|
||||||
try {
|
|
||||||
final int numIndexedFiles = KeywordSearch.getServer().getCore().queryNumIndexedFiles();
|
|
||||||
KeywordSearch.changeSupport.firePropertyChange(KeywordSearch.NUM_FILES_CHANGE_EVT, null, new Integer(numIndexedFiles));
|
|
||||||
} catch (SolrServerException se) {
|
|
||||||
logger.log(Level.SEVERE, "Error executing Solr query to check number of indexed files: ", se);
|
|
||||||
}
|
|
||||||
|
|
||||||
return problemFilesCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Collection<FsContent> processIngestible(Ingester ingester, Collection<FsContent> fscc) {
|
|
||||||
Collection<FsContent> ingestFailedCol = new ArrayList<FsContent>();
|
|
||||||
|
|
||||||
setProgress(0);
|
|
||||||
int finishedFiles = 0;
|
|
||||||
final int totalFilesCount = fscc.size();
|
|
||||||
for (FsContent f : fscc) {
|
|
||||||
if (isCancelled()) {
|
|
||||||
return ingestFailedCol;
|
|
||||||
}
|
|
||||||
this.publish("Indexing " + (finishedFiles + 1) + "/" + totalFilesCount + ": " + f.getName());
|
|
||||||
try {
|
|
||||||
ingester.ingest(f);
|
|
||||||
ingestStatus.put(f.getId(), IngestStatus.INGESTED);
|
|
||||||
} catch (IngesterException ex) {
|
|
||||||
ingestFailedCol.add(f);
|
|
||||||
ingestStatus.put(f.getId(), IngestStatus.NOT_INGESTED);
|
|
||||||
logger.log(Level.INFO, "Ingester failed with file '" + f.getName() + "' (id: " + f.getId() + ").", ex);
|
|
||||||
}
|
|
||||||
setProgress(++finishedFiles * 100 / totalFilesCount);
|
|
||||||
}
|
|
||||||
return ingestFailedCol;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processNonIngestible(Ingester ingester, Collection<FsContent> fscc) {
|
|
||||||
setProgress(0);
|
|
||||||
int finishedFiles = 0;
|
|
||||||
final int totalFilesCount = fscc.size();
|
|
||||||
|
|
||||||
for (FsContent f : fscc) {
|
|
||||||
if (isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.publish("String extracting/Indexing " + (finishedFiles + 1) + "/" + totalFilesCount + ": " + f.getName());
|
|
||||||
|
|
||||||
if (f.getSize() < MAX_STRING_EXTRACT_SIZE) {
|
|
||||||
if (!extractAndIngest(ingester, f)) {
|
|
||||||
ingestStatus.put(f.getId(), IngestStatus.NOT_INGESTED);
|
|
||||||
problemFilesCount++;
|
|
||||||
logger.log(Level.INFO, "Failed to extract strings and ingest, file '" + f.getName() + "' (id: " + f.getId() + ").");
|
|
||||||
} else {
|
|
||||||
ingestStatus.put(f.getId(), IngestStatus.EXTRACTED_INGESTED);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ingestStatus.put(f.getId(), IngestStatus.SKIPPED_EXTRACTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
setProgress(++finishedFiles * 100 / totalFilesCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void done() {
|
|
||||||
int problemFiles = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (!this.isCancelled()) {
|
|
||||||
problemFiles = get();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (InterruptedException ex) {
|
|
||||||
// shouldn't be interrupted except by cancel
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
} catch (ExecutionException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Fatal error during ingest.", ex);
|
|
||||||
} finally {
|
|
||||||
popUpWindow.setVisible(false);
|
|
||||||
popUpWindow.dispose();
|
|
||||||
|
|
||||||
// notify user if there were problem files
|
|
||||||
if (problemFiles > 0) {
|
|
||||||
displayProblemFilesDialog(problemFiles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void process(List<String> messages) {
|
|
||||||
|
|
||||||
// display the latest message
|
|
||||||
if (!messages.isEmpty()) {
|
|
||||||
panel.setStatusText(messages.get(messages.size() - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
panel.setProgressBar(getProgress());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
panel.addCancelButtonActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
task.cancel(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
popUpWindow.add(panel);
|
|
||||||
popUpWindow.pack();
|
|
||||||
popUpWindow.setResizable(false);
|
|
||||||
|
|
||||||
// set the location of the popUp Window on the center of the screen
|
|
||||||
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
|
||||||
double w = popUpWindow.getSize().getWidth();
|
|
||||||
double h = popUpWindow.getSize().getHeight();
|
|
||||||
popUpWindow.setLocation((int) ((screenDimension.getWidth() - w) / 2), (int) ((screenDimension.getHeight() - h) / 2));
|
|
||||||
|
|
||||||
popUpWindow.addWindowListener(new WindowAdapter() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void windowClosing(WindowEvent e) {
|
|
||||||
// deal with being Xed out of
|
|
||||||
if (!task.isDone()) {
|
|
||||||
task.cancel(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
task.execute();
|
|
||||||
// display the window
|
|
||||||
popUpWindow.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean extractAndIngest(Ingester ingester, FsContent f) {
|
|
||||||
boolean success = false;
|
|
||||||
FsContentStringStream fscs = new FsContentStringStream(f, FsContentStringStream.Encoding.ASCII);
|
|
||||||
try {
|
|
||||||
fscs.convert();
|
|
||||||
ingester.ingest(fscs);
|
|
||||||
success = true;
|
|
||||||
} catch (TskException tskEx) {
|
|
||||||
logger.log(Level.INFO, "Problem extracting string from file: '" + f.getName() + "' (id: " + f.getId() + ").", tskEx);
|
|
||||||
} catch (IngesterException ingEx) {
|
|
||||||
logger.log(Level.INFO, "Ingester had a problem with extracted strings from file '" + f.getName() + "' (id: " + f.getId() + ").", ingEx);
|
|
||||||
}
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayProblemFilesDialog(int problemFiles) {
|
|
||||||
final Component parentComponent = null; // Use default window frame.
|
|
||||||
final String message = "Had trouble indexing " + problemFiles + " of the files. See the log for details.";
|
|
||||||
final String title = "Problem indexing some files";
|
|
||||||
final int messageType = JOptionPane.WARNING_MESSAGE;
|
|
||||||
JOptionPane.showMessageDialog(
|
|
||||||
parentComponent,
|
|
||||||
message,
|
|
||||||
title,
|
|
||||||
messageType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ServiceProvider(service = AddImageAction.IndexImageTask.class)
|
|
||||||
public static class IndexImageTask implements AddImageAction.IndexImageTask {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void runTask(Image newImage) {
|
|
||||||
(new IndexContentFilesAction(newImage, "new image")).actionPerformed(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
<?xml version="1.1" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="statusText" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="progressBar" alignment="0" pref="420" max="32767" attributes="0"/>
|
|
||||||
<Component id="cancelButton" alignment="1" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="statusText" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Component id="progressBar" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JProgressBar" name="progressBar">
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="statusText">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="IndexProgressPanel.statusText.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="cancelButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="IndexProgressPanel.cancelButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,100 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays progress as files are indexed
|
|
||||||
*/
|
|
||||||
class IndexProgressPanel extends javax.swing.JPanel {
|
|
||||||
|
|
||||||
/** Creates new form IndexProgressPanel */
|
|
||||||
IndexProgressPanel() {
|
|
||||||
initComponents();
|
|
||||||
progressBar.setMinimum(0);
|
|
||||||
progressBar.setMaximum(100);
|
|
||||||
progressBar.setIndeterminate(true);
|
|
||||||
statusText.setText("Starting...");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
|
||||||
* initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
|
||||||
* always regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
progressBar = new javax.swing.JProgressBar();
|
|
||||||
statusText = new javax.swing.JLabel();
|
|
||||||
cancelButton = new javax.swing.JButton();
|
|
||||||
|
|
||||||
statusText.setText(org.openide.util.NbBundle.getMessage(IndexProgressPanel.class, "IndexProgressPanel.statusText.text")); // NOI18N
|
|
||||||
|
|
||||||
cancelButton.setText(org.openide.util.NbBundle.getMessage(IndexProgressPanel.class, "IndexProgressPanel.cancelButton.text")); // NOI18N
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(statusText)
|
|
||||||
.addComponent(progressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
|
|
||||||
.addComponent(cancelButton, javax.swing.GroupLayout.Alignment.TRAILING))
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(statusText)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(cancelButton)
|
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
);
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private javax.swing.JButton cancelButton;
|
|
||||||
private javax.swing.JProgressBar progressBar;
|
|
||||||
private javax.swing.JLabel statusText;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a listener for the Cancel button
|
|
||||||
* @param e The action listener
|
|
||||||
*/
|
|
||||||
void addCancelButtonActionListener(ActionListener e) {
|
|
||||||
this.cancelButton.addActionListener(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setProgressBar(int percent) {
|
|
||||||
progressBar.setIndeterminate(false);
|
|
||||||
progressBar.setValue(percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setStatusText(String text) {
|
|
||||||
statusText.setText(text);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,144 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.awt.Cursor;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.beans.PropertyChangeEvent;
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.util.List;
|
|
||||||
import org.openide.util.lookup.ServiceProvider;
|
|
||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataExplorer;
|
|
||||||
import org.sleuthkit.autopsy.keywordsearch.KeywordSearch.QueryType;
|
|
||||||
import org.sleuthkit.autopsy.keywordsearch.KeywordSearchQueryManager.Presentation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a data explorer to perform Solr searches with
|
|
||||||
*/
|
|
||||||
public class KeywordSearchDataExplorer implements DataExplorer {
|
|
||||||
|
|
||||||
private static KeywordSearchDataExplorer theInstance = null;
|
|
||||||
private KeywordSearchTabsTopComponent tc;
|
|
||||||
private int filesIndexed;
|
|
||||||
|
|
||||||
private KeywordSearchDataExplorer() {
|
|
||||||
this.filesIndexed = 0;
|
|
||||||
this.tc = KeywordSearchTabsTopComponent.findInstance();
|
|
||||||
|
|
||||||
this.tc.addSearchButtonListener(new ActionListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if (filesIndexed == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tc.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
|
||||||
|
|
||||||
try {
|
|
||||||
search();
|
|
||||||
} finally {
|
|
||||||
tc.setCursor(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
KeywordSearch.changeSupport.addPropertyChangeListener(KeywordSearch.NUM_FILES_CHANGE_EVT, new IndexChangeListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized KeywordSearchDataExplorer getDefault() {
|
|
||||||
if (theInstance == null) {
|
|
||||||
theInstance = new KeywordSearchDataExplorer();
|
|
||||||
}
|
|
||||||
return theInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes a query and populates a DataResult tab with the results
|
|
||||||
* @param solrQuery
|
|
||||||
*/
|
|
||||||
private void search() {
|
|
||||||
KeywordSearchQueryManager man = null;
|
|
||||||
if (tc.isMultiwordQuery()) {
|
|
||||||
final List<Keyword> keywords = tc.getQueryList();
|
|
||||||
if (keywords.isEmpty()) {
|
|
||||||
KeywordSearchUtil.displayDialog("Keyword Search Error", "Keyword list is empty, please add at least one keyword to the list", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
man = new KeywordSearchQueryManager(keywords, Presentation.COLLAPSE);
|
|
||||||
} else {
|
|
||||||
QueryType queryType = null;
|
|
||||||
if (tc.isLuceneQuerySelected()) {
|
|
||||||
queryType = QueryType.WORD;
|
|
||||||
} else {
|
|
||||||
queryType = QueryType.REGEX;
|
|
||||||
}
|
|
||||||
final String queryText = tc.getQueryText();
|
|
||||||
if (queryText == null || queryText.trim().equals("")) {
|
|
||||||
KeywordSearchUtil.displayDialog("Keyword Search Error", "Please enter a keyword to search for", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
man = new KeywordSearchQueryManager(tc.getQueryText(), queryType, Presentation.COLLAPSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (man.validate()) {
|
|
||||||
man.execute();
|
|
||||||
} else {
|
|
||||||
KeywordSearchUtil.displayDialog("Keyword Search Error", "Invalid query syntax.", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public org.openide.windows.TopComponent getTopComponent() {
|
|
||||||
return this.tc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasMenuOpenAction() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
|
||||||
}
|
|
||||||
|
|
||||||
class IndexChangeListener implements PropertyChangeListener {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
|
||||||
|
|
||||||
String changed = evt.getPropertyName();
|
|
||||||
//Object oldValue = evt.getOldValue();
|
|
||||||
Object newValue = evt.getNewValue();
|
|
||||||
|
|
||||||
if (newValue != null) {
|
|
||||||
if (changed.equals(KeywordSearch.NUM_FILES_CHANGE_EVT)) {
|
|
||||||
int newFilesIndexed = ((Integer) newValue).intValue();
|
|
||||||
filesIndexed = newFilesIndexed;
|
|
||||||
tc.setFilesIndexed(newFilesIndexed);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
String msg = "Unsupported change event: " + changed;
|
|
||||||
throw new UnsupportedOperationException(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,152 +0,0 @@
|
|||||||
<?xml version="1.1" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="mainScrollPane" alignment="0" pref="368" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="mainScrollPane" alignment="0" pref="455" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="javax.swing.JScrollPane" name="mainScrollPane">
|
|
||||||
<Properties>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[349, 433]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="javax.swing.JPanel" name="mainPanel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[349, 433]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="topLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="1">
|
|
||||||
<Component id="importButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
|
|
||||||
<Component id="exportButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
|
||||||
<Component id="deleteButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="jScrollPane1" alignment="0" min="-2" pref="266" max="-2" attributes="1"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="topLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
|
|
||||||
<Component id="jScrollPane1" min="-2" pref="251" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="importButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="exportButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="deleteButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="113" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JButton" name="importButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListImportExportTopComponent.importButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="importButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="exportButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListImportExportTopComponent.exportButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exportButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="deleteButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListImportExportTopComponent.deleteButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JTable" name="listsTable">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
|
||||||
<Connection code="tableModel" type="code"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="showHorizontalLines" type="boolean" value="false"/>
|
|
||||||
<Property name="showVerticalLines" type="boolean" value="false"/>
|
|
||||||
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
|
||||||
<TableHeader reorderingAllowed="false" resizingAllowed="true"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JLabel" name="topLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
|
||||||
<Font name="Tahoma" size="12" style="0"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListImportExportTopComponent.topLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,632 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.awt.Component;
|
|
||||||
import java.beans.PropertyChangeEvent;
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.io.File;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import javax.swing.JFileChooser;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JTable;
|
|
||||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
|
||||||
import javax.swing.table.AbstractTableModel;
|
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
|
||||||
import javax.swing.table.TableColumn;
|
|
||||||
import org.openide.util.NbBundle;
|
|
||||||
import org.openide.windows.TopComponent;
|
|
||||||
import org.netbeans.api.settings.ConvertAsProperties;
|
|
||||||
import org.openide.awt.ActionID;
|
|
||||||
import org.openide.awt.ActionReference;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Top component which displays something.
|
|
||||||
*/
|
|
||||||
//@ConvertAsProperties(dtd = "-//org.sleuthkit.autopsy.keywordsearch//KeywordSearchListImportExport//EN",
|
|
||||||
//autostore = false)
|
|
||||||
//@TopComponent.Description(preferredID = "KeywordSearchListImportExportTopComponent",
|
|
||||||
////iconBase="SET/PATH/TO/ICON/HERE",
|
|
||||||
//persistenceType = TopComponent.PERSISTENCE_NEVER)
|
|
||||||
//@TopComponent.Registration(mode = "explorer", openAtStartup = false)
|
|
||||||
//@ActionID(category = "Window", id = "org.sleuthkit.autopsy.keywordsearch.KeywordSearchListImportExportTopComponent")
|
|
||||||
//@ActionReference(path = "Menu/Window" /*, position = 333 */)
|
|
||||||
//@TopComponent.OpenActionRegistration(displayName = "#CTL_KeywordSearchListImportExportAction",
|
|
||||||
//preferredID = "KeywordSearchListImportExportTopComponent")
|
|
||||||
public final class KeywordSearchListImportExportTopComponent extends TopComponent {
|
|
||||||
|
|
||||||
private Logger logger = Logger.getLogger(KeywordSearchListImportExportTopComponent.class.getName());
|
|
||||||
private KeywordListTableModel tableModel;
|
|
||||||
|
|
||||||
public KeywordSearchListImportExportTopComponent() {
|
|
||||||
tableModel = new KeywordListTableModel();
|
|
||||||
initComponents();
|
|
||||||
customizeComponents();
|
|
||||||
setName(NbBundle.getMessage(KeywordSearchListImportExportTopComponent.class, "CTL_KeywordSearchListImportExportTopComponent"));
|
|
||||||
setToolTipText(NbBundle.getMessage(KeywordSearchListImportExportTopComponent.class, "HINT_KeywordSearchListImportExportTopComponent"));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void customizeComponents() {
|
|
||||||
|
|
||||||
importButton.setToolTipText("Import list(s) of keywords from an external file.");
|
|
||||||
exportButton.setToolTipText("Export selected list(s) of keywords to an external file.");
|
|
||||||
deleteButton.setToolTipText("Delete selected list(s) of keywords.");
|
|
||||||
|
|
||||||
|
|
||||||
listsTable.setAutoscrolls(true);
|
|
||||||
//listsTable.setTableHeader(null);
|
|
||||||
listsTable.setShowHorizontalLines(false);
|
|
||||||
listsTable.setShowVerticalLines(false);
|
|
||||||
|
|
||||||
listsTable.getParent().setBackground(listsTable.getBackground());
|
|
||||||
|
|
||||||
//customize column witdhs
|
|
||||||
listsTable.setSize(260, 200);
|
|
||||||
final int width = listsTable.getSize().width;
|
|
||||||
TableColumn column = null;
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
column = listsTable.getColumnModel().getColumn(i);
|
|
||||||
switch (i) {
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
column.setCellRenderer(new CellTooltipRenderer());
|
|
||||||
column.setPreferredWidth(((int) (width * 0.28)));
|
|
||||||
column.setResizable(true);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
column.setPreferredWidth(((int) (width * 0.15)));
|
|
||||||
column.setResizable(false);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
listsTable.setCellSelectionEnabled(false);
|
|
||||||
tableModel.resync();
|
|
||||||
if (KeywordSearchListsXML.getCurrent().getNumberLists() == 0) {
|
|
||||||
exportButton.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
KeywordSearchListsXML.getCurrent().addPropertyChangeListener(new PropertyChangeListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
|
||||||
if (evt.getPropertyName().equals(KeywordSearchListsXML.ListsEvt.LIST_ADDED.toString())
|
|
||||||
|| evt.getPropertyName().equals(KeywordSearchListsXML.ListsEvt.LIST_DELETED.toString())) {
|
|
||||||
tableModel.resync();
|
|
||||||
|
|
||||||
if (Integer.valueOf((Integer) evt.getNewValue()) == 0) {
|
|
||||||
exportButton.setEnabled(false);
|
|
||||||
deleteButton.setEnabled(false);
|
|
||||||
}
|
|
||||||
//else if (Integer.valueOf((Integer) evt.getOldValue()) == 0) {
|
|
||||||
// exportButton.setEnabled(true);
|
|
||||||
//}
|
|
||||||
} else if (evt.getPropertyName().equals(KeywordSearchListsXML.ListsEvt.LIST_UPDATED.toString())) {
|
|
||||||
tableModel.resync((String) evt.getNewValue()); //changed list name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
initButtons();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initButtons() {
|
|
||||||
if (tableModel.getSelectedLists().isEmpty()) {
|
|
||||||
deleteButton.setEnabled(false);
|
|
||||||
exportButton.setEnabled(false);
|
|
||||||
} else {
|
|
||||||
deleteButton.setEnabled(true);
|
|
||||||
exportButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
|
||||||
* initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
|
||||||
* always regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
mainScrollPane = new javax.swing.JScrollPane();
|
|
||||||
mainPanel = new javax.swing.JPanel();
|
|
||||||
importButton = new javax.swing.JButton();
|
|
||||||
exportButton = new javax.swing.JButton();
|
|
||||||
deleteButton = new javax.swing.JButton();
|
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
|
||||||
listsTable = new javax.swing.JTable();
|
|
||||||
topLabel = new javax.swing.JLabel();
|
|
||||||
|
|
||||||
mainScrollPane.setPreferredSize(new java.awt.Dimension(349, 433));
|
|
||||||
|
|
||||||
mainPanel.setPreferredSize(new java.awt.Dimension(349, 433));
|
|
||||||
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(importButton, org.openide.util.NbBundle.getMessage(KeywordSearchListImportExportTopComponent.class, "KeywordSearchListImportExportTopComponent.importButton.text")); // NOI18N
|
|
||||||
importButton.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
importButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(exportButton, org.openide.util.NbBundle.getMessage(KeywordSearchListImportExportTopComponent.class, "KeywordSearchListImportExportTopComponent.exportButton.text")); // NOI18N
|
|
||||||
exportButton.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
exportButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(deleteButton, org.openide.util.NbBundle.getMessage(KeywordSearchListImportExportTopComponent.class, "KeywordSearchListImportExportTopComponent.deleteButton.text")); // NOI18N
|
|
||||||
deleteButton.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
deleteButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
listsTable.setModel(tableModel);
|
|
||||||
listsTable.setShowHorizontalLines(false);
|
|
||||||
listsTable.setShowVerticalLines(false);
|
|
||||||
listsTable.getTableHeader().setReorderingAllowed(false);
|
|
||||||
jScrollPane1.setViewportView(listsTable);
|
|
||||||
|
|
||||||
topLabel.setFont(new java.awt.Font("Tahoma", 0, 12));
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(topLabel, org.openide.util.NbBundle.getMessage(KeywordSearchListImportExportTopComponent.class, "KeywordSearchListImportExportTopComponent.topLabel.text")); // NOI18N
|
|
||||||
|
|
||||||
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
|
|
||||||
mainPanel.setLayout(mainPanelLayout);
|
|
||||||
mainPanelLayout.setHorizontalGroup(
|
|
||||||
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(topLabel)
|
|
||||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
|
|
||||||
.addComponent(importButton)
|
|
||||||
.addGap(33, 33, 33)
|
|
||||||
.addComponent(exportButton)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(deleteButton))
|
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
mainPanelLayout.setVerticalGroup(
|
|
||||||
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(topLabel)
|
|
||||||
.addGap(34, 34, 34)
|
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(importButton)
|
|
||||||
.addComponent(exportButton)
|
|
||||||
.addComponent(deleteButton))
|
|
||||||
.addContainerGap(113, Short.MAX_VALUE))
|
|
||||||
);
|
|
||||||
|
|
||||||
mainScrollPane.setViewportView(mainPanel);
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 455, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
|
|
||||||
public void importButtonAction(java.awt.event.ActionEvent evt) {
|
|
||||||
importButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importButtonActionPerformed
|
|
||||||
final String FEATURE_NAME = "Keyword List Import";
|
|
||||||
|
|
||||||
JFileChooser chooser = new JFileChooser();
|
|
||||||
final String EXTENSION = "xml";
|
|
||||||
FileNameExtensionFilter filter = new FileNameExtensionFilter(
|
|
||||||
"Keyword List XML file", EXTENSION);
|
|
||||||
chooser.setFileFilter(filter);
|
|
||||||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
|
||||||
|
|
||||||
int returnVal = chooser.showOpenDialog(this);
|
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
|
||||||
File selFile = chooser.getSelectedFile();
|
|
||||||
if (selFile == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//force append extension if not given
|
|
||||||
String fileAbs = selFile.getAbsolutePath();
|
|
||||||
|
|
||||||
final KeywordSearchListsXML reader = new KeywordSearchListsXML(fileAbs);
|
|
||||||
if (!reader.load()) {
|
|
||||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Error importing keyword list from file " + fileAbs, KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<KeywordSearchList> toImport = reader.getListsL();
|
|
||||||
List<KeywordSearchList> toImportConfirmed = new ArrayList<KeywordSearchList>();
|
|
||||||
|
|
||||||
final KeywordSearchListsXML writer = KeywordSearchListsXML.getCurrent();
|
|
||||||
|
|
||||||
for (KeywordSearchList list : toImport) {
|
|
||||||
//check name collisions
|
|
||||||
if (writer.listExists(list.getName())) {
|
|
||||||
Object[] options = {"Yes, overwrite",
|
|
||||||
"No, skip",
|
|
||||||
"Cancel import"};
|
|
||||||
int choice = JOptionPane.showOptionDialog(this,
|
|
||||||
"Keyword list <" + list.getName() + "> already exists locally, overwrite?",
|
|
||||||
"Import list conflict",
|
|
||||||
JOptionPane.YES_NO_CANCEL_OPTION,
|
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
|
||||||
null,
|
|
||||||
options,
|
|
||||||
options[0]);
|
|
||||||
if (choice == JOptionPane.OK_OPTION) {
|
|
||||||
toImportConfirmed.add(list);
|
|
||||||
} else if (choice == JOptionPane.CANCEL_OPTION) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//no conflict
|
|
||||||
toImportConfirmed.add(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toImportConfirmed.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (writer.writeLists(toImportConfirmed)) {
|
|
||||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword list imported", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
|
||||||
}
|
|
||||||
|
|
||||||
initButtons();
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_importButtonActionPerformed
|
|
||||||
|
|
||||||
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed
|
|
||||||
final String FEATURE_NAME = "Keyword List Export";
|
|
||||||
|
|
||||||
List<String> toExport = tableModel.getSelectedLists();
|
|
||||||
if (toExport.isEmpty()) {
|
|
||||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Please select keyword lists to export", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
JFileChooser chooser = new JFileChooser();
|
|
||||||
final String EXTENSION = "xml";
|
|
||||||
FileNameExtensionFilter filter = new FileNameExtensionFilter(
|
|
||||||
"Keyword List XML file", EXTENSION);
|
|
||||||
chooser.setFileFilter(filter);
|
|
||||||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
|
||||||
|
|
||||||
int returnVal = chooser.showSaveDialog(this);
|
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
|
||||||
File selFile = chooser.getSelectedFile();
|
|
||||||
if (selFile == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//force append extension if not given
|
|
||||||
String fileAbs = selFile.getAbsolutePath();
|
|
||||||
if (!fileAbs.endsWith("." + EXTENSION)) {
|
|
||||||
fileAbs = fileAbs + "." + EXTENSION;
|
|
||||||
selFile = new File(fileAbs);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean shouldWrite = true;
|
|
||||||
if (selFile.exists()) {
|
|
||||||
shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME, "File " + selFile.getName() + " exists, overwrite?", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
|
|
||||||
}
|
|
||||||
if (!shouldWrite) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
final KeywordSearchListsXML reader = KeywordSearchListsXML.getCurrent();
|
|
||||||
|
|
||||||
List<KeywordSearchList> toWrite = new ArrayList<KeywordSearchList>();
|
|
||||||
for (String listName : toExport) {
|
|
||||||
toWrite.add(reader.getList(listName));
|
|
||||||
}
|
|
||||||
final KeywordSearchListsXML exporter = new KeywordSearchListsXML(fileAbs);
|
|
||||||
boolean written = exporter.writeLists(toWrite);
|
|
||||||
if (written) {
|
|
||||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword lists exported", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}//GEN-LAST:event_exportButtonActionPerformed
|
|
||||||
|
|
||||||
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
|
|
||||||
tableModel.deleteSelected();
|
|
||||||
initButtons();
|
|
||||||
}//GEN-LAST:event_deleteButtonActionPerformed
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private javax.swing.JButton deleteButton;
|
|
||||||
private javax.swing.JButton exportButton;
|
|
||||||
private javax.swing.JButton importButton;
|
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
|
||||||
private javax.swing.JTable listsTable;
|
|
||||||
private javax.swing.JPanel mainPanel;
|
|
||||||
private javax.swing.JScrollPane mainScrollPane;
|
|
||||||
private javax.swing.JLabel topLabel;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void componentOpened() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void componentClosed() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeProperties(java.util.Properties p) {
|
|
||||||
|
|
||||||
p.setProperty("version", "1.0");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void readProperties(java.util.Properties p) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private class KeywordListTableModel extends AbstractTableModel {
|
|
||||||
//data
|
|
||||||
|
|
||||||
private KeywordSearchListsXML listsHandle = KeywordSearchListsXML.getCurrent();
|
|
||||||
private Set<TableEntry> listData = new TreeSet<TableEntry>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getColumnCount() {
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRowCount() {
|
|
||||||
return listData.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getColumnName(int column) {
|
|
||||||
String colName = null;
|
|
||||||
switch (column) {
|
|
||||||
case 0:
|
|
||||||
colName = "Name";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
colName = "Created";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
colName = "Modified";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
colName = "Sel.";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
|
||||||
return colName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
|
||||||
Object ret = null;
|
|
||||||
TableEntry entry = null;
|
|
||||||
//iterate until row
|
|
||||||
Iterator<TableEntry> it = listData.iterator();
|
|
||||||
for (int i = 0; i <= rowIndex; ++i) {
|
|
||||||
entry = it.next();
|
|
||||||
}
|
|
||||||
switch (columnIndex) {
|
|
||||||
case 0:
|
|
||||||
ret = (Object) entry.name;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
ret = (Object) entry.created;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
ret = (Object) entry.modified;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
ret = (Object) entry.isActive;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
|
||||||
return columnIndex == 3 ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
|
||||||
if (columnIndex == 3) {
|
|
||||||
TableEntry entry = null;
|
|
||||||
//iterate until row
|
|
||||||
Iterator<TableEntry> it = listData.iterator();
|
|
||||||
for (int i = 0; i <= rowIndex && it.hasNext(); ++i) {
|
|
||||||
entry = it.next();
|
|
||||||
}
|
|
||||||
if (entry != null)
|
|
||||||
entry.isActive = (Boolean) aValue;
|
|
||||||
|
|
||||||
initButtons();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class getColumnClass(int c) {
|
|
||||||
return getValueAt(0, c).getClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> getAllLists() {
|
|
||||||
List<String> ret = new ArrayList<String>();
|
|
||||||
for (TableEntry e : listData) {
|
|
||||||
ret.add(e.name);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> getSelectedLists() {
|
|
||||||
List<String> ret = new ArrayList<String>();
|
|
||||||
for (TableEntry e : listData) {
|
|
||||||
if (e.isActive && !e.name.equals("")) {
|
|
||||||
ret.add(e.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean listExists(String list) {
|
|
||||||
List<String> all = getAllLists();
|
|
||||||
return all.contains(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
//delete selected from handle, events are fired from the handle
|
|
||||||
void deleteSelected() {
|
|
||||||
List<TableEntry> toDel = new ArrayList<TableEntry>();
|
|
||||||
for (TableEntry e : listData) {
|
|
||||||
if (e.isActive && !e.name.equals("")) {
|
|
||||||
toDel.add(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (TableEntry del : toDel) {
|
|
||||||
listsHandle.deleteList(del.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//resync model from handle, then update table
|
|
||||||
void resync() {
|
|
||||||
listData.clear();
|
|
||||||
addLists(listsHandle.getListsL());
|
|
||||||
fireTableDataChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
//resync single model entry from handle, then update table
|
|
||||||
void resync(String listName) {
|
|
||||||
TableEntry found = null;
|
|
||||||
for (TableEntry e : listData) {
|
|
||||||
if (e.name.equals(listName)) {
|
|
||||||
found = e;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found != null) {
|
|
||||||
listData.remove(found);
|
|
||||||
addList(listsHandle.getList(listName));
|
|
||||||
}
|
|
||||||
fireTableDataChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
//add list to the model
|
|
||||||
private void addList(KeywordSearchList list) {
|
|
||||||
if (!listExists(list.getName())) {
|
|
||||||
listData.add(new TableEntry(list));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//add lists to the model
|
|
||||||
private void addLists(List<KeywordSearchList> lists) {
|
|
||||||
for (KeywordSearchList list : lists) {
|
|
||||||
if (!listExists(list.getName())) {
|
|
||||||
listData.add(new TableEntry(list));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//single model entry
|
|
||||||
class TableEntry implements Comparable {
|
|
||||||
|
|
||||||
private DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
||||||
String name;
|
|
||||||
String created;
|
|
||||||
String modified;
|
|
||||||
Boolean isActive;
|
|
||||||
|
|
||||||
TableEntry(KeywordSearchList list, Boolean isActive) {
|
|
||||||
this.name = list.getName();
|
|
||||||
this.created = dateFormatter.format(list.getDateCreated());
|
|
||||||
this.modified = dateFormatter.format(list.getDateModified());
|
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
TableEntry(KeywordSearchList list) {
|
|
||||||
this.name = list.getName();
|
|
||||||
this.created = dateFormatter.format(list.getDateCreated());
|
|
||||||
this.modified = dateFormatter.format(list.getDateModified());
|
|
||||||
this.isActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Object o) {
|
|
||||||
return this.name.compareTo(((TableEntry) o).name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* tooltips that show text
|
|
||||||
*/
|
|
||||||
private static class CellTooltipRenderer extends DefaultTableCellRenderer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Component getTableCellRendererComponent(
|
|
||||||
JTable table, Object value,
|
|
||||||
boolean isSelected, boolean hasFocus,
|
|
||||||
int row, int column) {
|
|
||||||
|
|
||||||
if (column < 3) {
|
|
||||||
String val = (String) table.getModel().getValueAt(row, column);
|
|
||||||
setToolTipText(val);
|
|
||||||
setText(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,383 +0,0 @@
|
|||||||
<?xml version="1.1" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
|
||||||
<NonVisualComponents>
|
|
||||||
<Container class="javax.swing.JPopupMenu" name="rightClickMenu">
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
|
||||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="cutMenuItem">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.cutMenuItem.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="copyMenuItem">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.copyMenuItem.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="pasteMenuItem">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.pasteMenuItem.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="selectAllMenuItem">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.selectAllMenuItem.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</MenuItem>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</NonVisualComponents>
|
|
||||||
<Properties>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[345, 534]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="mainScrollPane" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="mainScrollPane" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="javax.swing.JScrollPane" name="mainScrollPane">
|
|
||||||
<Properties>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[345, 534]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="javax.swing.JPanel" name="mainPanel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[345, 534]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="103" alignment="0" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="titleLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="-2" pref="58" max="-2" attributes="0"/>
|
|
||||||
<Component id="loadListButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
|
|
||||||
<Component id="importButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
|
|
||||||
<Component id="curListNameLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="curListValLabel" pref="233" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="tablePanel" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="filesIndexedNameLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="filesIndexedValLabel" min="-2" pref="204" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace pref="29" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="-2" pref="54" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
|
|
||||||
<Component id="titleLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="importButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="loadListButton" alignment="1" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Component id="tablePanel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="curListNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="curListValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="filesIndexedNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="filesIndexedValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="28" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JLabel" name="filesIndexedNameLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.filesIndexedNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="filesIndexedValLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.filesIndexedValLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="titleLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
|
||||||
<Font name="Tahoma" size="12" style="0"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.titleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="curListNameLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.curListNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="loadListButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.loadListButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="loadListButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Container class="javax.swing.JPanel" name="tablePanel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
|
|
||||||
<LineBorder/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="deleteWordButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
|
||||||
<Component id="deleteAllWordsButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
|
||||||
<Component id="saveListButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="addWordField" min="-2" pref="152" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace min="10" pref="10" max="10" attributes="0"/>
|
|
||||||
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Component id="addWordButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="jScrollPane1" alignment="0" min="-2" pref="272" max="-2" attributes="0"/>
|
|
||||||
<Component id="searchButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="21" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="addWordButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="addWordField" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace pref="31" max="32767" attributes="0"/>
|
|
||||||
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jScrollPane1" min="-2" pref="210" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="deleteWordButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="deleteAllWordsButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="saveListButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
|
||||||
<Component id="searchButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JButton" name="saveListButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.saveListButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveListButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="deleteWordButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.deleteWordButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteWordButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="deleteAllWordsButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.deleteAllWordsButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteAllWordsButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JCheckBox" name="chRegex">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.chRegex.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chRegexActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="addWordButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.addWordButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addWordButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JTextField" name="addWordField">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.addWordField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addWordFieldActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JTable" name="keywordTable">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
|
||||||
<Connection code="tableModel" type="code"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="autoResizeMode" type="int" value="0"/>
|
|
||||||
<Property name="showHorizontalLines" type="boolean" value="false"/>
|
|
||||||
<Property name="showVerticalLines" type="boolean" value="false"/>
|
|
||||||
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
|
||||||
<TableHeader reorderingAllowed="false" resizingAllowed="true"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JButton" name="searchButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.searchButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="searchButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JLabel" name="curListValLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.curListValLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="importButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.importButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="importButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
File diff suppressed because it is too large
Load Diff
@ -1,232 +0,0 @@
|
|||||||
<?xml version="1.1" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
|
||||||
<NonVisualComponents>
|
|
||||||
<Container class="javax.swing.JPopupMenu" name="rightClickMenu">
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
|
||||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="cutMenuItem">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.cutMenuItem.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="copyMenuItem">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.copyMenuItem.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="pasteMenuItem">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.pasteMenuItem.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="selectAllMenuItem">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.selectAllMenuItem.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</MenuItem>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</NonVisualComponents>
|
|
||||||
<Properties>
|
|
||||||
<Property name="autoscrolls" type="boolean" value="true"/>
|
|
||||||
</Properties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="mainScrollPane" alignment="0" pref="370" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="mainScrollPane" alignment="0" pref="276" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="javax.swing.JScrollPane" name="mainScrollPane">
|
|
||||||
<Properties>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[351, 249]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="javax.swing.JPanel" name="mainPanel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[351, 249]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="filesIndexedNameLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="filesIndexedValLabel" min="-2" pref="59" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="titleLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
|
||||||
<Component id="searchPanel" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="-2" pref="84" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="titleLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
|
||||||
<Component id="searchPanel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="filesIndexedNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="filesIndexedValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="94" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JLabel" name="filesIndexedValLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.filesIndexedValLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<AccessibilityProperties>
|
|
||||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchTopComponent.filesIndexedValLabel.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</AccessibilityProperties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="filesIndexedNameLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<AccessibilityProperties>
|
|
||||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchTopComponent.filesIndexedNameLabel.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</AccessibilityProperties>
|
|
||||||
</Component>
|
|
||||||
<Container class="javax.swing.JPanel" name="searchPanel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
|
|
||||||
<LineBorder roundedCorners="true"/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="chRegex" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="queryTextField" alignment="0" pref="242" max="32767" attributes="0"/>
|
|
||||||
<Component id="searchButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="queryTextField" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Component id="searchButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JTextField" name="queryTextField">
|
|
||||||
<Properties>
|
|
||||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.queryTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="queryTextFieldActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JCheckBox" name="chRegex">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.chRegex.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chRegexActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="searchButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.searchButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JLabel" name="titleLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
|
||||||
<Font name="Tahoma" size="12" style="0"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.titleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,319 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import org.openide.windows.TopComponent;
|
|
||||||
import org.openide.windows.WindowManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Top component for Simple keyword search
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class KeywordSearchSimpleTopComponent extends TopComponent implements KeywordSearchTopComponentInterface {
|
|
||||||
|
|
||||||
private Logger logger = Logger.getLogger(KeywordSearchSimpleTopComponent.class.getName());
|
|
||||||
private static KeywordSearchSimpleTopComponent instance = null;
|
|
||||||
|
|
||||||
public static final String PREFERRED_ID = "KeywordSearchSimpleTopComponent";
|
|
||||||
|
|
||||||
/** Creates new form KeywordSearchSimpleTopComponent */
|
|
||||||
private KeywordSearchSimpleTopComponent() {
|
|
||||||
initComponents();
|
|
||||||
customizeComponents();
|
|
||||||
setName("Simple");
|
|
||||||
searchButton.setEnabled(false);
|
|
||||||
|
|
||||||
putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized KeywordSearchSimpleTopComponent getDefault() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new KeywordSearchSimpleTopComponent();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized KeywordSearchSimpleTopComponent findInstance() {
|
|
||||||
TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
|
|
||||||
if (win == null) {
|
|
||||||
return getDefault();
|
|
||||||
}
|
|
||||||
if (win instanceof KeywordSearchSimpleTopComponent) {
|
|
||||||
return (KeywordSearchSimpleTopComponent) win;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void customizeComponents() {
|
|
||||||
searchButton.setToolTipText("Execute a keyword search using the query specified.");
|
|
||||||
chRegex.setToolTipText("Select if keyword is a regular expression");
|
|
||||||
queryTextField.setToolTipText("<html>For non-regex search enter one or more keywords separated by white-space.<br />"
|
|
||||||
+ "For a regular expression search, enter a valid regular expression.<br />"
|
|
||||||
+ "Examples (in double-quotes): \"\\d\\d\\d-\\d\\d\\d\" \\d{8,10} \"phone\" \"ftp|sftp|ssh|http|https|www\".<br />"
|
|
||||||
+ "Note: a word can be also searched using a regex search.<br />Regex containing whitespace [ \\s] matches are currently not supported.</html>");
|
|
||||||
|
|
||||||
queryTextField.setComponentPopupMenu(rightClickMenu);
|
|
||||||
ActionListener actList = new ActionListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
JMenuItem jmi = (JMenuItem) e.getSource();
|
|
||||||
if (jmi.equals(cutMenuItem)) {
|
|
||||||
queryTextField.cut();
|
|
||||||
} else if (jmi.equals(copyMenuItem)) {
|
|
||||||
queryTextField.copy();
|
|
||||||
} else if (jmi.equals(pasteMenuItem)) {
|
|
||||||
queryTextField.paste();
|
|
||||||
} else if (jmi.equals(selectAllMenuItem)) {
|
|
||||||
queryTextField.selectAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
cutMenuItem.addActionListener(actList);
|
|
||||||
copyMenuItem.addActionListener(actList);
|
|
||||||
pasteMenuItem.addActionListener(actList);
|
|
||||||
selectAllMenuItem.addActionListener(actList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
|
||||||
* initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
|
||||||
* always regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
mainScrollPane = new javax.swing.JScrollPane();
|
|
||||||
mainPanel = new javax.swing.JPanel();
|
|
||||||
filesIndexedValLabel = new javax.swing.JLabel();
|
|
||||||
rightClickMenu = new javax.swing.JPopupMenu();
|
|
||||||
cutMenuItem = new javax.swing.JMenuItem();
|
|
||||||
copyMenuItem = new javax.swing.JMenuItem();
|
|
||||||
pasteMenuItem = new javax.swing.JMenuItem();
|
|
||||||
selectAllMenuItem = new javax.swing.JMenuItem();
|
|
||||||
filesIndexedNameLabel = new javax.swing.JLabel();
|
|
||||||
searchPanel = new javax.swing.JPanel();
|
|
||||||
queryTextField = new javax.swing.JTextField();
|
|
||||||
chRegex = new javax.swing.JCheckBox();
|
|
||||||
searchButton = new javax.swing.JButton();
|
|
||||||
titleLabel = new javax.swing.JLabel();
|
|
||||||
|
|
||||||
cutMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.cutMenuItem.text")); // NOI18N
|
|
||||||
rightClickMenu.add(cutMenuItem);
|
|
||||||
|
|
||||||
copyMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.copyMenuItem.text")); // NOI18N
|
|
||||||
rightClickMenu.add(copyMenuItem);
|
|
||||||
|
|
||||||
pasteMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.pasteMenuItem.text")); // NOI18N
|
|
||||||
rightClickMenu.add(pasteMenuItem);
|
|
||||||
|
|
||||||
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.selectAllMenuItem.text")); // NOI18N
|
|
||||||
rightClickMenu.add(selectAllMenuItem);
|
|
||||||
|
|
||||||
setAutoscrolls(true);
|
|
||||||
|
|
||||||
mainScrollPane.setPreferredSize(new java.awt.Dimension(351, 249));
|
|
||||||
|
|
||||||
mainPanel.setPreferredSize(new java.awt.Dimension(351, 249));
|
|
||||||
|
|
||||||
filesIndexedValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.filesIndexedValLabel.text")); // NOI18N
|
|
||||||
|
|
||||||
filesIndexedNameLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text")); // NOI18N
|
|
||||||
|
|
||||||
searchPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
|
|
||||||
|
|
||||||
queryTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
|
|
||||||
queryTextField.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.queryTextField.text")); // NOI18N
|
|
||||||
queryTextField.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
queryTextFieldActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
chRegex.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.chRegex.text")); // NOI18N
|
|
||||||
chRegex.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
chRegexActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
searchButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.searchButton.text")); // NOI18N
|
|
||||||
|
|
||||||
javax.swing.GroupLayout searchPanelLayout = new javax.swing.GroupLayout(searchPanel);
|
|
||||||
searchPanel.setLayout(searchPanelLayout);
|
|
||||||
searchPanelLayout.setHorizontalGroup(
|
|
||||||
searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(searchPanelLayout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(chRegex)
|
|
||||||
.addComponent(queryTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE)
|
|
||||||
.addComponent(searchButton))
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
searchPanelLayout.setVerticalGroup(
|
|
||||||
searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(searchPanelLayout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(queryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(chRegex)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(searchButton)
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("Tahoma", 0, 12));
|
|
||||||
titleLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.titleLabel.text")); // NOI18N
|
|
||||||
|
|
||||||
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
|
|
||||||
mainPanel.setLayout(mainPanelLayout);
|
|
||||||
mainPanelLayout.setHorizontalGroup(
|
|
||||||
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
|
||||||
.addComponent(filesIndexedNameLabel)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(filesIndexedValLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addComponent(titleLabel)
|
|
||||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
|
||||||
.addGap(10, 10, 10)
|
|
||||||
.addComponent(searchPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
|
||||||
.addGap(84, 84, 84))
|
|
||||||
);
|
|
||||||
mainPanelLayout.setVerticalGroup(
|
|
||||||
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(titleLabel)
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addComponent(searchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(23, 23, 23)
|
|
||||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(filesIndexedNameLabel)
|
|
||||||
.addComponent(filesIndexedValLabel))
|
|
||||||
.addContainerGap(94, Short.MAX_VALUE))
|
|
||||||
);
|
|
||||||
|
|
||||||
filesIndexedValLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchTopComponent.filesIndexedValLabel.AccessibleContext.accessibleName")); // NOI18N
|
|
||||||
filesIndexedNameLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchTopComponent.filesIndexedNameLabel.AccessibleContext.accessibleName")); // NOI18N
|
|
||||||
|
|
||||||
mainScrollPane.setViewportView(mainPanel);
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
|
|
||||||
private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed
|
|
||||||
}//GEN-LAST:event_chRegexActionPerformed
|
|
||||||
|
|
||||||
private void queryTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryTextFieldActionPerformed
|
|
||||||
}//GEN-LAST:event_queryTextFieldActionPerformed
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private javax.swing.JCheckBox chRegex;
|
|
||||||
private javax.swing.JMenuItem copyMenuItem;
|
|
||||||
private javax.swing.JMenuItem cutMenuItem;
|
|
||||||
private javax.swing.JLabel filesIndexedNameLabel;
|
|
||||||
private javax.swing.JLabel filesIndexedValLabel;
|
|
||||||
private javax.swing.JPanel mainPanel;
|
|
||||||
private javax.swing.JScrollPane mainScrollPane;
|
|
||||||
private javax.swing.JMenuItem pasteMenuItem;
|
|
||||||
private javax.swing.JTextField queryTextField;
|
|
||||||
private javax.swing.JPopupMenu rightClickMenu;
|
|
||||||
private javax.swing.JButton searchButton;
|
|
||||||
private javax.swing.JPanel searchPanel;
|
|
||||||
private javax.swing.JMenuItem selectAllMenuItem;
|
|
||||||
private javax.swing.JLabel titleLabel;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void componentOpened() {
|
|
||||||
// clear old search
|
|
||||||
queryTextField.setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isMultiwordQuery() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addSearchButtonListener(ActionListener l) {
|
|
||||||
searchButton.addActionListener(l);
|
|
||||||
queryTextField.addActionListener(l);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getQueryText() {
|
|
||||||
return queryTextField.getText().trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Keyword> getQueryList() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isLuceneQuerySelected() {
|
|
||||||
return !chRegex.isSelected();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRegexQuerySelected() {
|
|
||||||
return chRegex.isSelected();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overwrite when you want to change default persistence type. Default
|
|
||||||
* persistence type is PERSISTENCE_ALWAYS
|
|
||||||
*
|
|
||||||
* @return TopComponent.PERSISTENCE_NEVER
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getPersistenceType() {
|
|
||||||
return TopComponent.PERSISTENCE_NEVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFilesIndexed(int filesIndexed) {
|
|
||||||
filesIndexedValLabel.setText(Integer.toString(filesIndexed));
|
|
||||||
if (filesIndexed == 0) {
|
|
||||||
searchButton.setEnabled(false);
|
|
||||||
} else {
|
|
||||||
searchButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.1" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="tabs" alignment="0" pref="400" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="tabs" alignment="0" pref="300" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="javax.swing.JTabbedPane" name="tabs">
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,237 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.beans.PropertyChangeEvent;
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
|
||||||
import org.openide.util.NbBundle;
|
|
||||||
import org.openide.windows.TopComponent;
|
|
||||||
import org.openide.windows.WindowManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Keyword Search explorer top component, container for specific Keyword Search tabs
|
|
||||||
*/
|
|
||||||
//@ConvertAsProperties(dtd = "-//org.sleuthkit.autopsy.keywordsearch//KeywordSearchTabsTopComponent//EN",
|
|
||||||
//autostore = false)
|
|
||||||
//@TopComponent.Description(preferredID = "KeywordSearchTabsTopComponent",
|
|
||||||
////iconBase="SET/PATH/TO/ICON/HERE",
|
|
||||||
//persistenceType = TopComponent.PERSISTENCE_NEVER)
|
|
||||||
//@TopComponent.Registration(mode = "explorer", openAtStartup = false)
|
|
||||||
//@ActionID(category = "Window", id = "org.sleuthkit.autopsy.keywordsearch.KeywordSearchTabsTopComponentTopComponent")
|
|
||||||
//@ActionReference(path = "Menu/Window" /*, position = 333 */)
|
|
||||||
//@TopComponent.OpenActionRegistration(displayName = "#CTL_KeywordSearchTabsTopComponentAction",
|
|
||||||
//preferredID = "KeywordSearchTabsTopComponent")
|
|
||||||
public final class KeywordSearchTabsTopComponent extends TopComponent implements KeywordSearchTopComponentInterface {
|
|
||||||
|
|
||||||
private Logger logger = Logger.getLogger(KeywordSearchTabsTopComponent.class.getName());
|
|
||||||
private PropertyChangeListener serverChangeListener;
|
|
||||||
|
|
||||||
private static KeywordSearchTabsTopComponent instance = null;
|
|
||||||
public static final String PREFERRED_ID = "KeywordSearchTabsTopComponent";
|
|
||||||
|
|
||||||
public enum TABS{Simple, List, History};
|
|
||||||
|
|
||||||
private KeywordSearchTabsTopComponent() {
|
|
||||||
initComponents();
|
|
||||||
initTabs();
|
|
||||||
setName(NbBundle.getMessage(KeywordSearchTabsTopComponent.class, "CTL_KeywordSearchTabsTopComponentTopComponent"));
|
|
||||||
setToolTipText(NbBundle.getMessage(KeywordSearchTabsTopComponent.class, "HINT_KeywordSearchTabsTopComponentTopComponent"));
|
|
||||||
|
|
||||||
|
|
||||||
putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
|
|
||||||
|
|
||||||
//register with server Actions
|
|
||||||
serverChangeListener = new KeywordSearchServerListener();
|
|
||||||
KeywordSearch.getServer().addServerActionListener(serverChangeListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPersistenceType() {
|
|
||||||
return TopComponent.PERSISTENCE_NEVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized KeywordSearchTabsTopComponent getDefault() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new KeywordSearchTabsTopComponent();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized KeywordSearchTabsTopComponent findInstance() {
|
|
||||||
TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
|
|
||||||
if (win == null) {
|
|
||||||
return getDefault();
|
|
||||||
}
|
|
||||||
if (win instanceof KeywordSearchTabsTopComponent) {
|
|
||||||
return (KeywordSearchTabsTopComponent) win;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
|
||||||
* initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
|
||||||
* always regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
tabs = new javax.swing.JTabbedPane();
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(tabs, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(tabs, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private javax.swing.JTabbedPane tabs;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
|
|
||||||
private void initTabs() {
|
|
||||||
tabs.addTab(TABS.Simple.name(), null, KeywordSearchSimpleTopComponent.findInstance(), "Single keyword or regex search");
|
|
||||||
tabs.addTab(TABS.List.name(), null, KeywordSearchListTopComponent.findInstance(), "Search for or load a saved list of keywords.");
|
|
||||||
//tabs.addTab(TABS.Lists.name(), null, new KeywordSearchListImportExportTopComponent(), "Manage (import, export, delete) lists of keywords.");
|
|
||||||
//tabs.addTab(TABS.History.name(), null, new KeywordSearchHistoryTopComponent(), "Review keyword search history and saved search results."); //TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void componentOpened() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void componentClosed() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeProperties(java.util.Properties p) {
|
|
||||||
// better to version settings since initial version as advocated at
|
|
||||||
// http://wiki.apidesign.org/wiki/PropertyFiles
|
|
||||||
p.setProperty("version", "1.0");
|
|
||||||
// store your settings
|
|
||||||
}
|
|
||||||
|
|
||||||
void readProperties(java.util.Properties p) {
|
|
||||||
String version = p.getProperty("version");
|
|
||||||
// read your settings according to their version
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isMultiwordQuery() {
|
|
||||||
KeywordSearchTopComponentInterface selected = (KeywordSearchTopComponentInterface) tabs.getSelectedComponent();
|
|
||||||
if (selected == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return selected.isMultiwordQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addSearchButtonListener(ActionListener l) {
|
|
||||||
final int tabsCount = tabs.getTabCount();
|
|
||||||
for (int i = 0; i < tabsCount; ++i) {
|
|
||||||
KeywordSearchTopComponentInterface ks = (KeywordSearchTopComponentInterface) tabs.getComponentAt(i);
|
|
||||||
ks.addSearchButtonListener(l);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getQueryText() {
|
|
||||||
KeywordSearchTopComponentInterface selected = (KeywordSearchTopComponentInterface) tabs.getSelectedComponent();
|
|
||||||
if (selected == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return selected.getQueryText();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Keyword> getQueryList() {
|
|
||||||
KeywordSearchTopComponentInterface selected = (KeywordSearchTopComponentInterface) tabs.getSelectedComponent();
|
|
||||||
if (selected == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return selected.getQueryList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isLuceneQuerySelected() {
|
|
||||||
KeywordSearchTopComponentInterface selected = (KeywordSearchTopComponentInterface) tabs.getSelectedComponent();
|
|
||||||
if (selected == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return selected.isLuceneQuerySelected();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRegexQuerySelected() {
|
|
||||||
KeywordSearchTopComponentInterface selected = (KeywordSearchTopComponentInterface) tabs.getSelectedComponent();
|
|
||||||
if (selected == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return selected.isRegexQuerySelected();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFilesIndexed(int filesIndexed) {
|
|
||||||
final int tabsCount = tabs.getTabCount();
|
|
||||||
for (int i = 0; i < tabsCount; ++i) {
|
|
||||||
KeywordSearchTopComponentInterface ks = (KeywordSearchTopComponentInterface) tabs.getComponentAt(i);
|
|
||||||
ks.setFilesIndexed(filesIndexed);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class KeywordSearchServerListener implements PropertyChangeListener {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
|
||||||
String eventType = evt.getPropertyName();
|
|
||||||
|
|
||||||
if (eventType.equals(Server.CORE_EVT)) {
|
|
||||||
final Server.CORE_EVT_STATES state = (Server.CORE_EVT_STATES) evt.getNewValue();
|
|
||||||
switch (state) {
|
|
||||||
case STARTED:
|
|
||||||
try {
|
|
||||||
final int numIndexedFiles = KeywordSearch.getServer().getCore().queryNumIndexedFiles();
|
|
||||||
KeywordSearch.changeSupport.firePropertyChange(KeywordSearch.NUM_FILES_CHANGE_EVT, null, new Integer(numIndexedFiles));
|
|
||||||
//setFilesIndexed(numIndexedFiles);
|
|
||||||
} catch (SolrServerException se) {
|
|
||||||
logger.log(Level.SEVERE, "Error executing Solr query, " + se.getMessage());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case STOPPED:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.keywordsearch;
|
|
||||||
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* common methods for the KeywordSearch TCs / tabs
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
interface KeywordSearchTopComponentInterface {
|
|
||||||
|
|
||||||
boolean isMultiwordQuery();
|
|
||||||
boolean isLuceneQuerySelected();
|
|
||||||
boolean isRegexQuerySelected();
|
|
||||||
String getQueryText();
|
|
||||||
List<Keyword> getQueryList();
|
|
||||||
void setFilesIndexed(int filesIndexed);
|
|
||||||
void addSearchButtonListener(ActionListener l);
|
|
||||||
|
|
||||||
}
|
|
@ -169,7 +169,7 @@ public class TermComponentQuery implements KeywordSearchQuery {
|
|||||||
//snippet
|
//snippet
|
||||||
String snippet = null;
|
String snippet = null;
|
||||||
try {
|
try {
|
||||||
snippet = LuceneQuery.querySnippet(regexMatch, newFsHit.getId());
|
snippet = LuceneQuery.querySnippet(KeywordSearchUtil.escapeLuceneQuery(regexMatch, true, false), newFsHit.getId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.INFO, "Error querying snippet: " + regexMatch, e);
|
logger.log(Level.INFO, "Error querying snippet: " + regexMatch, e);
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user