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:com.nokia.tools.s60ct.javaversionchecker.ui.ShowDialogJob.java
License:Open Source License
/** * Shows JRE warning dialog./*w w w . ja v a2s. c o m*/ * @return state of toggle */ private static boolean showDialog() { MessageDialogWithToggle dialog = new MessageDialogWithToggle( PlatformUI.getWorkbench().getDisplay().getActiveShell(), MessageGenerator.generateTitle(), null, MessageGenerator.generateMessage(), MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0, "Do not warn again", false) { protected Control createMessageArea(Composite composite) { Image image = getImage(); if (image != null) { imageLabel = new Label(composite, SWT.NULL); image.setBackground(imageLabel.getBackground()); imageLabel.setImage(image); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel); } Link link = new Link(composite, getMessageLabelStyle()); link.setText(message); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if ("Download JRE".equals(e.text)) { try { IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport() .getExternalBrowser(); browser.openURL(new URL(SupportedJavaVersions.sunJre1_6_0_DownloadSite)); } catch (MalformedURLException ex) { ex.printStackTrace(); } catch (PartInitException ex) { ex.printStackTrace(); } } else { try { IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport() .getExternalBrowser(); browser.openURL(new URL( "http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/running_eclipse.htm")); } catch (MalformedURLException ex) { ex.printStackTrace(); } catch (PartInitException ex) { ex.printStackTrace(); } } } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false) .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT) .applyTo(link); return composite; } }; dialog.open(); return dialog.getToggleState(); }
From source file:com.nokia.tools.screen.ui.utils.FileChangeWatchThread.java
License:Open Source License
public static void displayThirdPartyEditorMisssingErrorMessageBox() { IBrandingManager branding = BrandingExtensionManager.getBrandingManager(); Image image = null;//from ww w .j a v a2 s. c om if (branding != null) { image = branding.getIconImageDescriptor().createImage(); } MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.FileChangeWatchThread_editorSettingsError, image, Messages.FileChangeWatchThread_editorError, 1, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); dialog.open(); if (image != null) { image.dispose(); } }
From source file:com.nokia.tools.screen.ui.wizards.AbstractPackagingOperation.java
License:Open Source License
public void run(IProgressMonitor parentMonitor) throws InvocationTargetException, InterruptedException { SubProgressMonitor childMonitor;//from w ww .j a v a 2 s. c om String progressString = "Packaging theme..."; String subProgressString = ""; File workingDir; IFolder folder = null, folderTemp = null; String dir = UiPlugin.getDefault().getPreferenceStore().getString(IScreenConstants.PREF_PACKAGING_DIR); parentMonitor.beginTask(progressString, IProgressMonitor.UNKNOWN); //parentMonitor.worked(INCREMENT); parentMonitor.subTask(subProgressString); childMonitor = new SubProgressMonitor(parentMonitor, IProgressMonitor.UNKNOWN); if (dir == null || !IScreenConstants.PACKAGING_DIR_PROJECT.equalsIgnoreCase(dir)) { workingDir = new File(System.getProperty("java.io.tmpdir") + File.separator + project.getName() + "_" + IScreenConstants.PACKAGING_DIR_NAME); if (workingDir.isFile()) { workingDir.delete(); } workingDir.mkdirs(); File[] files = workingDir.listFiles(); if (files != null) { for (File file : files) { file.delete(); } } } else { folder = project.getFolder(IScreenConstants.PACKAGING_DIR_NAME); folderTemp = project.getFolder(IScreenConstants.PACKAGING_DIR_NAME + "_temp"); if (!folder.exists()) { try { folder.create(true, true, childMonitor); } catch (Exception e) { UiPlugin.error(e); } } try { folderTemp.delete(true, false, childMonitor); } catch (CoreException e1) { UiPlugin.error(e1); } if (!folderTemp.exists()) { try { folderTemp.create(true, true, childMonitor); } catch (Exception e) { UiPlugin.error(e); } } workingDir = folderTemp.getLocation().toFile(); } parentMonitor.subTask(subProgressString); childMonitor = new SubProgressMonitor(parentMonitor, IProgressMonitor.UNKNOWN); context.setAttribute(PackagingAttribute.workingDir.name(), workingDir.getAbsolutePath()); try { doPackaging(childMonitor); if (folder != null && folderTemp != null) { try { folder.delete(true, false, null); } catch (Exception e) { showErrorMessage(); UiPlugin.error(e); return; } try { folderTemp.move(folder.getProjectRelativePath(), true, false, null); } catch (Exception e) { UiPlugin.error(e); } } PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { /* * (non-Javadoc) * * @see java.lang.Runnable#run() */ public void run() { try { IPreferenceStore store = UiPlugin.getDefault().getPreferenceStore(); String file = (String) context.getAttribute(PackagingAttribute.sisFile.name()); if (file == null) { file = (String) context.getAttribute(PackagingAttribute.output.name()); } IBrandingManager branding = BrandingExtensionManager.getBrandingManager(); Image image = null; if (branding != null) { image = branding.getIconImageDescriptor().createImage(); } String message = MessageFormat.format( WizardMessages.New_Package_Package_Created_Description, new Object[] { file }); String[] dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell(), WizardMessages.New_Package_Package_Created_Title, image, message, 2, dialogButtonLabels, 0); dialog.open(); if (image != null) { image.dispose(); } } catch (Exception e) { UiPlugin.error(e); } } }); parentMonitor.subTask(subProgressString); childMonitor = new SubProgressMonitor(parentMonitor, IProgressMonitor.UNKNOWN); // cleans up the temporary folder only when the packaging is // successful, so we could examine more easily what is wrong. if (folderTemp != null) { try { folderTemp.delete(true, false, childMonitor); } catch (final CoreException e) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { MessageDialog.openInformation(PlatformUI.getWorkbench().getDisplay().getActiveShell(), WizardMessages.New_Package_Package_Creation_Error_Title, WizardMessages.New_Package_Package_Deleting_Temp_Folder_Problem); } }); } } else { FileUtils.deleteDirectory(workingDir); } } catch (final Exception e) { UiPlugin.error(e); String sisTempFile = (String) context.getAttribute(PackagingAttribute.sisTempFile.name()); if (sisTempFile != null) { // removes the sis temporary file in case signing failed new File(sisTempFile).delete(); } PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { MessageDialogWithTextContent.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), WizardMessages.New_Package_Package_Creation_Error_Title, MessageFormat.format(WizardMessages.New_Package_Package_Creation_Error_Description, new Object[] { e.getMessage() }), e instanceof PackagingException ? ((PackagingException) e).getDetails() : StringUtils.dumpThrowable(e)); } }); } finally { parentMonitor.setTaskName(""); parentMonitor.subTask(subProgressString); childMonitor = new SubProgressMonitor(parentMonitor, IProgressMonitor.UNKNOWN); childMonitor.done(); parentMonitor.done(); try { project.refreshLocal(IProject.DEPTH_INFINITE, childMonitor); } catch (Exception e) { UiPlugin.error(e); } } }
From source file:com.nokia.tools.startuptip.ui.StartupTipDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { previousButton = createButton(parent, StartupTipDialog.PREVIOUS_ID, StartupTipDialog.PREVIOUS_LABEL, false); if (!tipSelector.previousAvailable()) { previousButton.setEnabled(false); }//from w w w. j av a2 s.c o m createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); }
From source file:com.nokia.tools.theme.s60.ui.dialogs.KeyPairsDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { PlatformUI.getWorkbench().getHelpSystem().setHelp(parent.getParent(), KeyPairsDialog.KEY_PAIRS_DIALOG_CONTEXT); Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); setTitle(WizardMessages.Key_Pairs_Banner_Title); setMessage(WizardMessages.Key_Pairs_Banner_Message); GridLayout layout = new GridLayout(); container.setLayout(layout);/* w w w.jav a2 s .c o m*/ layout.numColumns = 5; layout.marginHeight = 13; layout.marginWidth = 13; layout.verticalSpacing = 7; lblKeyPairs = new Label(container, SWT.NONE); lblKeyPairs.setText(WizardMessages.Key_Pairs_lblKeyPairs_Text); GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false); gd.verticalSpan = 2; lblKeyPairs.setLayoutData(gd); lstKeyPairs = new List(container, SWT.V_SCROLL | SWT.BORDER | SWT.H_SCROLL); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 3; gd.verticalSpan = 2; gd.widthHint = 280; gd.heightHint = 77; lstKeyPairs.setLayoutData(gd); lstKeyPairs.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (lstKeyPairs.getSelectionIndex() != -1) { strSelKeyPair = lstKeyPairs.getItem(lstKeyPairs.getSelectionIndex()); updateKeyPairContent(strSelKeyPair); updateStates(); } } }); btnEdit = new Button(container, SWT.NONE); initializeDialogUnits(btnEdit); setButtonLayoutData(btnEdit); btnEdit.setText(WizardMessages.Key_Pairs_btnEdit_Text); gd = new GridData(SWT.FILL, SWT.TOP, false, false); btnEdit.setLayoutData(gd); btnEdit.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { strSelKeyPair = lstKeyPairs.getItem(lstKeyPairs.getSelectionIndex()); contentChanged = false; dialogMode = 3; updateStates(); txtKeyPairName.setFocus(); } public void widgetDefaultSelected(SelectionEvent e) { } }); btnDelete = new Button(container, SWT.NONE); initializeDialogUnits(btnDelete); setButtonLayoutData(btnDelete); btnDelete.setText(WizardMessages.Key_Pairs_btnDelete_Text); gd = new GridData(SWT.FILL, SWT.TOP, false, false); btnDelete.setLayoutData(gd); btnDelete.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { IBrandingManager branding = BrandingExtensionManager.getBrandingManager(); Image image = null; if (branding != null) { image = branding.getIconImageDescriptor().createImage(); } MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), WizardMessages.Key_Pairs_Delete_MsgBox_Title, image, WizardMessages.Key_Pairs_Delete_MsgBox_Message, 3, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); if (dialog.open() == 0) { int index = lstKeyPairs.getSelectionIndex(); strSelKeyPair = lstKeyPairs.getItem(lstKeyPairs.getSelectionIndex()); deleteKeyPair(index, strSelKeyPair); updateKeyPairList(); dialogMode = 1; if (lstKeyPairs.getItemCount() > 0) { lstKeyPairs.select(0); updateKeyPairContent(lstKeyPairs.getItem(lstKeyPairs.getSelectionIndex())); updateStates(); } else { clearTextBoxes(); } dialogChanged(); } if (image != null) { image.dispose(); } } public void widgetDefaultSelected(SelectionEvent e) { } }); final Label separator = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 5; separator.setLayoutData(gd); lblKeyPairName = new Label(container, SWT.NONE); lblKeyPairName.setText(WizardMessages.Key_Pairs_lblKeyPairName_Text); txtKeyPairName = new Text(container, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; gd.widthHint = 280; txtKeyPairName.setLayoutData(gd); txtKeyPairName.setTextLimit(TEXT_LIMIT); txtKeyPairName.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { strPairName = txtKeyPairName.getText().trim(); if (dialogMode == 3) contentChanged = true; dialogChanged(); } }); // Dummy label to fill a column new Label(container, SWT.NONE); lblPublicKeyFile = new Label(container, SWT.NONE); lblPublicKeyFile.setText(WizardMessages.Key_Pairs_lblPublicKeyFile_Text); txtPrivateKeyFile = new Text(container, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = 282; gd.horizontalSpan = 3; txtPrivateKeyFile.setLayoutData(gd); txtPrivateKeyFile.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { strSelKey = txtPrivateKeyFile.getText(); if (dialogMode == 3) contentChanged = true; dialogChanged(); } }); shell = this.getShell(); class OpenKey implements SelectionListener { public void widgetSelected(SelectionEvent event) { FileDialog fileDialog = new FileDialog(shell, SWT.OPEN); fileDialog.setText(WizardMessages.Key_Pairs_keyFileDialog_Title); fileDialog.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); fileDialog.setFilterExtensions(keyFilterExt); if (strSelKey != "") fileDialog.setFileName(strSelKey); if (fileDialog.open() != null) { String separator = ""; int length = fileDialog.getFilterPath().trim().length(); if (length > 0 && fileDialog.getFilterPath().charAt(length - 1) != File.separatorChar) separator = File.separator; strSelKey = new Path(fileDialog.getFilterPath() + separator + fileDialog.getFileName()) .toOSString(); txtPrivateKeyFile.setText(strSelKey); } txtPrivateKeyFile.setFocus(); } public void widgetDefaultSelected(SelectionEvent event) { } } btnKeyBrowse = new Button(container, SWT.NONE); initializeDialogUnits(btnKeyBrowse); setButtonLayoutData(btnKeyBrowse); btnKeyBrowse.setText(WizardMessages.Key_Pairs_btnKeyBrowse_Text); btnKeyBrowse.addSelectionListener(new OpenKey()); lblCerFile = new Label(container, SWT.NONE); lblCerFile.setText(WizardMessages.Key_Pairs_lblCerFile_Text); txtCerFile = new Text(container, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = 280; gd.horizontalSpan = 3; txtCerFile.setLayoutData(gd); txtCerFile.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { strSelCer = txtCerFile.getText(); if (dialogMode == 3) contentChanged = true; dialogChanged(); } }); class OpenCer implements SelectionListener { public void widgetSelected(SelectionEvent event) { FileDialog fileDialog = new FileDialog(shell, SWT.OPEN); fileDialog.setText(WizardMessages.Key_Pairs_cerFileDialog_Title); fileDialog.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); fileDialog.setFilterExtensions(cerFilterExt); if (strSelCer != "") fileDialog.setFileName(strSelCer); if (fileDialog.open() != null) { String separator = ""; int length = fileDialog.getFilterPath().length(); if (length > 0 && fileDialog.getFilterPath().charAt(length - 1) != File.separatorChar) separator = File.separator; strSelCer = new Path(fileDialog.getFilterPath() + separator + fileDialog.getFileName()) .toOSString(); txtCerFile.setText(strSelCer); } txtCerFile.setFocus(); } public void widgetDefaultSelected(SelectionEvent event) { } } btnCerBrowse = new Button(container, SWT.NONE); initializeDialogUnits(btnCerBrowse); setButtonLayoutData(btnCerBrowse); btnCerBrowse.setText(WizardMessages.Key_Pairs_btnCerBrowse_Text); btnCerBrowse.addSelectionListener(new OpenCer()); lblPassword = new Label(container, SWT.NONE); lblPassword.setText(WizardMessages.Key_Pairs_lblPassword_Text); txtPassword = new Text(container, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; txtPassword.setLayoutData(gd); txtPassword.setEchoChar('*'); txtPassword.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { strPassword = txtPassword.getText(); if (dialogMode == 3) contentChanged = true; dialogChanged(); } }); warningContainer = new Composite(container, SWT.NONE); layout = new GridLayout(); warningContainer.setLayout(layout); gd = new GridData(SWT.RIGHT, SWT.TOP, false, false); gd.verticalSpan = 2; warningContainer.setLayoutData(gd); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; warningContainer.setVisible(false); warningImage = ISharedImageDescriptor.ICON16_WARNING.createImage(); infoImage = ISharedImageDescriptor.ICON16_INFO.createImage(); Label lblInfo2Image = new Label(warningContainer, SWT.NONE); gd = new GridData(SWT.RIGHT, SWT.TOP, false, false); lblInfo2Image.setLayoutData(gd); lblInfo2Image.setImage(warningImage); Label lblInfo2Text = new Label(warningContainer, SWT.WRAP); gd = new GridData(GridData.FILL_BOTH); gd.widthHint = 150; lblInfo2Text.setLayoutData(gd); lblInfo2Text.setText(WizardMessages.Key_Pairs_lblInfo2Text_Text); // Dummy labels to fill columns new Label(container, SWT.NONE); new Label(container, SWT.NONE); chkSavePassword = new Button(container, SWT.CHECK); chkSavePassword.setText(WizardMessages.Key_Pairs_chkSavePassword_Text); chkSavePassword.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (dialogMode == 3) { contentChanged = true; } dialogChanged(); } public void widgetDefaultSelected(SelectionEvent e) { } }); // Dummy label to fill a column Label label4 = new Label(container, SWT.NONE); gd = new GridData(GridData.FILL_HORIZONTAL); label4.setLayoutData(gd); // Dummy label to fill a column new Label(container, SWT.NONE); lblSavePasswordInfoImage = new Label(container, SWT.NONE); gd = new GridData(SWT.RIGHT, SWT.TOP, false, false); lblSavePasswordInfoImage.setLayoutData(gd); lblSavePasswordInfoImage.setImage(warningImage); lblSavePasswordInfo = new Label(container, SWT.WRAP); gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = 300; gd.horizontalSpan = 3; lblSavePasswordInfo.setLayoutData(gd); lblSavePasswordInfo.setText(WizardMessages.Key_Pairs_chkSavePasswordWarning_Text); // Dummy label to fill a column new Label(container, SWT.NONE); Composite container2 = new Composite(container, SWT.NONE); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 5; gd.verticalIndent = 5; container2.setLayoutData(gd); GridLayout layout2 = new GridLayout(); container2.setLayout(layout2); layout2.numColumns = 5; layout2.marginHeight = 0; layout2.marginWidth = 0; layout2.verticalSpacing = 7; // Dummy label to fill a column Label label5 = new Label(container2, SWT.NONE); gd = new GridData(GridData.FILL_HORIZONTAL); label5.setLayoutData(gd); btnNew = new Button(container2, SWT.NONE); initializeDialogUnits(btnNew); setButtonLayoutData(btnNew); btnNew.setText(WizardMessages.Key_Pairs_btnNew_Text); btnNew.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { clearTextBoxes(); dialogMode = 2; updateStates(); txtKeyPairName.setFocus(); } public void widgetDefaultSelected(SelectionEvent e) { } }); btnKeys = new Button(container2, SWT.NONE); initializeDialogUnits(btnKeys); setButtonLayoutData(btnKeys); btnKeys.setText(WizardMessages.Key_Pairs_btnKeys_Text); btnKeys.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { MakeKeysDialog makeKeysDialog = new MakeKeysDialog(getShell()); makeKeysDialog.create(); makeKeysDialog.open(); if (makeKeysDialog.getReturnCode() == 0) { strSelKey = makeKeysDialog.getKeyDestination(); txtPrivateKeyFile.setText(strSelKey); strSelCer = makeKeysDialog.getCerDestination(); txtCerFile.setText(strSelCer); strPassword = makeKeysDialog.getPassword(); if (strPassword.equals("")) { txtPassword.setText(""); txtPassword.setEnabled(false); } else txtPassword.setText(strPassword); if (dialogMode == 3) contentChanged = true; dialogChanged(); } } public void widgetDefaultSelected(SelectionEvent e) { } }); btnSave = new Button(container2, SWT.NONE); initializeDialogUnits(btnSave); setButtonLayoutData(btnSave); btnSave.setText(WizardMessages.Key_Pairs_btnSave_Text); btnSave.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { // Case creating a new key pair if (dialogMode == 2) { shell.setEnabled(false); shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); txtKeyPairName.setText(strPairName); if (validateKeyPairContent(strSelKey, strSelCer, strPassword)) { saveKeyPair(strPairName, strSelKey, strSelCer, strPassword); updateKeyPairList(); dialogMode = 1; shell.setEnabled(true); shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_ARROW)); lstKeyPairs.select(lstKeyPairs.indexOf(strPairName)); dialogChanged(); // if (chkSavePassword.getSelection() != true) // txtPassword.setText(""); return; } shell.setEnabled(true); shell.setCursor(new Cursor(shell.getDisplay(), SWT.CURSOR_ARROW)); IBrandingManager branding = BrandingExtensionManager.getBrandingManager(); Image image = null; if (branding != null) { image = branding.getIconImageDescriptor().createImage(); } MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell(), WizardMessages.Key_Pairs_Generate_MsgBox_Error_Title, image, WizardMessages.Key_Pairs_Generate_MsgBox_Error_Message, 1, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); if (image != null) { image.dispose(); } } // saving an existing key pair if (dialogMode == 3) { shell.setEnabled(false); shell.setCursor(new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT)); txtKeyPairName.setText(strPairName); if (validateKeyPairContent(strSelKey, strSelCer, strPassword)) { int index = lstKeyPairs.getSelectionIndex(); strSelKeyPair = lstKeyPairs.getItem(lstKeyPairs.getSelectionIndex()); deleteKeyPair(index, strSelKeyPair); updateKeyPairList(); saveKeyPair(strPairName, strSelKey, strSelCer, strPassword); updateKeyPairList(); dialogMode = 1; shell.setEnabled(true); shell.setCursor(new Cursor(shell.getDisplay(), SWT.CURSOR_ARROW)); lstKeyPairs.select(lstKeyPairs.indexOf(strPairName)); dialogChanged(); // if (chkSavePassword.getSelection() != true) // txtPassword.setText(""); return; } shell.setEnabled(true); shell.setCursor(new Cursor(shell.getDisplay(), SWT.CURSOR_ARROW)); IBrandingManager branding = BrandingExtensionManager.getBrandingManager(); Image image = null; if (branding != null) { image = branding.getIconImageDescriptor().createImage(); } MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell(), WizardMessages.Key_Pairs_Save_MsgBox_Error_Title, image, WizardMessages.Key_Pairs_Save_MsgBox_Error_Message, 1, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); if (image != null) { image.dispose(); } } } public void widgetDefaultSelected(SelectionEvent e) { } }); btnCancel = new Button(container2, SWT.NONE); initializeDialogUnits(btnCancel); setButtonLayoutData(btnCancel); btnCancel.setText(WizardMessages.Key_Pairs_btnCancel_Text); btnCancel.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (dialogMode == 2) { if (lstKeyPairs.getSelectionIndex() != -1) { strSelKeyPair = lstKeyPairs.getItem(lstKeyPairs.getSelectionIndex()); updateKeyPairContent(strSelKeyPair); } else if (lstKeyPairs.getItemCount() > 0) { lstKeyPairs.select(0); updateKeyPairContent(lstKeyPairs.getItem(lstKeyPairs.getSelectionIndex())); } else clearTextBoxes(); } else updateKeyPairContent(lstKeyPairs.getItem(lstKeyPairs.getSelectionIndex())); dialogMode = 1; dialogChanged(); } public void widgetDefaultSelected(SelectionEvent e) { } }); Composite container3 = new Composite(area, SWT.NONE); container3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout3 = new GridLayout(); container3.setLayout(layout3); layout3.numColumns = 1; layout3.marginHeight = 0; layout3.marginWidth = 0; layout3.verticalSpacing = 0; final Label separator2 = new Label(container3, SWT.SEPARATOR | SWT.HORIZONTAL); gd = new GridData(GridData.FILL_HORIZONTAL); separator2.setLayoutData(gd); updateKeyPairList(); if (lstKeyPairs.getItemCount() > 0) { updateKeyPairContent(lstKeyPairs.getItem(lstKeyPairs.getSelectionIndex())); } updateStates(); return area; }
From source file:com.nokia.tools.theme.s60.ui.wizards.NewPackagePage2.java
License:Open Source License
public boolean performFinish() { File file = new File(selDestination); IBrandingManager branding = BrandingExtensionManager.getBrandingManager(); Image image = null;/*from w w w .j av a2 s . co m*/ if (branding != null) { image = branding.getIconImageDescriptor().createImage(); } // Check for password in keypairs KeyPair[] keyPairs = null; try { keyPairs = KeyPair.getKeyPairs(); } catch (PackagingException e1) { e1.printStackTrace(); } if (btnNoSign.getSelection() == false) { if (keyPairs.length > 0) { if (keyPairs[cboKeyPairs.getSelectionIndex()].getPassword() != null && !("".equals(keyPairs[cboKeyPairs.getSelectionIndex()].getPassword().equals("")))) { if (txtPassword != null && !(keyPairs[cboKeyPairs.getSelectionIndex()].getPassword() .equals(txtPassword.getText()))) { MessageDialog dialog1 = new MessageDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell(), com.nokia.tools.screen.ui.wizards.WizardMessages.New_Package_Mismatch_Password_Error_Message_Title, image, com.nokia.tools.screen.ui.wizards.WizardMessages.New_Package_Mismatch_Password_Error_Message, 1, new String[] { IDialogConstants.OK_LABEL }, 0); getShell().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_ARROW)); dialog1.open(); if (image != null) { image.dispose(); } return false; } } } } // End key pairs password checks. if (file.exists()) { MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), com.nokia.tools.screen.ui.wizards.WizardMessages.New_Package_Package_Exist_MsgBox_Title, image, com.nokia.tools.screen.ui.wizards.WizardMessages.New_Package_Package_Exist_MsgBox_Message, 3, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); int ret = dialog.open(); if (image != null) { image.dispose(); } if (ret != Window.OK) { return false; } } if (txtPassword != null) { getShell().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT)); String cerFile = (String) context.getAttribute(PackagingAttribute.certificateFile.name()); String keyFile = (String) context.getAttribute(PackagingAttribute.privateKeyFile.name()); String password = (String) context.getAttribute(PackagingAttribute.passphrase.name()); try { SymbianUtil.testKey(cerFile, keyFile, password, context); } catch (Exception e) { Activator.error(e); IBrandingManager branding1 = BrandingExtensionManager.getBrandingManager(); Image image1 = null; if (branding1 != null) { image1 = branding1.getIconImageDescriptor().createImage(); } MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), com.nokia.tools.screen.ui.wizards.WizardMessages.New_Package_Create_MsgBox_Error_Title, image1, com.nokia.tools.screen.ui.wizards.WizardMessages.New_Package_Create_MsgBox_Error_Message, 1, new String[] { IDialogConstants.OK_LABEL }, 0); getShell().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_ARROW)); dialog.open(); if (image1 != null) { image1.dispose(); } return false; } getShell().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_ARROW)); } return true; }
From source file:com.nokia.tools.ui.dialog.MessageDialogWithTextContent.java
License:Open Source License
/** * Convenience method to open a standard error dialog. * /* www.jav a 2 s. c om*/ * @param parent the parent shell of the dialog, or <code>null</code> if * none * @param title the dialog's title, or <code>null</code> if none * @param message the message * @param content the message content. */ public static void openError(Shell parent, String title, String message, String content) { IBrandingManager branding = BrandingExtensionManager.getBrandingManager(); Image image = null; if (branding != null) { image = branding.getIconImageDescriptor().createImage(); } MessageDialog dialog = new MessageDialogWithTextContent(parent, title, image, message, content, ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); if (image != null) { image.dispose(); } return; }
From source file:com.nokia.tools.ui.dialog.ResourceSelectionDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); refresh();//w ww.j a va2s . c o m }
From source file:com.palantir.typescript.preferences.BuildPathPropertyPage.java
License:Apache License
private Button createUseTsConfigField(final Composite composite) { Label label = new Label(composite, SWT.NONE); label.setLayoutData(new GridData(GridData.BEGINNING, SWT.CENTER, false, false)); label.setText("Use tsconfig"); final Button button = new Button(composite, SWT.CHECK); button.setLayoutData(new GridData(GridData.BEGINNING, SWT.CENTER, false, false)); button.addListener(SWT.Selection, new Listener() { @Override/*w w w . j av a 2 s.c o m*/ public void handleEvent(Event e) { projectPreferenceStore.setUsingTsConfigFile(button.getSelection()); if (button.getSelection()) { Builders.promptRecompile(getShell(), getProject()); } updateFieldStates(); updateFieldValues(); } }); button.setSelection(projectPreferenceStore.isUsingTsConfigFile()); Button forceReloadButton = new Button(composite, SWT.NONE); forceReloadButton.setLayoutData(new GridData(GridData.CENTER, SWT.CENTER, false, false)); forceReloadButton.setText("Force reload"); forceReloadButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { boolean loaded = projectPreferenceStore.getTsConfigPreferences().reloadTsConfigFile(); if (!loaded) { String title = Resources.BUNDLE.getString("title.error"); String message = Resources.BUNDLE.getString("preferences.tsconfig.loadError"); String[] buttonLabels = new String[] { IDialogConstants.OK_LABEL }; MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR, buttonLabels, 1); dialog.open(); return; } projectPreferenceStore.setUsingTsConfigFile(true); Builders.promptRecompile(getShell(), getProject()); updateFieldStates(); updateFieldValues(); } }); return button; }
From source file:com.palantir.typescript.preferences.GeneralPreferencePage.java
License:Apache License
@Override public boolean performOk() { String oldNodePath = this.getPreferenceStore().getString(IPreferenceConstants.GENERAL_NODE_PATH); String newNodePath = this.nodePathText.getText(); if (!oldNodePath.equals(newNodePath)) { String title = Resources.BUNDLE.getString("preferences.general.node.path.dialog.title"); String message = Resources.BUNDLE.getString("preferences.general.node.path.dialog.message"); String[] buttonLabels = new String[] { IDialogConstants.OK_LABEL }; MessageDialog dialog = new MessageDialog(this.getShell(), title, null, message, MessageDialog.QUESTION, buttonLabels, 2);//from ww w . j a v a 2s. c o m dialog.open(); this.getPreferenceStore().setValue(IPreferenceConstants.GENERAL_NODE_PATH, newNodePath); } return true; }