コード例 #1
0
ファイル: JMSView.java プロジェクト: Desy-extern/cs-studio
 public void run(IAction action) {
   try {
     IWorkbenchWindow window =
         JmsSenderPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
     window.getActivePage().showView("org.csstudio.jmsSender.views.JMSView"); // $NON-NLS-1$
   } catch (Exception e) {
     System.out.println(e);
   }
 }
コード例 #2
0
ファイル: JMSView.java プロジェクト: Desy-extern/cs-studio
  @Override
  public void createPartControl(Composite parent) {
    //		final boolean canExecute = SecurityFacade.getInstance().canExecute(
    //				SECURITY_ID, false);
    GridLayout grid = new GridLayout();
    grid.numColumns = 5;
    parent.setLayout(grid);
    GridData gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;

    int style =
        SWT.SINGLE
            | SWT.BORDER
            | SWT.H_SCROLL
            | SWT.V_SCROLL
            | SWT.FULL_SELECTION
            | SWT.HIDE_SELECTION;
    Table table = new Table(parent, style);
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1);
    table.setLayoutData(gridData);
    messageTable = new MessageTable(table);

    Button butAlarm = new Button(parent, SWT.PUSH);
    butAlarm.setText(Messages.JMSView_SendButton1);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gridData.widthHint = 80;
    butAlarm.setLayoutData(gridData);
    butAlarm.setEnabled(true);

    Label alarmTopicLabel = new Label(parent, SWT.NONE);
    alarmTopicLabel.setText(Messages.JMSView_Labels);
    final Text alarmTopic = new Text(parent, SWT.BORDER);
    alarmTopic.setText("ALARM"); // $NON-NLS-1$
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gridData.widthHint = 160;
    alarmTopic.setLayoutData(gridData);

    Label alarmCountLabel = new Label(parent, SWT.NONE);
    alarmCountLabel.setText(Messages.JMSView_Numbers);
    final Text alarmCount = new Text(parent, SWT.BORDER);
    alarmCount.setText("1"); // $NON-NLS-1$
    alarmCount.addVerifyListener(
        new VerifyListener() {
          public void verifyText(VerifyEvent e) {
            if (e.character == SWT.DEL || e.character == SWT.BS) {
              e.doit = true;
            } else {
              try {
                Integer.parseInt(e.text);
                e.doit = true;
              } catch (NumberFormatException nfe) {
                e.doit = false;
              }
            }
          }
        });
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gridData.widthHint = 80;
    alarmCount.setLayoutData(gridData);

    Button butLog = new Button(parent, SWT.PUSH);
    butLog.setText(Messages.JMSView_SendButton2);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gridData.widthHint = 80;
    butLog.setLayoutData(gridData);
    butLog.setEnabled(true);

    Label logTopicLabel = new Label(parent, SWT.NONE);
    logTopicLabel.setText(Messages.JMSView_Labels);
    final Text logTopic = new Text(parent, SWT.BORDER);
    logTopic.setText("LOG"); // $NON-NLS-1$
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gridData.widthHint = 160;
    logTopic.setLayoutData(gridData);

    Label logCountLabel = new Label(parent, SWT.NONE);
    logCountLabel.setText(Messages.JMSView_Numbers);
    final Text logCount = new Text(parent, SWT.BORDER);
    logCount.setText("1"); // $NON-NLS-1$
    logCount.addVerifyListener(
        new VerifyListener() {
          public void verifyText(VerifyEvent e) {
            if (e.character == SWT.DEL || e.character == SWT.BS) {
              e.doit = true;
            } else {
              try {
                Integer.parseInt(e.text);
                e.doit = true;

              } catch (NumberFormatException nfe) {
                e.doit = false;
              }
            }
          }
        });
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gridData.widthHint = 80;
    logCount.setLayoutData(gridData);

    butAlarm.addSelectionListener(new SendButtonSelectionListener(alarmTopic, alarmCount));
    butLog.addSelectionListener(new SendButtonSelectionListener(logTopic, logCount));
    JmsSenderPlugin.getDefault()
        .getPluginPreferences()
        .addPropertyChangeListener(propertyChangeListener);

    parent.pack();
  }