Bug 543536: [REnv] Add support to add/delete R environments
Change-Id: Ifc31542f19a2219e1df8f27c498a9891fd978d1d
diff --git a/core/org.eclipse.statet.rj.services.core/srcEnv/org/eclipse/statet/rj/renv/core/BasicREnvManager.java b/core/org.eclipse.statet.rj.services.core/srcEnv/org/eclipse/statet/rj/renv/core/BasicREnvManager.java
index d522505..0b0d1c2 100644
--- a/core/org.eclipse.statet.rj.services.core/srcEnv/org/eclipse/statet/rj/renv/core/BasicREnvManager.java
+++ b/core/org.eclipse.statet.rj.services.core/srcEnv/org/eclipse/statet/rj/renv/core/BasicREnvManager.java
@@ -105,6 +105,18 @@
return null;
}
+
+ @Override
+ public void add(final REnvConfiguration rEnvConfig) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void delete(final REnv rEnv) {
+ throw new UnsupportedOperationException();
+ }
+
+
protected boolean isValidId(final String id) {
return ID_PATTERN.matcher(id).matches();
}
diff --git a/core/org.eclipse.statet.rj.services.core/srcEnv/org/eclipse/statet/rj/renv/core/REnvManager.java b/core/org.eclipse.statet.rj.services.core/srcEnv/org/eclipse/statet/rj/renv/core/REnvManager.java
index 95d4f12..f6f5e67 100644
--- a/core/org.eclipse.statet.rj.services.core/srcEnv/org/eclipse/statet/rj/renv/core/REnvManager.java
+++ b/core/org.eclipse.statet.rj.services.core/srcEnv/org/eclipse/statet/rj/renv/core/REnvManager.java
@@ -22,9 +22,43 @@
@NonNullByDefault
public interface REnvManager {
-
+ /**
+ * Returns a list containing all current R environments.
+ *
+ * @return a list containing the handle of all R environments
+ */
ImList<? extends REnv> list();
+ /**
+ * Returns the R environment with the specified id or name.
+ *
+ * <p>The name is only considered, if the id is not specified (<code>null</code>) or there is
+ * no environment with the specified id.</p>
+ *
+ * @param id the id of the R environment
+ * @param name the name of the R environment
+ * @return the handle of the R environment or <code>null</code>
+ */
@Nullable REnv get(final @Nullable String id, final @Nullable String name);
+ /**
+ * Adds the specified R environment.
+ *
+ * @param rEnvConfig the configuration of the R environment to add
+ *
+ * @throws UnsupportedOperationException if add/delete is not supported for the specified
+ * R environment
+ */
+ void add(final REnvConfiguration rEnvConfig);
+
+ /**
+ * Deletes the specified R environment.
+ *
+ * @param rEnv the handle of the R environment
+ *
+ * @throws UnsupportedOperationException if delete is not supported for the specified
+ * R environment
+ */
+ void delete(final REnv rEnv);
+
}