use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class Spoon method zoomIn.
public void zoomIn() {
TransGraph transGraph = getActiveTransGraph();
if (transGraph != null) {
transGraph.zoomIn();
}
JobGraph jobGraph = getActiveJobGraph();
if (jobGraph != null) {
jobGraph.zoomIn();
}
}
use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class Spoon method enableMenus.
public void enableMenus() {
boolean disableTransMenu = getActiveTransformation() == null;
boolean disableJobMenu = getActiveJob() == null;
boolean disableMetaMenu = getActiveMeta() == null;
boolean isRepositoryRunning = rep != null;
boolean disablePreviewButton = true;
String activePerspectiveId = null;
SpoonPerspectiveManager manager = SpoonPerspectiveManager.getInstance();
if (manager != null && manager.getActivePerspective() != null) {
activePerspectiveId = manager.getActivePerspective().getId();
}
boolean etlPerspective = false;
if (activePerspectiveId != null && activePerspectiveId.length() > 0) {
etlPerspective = activePerspectiveId.equals(MainSpoonPerspective.ID);
}
TransGraph transGraph = getActiveTransGraph();
if (transGraph != null) {
disablePreviewButton = !(transGraph.isRunning() && !transGraph.isHalting());
}
boolean disableSave = true;
boolean disableDatabaseExplore = true;
TabItemInterface currentTab = getActiveTabitem();
if (currentTab != null && currentTab.canHandleSave()) {
disableSave = !currentTab.hasContentChanged();
}
EngineMetaInterface meta = getActiveMeta();
if (meta != null) {
disableSave = !meta.canSave();
disableDatabaseExplore = false;
}
org.pentaho.ui.xul.dom.Document doc;
if (mainSpoonContainer != null) {
doc = mainSpoonContainer.getDocumentRoot();
if (doc != null) {
if (etlPerspective) {
doc.getElementById("file").setVisible(etlPerspective);
doc.getElementById("edit").setVisible(etlPerspective);
doc.getElementById("view").setVisible(etlPerspective);
doc.getElementById("action").setVisible(etlPerspective);
doc.getElementById("tools").setVisible(etlPerspective);
doc.getElementById("help").setVisible(etlPerspective);
doc.getElementById("help-welcome").setVisible(etlPerspective);
doc.getElementById("help-plugins").setVisible(true);
}
// Only enable certain menu-items if we need to.
disableMenuItem(doc, "file-new-database", disableTransMenu && disableJobMenu);
disableMenuItem(doc, "menubar-new-database", disableTransMenu && disableJobMenu);
disableMenuItem(doc, "file-save", disableTransMenu && disableJobMenu && disableMetaMenu || disableSave);
disableMenuItem(doc, "toolbar-file-save", disableTransMenu && disableJobMenu && disableMetaMenu || disableSave);
disableMenuItem(doc, "file-save-as", disableTransMenu && disableJobMenu && disableMetaMenu || disableSave);
disableMenuItem(doc, "toolbar-file-save-as", disableTransMenu && disableJobMenu && disableMetaMenu || disableSave);
disableMenuItem(doc, "file-save-as-vfs", disableTransMenu && disableJobMenu && disableMetaMenu);
disableMenuItem(doc, "file-close", disableTransMenu && disableJobMenu && disableMetaMenu);
disableMenuItem(doc, "file-print", disableTransMenu && disableJobMenu);
disableMenuItem(doc, "file-export-to-xml", disableTransMenu && disableJobMenu);
disableMenuItem(doc, "file-export-all-to-xml", disableTransMenu && disableJobMenu);
// Disable the undo and redo menus if there is no active transformation
// or active job
// DO NOT ENABLE them otherwise ... leave that to the undo/redo settings
//
disableMenuItem(doc, UNDO_MENU_ITEM, disableTransMenu && disableJobMenu);
disableMenuItem(doc, REDO_MENU_ITEM, disableTransMenu && disableJobMenu);
disableMenuItem(doc, "edit-clear-selection", disableTransMenu && disableJobMenu);
disableMenuItem(doc, "edit-select-all", disableTransMenu && disableJobMenu);
updateSettingsMenu(doc, disableTransMenu, disableJobMenu);
disableMenuItem(doc, "edit-settings", disableTransMenu && disableJobMenu && disableMetaMenu);
// View Menu
((XulMenuitem) doc.getElementById("view-results")).setSelected(isExecutionResultsPaneVisible());
disableMenuItem(doc, "view-results", transGraph == null && disableJobMenu);
disableMenuItem(doc, "view-zoom-in", disableTransMenu && disableJobMenu);
disableMenuItem(doc, "view-zoom-out", disableTransMenu && disableJobMenu);
disableMenuItem(doc, "view-zoom-100pct", disableTransMenu && disableJobMenu);
// Transformations
disableMenuItem(doc, "process-run", disableTransMenu && disablePreviewButton && disableJobMenu);
disableMenuItem(doc, "process-run-options", disableTransMenu && disablePreviewButton && disableJobMenu);
disableMenuItem(doc, "trans-replay", disableTransMenu && disablePreviewButton);
disableMenuItem(doc, "trans-preview", disableTransMenu && disablePreviewButton);
disableMenuItem(doc, "trans-debug", disableTransMenu && disablePreviewButton);
disableMenuItem(doc, "trans-verify", disableTransMenu);
disableMenuItem(doc, "trans-impact", disableTransMenu);
disableMenuItem(doc, "trans-get-sql", disableTransMenu);
disableMenuItem(doc, "trans-last-impact", disableTransMenu);
// Tools
disableMenuItem(doc, "repository-explore", !isRepositoryRunning);
disableMenuItem(doc, "tools-dabase-explore", !isRepositoryRunning && disableDatabaseExplore);
disableMenuItem(doc, "repository-clear-shared-object-cache", !isRepositoryRunning);
disableMenuItem(doc, "toolbar-expore-repository", !isRepositoryRunning);
disableMenuItem(doc, "repository-export-all", !isRepositoryRunning);
disableMenuItem(doc, "repository-import-directory", !isRepositoryRunning);
disableMenuItem(doc, "trans-last-preview", !isRepositoryRunning || disableTransMenu);
// Wizard
disableMenuItem(doc, "wizard-connection", disableTransMenu && disableJobMenu);
disableMenuItem(doc, "wizard-copy-table", disableTransMenu && disableJobMenu);
disableMenuItem(doc, "wizard-copy-tables", isRepositoryRunning && disableTransMenu && disableJobMenu);
disableMenuItem(doc, "database-inst-dependancy", !isRepositoryRunning);
SpoonPluginManager.getInstance().notifyLifecycleListeners(SpoonLifeCycleEvent.MENUS_REFRESHED);
MenuManager menuManager = getMenuBarManager();
menuManager.updateAll(true);
// What steps & plugins to show?
refreshCoreObjects();
fireMenuControlers();
}
}
}
use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class Spoon method refreshGraph.
public void refreshGraph() {
if (shell.isDisposed()) {
return;
}
TabItem tabItem = tabfolder.getSelected();
if (tabItem == null) {
return;
}
TabMapEntry tabMapEntry = delegates.tabs.getTab(tabItem);
if (tabMapEntry != null) {
if (tabMapEntry.getObject() instanceof TransGraph) {
TransGraph transGraph = (TransGraph) tabMapEntry.getObject();
transGraph.redraw();
}
if (tabMapEntry.getObject() instanceof JobGraph) {
JobGraph jobGraph = (JobGraph) tabMapEntry.getObject();
jobGraph.redraw();
}
}
setShellText();
}
use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class Spoon method paste.
public void paste() {
String clipContent = fromClipboard();
if (clipContent != null) {
//
try {
Document document = XMLHandler.loadXMLString(clipContent);
boolean transformation = XMLHandler.getSubNode(document, TransMeta.XML_TAG) != null;
boolean job = XMLHandler.getSubNode(document, JobMeta.XML_TAG) != null;
boolean steps = XMLHandler.getSubNode(document, Spoon.XML_TAG_TRANSFORMATION_STEPS) != null;
boolean jobEntries = XMLHandler.getSubNode(document, Spoon.XML_TAG_JOB_JOB_ENTRIES) != null;
if (transformation) {
pasteTransformation();
} else if (job) {
pasteJob();
} else if (steps) {
TransGraph transGraph = getActiveTransGraph();
if (transGraph != null && transGraph.getLastMove() != null) {
pasteXML(transGraph.getManagedObject(), clipContent, transGraph.getLastMove());
}
} else if (jobEntries) {
JobGraph jobGraph = getActiveJobGraph();
if (jobGraph != null && jobGraph.getLastMove() != null) {
pasteXML(jobGraph.getManagedObject(), clipContent, jobGraph.getLastMove());
}
}
} catch (KettleXMLException e) {
log.logError("Unable to paste", e);
}
}
}
use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class Spoon method showLastTransCheck.
/**
* Show the remarks of the last transformation check that was run.
*
* @see #checkTrans()
*/
public void showLastTransCheck() {
TransMeta transMeta = getActiveTransformation();
if (transMeta == null) {
return;
}
TransGraph transGraph = delegates.trans.findTransGraphOfTransformation(transMeta);
if (transGraph == null) {
return;
}
CheckResultDialog crd = new CheckResultDialog(transMeta, shell, SWT.NONE, transGraph.getRemarks());
String stepName = crd.open();
if (stepName != null) {
// Go to the indicated step!
StepMeta stepMeta = transMeta.findStep(stepName);
if (stepMeta != null) {
delegates.steps.editStep(transMeta, stepMeta);
}
}
}
Aggregations