private boolean shouldEnableProperties(Object[] selected) { if (selected.length == 0) return false; if (selected.length == 1) return true; String version = ((ExportPackageObject) selected[0]).getVersion(); for (int i = 1; i < selected.length; i++) { ExportPackageObject object = (ExportPackageObject) selected[i]; if (version == null) { if (object.getVersion() != null) { return false; } } else if (!version.equals(object.getVersion())) { return false; } } return true; }
private void handleOpenProperties() { Object[] selected = ((IStructuredSelection) fPackageViewer.getSelection()).toArray(); ExportPackageObject first = (ExportPackageObject) selected[0]; DependencyPropertiesDialog dialog = new DependencyPropertiesDialog(isEditable(), first); dialog.create(); PlatformUI.getWorkbench() .getHelpSystem() .setHelp(dialog.getShell(), IHelpContextIds.EXPORTED_PACKAGE_PROPERTIES); SWTUtil.setDialogSize(dialog, 400, -1); if (selected.length == 1) dialog.setTitle(((ExportPackageObject) selected[0]).getName()); else dialog.setTitle(PDEUIMessages.ExportPackageSection_props); if (dialog.open() == Window.OK && isEditable()) { String newVersion = dialog.getVersion(); for (Object selectedObject : selected) { ExportPackageObject object = (ExportPackageObject) selectedObject; if (!newVersion.equals(object.getVersion())) object.setVersion(newVersion); } } }