use of org.apache.hop.ui.hopgui.file.HopFileTypeRegistry in project hop by apache.
the class HopGuiFileDelegate method fileOpen.
public void fileOpen() {
try {
// Ask for the file name
// Check in the registry for extensions and names...
//
HopFileTypeRegistry fileRegistry = HopFileTypeRegistry.getInstance();
String filename = BaseDialog.presentFileDialog(hopGui.getShell(), fileRegistry.getFilterExtensions(), fileRegistry.getFilterNames(), true);
if (filename == null) {
return;
}
fileOpen(hopGui.getVariables().resolve(filename));
} catch (Exception e) {
new ErrorDialog(hopGui.getShell(), "Error", "Error opening file", e);
}
}
use of org.apache.hop.ui.hopgui.file.HopFileTypeRegistry in project hop by apache.
the class HopGuiFileDelegate method fileOpen.
public IHopFileTypeHandler fileOpen(String filename) throws Exception {
HopFileTypeRegistry fileRegistry = HopFileTypeRegistry.getInstance();
IHopFileType hopFile = fileRegistry.findHopFileType(filename);
if (hopFile == null) {
throw new HopException("We looked at " + fileRegistry.getFileTypes().size() + " different Hop GUI file types but none know how to open file '" + filename + "'");
}
IHopFileTypeHandler fileTypeHandler = hopFile.openFile(hopGui, filename, hopGui.getVariables());
if (fileTypeHandler != null) {
hopGui.handleFileCapabilities(hopFile, fileTypeHandler.hasChanged(), false, false);
// Also save the state of Hop GUI
//
hopGui.auditDelegate.writeLastOpenFiles();
}
return fileTypeHandler;
}
use of org.apache.hop.ui.hopgui.file.HopFileTypeRegistry in project hop by apache.
the class HopGui method getContextHandlers.
/**
* What are the contexts to consider: - the file types registered - the available metadata types
*
* @return The list of context handlers
*/
@Override
public List<IGuiContextHandler> getContextHandlers() {
List<IGuiContextHandler> contextHandlers = new ArrayList<>();
// Get all the file context handlers
//
HopFileTypeRegistry registry = HopFileTypeRegistry.getInstance();
List<IHopFileType> hopFileTypes = registry.getFileTypes();
for (IHopFileType hopFileType : hopFileTypes) {
contextHandlers.addAll(hopFileType.getContextHandlers());
}
// Get all the metadata context handlers...
//
contextHandlers.addAll(new MetadataContext(this, metadataProvider).getContextHandlers());
return contextHandlers;
}
Aggregations