List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_LABEL
String NO_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_LABEL.
Click Source Link
From source file:com.aptana.ide.debug.internal.ui.InstallDebuggerPromptStatusHandler.java
License:Open Source License
/** * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object) */// w w w.j a va2s . c om public Object handleStatus(IStatus status, Object source) throws CoreException { Shell shell = DebugUiPlugin.getActiveWorkbenchShell(); String title = Messages.InstallDebuggerPromptStatusHandler_InstallDebuggerExtension; if ("install".equals(source)) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_AcceptExtensionInstallation_Quit); return null; } else if ("postinstall".equals(source)) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_Quit); return null; } else if ("nopdm".equals(source)) { //$NON-NLS-1$ MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, null, Messages.InstallDebuggerPromptStatusHandler_PDMNotInstalled, MessageDialog.WARNING, new String[] { StringUtils.ellipsify(Messages.InstallDebuggerPromptStatusHandler_Download), CoreStrings.CONTINUE, CoreStrings.CANCEL, CoreStrings.HELP }, 0); switch (md.open()) { case 0: WorkbenchHelper.launchBrowser("http://www.aptana.com/pro/pdm.php", "org.eclipse.ui.browser.ie"); //$NON-NLS-1$ //$NON-NLS-2$ /* continue */ case 1: return new Boolean(true); case 3: WorkbenchHelper.launchBrowser("http://www.aptana.com/docs/index.php/Installing_the_IE_debugger"); //$NON-NLS-1$ return new Boolean(true); default: break; } return null; } else if (source instanceof String && ((String) source).startsWith("quit_")) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_BrowserIsRunning, new String[] { ((String) source).substring(5) })); return null; } else if (source instanceof String && ((String) source).startsWith("installed_")) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstalled, new String[] { ((String) source).substring(10) })); return null; } else if (source instanceof String && ((String) source).startsWith("warning_")) { //$NON-NLS-1$ MessageDialog.openWarning(shell, title, ((String) source).substring(8)); return null; } else if (source instanceof String && ((String) source).startsWith("failed_")) { //$NON-NLS-1$ MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, null, MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstallFailed, new Object[] { ((String) source).substring(7) }), MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, CoreStrings.HELP }, 0); while (true) { switch (md.open()) { case IDialogConstants.OK_ID: return null; default: break; } WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$ ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$ : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$ } } IPreferenceStore store = DebugUiPlugin.getDefault().getPreferenceStore(); String pref = store.getString(IDebugUIConstants.PREF_INSTALL_DEBUGGER); if (pref != null) { if (pref.equals(MessageDialogWithToggle.ALWAYS)) { return new Boolean(true); } } String message = StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionNotInstalled, new String[] { (String) source }); MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, CoreStrings.HELP }, 2, null, false); dialog.setPrefKey(IDebugUIConstants.PREF_INSTALL_DEBUGGER); dialog.setPrefStore(store); while (true) { switch (dialog.open()) { case IDialogConstants.YES_ID: return new Boolean(true); case IDialogConstants.NO_ID: return new Boolean(false); default: break; } WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$ ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$ : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$ } }
From source file:com.aptana.ide.server.jetty.ShowPerspectiveClient.java
License:Open Source License
private boolean promptUser(String id) { Shell shell = JettyPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, Messages.ShowPerspectiveClient_1, null, // accept the default window icon MessageFormat.format(Messages.ShowPerspectiveClient_2, getPerspectiveName(id)), MessageDialogWithToggle.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0, // YES is the default null, false) {/* w w w.j av a 2 s. c o m*/ @Override protected Control createCustomArea(Composite parent) { try { URL url = JettyPlugin.getDefault().getBundle().getEntry("/icons/animation.gif"); //$NON-NLS-1$ url = FileLocator.toFileURL(url); Browser animation = new Browser(parent, SWT.NULL); animation.setText("<html>" + //$NON-NLS-1$ "<body style='margin: 0; padding:0; border: 1px solid black' >" + //$NON-NLS-1$ "<center>" + //$NON-NLS-1$ "<img src='" + url.toExternalForm() + "' />" + //$NON-NLS-1$ //$NON-NLS-2$ "</center>" + //$NON-NLS-1$ "</body>" + //$NON-NLS-1$ "</html>" //$NON-NLS-1$ ); GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, true, false); gridData.widthHint = 311 + 2; // 2 for border gridData.heightHint = 169 + 2; // 2 for border animation.setLayoutData(gridData); return animation; } catch (IOException e) { } Label animation = new Label(parent, SWT.CENTER); animation.setImage(JettyPlugin.getImage("/icons/animation.gif")); //$NON-NLS-1$ GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); animation.setLayoutData(gridData); return animation; } }; dialog.setPrefStore(JettyPlugin.getDefault().getPreferenceStore()); dialog.setPrefKey(getPrefKey(id)); dialog.open(); return (dialog.getReturnCode() == IDialogConstants.YES_ID); }
From source file:com.aptana.ide.ui.io.actions.CopyFilesOperation.java
License:Open Source License
/** * @param sourceStore//from w w w . j a v a 2 s . c o m * the file to be copied * @param destinationStore * the destination location * @param monitor * the progress monitor * @return true if the file is successfully copied, false if the operation did not go through for any reason */ protected boolean copyFile(IFileStore sourceStore, IFileStore destinationStore, IProgressMonitor monitor) { if (sourceStore == null || CloakingUtils.isFileCloaked(sourceStore)) { return false; } boolean success = true; monitor.subTask(MessageFormat.format(Messages.CopyFilesOperation_Copy_Subtask, sourceStore.getName(), destinationStore.getName())); if (destinationStore.equals(sourceStore)) { destinationStore = getNewNameFor(destinationStore); if (destinationStore == null) { return false; } } try { IFileStore[] childStores = Utils.isDirectory(sourceStore) ? sourceStore.childStores(EFS.NONE, monitor) : new IFileStore[0]; if (Utils.exists(destinationStore) && sourceStore.getName().equals(destinationStore.getName())) { // a name conflict; ask to overwrite if (overwriteStatus != OverwriteStatus.YES_TO_ALL) { final IFileStore dStore = destinationStore; final IFileStore sStore = sourceStore; fShell.getDisplay().syncExec(new Runnable() { public void run() { MessageDialog dialog = new MessageDialog(fShell, Messages.CopyFilesOperation_OverwriteTitle, null, MessageFormat.format(Messages.CopyFilesOperation_OverwriteWarning, dStore.toString(), sStore.toString()), MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); int retCode = dialog.open(); switch (retCode) { case 0: // Yes overwriteStatus = OverwriteStatus.YES; break; case 1: // Yes to All overwriteStatus = OverwriteStatus.YES_TO_ALL; break; case 2: // No overwriteStatus = OverwriteStatus.NO; break; default: overwriteStatus = OverwriteStatus.CANCEL; } } }); switch (overwriteStatus) { case CANCEL: monitor.setCanceled(true); // let it fall through since it would return false as well case NO: return false; } } } SyncUtils.copy(sourceStore, null, destinationStore, EFS.NONE, monitor); // copy the children recursively IFileStore destChildStore; for (IFileStore childStore : childStores) { destChildStore = destinationStore.getChild(childStore.getName()); copyFile(childStore, destChildStore, monitor); } } catch (CoreException e) { IdeLog.logError(IOUIPlugin.getDefault(), MessageFormat .format(Messages.CopyFilesOperation_ERR_FailedToCopy, sourceStore, destinationStore), e); success = false; } return success; }
From source file:com.aptana.internal.ui.text.spelling.OptionsConfigurationBlock.java
License:Open Source License
protected boolean processChanges(IWorkbenchPreferenceContainer container) { final IScopeContext currContext = this.fLookupOrder[0]; final List /* <Key> */ changedOptions = new ArrayList(); boolean needsBuild = this.getChanges(currContext, changedOptions); if (changedOptions.isEmpty()) { return true; }/* w w w . j a v a2 s . c om*/ if (needsBuild) { final int count = this.getRebuildCount(); if (count > this.fRebuildCount) { needsBuild = false; // build already requested this.fRebuildCount = count; } } boolean doBuild = false; if (needsBuild) { final String[] strings = this.getFullBuildDialogStrings(true); if (strings != null) { final MessageDialog dialog = new MessageDialog(this.getShell(), strings[0], null, strings[1], MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); final int res = dialog.open(); if (res == 0) { doBuild = true; } else if (res != 1) { return false; // cancel pressed } } } if (container != null) { // no need to apply the changes to the original store: will be done // by the page container if (doBuild) { // post build this.incrementRebuildCount(); //container.registerUpdateJob(CoreUtility.getBuildJob(fProject)) // ; } } else { // apply changes right away try { this.fManager.applyChanges(); } catch (final BackingStoreException e) { // JavaPlugin.log(e); return false; } if (doBuild) { // CoreUtility.getBuildJob(fProject).schedule(); } } return true; }
From source file:com.aptana.js.debug.ui.internal.InstallDebuggerPromptStatusHandler.java
License:Open Source License
/** * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object) *//*from w ww.j a va 2 s . c om*/ public Object handleStatus(IStatus status, Object source) throws CoreException { Shell shell = UIUtils.getActiveShell(); String title = Messages.InstallDebuggerPromptStatusHandler_InstallDebuggerExtension; if ("install".equals(source)) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_AcceptExtensionInstallation_Quit); return null; } else if ("postinstall".equals(source)) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_Quit); return null; } else if ("nopdm".equals(source)) { //$NON-NLS-1$ MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, null, Messages.InstallDebuggerPromptStatusHandler_PDMNotInstalled, MessageDialog.WARNING, new String[] { StringUtil.ellipsify(Messages.InstallDebuggerPromptStatusHandler_Download), CoreStrings.CONTINUE, CoreStrings.CANCEL, CoreStrings.HELP }, 0); switch (md.open()) { case 0: WorkbenchBrowserUtil.launchExternalBrowser(URL_INSTALL_PDM, "org.eclipse.ui.browser.ie"); //$NON-NLS-1$ return Boolean.TRUE; case 1: return Boolean.TRUE; case 3: WorkbenchBrowserUtil.launchExternalBrowser(URL_DOCS_INSTALL_IE_DEBUGGER); return Boolean.TRUE; default: break; } return null; } else if (source instanceof String && ((String) source).startsWith("quit_")) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, MessageFormat.format( Messages.InstallDebuggerPromptStatusHandler_BrowserIsRunning, ((String) source).substring(5))); return null; } else if (source instanceof String && ((String) source).startsWith("installed_")) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstalled, ((String) source).substring(10))); return null; } else if (source instanceof String && ((String) source).startsWith("warning_")) { //$NON-NLS-1$ MessageDialog.openWarning(shell, title, ((String) source).substring(8)); return null; } else if (source instanceof String && ((String) source).startsWith("failed_")) { //$NON-NLS-1$ MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, null, MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstallFailed, new Object[] { ((String) source).substring(7) }), MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, CoreStrings.HELP }, 0); while (true) { switch (md.open()) { case IDialogConstants.OK_ID: return null; default: break; } String urlString = (((String) source).indexOf("Internet Explorer") != -1) //$NON-NLS-1$ ? URL_DOCS_INSTALL_IE_DEBUGGER : URL_DOCS_INSTALL_DEBUGGER; WorkbenchBrowserUtil.launchExternalBrowser(urlString); } } IPreferenceStore store = JSDebugUIPlugin.getDefault().getPreferenceStore(); String pref = store.getString(IJSDebugUIConstants.PREF_INSTALL_DEBUGGER); if (pref != null) { if (pref.equals(MessageDialogWithToggle.ALWAYS)) { return Boolean.TRUE; } } String message = MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionNotInstalled, (String) source); MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, CoreStrings.HELP }, 2, null, false); dialog.setPrefKey(IJSDebugUIConstants.PREF_INSTALL_DEBUGGER); dialog.setPrefStore(store); while (true) { switch (dialog.open()) { case IDialogConstants.YES_ID: return Boolean.TRUE; case IDialogConstants.NO_ID: return Boolean.FALSE; default: break; } String urlString = (((String) source).indexOf("Internet Explorer") != -1) //$NON-NLS-1$ ? URL_DOCS_INSTALL_IE_DEBUGGER : URL_DOCS_INSTALL_DEBUGGER; WorkbenchBrowserUtil.launchExternalBrowser(urlString); } }
From source file:com.aptana.ui.dialogs.HyperlinkMessageDialog.java
License:Open Source License
public static String[] getButtonLabels(int kind) { switch (kind) { case ERROR://ww w . j ava 2 s. c om case INFORMATION: case WARNING: return new String[] { IDialogConstants.OK_LABEL }; case CONFIRM: return new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; case QUESTION: return new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; case QUESTION_WITH_CANCEL: return new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; default: throw new IllegalArgumentException("Illegal value for kind in HyperlinkMessageDialog.open()"); //$NON-NLS-1$ } }
From source file:com.aptana.ui.dialogs.MultipleInputMessageDialog.java
License:Open Source License
private void createInput(Composite composite) { for (JsonNode question : questionsNode) { List<Object> input = new ArrayList<Object>(1); new Label(composite, SWT.NONE); Composite parent = new Composite(composite, SWT.NONE); parent.setLayout(/*ww w .j a v a 2s .c om*/ GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(2).equalWidth(false).create()); Label label = new Label(parent, SWT.NONE); String lblTxt = question.path(MESSAGE).asText(); label.setText(lblTxt); Point requiredSize = label.computeSize(SWT.DEFAULT, SWT.DEFAULT); int minSize = convertHorizontalDLUsToPixels(80); if (requiredSize.x > minSize) { minSize = requiredSize.x; } GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, false) .hint(minSize, SWT.DEFAULT).applyTo(label); Composite valueComp = new Composite(parent, SWT.NONE); valueComp.setLayout(new FillLayout(SWT.HORIZONTAL)); JsonNode choices = question.path(CHOICES); ArrayNode values = JsonNodeFactory.instance.arrayNode(); if (!choices.isArray()) { values.add(choices); } else { values = (ArrayNode) choices; } String inputType = question.path(TYPE).asText(); String responseKey = question.path(NAME).asText(); if (INPUT.equals(inputType) || PASSWORD.equals(inputType)) { int flags = SWT.BORDER; if (PASSWORD.equals(inputType)) { flags |= SWT.PASSWORD; } Text t = new Text(valueComp, flags); input.add(t); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false) .hint(convertHorizontalDLUsToPixels(160), 25).applyTo(valueComp); } else if (CHECKBOX.equals(inputType)) { for (JsonNode value : values) { Button b = new Button(valueComp, SWT.CHECK); b.setText(value.asText()); input.add(b); } GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(valueComp); } else if (LIST.equals(inputType)) { Combo l = new Combo(valueComp, SWT.READ_ONLY); ComboViewer combo = new ComboViewer(l); input.add(combo); combo.setContentProvider(new ArrayContentProvider() { @Override public Object[] getElements(Object inputElement) { if (inputElement instanceof ArrayNode) { ArrayNode arrayNode = (ArrayNode) inputElement; JsonNode[] names = new JsonNode[arrayNode.size()]; int i = 0; for (JsonNode node : arrayNode) { names[i++] = node; } return names; } return super.getElements(inputElement); } }); combo.setInput(values); combo.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof ObjectNode) { String name = ((ObjectNode) element).path(NAME).asText(); if (StringUtil.isEmpty(name)) { return ((ObjectNode) element).asText(); } return name; } else if (element instanceof JsonNode) { return ((JsonNode) element).asText(); } return element.toString(); } }); JsonNode defaultValue = question.path(DEFAULT); if (defaultValue != null && values instanceof ArrayNode) { ArrayNode arrayNode = (ArrayNode) values; for (JsonNode node : arrayNode) { if (ObjectUtil.areEqual(node.get(VALUE).textValue(), defaultValue.textValue())) { combo.setSelection(new StructuredSelection(node)); break; } } } else { combo.setSelection(new StructuredSelection(values.get(0))); } GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(valueComp); } else if (CONFIRMATION.equals(inputType)) { input.add(Boolean.TRUE); setButtonLabels(new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL });//TISTUD-7408 } userInput.putPOJO(responseKey, input); } }
From source file:com.archimatetool.editor.model.impl.EditorModelManager.java
License:Open Source License
/** * Show dialog to save modified model/* w w w . j a v a 2 s . c om*/ * @param model * @return true if the user chose to save the model or chose not to save the model, false if cancelled * @throws IOException */ private boolean askSaveModel(IArchimateModel model) throws IOException { MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), Messages.EditorModelManager_6, null, NLS.bind(Messages.EditorModelManager_7, model.getName()), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); int result = dialog.open(); // Yes if (result == 0) { return saveModel(model); } // No if (result == 1) { return true; } // Cancel return false; }
From source file:com.arm.cmsis.pack.installer.CpPackInstaller.java
License:Open Source License
protected int timeoutQuestion(String pdscUrl) { Display.getDefault().syncExec(() -> { MessageDialog dialog = new MessageDialog(null, Messages.CpPackInstaller_Timout, null, NLS.bind(Messages.CpPackInstaller_TimeoutMessage, pdscUrl, TIME_OUT / 1000), MessageDialog.QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);/* ww w.j a v a 2 s . co m*/ wait = dialog.open(); }); return wait; }
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 www. j av a 2 s . 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; } }