public ShowFileAction(URI physicalURI) { super("Show file..."); this.physicalURI = physicalURI; if (!UIUtil.isLocalFile(physicalURI)) { throw new IllegalArgumentException("URI must be a file URI!"); } }
public ShowFileAction(URI physicalURI) { super("Show file..."); this.physicalURI = physicalURI; if (!UIUtil.isLocalFile(physicalURI)) { throw new IllegalArgumentException("URI must be a file URI!"); } }
public ShowFileAction(URI physicalURI) { super("Show file..."); this.physicalURI = physicalURI; if (!UIUtil.isLocalFile(physicalURI)) { throw new IllegalArgumentException("URI must be a file URI!"); } }
public boolean isValidDescriptor(@Nonnull EditorKitDescriptor descriptor) { URI uri = descriptor.getURI(OWLEditorKit.URI_KEY); if(uri == null || uri.getScheme() == null) { return false; } if (UIUtil.isLocalFile(uri)) { File file = new File(uri); return file.exists(); } return true; } }
public boolean isValidDescriptor(EditorKitDescriptor descriptor) { URI uri = descriptor.getURI(OWLEditorKit.URI_KEY); if(uri == null || uri.getScheme() == null) { return false; } if (UIUtil.isLocalFile(uri)) { File file = new File(uri); return file.exists(); } return true; } }
public boolean isValidDescriptor(@Nonnull EditorKitDescriptor descriptor) { URI uri = descriptor.getURI(OWLEditorKit.URI_KEY); if(uri == null || uri.getScheme() == null) { return false; } if (UIUtil.isLocalFile(uri)) { File file = new File(uri); return file.exists(); } return true; } }
private void handleShowFile(OWLOntology ont){ URI physicalURI = owlEditorKit.getOWLModelManager().getOntologyPhysicalURI(ont); if (!UIUtil.isLocalFile(physicalURI)) { throw new IllegalArgumentException("URI must be a file URI!"); } try { FileUtils.showFile(new File(physicalURI)); } catch (IOException ex) { logger.error(ex); } }
private JList createRecentList() { DefaultListModel model = new DefaultListModel(); RecentEditorKitManager man = RecentEditorKitManager.getInstance(); for (EditorKitDescriptor descriptor : man.getDescriptors()) { final URI uri = descriptor.getURI(OWLEditorKit.URI_KEY); if (uri.getScheme() != null && UIUtil.isLocalFile(uri)){ model.addElement(descriptor); } } final JList list = new JList(model); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent event) { String path = ((EditorKitDescriptor)list.getSelectedValue()).getLabel(); filePathPanel.setPath(path); } }); return list; }
private JList createRecentList() { DefaultListModel model = new DefaultListModel(); RecentEditorKitManager man = RecentEditorKitManager.getInstance(); for (EditorKitDescriptor descriptor : man.getDescriptors()) { final URI uri = descriptor.getURI(OWLEditorKit.URI_KEY); if (uri.getScheme() != null && UIUtil.isLocalFile(uri)){ model.addElement(descriptor); } } final JList list = new JList(model); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addListSelectionListener(event -> { String path = ((EditorKitDescriptor)list.getSelectedValue()).getLabel(); filePathPanel.setPath(path); }); return list; }
protected List<MListButton> getButtons(Object value) { List<MListButton> buttons = new ArrayList<MListButton>(super.getButtons(value)); buttons.add(reload); OWLOntology ont = ((OntologyListItem)value).ont; URI ontologyPhysicalURI = owlEditorKit.getModelManager().getOntologyPhysicalURI(ont); if (UIUtil.isLocalFile(ontologyPhysicalURI)){ buttons.add(showFile); } if (owlEditorKit.getModelManager().getDirtyOntologies().contains(ont)){ buttons.add(saveFile); } return buttons; } };
private JList createRecentList() { DefaultListModel model = new DefaultListModel(); RecentEditorKitManager man = RecentEditorKitManager.getInstance(); for (EditorKitDescriptor descriptor : man.getDescriptors()) { final URI uri = descriptor.getURI(OWLEditorKit.URI_KEY); if (uri.getScheme() != null && UIUtil.isLocalFile(uri)){ model.addElement(descriptor); } } final JList list = new JList(model); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addListSelectionListener(event -> { String path = ((EditorKitDescriptor)list.getSelectedValue()).getLabel(); filePathPanel.setPath(path); }); return list; }
public void setOntology(OWLOntology ont){ final OWLModelManager mngr = owlEditorKit.getModelManager(); String label = OWLOntologyCellRenderer.getOntologyLabelText(ont, mngr); ontURILabel.setText(label); //2012.02.01 hilpold use Owl Icon Provider OWLIconProvider owlICP = owlEditorKit.getWorkspace().getOWLIconProvider(); Icon ontIcon = owlICP.getIcon(ont); ontURILabel.setIcon(ontIcon); final URI physicalURI = mngr.getOntologyPhysicalURI(ont); if (UIUtil.isLocalFile(physicalURI)) { locURILabel.setText(new File(physicalURI).toString()); } else { locURILabel.setText(physicalURI.toString()); } } }
private void handleShowFile(){ if (ontologiesPanel.getSelectedValue() instanceof OntologyListItem) { OntologyListItem item = (OntologyListItem) ontologiesPanel.getSelectedValue(); OWLOntology ont = item.ont; URI physicalURI = owlEditorKit.getOWLModelManager().getOntologyPhysicalURI(ont); if (!UIUtil.isLocalFile(physicalURI)) { throw new IllegalArgumentException("URI must be a file URI!"); } try { FileUtils.showFile(new File(physicalURI)); } catch (IOException ex) { logger.error("An error occurred whilst attempting to show a file in the Operating System.", ex); } } }
public void setOntology(OWLOntology ont){ final OWLModelManager mngr = owlEditorKit.getModelManager(); String label = OWLOntologyCellRenderer.getOntologyLabelText(ont, mngr); ontURILabel.setText(label); //2012.02.01 hilpold use Owl Icon Provider OWLIconProvider owlICP = owlEditorKit.getWorkspace().getOWLIconProvider(); Icon ontIcon = owlICP.getIcon(ont); ontURILabel.setIcon(ontIcon); final URI physicalURI = mngr.getOntologyPhysicalURI(ont); if (UIUtil.isLocalFile(physicalURI)) { locURILabel.setText(new File(physicalURI).toString()); } else { locURILabel.setText(physicalURI.toString()); } } }
protected List<MListButton> getButtons(Object value) { List<MListButton> buttons = new ArrayList<>(super.getButtons(value)); buttons.add(new ReloadMListButton(e -> handleReload())); OWLOntology ont = ((OntologyListItem)value).ont; URI ontologyPhysicalURI = owlEditorKit.getModelManager().getOntologyPhysicalURI(ont); if (UIUtil.isLocalFile(ontologyPhysicalURI)){ buttons.add(new ShowFileMListButton(e -> handleShowFile())); } if (owlEditorKit.getModelManager().getDirtyOntologies().contains(ont)){ buttons.add(new SaveMListButton(e -> handleSave())); } return buttons; } };
private void handleShowFile(){ if (ontologiesPanel.getSelectedValue() instanceof OntologyListItem) { OntologyListItem item = (OntologyListItem) ontologiesPanel.getSelectedValue(); OWLOntology ont = item.ont; URI physicalURI = owlEditorKit.getOWLModelManager().getOntologyPhysicalURI(ont); if (!UIUtil.isLocalFile(physicalURI)) { throw new IllegalArgumentException("URI must be a file URI!"); } try { FileUtils.showFile(new File(physicalURI)); } catch (IOException ex) { logger.error("An error occurred whilst attempting to show a file in the Operating System.", ex); } } }
protected List<MListButton> getButtons(Object value) { List<MListButton> buttons = new ArrayList<>(super.getButtons(value)); buttons.add(new ReloadMListButton(e -> handleReload())); OWLOntology ont = ((OntologyListItem)value).ont; URI ontologyPhysicalURI = owlEditorKit.getModelManager().getOntologyPhysicalURI(ont); if (UIUtil.isLocalFile(ontologyPhysicalURI)){ buttons.add(new ShowFileMListButton(e -> handleShowFile())); } if (owlEditorKit.getModelManager().getDirtyOntologies().contains(ont)){ buttons.add(new SaveMListButton(e -> handleSave())); } return buttons; } };
private void addImportMapping(OWLOntology ontology, IRI importLocation, IRI physicalLocation) { OWLOntologyManager manager = ontology.getOWLOntologyManager(); manager.getIRIMappers().add(new SimpleIRIMapper(importLocation, physicalLocation)); IRI importersDocumentLocation = manager.getOntologyDocumentIRI(ontology); if (UIUtil.isLocalFile(importersDocumentLocation.toURI())) { File f = new File(importersDocumentLocation.toURI()); XMLCatalog catalog = editorKit.getModelManager().addRootFolder(f.getParentFile()); URI physicalUri = CatalogUtilities.relativize(physicalLocation.toURI(), catalog); catalog.addEntry(0, new UriEntry("Imports Wizard Entry", catalog, importLocation.toURI().toString(), physicalUri, null)); try { CatalogUtilities.save(catalog, OntologyCatalogManager.getCatalogFile(f.getParentFile())); } catch (IOException e) { logger.warn("An error occurred whilst saving the catalog file: {}", e); } } }
private void addImportMapping(OWLOntology ontology, IRI importLocation, IRI physicalLocation) { OWLOntologyManager manager = ontology.getOWLOntologyManager(); manager.getIRIMappers().add(new SimpleIRIMapper(importLocation, physicalLocation)); IRI importersDocumentLocation = manager.getOntologyDocumentIRI(ontology); if (UIUtil.isLocalFile(importersDocumentLocation.toURI())) { File f = new File(importersDocumentLocation.toURI()); XMLCatalog catalog = editorKit.getModelManager().addRootFolder(f.getParentFile()); URI physicalUri = CatalogUtilities.relativize(physicalLocation.toURI(), catalog); catalog.addEntry(0, new UriEntry("Imports Wizard Entry", catalog, importLocation.toURI().toString(), physicalUri, null)); try { CatalogUtilities.save(catalog, OntologyCatalogManager.getCatalogFile(f.getParentFile())); } catch (IOException e) { logger.warn("An error occurred whilst saving the catalog file: {}", e); } } }
private void addImportMapping(OWLOntology ontology, IRI importLocation, IRI physicalLocation) { OWLOntologyManager manager = ontology.getOWLOntologyManager(); manager.addIRIMapper(new SimpleIRIMapper(importLocation, physicalLocation)); try { IRI importersDocumentLocation = manager.getOntologyDocumentIRI(ontology); if (UIUtil.isLocalFile(importersDocumentLocation.toURI())) { File f = new File(importersDocumentLocation.toURI()); XMLCatalog catalog = eKit.getModelManager().addRootFolder(f.getParentFile()); URI physicalUri = CatalogUtilities.relativize(physicalLocation.toURI(), catalog); catalog.addEntry(0, new UriEntry("Imports Wizard Entry", catalog, importLocation.toURI().toString(), physicalUri, null)); CatalogUtilities.save(catalog, OntologyCatalogManager.getCatalogFile(f.getParentFile())); } } catch (Throwable t) { ProtegeApplication.getErrorLog().logError(t); } }