Example #1
0
  private Text createSerchBar() {
    Text filterText = null;
    if ((gridStyle & IGridViewer.filterBar) != 0) {
      Label headerLabel = new Label(container, SWT.NONE);
      String columnText = filterColumn;
      if (columnNames != null && columnTitles != null) {
        for (int i = 0; i < columnNames.length; i++) {
          if (filterColumn.equals(columnNames[i])) {
            columnText = columnTitles[i];
            break;
          }
        }
      }
      headerLabel.setText(
          LocaleMessage.getString("please.input")
              + columnText
              + LocaleMessage.getString("prefix.of.column"));

      GridData gd = new GridData(GridData.FILL_HORIZONTAL);
      headerLabel.setLayoutData(gd);

      filterText = new Text(container, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
      gd.heightHint = 15;
      filterText.setLayoutData(gd);
    }
    return filterText;
  }
  /** @see IDialogPage#createControl(Composite) */
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 3;
    layout.verticalSpacing = 9;
    Label label = new Label(container, SWT.NULL);
    label.setText(LocaleMessage.getString("container"));

    containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    containerText.setLayoutData(gd);
    containerText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });

    Button button = new Button(container, SWT.PUSH);
    button.setText(LocaleMessage.getString("openBrowse"));
    button.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleBrowse();
          }
        });
    label = new Label(container, SWT.NULL);
    label.setText(LocaleMessage.getString("file.name"));

    fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    fileText.setLayoutData(gd);
    fileText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });

    Group SQLText = new Group(container, SWT.NONE);
    gd = new GridData(GridData.FILL, GridData.FILL, true, true);
    gd.horizontalSpan = 3;
    SQLText.setLayoutData(gd);
    SQLText.setText(LocaleMessage.getString("enter.sql"));
    SQLText.setLayout(new FillLayout());
    innerText = new StyledText(SQLText, SWT.WRAP | SWT.V_SCROLL);
    innerText.setFont(new Font(SQLText.getDisplay(), "Courier New", 10, SWT.NORMAL));
    innerText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });
    initialize();
    dialogChanged();
    setControl(container);
  }
Example #3
0
    public void createControl(Composite parent) {
      Composite content = new Composite(parent, SWT.NONE);
      content.setLayout(new GridLayout());

      final Button lookup = new Button(content, SWT.RADIO);
      lookup.setText(LocaleMessage.getString("create.lookup"));
      lookup.addSelectionListener(
          new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
              if (lookup.getSelection()) {
                nextPageName = LoopupCodePage.PAGE_NAME;
              }
            }

            public void widgetDefaultSelected(SelectionEvent e) {
              widgetSelected(e);
            }
          });

      final Button manual = new Button(content, SWT.RADIO);
      manual.setText(LocaleMessage.getString("manual.creation"));
      manual.addSelectionListener(
          new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
              if (manual.getSelection()) {
                nextPageName = ManualDataSetPage.PAGE_NAME;
              }
            }

            public void widgetDefaultSelected(SelectionEvent e) {
              widgetSelected(e);
            }
          });

      final Button fromBM = new Button(content, SWT.RADIO);
      fromBM.setText(LocaleMessage.getString("create.from.bm.file"));
      fromBM.addSelectionListener(
          new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
              if (fromBM.getSelection()) {
                nextPageName = BMSelectionPage.PAGE_NAME;
              }
            }

            public void widgetDefaultSelected(SelectionEvent e) {
              widgetSelected(e);
            }
          });
      nextPageName = ManualDataSetPage.PAGE_NAME;
      getWizard().getNextPage(this);
      setPageComplete(true);
      setControl(content);
    }
Example #4
0
  /** Ensures that both text fields are set. */
  private void dialogChanged() {
    IResource container =
        ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(getContainerName()));
    String fileName = getFileName();

    if (getContainerName().length() == 0) {
      updateStatus(LocaleMessage.getString("file.container.must.be.specified"));
      return;
    }
    if (container == null || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
      updateStatus(LocaleMessage.getString("file.container.must.exist"));
      return;
    }
    if (fileName != null
        && !fileName.equals("")
        && ((IContainer) container).getFile(new Path(fileName)).exists()) {
      updateStatus(LocaleMessage.getString("filename.used"));
      return;
    }
    if (!container.isAccessible()) {
      updateStatus(LocaleMessage.getString("project.must.be.writable"));
      return;
    }
    if (fileName.length() == 0) {
      updateStatus(LocaleMessage.getString("file.name.must.be.specified"));
      return;
    }

    if (fileName.replace('\\', '/').indexOf('/', 1) > 0) {
      updateStatus(LocaleMessage.getString("file.name.must.be.valid"));
      return;
    }
    int dotLoc = fileName.lastIndexOf('.');
    if (dotLoc != -1) {
      String ext = fileName.substring(dotLoc + 1);
      if (ext.equalsIgnoreCase("sxsd") == false) {
        updateStatus(LocaleMessage.getString("file.extension.must.be.sxsd"));
        return;
      }
    }

    if (getNamespacePrefix().length() == 0) {
      updateStatus(LocaleMessage.getString("namespace.prefix.must.be.specified"));
      return;
    }

    if (getNamespaceUrl().length() == 0) {
      updateStatus(LocaleMessage.getString("namespace.url.must.be.specified"));
      return;
    }

    updateStatus(null);
  }
Example #5
0
 public void createControl(Composite parent) {
   Composite content = new Composite(parent, SWT.NONE);
   content.setLayout(new GridLayout(2, false));
   Label label = new Label(content, SWT.CANCEL);
   label.setText(LocaleMessage.getString("please.input.id"));
   final Text text = new Text(content, SWT.NONE);
   text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   text.addModifyListener(
       new ModifyListener() {
         public void modifyText(ModifyEvent e) {
           if (text.getText() != null && !(text.getText().equals(""))) {
             Set ids = new HashSet();
             CompositeMapUtil.collectAttribueValues(ids, "id", parentCM.getRoot());
             if (ids.contains(text.getText())) {
               setErrorMessage(LocaleMessage.getString("This.id.has.exists.please.change.it"));
               setPageComplete(false);
               return;
             }
             setErrorMessage(null);
             id = text.getText();
             setPageComplete(true);
           } else {
             setErrorMessage(LocaleMessage.getString("id.can.not.be.null"));
             setPageComplete(false);
           }
         }
       });
   setControl(content);
 }
 /**
  * Uses the standard container selection dialog to choose the new value for the container field.
  */
 private void handleBrowse() {
   ContainerSelectionDialog dialog =
       new ContainerSelectionDialog(
           getShell(),
           ResourcesPlugin.getWorkspace().getRoot(),
           false,
           LocaleMessage.getString("select.new.file.container"));
   if (dialog.open() == ContainerSelectionDialog.OK) {
     Object[] result = dialog.getResult();
     if (result.length == 1) {
       containerText.setText(((Path) result[0]).toString());
     }
   }
 }
Example #7
0
 public void createControl(Composite parent) {
   Composite content = new Composite(parent, SWT.NONE);
   content.setLayout(new GridLayout(2, false));
   Label label = new Label(content, SWT.CANCEL);
   label.setText(LocaleMessage.getString("please.input.lookupcode"));
   final Text text = new Text(content, SWT.NONE);
   text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   text.addModifyListener(
       new ModifyListener() {
         public void modifyText(ModifyEvent e) {
           if (text.getText() != null && !(text.getText().equals(""))) {
             lookupCode = text.getText();
             setErrorMessage(null);
             setPageComplete(true);
           } else {
             setErrorMessage(LocaleMessage.getString("lookupcode.can.not.be.null"));
             setPageComplete(false);
           }
         }
       });
   setControl(content);
 }
Example #8
0
  public void createControl(Composite parent) {
    Composite content = new Composite(parent, SWT.NONE);
    content.setLayout(new GridLayout(1, false));
    GridData data = new GridData(GridData.FILL_HORIZONTAL);

    Group bmilesGroup = new Group(content, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    bmilesGroup.setLayout(layout);
    bmilesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    bmilesGroup.setText(LocaleMessage.getString("business.model.files"));

    bmselectionsText = new Text(bmilesGroup, SWT.NONE);
    bmselectionsText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    bmselectionsText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            if (bmselectionsText.getText() != null && !(bmselectionsText.getText().equals(""))) {
              bmselections = bmselectionsText.getText();
              setErrorMessage(null);
              setPageComplete(true);
            } else {
              setErrorMessage(LocaleMessage.getString("bm.file.selection.can.not.be.null"));
              setPageComplete(false);
            }
          }
        });
    if (bmselections != null) {
      bmselectionsText.setText(bmselections);
    }
    Button uncertainProDirButton = new Button(bmilesGroup, SWT.PUSH);
    uncertainProDirButton.setData(data);
    uncertainProDirButton.setText(LocaleMessage.getString("openBrowse"));
    uncertainProDirButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            try {
              fireEvent();
            } catch (Exception e) {
              DialogUtil.showExceptionMessageBox(e);
            }
          }
        });
    justForInput = new Button(content, SWT.CHECK);
    justForInput.setText(LocaleMessage.getString("is.just.for.input"));

    final Group configGroup = new Group(content, SWT.NONE);
    configGroup.setText(LocaleMessage.getString("config.query.and.save"));
    layout = new GridLayout();
    configGroup.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    configGroup.setLayoutData(data);

    final Group dataQueryGroup = new Group(configGroup, SWT.NONE);
    dataQueryGroup.setText(LocaleMessage.getString("fill.data"));
    data = new GridData(GridData.FILL_HORIZONTAL);
    dataQueryGroup.setLayoutData(data);
    dataQueryGroup.setLayout(layout);
    fromServer = new Button(dataQueryGroup, SWT.RADIO);
    fromServer.setText(LocaleMessage.getString("get.data.from.server"));
    fromServer.setSelection(true);
    final Button fromClient = new Button(dataQueryGroup, SWT.RADIO);
    fromClient.setText(LocaleMessage.getString("get.data.from.ajax"));

    canSave = new Button(configGroup, SWT.CHECK);
    canSave.setText(LocaleMessage.getString("can.save"));
    canSave.setSelection(true);

    justForInput.addSelectionListener(
        new SelectionListener() {

          public void widgetSelected(SelectionEvent e) {
            if (justForInput.getSelection()) {
              configGroup.setEnabled(false);
              fromServer.setSelection(false);
              fromClient.setSelection(false);
              canSave.setSelection(false);
            } else {
              configGroup.setEnabled(true);
              fromServer.setSelection(true);
              fromClient.setSelection(false);
              canSave.setSelection(true);
            }
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }
        });
    setControl(content);
  }
Example #9
0
 protected BMSelectionPage() {
   super(PAGE_NAME);
   setTitle(LocaleMessage.getString("create.from.bm.file.page"));
 }
Example #10
0
 protected ManualDataSetPage(CompositeMap parentCM) {
   super(PAGE_NAME);
   setTitle(LocaleMessage.getString("manual.create.dataset.page"));
   this.parentCM = parentCM;
 }
Example #11
0
 protected LoopupCodePage() {
   super(PAGE_NAME);
   setTitle(LocaleMessage.getString("create.lookup"));
 }
Example #12
0
 protected NavigationPage() {
   super(PAGE_NAME);
   setTitle(LocaleMessage.getString("create.dataset.page"));
 }
Example #13
0
 /**
  * Constructor for SampleNewWizardPage.
  *
  * @param pageName
  */
 public BMFromSQLWizardPage(ISelection selection) {
   super("wizardPage");
   setTitle(LocaleMessage.getString("business.model.editor.file"));
   setDescription(LocaleMessage.getString("bm.wizard.desc"));
   this.selection = selection;
 }
Example #14
0
  protected void createDefaultActions() {
    toolBarManager.removeAll();
    if ((gridStyle & IGridViewer.NoToolBar) == 0) {
      if ((gridStyle & IGridViewer.fullEditable) != 0) {
        Element element = null;
        try {
          // element =
          // LoadSchemaManager.getSchemaManager().getElement(
          // data);
          element = CompositeMapUtil.getElement(data);
        } catch (Exception e) {
          // do nothing
        }
        if (element != null && element.isArray()) {
          final QualifiedName qName = element.getElementType().getQName();
          Action addAction = new AddElementAction(this, data, qName, ActionListener.NONE);
          addAction.setText("");
          addAction.setHoverImageDescriptor(
              AuroraPlugin.getImageDescriptor(LocaleMessage.getString("add.icon")));

          Action removeAction = new RemoveElementAction(this, ActionListener.DefaultImage);
          Action refreshAction = new RefreshAction(this, ActionListener.DefaultImage);
          toolBarManager.add(createActionContributionItem(addAction));
          toolBarManager.add(createActionContributionItem(refreshAction));
          toolBarManager.add(createActionContributionItem(removeAction));
          toolBarManager.update(true);
          tableViewer
              .getTable()
              .addKeyListener(
                  new KeyListener() {
                    public void keyPressed(KeyEvent e) {
                      if (e.keyCode == SWT.DEL) {
                        removeElement();
                      }
                    }

                    public void keyReleased(KeyEvent e) {}
                  });
        }
      }
    }
    if ((gridStyle & IGridViewer.isMulti) != 0) {

      Action allCheckAction =
          new Action(
              LocaleMessage.getString("all.checed"),
              AuroraPlugin.getImageDescriptor(LocaleMessage.getString("checked.icon"))) {
            public void run() {
              setAllChecked(tableViewer.getTable(), true);
            }
          };
      Action unAllCheckAction =
          new Action(
              LocaleMessage.getString("non.checed"),
              AuroraPlugin.getImageDescriptor(LocaleMessage.getString("unchecked.icon"))) {
            public void run() {
              setAllChecked(tableViewer.getTable(), false);
            }
          };
      toolBarManager.add(createActionContributionItem(allCheckAction));
      toolBarManager.add(createActionContributionItem(unAllCheckAction));
      toolBarManager.update(true);
    }
  }
Example #15
0
  /** @see IDialogPage#createControl(Composite) */
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 3;
    layout.verticalSpacing = 9;
    Label label = new Label(container, SWT.NULL);
    label.setText(LocaleMessage.getString("container"));

    containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    containerText.setLayoutData(gd);
    containerText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });

    Button button = new Button(container, SWT.PUSH);
    button.setText(LocaleMessage.getString("openBrowse"));
    button.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleBrowse();
          }
        });
    label = new Label(container, SWT.NULL);
    label.setText(LocaleMessage.getString("file.name"));

    fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    fileText.setLayoutData(gd);
    fileText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });

    label = new Label(container, SWT.NULL);
    label.setText(LocaleMessage.getString("namespace.prefix"));
    namespacePrefix = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    namespacePrefix.setLayoutData(gd);
    namespacePrefix.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });

    label = new Label(container, SWT.NULL);
    label.setText(LocaleMessage.getString("namespace.url"));
    namespaceUrl = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    namespaceUrl.setLayoutData(gd);
    namespaceUrl.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });

    initialize();
    dialogChanged();
    setControl(container);
  }
Example #16
0
 /**
  * Constructor for SampleNewWizardPage.
  *
  * @param pageName
  */
 public SxsdNewWizardPage(ISelection selection) {
   super("wizardPage");
   setTitle(LocaleMessage.getString("sxsd.wizard"));
   setDescription(LocaleMessage.getString("sxsd.wizard.desc"));
   this.selection = selection;
 }