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);
}
}
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();
}
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();
}
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);
}
}
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);
}
}
}
Aggregations