Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2007-01-17 18:14:25 +0000
committerChris Goldthorpe2007-01-17 18:14:25 +0000
commit79fd1c4ed08b6bfa739e366738dffdadc518301a (patch)
tree2224bd23f701d125627b4ba0607971505c647db4 /org.eclipse.ui.cheatsheets/src/org
parent128c76c3ee438bdbebb09a8fe3c866635618fa1b (diff)
downloadeclipse.platform.ua-79fd1c4ed08b6bfa739e366738dffdadc518301a.tar.gz
eclipse.platform.ua-79fd1c4ed08b6bfa739e366738dffdadc518301a.tar.xz
eclipse.platform.ua-79fd1c4ed08b6bfa739e366738dffdadc518301a.zip
Bug 69731 - [CheatSheet] Missing workflow: running an action should auto-confirm the item
Diffstat (limited to 'org.eclipse.ui.cheatsheets/src/org')
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.java1
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.properties1
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java20
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Action.java3
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java3
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IParserTags.java1
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java4
8 files changed, 32 insertions, 3 deletions
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.java
index c99ea8433..8308732f5 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.java
@@ -88,6 +88,7 @@ public final class Messages extends NLS {
public static String ERROR_PARSING_NO_SERIALIZATION;
public static String ERROR_PARSING_INCOMPATIBLE_CHILDREN;
public static String ERROR_PARSING_DUPLICATE_CHILD;
+ public static String ERROR_PARSING_REQUIRED_CONFIRM;
public static String ERROR_COMMAND_ID_NOT_FOUND;
public static String ERROR_COMMAND_ERROR_STATUS;
public static String ERROR_COMMAND_SERVICE_UNAVAILABLE;
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.properties b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.properties
index fe30f2bd9..3bb105d68 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.properties
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.properties
@@ -124,6 +124,7 @@ ERROR_PARSING_NO_VALUES = The ''{0}'' element must specify a values attribute.
ERROR_PARSING_NO_LABEL = The ''{0}'' element must specify a label attribute.
ERROR_PARSING_INCOMPATIBLE_CHILDREN = The ''{0}'' element contains incompatible child elements ''{1}'' and ''{2}''.
ERROR_PARSING_DUPLICATE_CHILD = The ''{0}'' element has more than one child element ''{1}''.
+ERROR_PARSING_REQUIRED_CONFIRM = The ''{0}'' element has both required = false and confirm = true.
# CheatsheetCommand, content error messages
ERROR_PARSING_NO_SERIALIZATION = The ''{0}'' element must specify a serialization attribute.
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java
index 3025b5e01..e2c1009c8 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java
@@ -23,8 +23,9 @@ import org.w3c.dom.Node;
public abstract class AbstractExecutable {
private String[] params;
- private boolean confirm;
+ private boolean confirm = false;
private String when;
+ private boolean required = true;
/**
* This method returns an array of parameters specified to be passed to the action class
@@ -50,6 +51,14 @@ public abstract class AbstractExecutable {
public boolean isConfirm() {
return confirm;
}
+
+ /**
+ * @return true if this step or substep can only be completed by performing
+ * this executable.
+ */
+ public boolean isRequired() {
+ return required;
+ }
/**
* This method allows you to set the string parameters to be passed to the action class on running it
@@ -67,6 +76,15 @@ public abstract class AbstractExecutable {
public void setConfirm(boolean value) {
this.confirm = value;
}
+
+ /**
+ * Set whether this executable can be by passed.
+ * @param required if true this action must be performed to complete this
+ * step or substep.
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
/**
* Indicates this action is to be used if and only if the value of the condition attribute
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Action.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Action.java
index c983dd208..98e43b92c 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Action.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Action.java
@@ -85,6 +85,9 @@ public class Action extends AbstractExecutable {
if(!hasPluginId) {
return NLS.bind(Messages.ERROR_PARSING_NO_PLUGINID, (new Object[] {node.getNodeName()}));
}
+ if(isConfirm() && !isRequired()) {
+ return NLS.bind(Messages.ERROR_PARSING_REQUIRED_CONFIRM, (new Object[] {node.getNodeName()}));
+ }
return null;
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java
index 4eba701d9..f44931e62 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java
@@ -64,6 +64,9 @@ public class CheatSheetCommand extends AbstractExecutable {
if(!serializationFound) {
return NLS.bind(Messages.ERROR_PARSING_NO_SERIALIZATION, (new Object[] {node.getNodeName()}));
}
+ if(isConfirm() && !isRequired()) {
+ return NLS.bind(Messages.ERROR_PARSING_REQUIRED_CONFIRM, (new Object[] {node.getNodeName()}));
+ }
return null;
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
index 6eb78c551..b326a5c26 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
@@ -226,6 +226,8 @@ public class CheatSheetParser implements IStatusContainer {
executable.setConfirm(attribute.getNodeValue().equals(TRUE_STRING));}
else if (attributeName.equals(IParserTags.WHEN)) {
executable.setWhen(attribute.getNodeValue());
+ } else if (attributeName.equals(IParserTags.REQUIRED)) {
+ executable.setRequired(attribute.getNodeValue().equals(TRUE_STRING));
} else if (executable.hasParams() && attributeName.startsWith(IParserTags.PARAM)) {
try {
if(params == null) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IParserTags.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IParserTags.java
index 5b30ae1d7..ee5aaafe7 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IParserTags.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IParserTags.java
@@ -127,6 +127,7 @@ public interface IParserTags {
public static final String RETURNS = "returns"; //$NON-NLS-1$
public static final String ON_COMPLETION = "onCompletion"; //$NON-NLS-1$
public static final String CONTENT_URL = "contentURL"; //$NON-NLS-1$
+ public static final String REQUIRED = "required"; //$NON-NLS-1$
// Constants for re-escaping XML characters
public static final String LESS_THAN = "<"; //$NON-NLS-1$
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
index 5d5113e4c..9b0208291 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
@@ -90,7 +90,7 @@ public class CoreItem extends ViewItem {
}
});
}
- if (!isActionShown || executable.isConfirm()) {
+ if (!isActionShown || executable.isConfirm() || !executable.isRequired()) {
final ImageHyperlink completeButton = createButtonWithText(buttonComposite, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_COMPLETE), this, itemColor, Messages.COMPLETE_TASK_TOOLTIP);
page.getToolkit().adapt(completeButton, true, true);
completeButton.addHyperlinkListener(new HyperlinkAdapter() {
@@ -193,7 +193,7 @@ public class CoreItem extends ViewItem {
});
holder.setStartButton(startButton);
}
- if (!isActionShown || subExecutable.isConfirm()) {
+ if (!isActionShown || subExecutable.isConfirm() || !subExecutable.isRequired()) {
added++;
final ImageHyperlink completeButton = createButton(buttonComposite, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_COMPLETE), this, itemColor, Messages.COMPLETE_TASK_TOOLTIP);
page.getToolkit().adapt(completeButton, true, true);

Back to the top