String currentFileBeingEdited = editor.getFile().getLocation().toString(); currentFileBeingEdited = editor.getDescriptorRelativePath(currentFileBeingEdited); if (currentFileBeingEdited.equals(imp.getLocation())) { Utility .popMessage( .format( "The import {0} is the same as the current file being edited. A file can''t be imported into itself.", new Object[] { imp.getLocation() }), MessageDialog.ERROR); return true; Utility.popMessage("Error - duplicate import", MessageFormat.format( "The import {0} is already present", new Object[] { null != imp.getName() ? imp .getName() : imp.getLocation() }), MessageDialog.ERROR); return true;
/** * adds a tableItem to the table. * * @param o the o * @param keyName the key name */ private void addFile(Object o, String keyName) { Import impItem = (Import) o; String fileName = impItem.getLocation(); if (null == fileName || (0 == fileName.length())) fileName = impItem.getName(); // create new TableItem TableItem item = new TableItem(filesTable, SWT.NONE); item.setImage(TAEConfiguratorPlugin.getImage(TAEConfiguratorPlugin.IMAGE_ANNOTATOR)); item.setText(0, fileName); item.setText(1, keyName); }
String fileName = null; if (null != fcdImport) { fileName = fcdImport.getLocation(); if (null == fileName || (0 == fileName.length())) fileName = fcdImport.getName();
CpeCollectionReader[] collRdrs = currentCpeDesc.getAllCollectionCollectionReaders(); for (CpeCollectionReader collReader : collRdrs) { File descFile = new File(rootFolder + System.getProperty("file.separator") + collReader.getDescriptor().getImport().getLocation()); CollectionReaderDescription crd = UIMAFramework.getXMLParser().parseCollectionReaderDescription(new XMLInputSource(descFile)); TypeSystemDescription typeSystem = crd.getCollectionReaderMetaData().getTypeSystem(); File descFile = new File(rootFolder + System.getProperty("file.separator") + casProcessor.getCpeComponentDescriptor().getImport().getLocation()); AnalysisEngineDescription aed = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(new XMLInputSource(descFile)); TypeSystemDescription typeSystem = aed.getAnalysisEngineMetaData().getTypeSystem();
CpeCollectionReader[] collRdrs = currentCpeDesc.getAllCollectionCollectionReaders(); for (CpeCollectionReader collReader : collRdrs) { File descFile = new File(rootFolder + System.getProperty("file.separator") + collReader.getDescriptor().getImport().getLocation()); CollectionReaderDescription crd = UIMAFramework.getXMLParser().parseCollectionReaderDescription(new XMLInputSource(descFile)); TypeSystemDescription typeSystem = crd.getCollectionReaderMetaData().getTypeSystem(); for (CpeCasProcessor casProcessor : cpeCasProcessors) { File descFile = new File(rootFolder + System.getProperty("file.separator") + casProcessor.getCpeComponentDescriptor().getImport().getLocation()); AnalysisEngineDescription aed = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(new XMLInputSource(descFile)); TypeSystemDescription typeSystem = aed.getAnalysisEngineMetaData().getTypeSystem();
@Override public void refresh() { super.refresh(); importTable.removeAll(); if (isAppropriate()) { Import[] importItems = getModelImportArray(); if (importItems != null) { for (int i = 0; i < importItems.length; i++) { if (importItems[i] != null) { TableItem tableItem = new TableItem(importTable, SWT.NONE); if (importItems[i].getLocation() != null) { tableItem.setText(0, TABLE_INDICATOR_BY_LOCATION); tableItem.setText(1, importItems[i].getLocation()); } else { tableItem.setText(0, TABLE_INDICATOR_BY_NAME); tableItem.setText(1, importItems[i].getName()); } } } packTable(importTable); } } enable(); }