Added desktop action attribute to allow file/folder parameters to be optional.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3535 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gary Spencer
2006-08-17 10:39:56 +00:00
parent 7c670da1b0
commit 3877dffcd4
7 changed files with 21 additions and 7 deletions

Binary file not shown.

View File

@@ -148,7 +148,7 @@ BOOL CCAlfrescoAppApp::InitInstance()
// Action does not use targets, just run the action // Action does not use targets, just run the action
else { else if ( actionInfo.allowsNoParameters()) {
// Run the action // Run the action
@@ -465,6 +465,13 @@ bool CCAlfrescoAppApp::runAction( AlfrescoInterface& alfresco, StringList& pathL
if ( buildDesktopParameters( alfresco, pathList, actionInfo, desktopParams)) { if ( buildDesktopParameters( alfresco, pathList, actionInfo, desktopParams)) {
// Check if the action requires parameters
if ( actionInfo.allowsNoParameters() == false && desktopParams.numberOfTargets() == 0) {
AfxMessageBox( L"No parameters for action", MB_OK | MB_ICONEXCLAMATION);
return false;
}
// Run the desktop action // Run the desktop action
DesktopResponse response = alfresco.runAction( actionInfo, desktopParams); DesktopResponse response = alfresco.runAction( actionInfo, desktopParams);

View File

@@ -106,6 +106,7 @@ namespace Alfresco {
#define AttrAlfrescoFiles 0x0010 #define AttrAlfrescoFiles 0x0010
#define AttrAlfrescoFolders 0x0020 #define AttrAlfrescoFolders 0x0020
#define AttrMultiplePaths 0x0040 #define AttrMultiplePaths 0x0040
#define AttrAllowNoParams 0x0080
#define AttrAnyFiles (AttrTargetFiles + AttrClientFiles + AttrAlfrescoFiles) #define AttrAnyFiles (AttrTargetFiles + AttrClientFiles + AttrAlfrescoFiles)
#define AttrAnyFolders (AttrTargetFolders + AttrClientFolders + AttrAlfrescoFolders) #define AttrAnyFolders (AttrTargetFolders + AttrClientFolders + AttrAlfrescoFolders)
@@ -367,6 +368,10 @@ public:
inline bool supportsFiles(void) const { return hasAttribute(AttrTargetFiles+AttrClientFiles+AttrAlfrescoFiles); } inline bool supportsFiles(void) const { return hasAttribute(AttrTargetFiles+AttrClientFiles+AttrAlfrescoFiles); }
inline bool supportsFolders(void) const { return hasAttribute(AttrTargetFolders+AttrClientFolders+AttrAlfrescoFolders); } inline bool supportsFolders(void) const { return hasAttribute(AttrTargetFolders+AttrClientFolders+AttrAlfrescoFolders); }
// Check if the action allows no parameters
inline bool allowsNoParameters(void) const { return hasAttribute(AttrAllowNoParams) || hasAttribute(AttrAnyFilesFolders) == false; }
// Set the action name, pseudo name, set the confirmation message // Set the action name, pseudo name, set the confirmation message
inline void setName(const String& name) { m_name = name; } inline void setName(const String& name) { m_name = name; }

View File

@@ -65,6 +65,8 @@ public abstract class DesktopAction {
public static final int AttrMultiplePaths = 0x0040; // run action using multiple paths public static final int AttrMultiplePaths = 0x0040; // run action using multiple paths
// default is to run the action against a single path with the client app calling the action // default is to run the action against a single path with the client app calling the action
// multiple times // multiple times
public static final int AttrAllowNoParams = 0x0080; // allow action to run without parameters
// used when files/folder parameters are optional
public static final int AttrAnyFiles = AttrTargetFiles + AttrClientFiles + AttrAlfrescoFiles; public static final int AttrAnyFiles = AttrTargetFiles + AttrClientFiles + AttrAlfrescoFiles;
public static final int AttrAnyFolders = AttrTargetFolders + AttrClientFolders + AttrAlfrescoFolders; public static final int AttrAnyFolders = AttrTargetFolders + AttrClientFolders + AttrAlfrescoFolders;
@@ -117,7 +119,7 @@ public abstract class DesktopAction {
/** /**
* Default constructor * Default constructor
*/ */
public DesktopAction() protected DesktopAction()
{ {
} }
@@ -127,7 +129,7 @@ public abstract class DesktopAction {
* @param attr int * @param attr int
* @param preActions int * @param preActions int
*/ */
public DesktopAction(int attr, int preActions) protected DesktopAction(int attr, int preActions)
{ {
setAttributes(attr); setAttributes(attr);
setPreProcessActions(preActions); setPreProcessActions(preActions);
@@ -138,7 +140,7 @@ public abstract class DesktopAction {
* *
* @param name String * @param name String
*/ */
public DesktopAction(String name) protected DesktopAction(String name)
{ {
m_name = name; m_name = name;
} }

View File

@@ -34,7 +34,7 @@ public class CmdLineDesktopAction extends DesktopAction {
*/ */
public CmdLineDesktopAction() public CmdLineDesktopAction()
{ {
super( 0, DesktopAction.PreConfirmAction); super( 0, PreConfirmAction);
} }
@Override @Override

View File

@@ -36,7 +36,7 @@ public class EchoDesktopAction extends DesktopAction {
*/ */
public EchoDesktopAction() public EchoDesktopAction()
{ {
super( 0, DesktopAction.PreConfirmAction); super( 0, PreConfirmAction);
} }
@Override @Override

View File

@@ -34,7 +34,7 @@ public class URLDesktopAction extends DesktopAction {
*/ */
public URLDesktopAction() public URLDesktopAction()
{ {
super( 0, DesktopAction.PreConfirmAction); super( 0, PreConfirmAction);
} }
@Override @Override