use of org.apache.hop.ui.hopgui.perspective.IHopPerspective in project hop by apache.
the class HopGuiFileDelegate method fileOpenRecent.
/**
* Show all the recent files in a new dialog...
*/
public void fileOpenRecent() {
// Get the recent files for the active perspective...
//
IHopPerspective perspective = hopGui.getActivePerspective();
try {
// Let's limit ourselves to 100 operations...
//
List<AuditEvent> events = AuditManager.findEvents(HopNamespace.getNamespace(), "file", "open", 100, true);
Set<String> filenames = new HashSet<>();
List<RowMetaAndData> rows = new ArrayList<>();
IRowMeta rowMeta = new RowMeta();
rowMeta.addValueMeta(new ValueMetaString("filename"));
rowMeta.addValueMeta(new ValueMetaString("operation"));
rowMeta.addValueMeta(new ValueMetaString("date"));
for (AuditEvent event : events) {
String filename = event.getName();
if (!filenames.contains(filename)) {
filenames.add(filename);
String operation = event.getOperation();
String dateString = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(event.getDate());
rows.add(new RowMetaAndData(rowMeta, new Object[] { filename, operation, dateString }));
}
}
SelectRowDialog rowDialog = new SelectRowDialog(hopGui.getShell(), hopGui.getVariables(), SWT.NONE, rows);
rowDialog.setTitle("Select the file to open");
RowMetaAndData row = rowDialog.open();
if (row != null) {
String filename = row.getString("filename", null);
hopGui.fileDelegate.fileOpen(filename);
}
} catch (Exception e) {
new ErrorDialog(hopGui.getShell(), "Error", "Error getting list of recently opened files", e);
}
}
use of org.apache.hop.ui.hopgui.perspective.IHopPerspective in project hop by apache.
the class HopGuiFileDelegate method fileClose.
public boolean fileClose() {
try {
IHopPerspective perspective = hopGui.getActivePerspective();
IHopFileTypeHandler typeHandler = getActiveFileTypeHandler();
IHopFileType fileType = typeHandler.getFileType();
if (fileType.hasCapability(IHopFileType.CAPABILITY_CLOSE)) {
perspective.remove(typeHandler);
}
} catch (Exception e) {
new ErrorDialog(hopGui.getShell(), "Error", "Error saving/closing file", e);
}
return false;
}
use of org.apache.hop.ui.hopgui.perspective.IHopPerspective in project hop by apache.
the class HopGuiFileDelegate method closeAllFiles.
public void closeAllFiles() {
for (IHopPerspective perspective : hopGui.getPerspectiveManager().getPerspectives()) {
List<TabItemHandler> tabItemHandlers = perspective.getItems();
if (tabItemHandlers != null) {
// Copy the list to avoid changing the list we're editing (closing items)
//
List<TabItemHandler> handlers = new ArrayList<>(tabItemHandlers);
for (TabItemHandler tabItemHandler : handlers) {
IHopFileTypeHandler typeHandler = tabItemHandler.getTypeHandler();
typeHandler.close();
}
}
}
}
use of org.apache.hop.ui.hopgui.perspective.IHopPerspective in project hop by apache.
the class HopGui method getActivePipelineGraph.
/**
* Convenience method to pick up the active pipeline graph
*
* @return The active pipeline graph or null if none is active
*/
public static HopGuiPipelineGraph getActivePipelineGraph() {
IHopPerspective activePerspective = HopGui.getInstance().getActivePerspective();
if (!(activePerspective instanceof HopDataOrchestrationPerspective)) {
return null;
}
HopDataOrchestrationPerspective perspective = (HopDataOrchestrationPerspective) activePerspective;
IHopFileTypeHandler typeHandler = perspective.getActiveFileTypeHandler();
if (!(typeHandler instanceof HopGuiPipelineGraph)) {
return null;
}
return (HopGuiPipelineGraph) typeHandler;
}
use of org.apache.hop.ui.hopgui.perspective.IHopPerspective in project hop by apache.
the class HopGui method getActiveWorkflowGraph.
public static HopGuiWorkflowGraph getActiveWorkflowGraph() {
IHopPerspective activePerspective = HopGui.getInstance().getActivePerspective();
if (!(activePerspective instanceof HopDataOrchestrationPerspective)) {
return null;
}
HopDataOrchestrationPerspective perspective = (HopDataOrchestrationPerspective) activePerspective;
IHopFileTypeHandler typeHandler = perspective.getActiveFileTypeHandler();
if (!(typeHandler instanceof HopGuiWorkflowGraph)) {
return null;
}
return (HopGuiWorkflowGraph) typeHandler;
}
Aggregations