1 11 12 package org.eclipse.ui.internal.dialogs; 13 14 import java.net.URL ; 15 16 import org.eclipse.jface.dialogs.IDialogConstants; 17 import org.eclipse.jface.resource.ImageDescriptor; 18 import org.eclipse.jface.wizard.WizardPage; 19 import org.eclipse.swt.SWT; 20 import org.eclipse.swt.widgets.Button; 21 import org.eclipse.ui.PlatformUI; 22 import org.eclipse.ui.internal.WorkbenchMessages; 23 import org.eclipse.ui.internal.util.BundleUtility; 24 25 26 32 abstract class AbstractPreferenceImportExportPage extends WizardPage { 33 34 37 protected static final String EXPORT_TITLE = WorkbenchMessages.getString("ImportExportPages.exportTitle"); 41 protected static final String IMPORT_TITLE = WorkbenchMessages.getString("ImportExportPages.importTitle"); 45 protected static final String PREFERENCE_EXT = ".epf"; 47 54 protected static ImageDescriptor getImageDescriptor(String relativePath) { 55 String path = "icons/full/" + relativePath; URL url = BundleUtility.find(PlatformUI.PLUGIN_ID, path); 57 58 return url != null 59 ? ImageDescriptor.createFromURL(url) 60 : ImageDescriptor.getMissingImageDescriptor(); 61 } 62 63 68 protected final boolean export; 69 70 77 protected AbstractPreferenceImportExportPage(final String name, final boolean exportWizard) { 78 super(name); 79 80 export = exportWizard; 81 } 82 83 91 protected int computePushButtonWidthHint(Button pushButton) { 92 final int defaultWidth = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); 93 final int minimumWidth = pushButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x; 94 return Math.max(defaultWidth, minimumWidth) + 5; 95 } 96 } 97 | Popular Tags |