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.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java
License:Open Source License
@Test public void testCreateExistingCategory() throws Exception { final String id = "test7"; final String version = "1.0.0"; final String categoryId = "category3"; SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, version); SWTBotConnectorTestUtil.createNewCategory(bot, categoryId); bot.button("New...").click(); bot.textWithLabel("Id").setText(categoryId); assertFalse("Ok button should be disabled when trying to create an existing category", bot.button(IDialogConstants.OK_LABEL).isEnabled()); bot.button(IDialogConstants.CANCEL_LABEL).click(); bot.button(IDialogConstants.FINISH_LABEL).click(); }
From source file:org.bonitasoft.studio.connectors.test.swtbot.TestLoadSaveConnectorConfiguration.java
License:Open Source License
@Test public void testSaveLoadConnectorConfiguration() { ConnectorConfRepositoryStore store = (ConnectorConfRepositoryStore) RepositoryManager.getInstance() .getRepositoryStore(ConnectorConfRepositoryStore.class); final int initialSize = store.getChildren().size(); final String connectorDefId = "testLoadConnectorDefinition"; final String version = "1.0.0"; final String name = "testLoadConnector"; final String name2 = "testLoadConnector2"; final String dataName = "dataLoadConnector"; final String saveName = "testLoadConnectorConfig"; createConnector(connectorDefId);// ww w . java 2 s. c om SWTBotTestUtil.createNewDiagram(bot); bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).show(); createData(dataName); //SWTBotConnectorTestUtil.addConnectorToPool(bot, connectorDefId,version, new String[]{"Uncategorized"},name); SWTBotTestUtil.selectTabbedPropertyView(bot, "Connectors"); bot.button("Add...").click(); bot.text().setText(connectorDefId); bot.table().select(connectorDefId); bot.button(IDialogConstants.NEXT_LABEL).click(); //SWTBotConnectorTestUtil.addConnectorToPool(bot, connectorLabel,connectorVersion,dbCategoryLabel, connectorName); bot.textWithLabel("Name *").setText(name); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.textWithLabel("text").setText("hello world"); bot.sleep(1000); // Due to delayed observable on databinding bot.button(IDialogConstants.NEXT_LABEL).click(); SWTBotTestUtil.setOutputStorageExpressionByName(bot, dataName, String.class.getName(), 0); bot.button(IDialogConstants.FINISH_LABEL).click(); bot.table().select(name + " -- " + connectorDefId + " (" + version + ") -- ON_FINISH"); bot.button("Edit...").click(); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.toolbarButton("Save").click(); bot.textWithLabel("Name *").setText(saveName); bot.button(IDialogConstants.FINISH_LABEL).click(); bot.button(IDialogConstants.FINISH_LABEL).click(); //add a new connector and load previous configuration connector SWTBotTestUtil.selectTabbedPropertyView(bot, "Connectors"); bot.button("Add...").click(); //bot.tree().setFocus(); //bot.tree().expandNode("Uncategorized").select(connectorDefId + " (" + version + ")"); bot.text().setText(connectorDefId); bot.table().select(connectorDefId); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.textWithLabel("Name *").setText(name2); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.toolbarButton("Load").click(); final SWTBotTree wizardTree = bot.treeWithId(SWTBotConstants.SELECTION_CONNECTOR_CONFIGURATION_TREE_ID); wizardTree.setFocus(); bot.waitUntil(new ICondition() { public boolean test() throws Exception { wizardTree.getTreeItem(saveName).select(); return wizardTree.selectionCount() > 0; } public void init(SWTBot bot) { } public String getFailureMessage() { return "Cannot select tree item"; } }, 10000, 1000); bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL))); bot.button(IDialogConstants.FINISH_LABEL).click(); bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.NEXT_LABEL))); bot.button(IDialogConstants.NEXT_LABEL).click(); assertEquals("text field should be completed with hello world", bot.textWithLabel("text").getText(), "hello world"); //remove configuration bot.toolbarButton("Load").click(); assertTrue("remove button should be enabled", bot.button("Remove").isEnabled()); bot.tree().setFocus(); bot.waitUntil(new ICondition() { public boolean test() throws Exception { bot.tree().getTreeItem(saveName).select(); return bot.tree().selectionCount() > 0; } public void init(SWTBot bot) { } public String getFailureMessage() { return "Cannot select tree item"; } }, 10000, 500); bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Remove"))); bot.button("Remove").click(); bot.waitUntil(new ICondition() { public boolean test() throws Exception { return bot.tree().getAllItems().length == initialSize; } public void init(SWTBot bot) { } public String getFailureMessage() { return "Fail to delete configuration"; } }); bot.button(IDialogConstants.CANCEL_LABEL).click(); bot.button(IDialogConstants.CANCEL_LABEL).click(); bot.saveAllEditors(); assertEquals("invalid number of configuration", initialSize, store.getChildren().size()); }
From source file:org.bonitasoft.studio.connectors.test.TestTestWSConnector.java
License:Open Source License
public void testTestWSConnector() throws IOException { /*Import process*/ bot.waitUntil(Conditions.shellIsActive("Bonita Studio")); SWTBotTestUtil.importProcessWIthPathFromClass(bot, "WS_Without_Introspect--1.0.bar", "Bonita", "WS_Without_Introspect (1.0)", this.getClass(), false); SWTBotGefEditor gefEditor = bot.gefEditor("WS_Without_Introspect (1.0)"); /*Select step on which there is the connector to test*/ gefEditor.getEditPart("Step1").parent().select(); /*Open connector configuration wizard to test the connector*/ bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).setFocus(); SWTBotTestUtil.selectTabbedPropertyView(bot, "Connectors"); bot.tree().select(0);/*from w w w . j a va 2s .c o m*/ bot.button("Edit...").click(); bot.waitUntil(Conditions.shellIsActive("Web Service Client")); /*In the wizard go to the right page to test it*/ bot.button(IDialogConstants.NEXT_LABEL).click(); bot.button("Test Configuration").click(); /*Wait that the correct shell opened*/ bot.waitUntil(Conditions.shellIsActive("Results")); assertContains("DOMSource", bot.tree().getAllItems()[0].getText()); bot.button("Back").click(); bot.button(IDialogConstants.CANCEL_LABEL).click(); }
From source file:org.bonitasoft.studio.connectors.ui.TestConnectorResultDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); getButton(IDialogConstants.CANCEL_ID).setText(IDialogConstants.OK_LABEL); }
From source file:org.bonitasoft.studio.data.test.DataSWTBotTests.java
License:Open Source License
@Test public void testDatacantBeInitializeByItself() { SWTBotTestUtil.createNewDiagram(bot); SWTBotTestUtil.changeDiagramName(bot, "Step1", "DataInit"); SWTBotEditor botEditor = bot.activeEditor(); SWTBotGefEditor gmfEditor = bot.gefEditor(botEditor.getTitle()); AbstractProcess proc = ModelHelper.getParentProcess( ((IGraphicalEditPart) gmfEditor.getEditPart("Step1").part()).resolveSemanticElement()); List<String> step1DataList = new ArrayList<String>(2); step1DataList.add("varS1_1" + " -- " + "Text"); step1DataList.add("varS1_2" + " -- " + "Integer"); List<String> step2DataList = new ArrayList<String>(2); step2DataList.add("varS2_1" + " -- " + "Text"); step2DataList.add("varS2_2" + " -- " + "Integer"); List<String> procDataList = new ArrayList<String>(2); procDataList.add("procVar_1" + " -- " + "Text"); procDataList.add("procVar_2" + " -- " + "Integer"); // add data to Process gmfEditor.getEditPart(proc.getName()); getDataSection(bot);/*from w w w .ja v a 2s. c o m*/ bot.button("Add...").click(); SWTBotTestUtil.addNewData(bot, "procVar_1", "Text", false, null); bot.button("Add...").click(); SWTBotTestUtil.addNewData(bot, "procVar_2", "Integer", false, null); SWTBotTestUtil.selectTaskFromSelectedElementAndDragIt(gmfEditor, "Step1", new Point(400, 100)); // set data on step1 Task gmfEditor.getEditPart("Step1").click(); getDataSection(bot); bot.button("Add...").click(); SWTBotTestUtil.addNewData(bot, "varS1_1", "Text", false, null); bot.button("Add...").click(); SWTBotTestUtil.addNewData(bot, "varS1_2", "Integer", false, null); // set data on step2 Task gmfEditor.getEditPart("Step2").click(); getDataSection(bot); bot.button("Add...").click(); SWTBotTestUtil.addNewData(bot, "varS2_1", "Text", false, null); bot.button("Add...").click(); SWTBotTestUtil.addNewData(bot, "varS2_2", "Integer", false, null); bot.menu("Diagram").menu("Save").click(); // check only process variables are available in tasks data edit expression gmfEditor.getEditPart("Step1").click(); getDataSection(bot); SWTBotTable dataTable = bot.table(); // Test on var varS1_2 dataTable.select("varS1_1" + " -- " + "Text"); bot.button("Edit...").click(); bot.waitUntil(Conditions.shellIsActive("Edit variable")); bot.toolbarButtonWithId(ExpressionViewer.SWTBOT_ID_EDITBUTTON, 0).click(); bot.waitUntil(Conditions.shellIsActive(editExpression)); bot.tableWithLabel(expressionTypeLabel).select("Variable"); SWTBotTable tableVar = bot.table(1); Assert.assertFalse("Error: Task data can't be initialized by itself", tableVar.containsItem("varS1_1" + " -- " + "Text")); Assert.assertFalse("Error: Task data can't be initialized by a sibling task data", tableVar.containsItem("varS1_2" + " -- " + "Integer")); for (int j = 0; j < 2; j++) { Assert.assertFalse("Error: Task data can't be initialized by task data", tableVar.containsItem(step2DataList.get(j))); Assert.assertTrue("Error: Task data sould be initialized by Process data", tableVar.containsItem(procDataList.get(j))); } bot.button(IDialogConstants.CANCEL_LABEL).click(); bot.button(IDialogConstants.CANCEL_LABEL).click(); // Test on var varS1_2 dataTable.select("varS1_2" + " -- " + "Integer"); bot.button("Edit...").click(); bot.waitUntil(Conditions.shellIsActive("Edit variable")); bot.toolbarButtonWithId(ExpressionViewer.SWTBOT_ID_EDITBUTTON, 0).click(); bot.waitUntil(Conditions.shellIsActive(editExpression)); bot.tableWithLabel(expressionTypeLabel).select("Variable"); tableVar = bot.table(1); Assert.assertFalse("Error: Task data can't be initialized by itself", tableVar.containsItem("varS1_2" + " -- " + "Integer")); Assert.assertFalse("Error: Task data can't be initialized by a sibling task data", tableVar.containsItem("varS1_1" + " -- " + "Text")); for (int j = 0; j < 2; j++) { Assert.assertFalse("Error: Task data can't be initialized by task data", tableVar.containsItem(step2DataList.get(j))); Assert.assertTrue("Error: Task data sould be initialized by Process data", tableVar.containsItem(procDataList.get(j))); } bot.button(IDialogConstants.CANCEL_LABEL).click(); bot.button(IDialogConstants.CANCEL_LABEL).click(); }
From source file:org.bonitasoft.studio.data.ui.property.section.AbstractDataSection.java
License:Open Source License
protected void removeData(IStructuredSelection structuredSelection) { String[] buttonList = { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; OutlineDialog dialog = new OutlineDialog(Display.getDefault().getActiveShell(), Messages.deleteDataDialogTitle, Display.getCurrent().getSystemImage(SWT.ICON_WARNING), createMessage(structuredSelection), MessageDialog.CONFIRM, buttonList, 1, structuredSelection.toList()); if (dialog.open() == Dialog.OK) { IProgressService service = PlatformUI.getWorkbench().getProgressService(); CompoundCommand cc = new CompoundCommand("Remove list of data"); boolean canExecute = false; for (Object d : structuredSelection.toList()) { RefactorDataOperation op = new RefactorDataOperation( BonitaGroovyRefactoringAction.REMOVE_OPERATION); op.setCompoundCommand(cc);/*from www . j a v a2 s. c o m*/ op.setContainer(ModelHelper.getParentProcess(eObject)); op.setEditingDomain(getEditingDomain()); op.setOldData((Data) d); op.updateReferencesInScripts(); try { if (op.isCanExecute()) { service.run(true, false, op); cc.append(DeleteCommand.create(getEditingDomain(), d)); canExecute = canExecute || true; } else { canExecute = canExecute || false; } } catch (InvocationTargetException e) { BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID); } catch (InterruptedException e) { BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID); } } if (canExecute) { getEditingDomain().getCommandStack().execute(cc); } else { cc.dispose(); } try { RepositoryManager.getInstance().getCurrentRepository().getProject().build( IncrementalProjectBuilder.FULL_BUILD, XtextProjectHelper.BUILDER_ID, new HashMap<String, String>(), null); } catch (CoreException e) { BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID); } } }
From source file:org.bonitasoft.studio.data.ui.property.section.RemoveDataHandler.java
License:Open Source License
public void execute(final IStructuredSelection structuredSelection, final EObject container, final EStructuralFeature dataFeature) { final String[] buttonList = { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; final OutlineDialog dialog = new OutlineDialog(Display.getDefault().getActiveShell(), org.bonitasoft.studio.common.Messages.removalConfirmationDialogTitle, Display.getCurrent().getSystemImage(SWT.ICON_WARNING), createMessage(structuredSelection), MessageDialog.CONFIRM, buttonList, 1, structuredSelection.toList()); if (dialog.open() == Dialog.OK) { final IProgressService service = PlatformUI.getWorkbench().getProgressService(); final RefactorDataOperation op = new RefactorDataOperation(RefactoringOperationType.REMOVE); for (final Object d : structuredSelection.toList()) { op.setEditingDomain(TransactionUtil.getEditingDomain(container)); op.addItemToRefactor(null, (Data) d); op.setDataContainer((DataAware) container); op.setDataContainmentFeature(dataFeature); op.setAskConfirmation(true); }//from w w w. j a v a 2 s . com try { if (op.canExecute()) { service.run(true, true, op); } } catch (final InvocationTargetException e) { BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID); } catch (final InterruptedException e) { BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID); } try { RepositoryManager.getInstance().getCurrentRepository().getProject().build( IncrementalProjectBuilder.FULL_BUILD, XTEXT_BUILDER_ID, Collections.<String, String>emptyMap(), null); } catch (final CoreException e) { BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID); } } }
From source file:org.bonitasoft.studio.data.ui.wizard.DataWizardDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); if (dataSection != null) { createAndNewButton = super.createButton(parent, CREATE_AND_NEW_ID, Messages.createAndNewButton, true); setButtonLayoutData(createAndNewButton); }/*from w w w .ja v a 2s . c o m*/ Button cancelButton = getButton(IDialogConstants.CANCEL_ID); cancelButton.setText(IDialogConstants.CANCEL_LABEL); Button finishButton = getButton(IDialogConstants.FINISH_ID); cancelButton.moveBelow(null); if (dataSection != null) { createAndNewButton.moveAbove(cancelButton); finishButton.setText(IDialogConstants.FINISH_LABEL); } else { finishButton.setText(IDialogConstants.OK_LABEL); } finishButton.moveAbove(createAndNewButton); }
From source file:org.bonitasoft.studio.document.ui.DocumentPropertySection.java
License:Open Source License
private int openOutlineDialog(final IStructuredSelection selection) { final StringBuilder sb = new StringBuilder(); for (final Object selectionElement : selection.toList()) { if (selectionElement instanceof Document) { sb.append(((Document) selectionElement).getName() + "\n"); }// www .ja v a2s. c o m } if (sb.length() > 0) { sb.delete(sb.length() - 1, sb.length()); } final String[] buttonList = { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; final java.util.List<Object> selectionList = ((IStructuredSelection) documentListViewer.getSelection()) .toList(); final OutlineDialog dialog = new OutlineDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), removalConfirmationDialogTitle, Display.getCurrent().getSystemImage(SWT.ICON_WARNING), NLS.bind(Messages.areYouSureMessage, sb.toString()), MessageDialog.CONFIRM, buttonList, 1, selectionList); return dialog.open(); }
From source file:org.bonitasoft.studio.engine.ui.dialog.ProcessEnablementProblemsDialog.java
License:Open Source License
public ProcessEnablementProblemsDialog(Shell parentShell, String dialogMessage, AbstractProcess process, List<Problem> processResolutionProblems) { super(parentShell, Messages.processEnableFailedTitle, null, dialogMessage, INFORMATION, new String[] { Messages.configure, IDialogConstants.CANCEL_LABEL }, 0); this.process = process; this.processResolutionProblems = processResolutionProblems; }