Search in sources :

Example 16 with GuiToolbarElement

use of org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement in project hop by apache.

the class MetadataExplorerDialog method refreshTree.

@GuiToolbarElement(root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ITEM_REFRESH, toolTip = "Refresh", image = "ui/images/refresh.svg")
public void refreshTree() {
    try {
        tree.removeAll();
        IHopMetadataProvider metadataProvider = HopGui.getInstance().getMetadataProvider();
        // top level: object key
        // 
        List<Class<IHopMetadata>> metadataClasses = metadataProvider.getMetadataClasses();
        for (Class<IHopMetadata> metadataClass : metadataClasses) {
            HopMetadata hopMetadata = HopMetadataUtil.getHopMetadataAnnotation(metadataClass);
            Image image = SwtSvgImageUtil.getImage(shell.getDisplay(), metadataClass.getClassLoader(), hopMetadata.image(), ConstUi.ICON_SIZE, ConstUi.ICON_SIZE);
            TreeItem elementTypeItem = new TreeItem(tree, SWT.NONE);
            elementTypeItem.setImage(image);
            elementTypeItem.setText(0, Const.NVL(hopMetadata.key(), ""));
            elementTypeItem.setText(1, Const.NVL(hopMetadata.name(), ""));
            // level 1: object names
            // 
            IHopMetadataSerializer<IHopMetadata> serializer = metadataProvider.getSerializer(metadataClass);
            List<String> names = serializer.listObjectNames();
            Collections.sort(names);
            for (final String name : names) {
                TreeItem elementItem = new TreeItem(elementTypeItem, SWT.NONE);
                elementItem.setText(1, Const.NVL(name, ""));
                elementItem.addListener(SWT.Selection, event -> log.logBasic("Selected : " + name));
                elementItem.setFont(GuiResource.getInstance().getFontBold());
            }
        }
        TreeUtil.setOptimalWidthOnColumns(tree);
        TreeMemory.setExpandedFromMemory(tree, METADATA_EXPLORER_DIALOG_TREE);
    } catch (Exception e) {
        new ErrorDialog(shell, "Error", "Error refreshing metadata tree", e);
    }
}
Also used : IHopMetadata(org.apache.hop.metadata.api.IHopMetadata) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) Image(org.eclipse.swt.graphics.Image) IHopMetadataProvider(org.apache.hop.metadata.api.IHopMetadataProvider) HopMetadata(org.apache.hop.metadata.api.HopMetadata) IHopMetadata(org.apache.hop.metadata.api.IHopMetadata) GuiToolbarElement(org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement)

Example 17 with GuiToolbarElement

use of org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement in project hop by apache.

the class HopGuiPipelineGridDelegate method showHideInactive.

@GuiToolbarElement(root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ICON_SHOW_HIDE_INACTIVE, toolTip = "i18n:org.apache.hop.ui.hopgui:PipelineLog.Button.ShowOnlyActiveTransforms", image = "ui/images/show.svg")
public void showHideInactive() {
    hideInactiveTransforms = !hideInactiveTransforms;
    ToolItem toolItem = toolbarWidget.findToolItem(TOOLBAR_ICON_SHOW_HIDE_INACTIVE);
    if (toolItem != null) {
        if (hideInactiveTransforms) {
            toolItem.setImage(GuiResource.getInstance().getImageHide());
        } else {
            toolItem.setImage(GuiResource.getInstance().getImageShow());
        }
    }
    refreshView();
}
Also used : ToolItem(org.eclipse.swt.widgets.ToolItem) GuiToolbarElement(org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement)

Example 18 with GuiToolbarElement

use of org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement in project hop by apache.

the class HopGuiPipelineGridDelegate method showHideSelected.

@GuiToolbarElement(root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ICON_SHOW_HIDE_SELECTED, toolTip = "i18n:org.apache.hop.ui.hopgui:PipelineLog.Button.ShowOnlySelectedTransforms", image = "ui/images/show-all.svg")
public void showHideSelected() {
    showSelectedTransforms = !showSelectedTransforms;
    ToolItem toolItem = toolbarWidget.findToolItem(TOOLBAR_ICON_SHOW_HIDE_SELECTED);
    if (toolItem != null) {
        if (showSelectedTransforms) {
            toolItem.setImage(GuiResource.getInstance().getImageShowSelected());
        } else {
            toolItem.setImage(GuiResource.getInstance().getImageShowAll());
        }
    }
    refreshView();
}
Also used : ToolItem(org.eclipse.swt.widgets.ToolItem) GuiToolbarElement(org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement)

Example 19 with GuiToolbarElement

use of org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement in project hop by apache.

the class HopGuiPipelineGraph method checkPipeline.

@GuiToolbarElement(root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ITEM_CHECK, toolTip = "i18n:org.apache.hop.ui.hopgui:HopGui.Tooltip.VerifyPipeline", image = "ui/images/check-pipeline.svg", separator = true)
public void checkPipeline() {
    try {
        CheckPipelineProgressDialog dialog = new CheckPipelineProgressDialog(getShell(), variables, pipelineMeta, getRemarks(), false);
        dialog.open();
        CheckResultDialog crd = new CheckResultDialog(getShell(), getRemarks());
        String transformName = crd.open();
        if (transformName != null) {
            // Go to the indicated transform
            // 
            TransformMeta transformMeta = pipelineMeta.findTransform(transformName);
            if (transformMeta != null) {
                pipelineTransformDelegate.editTransform(pipelineMeta, transformMeta);
            }
        }
    } catch (Exception e) {
        new ErrorDialog(getShell(), "Error", "Error verifying pipeline", e);
    }
}
Also used : CheckPipelineProgressDialog(org.apache.hop.ui.hopgui.dialog.CheckPipelineProgressDialog) HopException(org.apache.hop.core.exception.HopException) InvocationTargetException(java.lang.reflect.InvocationTargetException) HopTransformException(org.apache.hop.core.exception.HopTransformException) HopValueException(org.apache.hop.core.exception.HopValueException) GuiToolbarElement(org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement)

Example 20 with GuiToolbarElement

use of org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement in project hop by apache.

the class MetadataPerspective method onDeleteMetadata.

@GuiToolbarElement(root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ITEM_DELETE, toolTip = "i18n::MetadataPerspective.ToolbarElement.Delete.Tooltip", image = "ui/images/delete.svg")
public void onDeleteMetadata() {
    if (tree.getSelectionCount() != 1) {
        return;
    }
    TreeItem treeItem = tree.getSelection()[0];
    if (treeItem != null && treeItem.getParentItem() != null) {
        String objectKey = (String) treeItem.getParentItem().getData();
        String objectName = treeItem.getText(0);
        try {
            MetadataManager<IHopMetadata> manager = getMetadataManager(objectKey);
            manager.deleteMetadata(objectName);
            refresh();
            updateSelection();
        } catch (Exception e) {
            new ErrorDialog(getShell(), "Error", "Error delete metadata", e);
        }
    }
}
Also used : IHopMetadata(org.apache.hop.metadata.api.IHopMetadata) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) HopException(org.apache.hop.core.exception.HopException) GuiToolbarElement(org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement)

Aggregations

GuiToolbarElement (org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement)39 ErrorDialog (org.apache.hop.ui.core.dialog.ErrorDialog)23 HopException (org.apache.hop.core.exception.HopException)21 HopGui (org.apache.hop.ui.hopgui.HopGui)12 Combo (org.eclipse.swt.widgets.Combo)10 InvocationTargetException (java.lang.reflect.InvocationTargetException)9 ProjectsConfig (org.apache.hop.projects.config.ProjectsConfig)9 IOException (java.io.IOException)8 FileObject (org.apache.commons.vfs2.FileObject)7 ProjectConfig (org.apache.hop.projects.project.ProjectConfig)7 IHopMetadata (org.apache.hop.metadata.api.IHopMetadata)6 PipelineMeta (org.apache.hop.pipeline.PipelineMeta)6 LifecycleEnvironment (org.apache.hop.projects.environment.LifecycleEnvironment)6 FileSystemException (org.apache.commons.vfs2.FileSystemException)5 HopPluginException (org.apache.hop.core.exception.HopPluginException)5 HopTransformException (org.apache.hop.core.exception.HopTransformException)5 HopValueException (org.apache.hop.core.exception.HopValueException)5 GuiKeyboardShortcut (org.apache.hop.core.gui.plugin.key.GuiKeyboardShortcut)5 GuiOsxKeyboardShortcut (org.apache.hop.core.gui.plugin.key.GuiOsxKeyboardShortcut)5 Project (org.apache.hop.projects.project.Project)5