List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_ID
int OK_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_ID.
Click Source Link
From source file:com.arm.cmsis.pack.installer.jobs.CpPackUnpackJob.java
License:Open Source License
private boolean myRun(IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, 100); File sourceFile = new File(fSourceFilePath); monitor.setTaskName(Messages.CpPackUnpackJob_Unpacking + sourceFile.toString()); if (fDestPath.toFile().exists()) { final String messageString = NLS.bind(Messages.CpPackUnpackJob_PathAlreadyExists, fDestPath.toOSString()); Display.getDefault().syncExec(new Runnable() { @Override/*from ww w . j ava2s. c o m*/ public void run() { final MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), Messages.CpPackUnpackJob_OverwriteQuery, null, messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); returnCode = dialog.open(); } }); if (returnCode == IDialogConstants.OK_ID) { Utils.deleteFolderRecursive(fDestPath.toFile()); } else { fResult.setSuccess(false); fResult.setErrorString(Messages.CpPackJob_CancelledByUser); return false; } } if (!sourceFile.exists()) { fResult.setSuccess(false); fResult.setErrorString(sourceFile.toString() + Messages.CpPackUnpackJob_SourceFileCannotBeFound); return true; } try { if (!fPackInstaller.unzip(sourceFile, fDestPath, progress.newChild(95))) { fResult.setSuccess(false); fResult.setErrorString(Messages.CpPackJob_CancelledByUser); Utils.deleteFolderRecursive(fDestPath.toFile()); return false; } if (fPack != null) { // unpack job fPack.setPackState(PackState.INSTALLED); fPack.setFileName(fDestPath.append(fPack.getPackFamilyId() + CmsisConstants.EXT_PDSC).toString()); fResult.setPack(fPack); fResult.setSuccess(true); return true; } Collection<String> files = new LinkedList<>(); Utils.findPdscFiles(fDestPath.toFile(), files, 1); if (files.isEmpty()) { Utils.deleteFolderRecursive(fDestPath.toFile()); fResult.setSuccess(false); fResult.setErrorString(Messages.CpPackUnpackJob_PdscFileNotFoundInFolder + fDestPath.toOSString()); return true; } String file = files.iterator().next(); ICpXmlParser parser = CpPlugIn.getPackManager().getParser(); fPack = (ICpPack) parser.parseFile(file); if (fPack != null) { ICpItem urlItem = fPack.getFirstChild(CmsisConstants.URL); if (urlItem == null || !Utils.isValidURL(urlItem.getText())) { fPack.setPackState(PackState.GENERATED); } else { fPack.setPackState(PackState.INSTALLED); } fResult.setPack(fPack); fResult.setSuccess(true); return true; } Utils.deleteFolderRecursive(fDestPath.toFile()); StringBuilder sb = new StringBuilder(Messages.CpPackUnpackJob_FailToParsePdscFile + file); for (String es : parser.getErrorStrings()) { sb.append(System.lineSeparator()); sb.append(es); } fResult.setErrorString(sb.toString()); fResult.setSuccess(false); return true; } catch (IOException e) { fResult.setSuccess(false); fResult.setErrorString(Messages.CpPackUnpackJob_FailedToUnzipFile + sourceFile.toString()); Utils.deleteFolderRecursive(fDestPath.toFile()); return true; } }
From source file:com.arm.cmsis.pack.installer.jobs.LicenseDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); okButton = getButton(IDialogConstants.OK_ID); okButton.setEnabled(false);/*w w w . j a v a2 s .com*/ }
From source file:com.asakusafw.shafu.internal.ui.dialogs.PropertyEntryInputDialog.java
License:Apache License
@Override protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { this.inputKey = textKey.getText().trim(); this.inputValue = textValue.getText(); } else {//ww w . j a v a2 s .c o m this.inputKey = null; this.inputValue = null; } super.buttonPressed(buttonId); }
From source file:com.asakusafw.shafu.internal.ui.dialogs.PropertyEntryInputDialog.java
License:Apache License
@Override protected void createButtonsForButtonBar(Composite parent) { this.buttonOk = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); if (defaultKey == null) { textKey.setFocus();//from w w w .j a v a 2 s .c om buttonOk.setEnabled(false); } else { if (defaultKey.isEmpty()) { textKey.setFocus(); } else { textValue.setFocus(); textValue.selectAll(); } validate(); } }
From source file:com.ashigeru.eclipse.internal.codereading.ui.dialogs.LogEditDialog.java
License:Apache License
private void setCompleted(boolean completed) { Button button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(completed);//w w w . j a v a 2 s. c o m } }
From source file:com.astra.ses.spell.gui.dialogs.AttachModeDialog.java
License:Open Source License
/*************************************************************************** * Create the button bar buttons./* w w w . j a va 2 s .c o m*/ * * @param parent * The Button Bar. **************************************************************************/ protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); }
From source file:com.astra.ses.spell.gui.dialogs.AttachModeDialog.java
License:Open Source License
/*************************************************************************** * Called when one of the buttons of the button bar is pressed. * /*from w ww .j a v a 2s . c om*/ * @param buttonId * The button identifier. **************************************************************************/ protected void buttonPressed(int buttonId) { setReturnCode(buttonId); switch (buttonId) { case IDialogConstants.OK_ID: case IDialogConstants.CANCEL_ID: close(); break; } }
From source file:com.astra.ses.spell.gui.dialogs.ConditionDialog.java
License:Open Source License
/*************************************************************************** * Create the button bar buttons.//from w w w . j av a 2 s.c o m * * @param parent * The Button Bar. **************************************************************************/ protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); }
From source file:com.astra.ses.spell.gui.dialogs.ConditionDialog.java
License:Open Source License
/*************************************************************************** * Called when one of the buttons of the button bar is pressed. * /*from w ww . j av a2 s. c o m*/ * @param buttonId * The button identifier. **************************************************************************/ protected void buttonPressed(int buttonId) { m_condition = null; switch (buttonId) { case IDialogConstants.OK_ID: try { if (m_absTimeOption.getSelection()) { parseAbsTimeCondition(); } else if (m_relTimeOption.getSelection()) { parseRelTimeCondition(); } else if (m_tmOption.getSelection()) { parseTmCondition(); } // else if (m_customOption.getSelection()) // { // parseCustomCondition(); // } Logger.debug("Scheduling condition: " + m_condition, Level.PROC, this); close(); } catch (ParseException ex) { MessageDialog.openError(Display.getCurrent().getActiveShell(), "Condition definition error", ex.getLocalizedMessage()); } break; case IDialogConstants.CANCEL_ID: close(); } }
From source file:com.astra.ses.spell.gui.dialogs.ConfirmDialog.java
License:Open Source License
/*************************************************************************** * Called when one of the buttons of the button bar is pressed. * // w ww. j a v a 2s . c o m * @param buttonId * The button identifier. **************************************************************************/ protected void buttonPressed(int buttonId) { switch (buttonId) { case IDialogConstants.OK_ID: setReturnCode(1); break; case IDialogConstants.CANCEL_ID: setReturnCode(0); break; } close(); }