/**
   * Creates the testing area.
   *
   * @param client the client
   * @param toolkit the toolkit
   * @param actionBars the action bars
   */
  private void createTestingArea(
      final Composite client, final FormToolkit toolkit, final IActionBars actionBars) {
    ImageHyperlink imageHyperlink = toolkit.createImageHyperlink(client, SWT.None);
    imageHyperlink.setText("Launch a local component");
    imageHyperlink.setHref(TestingSection.TESTING_HREF_LOCAL_LAUNCH);
    imageHyperlink.addHyperlinkListener(this.getPage());
    imageHyperlink.setImage(ComponentImages.getImage(ComponentImages.RUN_EXEC));

    //		imageHyperlink = toolkit.createImageHyperlink(client, SWT.None);
    //		imageHyperlink.setText("Launch a remote component");
    //		imageHyperlink.setHref(TestingSection.TESTING_HREF);
    //		imageHyperlink.addHyperlinkListener(this.getPage());

    imageHyperlink = toolkit.createImageHyperlink(client, SWT.None);
    imageHyperlink.setText("Launch a local component in debug mode");
    imageHyperlink.setHref(TestingSection.TESTING_HREF_LOCAL_DEBUG);
    imageHyperlink.addHyperlinkListener(this.getPage());
    imageHyperlink.setEnabled(getPage().getEditor().getMainResource().getURI().isPlatform());
    imageHyperlink.setImage(ComponentImages.getImage(ComponentImages.DEBUG_EXEC));

    //		imageHyperlink = toolkit.createImageHyperlink(client, SWT.None);
    //		imageHyperlink.setText("Launch a remote component in debug mode");
    //		imageHyperlink.setHref(TestingSection.TESTING_HREF);
    //		imageHyperlink.addHyperlinkListener(this.getPage());
  }
  @Override
  protected Control createContents(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayoutFactory.fillDefaults().applyTo(container);

    if (studyParameters.getCustomizingPlugin() != null) {
      Label label = new Label(parent, SWT.NULL);
      label.setText(studyParameters.getCustomizedByMessage());
      label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));

      if (studyParameters.getMoreInformationUrl() != null) {
        ImageHyperlink link = new ImageHyperlink(parent, SWT.NONE);
        link.setText(Messages.UsageDataPreferencePage_Learn_More);
        link.setForeground(CommonColors.HYPERLINK_WIDGET);
        link.addHyperlinkListener(
            new HyperlinkAdapter() {
              @Override
              public void linkActivated(HyperlinkEvent e) {
                openMoreInformaionInBrowser();
              }
            });
      }
    }

    createLogFileSection(container);
    createUsageSection(container);
    updateEnablement();

    Dialog.applyDialogFont(container);
    return container;
  }
  public Composite createControl(final Composite parent) {
    // Form form=tk.createForm(parent);
    // form.setLayoutData(SWTHelper.getFillGridData(1,true,1,false));
    // Composite ret=form.getBody();
    Composite ret = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    ret.setLayout(layout);
    ret.setBackground(parent.getBackground());

    ImageHyperlink hClr = tk.createImageHyperlink(ret, SWT.NONE); // $NON-NLS-1$
    hClr.setImage(Images.IMG_CLEAR.getImage());
    hClr.addHyperlinkListener(
        new HyperlinkAdapter() {

          @Override
          public void linkActivated(final HyperlinkEvent e) {
            clearValues();
          }
        });
    hClr.setBackground(parent.getBackground());

    Composite inner = new Composite(ret, SWT.NONE);
    GridLayout lRet = new GridLayout(fields.length, true);
    inner.setLayout(lRet);
    inner.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));

    for (String l : fields) {
      Hyperlink hl = tk.createHyperlink(inner, l, SWT.NONE);
      hl.addHyperlinkListener(
          new HyperlinkAdapter() {

            @Override
            public void linkActivated(final HyperlinkEvent e) {
              Hyperlink h = (Hyperlink) e.getSource();
              fireSortEvent(h.getText());
            }
          });
      hl.setBackground(parent.getBackground());
    }

    createSelectors(fields.length);
    for (int i = 0; i < selectors.length; i++) {
      selectors[i] = new ElexisText(tk.createText(inner, "", SWT.BORDER)); // $NON-NLS-1$
      selectors[i].addModifyListener(ml);
      selectors[i].addSelectionListener(sl);
      selectors[i].setToolTipText(
          Messages.getString("DefaultControlFieldProvider.enterFilter")); // $NON-NLS-1$
      selectors[i].setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
      SWTHelper.setSelectOnFocus((Text) selectors[i].getWidget());
    }

    return ret;
  }
Пример #4
0
  private void addOptions() {
    Map<String, Composite> sections = new HashMap<String, Composite>();

    for (IOption option : action.getConfiguration().getOptions()) {
      Composite parent = body;
      if (option instanceof Option) {
        if (((Option) option).isFixed()) continue;
        String sectionName = ((Option) option).getSection();
        if (sectionName != null) {
          parent = sections.get(sectionName);
          if (parent == null) {
            Section section =
                toolkit.createSection(body, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
            section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
            section.setExpanded(false);
            section.addExpansionListener(
                new ExpansionAdapter() {
                  public void expansionStateChanged(ExpansionEvent e) {
                    form.reflow(true);
                  }
                });
            section.setText(sectionName);
            //						section.setDescription("This is the description that goes below the title");
            Composite sectionClient = toolkit.createComposite(section);
            sectionClient.setLayout(new GridLayout());
            section.setClient(sectionClient);
            sections.put(sectionName, sectionClient);
            parent = sectionClient;
          }
        }
      }
      addOption(parent, option);
    }

    runLink = toolkit.createImageHyperlink(body, SWT.NONE);
    //		runLink.setFont(JFaceResources.getHeaderFont());
    runLink.setImage(runImage);
    runLink.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, true));
    runLink.setText("Run");
    updateRunButton();

    runLink.addHyperlinkListener(
        new HyperlinkAdapter() {
          @Override
          public void linkActivated(HyperlinkEvent e) {
            safeRun();
          }
        });
  }
Пример #5
0
 NotesList(Composite parent) {
   super(parent, SWT.NONE);
   setLayout(new GridLayout());
   this.parent = parent;
   Composite cFilter = new Composite(this, SWT.NONE);
   cFilter.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
   cFilter.setLayout(new GridLayout(3, false));
   ImageHyperlink clearSearchFieldHyperlink = new ImageHyperlink(cFilter, SWT.NONE);
   clearSearchFieldHyperlink.setImage(Images.IMG_CLEAR.getImage());
   clearSearchFieldHyperlink.addHyperlinkListener(
       new HyperlinkAdapter() {
         @Override
         public void linkActivated(HyperlinkEvent e) {
           tFilter.setText(""); // $NON-NLS-1$
           filterExpr = ""; // $NON-NLS-1$
           matches.clear();
           tv.collapseAll();
           tv.removeFilter(notesFilter);
         }
       });
   new Label(cFilter, SWT.NONE).setText(Messages.NotesList_searchLabel);
   tFilter = new Text(cFilter, SWT.SINGLE);
   tFilter.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
   tFilter.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetDefaultSelected(SelectionEvent e) {
           filterExpr = tFilter.getText().toLowerCase();
           matches.clear();
           if (filterExpr.length() == 0) {
             tv.removeFilter(notesFilter);
             tv.collapseAll();
           } else {
             tv.addFilter(notesFilter);
             tv.expandAll();
           }
         }
       });
   tv = new TreeViewer(this, SWT.NONE);
   tv.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
   tv.setContentProvider(new NotesContentProvider());
   tv.setLabelProvider(new DefaultLabelProvider());
   tv.setUseHashlookup(true);
   tv.setInput(parent);
   tv.addSelectionChangedListener(GlobalEventDispatcher.getInstance().getDefaultListener());
 }
Пример #6
0
  private void initIcons(ApplicationFactory factory) {
    Composite center = null;
    if (Application.LICENSE == Install.PERSONAL) {
      center = new Composite(this, SWT.TRANSPARENCY_ALPHA);
      GridData gridData = new GridData(GridData.FILL_BOTH);
      center.setLayoutData(gridData);

      GridLayout gridLayout = new GridLayout(2, false);
      center.setLayout(gridLayout);

      Browser widget = null;

      //      ClientLog.getInstance().setMessage(getShell(), new Exception( "buoc 1 da chay vao day
      // roi " + widget.toString()));

      try {
        widget = new Browser(center, SWT.NONE);
        //        ClientLog.getInstance().setMessage(getShell(), new Exception( " da chay vao day
        // roi " + widget.toString()));
      } catch (Exception e) {
        widget = new Browser(center, SWT.NONE);
        ClientLog.getInstance().setException(null, e);
      }
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.verticalSpan = 2;
      widget.setLayoutData(gridData);
      if (Application.GROUPS.length > 0 && Application.GROUPS[0].equals("XML")) {
        widget.setUrl("http://vietspider.org/webextractor/");
        toolbar.setText("http://vietspider.org/webextractor/");
      } else {
        widget.setUrl("http://nik.vn/tin/");
        //      widget.setUrl("http://*****:*****@SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            BrowserWidget browser = workspace.getTab().createItem();
            browser.viewPage();
          }
        };
    browserImageLink.addHyperlinkListener(listener);
    //    browserLink.addHyperlinkListener(listener);

    composite = createItem(top);
    final ImageHyperlink creatorImageLink =
        new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
    creatorImageLink.setImage(factory.loadImage("large.createsource.png"));
    //    creatorImageLink.setBackground(getBackground());
    creatorImageLink.setToolTipText(factory.getLabel("creatorLink"));
    //    final Hyperlink creatorLink = createLink(composite);
    //    creatorLink.setText(factory.getLabel("creatorLink"));
    //    creatorLink.setForeground(color);
    listener =
        new HyperlinkAdapter() {
          @SuppressWarnings("unused")
          public void linkEntered(HyperlinkEvent e) {
            //        creatorLink.setUnderlined(true);
          }

          @SuppressWarnings("unused")
          public void linkExited(HyperlinkEvent e) {
            //        creatorLink.setUnderlined(false);
          }

          @SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            //        creatorLink.setUnderlined(false);
            try {
              ChannelWizard wizard =
                  (ChannelWizard)
                      workspace.getTab().createTool(ChannelWizard.class, false, SWT.CLOSE);
            } catch (Exception exp) {
              ClientLog.getInstance().setException(null, exp);
            }
            //        try {
            //          Creator creator = (Creator)workspace.getTab().createTool(
            //              Creator.class, false,  SWT.CLOSE);
            //          creator.selectData(new Worker[0], null, null);
            //        } catch (Exception exp) {
            //          ClientLog.getInstance().setException(null, exp);
            //        }
          }
        };
    creatorImageLink.addHyperlinkListener(listener);
    //    creatorLink.addHyperlinkListener(listener);

    ////////////////////////////////////////////////////////////////////////////////////////////////

    Composite bottom = new Composite(center, SWT.TRANSPARENCY_ALPHA);
    if (Application.LICENSE == Install.PERSONAL) {
      gridData = new GridData();
      gridData.widthHint = 350;
    } else {
      gridData = new GridData(GridData.FILL_BOTH);
    }
    bottom.setLayoutData(gridData);
    //    bottom.setBackground(getBackground());

    rowLayout = new RowLayout();
    rowLayout.wrap = true;
    rowLayout.pack = true;
    rowLayout.justify = true;
    rowLayout.type = SWT.HORIZONTAL;
    rowLayout.marginLeft = 5;
    rowLayout.marginTop = 5;
    rowLayout.marginRight = 5;
    rowLayout.marginBottom = 5;
    rowLayout.spacing = 20;
    bottom.setLayout(rowLayout);

    if (Application.LICENSE != Install.PERSONAL) {
      composite = createItem(top);
    } else {
      composite = createItem(bottom);
    }
    final ImageHyperlink crawlerImageLink =
        new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
    crawlerImageLink.setImage(factory.loadImage("large.crawler.png"));
    //    crawlerImageLink.setBackground(getBackground());
    crawlerImageLink.setToolTipText(factory.getLabel("crawlerLink"));
    //    final Hyperlink crawlerLink = createLink(composite);
    //    crawlerLink.setText(factory.getLabel("crawlerLink"));
    //    crawlerLink.setForeground(color);
    listener =
        new HyperlinkAdapter() {
          @SuppressWarnings("unused")
          public void linkEntered(HyperlinkEvent e) {
            //        crawlerLink.setUnderlined(true);
          }

          @SuppressWarnings("unused")
          public void linkExited(HyperlinkEvent e) {
            //        crawlerLink.setUnderlined(false);
          }

          @SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            //        crawlerLink.setUnderlined(false);
            try {
              workspace.getTab().createTool(Crawler.class, true, SWT.CLOSE);
            } catch (Exception exp) {
              ClientLog.getInstance().setException(getShell(), exp);
            }
          }
        };
    crawlerImageLink.addHyperlinkListener(listener);
    //    crawlerLink.addHyperlinkListener(listener);

    if (Application.LICENSE != Install.PERSONAL) {
      composite = createItem(bottom);
      final ImageHyperlink monitorImageLink =
          new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
      monitorImageLink.setImage(factory.loadImage("large.log.png"));
      //      monitorImageLink.setBackground(getBackground());
      monitorImageLink.setToolTipText(factory.getLabel("logLink"));
      //      final Hyperlink monitorLink = createLink(composite);
      //      monitorLink.setText(factory.getLabel("monitorLink"));
      //      monitorLink.setForeground(color);
      listener =
          new HyperlinkAdapter() {
            @SuppressWarnings("unused")
            public void linkActivated(HyperlinkEvent e) {
              try {
                workspace.getTab().createTool(LogViewer2.class, true, SWT.CLOSE);
              } catch (Exception exp) {
                ClientLog.getInstance().setException(workspace.getShell(), exp);
              }
            }
          };
      monitorImageLink.addHyperlinkListener(listener);
      //      monitorLink.addHyperlinkListener(listener);
    }

    /*if(Application.LICENSE  != Install.PERSONAL) {
          composite = createItem(bottom);
          final ImageHyperlink userImageLink =
            new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
          userImageLink.setImage(factory.loadImage("large.userfolder.png"));
    //      userImageLink.setBackground(getBackground());
          userImageLink.setToolTipText(factory.getLabel("userLink"));
    //      final Hyperlink userLink = createLink(composite);
    //      userLink.setText(factory.getLabel("userLink"));
    //      userLink.setForeground(color);
          listener = new HyperlinkAdapter() {
            @SuppressWarnings("unused")
            public void linkEntered(HyperlinkEvent e) {
    //          userLink.setUnderlined(true);
            }

            @SuppressWarnings("unused")
            public void linkExited(HyperlinkEvent e) {
    //          userLink.setUnderlined(false);
    //          userLink.setFont(UIDATA.FONT_9VB);
            }
            @SuppressWarnings("unused")
            public void linkActivated(HyperlinkEvent e) {
    //          userLink.setUnderlined(false);
              try {
                workspace.getTab().createTool(Organization.class, true,  SWT.CLOSE);
              }catch (Exception exp) {
                ClientLog.getInstance().setException(workspace.getShell(), exp);
              }
            }
          };
          userImageLink.addHyperlinkListener(listener);
    //      userLink.addHyperlinkListener(listener);
        }*/

    composite = createItem(bottom);

    final ImageHyperlink configImageLink =
        new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
    configImageLink.setImage(factory.loadImage("large.settingsfolder.png"));
    //    configImageLink.setBackground(getBackground());
    configImageLink.setToolTipText(factory.getLabel("configLink"));
    //    final Hyperlink configLink = createLink(composite);
    //    configLink.setText(factory.getLabel("configLink"));
    //    configLink.setForeground(color);
    listener =
        new HyperlinkAdapter() {
          @SuppressWarnings("unused")
          public void linkEntered(HyperlinkEvent e) {
            //        configLink.setUnderlined(true);
          }

          @SuppressWarnings("unused")
          public void linkExited(HyperlinkEvent e) {
            //        configLink.setUnderlined(false);
          }

          @SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            //        configLink.setUnderlined(false);
            try {
              workspace.getTab().createTool(Config.class, true, SWT.CLOSE);
            } catch (Exception exp) {
              ClientLog.getInstance().setException(workspace.getShell(), exp);
            }
          }
        };
    configImageLink.addHyperlinkListener(listener);
  }
  protected void createPlanningLayout(Composite comp) {
    Section section = createSection(comp, "Personal Planning");
    section.setLayout(new GridLayout());
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    section.setExpanded(true);

    Composite sectionClient = getManagedForm().getToolkit().createComposite(section);
    section.setClient(sectionClient);
    GridLayout layout = new GridLayout();
    layout.numColumns = 7;
    layout.makeColumnsEqualWidth = false;
    sectionClient.setLayout(layout);
    GridData clientDataLayout = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    sectionClient.setLayoutData(clientDataLayout);

    // Scheduled date
    getManagedForm().getToolkit().createLabel(sectionClient, "Scheduled for:");
    // label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
    scheduledForDate = new ScheduleDatePicker(sectionClient, null, SWT.FLAT);
    scheduledForDate.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    scheduledForDate.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    //		Calendar newTaskSchedule = TaskActivityUtil.getCalendar();
    //		int scheduledEndHour = TasksUiPlugin.getDefault().getPreferenceStore().getInt(
    //				TasksUiPreferenceConstants.PLANNING_ENDHOUR);
    // If past scheduledEndHour set for following day
    //		if (newTaskSchedule.get(Calendar.HOUR_OF_DAY) >= scheduledEndHour) {
    //			TaskActivityUtil.snapForwardNumDays(newTaskSchedule, 1);
    //		} else {
    //			TaskActivityUtil.snapEndOfWorkDay(newTaskSchedule);
    //		}
    //		scheduledForDate.setDate(newTaskSchedule);
    //		Button removeReminder = getManagedForm().getToolkit().createButton(sectionClient, "Clear",
    //				SWT.PUSH | SWT.CENTER);
    //		removeReminder.addSelectionListener(new SelectionAdapter() {
    //			@Override
    //			public void widgetSelected(SelectionEvent e) {
    //				scheduledForDate.setDate(null);
    //			}
    //		});

    ImageHyperlink clearReminder =
        getManagedForm().getToolkit().createImageHyperlink(sectionClient, SWT.NONE);
    clearReminder.setImage(CommonImages.getImage(CommonImages.REMOVE));
    clearReminder.setToolTipText("Clear");
    clearReminder.addHyperlinkListener(
        new HyperlinkAdapter() {
          @Override
          public void linkActivated(HyperlinkEvent e) {
            scheduledForDate.setScheduledDate(null);
          }
        });

    // 1 Blank column after Reminder clear button
    Label dummy = getManagedForm().getToolkit().createLabel(sectionClient, "");
    GridData dummyLabelDataLayout = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
    dummyLabelDataLayout.horizontalSpan = 1;
    dummyLabelDataLayout.widthHint = 30;
    dummy.setLayoutData(dummyLabelDataLayout);

    // Estimated time
    getManagedForm().getToolkit().createLabel(sectionClient, "Estimated hours:");
    // label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
    // estimatedTime = new Spinner(sectionClient, SWT.FLAT);
    estimatedTime = new Spinner(sectionClient, SWT.FLAT);
    estimatedTime.setDigits(0);
    estimatedTime.setMaximum(100);
    estimatedTime.setMinimum(0);
    estimatedTime.setIncrement(1);
    estimatedTime.setSelection(DEFAULT_ESTIMATED_TIME);
    estimatedTime.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    GridData estimatedDataLayout = new GridData();
    estimatedDataLayout.widthHint = 30;
    estimatedTime.setLayoutData(estimatedDataLayout);
    // getManagedForm().getToolkit().createLabel(sectionClient, "hours ");
    // label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));

    ImageHyperlink clearEstimated =
        getManagedForm().getToolkit().createImageHyperlink(sectionClient, SWT.NONE);
    clearEstimated.setImage(CommonImages.getImage(CommonImages.REMOVE));
    clearEstimated.setToolTipText("Clear");
    clearEstimated.addHyperlinkListener(
        new HyperlinkAdapter() {
          @Override
          public void linkActivated(HyperlinkEvent e) {
            estimatedTime.setSelection(0);
          }
        });

    getManagedForm().getToolkit().paintBordersFor(sectionClient);
  }