1 11 package org.eclipse.update.internal.ui.properties; 12 13 import org.eclipse.swt.*; 14 import org.eclipse.swt.layout.*; 15 import org.eclipse.swt.widgets.*; 16 import org.eclipse.ui.*; 17 import org.eclipse.ui.dialogs.*; 18 import org.eclipse.update.configuration.*; 19 import org.eclipse.update.internal.ui.model.*; 20 import org.eclipse.update.internal.ui.UpdateUIMessages; 21 22 25 public class ConfiguredSitePropertyPage extends PropertyPage implements IWorkbenchPropertyPage { 26 29 public ConfiguredSitePropertyPage() { 30 noDefaultAndApplyButton(); 31 } 32 33 protected Control createContents(Composite parent) { 34 IConfiguredSiteAdapter adapter = (IConfiguredSiteAdapter)getElement(); 35 IConfiguredSite csite = adapter.getConfiguredSite(); 36 Composite composite = new Composite(parent,SWT.NONE); 37 GridLayout layout = new GridLayout(); 38 layout.numColumns = 2; 39 composite.setLayout(layout); 40 addProperty(composite, UpdateUIMessages.ConfiguredSitePropertyPage_path, csite.getSite().getURL().toString()); 41 addProperty(composite, UpdateUIMessages.ConfiguredSitePropertyPage_type, getLocationType(csite)); 42 addProperty(composite, UpdateUIMessages.ConfiguredSitePropertyPage_enabled, csite.isEnabled()?UpdateUIMessages.ConfiguredSitePropertyPage_yes:UpdateUIMessages.ConfiguredSitePropertyPage_no); 43 return composite; 44 } 45 46 private String getLocationType(IConfiguredSite csite) { 47 if (csite.isExtensionSite()) 48 return UpdateUIMessages.ConfiguredSitePropertyPage_extension; 49 if (csite.isProductSite()) 50 return UpdateUIMessages.ConfiguredSitePropertyPage_product; 51 return UpdateUIMessages.ConfiguredSitePropertyPage_unknown; 52 } 53 54 private void addProperty(Composite parent, String key, String value) { 55 Label label = new Label(parent, SWT.NULL); 56 label.setText(key); 57 58 label = new Label(parent, SWT.NULL); 59 label.setText(value); 60 GridData gd = new GridData(GridData.FILL_HORIZONTAL); 61 label.setLayoutData(gd); 62 } 63 } 64 | Popular Tags |