Search in sources :

Example 1 with IHasFilename

use of org.apache.hop.core.file.IHasFilename in project hop by apache.

the class HopGuiPipelineTransformContext method openReferencedObject.

public static final void openReferencedObject(PipelineMeta pipelineMeta, IVariables variables, ITransformMeta iTransformMeta, String objectDescription, int index) {
    HopGui hopGui = HopGui.getInstance();
    try {
        IHasFilename hasFilename = iTransformMeta.loadReferencedObject(index, pipelineMeta.getMetadataProvider(), variables);
        if (hasFilename != null) {
            String filename = variables.resolve(hasFilename.getFilename());
            // Is this object already loaded?
            // 
            HopDataOrchestrationPerspective perspective = HopGui.getDataOrchestrationPerspective();
            TabItemHandler tabItemHandler = perspective.findTabItemHandlerWithFilename(filename);
            if (tabItemHandler != null) {
                perspective.switchToTab(tabItemHandler);
            } else {
                hopGui.fileDelegate.fileOpen(filename);
            }
        }
    } catch (Exception e) {
        new ErrorDialog(hopGui.getShell(), "Error", "Error opening referenced object '" + objectDescription + "'", e);
    }
}
Also used : IHasFilename(org.apache.hop.core.file.IHasFilename) HopDataOrchestrationPerspective(org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) TabItemHandler(org.apache.hop.ui.hopgui.perspective.TabItemHandler) HopGui(org.apache.hop.ui.hopgui.HopGui)

Example 2 with IHasFilename

use of org.apache.hop.core.file.IHasFilename in project hop by apache.

the class HopGuiWorkflowActionContext method openReferencedObject.

public static final void openReferencedObject(WorkflowMeta workflowMeta, IVariables variables, IAction action, String objectDescription, int index) {
    HopGui hopGui = HopGui.getInstance();
    try {
        IHasFilename hasFilename = action.loadReferencedObject(index, workflowMeta.getMetadataProvider(), variables);
        if (hasFilename != null) {
            String filename = variables.resolve(hasFilename.getFilename());
            // Is this object already loaded?
            // 
            HopDataOrchestrationPerspective perspective = HopGui.getDataOrchestrationPerspective();
            TabItemHandler tabItemHandler = perspective.findTabItemHandlerWithFilename(filename);
            if (tabItemHandler != null) {
                perspective.switchToTab(tabItemHandler);
            } else {
                hopGui.fileDelegate.fileOpen(filename);
            }
        }
    } catch (Exception e) {
        new ErrorDialog(hopGui.getShell(), "Error", "Error opening referenced object '" + objectDescription + "'", e);
    }
}
Also used : IHasFilename(org.apache.hop.core.file.IHasFilename) HopDataOrchestrationPerspective(org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) TabItemHandler(org.apache.hop.ui.hopgui.perspective.TabItemHandler) HopGui(org.apache.hop.ui.hopgui.HopGui)

Example 3 with IHasFilename

use of org.apache.hop.core.file.IHasFilename in project hop by apache.

the class HopGuiWorkflowGraph method loadReferencedObject.

protected void loadReferencedObject(ActionMeta actionCopy, int index) {
    try {
        IHasFilename referencedMeta = actionCopy.getAction().loadReferencedObject(index, hopGui.getMetadataProvider(), variables);
        if (referencedMeta == null) {
            // Sorry, nothing loaded
            return;
        }
        IHopFileType fileTypeHandler = hopGui.getPerspectiveManager().findFileTypeHandler(referencedMeta);
        fileTypeHandler.openFile(hopGui, referencedMeta.getFilename(), hopGui.getVariables());
    } catch (Exception e) {
        new ErrorDialog(hopShell(), BaseMessages.getString(PKG, "HopGuiWorkflowGraph.ErrorDialog.FileNotLoaded.Header"), BaseMessages.getString(PKG, "HopGuiWorkflowGraph.ErrorDialog.FileNotLoaded.Message"), e);
    }
}
Also used : IHopFileType(org.apache.hop.ui.hopgui.file.IHopFileType) IHasFilename(org.apache.hop.core.file.IHasFilename) HopException(org.apache.hop.core.exception.HopException)

Aggregations

IHasFilename (org.apache.hop.core.file.IHasFilename)3 ErrorDialog (org.apache.hop.ui.core.dialog.ErrorDialog)2 HopGui (org.apache.hop.ui.hopgui.HopGui)2 TabItemHandler (org.apache.hop.ui.hopgui.perspective.TabItemHandler)2 HopDataOrchestrationPerspective (org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective)2 HopException (org.apache.hop.core.exception.HopException)1 IHopFileType (org.apache.hop.ui.hopgui.file.IHopFileType)1