Skip to content

Commit

Permalink
closes #621: error message if user doesn't have javafx and exit gui
Browse files Browse the repository at this point in the history
  • Loading branch information
lfcnassif committed Jun 23, 2021
1 parent 96dfea8 commit c2bdb17
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ MetadataPanel.FilterProps=Properties
MetadataPanel.FilterValues=Values
MetadataPanel.CopyClipboard=Copy to clipboard
MetadataPanel.UpdateWarn=[Click on Update]
NoJavaFX.Error=This application needs JavaFX to be installed!
ProcessingNotFinished.title=Processing not finished
ProcessingNotFinished.message=Processing didn't finish successfully. Many case items could be missing, including allocated.\nTry to resume it with --continue option.
ProcessingNotFinished.cases=\ Following cases are affected:\n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ MetadataPanel.Filter=Filtrar:
MetadataPanel.FilterProps=Propriedades
MetadataPanel.FilterValues=Valores
MetadataPanel.CopyClipboard=Copiar para a área transf.
NoJavaFX.Error=Esta aplicação precisa que o JavaFX esteja instalado!
ProcessingNotFinished.title=Processamento não finalizado
ProcessingNotFinished.message=Processamento não finalizou com sucesso. Muitos itens podem estar ausentes, incluindo alocados.\nTente retomá-lo com a opção --continue.
ProcessingNotFinished.cases=\ Os seguintes casos são afetados:\n
Expand Down
7 changes: 7 additions & 0 deletions iped-app/src/main/java/dpf/sp/gpinf/indexer/desktop/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
Expand Down Expand Up @@ -123,6 +124,7 @@
import dpf.sp.gpinf.indexer.ui.hitsViewer.HitsTable;
import dpf.sp.gpinf.indexer.ui.hitsViewer.HitsTableModel;
import dpf.sp.gpinf.indexer.util.IconUtil;
import dpf.sp.gpinf.indexer.util.Util;
import iped3.IIPEDSource;
import iped3.IItem;
import iped3.IItemId;
Expand Down Expand Up @@ -390,6 +392,11 @@ private void destroy() {

public void createGUI() {

if (!Util.isJavaFXPresent()) {
JOptionPane.showMessageDialog(this, Messages.get("NoJavaFX.Error"), "Error", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}

String tab = " "; //$NON-NLS-1$
this.setTitle(Versao.APP_NAME + tab + "[" + Messages.getString("App.Case") + ": " + casesPathFile + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
this.setSize(new Dimension(800, 600));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.LibreOfficeViewer.NotSupported32BitPlatformExcepion;
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.MetadataViewer;
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.MsgViewer;
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.NoJavaFXViewer;
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.ReferencedFileViewer;
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.TextViewer;
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.TiffViewer;
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.TikaHtmlViewer;
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.Viewer;
import dpf.sp.gpinf.indexer.ui.fileViewer.frames.ViewersRepository;
import dpf.sp.gpinf.indexer.ui.fileViewer.util.AppSearchParams;
import dpf.sp.gpinf.indexer.util.JarLoader;
import dpf.sp.gpinf.indexer.util.LibreOfficeFinder;
import iped3.io.IStreamSource;

Expand Down Expand Up @@ -85,22 +83,15 @@ public boolean isFixed() {
});
viewers.add(viewersRepository = new ViewersRepository());

boolean javaFX = new JarLoader().loadJavaFX();

// These are content-specific viewers (inside a single ViewersRepository)
viewersRepository.addViewer(new ImageViewer());
viewersRepository.addViewer(new CADViewer());
if (javaFX) {
viewersRepository.addViewer(new HtmlViewer());
viewersRepository.addViewer(new EmailViewer());
viewersRepository.addViewer(new MsgViewer());
linkViewer = new HtmlLinkViewer(new AttachmentSearcherImpl());
viewersRepository.addViewer(linkViewer);
viewersRepository.addViewer(new TikaHtmlViewer());
} else {
viewersRepository.addViewer(new NoJavaFXViewer());
linkViewer = null;
}
viewersRepository.addViewer(new HtmlViewer());
viewersRepository.addViewer(new EmailViewer());
viewersRepository.addViewer(new MsgViewer());
linkViewer = new HtmlLinkViewer(new AttachmentSearcherImpl());
viewersRepository.addViewer(linkViewer);
viewersRepository.addViewer(new TikaHtmlViewer());
viewersRepository.addViewer(new IcePDFViewer());
viewersRepository.addViewer(new TiffViewer());
viewersRepository.addViewer(new ReferencedFileViewer(viewersRepository, new AttachmentSearcherImpl()));
Expand Down
11 changes: 10 additions & 1 deletion iped-engine/src/main/java/dpf/sp/gpinf/indexer/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.DocumentInputStream;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.tika.io.TemporaryResources;
import org.apache.tika.io.TikaInputStream;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.mime.MediaType;
Expand Down Expand Up @@ -103,6 +102,16 @@ public static String getJavaVersionWarn() {
return null;
}

public static boolean isJavaFXPresent() {
try {
Class.forName("javafx.application.Platform");
return true;

} catch (Throwable t) {
return false;
}
}

public static String getRootName(String path) {
int fromIndex = path.charAt(0) == '/' || path.charAt(0) == '\\' ? 1 : 0;
int slashIdx = path.indexOf('/', fromIndex);
Expand Down
76 changes: 0 additions & 76 deletions iped-utils/src/main/java/dpf/sp/gpinf/indexer/util/JarLoader.java

This file was deleted.

0 comments on commit c2bdb17

Please sign in to comment.