KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > internal > ui > properties > ConfiguredSitePropertyPage


1 /*******************************************************************************
2  * Copyright (c) 2003, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

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 /**
23  * @see PropertyPage
24  */

25 public class ConfiguredSitePropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
26     /**
27      *
28      */

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 JavaDoc 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 JavaDoc key, String JavaDoc 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