List of usage examples for javax.swing.filechooser FileNameExtensionFilter accept
public boolean accept(File f)
From source file:gr.aueb.mipmapgui.controller.file.ActionOpenMappingTask.java
public Scenario openCompositionFile(String fileAbsoluteFile, File file) { Scenario scenario = null;/*from w w w . j a v a 2 s .co m*/ try { FileNameExtensionFilter xmlFilter = new FileNameExtensionFilter("XML", "xml"); MappingTask mappingTask = null; DAOMappingTask daoMappingTask = new DAOMappingTask(); if (xmlFilter.accept(file)) { mappingTask = daoMappingTask.loadMappingTask(scenarioNo, fileAbsoluteFile, true); // scenario = gestioneScenario(file, mappingTask, false); } else { ///throw new Exception } } catch (Exception ex) { logger.error(ex); ////Scenarios.releaseNumber(); } return scenario; }
From source file:it.unibas.spicygui.controllo.file.ActionOpenMappingTask.java
public Scenario openCompositionFile(String fileAbsoluteFile, File file, boolean isSelected) { Scenario scenario = null;/*from w w w . ja v a 2s . co m*/ try { java.util.Date date = new java.util.Date(); System.out.println("Starting to load task at: " + new Timestamp(date.getTime())); if (logger.isDebugEnabled()) { logger.debug("Apro il file : " + fileAbsoluteFile); } //giannisk int scenarioNo = Scenarios.getNextFreeNumber(); FileNameExtensionFilter tgdFilter = new FileNameExtensionFilter("TGD", "tgd"); FileNameExtensionFilter xmlFilter = new FileNameExtensionFilter("XML", "xml"); MappingTask mappingTask = null; DAOMappingTask daoMappingTask = new DAOMappingTask(); if (xmlFilter.accept(file)) { mappingTask = daoMappingTask.loadMappingTask(scenarioNo, fileAbsoluteFile, SpicyEngineConstants.LINES_BASED_MAPPING_TASK, false); enableActions(); scenario = gestioneScenario(file, mappingTask, false, isSelected); this.actionViewSchema.performAction(); } else if (tgdFilter.accept(file)) { mappingTask = daoMappingTask.loadMappingTask(scenarioNo, fileAbsoluteFile, SpicyEngineConstants.TGD_BASED_MAPPING_TASK, false); enableActionsTGDs(); scenario = gestioneScenario(file, mappingTask, true, isSelected); this.actionViewSchema.setEnabled(false); Lookups.forPath("Azione").lookup(ActionViewTGDs.class).myPerformAction(scenario); Lookups.forPath("Azione").lookup(ActionViewTGD.class).myPerformAction(scenario); } //giannisk open scenarios on the tree panel when loading mapping tasks this.actionProjectTree.performAction(); java.util.Date date2 = new java.util.Date(); System.out.println("Task loaded at: " + new Timestamp(date2.getTime())); } catch (Exception ex) { logger.error(ex); Scenarios.releaseNumber(); DialogDisplayer.getDefault() .notify(new NotifyDescriptor.Message( NbBundle.getMessage(Costanti.class, Costanti.OPEN_ERROR) + " : " + ex.getMessage(), DialogDescriptor.ERROR_MESSAGE)); logger.error(ex); } return scenario; }