Esempio n. 1
0
  @Override
  protected Control buildControl(Composite composite) {
    Composite control = new Composite(composite, SWT.NONE);
    control.setLayout(new RowLayout(SWT.VERTICAL));

    Label text = new Label(control, SWT.HORIZONTAL | SWT.WRAP);
    text.setLayoutData(new RowData(400, 70));
    text.setText(Messages.Wizard_Osm_Info);

    Link link = new Link(control, SWT.BORDER);
    link.setText(Messages.Wizard_Osm_InfoLink);
    link.setLayoutData(new RowData(400, 40));
    link.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            Program.launch("http://www.openstreetmap.org/"); // $NON-NLS-1$
          }
        });

    imageCache = new ImageRegistry(composite.getDisplay());
    ImageDescriptor desc = ImageDescriptor.createFromFile(getClass(), OSMControl.IMG_OSM);
    imageCache.put(OSMControl.IMG_OSM, desc);

    Composite imgControl = new Composite(control, SWT.NONE);
    imgControl.setLayoutData(new RowData(300, 100));
    imgControl.setBackgroundImage(imageCache.get(OSMControl.IMG_OSM));

    this.control = control;

    return control;
  }
Esempio n. 2
0
  public void create() {
    label = new Label(parent, SWT.NULL);
    String labelText = type.getName();
    if (showValidationHint && useValidationGUIHints) {
      refontLabel(true);
    }
    label.setText(type.getName());

    Composite container = new Composite(parent, SWT.NULL);
    GridLayout contLayout = new GridLayout(3, false);
    contLayout.horizontalSpacing = 5;
    contLayout.marginLeft = 0;
    contLayout.marginWidth = 0;
    contLayout.marginHeight = 0;
    container.setLayout(contLayout);

    GridData containerLData = new GridData();
    containerLData.horizontalAlignment = GridData.FILL;
    containerLData.grabExcessHorizontalSpace = true;
    container.setLayoutData(containerLData);

    link = new Link(container, SWT.NONE);
    link.setToolTipText(this.type.getTooltiptext());
    link.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
    link.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            if (getHref() != null && getHref().length() > 0) Program.launch(getHref());
          }
        });

    Button editBtn = new Button(container, SWT.PUSH);
    editBtn.setText(Messages.getString("URLControl.1")); // $NON-NLS-1$
    editBtn.setToolTipText(this.type.getTooltiptext());
    editBtn.setEnabled(editable);
    editBtn.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent arg0) {
            showLinkEditDialog();
          }

          public void widgetDefaultSelected(SelectionEvent arg0) {
            showLinkEditDialog();
          }
        });

    setLinkText();
  }
 @Override
 protected Control createContents(Composite parent) {
   Link link = new Link(parent, SWT.NONE);
   link.setText(ARMExplorerPreferenceConstants.PREFERENCE_ACCOUNT_INFO_MESSAGE);
   link.addListener(
       SWT.Selection,
       new Listener() {
         @Override
         public void handleEvent(Event event) {
           // Open Azure Account info article with default Browser.
           Program.launch(event.text);
         }
       });
   return super.createContents(parent);
 };
Esempio n. 4
0
 /**
  * Creates a link.
  *
  * @param parent
  * @param text
  * @param tooltip
  * @param url
  */
 private void createLink(Composite parent, String text, String tooltip, final String url) {
   Link link = new Link(parent, SWT.NONE);
   link.setLayoutData(SWTUtil.createFillHorizontallyGridData());
   link.setText(text);
   link.setToolTipText(tooltip);
   link.setBackground(parent.getBackground());
   link.addListener(
       SWT.Selection,
       new Listener() {
         public void handleEvent(Event event) {
           try {
             Program.launch(url);
           } catch (Exception e) {
             /* Ignore*/
           }
         }
       });
 }
 private void addComment(Composite parent, String text) {
   final Link link = new Link(parent, SWT.LEFT);
   link.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
   link.setText(text);
   link.addListener(
       SWT.Selection,
       new Listener() {
         public void handleEvent(Event event) {
           final String href = event.text;
           if (href != null) {
             new Thread(
                     new Runnable() {
                       public void run() {
                         TGCommunityWeb.open(href);
                       }
                     })
                 .start();
           }
         }
       });
 }
  /**
   * Main entry point to generate UI for compiler switching
   *
   * @param compilerPage
   */
  public static Composite createCompilerSwitchBlock(Composite parent) {
    Composite compilerPage = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 3;
    layout.marginWidth = 3;
    compilerPage.setLayout(layout);

    SpecifiedVersion activeGroovyVersion = CompilerUtils.getActiveGroovyVersion();
    Label compilerVersion = new Label(compilerPage, SWT.LEFT | SWT.WRAP);
    compilerVersion.setText(
        "You are currently using Groovy Compiler version "
            + CompilerUtils.getGroovyVersion()
            + ".");

    for (SpecifiedVersion version : SpecifiedVersion.values()) {
      if (activeGroovyVersion != version) {
        switchVersion(version, compilerPage);
      }
    }

    Link moreInfoLink = new Link(compilerPage, 0);
    moreInfoLink.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    moreInfoLink.setText(
        "<a href=\"http://docs.codehaus.org/display/GROOVY/Compiler+Switching+within+Groovy-Eclipse\">See here</a> for more information "
            + "on compiler switching (opens a browser window).");
    moreInfoLink.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            openUrl(event.text);
          }
        });

    return compilerPage;
  }
  protected Control createDialogArea(Composite parent) {

    Composite top = new Composite(parent, SWT.NONE);
    GridData gdSpanAll = GridDataFactory.fillDefaults().create();
    gdSpanAll.horizontalSpan = 2;
    GridData gdFillH = GridDataFactory.fillDefaults().create();

    gdFillH.widthHint = 150;
    GridLayout layout = new GridLayout(2, false);
    top.setLayout(layout);

    Label lbl = new Label(top, SWT.NONE);
    lbl.setText(Messages.getString("AuthenticationDialog.1")); // $NON-NLS-1$
    lbl.setLayoutData(gdSpanAll);
    Label lblUserName = new Label(top, SWT.NONE);
    lblUserName.setText(Messages.getString("AuthenticationDialog.2")); // $NON-NLS-1$
    Text txtUserName = new Text(top, SWT.BORDER);
    txtUserName.setLayoutData(gdFillH);
    txtUserName.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            username = ((Text) e.widget).getText();
          }
        });
    Label lblPassword = new Label(top, SWT.None);
    lblPassword.setText(Messages.getString("AuthenticationDialog.3")); // $NON-NLS-1$
    Text txtPassword = new Text(top, SWT.BORDER | SWT.PASSWORD);
    txtPassword.addModifyListener(
        new ModifyListener() {

          public void modifyText(ModifyEvent e) {
            pwd = ((Text) e.widget).getText();
          }
        });
    txtPassword.setLayoutData(gdFillH);

    createSpacer(top);

    btnSaveAuth = new Button(top, SWT.CHECK);
    btnSaveAuth.setText(Messages.getString("AuthenticationDialog.4")); // $NON-NLS-1$
    btnSaveAuth.addSelectionListener(
        new SelectionListener() {

          public void widgetDefaultSelected(SelectionEvent e) {
            // TODO Auto-generated method stub

          }

          public void widgetSelected(SelectionEvent e) {
            saveAuthData = ((Button) e.widget).getSelection();
          }
        });

    createSpacer(top);

    Link createAccountLink = new Link(top, SWT.NONE);
    createAccountLink.setText(
        "If you have not yet created an account on BUGnet, you can do it <a>here</a>");

    GridData gridData = new GridData();
    gridData.horizontalSpan = 3;

    createAccountLink.setLayoutData(gridData);

    createAccountLink.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            setReturnCode(ACCOUNT_CREATE_ID);
            close();
          }
        });

    return top;
  }
  public void openResultsXML(String fileName) {

    String outStr;
    try {

      DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
      Document doc = (Document) dBuilder.parse(fileName);
      doc.getDocumentElement().normalize();

      if (doc.getElementsByTagName("wuid") != null) {
        wuid = doc.getElementsByTagName("wuid").item(0).getTextContent();
      }
      if (doc.getElementsByTagName("jobname") != null) {
        jobname = doc.getElementsByTagName("jobname").item(0).getTextContent();
      }
      if (doc.getElementsByTagName("serverAddress") != null) {
        serverAddress = doc.getElementsByTagName("serverAddress").item(0).getTextContent();
      }
      // WUID
      // System.out.println(wuid);
      // lets create a tab for the wuid
      CTabItem wuidTab = new CTabItem(folder, SWT.NONE);
      wuidTab.setText(jobname + " " + wuid);

      folder.setSelection(folder.indexOf(wuidTab));
      System.out.println("BUILDTAB--------" + folder.indexOf(wuidTab));
      Composite tabHolder = new Composite(folder, SWT.NONE);
      tabHolder.setLayout(new GridLayout());
      tabHolder.setLayoutData(new GridData(GridData.FILL_BOTH));
      final String thisWuid = wuid;
      final String thisServerAddress = serverAddress;
      // add link here
      // Label link = new Label();
      Link link = new Link(tabHolder, SWT.NONE);
      link.setText("<a>View Workunit in the Default Web Browser</a>");
      link.addListener(
          SWT.Selection,
          new Listener() {
            public void handleEvent(Event event) {
              openUrl(thisServerAddress + "/WsWorkunits/WUInfo?Wuid=" + thisWuid);
            }
          });

      CTabFolder subfolder = new CTabFolder(tabHolder, SWT.CLOSE);
      subfolder.setSimple(false);
      subfolder.setBorderVisible(true);
      subfolder.setLayoutData(new GridData(GridData.FILL_BOTH));

      NodeList results = doc.getElementsByTagName("result");

      for (int temp = 0; temp < results.getLength(); temp++) {
        Node result = results.item(temp);
        NamedNodeMap att = result.getAttributes();
        // type
        String resType = att.getNamedItem("resulttype").getTextContent();
        // System.out.println("resType: |" + resType + "|");
        // filename
        String filePath = result.getTextContent();
        // System.out.println(filePath);

        // CTabItem resultTab = new CTabItem(subfolder, SWT.NONE);
        // resultTab.setText(resType);
        // so here we use type and decide what tab to open and pass filename
        // buildTab(filePath,resType,subfolder);
        if (resType != null && filePath != null) {
          if (resType.equalsIgnoreCase("ClusterCounts")) {
            buildClusterCountsTab(filePath, resType, subfolder);
          } else if (resType.equalsIgnoreCase("SrcProfiles")) {
            buildSrcProfilesTab(filePath, resType, subfolder);
          } else if (resType.equalsIgnoreCase("Hygiene_ValidityErrors")) {
            buildHygieneValidityErrorsTab(filePath, resType, subfolder);
          } else if (resType.equalsIgnoreCase("ClusterSrc")) {
            buildClusterSrcTab(filePath, resType, subfolder);
          } else if (resType.equalsIgnoreCase("SrcOutliers")) {
            buildSrcOutliersTab(filePath, resType, subfolder);
          } else if (resType.equalsIgnoreCase("Dataprofiling_AllProfiles")) {
            buildProfileTab(filePath, resType, subfolder);
          } else if (resType.equalsIgnoreCase("Dataprofiling_SummaryReport")) {
            buildSummaryTab(filePath, resType, subfolder);
          } else if (resType.equalsIgnoreCase("Dataprofiling_OptimizedLayout")) {
            buildOptimizedLayoutTab(filePath, resType, subfolder);
          } else { // CleanedData
            buildTab(filePath, resType, subfolder);
          }
        }
      }
      wuidTab.setControl(tabHolder);
    } catch (Exception e) { // Catch exception if any
      System.err.println("Error: " + e.getMessage());
      e.printStackTrace();
    }
  }