mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 03:55:22 +02:00
[170909] [plan] Contribute User Actions and Import/Export from RSE7. Update model and registry for user actions.
This commit is contained in:
parent
2ce6dd9df2
commit
782d2eb994
3 changed files with 72 additions and 5 deletions
|
@ -46,9 +46,21 @@ public interface IUserActionModel extends IRSEModelObject {
|
||||||
*/
|
*/
|
||||||
public String getSupplier();
|
public String getSupplier();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the command of the user action.
|
||||||
|
* @return the command of the user action.
|
||||||
|
*/
|
||||||
|
public String getCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the contexts to which the user action applies.
|
||||||
|
* @return array of user action contexts, or an empty array if there are no contexts to which the user action applies.
|
||||||
|
*/
|
||||||
|
public IUserActionContext[] getContexts();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the user action is modifiable.
|
* Returns whether the user action is modifiable.
|
||||||
* @return <code>true<code> if the user action is modifiable, <code>false</code> otherwise.
|
* @return <code>true<code> if the user action is modifiable, <code>false</code> otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isModifiable();
|
public boolean isModifiable();
|
||||||
}
|
}
|
|
@ -10,6 +10,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.useractions;
|
package org.eclipse.rse.internal.useractions;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.rse.core.model.IPropertySet;
|
import org.eclipse.rse.core.model.IPropertySet;
|
||||||
import org.eclipse.rse.core.model.IRSEPersistableContainer;
|
import org.eclipse.rse.core.model.IRSEPersistableContainer;
|
||||||
import org.eclipse.rse.core.model.ISystemProfile;
|
import org.eclipse.rse.core.model.ISystemProfile;
|
||||||
|
@ -28,7 +31,23 @@ public class UserActionModel extends RSEModelObject implements IUserActionModel
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private String supplier;
|
private String supplier;
|
||||||
|
private String command;
|
||||||
|
private List contextList;
|
||||||
private boolean isModifiable;
|
private boolean isModifiable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a modifiable user action.
|
||||||
|
* @param profile the parent profile for which the user action applies.
|
||||||
|
* @param subsysConfig the subsystem configuration for which the user action applies.
|
||||||
|
* @param name the name of the user action.
|
||||||
|
*/
|
||||||
|
public UserActionModel(ISystemProfile profile, ISubSystemConfiguration subsysConfig, String name) {
|
||||||
|
super();
|
||||||
|
this.profile = profile;
|
||||||
|
this.subsysConfig = subsysConfig;
|
||||||
|
this.name = name;
|
||||||
|
this.isModifiable = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a user action model object.
|
* Creates a user action model object.
|
||||||
|
@ -38,10 +57,12 @@ public class UserActionModel extends RSEModelObject implements IUserActionModel
|
||||||
* @param name the name of the user action.
|
* @param name the name of the user action.
|
||||||
* @param description the description of the user action.
|
* @param description the description of the user action.
|
||||||
* @param supplier the supplier of the user action.
|
* @param supplier the supplier of the user action.
|
||||||
|
* @param command the command of the user action.
|
||||||
|
* @param contexts the array of user action contexts to which this user action applies, or an empty array if there are no contexts to which the user action applies.
|
||||||
* @param sets the property sets associated with the user action.
|
* @param sets the property sets associated with the user action.
|
||||||
* @param isModifiable <code>true</code> if the user action is modifiable, <code>false</code> otherwise.
|
* @param isModifiable <code>true</code> if the user action is modifiable, <code>false</code> otherwise.
|
||||||
*/
|
*/
|
||||||
public UserActionModel(ISystemProfile profile, ISubSystemConfiguration subsysConfig, String type, String name, String description, String supplier, IPropertySet[] sets, boolean isModifiable) {
|
public UserActionModel(ISystemProfile profile, ISubSystemConfiguration subsysConfig, String type, String name, String description, String supplier, String command, IUserActionContext[] contexts, IPropertySet[] sets, boolean isModifiable) {
|
||||||
super();
|
super();
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.subsysConfig = subsysConfig;
|
this.subsysConfig = subsysConfig;
|
||||||
|
@ -49,6 +70,13 @@ public class UserActionModel extends RSEModelObject implements IUserActionModel
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.supplier = supplier;
|
this.supplier = supplier;
|
||||||
|
this.command = command;
|
||||||
|
contextList = new ArrayList();
|
||||||
|
|
||||||
|
for (int i = 0; i < contexts.length; i++) {
|
||||||
|
contextList.add(contexts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
addPropertySets(sets);
|
addPropertySets(sets);
|
||||||
this.isModifiable = isModifiable;
|
this.isModifiable = isModifiable;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +155,7 @@ public class UserActionModel extends RSEModelObject implements IUserActionModel
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the supplier of the user action.
|
* Sets the supplier of the user action. It has no effect if the user action is not modifiable.
|
||||||
* @param supplier the supplier of the user action.
|
* @param supplier the supplier of the user action.
|
||||||
*/
|
*/
|
||||||
public void setSupplier(String supplier) {
|
public void setSupplier(String supplier) {
|
||||||
|
@ -144,6 +172,33 @@ public class UserActionModel extends RSEModelObject implements IUserActionModel
|
||||||
public String getSupplier() {
|
public String getSupplier() {
|
||||||
return supplier;
|
return supplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the command of the user action. It has no effect if the user action is not modifiable.
|
||||||
|
* @param command the command of the user action.
|
||||||
|
*/
|
||||||
|
public void setCommand(String command) {
|
||||||
|
|
||||||
|
if (isModifiable()) {
|
||||||
|
this.command = command;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the command of the user action.
|
||||||
|
* @return the command of the user action.
|
||||||
|
*/
|
||||||
|
public String getCommand() {
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the contexts to which the user action applies.
|
||||||
|
* @return array of user action contexts, or an empty array if there are no contexts to which the user action applies.
|
||||||
|
*/
|
||||||
|
public IUserActionContext[] getContexts() {
|
||||||
|
return (IUserActionContext[])(contextList.toArray());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the user action is modifiable.
|
* Returns whether the user action is modifiable.
|
||||||
|
|
|
@ -128,8 +128,8 @@ public class UserActionRegistry {
|
||||||
*/
|
*/
|
||||||
public boolean containsUserActionModel(ISystemProfile profile, ISubSystemConfiguration configuration, IUserActionContext context) {
|
public boolean containsUserActionModel(ISystemProfile profile, ISubSystemConfiguration configuration, IUserActionContext context) {
|
||||||
|
|
||||||
Map map = getUserActionContextMap(profile);
|
Map map = getUserActionModelMap(profile);
|
||||||
List list = getUserActionContexts(map, configuration);
|
List list = getUserActionModels(map, configuration);
|
||||||
return list.contains(context);
|
return list.contains(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue