use of de.janrufmonitor.repository.types.ILocalRepository 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;
}
use of de.janrufmonitor.repository.types.ILocalRepository in project janrufmonitor by tbrandt77.
the class NewEditorAction method getSubActions.
public IAction[] getSubActions() {
List localCallerManagers = getRuntime().getCallerManagerFactory().getTypedCallerManagers(ILocalRepository.class);
this.ensureWriteRepository(localCallerManagers);
IAction[] actions = new IAction[localCallerManagers.size()];
for (int i = 0; i < localCallerManagers.size(); i++) {
actions[i] = new SubAction((ILocalRepository) localCallerManagers.get(i));
}
return actions;
}
use of de.janrufmonitor.repository.types.ILocalRepository 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);
}
use of de.janrufmonitor.repository.types.ILocalRepository in project janrufmonitor by tbrandt77.
the class OpenEditorAction method getSubActions.
public IAction[] getSubActions() {
List localCallManagers = getRuntime().getCallerManagerFactory().getTypedCallerManagers(ILocalRepository.class);
List remoteCallManagers = getRuntime().getCallerManagerFactory().getTypedCallerManagers(IRemoteRepository.class);
IAction[] actions = new IAction[localCallManagers.size() + (remoteCallManagers.size() > 0 ? remoteCallManagers.size() : 0)];
for (int i = 0; i < localCallManagers.size(); i++) {
actions[i] = new LocalAction((ILocalRepository) localCallManagers.get(i));
}
if (remoteCallManagers.size() > 0)
for (int i = 0; i < remoteCallManagers.size(); i++) {
actions[i + localCallManagers.size()] = new RemoteAction((IRemoteRepository) remoteCallManagers.get(i));
}
return actions;
}
use of de.janrufmonitor.repository.types.ILocalRepository in project janrufmonitor by tbrandt77.
the class NewJournalAction method getSubActions.
public IAction[] getSubActions() {
List localCallerManagers = getRuntime().getCallManagerFactory().getTypedCallManagers(ILocalRepository.class);
filterReadOnlyRepositories(localCallerManagers);
IAction[] actions = new IAction[localCallerManagers.size()];
for (int i = 0; i < localCallerManagers.size(); i++) {
actions[i] = new SubAction((ILocalRepository) localCallerManagers.get(i));
}
return actions;
}
Aggregations