List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog getProgressMonitor
public IProgressMonitor getProgressMonitor()
From source file:de.jcup.egradle.eclipse.ui.RootProjectConfigUIDelegate.java
License:Apache License
private void createValidationGroup(Composite parent) { /* ------------------------------------ */ /* - Check output - */ /* ------------------------------------ */ GridData groupLayoutData = new GridData(); groupLayoutData.horizontalAlignment = GridData.FILL; groupLayoutData.verticalAlignment = GridData.FILL; groupLayoutData.grabExcessHorizontalSpace = true; groupLayoutData.grabExcessVerticalSpace = true; groupLayoutData.verticalSpan = 2;/* w w w . jav a 2 s. c om*/ groupLayoutData.horizontalSpan = 3; Group validationGroup = SWTFactory.createGroup(parent, "Validate preferences correct", 1, 10, SWT.FILL); validationGroup.setLayoutData(groupLayoutData); GridData labelGridData = new GridData(); labelGridData.horizontalAlignment = GridData.FILL; labelGridData.verticalAlignment = GridData.BEGINNING; labelGridData.grabExcessHorizontalSpace = false; labelGridData.grabExcessVerticalSpace = false; GridData gridDataLastColumn = new GridData(); gridDataLastColumn.horizontalAlignment = GridData.FILL; gridDataLastColumn.verticalAlignment = GridData.FILL; gridDataLastColumn.grabExcessHorizontalSpace = true; gridDataLastColumn.grabExcessVerticalSpace = true; gridDataLastColumn.verticalSpan = 2; gridDataLastColumn.horizontalSpan = 2; gridDataLastColumn.minimumHeight = 50; gridDataLastColumn.heightHint = 100; validationOutputField = new Text(validationGroup, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY); validationOutputField.setLayoutData(gridDataLastColumn); validationButton = new Button(validationGroup, SWT.NONE); validationButton.setText("Start validation"); validationButton.setImage(getValidationButtonImage()); validationButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (validationRunning == true) { return; } setValid(false); handleValidationRunning(true); validationOutputField.setText("Start validation...\n"); OutputHandler validationOutputHandler = new OutputHandler() { @Override public void output(String line) { EGradleUtil.safeAsyncExec(new Runnable() { @Override public void run() { validationOutputField.append(line + "\n"); } }); } }; MutableGradleConfiguration configuration = new MutableGradleConfiguration(); configuration.setGradleCommand(getGradleCommand()); configuration.setGradleBinDirectory(getGradleBinDirectory()); configuration.setShellCommand(getShellCommand()); configuration.setWorkingDirectory(getWorkingDirectory()); configuration.setJavaHome(getGlobalJavaHomePath()); startValidation(validationOutputHandler, configuration); } private void startValidation(OutputHandler validationOutputHandler, MutableGradleConfiguration configuration) { try { RootProjectConfigUIDelegate observer = RootProjectConfigUIDelegate.this; ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog( EGradleUtil.getActiveWorkbenchShell()); RootProjectValidationProgressRunnable runnable = new RootProjectValidationProgressRunnable( new CancelStateProvider() { @Override public boolean isCanceled() { return progressMonitorDialog.getProgressMonitor().isCanceled(); } }, configuration, observer, validationOutputHandler); /* use own progress monitor dialog here - progress service did not work well because this is in model state */ progressMonitorDialog.run(true, true, runnable); } catch (InvocationTargetException | InterruptedException e1) { EGradleUtil.log(e1); } } }); }
From source file:eu.modelwriter.marker.ui.internal.wizards.markallinwswizard.MarkAllInWsWizard.java
License:Open Source License
@Override public boolean performFinish() { final Object[] checkedElements = MarkAllInWsPage.checkboxTreeViewer.getCheckedElements(); final String text = this.textSelection.getText(); final String leader_id = UUID.randomUUID().toString(); boolean success = false; final Image image = MarkerActivator.getDefault().getImageRegistry() .get(MarkerActivator.Images.IMAGE_MODELWRITER_ID); final ProgressMonitorDialog pmd = new ProgressMonitorDialog( Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell()); ProgressMonitorDialog.setDefaultImage(image); pmd.open();/*from ww w.j a v a2s .c om*/ final IProgressMonitor pmdmoni = pmd.getProgressMonitor(); try { pmdmoni.beginTask("Marking", checkedElements.length); for (int i = 0; i < checkedElements.length && !pmdmoni.isCanceled(); i++) { try { if (checkedElements[i] instanceof IFile) { final IFile iFile = (IFile) checkedElements[i]; pmdmoni.subTask(iFile.getName()); pmdmoni.worked(1); if (!iFile.getFileExtension().equals("xmi") && !iFile.getFileExtension().equals("ecore") && !iFile.getFileExtension().equals("reqif")) { final String charSet = iFile.getCharset(); final Scanner scanner = new Scanner(iFile.getContents(), charSet); final IDocument document = new Document(scanner.useDelimiter("\\A").next()); scanner.close(); final String fullText = document.get(); boolean hasLeader = false; int index = 0; int offset = 0; final int lenght = this.textSelection.getLength(); final String id = UUID.randomUUID().toString(); if (lenght != 0) { while ((offset = fullText.indexOf(text, index)) != -1) { final TextSelection nextSelection = new TextSelection(document, offset, lenght); if (MarkerFactory.findMarkerByOffset(iFile, offset) == null) { final IMarker mymarker = MarkerFactory.createMarker(iFile, nextSelection); MarkUtilities.setGroupId(mymarker, id); if (!iFile.equals(this.file)) { if (hasLeader == false) { MarkUtilities.setLeaderId(mymarker, leader_id); hasLeader = true; } } else { if (this.textSelection.getOffset() == offset) { MarkUtilities.setLeaderId(mymarker, leader_id); } } this.addToAlloyXML(mymarker); AnnotationFactory.addAnnotation(mymarker, AnnotationFactory.ANNOTATION_MARKING); } index = offset + lenght; } } success = true; } else { final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark All In Workspace", null, iFile.getName() + " doesn't supported for this command.", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); MarkAllInWsPage.checkboxTreeViewer.setChecked(iFile, false); } } } catch (final CoreException e) { e.printStackTrace(); } } } finally { pmdmoni.done(); } pmd.close(); if (success == true) { final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark All In Workspace", null, "Selected project(s) have been marked by selected text", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); return true; } else { return false; } }
From source file:eu.numberfour.n4js.ui.dialog.ModuleSpecifierSelectionDialog.java
License:Open Source License
@Override protected void createPressed() { InputDialog dialog = new InputDialog(getShell(), CREATE_A_NEW_FOLDER_TITLE, CREATE_A_NEW_FOLDER_MESSAGE, "", new ModuleFolderValidator()); dialog.open();// w ww . j av a 2 s. c o m Object selection = treeViewer.getStructuredSelection().getFirstElement(); // Infer parent folder from selection IContainer parent; if (selection instanceof IFile) { parent = ((IFile) selection).getParent(); } else if (selection instanceof IContainer) { parent = (IContainer) selection; } else { // Use the source folder as default parent = this.sourceFolder; } String dialogValue = dialog.getValue(); if (OSInfo.isWindows()) { dialogValue = convertToUnixPath(dialogValue); } IPath folderPath = new Path(dialogValue); IContainer createdFolder = null; if (Window.OK == dialog.getReturnCode()) { ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(getShell()); progressMonitorDialog.open(); IProgressMonitor progressMonitor = progressMonitorDialog.getProgressMonitor(); createdFolder = createFolderPath(folderPath, parent, null); progressMonitor.done(); progressMonitorDialog.close(); if (null != createdFolder) { treeViewer.setSelection(new StructuredSelection(createdFolder)); } } }
From source file:eu.numberfour.n4js.ui.dialog.ModuleSpecifierSelectionDialog.java
License:Open Source License
/** * Processes the initial string selection. * * For existing resources it just sets the initial selection to the specified file system resource. * * In the case that the initial module specifier points to a non-existing location, a dialog is displayed which * allows the user to automatically create not yet existing folders. * * @param initialModuleSpecifier//from w w w . j a va2 s .c o m * The module specifier * @return A {@link IWorkbenchAdapter} adaptable object or null on failure */ private Object processInitialSelection(String initialModuleSpecifier) { IPath sourceFolderPath = sourceFolder.getFullPath(); IPath initialModulePath = new Path(initialModuleSpecifier); // Use the root element source folder for an empty initial selection if (initialModuleSpecifier.isEmpty()) { return this.sourceFolder; } // Use the root element source folder for invalid module specifiers if (!WorkspaceWizardValidatorUtils.isValidFolderPath(initialModulePath)) { return this.sourceFolder; } // The project relative path of a module specifier IPath fullPath = sourceFolderPath.append(new Path(initialModuleSpecifier)); // If the module specifier refers to an existing n4js resource if (!fullPath.hasTrailingSeparator()) { IFile n4jsModuleFile = workspaceRoot .getFile(fullPath.addFileExtension(N4JSGlobals.N4JS_FILE_EXTENSION)); IFile n4jsdModuleFile = workspaceRoot .getFile(fullPath.addFileExtension(N4JSGlobals.N4JSD_FILE_EXTENSION)); // Just use it as initial selection if (n4jsModuleFile.exists()) { return n4jsModuleFile; } if (n4jsdModuleFile.exists()) { return n4jsdModuleFile; } } //// Otherwise use the existing part of the path as initial selection: // If the module specifier specifies the module name, extract it and remove its segment. if (isModuleFileSpecifier(initialModulePath)) { initialModuleName = initialModulePath.lastSegment(); initialModulePath = initialModulePath.removeLastSegments(1); } IResource selection = this.sourceFolder; // Accumulate path segments to search for the longest existing path IPath accumulatedPath = sourceFolderPath; // Collect the paths of all non-existing segments // These are relative to the last existing segment of the path List<IPath> nonExistingSegmentPaths = new ArrayList<>(); for (Iterator<String> segmentIterator = Arrays.asList(initialModulePath.segments()) .iterator(); segmentIterator.hasNext(); /**/) { accumulatedPath = accumulatedPath.append(segmentIterator.next()); // Results in null if non-existing IResource nextSegmentResource = workspaceRoot.findMember(accumulatedPath); // If the current segment is an existing file and not the last specifier segment // show a file overlap error message if (null != nextSegmentResource && !(nextSegmentResource instanceof IContainer) && segmentIterator.hasNext()) { MessageDialog.open(MessageDialog.ERROR, getShell(), SPECIFIER_OVERLAPS_WITH_FILE_TITLE, String .format(SPECIFIER_OVERLAPS_WITH_FILE_MESSAGE, initialModuleSpecifier, accumulatedPath), SWT.NONE); return selection; } // If the segment exist go ahead with the next one if (null != nextSegmentResource && nextSegmentResource.exists()) { selection = nextSegmentResource; } else { // If not add it to the list of non existing segments. nonExistingSegmentPaths.add(accumulatedPath.makeRelativeTo(selection.getFullPath())); } } // If any non-existing folders need to be created if (nonExistingSegmentPaths.size() > 0) { // Ask the user if he wants to create the missing folders boolean create = MessageDialog.open(MessageDialog.QUESTION, getShell(), NON_EXISTING_MODULE_LOCATION_TITLE, NON_EXISTING_MODULE_LOCATION_MESSAGE, SWT.NONE); // Create the missing folders if (create) { ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(getShell()); progressMonitorDialog.open(); IProgressMonitor progressMonitor = progressMonitorDialog.getProgressMonitor(); IPath deepestPath = nonExistingSegmentPaths.get(nonExistingSegmentPaths.size() - 1); selection = createFolderPath(deepestPath, (IContainer) selection, progressMonitor); progressMonitor.done(); progressMonitorDialog.close(); } } return selection; }
From source file:gov.redhawk.ide.codegen.ui.internal.command.GenerateCodeHandler.java
License:Open Source License
/** * Tries to save the resources which are in the same project as the editorFile provided. The user is prompted to * save//from w w w.ja va 2s. co m * if any related unsaved resources are present. * @param event Handler event * @param editorFile File who's project we are using to find related editor pages. * @return True if everything saved correctly. False otherwise. * @throws CoreException */ private boolean relatedResourcesSaved(final Shell shell, final IProject parentProject) throws CoreException { final Set<ISaveablePart> dirtyPartsSet = getRelatedDirtyParts(parentProject); // If there were unsaved parts in this project. if (!dirtyPartsSet.isEmpty()) { // Prompt the user that they MUST save before generation if (MessageDialog.openQuestion(shell, "File Changed", "Resources in the project '" + parentProject.getName() + "' have unsaved changes. Changes must be saved prior to code generation.\n\nDo you want to save these changes now?")) { ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); try { dialog.run(false, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) { monitor.beginTask("Saving Resources ...", dirtyPartsSet.size()); // Go through and save each of the parts that were previously identified. for (ISaveablePart dirtyPart : dirtyPartsSet) { dirtyPart.doSave(monitor); monitor.worked(1); if (monitor.isCanceled()) { break; } } monitor.done(); } }); } catch (InvocationTargetException e) { throw new CoreException(new Status(Status.ERROR, RedhawkUiActivator.PLUGIN_ID, "Error while attempting to save editors", e.getCause())); } catch (InterruptedException e) { return false; // The user canceled this save dialog. } if (dialog.getProgressMonitor().isCanceled()) { return false; // The user has canceled another dialog which was passed our monitor. } return true; // User saved all unsaved parts with no errors, generate code. } // User canceled the save dialog do not generate return false; } // Resources don't need to be saved return true; }
From source file:net.sf.commonclipse.Generator.java
License:Apache License
/** * Generates the appropriate method in <code>type</code>. * @param type IType/*from w w w. ja va 2 s . c o m*/ * @param shell Shell */ public void generate(IType type, Shell shell) { ICompilationUnit cu = (ICompilationUnit) type.getAncestor(IJavaElement.COMPILATION_UNIT); // first check if file is writable IResource resource; try { resource = cu.getCorrespondingResource(); } catch (JavaModelException e) { MessageDialog.openError(shell, CCMessages.getString("Generator.errortitle"), e.getMessage()); //$NON-NLS-1$ return; } if (resource != null && resource.getResourceAttributes().isReadOnly()) { IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] { (IFile) resource }, shell); if (!status.isOK()) { MessageDialog.openError(shell, CCMessages.getString("Generator.errortitle"), CCMessages //$NON-NLS-1$ .getString("Generator.readonly")); //$NON-NLS-1$ return; } } resource = null; if (!validate(type, shell)) { return; } ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); progressDialog.open(); try { IProgressMonitor monitor = progressDialog.getProgressMonitor(); generateMethod(type, cu, shell, monitor); } catch (JavaModelException ex) { MessageDialog.openError(shell, CCMessages.getString("Generator.errortitle"), ex.getMessage()); //$NON-NLS-1$ } progressDialog.close(); }
From source file:net.sf.eclipsensis.installoptions.actions.PreviewAction.java
License:Open Source License
private void doPreview(final INIFile iniFile, final File file) { final Shell shell = mEditor.getSite().getShell(); BusyIndicator.showWhile(shell.getDisplay(), new Runnable() { public void run() { final ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell) { @Override/*w ww .j a v a2s . com*/ protected void configureShell(Shell shell) { super.configureShell(shell); Rectangle rect = shell.getDisplay().getBounds(); shell.setLocation(rect.x + rect.width + 1, rect.y + rect.height + 1); } @Override protected Rectangle getConstrainedShellBounds(Rectangle preferredSize) { Rectangle rect = shell.getDisplay().getBounds(); return new Rectangle(rect.x + rect.width + 1, rect.y + rect.height + 1, preferredSize.width, preferredSize.height); } }; pmd.open(); try { ModalContext.run(new IRunnableWithProgress() { private File createPreviewFile(File previewFile, INIFile inifile, final NSISLanguage lang) throws IOException { File previewFile2 = previewFile; INIFile inifile2 = inifile; if (previewFile2 == null) { previewFile2 = File.createTempFile("preview", ".ini"); //$NON-NLS-1$ //$NON-NLS-2$ previewFile2.deleteOnExit(); } inifile2 = inifile2.copy(); InstallOptionsDialog dialog = InstallOptionsDialog.loadINIFile(inifile2); DialogSize dialogSize; if (getId().equals(PREVIEW_MUI_ID)) { dialogSize = DialogSizeManager.getDialogSize(cMUIDialogSizeName); } else { dialogSize = DialogSizeManager.getDialogSize(cClassicDialogSizeName); } if (dialogSize == null) { dialogSize = DialogSizeManager.getDefaultDialogSize(); } dialog.setDialogSize(dialogSize); Font font = FontUtility.getFont(lang); for (Iterator<InstallOptionsWidget> iter = dialog.getChildren().iterator(); iter .hasNext();) { InstallOptionsWidget widget = iter.next(); if (widget instanceof InstallOptionsPicture) { final InstallOptionsPicture picture = (InstallOptionsPicture) widget; final Dimension dim = widget.toGraphical(widget.getPosition(), font).getSize(); final Map<Dimension, File> cache; switch (picture.getSWTImageType()) { case SWT.IMAGE_BMP: cache = cBitmapCache; break; case SWT.IMAGE_ICO: cache = cIconCache; break; default: continue; } final File[] imageFile = new File[] { cache.get(dim) }; if (!IOUtility.isValidFile(imageFile[0])) { shell.getDisplay().syncExec(new Runnable() { public void run() { Image widgetImage = picture.getImage(); ImageData data = widgetImage.getImageData(); data.width = dim.width; data.height = dim.height; data.type = picture.getSWTImageType(); Image bitmap = new Image(shell.getDisplay(), data); GC gc = new GC(bitmap); gc.setBackground(shell.getDisplay() .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); gc.setForeground( shell.getDisplay().getSystemColor(SWT.COLOR_BLACK)); gc.fillRectangle(0, 0, dim.width, dim.height); Rectangle rect = widgetImage.getBounds(); int x, y, width, height; if (rect.width > dim.width) { x = 0; width = dim.width; } else { x = (dim.width - rect.width) / 2; width = rect.width; } if (rect.height > dim.height) { y = 0; height = dim.height; } else { y = (dim.height - rect.height) / 2; height = rect.height; } gc.drawImage(widgetImage, 0, 0, rect.width, rect.height, x, y, width, height); gc.setLineStyle(SWT.LINE_CUSTOM); gc.setLineDash(DashedLineBorder.DASHES); gc.drawRectangle(0, 0, dim.width - 1, dim.height - 1); gc.dispose(); ImageLoader loader = new ImageLoader(); loader.data = new ImageData[] { bitmap.getImageData() }; try { imageFile[0] = File.createTempFile("preview", //$NON-NLS-1$ picture.getFileExtension()); imageFile[0].deleteOnExit(); loader.save(imageFile[0].getAbsolutePath(), picture.getSWTImageType()); cache.put(dim, imageFile[0]); } catch (IOException e) { imageFile[0] = null; InstallOptionsPlugin.getDefault().log(e); cache.remove(dim); } } }); } if (imageFile[0] != null) { picture.setPropertyValue(InstallOptionsModel.PROPERTY_TEXT, imageFile[0].getAbsolutePath()); } } } inifile2 = dialog.updateINIFile(); IOUtility.writeContentToFile(previewFile2, inifile2.toString().getBytes()); return previewFile2; } public void run(IProgressMonitor monitor) { try { monitor.beginTask( InstallOptionsPlugin.getResourceString("previewing.script.task.name"), //$NON-NLS-1$ IProgressMonitor.UNKNOWN); String pref = InstallOptionsPlugin.getDefault().getPreferenceStore() .getString(IInstallOptionsConstants.PREFERENCE_PREVIEW_LANG); NSISLanguage lang; if (pref.equals("")) { //$NON-NLS-1$ lang = NSISLanguageManager.getInstance().getDefaultLanguage(); } else { lang = NSISLanguageManager.getInstance().getLanguage(pref); if (lang == null) { lang = NSISLanguageManager.getInstance().getDefaultLanguage(); InstallOptionsPlugin.getDefault().getPreferenceStore() .setValue(IInstallOptionsConstants.PREFERENCE_PREVIEW_LANG, ""); //$NON-NLS-1$ } } PreviewCacheKey key = new PreviewCacheKey(file, lang); File previewFile = cPreviewCache.get(key); if (previewFile == null || file.lastModified() > previewFile.lastModified()) { previewFile = createPreviewFile(previewFile, iniFile, lang); cPreviewCache.put(key, previewFile); } Map<String, String> symbols = mSettings.getSymbols(); symbols.put("PREVIEW_INI", previewFile.getAbsolutePath()); //$NON-NLS-1$ symbols.put("PREVIEW_LANG", lang.getName()); //$NON-NLS-1$ Locale locale = NSISLanguageManager.getInstance() .getLocaleForLangId(lang.getLangId()); if (getId().equals(PREVIEW_MUI_ID)) { symbols.put("PREVIEW_TITLE", //$NON-NLS-1$ InstallOptionsPlugin.getResourceString(locale, "preview.setup.title")); //$NON-NLS-1$ symbols.put("PREVIEW_SUBTITLE", InstallOptionsPlugin.getResourceString(locale, //$NON-NLS-1$ "preview.setup.subtitle")); //$NON-NLS-1$ } else { symbols.put("PREVIEW_BRANDING", InstallOptionsPlugin.getResourceString(locale, //$NON-NLS-1$ "preview.setup.branding")); //$NON-NLS-1$ } symbols.put("PREVIEW_NAME", //$NON-NLS-1$ InstallOptionsPlugin.getResourceString(locale, "preview.setup.name")); //$NON-NLS-1$ if (EclipseNSISPlugin.getDefault().isWinVista() && NSISPreferences.getInstance() .getNSISVersion().compareTo(INSISVersions.VERSION_2_21) >= 0) { symbols.put("WINDOWS_VISTA", ""); //$NON-NLS-1$ //$NON-NLS-2$ } mSettings.setSymbols(symbols); final File previewScript = getPreviewScript(); long timestamp = System.currentTimeMillis(); MakeNSISResults results = null; results = MakeNSISRunner.compile(previewScript, mSettings, cDummyConsole, new INSISConsoleLineProcessor() { public NSISConsoleLine processText(String text) { return NSISConsoleLine.info(text); } public void reset() { } }); if (results != null) { if (results.getReturnCode() != 0) { List<NSISScriptProblem> errors = results.getProblems(); final String error; if (!Common.isEmptyCollection(errors)) { Iterator<NSISScriptProblem> iter = errors.iterator(); StringBuffer buf = new StringBuffer(iter.next().getText()); while (iter.hasNext()) { buf.append(INSISConstants.LINE_SEPARATOR) .append(iter.next().getText()); } error = buf.toString(); } else { error = InstallOptionsPlugin.getResourceString("preview.compile.error"); //$NON-NLS-1$ } shell.getDisplay().asyncExec(new Runnable() { public void run() { Common.openError(shell, error, InstallOptionsPlugin.getShellImage()); } }); } else { final File outfile = new File(results.getOutputFileName()); if (IOUtility.isValidFile(outfile) && outfile.lastModified() > timestamp) { MakeNSISRunner.testInstaller(outfile.getAbsolutePath(), null, true); } } } } catch (final Exception e) { InstallOptionsPlugin.getDefault().log(e); shell.getDisplay().asyncExec(new Runnable() { public void run() { Common.openError(shell, e.getMessage(), InstallOptionsPlugin.getShellImage()); } }); } finally { monitor.done(); } } }, true, pmd.getProgressMonitor(), shell.getDisplay()); } catch (Exception e) { InstallOptionsPlugin.getDefault().log(e); Common.openError(shell, e.getMessage(), InstallOptionsPlugin.getShellImage()); } finally { pmd.close(); } } }); }
From source file:net.sf.fjep.fatjar.popup.actions.BuildFatJar.java
License:Open Source License
public void runBuildConfiguredFatJar(IJavaProject jproject, Properties props, Set excludes, ArrayList includes) {// w ww . j a v a2s. c o m // Create a progress bar Shell shell = new Shell(); ProgressMonitorDialog progressmonitordialog = new ProgressMonitorDialog(shell); progressmonitordialog.open(); IProgressMonitor iprogressmonitor = progressmonitordialog.getProgressMonitor(); iprogressmonitor.beginTask("Build Fat jar", PROGRESS_CLEAN + PROGRESS_COLLECT + PROGRESS_PACK + PROGRESS_CLEAN); // Make One-JAR? boolean onejar = new Boolean(props.getProperty(AguiPlugin.ONEJAR_CHECKBOX)).booleanValue(); String expand = props.getProperty(AguiPlugin.ONEJAR_EXPAND); String jarfile = null; try { saveConfig(jproject, props); doCleanFatJar(jproject, iprogressmonitor); doCollectFatJar(jproject, iprogressmonitor, excludes, includes, onejar, expand); jarfile = doPackFatJar(jproject, iprogressmonitor); doCleanFatJar(jproject, iprogressmonitor); try { jproject.getProject().refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); MessageDialog.openInformation(shell, "Fat Jar Plug-In ERROR", e.getMessage()); } progressmonitordialog.close(); MessageDialog.openInformation(shell, "Fat Jar Plug-In", "built " + jarfile); }
From source file:net.sf.fjep.fatjar.popup.actions.BuildFatJar.java
License:Open Source License
public void doQuickBuildFatJar(IJavaProject jproject) { Properties props = getFatJarProperties(jproject); Set excludes = getExcludes(jproject, props.getProperty("excludes")); ArrayList includes = getIncludes(jproject, props.getProperty("includes")); // Create a progress bar Shell shell = new Shell(); ProgressMonitorDialog progressmonitordialog = new ProgressMonitorDialog(shell); progressmonitordialog.open();/* ww w. j av a2 s. c o m*/ IProgressMonitor iprogressmonitor = progressmonitordialog.getProgressMonitor(); iprogressmonitor.beginTask("Quick Build Fat jar", PROGRESS_CLEAN + PROGRESS_COLLECT + PROGRESS_PACK + PROGRESS_CLEAN); // Make One-JAR? boolean onejar = new Boolean(props.getProperty(AguiPlugin.ONEJAR_CHECKBOX)).booleanValue(); String expand = props.getProperty(AguiPlugin.ONEJAR_EXPAND); String jarfile = null; try { // saveConfig(jproject, props); doCleanFatJar(jproject, iprogressmonitor); doCollectFatJar(jproject, iprogressmonitor, excludes, includes, onejar, expand); jarfile = doPackFatJar(jproject, iprogressmonitor); doCleanFatJar(jproject, iprogressmonitor); try { jproject.getProject().refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); MessageDialog.openInformation(shell, "Fat Jar Plug-In ERROR", e.getMessage()); } progressmonitordialog.close(); MessageDialog.openInformation(shell, "Fat Jar Plug-In", "built " + jarfile); // testExtensionPoints(jarfile); }
From source file:net.sf.fjep.fatjar.wizards.export.BuildFJ.java
License:Open Source License
public static void buildConfiguredFatJar(JProjectConfiguration jproject, BuildProperties props, SourceInfo[] sourceInfo) {//w w w. j a va2 s. com // Create a progress bar Shell shell = new Shell(); ProgressMonitorDialog progressmonitordialog = new ProgressMonitorDialog(shell); progressmonitordialog.open(); IProgressMonitor iprogressmonitor = progressmonitordialog.getProgressMonitor(); iprogressmonitor.beginTask("Build Fat jar", PROGRESS_CLEAN + PROGRESS_COLLECT + PROGRESS_PACK + PROGRESS_CLEAN); // Make One-JAR? boolean onejar = props.isUseOneJar(); String expand = props.getOnejarExpand(); String jarfile = null; try { props.save(); jarfile = buildFatJar(jproject, props, sourceInfo); try { jproject.getProject().refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { e.printStackTrace(); } JProjectConfiguration.removeTempFatjarConfigs(); } catch (Exception e) { e.printStackTrace(); MessageDialog.openInformation(shell, "Fat Jar Plug-In ERROR", e.getMessage()); } progressmonitordialog.close(); MessageDialog.openInformation(shell, "Fat Jar Plug-In", "built " + jarfile); }