Package net.sf.logsaw.core.config

Examples of net.sf.logsaw.core.config.IConfigurableObject


    text.setText(dialect.getFactory().getName());
   
    // Spacer
    new Label(root, SWT.NONE);
   
    final IConfigurableObject co = (IConfigurableObject) dialect.getAdapter(IConfigurableObject.class);
    if (co != null) {
      List<IConfigOption<?>> options = co.getAllConfigOptions();
      if (!options.isEmpty()) {
        final Group group = new Group(root, SWT.NONE);
        group.setText(Messages.DialectPropertyPage_label_config);
        GridData gridData = new GridData(SWT.FILL, SWT.NONE, true, false);
        gridData.horizontalSpan = 2;
        group.setLayoutData(gridData);
        group.setLayout(new GridLayout(2, false));
       
        for (IConfigOption<?> option : options) {
          if (!option.isVisible()) {
            // Skip
            continue;
          }
          try {
            option.visit(new IConfigOptionVisitor() {
              /* (non-Javadoc)
               * @see net.sf.logsaw.core.config.IConfigOptionVisitor#visit(net.sf.logsaw.core.config.StringConfigOption, java.lang.String)
               */
              @Override
              public void visit(StringConfigOption opt, String value)
                  throws CoreException {
                Label label = new Label(group, SWT.NONE);
                label.setText(opt.getLabel() + ":"); //$NON-NLS-1$
               
                Text text = new Text(group, SWT.SINGLE);
                text.setBackground(group.getDisplay().getSystemColor(
                    SWT.COLOR_WIDGET_BACKGROUND));
                text.setText(co.getConfigValue(opt));
              }
            }, null);
          } catch (CoreException e) {
            // Log and show error
            UIPlugin.logAndShowError(e, true);
View Full Code Here


   */
  @Override
  public boolean performFinish() {
    try {
      // Signal dynamic pages to apply settings
      IConfigurableObject obj = (IConfigurableObject) dialectInstance.getAdapter(IConfigurableObject.class);
      if (obj != null) {
        // Configure option defaults (if any)
        obj.configureDefaults();
       
        for (IConfigurableObjectWizardPage page : dialectPages) {
          page.performFinish();
        }
        Assert.isTrue(obj.isConfigured(), "Dialect should be configured by now"); //$NON-NLS-1$
      }
     
      // Create the log resource
      final ILogResource log = logResourcePage.createLogResource(dialectInstance);
      Assert.isTrue(log.isConfigured(), "Log resource should be configured by now"); //$NON-NLS-1$
View Full Code Here

      selectedDialectFactory = dialectFactory;
      dialectInstance = dialectFactory.createLogDialect();
     
      disposeDynamicPages(pages);
      // Re-fill
      IConfigurableObject obj = (IConfigurableObject) dialectInstance.getAdapter(IConfigurableObject.class);
      if (obj == null) {
        return;
      }
      IConfigurationElement[] wizardPages = Platform.getExtensionRegistry().getConfigurationElementsFor(
          extensionPointId); //$NON-NLS-1$
View Full Code Here

    text.setText(log.getPK());
   
    // Spacer
    new Label(root, SWT.NONE);
   
    final IConfigurableObject co = (IConfigurableObject) log.getAdapter(IConfigurableObject.class);
    if (co != null) {
      List<IConfigOption<?>> options = co.getAllConfigOptions();
      if (!options.isEmpty()) {
        final Group group = new Group(root, SWT.NONE);
        group.setText(Messages.ResourcePropertyPage_label_config);
        GridData gridData = new GridData(SWT.FILL, SWT.NONE, true, false);
        gridData.horizontalSpan = 2;
        group.setLayoutData(gridData);
        group.setLayout(new GridLayout(2, false));
       
        for (IConfigOption<?> option : options) {
          if (!option.isVisible()) {
            // Skip
            continue;
          }
          try {
            option.visit(new IConfigOptionVisitor() {
              /* (non-Javadoc)
               * @see net.sf.logsaw.core.config.IConfigOptionVisitor#visit(net.sf.logsaw.core.config.StringConfigOption, java.lang.String)
               */
              @Override
              public void visit(StringConfigOption opt, String value)
                  throws CoreException {
                Label label = new Label(group, SWT.NONE);
                label.setText(opt.getLabel() + ":"); //$NON-NLS-1$
               
                Text text = new Text(group, SWT.SINGLE);
                text.setBackground(group.getDisplay().getSystemColor(
                    SWT.COLOR_WIDGET_BACKGROUND));
                text.setText(co.getConfigValue(opt));
              }
            }, null);
          } catch (CoreException e) {
            // Log and show error
            UIPlugin.logAndShowError(e, true);
View Full Code Here

TOP

Related Classes of net.sf.logsaw.core.config.IConfigurableObject

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.