@Override public void open(JarPackageData jarPackage, Shell displayShell, MultiStatus status) throws CoreException { super.open(jarPackage, displayShell, status); fJarPackage= jarPackage; jarNames= new HashSet<>(); createBlankSubfolder(displayShell, jarPackage.allowOverwrite()); }
@Override public void open(JarPackageData jarPackage, Shell displayShell, MultiStatus status) throws CoreException { super.open(jarPackage, displayShell, status); fJarPackage= jarPackage; jarNames= new HashSet<>(); createBlankSubfolder(displayShell, jarPackage.allowOverwrite()); }
private void xmlWriteOptions(JarPackageData jarPackage, Document document, Element xmlJarDesc) throws DOMException { Element options= document.createElement("options"); //$NON-NLS-1$ xmlJarDesc.appendChild(options); options.setAttribute("overwrite", "" + jarPackage.allowOverwrite()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("compress", "" + jarPackage.isCompressed()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("exportErrors", "" + jarPackage.areErrorsExported()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("exportWarnings", "" + jarPackage.exportWarnings()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("saveDescription", "" + jarPackage.isDescriptionSaved()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("descriptionLocation", jarPackage.getDescriptionLocation().toPortableString()); //$NON-NLS-1$ options.setAttribute("useSourceFolders", "" + jarPackage.useSourceFolderHierarchy()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("buildIfNeeded", "" + jarPackage.isBuildingIfNeeded()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("includeDirectoryEntries", "" + jarPackage.areDirectoryEntriesIncluded()); //$NON-NLS-1$//$NON-NLS-2$ options.setAttribute("storeRefactorings", "" + jarPackage.isRefactoringAware()); //$NON-NLS-1$//$NON-NLS-2$ }
private void xmlWriteOptions(JarPackageData jarPackage, Document document, Element xmlJarDesc) throws DOMException { Element options= document.createElement("options"); //$NON-NLS-1$ xmlJarDesc.appendChild(options); options.setAttribute("overwrite", "" + jarPackage.allowOverwrite()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("compress", "" + jarPackage.isCompressed()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("exportErrors", "" + jarPackage.areErrorsExported()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("exportWarnings", "" + jarPackage.exportWarnings()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("saveDescription", "" + jarPackage.isDescriptionSaved()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("descriptionLocation", jarPackage.getDescriptionLocation().toPortableString()); //$NON-NLS-1$ options.setAttribute("useSourceFolders", "" + jarPackage.useSourceFolderHierarchy()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("buildIfNeeded", "" + jarPackage.isBuildingIfNeeded()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("includeDirectoryEntries", "" + jarPackage.areDirectoryEntriesIncluded()); //$NON-NLS-1$//$NON-NLS-2$ options.setAttribute("storeRefactorings", "" + jarPackage.isRefactoringAware()); //$NON-NLS-1$//$NON-NLS-2$ }
private void xmlWriteOptions(JarPackageData jarPackage, Document document, Element xmlJarDesc) throws DOMException { Element options= document.createElement("options"); //$NON-NLS-1$ xmlJarDesc.appendChild(options); options.setAttribute("overwrite", "" + jarPackage.allowOverwrite()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("compress", "" + jarPackage.isCompressed()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("exportErrors", "" + jarPackage.areErrorsExported()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("exportWarnings", "" + jarPackage.exportWarnings()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("saveDescription", "" + jarPackage.isDescriptionSaved()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("descriptionLocation", jarPackage.getDescriptionLocation().toPortableString()); //$NON-NLS-1$ options.setAttribute("useSourceFolders", "" + jarPackage.useSourceFolderHierarchy()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("buildIfNeeded", "" + jarPackage.isBuildingIfNeeded()); //$NON-NLS-2$ //$NON-NLS-1$ options.setAttribute("includeDirectoryEntries", "" + jarPackage.areDirectoryEntriesIncluded()); //$NON-NLS-1$//$NON-NLS-2$ options.setAttribute("storeRefactorings", "" + jarPackage.isRefactoringAware()); //$NON-NLS-1$//$NON-NLS-2$ }
if (!file.canWrite()) return false; if (fJarPackage.allowOverwrite()) return true; return parent != null && JarPackagerUtil.askForOverwritePermission(parent, fJarPackage.getAbsoluteJarLocation(), true);
private void saveManifest() throws CoreException, IOException { ByteArrayOutputStream manifestOutput= new ByteArrayOutputStream(); Manifest manifest= fJarPackage.getManifestProvider().create(fJarPackage); manifest.write(manifestOutput); ByteArrayInputStream fileInput= new ByteArrayInputStream(manifestOutput.toByteArray()); IFile manifestFile= fJarPackage.getManifestFile(); if (manifestFile.isAccessible()) { if (fJarPackage.allowOverwrite() || JarPackagerUtil.askForOverwritePermission(fParentShell, manifestFile.getFullPath().toString())) manifestFile.setContents(fileInput, true, true, null); } else manifestFile.create(fileInput, true, null); }
private void saveManifest() throws CoreException, IOException { ByteArrayOutputStream manifestOutput= new ByteArrayOutputStream(); Manifest manifest= fJarPackage.getManifestProvider().create(fJarPackage); manifest.write(manifestOutput); ByteArrayInputStream fileInput= new ByteArrayInputStream(manifestOutput.toByteArray()); IFile manifestFile= fJarPackage.getManifestFile(); if (manifestFile.isAccessible()) { if (fJarPackage.allowOverwrite() || JarPackagerUtil.askForOverwritePermission(fParentShell, manifestFile.getFullPath(), false)) manifestFile.setContents(fileInput, true, true, null); } else manifestFile.create(fileInput, true, null); }
private void saveManifest() throws CoreException, IOException { ByteArrayOutputStream manifestOutput= new ByteArrayOutputStream(); Manifest manifest= fJarPackage.getManifestProvider().create(fJarPackage); manifest.write(manifestOutput); ByteArrayInputStream fileInput= new ByteArrayInputStream(manifestOutput.toByteArray()); IFile manifestFile= fJarPackage.getManifestFile(); if (manifestFile.isAccessible()) { if (fJarPackage.allowOverwrite() || JarPackagerUtil.askForOverwritePermission(fParentShell, manifestFile.getFullPath(), false)) manifestFile.setContents(fileInput, true, true, null); } else manifestFile.create(fileInput, true, null); }
protected void saveManifest() throws CoreException, IOException { ByteArrayOutputStream manifestOutput= new ByteArrayOutputStream(); ByteArrayInputStream fileInput= null; try { Manifest manifest= fJarPackage.getManifestProvider().create(fJarPackage); manifest.write(manifestOutput); fileInput= new ByteArrayInputStream(manifestOutput.toByteArray()); IFile manifestFile= fJarPackage.getManifestFile(); if (manifestFile.isAccessible()) { // AspectJ Change Begin if (fJarPackage.allowOverwrite() || AJJarPackagerUtil.askForOverwritePermission(fParentShell, manifestFile.getFullPath().toString())) // AspectJ Change End manifestFile.setContents(fileInput, true, true, null); } else manifestFile.create(fileInput, true, null); } finally { if (manifestOutput != null) manifestOutput.close(); if (fileInput != null) fileInput.close(); } }
/** * Hook method for restoring widget values to the values that they held * last time this wizard was used to completion. */ @Override protected void restoreWidgetValues() { if (!((JarPackageWizard)getWizard()).isInitializingFromJarPackage()) initializeJarPackage(); fExportClassFilesCheckbox.setSelection(fJarPackage.areClassFilesExported()); fExportOutputFoldersCheckbox.setSelection(fJarPackage.areOutputFoldersExported()); fExportJavaFilesCheckbox.setSelection(fJarPackage.areJavaFilesExported()); super.restoreWidgetValues(); // options if (fExportRefactoringsCheckbox != null) fExportRefactoringsCheckbox.setSelection(fJarPackage.isRefactoringAware()); fCompressCheckbox.setSelection(fJarPackage.isCompressed()); fIncludeDirectoryEntriesCheckbox.setSelection(fJarPackage.areDirectoryEntriesIncluded()); fOverwriteCheckbox.setSelection(fJarPackage.allowOverwrite()); }
/** * Hook method for restoring widget values to the values that they held * last time this wizard was used to completion. */ @Override protected void restoreWidgetValues() { if (!((JarPackageWizard)getWizard()).isInitializingFromJarPackage()) initializeJarPackage(); fExportClassFilesCheckbox.setSelection(fJarPackage.areClassFilesExported()); fExportOutputFoldersCheckbox.setSelection(fJarPackage.areOutputFoldersExported()); fExportJavaFilesCheckbox.setSelection(fJarPackage.areJavaFilesExported()); super.restoreWidgetValues(); // options if (fExportRefactoringsCheckbox != null) fExportRefactoringsCheckbox.setSelection(fJarPackage.isRefactoringAware()); fCompressCheckbox.setSelection(fJarPackage.isCompressed()); fIncludeDirectoryEntriesCheckbox.setSelection(fJarPackage.areDirectoryEntriesIncluded()); fOverwriteCheckbox.setSelection(fJarPackage.allowOverwrite()); }
protected void saveDescription() throws CoreException, IOException { // Adjust JAR package attributes if (fJarPackage.isManifestReused()) fJarPackage.setGenerateManifest(false); ByteArrayOutputStream objectStreamOutput= new ByteArrayOutputStream(); IJarDescriptionWriter writer= fJarPackage.createJarDescriptionWriter(objectStreamOutput); ByteArrayInputStream fileInput= null; try { writer.write(fJarPackage); fileInput= new ByteArrayInputStream(objectStreamOutput.toByteArray()); IFile descriptionFile= fJarPackage.getDescriptionFile(); if (descriptionFile.isAccessible()) { // AspectJ Change Begin if (fJarPackage.allowOverwrite() || AJJarPackagerUtil.askForOverwritePermission(fParentShell, descriptionFile.getFullPath().toString())) // AspectJ Change End descriptionFile.setContents(fileInput, true, true, null); } else descriptionFile.create(fileInput, true, null); } finally { if (fileInput != null) fileInput.close(); if (writer != null) writer.close(); } }
private void saveDescription() throws CoreException, IOException { // Adjust JAR package attributes if (fJarPackage.isManifestReused()) fJarPackage.setGenerateManifest(false); ByteArrayOutputStream objectStreamOutput= new ByteArrayOutputStream(); IFile descriptionFile= fJarPackage.getDescriptionFile(); String encoding= "UTF-8"; //$NON-NLS-1$ try { encoding= descriptionFile.getCharset(true); } catch (CoreException exception) { JavaPlugin.log(exception); } IJarDescriptionWriter writer= fJarPackage.createJarDescriptionWriter(objectStreamOutput, encoding); ByteArrayInputStream fileInput= null; try { writer.write(fJarPackage); fileInput= new ByteArrayInputStream(objectStreamOutput.toByteArray()); if (descriptionFile.isAccessible()) { if (fJarPackage.allowOverwrite() || JarPackagerUtil.askForOverwritePermission(fParentShell, descriptionFile.getFullPath().toString())) descriptionFile.setContents(fileInput, true, true, null); } else descriptionFile.create(fileInput, true, null); } finally { if (fileInput != null) fileInput.close(); if (writer != null) writer.close(); } }
private void saveDescription() throws CoreException, IOException { // Adjust JAR package attributes if (fJarPackage.isManifestReused()) fJarPackage.setGenerateManifest(false); ByteArrayOutputStream objectStreamOutput= new ByteArrayOutputStream(); IFile descriptionFile= fJarPackage.getDescriptionFile(); String encoding= "UTF-8"; //$NON-NLS-1$ try { encoding= descriptionFile.getCharset(true); } catch (CoreException exception) { JavaPlugin.log(exception); } IJarDescriptionWriter writer= fJarPackage.createJarDescriptionWriter(objectStreamOutput, encoding); ByteArrayInputStream fileInput= null; try { writer.write(fJarPackage); fileInput= new ByteArrayInputStream(objectStreamOutput.toByteArray()); if (descriptionFile.isAccessible()) { if (fJarPackage.allowOverwrite() || JarPackagerUtil.askForOverwritePermission(fParentShell, descriptionFile.getFullPath(), false)) descriptionFile.setContents(fileInput, true, true, null); } else descriptionFile.create(fileInput, true, null); } finally { if (fileInput != null) fileInput.close(); if (writer != null) writer.close(); } }
private void saveDescription() throws CoreException, IOException { // Adjust JAR package attributes if (fJarPackage.isManifestReused()) fJarPackage.setGenerateManifest(false); ByteArrayOutputStream objectStreamOutput= new ByteArrayOutputStream(); IFile descriptionFile= fJarPackage.getDescriptionFile(); String encoding= "UTF-8"; //$NON-NLS-1$ try { encoding= descriptionFile.getCharset(true); } catch (CoreException exception) { JavaPlugin.log(exception); } IJarDescriptionWriter writer= fJarPackage.createJarDescriptionWriter(objectStreamOutput, encoding); ByteArrayInputStream fileInput= null; try { writer.write(fJarPackage); fileInput= new ByteArrayInputStream(objectStreamOutput.toByteArray()); if (descriptionFile.isAccessible()) { if (fJarPackage.allowOverwrite() || JarPackagerUtil.askForOverwritePermission(fParentShell, descriptionFile.getFullPath(), false)) descriptionFile.setContents(fileInput, true, true, null); } else descriptionFile.create(fileInput, true, null); } finally { if (fileInput != null) fileInput.close(); if (writer != null) writer.close(); } }
fCompressCheckbox.setSelection(fJarPackage.isCompressed()); fIncludeDirectoryEntriesCheckbox.setSelection(fJarPackage.areDirectoryEntriesIncluded()); fOverwriteCheckbox.setSelection(fJarPackage.allowOverwrite());
/** * Persists resource specification control setting that are to be restored * in the next instance of this page. Subclasses wishing to persist * settings for their controls should extend the hook method * <code>internalSaveWidgetValues</code>. */ @Override public final void saveWidgetValues() { super.saveWidgetValues(); // update directory names history IDialogSettings settings= getDialogSettings(); if (settings != null) { settings.put(STORE_EXPORT_CLASS_FILES, fJarPackage.areClassFilesExported()); settings.put(STORE_EXPORT_OUTPUT_FOLDERS, fJarPackage.areOutputFoldersExported()); settings.put(STORE_EXPORT_JAVA_FILES, fJarPackage.areJavaFilesExported()); // options settings.put(STORE_REFACTORINGS, fJarPackage.isRefactoringAware()); settings.put(STORE_COMPRESS, fJarPackage.isCompressed()); settings.put(STORE_INCLUDE_DIRECTORY_ENTRIES, fJarPackage.areDirectoryEntriesIncluded()); settings.put(STORE_OVERWRITE, fJarPackage.allowOverwrite()); } // Allow subclasses to save values internalSaveWidgetValues(); }
/** * Persists resource specification control setting that are to be restored * in the next instance of this page. Subclasses wishing to persist * settings for their controls should extend the hook method * <code>internalSaveWidgetValues</code>. */ @Override public final void saveWidgetValues() { super.saveWidgetValues(); // update directory names history IDialogSettings settings= getDialogSettings(); if (settings != null) { settings.put(STORE_EXPORT_CLASS_FILES, fJarPackage.areClassFilesExported()); settings.put(STORE_EXPORT_OUTPUT_FOLDERS, fJarPackage.areOutputFoldersExported()); settings.put(STORE_EXPORT_JAVA_FILES, fJarPackage.areJavaFilesExported()); // options settings.put(STORE_REFACTORINGS, fJarPackage.isRefactoringAware()); settings.put(STORE_COMPRESS, fJarPackage.isCompressed()); settings.put(STORE_INCLUDE_DIRECTORY_ENTRIES, fJarPackage.areDirectoryEntriesIncluded()); settings.put(STORE_OVERWRITE, fJarPackage.allowOverwrite()); } // Allow subclasses to save values internalSaveWidgetValues(); }
/** * Persists resource specification control setting that are to be restored * in the next instance of this page. Subclasses wishing to persist * settings for their controls should extend the hook method * <code>internalSaveWidgetValues</code>. */ public final void saveWidgetValues() { // update directory names history IDialogSettings settings= getDialogSettings(); if (settings != null) { String[] directoryNames= settings.getArray(STORE_DESTINATION_NAMES); if (directoryNames == null) directoryNames= new String[0]; directoryNames= addToHistory(directoryNames, getDestinationValue()); settings.put(STORE_DESTINATION_NAMES, directoryNames); settings.put(STORE_EXPORT_CLASS_FILES, fJarPackage.areClassFilesExported()); settings.put(STORE_EXPORT_OUTPUT_FOLDERS, fJarPackage.areOutputFoldersExported()); settings.put(STORE_EXPORT_JAVA_FILES, fJarPackage.areJavaFilesExported()); // options settings.put(STORE_REFACTORINGS, fJarPackage.isRefactoringAware()); settings.put(STORE_COMPRESS, fJarPackage.isCompressed()); settings.put(STORE_INCLUDE_DIRECTORY_ENTRIES, fJarPackage.areDirectoryEntriesIncluded()); settings.put(STORE_OVERWRITE, fJarPackage.allowOverwrite()); } // Allow subclasses to save values internalSaveWidgetValues(); }