Search in sources :

Example 16 with EngineMetaInterface

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;
}
Also used : AbstractMeta(org.pentaho.di.base.AbstractMeta) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) SWTException(org.eclipse.swt.SWTException) KettleRowException(org.pentaho.di.core.exception.KettleRowException) FileSystemException(org.apache.commons.vfs2.FileSystemException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleAuthException(org.pentaho.di.core.exception.KettleAuthException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) LifecycleException(org.pentaho.di.core.lifecycle.LifecycleException) KettleMissingPluginsException(org.pentaho.di.core.exception.KettleMissingPluginsException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) KettleException(org.pentaho.di.core.exception.KettleException) MalformedURLException(java.net.MalformedURLException) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 17 with EngineMetaInterface

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();
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) TransMeta(org.pentaho.di.trans.TransMeta) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SharedObjects(org.pentaho.di.shared.SharedObjects) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) SWTException(org.eclipse.swt.SWTException) KettleRowException(org.pentaho.di.core.exception.KettleRowException) FileSystemException(org.apache.commons.vfs2.FileSystemException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleAuthException(org.pentaho.di.core.exception.KettleAuthException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) LifecycleException(org.pentaho.di.core.lifecycle.LifecycleException) KettleMissingPluginsException(org.pentaho.di.core.exception.KettleMissingPluginsException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) KettleException(org.pentaho.di.core.exception.KettleException) MalformedURLException(java.net.MalformedURLException) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 18 with EngineMetaInterface

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;
}
Also used : EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface)

Example 19 with EngineMetaInterface

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();
}
Also used : AbstractGraph(org.pentaho.di.ui.spoon.AbstractGraph) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry)

Example 20 with EngineMetaInterface

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();
}
Also used : JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry)

Aggregations

EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)21 KettleException (org.pentaho.di.core.exception.KettleException)9 TransMeta (org.pentaho.di.trans.TransMeta)7 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)5 TransGraph (org.pentaho.di.ui.spoon.trans.TransGraph)5 MalformedURLException (java.net.MalformedURLException)4 FileSystemException (org.apache.commons.vfs2.FileSystemException)4 SWTException (org.eclipse.swt.SWTException)4 Test (org.junit.Test)4 KettleAuthException (org.pentaho.di.core.exception.KettleAuthException)4 KettleFileException (org.pentaho.di.core.exception.KettleFileException)4 KettleMissingPluginsException (org.pentaho.di.core.exception.KettleMissingPluginsException)4 KettleRowException (org.pentaho.di.core.exception.KettleRowException)4 KettleValueException (org.pentaho.di.core.exception.KettleValueException)4 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)4 LifecycleException (org.pentaho.di.core.lifecycle.LifecycleException)4 JobMeta (org.pentaho.di.job.JobMeta)4 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)4 Repository (org.pentaho.di.repository.Repository)4 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)4