Search in sources :

Example 16 with LastUsedFile

use of org.pentaho.di.core.LastUsedFile in project pentaho-kettle by pentaho.

the class PropsUI method getLastTypes.

public boolean[] getLastTypes() {
    boolean[] retval = new boolean[lastUsedFiles.size()];
    for (int i = 0; i < retval.length; i++) {
        LastUsedFile lastUsedFile = lastUsedFiles.get(i);
        retval[i] = lastUsedFile.isSourceRepository();
    }
    return retval;
}
Also used : Point(org.pentaho.di.core.gui.Point) LastUsedFile(org.pentaho.di.core.LastUsedFile)

Example 17 with LastUsedFile

use of org.pentaho.di.core.LastUsedFile in project pentaho-kettle by pentaho.

the class PropsUI method loadOpenTabFiles.

public void loadOpenTabFiles() {
    openTabFiles = new ArrayList<LastUsedFile>();
    int nr = Const.toInt(properties.getProperty("tabfiles"), 0);
    for (int i = 0; i < nr; i++) {
        String fileType = properties.getProperty("tabtype" + (i + 1), LastUsedFile.FILE_TYPE_TRANSFORMATION);
        String filename = properties.getProperty("tabfile" + (i + 1), "");
        String directory = properties.getProperty("tabdir" + (i + 1), "");
        boolean sourceRepository = YES.equalsIgnoreCase(properties.getProperty("tabrep" + (i + 1), NO));
        String repositoryName = properties.getProperty("tabrepname" + (i + 1));
        boolean isOpened = YES.equalsIgnoreCase(properties.getProperty("tabopened" + (i + 1), NO));
        int openItemTypes = Const.toInt(properties.getProperty("tabopentypes" + (i + 1), "0"), 0);
        openTabFiles.add(new LastUsedFile(fileType, filename, directory, sourceRepository, repositoryName, isOpened, openItemTypes));
    }
}
Also used : LastUsedFile(org.pentaho.di.core.LastUsedFile) Point(org.pentaho.di.core.gui.Point)

Example 18 with LastUsedFile

use of org.pentaho.di.core.LastUsedFile in project pentaho-kettle by pentaho.

the class PropsUI method getLastFileTypes.

public String[] getLastFileTypes() {
    String[] retval = new String[lastUsedFiles.size()];
    for (int i = 0; i < retval.length; i++) {
        LastUsedFile lastUsedFile = lastUsedFiles.get(i);
        retval[i] = lastUsedFile.getFileType();
    }
    return retval;
}
Also used : Point(org.pentaho.di.core.gui.Point) LastUsedFile(org.pentaho.di.core.LastUsedFile)

Example 19 with LastUsedFile

use of org.pentaho.di.core.LastUsedFile in project pentaho-kettle by pentaho.

the class PropsUI method getLastFiles.

public String[] getLastFiles() {
    String[] retval = new String[lastUsedFiles.size()];
    for (int i = 0; i < retval.length; i++) {
        LastUsedFile lastUsedFile = lastUsedFiles.get(i);
        retval[i] = lastUsedFile.getFilename();
    }
    return retval;
}
Also used : Point(org.pentaho.di.core.gui.Point) LastUsedFile(org.pentaho.di.core.LastUsedFile)

Example 20 with LastUsedFile

use of org.pentaho.di.core.LastUsedFile in project pentaho-kettle by pentaho.

the class PropsUI method addLastFile.

/**
 * Add a last opened file to the top of the recently used list.
 *
 * @param fileType         the type of file to use @see LastUsedFile
 * @param filename         The name of the file or transformation
 * @param directory        The repository directory path, null in case lf is an XML file
 * @param sourceRepository True if the file was loaded from repository, false if ld is an XML file.
 * @param repositoryName   The name of the repository the file was loaded from or save to.
 */
public void addLastFile(String fileType, String filename, String directory, boolean sourceRepository, String repositoryName, String username, Date lastOpened) {
    LastUsedFile lastUsedFile = new LastUsedFile(fileType, filename, directory, sourceRepository, repositoryName, username, false, LastUsedFile.OPENED_ITEM_TYPE_MASK_GRAPH, lastOpened);
    int idx = lastUsedFiles.indexOf(lastUsedFile);
    if (idx >= 0) {
        lastUsedFiles.remove(idx);
    }
    // Add it to position 0
    lastUsedFiles.add(0, lastUsedFile);
    // If we have more than Const.MAX_FILE_HIST, top it off
    while (lastUsedFiles.size() > Const.MAX_FILE_HIST) {
        lastUsedFiles.remove(lastUsedFiles.size() - 1);
    }
    addLastRepoFile(lastUsedFile);
}
Also used : LastUsedFile(org.pentaho.di.core.LastUsedFile) Point(org.pentaho.di.core.gui.Point)

Aggregations

LastUsedFile (org.pentaho.di.core.LastUsedFile)25 Point (org.pentaho.di.core.gui.Point)17 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)4 Date (java.util.Date)3 ParseException (java.text.ParseException)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Calendar (java.util.Calendar)2 PropsUI (org.pentaho.di.ui.core.PropsUI)2 ArrayList (java.util.ArrayList)1 ResourceBundle (java.util.ResourceBundle)1 Action (org.eclipse.jface.action.Action)1 FontData (org.eclipse.swt.graphics.FontData)1 RGB (org.eclipse.swt.graphics.RGB)1 KettleException (org.pentaho.di.core.exception.KettleException)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 TransAction (org.pentaho.di.core.undo.TransAction)1 IUser (org.pentaho.di.repository.IUser)1 Repository (org.pentaho.di.repository.Repository)1 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)1 RepositoryMeta (org.pentaho.di.repository.RepositoryMeta)1