Package org.objectstyle.wolips.preferences

Examples of org.objectstyle.wolips.preferences.TableViewerSupport


    return Activator.getDefault().getPreferenceStore();
  }

  @Override
  protected Control createContents(Composite parent) {
    TableViewerSupport support = new TableViewerSupport(_model, parent) {

      @Override
      protected void initTableViewer(TableViewer viewer) {
        Table table = viewer.getTable();

        TableColumn col1 = new TableColumn(table, SWT.LEFT);
        col1.setText("Component Regex");
        col1.setWidth(150);

        TableColumn col2 = new TableColumn(table, SWT.LEFT);
        col2.setText("Valid Binding Regex");
        col2.setWidth(150);
      }

      @Override
      protected Object doAdd() {
        BindingValidationRuleDialog dialog = new BindingValidationRuleDialog(getShell());
        if (dialog.open() == Window.OK) {
          return dialog.getBindingValidationRule();
        }
        return null;
      }

      @Override
      protected void doEdit(Object obj) {
        BindingValidationRule bindingValidationRule = (BindingValidationRule) obj;
        BindingValidationRuleDialog dialog = new BindingValidationRuleDialog(getShell(), bindingValidationRule);
        if (dialog.open() == Window.OK) {
          BindingValidationRule newElement = dialog.getBindingValidationRule();
          bindingValidationRule.setTypeRegex(newElement.getTypeRegex());
          bindingValidationRule.setValidBindingRegex(newElement.getValidBindingRegex());
        }
      }

      @Override
      protected ITableLabelProvider createLabelProvider() {
        return new ITableLabelProvider() {

          public Image getColumnImage(Object _tagShortcut, int columnIndex) {
            return null;
          }

          public String getColumnText(Object bindingValidationRule, int columnIndex) {
            switch (columnIndex) {
            case 0:
              return ((BindingValidationRule) bindingValidationRule).getTypeRegex();
            case 1:
              return ((BindingValidationRule) bindingValidationRule).getValidBindingRegex();
            default:
              return bindingValidationRule.toString();
            }
          }

          public void addListener(ILabelProviderListener listener) {
            // DO NOTHING
          }

          public void dispose() {
            // DO NOTHING
          }

          public boolean isLabelProperty(Object bindingValidationRule, String property) {
            return false;
          }

          public void removeListener(ILabelProviderListener listener) {
            // DO NOTHING
          }
        };
      }

    };

    _viewer = support.getTableViewer();
    _model.addAll(BindingValidationRule.fromPreferenceString(getPreferenceStore().getString(PreferenceConstants.BINDING_VALIDATION_RULES_KEY)));
    syncModels();
    _viewer.refresh();

    return support.getControl();
  }
View Full Code Here


    return Activator.getDefault().getPreferenceStore();
  }

  @Override
  protected Control createContents(Composite parent) {
    TableViewerSupport support = new TableViewerSupport(_model, parent) {

      @Override
      protected void initTableViewer(TableViewer viewer) {
        Table table = viewer.getTable();

        TableColumn col1 = new TableColumn(table, SWT.LEFT);
        col1.setText("Shortcut");
        col1.setWidth(100);

        TableColumn col2 = new TableColumn(table, SWT.LEFT);
        col2.setText("Actual Tag");
        col2.setWidth(150);

        TableColumn col3 = new TableColumn(table, SWT.LEFT);
        col3.setText("Attributes");
        col3.setWidth(200);
      }

      @Override
      protected Object doAdd() {
        TagShortcutDialog dialog = new TagShortcutDialog(getShell());
        if (dialog.open() == Dialog.OK) {
          return dialog.getTagShortcut();
        }
        return null;
      }

      @Override
      protected void doEdit(Object obj) {
        TagShortcut _tagShortcut = (TagShortcut) obj;
        TagShortcutDialog dialog = new TagShortcutDialog(getShell(), _tagShortcut);
        if (dialog.open() == Dialog.OK) {
          TagShortcut newElement = dialog.getTagShortcut();
          _tagShortcut.setShortcut(newElement.getShortcut());
          _tagShortcut.setActual(newElement.getActual());
          _tagShortcut.setAttributesAsString(newElement.getAttributesAsString());
        }
      }

      @Override
      protected ITableLabelProvider createLabelProvider() {
        return new ITableLabelProvider() {

          public Image getColumnImage(Object tagShortcut, int columnIndex) {
            return null;
          }

          public String getColumnText(Object tagShortcut, int columnIndex) {
            switch (columnIndex) {
            case 0:
              return ((TagShortcut) tagShortcut).getShortcut();
            case 1:
              return ((TagShortcut) tagShortcut).getActual();
            case 2:
              return ((TagShortcut) tagShortcut).getAttributesAsString();
            default:
              return tagShortcut.toString();
            }
          }

          public void addListener(ILabelProviderListener listener) {
            // DO NOTHING
          }

          public void dispose() {
            // DO NOTHING
          }

          public boolean isLabelProperty(Object tagShortcut, String property) {
            return false;
          }

          public void removeListener(ILabelProviderListener listener) {
            // DO NOTHING
          }
        };
      }

    };

    _viewer = support.getTableViewer();
    _model.addAll(TagShortcut.fromPreferenceString(getPreferenceStore().getString(PreferenceConstants.TAG_SHORTCUTS_KEY)));
    syncModels();
    _viewer.refresh();

    return support.getControl();
  }
View Full Code Here

    setTitle(HTMLPlugin.getResourceString("HTMLEditorPreferencePage.TaskTag"));
  }
 
  @Override
  protected Control createContents(Composite parent) {
    TableViewerSupport support = new TableViewerSupport(_model, parent){

      @Override
      protected void initTableViewer(TableViewer viewer) {
        Table table = viewer.getTable();
       
        TableColumn col1 = new TableColumn(table,SWT.LEFT);
        col1.setText(HTMLPlugin.getResourceString("HTMLEditorPreferencePage.Tag"));
        col1.setWidth(100);
       
        TableColumn col2 = new TableColumn(table,SWT.LEFT);
        col2.setText(HTMLPlugin.getResourceString("HTMLEditorPreferencePage.Priority"));
        col2.setWidth(100);
      }

      @Override
      protected Object doAdd() {
        TaskTagDialog dialog = new TaskTagDialog(getShell());
        if(dialog.open()==Dialog.OK){
          return dialog.getTaskTag();
        }
        return null;
      }

      @Override
      protected void doEdit(Object obj) {
        TaskTag element = (TaskTag)obj;
        TaskTagDialog dialog = new TaskTagDialog(getShell(), element);
        if(dialog.open()==Dialog.OK){
          TaskTag newElement = dialog.getTaskTag();
          element.setTag(newElement.getTag());
          element.setPriority(newElement.getPriority());
        }
      }

      @Override
      protected ITableLabelProvider createLabelProvider() {
        return new ITableLabelProvider(){
           
          public Image getColumnImage(Object element, int columnIndex){
              return null;
            }
           
            public String getColumnText(Object element, int columnIndex){
            switch(columnIndex){
            case 0: return ((TaskTag)element).getTag();
            case 1: return ((TaskTag)element).getPriorityName();
              default: return element.toString();
              }
            }
           
          public void addListener(ILabelProviderListener listener) {
          }
         
          public void dispose() {
          }
         
          public boolean isLabelProperty(Object element, String property) {
            return false;
          }
         
          public void removeListener(ILabelProviderListener listener) {
          }
        };
      }
     
    };
   
    _viewer = support.getTableViewer();
    _model.addAll(TaskTag.loadFromPreference(false));
    syncModels();
    _viewer.refresh();
   
    return support.getControl();
  }
View Full Code Here

   
    return composite;
  }
 
  private Control createElementArea(TabFolder tabFolder){
    TableViewerSupport support = new TableViewerSupport(elementModel, tabFolder){

      @Override
      protected void initTableViewer(TableViewer viewer) {
        Table table = viewer.getTable();
       
        TableColumn col1 = new TableColumn(table, SWT.NULL);
        col1.setText(HTMLPlugin.getResourceString("HTMLEditorPreferencePage.DisplayName"));
        col1.setWidth(100);
       
        TableColumn col2 = new TableColumn(table, SWT.NULL);
        col2.setText(HTMLPlugin.getResourceString("HTMLEditorPreferencePage.AssistString"));
        col2.setWidth(200);
      }

      @Override
      protected Object doAdd() {
        CustomElementDialog dialog = new CustomElementDialog(getShell());
        if(dialog.open()==Dialog.OK){
          return dialog.getCustomElement();
        }
        return null;
      }

      @Override
      protected void doEdit(Object obj) {
        CustomElement element = (CustomElement)obj;
        CustomElementDialog dialog = new CustomElementDialog(getShell(), element);
        if(dialog.open()==Dialog.OK){
          CustomElement newElement = dialog.getCustomElement();
          element.setDisplayName(newElement.getDisplayName());
          element.setAssistString(newElement.getAssistString());
        }
      }

      @Override
      protected ITableLabelProvider createLabelProvider() {
        return new CustomAssistLabelProvider();
      }
    };
   
    elementTableViewer = support.getTableViewer();
    return support.getControl();
  }
View Full Code Here

    elementTableViewer = support.getTableViewer();
    return support.getControl();
  }
 
  private Control createAttributeArea(TabFolder tabFolder){
    TableViewerSupport support = new TableViewerSupport(attributeModel, tabFolder){

      @Override
      protected void initTableViewer(TableViewer viewer) {
        Table table = viewer.getTable();
       
        TableColumn col1 = new TableColumn(table, SWT.NULL);
        col1.setText(HTMLPlugin.getResourceString("HTMLEditorPreferencePage.TargetTag"));
        col1.setWidth(100);
       
        TableColumn col2 = new TableColumn(table, SWT.NULL);
        col2.setText(HTMLPlugin.getResourceString("HTMLEditorPreferencePage.AttributeName"));
        col2.setWidth(200);
      }

      @Override
      protected Object doAdd() {
        CustomAttributeDialog dialog = new CustomAttributeDialog(getShell());
        if(dialog.open()==Dialog.OK){
          return dialog.getCustomAttribute();
        }
        return null;
      }

      @Override
      protected void doEdit(Object obj) {
        CustomAttribute attrInfo = (CustomAttribute)obj;
        CustomAttributeDialog dialog = new CustomAttributeDialog(getShell(), attrInfo);
        if(dialog.open()==Dialog.OK){
          CustomAttribute newAttrInfo = dialog.getCustomAttribute();
          attrInfo.setTargetTag(newAttrInfo.getTargetTag());
          attrInfo.setAttributeName(newAttrInfo.getAttributeName());
        }
      }

      @Override
      protected ITableLabelProvider createLabelProvider() {
        return new CustomAssistLabelProvider();
      }
     
    };
   
    attributeTableViewer = support.getTableViewer();
    return support.getControl();
  }
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.preferences.TableViewerSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.