List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_LABEL
String OK_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_LABEL.
Click Source Link
From source file:org.apache.directory.studio.openldap.config.editor.dialogs.ReplicationConsumerDialog.java
License:Apache License
/** * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) *///from w ww . j a va 2 s . c o m @Override protected void createButtonsForButtonBar(Composite parent) { okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); updateOkButtonEnableState(); }
From source file:org.apache.directory.studio.openldap.config.editor.dialogs.RwmMappingDialog.java
License:Apache License
/** * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) *//* w w w .ja v a 2 s.c om*/ @Override protected void createButtonsForButtonBar(Composite parent) { okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); checkAndUpdateOkButtonEnableState(); }
From source file:org.apache.directory.studio.schemaeditor.view.dialogs.AbstractRenameDialog.java
License:Apache License
/** * {@inheritDoc}/*from w ww . j av a 2 s .c om*/ */ protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); }
From source file:org.apache.directory.studio.schemaeditor.view.dialogs.MessageDialogWithTextarea.java
License:Apache License
/** * Instantiates a dialog.// w ww. j a v a2 s .c o m * * @param parentShell the parent shell * @param title the title * @param message the message * @param detailMessage the detail message */ public MessageDialogWithTextarea(Shell parentShell, String title, String message, String detailMessage) { super(parentShell, title, null, message, INFORMATION, new String[] { IDialogConstants.OK_LABEL }, OK); setShellStyle(SWT.RESIZE); this.detailMessage = detailMessage; }
From source file:org.apache.directory.studio.templateeditor.view.preferences.PreferencesTemplatesManager.java
License:Apache License
/** * Saves the modifications back to the initial manager. */// w w w . jav a 2 s.c o m public boolean saveModifications() { // Getting original templates Template[] originalTemplates = manager.getTemplates(); // Creating a list of original templates List<Template> originalTemplatesList = new ArrayList<Template>(); // Looping on original templates for (Template originalTemplate : originalTemplates) { // Checking if the enablement state has been changed boolean isEnabled = isEnabled(originalTemplate); if (manager.isEnabled(originalTemplate) != isEnabled) { if (isEnabled) { manager.enableTemplate(originalTemplate); } else { manager.disableTemplate(originalTemplate); } } // Checking if the default state has been changed boolean isDefaultTemplate = isDefaultTemplate(originalTemplate); if (manager.isDefaultTemplate(originalTemplate) != isDefaultTemplate) { if (isDefaultTemplate) { manager.setDefaultTemplate(originalTemplate); } else { manager.unSetDefaultTemplate(originalTemplate); } } // Checking if the original template has been removed if (!templatesList.contains(originalTemplate)) { if (!manager.removeTemplate((FileTemplate) originalTemplate)) { // Creating and opening the error dialog String dialogTitle = Messages .getString("PreferencesTemplatesManager.UnableToRemoveTheTemplate"); //$NON-NLS-1$ String dialogMessage = MessageFormat.format( Messages.getString("PreferencesTemplatesManager.TheTemplateCouldNotBeRemoved") //$NON-NLS-1$ + EntryTemplatePluginUtils.LINE_SEPARATOR + EntryTemplatePluginUtils.LINE_SEPARATOR + Messages.getString( "PreferencesTemplatesManager.SeeTheLogsFileForMoreInformation"), //$NON-NLS-1$ originalTemplate.getTitle()); MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), dialogTitle, null, dialogMessage, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, MessageDialog.OK); dialog.open(); return false; } } // Adding the template to the list originalTemplatesList.add(originalTemplate); } // Looping on the new templates list for (Template template : templatesList) { // Checking if the template has been added if (!originalTemplatesList.contains(template)) { // Adding the new template if (!manager.addTemplate(new File(((PreferencesFileTemplate) template).getFilePath()))) { // Creating and opening the error dialog String dialogTitle = Messages.getString("PreferencesTemplatesManager.UnableToAddTheTemplate"); //$NON-NLS-1$ String dialogMessage = MessageFormat.format( Messages.getString("PreferencesTemplatesManager.TheTemplateCouldNotBeAdded") //$NON-NLS-1$ + EntryTemplatePluginUtils.LINE_SEPARATOR + EntryTemplatePluginUtils.LINE_SEPARATOR + Messages.getString( "PreferencesTemplatesManager.SeeTheLogsFileForMoreInformation"), //$NON-NLS-1$ template.getTitle()); MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), dialogTitle, null, dialogMessage, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, MessageDialog.OK); dialog.open(); return false; } // Setting the enablement state to the new template boolean isEnabled = isEnabled(template); if (isEnabled) { manager.enableTemplate(template); } else { manager.disableTemplate(template); } // Setting the default state has been changed boolean isDefaultTemplate = isDefaultTemplate(template); if (isDefaultTemplate) { manager.setDefaultTemplate(template); } else { manager.unSetDefaultTemplate(template); } } } return true; }
From source file:org.apache.directory.studio.templateeditor.view.preferences.TemplateEntryEditorPreferencePage.java
License:Apache License
/** * Implements the remove template action. *//* w w w . java 2 s .c o m*/ @SuppressWarnings("unchecked") private void removeTemplateAction() { StructuredSelection selection = (StructuredSelection) templatesViewer.getSelection(); if (!selection.isEmpty()) { Iterator<Object> selectionIterator = ((StructuredSelection) templatesViewer.getSelection()).iterator(); while (selectionIterator.hasNext()) { Object selectedObject = selectionIterator.next(); if (selectedObject instanceof Template) { Template template = (Template) selectedObject; if (!manager.removeTemplate(template)) { // Creating and opening the dialog String dialogTitle = Messages .getString("TemplateEntryEditorPreferencePage.UnableToRemoveTheTemplate"); //$NON-NLS-1$ String dialogMessage = MessageFormat.format(Messages .getString("TemplateEntryEditorPreferencePage.TheTemplateCouldNotBeRemoved") //$NON-NLS-1$ + EntryTemplatePluginUtils.LINE_SEPARATOR + EntryTemplatePluginUtils.LINE_SEPARATOR + Messages.getString( "TemplateEntryEditorPreferencePage.SeeTheLogsFileForMoreInformation"), //$NON-NLS-1$ template.getTitle()); MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), dialogTitle, null, dialogMessage, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, MessageDialog.OK); dialog.open(); } } } } }
From source file:org.apache.directory.studio.templateeditor.view.wizards.ExportTemplatesWizard.java
License:Apache License
/** * {@inheritDoc}/*from ww w . ja v a 2 s. c o m*/ */ public boolean performFinish() { // Saving the dialog settings page.saveDialogSettings(); // Getting the selected templates and export directory final Template[] selectedTemplates = page.getSelectedTemplates(); final File exportDirectory = new File(page.getExportDirectory()); // Creating a list where all the template files that could not be // exported will be stored final List<Template> failedTemplates = new ArrayList<Template>(); if (selectedTemplates != null) { try { getContainer().run(false, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { for (Template selectedTemplate : selectedTemplates) { try { // Creating the output stream FileOutputStream fos = new FileOutputStream( new File(exportDirectory, selectedTemplate.getId() + ".xml")); //$NON-NLS-1$ // Exporting the template TemplateIO.save(selectedTemplate, fos); fos.close(); } catch (FileNotFoundException e) { // Logging the error EntryTemplatePluginUtils.logError(e, Messages.getString( "ExportTemplatesWizard.TheTemplateCouldNotBeExportedBecauseOfTheFollowingError"), //$NON-NLS-1$ selectedTemplate.getTitle(), selectedTemplate.getId(), e.getMessage()); // Adding the template to the failed templates list failedTemplates.add(selectedTemplate); } catch (IOException e) { // Logging the error EntryTemplatePluginUtils.logError(e, Messages.getString( "ExportTemplatesWizard.TheTemplateCouldNotBeExportedBecauseOfTheFollowingError"), //$NON-NLS-1$ selectedTemplate.getTitle(), selectedTemplate.getId(), e.getMessage()); // Adding the template to the failed templates list failedTemplates.add(selectedTemplate); } } } }); } catch (InvocationTargetException e) { // Nothing to do (it will never occur) } catch (InterruptedException e) { // Nothing to do. } } // Handling the templates that could not be exported if (failedTemplates.size() > 0) { String title = null; String message = null; // Only one template could not be imported if (failedTemplates.size() == 1) { // Getting the failed template Template failedTemplate = failedTemplates.get(0); // Creating the title and message title = Messages.getString("ExportTemplatesWizard.ATemplateCouldNotBeExported"); //$NON-NLS-1$ message = MessageFormat.format( Messages.getString("ExportTemplatesWizard.TheTemplateCouldNotBeExported"), failedTemplate //$NON-NLS-1$ .getTitle(), failedTemplate.getId()); } // Several templates could not be imported else { title = Messages.getString("ExportTemplatesWizard.SeveralTemplatesCouldNotBeExported"); //$NON-NLS-1$ message = Messages.getString("ExportTemplatesWizard.TheFollowingTemplatesCouldNotBeExported"); //$NON-NLS-1$ for (Template failedTemplate : failedTemplates) { message += EntryTemplatePluginUtils.LINE_SEPARATOR + " - " //$NON-NLS-1$ + MessageFormat.format("{0} ({1})", failedTemplate.getTitle(), failedTemplate.getId()); //$NON-NLS-1$ } } // Common ending message message += EntryTemplatePluginUtils.LINE_SEPARATOR + EntryTemplatePluginUtils.LINE_SEPARATOR + Messages.getString("ExportTemplatesWizard.SeeTheLogsFileForMoreInformation"); //$NON-NLS-1$ // Creating and opening the dialog MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, null, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, MessageDialog.OK); dialog.open(); } return true; }
From source file:org.apache.directory.studio.templateeditor.view.wizards.ImportTemplatesWizard.java
License:Apache License
/** * {@inheritDoc}/*from w ww. j av a 2 s. c o m*/ */ public boolean performFinish() { // Saving the dialog settings page.saveDialogSettings(); // Getting the templates to be imported final File[] selectedTemplateFiles = page.getSelectedTemplateFiles(); // Creating a list where all the template files that could not be // imported will be stored final List<File> failedTemplates = new ArrayList<File>(); // Running the code to add the templates in a separate container // with progress monitor try { getContainer().run(false, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { for (File selectedTemplateFile : selectedTemplateFiles) { if (!manager.addTemplate(selectedTemplateFile)) { failedTemplates.add(selectedTemplateFile); } } } }); } catch (InvocationTargetException e) { // Nothing to do (it will never occur) } catch (InterruptedException e) { // Nothing to do. } // Handling the templates that could not be added if (failedTemplates.size() > 0) { String title = null; String message = null; // Only one template could not be imported if (failedTemplates.size() == 1) { title = Messages.getString("ImportTemplatesWizard.ATemplateCouldNotBeImported"); //$NON-NLS-1$ message = MessageFormat.format( Messages.getString("ImportTemplatesWizard.TheTemplateCouldNotBeImported"), //$NON-NLS-1$ failedTemplates.get(0).getAbsolutePath()); } // Several templates could not be imported else { title = Messages.getString("ImportTemplatesWizard.SeveralTemplatesCouldNotBeImported"); //$NON-NLS-1$ message = Messages.getString("ImportTemplatesWizard.TheFollowingTemplatesCouldNotBeImported"); //$NON-NLS-1$ for (File failedTemplate : failedTemplates) { message += EntryTemplatePluginUtils.LINE_SEPARATOR + " - " //$NON-NLS-1$ + failedTemplate.getAbsolutePath(); } } // Common ending message message += EntryTemplatePluginUtils.LINE_SEPARATOR + EntryTemplatePluginUtils.LINE_SEPARATOR + Messages.getString("ImportTemplatesWizard.SeeTheLogsFileForMoreInformation"); //$NON-NLS-1$ // Creating and opening the dialog MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, null, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, MessageDialog.OK); dialog.open(); } return true; }
From source file:org.apache.directory.studio.valueeditors.certificate.CertificateDialog.java
License:Apache License
/** * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) *///from w w w .j a v a 2 s. com protected void createButtonsForButtonBar(Composite parent) { createButton(parent, LOAD_BUTTON_ID, Messages.getString("CertificateDialog.LoadCertificateButton"), false); //$NON-NLS-1$ createButton(parent, SAVE_BUTTON_ID, Messages.getString("CertificateDialog.SaveCertificateButton"), false); //$NON-NLS-1$ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:org.apache.directory.studio.valueeditors.image.ImageDialog.java
License:Apache License
/** * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */// w w w . j ava 2 s . c om protected void createButtonsForButtonBar(Composite parent) { okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); // load dialog settings try { int tabIndex = ValueEditorsActivator.getDefault().getDialogSettings() .getInt(SELECTED_TAB_DIALOGSETTINGS_KEY); tabFolder.setSelection(tabIndex); } catch (Exception e) { // Nothing to do } // Updating the tab folder on load updateTabFolder(); }