Search in sources :

Example 1 with IRemoteRepository

use of de.janrufmonitor.repository.types.IRemoteRepository in project janrufmonitor by tbrandt77.

the class LastOpenEditorAction method getLastopenedRepositories.

private List getLastopenedRepositories() {
    List cms = new ArrayList();
    Properties config = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(NAMESPACE);
    String lastOpen = config.getProperty(EditorConfigConst.CFG_LASTOPEN, "");
    if (lastOpen.length() > 0) {
        String[] locm = lastOpen.split(";");
        if (locm != null && locm.length > 0) {
            String l = null;
            for (int i = 0; i < locm.length; i++) {
                l = locm[i];
                if (l.split("%").length == 1) {
                    ICallerManager mgr = getRuntime().getCallerManagerFactory().getCallerManager(l.split("%")[0]);
                    if (mgr != null && mgr.isActive() && mgr.isSupported(IRemoteRepository.class)) {
                        cms.add(new RemoteAction((IRemoteRepository) mgr));
                    }
                    continue;
                }
                if (l.split("%").length == 2) {
                    ICallerManager mgr = getRuntime().getCallerManagerFactory().getCallerManager(l.split("%")[0]);
                    if (mgr != null && mgr.isActive() && mgr.isSupported(ILocalRepository.class)) {
                        if (new File(l.split("%")[1]).exists())
                            cms.add(new LocalAction((ILocalRepository) mgr, l.split("%")[1]));
                    }
                }
            }
        }
    }
    return cms;
}
Also used : IRemoteRepository(de.janrufmonitor.repository.types.IRemoteRepository) ArrayList(java.util.ArrayList) ILocalRepository(de.janrufmonitor.repository.types.ILocalRepository) ArrayList(java.util.ArrayList) List(java.util.List) Properties(java.util.Properties) File(java.io.File) ICallerManager(de.janrufmonitor.repository.ICallerManager)

Example 2 with IRemoteRepository

use of de.janrufmonitor.repository.types.IRemoteRepository in project janrufmonitor by tbrandt77.

the class NewEditorAction method updateLastOpenEditorEntries.

private void updateLastOpenEditorEntries(ICallerManager mgr) {
    List cms = new ArrayList();
    Properties config = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(LastOpenEditorAction.NAMESPACE);
    String lastOpen = config.getProperty(EditorConfigConst.CFG_LASTOPEN, "");
    if (lastOpen.length() > 0) {
        String[] locm = lastOpen.split(";");
        if (locm != null && locm.length > 0) {
            String l = null;
            for (int i = 0; i < locm.length; i++) {
                l = locm[i];
                cms.add(l);
            }
        }
    }
    if (mgr instanceof ILocalRepository) {
        String newcm = mgr.getManagerID() + "%" + ((ILocalRepository) mgr).getFile();
        if (!cms.contains(newcm))
            cms.add(0, newcm);
    }
    if (mgr instanceof IRemoteRepository) {
        String newcm = mgr.getManagerID();
        if (!cms.contains(newcm))
            cms.add(0, newcm);
    }
    cms = cms.subList(0, Math.min(cms.size(), 5));
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < cms.size(); i++) {
        sb.append(cms.get(i));
        sb.append(";");
    }
    config.setProperty(EditorConfigConst.CFG_LASTOPEN, sb.toString());
    getRuntime().getConfigManagerFactory().getConfigManager().setProperties(LastOpenEditorAction.NAMESPACE, config);
    getRuntime().getConfigurableNotifier().notifyByNamespace(LastOpenEditorAction.NAMESPACE);
}
Also used : IRemoteRepository(de.janrufmonitor.repository.types.IRemoteRepository) ArrayList(java.util.ArrayList) ILocalRepository(de.janrufmonitor.repository.types.ILocalRepository) ArrayList(java.util.ArrayList) List(java.util.List) Properties(java.util.Properties)

Example 3 with IRemoteRepository

use of de.janrufmonitor.repository.types.IRemoteRepository in project janrufmonitor by tbrandt77.

the class OpenJournalAction method updateLastOpenJournalEntries.

private void updateLastOpenJournalEntries(ICallManager mgr) {
    List cms = new ArrayList();
    Properties config = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(LastOpenJournalAction.NAMESPACE);
    String lastOpen = config.getProperty(JournalConfigConst.CFG_LASTOPEN, "");
    if (lastOpen.length() > 0) {
        String[] locm = lastOpen.split(";");
        if (locm != null && locm.length > 0) {
            String l = null;
            for (int i = 0; i < locm.length; i++) {
                l = locm[i];
                cms.add(l);
            }
        }
    }
    if (mgr instanceof ILocalRepository) {
        String newcm = mgr.getManagerID() + "%" + ((ILocalRepository) mgr).getFile();
        if (!cms.contains(newcm))
            cms.add(0, newcm);
    }
    if (mgr instanceof IRemoteRepository) {
        String newcm = mgr.getManagerID();
        if (!cms.contains(newcm))
            cms.add(0, newcm);
    }
    cms = cms.subList(0, Math.min(cms.size(), 5));
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < cms.size(); i++) {
        sb.append(cms.get(i));
        sb.append(";");
    }
    config.setProperty(JournalConfigConst.CFG_LASTOPEN, sb.toString());
    getRuntime().getConfigManagerFactory().getConfigManager().setProperties(LastOpenJournalAction.NAMESPACE, config);
    getRuntime().getConfigurableNotifier().notifyByNamespace(Journal.NAMESPACE);
}
Also used : IRemoteRepository(de.janrufmonitor.repository.types.IRemoteRepository) ArrayList(java.util.ArrayList) ILocalRepository(de.janrufmonitor.repository.types.ILocalRepository) ArrayList(java.util.ArrayList) List(java.util.List) Properties(java.util.Properties)

Example 4 with IRemoteRepository

use of de.janrufmonitor.repository.types.IRemoteRepository in project janrufmonitor by tbrandt77.

the class OpenEditorAction method updateLastOpenEditorEntries.

private void updateLastOpenEditorEntries(ICallerManager mgr) {
    List cms = new ArrayList();
    Properties config = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(LastOpenEditorAction.NAMESPACE);
    String lastOpen = config.getProperty(EditorConfigConst.CFG_LASTOPEN, "");
    if (lastOpen.length() > 0) {
        String[] locm = lastOpen.split(";");
        if (locm != null && locm.length > 0) {
            String l = null;
            for (int i = 0; i < locm.length; i++) {
                l = locm[i];
                cms.add(l);
            }
        }
    }
    if (mgr instanceof ILocalRepository) {
        String newcm = mgr.getManagerID() + "%" + ((ILocalRepository) mgr).getFile();
        if (!cms.contains(newcm))
            cms.add(0, newcm);
    }
    if (mgr instanceof IRemoteRepository) {
        String newcm = mgr.getManagerID();
        if (!cms.contains(newcm))
            cms.add(0, newcm);
    }
    cms = cms.subList(0, Math.min(cms.size(), 5));
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < cms.size(); i++) {
        sb.append(cms.get(i));
        sb.append(";");
    }
    config.setProperty(EditorConfigConst.CFG_LASTOPEN, sb.toString());
    getRuntime().getConfigManagerFactory().getConfigManager().setProperties(LastOpenEditorAction.NAMESPACE, config);
    getRuntime().getConfigurableNotifier().notifyByNamespace(LastOpenEditorAction.NAMESPACE);
}
Also used : IRemoteRepository(de.janrufmonitor.repository.types.IRemoteRepository) ArrayList(java.util.ArrayList) ILocalRepository(de.janrufmonitor.repository.types.ILocalRepository) ArrayList(java.util.ArrayList) List(java.util.List) Properties(java.util.Properties)

Example 5 with IRemoteRepository

use of de.janrufmonitor.repository.types.IRemoteRepository in project janrufmonitor by tbrandt77.

the class LastOpenJournalAction method getLastopenedRepositories.

private List getLastopenedRepositories() {
    List cms = new ArrayList();
    Properties config = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(NAMESPACE);
    String lastOpen = config.getProperty(JournalConfigConst.CFG_LASTOPEN, "");
    if (lastOpen.length() > 0) {
        String[] locm = lastOpen.split(";");
        if (locm != null && locm.length > 0) {
            String l = null;
            for (int i = 0; i < locm.length; i++) {
                l = locm[i];
                if (l.split("%").length == 1) {
                    ICallManager mgr = getRuntime().getCallManagerFactory().getCallManager(l.split("%")[0]);
                    if (mgr != null && mgr.isActive() && mgr.isSupported(IRemoteRepository.class)) {
                        cms.add(new RemoteAction((IRemoteRepository) mgr));
                    }
                    continue;
                }
                if (l.split("%").length == 2) {
                    ICallManager mgr = getRuntime().getCallManagerFactory().getCallManager(l.split("%")[0]);
                    if (mgr != null && mgr.isActive() && mgr.isSupported(ILocalRepository.class)) {
                        if (new File(l.split("%")[1]).exists())
                            cms.add(new LocalAction((ILocalRepository) mgr, l.split("%")[1]));
                    }
                }
            }
        }
    }
    return cms;
}
Also used : ICallManager(de.janrufmonitor.repository.ICallManager) IRemoteRepository(de.janrufmonitor.repository.types.IRemoteRepository) ArrayList(java.util.ArrayList) ILocalRepository(de.janrufmonitor.repository.types.ILocalRepository) ArrayList(java.util.ArrayList) List(java.util.List) Properties(java.util.Properties) File(java.io.File)

Aggregations

ILocalRepository (de.janrufmonitor.repository.types.ILocalRepository)6 IRemoteRepository (de.janrufmonitor.repository.types.IRemoteRepository)6 ArrayList (java.util.ArrayList)6 List (java.util.List)6 Properties (java.util.Properties)6 File (java.io.File)2 ICallManager (de.janrufmonitor.repository.ICallManager)1 ICallerManager (de.janrufmonitor.repository.ICallerManager)1