use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.
the class Spoon method saveFileAs.
public boolean saveFileAs() throws KettleException {
try {
EngineMetaInterface meta = getActiveMeta();
if (meta != null && AbstractMeta.class.isAssignableFrom(meta.getClass())) {
if (((AbstractMeta) meta).hasMissingPlugins()) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "Spoon.ErrorDialog.MissingPlugin.Error"));
mb.setText(BaseMessages.getString(PKG, "Spoon.ErrorDialog.MissingPlugin.Title"));
mb.open();
return false;
}
}
if (meta != null) {
if (meta.canSave()) {
return saveFileAs(meta);
}
}
} catch (Exception e) {
KettleRepositoryLostException krle = KettleRepositoryLostException.lookupStackStrace(e);
if (krle != null) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.File.Save.Fail.Title"), krle.getPrefaceMessage(), krle);
closeRepository();
} else {
new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.File.Save.Fail.Title"), BaseMessages.getString(PKG, "Spoon.File.Save.Fail.Message"), e);
}
}
return false;
}
use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.
the class Spoon method unShareObject.
protected void unShareObject(SharedObjectInterface sharedObject) {
MessageBox mb = new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_WARNING);
// "Are you sure you want to stop sharing?"
mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.StopSharing.Message"));
// Warning!
mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.StopSharing.Title"));
int answer = mb.open();
if (answer == SWT.YES) {
sharedObject.setShared(false);
EngineMetaInterface meta = getActiveMeta();
try {
if (meta != null) {
SharedObjects sharedObjects = null;
if (meta instanceof TransMeta) {
sharedObjects = ((TransMeta) meta).getSharedObjects();
}
if (meta instanceof JobMeta) {
sharedObjects = ((JobMeta) meta).getSharedObjects();
}
if (sharedObjects != null) {
sharedObjects.removeObject(sharedObject);
sharedObjects.saveToFile();
}
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.ErrorWritingSharedObjects.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.ErrorWritingSharedObjects.Message"), e);
}
refreshTree();
}
}
use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.
the class Spoon method closeFile.
public boolean closeFile(boolean force) {
boolean closed = true;
EngineMetaInterface meta = getActiveMeta();
if (meta != null) {
// If a transformation or job is the current active tab, close it
closed = tabCloseSelected(force);
}
return closed;
}
use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.
the class SpoonTabsDelegate method tabSelected.
public void tabSelected(TabItem item) {
//
for (TabMapEntry entry : tabMap) {
boolean isAbstractGraph = (entry.getObject() instanceof AbstractGraph);
if (item.equals(entry.getTabItem())) {
if (isAbstractGraph) {
EngineMetaInterface meta = entry.getObject().getMeta();
if (meta != null) {
meta.setInternalKettleVariables();
}
if (spoon.getCoreObjectsState() != SpoonInterface.STATE_CORE_OBJECTS_SPOON) {
spoon.refreshCoreObjects();
}
((AbstractGraph) entry.getObject()).setFocus();
}
break;
}
}
// Also refresh the tree
spoon.refreshTree();
// calls also enableMenus() and markTabsChanged()
spoon.setShellText();
}
use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.
the class SpoonTransformationDelegate method tabSelected.
public void tabSelected(TabItem item) {
List<TabMapEntry> collection = spoon.delegates.tabs.getTabs();
//
for (TabMapEntry entry : collection) {
if (item.equals(entry.getTabItem())) {
//
if (entry.getObject() instanceof TransGraph || entry.getObject() instanceof JobGraph) {
EngineMetaInterface meta = entry.getObject().getMeta();
if (meta != null) {
meta.setInternalKettleVariables();
}
if (spoon.getCoreObjectsState() != SpoonInterface.STATE_CORE_OBJECTS_SPOON) {
spoon.refreshCoreObjects();
}
}
}
}
// Also refresh the tree
spoon.refreshTree();
spoon.enableMenus();
}
Aggregations