public code v1

This commit is contained in:
2026-05-22 11:14:29 +02:00
parent 427197ec5a
commit b8141736eb
28859 changed files with 575079 additions and 0 deletions
@@ -0,0 +1,464 @@
package afryca.workspace.service;
import java.util.List;
import afryca.ase.Function;
import afryca.ase.Module;
import afryca.ase.ModuleBinding;
import afryca.ase.Repository;
import afryca.ase.Snippet;
import afryca.behavior.Attitude;
import afryca.consensusmodel.Configuration;
import afryca.gdmp.GDMP;
import afryca.workspace.Workspace;
/**
* Workspace service interface
*
* @author Sinbad²
* @version 3.0
*/
public interface IWorkspaceService {
/**
* Return workspace
*
* @return Workspace
*/
Workspace getWorkspace();
/**
* Return workspace folder
*
* @return Workspace folder
*/
String getFolder();
/**
* Tests if the application can write in the workspace
*
* @return True if application can write in the workspace. False otherwise
*/
boolean writableWorkspace();
/**
* List workspace problems content
*
* @return Workspace problems content
*/
List<GDMP> listWorkspaceGDMPs();
/**
* List workspace GDMP files
*
* @return Workspace GDMP files names
*/
List<String> listWorkspaceGDMPFiles();
/**
* Remove GDMP
*
* @param gdmp
* GDMP
* @return True if gdmp is removed. False otherwise
*/
boolean removeGDMP(GDMP gdmp);
/**
* Clone GDMP
*
* @param gdmp
* GDMP
* @param file
* New GDMP file name
* @return True if gdmp is cloned. False otherwise
*/
boolean cloneGDMP(GDMP gdmp, String file);
/**
* Import GDMP
*
* @param gdmp
* GDMP
* @param file
* File name
* @return True if gdmp is imported. False otherwise
*/
boolean importGDMP(GDMP gdmp, String file);
/**
* New GDMP
*
* @param gdmp
* GDMP
* @return True if gdmp is created. False otherwise
*/
boolean newGDMP(GDMP gdmp);
/**
* List workspace consensus model configurations
*
* @param id
* Consensus model id
*
* @return List workspace consensus model configurations
*/
List<Configuration> listWorkspaceConfigurations(String id);
/**
* List workspace consensus model configurations files
*
* @return Workspace consensus model configurations files names
*/
List<String> listWorkspaceConfigurationsFiles();
/**
* Check if selected consensus model configuration has changes respect saved
* configuration
*
* @return True if selected consensus model configuration has changes
* respect saved configuration. False otherwise
*/
boolean selectedConfigurationHasChanges();
/**
* Restore selected consensus model configuration
*
* @return True if selected consensus model configuration is restored. False
* otherwise
*/
boolean restoreSelectedConfiguration();
/**
* Check if selected consensus model configuration can be recorded
*
* @return True if consensus model configuration can be recorded. False
* otherwise
*/
boolean selectedConfigurationCanBeRecorded();
/**
* Record consensus model configuration changes
*
* @return True if consensus model configuration changes have been recorded.
* False otherwise
*/
boolean recordSelectedConfigurationChanges();
/**
* Remove consensus model configuration
*
* @param configuration
* Consensus model configuration
* @return True if consensus model configuration is removed. False otherwise
*/
boolean removeConfiguration(Configuration configuration);
/**
* Clone consensus model configuration
*
* @param configuration
* Consensus model configuration
* @param file
* New consensus model configuration file name
* @return True if consensus model configuration is cloned. False otherwise
*/
boolean cloneConfiguration(Configuration configuration, String file);
/**
* Import consensus model configuration
*
* @param configuration
* Consensus model configuration
* @param file
* File name
* @return True if consensus model configuration is imported. False
* otherwise
*/
boolean importConfiguration(Configuration configuration, String file);
/**
* New consensus model configuration
*
* @param configuration
* Consensus model configuration
* @return True if consensus model configuration is created. False otherwise
*/
boolean newConfiguration(Configuration configuration);
/**
* List workspace attitudes
*
* @param id
* Behavior id
*
* @return List workspace attitudes
*/
List<Attitude> listWorkspaceAttitudes(String id);
/**
* List workspace attitudes files
*
* @return Workspace attitudes files names
*/
List<String> listWorkspaceAttitudesFiles();
/**
* Check if selected attitude has changes respect saved attitude
*
* @return True if selected attitude has changes respect saved attitude.
* False otherwise
*/
boolean selectedAttitudeHasChanges();
/**
* Restore selected attitude
*
* @return True if selected attitude is restored. False otherwise
*/
boolean restoreSelectedAttitude();
/**
* Check if selected attitude can be recorded
*
* @return True if attitude can be recorded. False otherwise
*/
boolean selectedAttitudeCanBeRecorded();
/**
* Record attitude changes
*
* @return True if attitude changes have been recorded. False otherwise
*/
boolean recordSelectedAttitudeChanges();
/**
* Remove attitude
*
* @param attitude
* attitude
* @return True if attitude is removed. False otherwise
*/
boolean removeAttitude(Attitude attitude);
/**
* Clone attitude
*
* @param attitude
* attitude
* @param file
* New attitude file name
* @return True if attitude is cloned. False otherwise
*/
boolean cloneAttitude(Attitude attitude, String file);
/**
* Import attitude
*
* @param attitude
* attitude
* @param file
* File name
* @return True if attitude is imported. False otherwise
*/
boolean importAttitude(Attitude attitude, String file);
/**
* New attitude
*
* @param attitude
* attitude
* @return True if attitude is created. False otherwise
*/
boolean newAttitude(Attitude attitude);
/**
* List workspace repositories
*
* @return Workspace repositories
*/
List<Repository> listWorkspaceRepositories();
/**
* List workspace repository files
*
* @return List workspace repository files
*/
List<String> listWorkspaceRepositoryFiles();
/**
* Remove repository
*
* @param repository
* repository
* @return True if repository is removed. False otherwise
*/
boolean removeRepository(Repository repository);
/**
* New repository
*
* @param repository
* repository
* @return True if repository is created. False otherwise
*/
boolean newRepository(Repository repository);
/**
* List workspace snippets
*
* @return Workspace snippets
*/
List<Snippet> listWorkspaceSnippets();
/**
* List workspace snippets
*
* @param repository
* Repository
*
* @return Workspace snippets
*/
List<Snippet> listWorkspaceSnippets(String repository);
/**
* List workspace snippet files
*
* @return List workspace snippet files
*/
List<String> listWorkspaceSnippetFiles();
/**
* Remove snippet
*
* @param snippet
* snippet
* @return True if snippet is removed. False otherwise
*/
boolean removeSnippet(Snippet snippet);
/**
* New snippet
*
* @param snippet
* snippet
* @return True if snippet is created. False otherwise
*/
boolean newSnippet(Snippet snippet);
/**
* List workspace modules
*
* @return Workspace modules
*/
List<Module> listWorkspaceModules();
/**
* List workspace module files
*
* @return List workspace module files
*/
List<String> listWorkspaceModuleFiles();
/**
* Remove module
*
* @param module
* module
* @return True if module is removed. False otherwise
*/
boolean removeModule(Module module);
/**
* New module
*
* @param module
* module
* @return True if module is created. False otherwise
*/
boolean newModule(Module module);
/**
* List workspace functions
*
* @return Workspace functions
*/
List<Function> listWorkspaceFunctions();
/**
* List workspace functions
*
* @param module
* Module
*
* @return Workspace functions
*/
List<Function> listWorkspaceFunctions(String module);
/**
* List workspace function files
*
* @return List workspace function files
*/
List<String> listWorkspaceFunctionFiles();
/**
* Remove function
*
* @param function
* function
* @return True if function is removed. False otherwise
*/
boolean removeFunction(Function function);
/**
* New function
*
* @param function
* function
* @return True if function is created. False otherwise
*/
boolean newFunction(Function function);
/**
* List workspace module bindigns
*
* @return Workspace module bindings
*/
List<ModuleBinding> listWorkspaceModuleBindings();
/**
* List workspace module bindings
*
* @param module
* Module
*
* @return Workspace module bindings
*/
List<ModuleBinding> listWorkspaceModuleBindings(String module);
/**
* List workspace module bindings files
*
* @return List workspace module bindings files
*/
List<String> listWorkspaceModuleBindingsFiles();
/**
* Remove module binding
*
* @param moduleBinding
* Module binding
* @return True if module binding is removed. False otherwise
*/
boolean removeModuleBinding(ModuleBinding moduleBinding);
/**
* New module binding
*
* @param moduleBinding
* module binding
* @return True if module binding is created. False otherwise
*/
boolean newModuleBinding(ModuleBinding moduleBinding);
}
@@ -0,0 +1,26 @@
package afryca.workspace.service.provider;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.MApplication;
import afryca.workspace.service.IWorkspaceService;
/**
* Workspace service context function
*
* @author Sinbad²
* @version 3.0
*/
public class WorkspaceServiceContextFunction extends ContextFunction {
@Override
public Object compute(IEclipseContext context, String contextKey) {
IWorkspaceService workspaceService = ContextInjectionFactory.make(WorkspaceServiceProvider.class, context);
MApplication application = context.get(MApplication.class);
IEclipseContext applicationContext = application.getContext();
applicationContext.set(IWorkspaceService.class, workspaceService);
return workspaceService;
}
}