List of usage examples for org.eclipse.jface.dialogs IDialogConstants CANCEL_LABEL
String CANCEL_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants CANCEL_LABEL.
Click Source Link
From source file:org.bonitasoft.studio.common.jface.MessageDialogWithPrompt.java
License:Open Source License
private static String[] getButtonLabelsFor(int kind) { String[] dialogButtonLabels;//from w w w . ja va 2s . c o m switch (kind) { case ERROR: case INFORMATION: case WARNING: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; break; } case CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; break; } case QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; break; } case QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$ } } return dialogButtonLabels; }
From source file:org.bonitasoft.studio.connectors.test.swtbot.ConnectorDefinitionWizardPageTest.java
License:Open Source License
@Test public void testConnectorDefinitionWizardPageValidityName() { final String connectorDefId = "testWizardPage1"; final String pageId = "pageTest"; final String pageIdLabelStar = Messages.pageId + " *"; final String widgetIdStar = Messages.widgetId + "*"; final String widgetIdValid = "myWidgetId"; openConnectorDefinitionWizardPage(connectorDefId); bot.button(Messages.Add).click();/* w w w . j a v a 2 s .c o m*/ bot.waitUntil(Conditions.shellIsActive(Messages.newConnectorDefinition)); // ----- Test Page id name validity ----- assertFalse("button Apply should be disabled", bot.button(Messages.apply).isEnabled()); // valid id bot.textWithLabel(pageIdLabelStar).setText(pageId); assertTrue("button Apply should be enabled", bot.button(Messages.apply).isEnabled()); // whitespace in id bot.textWithLabel(pageIdLabelStar).setText("bla bla"); assertFalse("button Apply should be disabled", bot.button(Messages.apply).isEnabled()); // forbidden characters bot.textWithLabel(pageIdLabelStar).setText("//dfgjkdfg**"); assertFalse("button Apply should be disabled", bot.button(Messages.apply).isEnabled()); // valid id bot.textWithLabel(pageIdLabelStar).setText(pageId); assertTrue("button Apply should be enabled", bot.button(Messages.apply).isEnabled()); // ----- test widget id validity ------ bot.button(Messages.Add).click(); bot.waitUntil(Conditions.shellIsActive(Messages.addWidget)); bot.comboBoxWithLabel(Messages.input + " *").setSelection(0); // valid text bot.textWithLabel(widgetIdStar).setText(widgetIdValid); assertTrue("button OK should be enabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); // forbidden characters bot.textWithLabel(widgetIdStar).setText("//lfhsduh**"); assertFalse("button OK should be disabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); // whitespace bot.textWithLabel(widgetIdStar).setText("bla bla"); assertFalse("button OK should be disabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); // valid text bot.textWithLabel(widgetIdStar).setText(widgetIdValid); assertTrue("button OK should be enabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); bot.button(IDialogConstants.OK_LABEL).click(); bot.button(Messages.apply).click(); bot.button(IDialogConstants.CANCEL_LABEL).click(); }
From source file:org.bonitasoft.studio.connectors.test.swtbot.ConnectorEditionTest.java
License:Open Source License
public void removeConnectorDefinition(final String name, final String version) { SWTBotConnectorTestUtil.activateConnectorDefEditionShell(bot); bot.tree().setFocus();/* ww w .jav a2 s. co m*/ bot.waitUntil(new ICondition() { public boolean test() throws Exception { bot.tree().select("Uncategorized").expandNode("Uncategorized").select(name + " (" + version + ")"); return bot.tree().selectionCount() > 0; } public void init(SWTBot bot) { } public String getFailureMessage() { return "Cannot select tree item"; } }, 10000, 1000); assertNotNull("could not find" + name + " (" + version + ")", bot.tree().select("Uncategorized") .expandNode("Uncategorized").getNode(name + " (" + version + ")")); bot.tree().select("Uncategorized").expandNode("Uncategorized").select(name + " (" + version + ")"); bot.button("Delete").click(); if (!FileActionDialog.getDisablePopup()) { bot.waitUntil(Conditions.shellIsActive("Delete?")); bot.button(IDialogConstants.YES_LABEL).click(); } bot.button(IDialogConstants.CANCEL_LABEL).click(); }
From source file:org.bonitasoft.studio.connectors.test.swtbot.ConnectorEditionTest.java
License:Open Source License
@Test public void testAddCategory() throws Exception { final String id = "testEdit4"; final String version = "1.0.0"; SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, version); bot.button(IDialogConstants.FINISH_LABEL).click(); SWTBotConnectorTestUtil.activateConnectorDefEditionShell(bot); bot.tree().setFocus();// ww w .j a v a 2 s . c om bot.waitUntil(Conditions .widgetIsEnabled(bot.tree().expandNode("Uncategorized").select(id + " (" + version + ")")), 10000); bot.tree().select("Uncategorized").expandNode("Uncategorized").select(id + " (" + version + ")"); bot.button(Messages.Edit).click(); bot.treeWithLabel(Messages.categoryLabel).select(0); bot.button(IDialogConstants.FINISH_LABEL).click(); ConnectorDefRepositoryStore store = (ConnectorDefRepositoryStore) RepositoryManager.getInstance() .getRepositoryStore(ConnectorDefRepositoryStore.class); ConnectorDefinition connectorDef = store.getDefinition(id, version); assertEquals("category size should be equal to 1", 1, connectorDef.getCategory().size()); DefinitionResourceProvider messageProvider = DefinitionResourceProvider.getInstance(store, ConnectorPlugin.getDefault().getBundle()); SWTBotConnectorTestUtil.activateConnectorDefEditionShell(bot); final Category category = connectorDef.getCategory().get(0); String categoryLabel = messageProvider.getCategoryLabel(category); if (categoryLabel == null) { categoryLabel = category.getId(); } final String connectorLabel = new ConnectorDefinitionTreeLabelProvider(messageProvider) .getText(connectorDef); assertNotNull("could not find " + connectorLabel, bot.tree().getTreeItem(categoryLabel).expand().getNode(connectorLabel)); bot.button(IDialogConstants.CANCEL_LABEL).click(); }
From source file:org.bonitasoft.studio.connectors.test.swtbot.ConnectorImplementationTest.java
License:Open Source License
@Test public void testPackageSyntax() throws Exception { final String id = "testImplementation"; final String definition = "testEdit"; final String className = "MyConnectorImpl"; final String packageName = "org.bonita.connector."; SWTBotConnectorTestUtil.activateConnectorImplementationShell(bot); selectDefinition(definition);/*www. j ava2 s. c o m*/ bot.textWithLabel("Implementation id *").setText(id); bot.textWithLabel("Class name *").setText(className); bot.textWithLabel("Package *").setText(packageName); assertFalse("finish button should be desabled", bot.button(IDialogConstants.FINISH_LABEL).isEnabled()); bot.button(IDialogConstants.CANCEL_LABEL).click(); }
From source file:org.bonitasoft.studio.connectors.test.swtbot.ConnectorImplementationTest.java
License:Open Source License
@Test public void testClassNameSyntax() throws Exception { final String id = "testImplementation"; final String definition = "testEdit"; final String packageName = "org.bonita.connector"; SWTBotConnectorTestUtil.activateConnectorImplementationShell(bot); selectDefinition(definition);/*www .j a v a2 s. c o m*/ bot.textWithLabel(Messages.implementationId + " *").setText(id); bot.textWithLabel("Package *").setText(packageName); bot.textWithLabel(Messages.classNameLabel + " *").setText("MyConnector.Implsfgsdf"); bot.waitUntil(new DefaultCondition() { public boolean test() throws Exception { return !bot.button(IDialogConstants.FINISH_LABEL).isEnabled(); } public String getFailureMessage() { return "finish button should be disabled"; } }); bot.button(IDialogConstants.CANCEL_LABEL).click(); }
From source file:org.bonitasoft.studio.connectors.test.swtbot.ConnectorImplementationTest.java
License:Open Source License
@Test public void testConnectorImplEditionWithSameDefandClassName() { final int nbEditorsBefore = bot.editors().size(); final String id = "testImplementation4"; final String id2 = "testImplementation5"; final String definition = "testEdit"; final String className = "MyactorFilterImpl"; final String packageName = "org.bonita.actorFilter.test"; SWTBotConnectorTestUtil.activateConnectorImplementationShell(bot); selectDefinition(definition);//from w w w. j a v a 2 s.c o m bot.textWithLabel("Implementation id *").setText(id); bot.textWithLabel("Class name *").setText(className); bot.textWithLabel("Package *").setText(packageName); bot.button(IDialogConstants.FINISH_LABEL).click(); bot.waitUntil(new ICondition() { public boolean test() throws Exception { return nbEditorsBefore + 1 == bot.editors().size(); } public void init(SWTBot bot) { } public String getFailureMessage() { return "Editor for implementation has not been opened."; } }, 30000); SWTBotConnectorTestUtil.activateConnectorImplementationShell(bot); selectDefinition(definition); bot.textWithLabel("Implementation id *").setText(id2); bot.textWithLabel("Class name *").setText(className); bot.textWithLabel("Package *").setText(packageName); bot.waitUntil(new ICondition() { public boolean test() throws Exception { return !bot.button(IDialogConstants.FINISH_LABEL).isEnabled(); } public void init(SWTBot bot) { } public String getFailureMessage() { return "Finish button should be disabled"; } }); bot.button(IDialogConstants.CANCEL_LABEL).click(); removeImplementation(id); }
From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java
License:Open Source License
@Test public void testIdSyntaxError() throws Exception { final String id2 = "id.?"; final String textLabel = "Definition id *"; SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); testButtonDisabled("", textLabel); testButtonDisabled(id2, textLabel);/*from www . jav a 2 s.com*/ bot.button(IDialogConstants.CANCEL_LABEL).click(); }
From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java
License:Open Source License
@Test public void testVersionSyntaxError() throws Exception { final String id = "test0"; final String version2 = "epd?"; final String textLabel = "Version *"; SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); bot.textWithLabel("Definition id *").setText(id); testButtonDisabled("", textLabel); testButtonDisabled(version2, textLabel); bot.button(IDialogConstants.CANCEL_LABEL).click(); }
From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java
License:Open Source License
@Test public void testExistingConnectorDefinition() throws Exception { final String id = "test1"; final String textLabel = "Definition id *"; final String textLabelVersion = "Version *"; final String version = "1.1.0"; SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); bot.textWithLabel(textLabel).setText(id); bot.button(IDialogConstants.FINISH_LABEL).click(); SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); testButtonDisabled(id, textLabel);//from ww w . j ava2s .c o m bot.textWithLabel(textLabelVersion).setText(version); bot.waitUntil(new ICondition() { public boolean test() throws Exception { return bot.button(IDialogConstants.FINISH_LABEL).isEnabled(); } public void init(SWTBot bot) { } public String getFailureMessage() { return "changing version should enable finish button"; } }, 5000); bot.button(IDialogConstants.CANCEL_LABEL).click(); }