/** * Create the export option group. * * @param parent the parent composite */ protected void createOptionsGroup(Composite parent) { Composite optionsGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; optionsGroup.setLayout(layout); fExportStructural = new Button(optionsGroup, SWT.CHECK | SWT.LEFT); fExportStructural.setText(JarPackagerMessages.JarRefactoringDialog_export_structural); fExportStructural.setSelection(fData.isExportStructuralOnly()); }
private void xmlReadRefactoring(JarPackageData jarPackage, Element element) throws java.io.IOException { if (element.getNodeName().equals("storedRefactorings")) { // $NON-NLS-1$ jarPackage.setExportStructuralOnly( getBooleanAttribute( element, "structuralOnly", jarPackage.isExportStructuralOnly())); // $NON-NLS-1$ jarPackage.setDeprecationAware( getBooleanAttribute( element, "deprecationInfo", jarPackage.isDeprecationAware())); // $NON-NLS-1$ List<IAdaptable> elements = new ArrayList<IAdaptable>(); int count = 1; String value = element.getAttribute("project" + count); // $NON-NLS-1$ while (value != null && !"".equals(value)) { // $NON-NLS-1$ final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(value); if (project.exists()) elements.add(project); count++; value = element.getAttribute("project" + count); // $NON-NLS-1$ } jarPackage.setRefactoringProjects(elements.toArray(new IProject[elements.size()])); elements.clear(); count = 1; IRefactoringHistoryService service = RefactoringCore.getHistoryService(); try { service.connect(); value = element.getAttribute("refactoring" + count); // $NON-NLS-1$ while (value != null && !"".equals(value)) { // $NON-NLS-1$ final ByteArrayInputStream stream = new ByteArrayInputStream(value.getBytes("UTF-8")); // $NON-NLS-1$ try { final RefactoringHistory history = service.readRefactoringHistory(stream, RefactoringDescriptor.NONE); if (history != null) { final RefactoringDescriptorProxy[] descriptors = history.getDescriptors(); if (descriptors.length > 0) { for (int index = 0; index < descriptors.length; index++) { elements.add(descriptors[index]); } } } } catch (CoreException exception) { JavaPlugin.log(exception); } count++; value = element.getAttribute("refactoring" + count); // $NON-NLS-1$ } } finally { service.disconnect(); } jarPackage.setRefactoringDescriptors( elements.toArray(new RefactoringDescriptorProxy[elements.size()])); } }