Home | History | Annotate | Download | only in export
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.eclipse.org/org/documents/epl-v10.php
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ide.eclipse.adt.internal.editors.export;
     18 
     19 import org.eclipse.swt.events.ModifyListener;
     20 import org.eclipse.swt.widgets.Composite;
     21 import org.eclipse.swt.widgets.Control;
     22 import org.eclipse.swt.widgets.Text;
     23 import org.eclipse.ui.forms.widgets.FormToolkit;
     24 import org.eclipse.ui.forms.widgets.Section;
     25 
     26 import java.util.HashMap;
     27 
     28 /**
     29  * Section part for editing the properties in an Export editor.
     30  */
     31 final class ExportFieldsPart extends AbstractPropertiesFieldsPart {
     32 
     33     public ExportFieldsPart(Composite body, FormToolkit toolkit, ExportEditor editor) {
     34         super(body, toolkit, editor);
     35         Section section = getSection();
     36 
     37         section.setText("Export Properties");
     38         section.setDescription("Properties of export.properties:");
     39 
     40         Composite table = createTableLayout(toolkit, 2 /* numColumns */);
     41 
     42         createLabel(table, toolkit,
     43                 "Available Properties", //label
     44                 "List of properties you can edit in export.properties");  //tooltip
     45 
     46         Text packageField = createLabelAndText(table, toolkit,
     47                 "Package", //label,
     48                 "", //$NON-NLS-1$ value,
     49                 "TODO tooltip for Package");  //tooltip
     50 
     51         Text projectsField = createLabelAndText(table, toolkit,
     52                 "Projects", //label,
     53                 "", //$NON-NLS-1$ value,
     54                 "TODO tooltip for Projects");  //tooltip
     55 
     56         Text versionCodeField = createLabelAndText(table, toolkit,
     57                 "Version Code", //label,
     58                 "", //$NON-NLS-1$ value,
     59                 "TODO tooltip for Version Code");  //tooltip
     60 
     61         Text keyStoreField = createLabelAndText(table, toolkit,
     62                 "Key Store", //label,
     63                 "", //$NON-NLS-1$ value,
     64                 "TODO tooltip for Key Store");  //tooltip
     65 
     66         Text keyAliasField = createLabelAndText(table, toolkit,
     67                 "Key Alias", //label,
     68                 "", //$NON-NLS-1$ value,
     69                 "TODO tooltip for Key Alias");  //tooltip
     70 
     71         // Associate each field with the keyword in the properties files.
     72         // TODO there's probably some constant to reuse here.
     73         HashMap<String, Control> map = getNameToField();
     74         map.put("package", packageField);              //$NON-NLS-1$
     75         map.put("projects", projectsField);            //$NON-NLS-1$
     76         map.put("versionCode", versionCodeField);      //$NON-NLS-1$
     77         map.put("_key.store", keyStoreField);          //$NON-NLS-1$
     78         map.put("_key.alias", keyAliasField);          //$NON-NLS-1$
     79 
     80         addModifyListenerToFields();
     81     }
     82 
     83     @Override
     84     protected void setFieldModifyListener(Control field, ModifyListener markDirtyListener) {
     85         super.setFieldModifyListener(field, markDirtyListener);
     86         // TODO override for custom controls
     87     }
     88 
     89     @Override
     90     protected String getFieldText(Control field) {
     91         // TODO override for custom controls
     92         return super.getFieldText(field);
     93     }
     94 
     95     @Override
     96     protected void setFieldText(Control field, String value) {
     97         // TODO override for custom controls
     98         super.setFieldText(field, value);
     99     }
    100 }
    101