/**
   * Create page links "Previous 1 2 ...10 Next" with SWT Link.
   *
   * @param parent
   */
  private void createRightContainer(Composite parent) {
    Composite right = createComposite(parent, SWT.NONE);
    right.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    GridLayout layout = new GridLayout(3, false);
    layout.marginHeight = 0;
    right.setLayout(layout);

    // Previous link
    previousLink = createHyperlink(right, SWT.NONE);
    setLinkText(
        previousLink, Resources.getText(Resources.PaginationRenderer_previous, getLocale()));
    previousLink.setLayoutData(new GridData(SWT.RIGHT));
    previousLink.addSelectionListener(this);

    // Page links
    pageLinks = createHyperlink(right, SWT.NONE);
    pageLinks.setForeground(getColor());
    pageLinks.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    pageLinks.addSelectionListener(this);

    // Next link
    nextLink = createHyperlink(right, SWT.NONE);
    setLinkText(nextLink, Resources.getText(Resources.PaginationRenderer_next, getLocale()));
    nextLink.setLayoutData(new GridData(SWT.LEFT));
    nextLink.addSelectionListener(this);
  }
  protected void createLinksPanel(Composite composite) {
    final DriverDescriptor driver = getWizard().getDriver();

    // UIUtils.createPlaceholder(composite, 1).setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite linksGroup = UIUtils.createPlaceholder(composite, 2);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.verticalIndent = 10;
    linksGroup.setLayoutData(gd);

    // Vendor site
    if (!CommonUtils.isEmpty(driver.getWebURL())) {
      Link link =
          UIUtils.createLink(
              linksGroup,
              "<a>Vendor's website</a>",
              new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                  RuntimeUtils.openWebBrowser(driver.getWebURL());
                }
              });
      link.setToolTipText(driver.getWebURL());
      link.setLayoutData(
          new GridData(
              GridData.FILL_HORIZONTAL
                  | GridData.VERTICAL_ALIGN_BEGINNING
                  | GridData.HORIZONTAL_ALIGN_BEGINNING));
    } else {
      UIUtils.createPlaceholder(linksGroup, 1)
          .setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    }

    Link link =
        UIUtils.createLink(
            linksGroup,
            "<a>Download configuration</a>",
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                UIUtils.showPreferencesFor(null, null, PrefPageDrivers.PAGE_ID);
              }
            });
    link.setLayoutData(
        new GridData(
            GridData.FILL_HORIZONTAL
                | GridData.VERTICAL_ALIGN_BEGINNING
                | GridData.HORIZONTAL_ALIGN_END));
  }
Example #3
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;
  }
  private void createHeader(Composite contents) {
    final Shell shell = contents.getShell();
    String text = PreferencesMessages.JavaEditorPreferencePage_link;
    Link link = new Link(contents, SWT.NONE);
    link.setText(text);
    link.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if ("org.eclipse.ui.preferencePages.GeneralTextEditor".equals(e.text)) // $NON-NLS-1$
            PreferencesUtil.createPreferenceDialogOn(shell, e.text, null, null);
            else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) // $NON-NLS-1$
            PreferencesUtil.createPreferenceDialogOn(
                  shell,
                  e.text,
                  null,
                  "selectFont:org.eclipse.jdt.ui.editors.textfont"); //$NON-NLS-1$
          }
        });

    GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    gridData.widthHint = 150; // only expand further if anyone else requires it
    link.setLayoutData(gridData);

    addFiller(contents);
  }
  private void createWarning(Composite container) {
    warningImg = new Label(container, SWT.CENTER);
    warningLink = new Link(container, SWT.NONE);
    warningLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(warningImg);
    warningImg.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    warningLink.setText(
        "Some selected dependencies can not be resolved. Click <a>here</a> to configure repositories in your settings.xml.");
    warningLink.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            openSettingsRepositoriesWizard();
          }

          private void openSettingsRepositoriesWizard() {
            ConfigureMavenRepositoriesWizard wizard = new ConfigureMavenRepositoriesWizard();
            WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            dialog.create();
            dialog.open();
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }
        });
  }
  /*
   * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createButtonBar(Composite parent) {
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    Composite buttonBar = new Composite(parent, SWT.NONE);
    buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    buttonBar.setLayout(layout);

    /* Status Label */
    fStatusLabel = new Link(buttonBar, SWT.NONE);
    applyDialogFont(fStatusLabel);
    fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    if (StringUtils.isSet(fBookmark.getName())) fStatusLabel.setText(fBookmark.getName());

    /* Close */
    Button closeButton =
        createButton(buttonBar, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false);
    closeButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            close();
          }
        });

    return buttonBar;
  }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    checkNetworkStatus();
    GridData layoutData = new GridData(GridData.FILL_BOTH);
    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);
    composite.setLayoutData(layoutData);
    tableViewerCreator = new TableViewerCreator<ModuleToInstall>(composite);
    tableViewerCreator.setCheckboxInFirstColumn(false);
    tableViewerCreator.setColumnsResizableByDefault(true);
    tableViewerCreator.setLinesVisible(true);
    tableViewerCreator.setLayoutMode(LAYOUT_MODE.CONTINUOUS);

    tableViewerCreator.createTable();

    createJarNameColumn();
    createModuleNameColumn();
    createContextColumn();
    createRequiredColumn();
    createLicenseColumn();

    urlcolumn = createMoreInformationColumn();

    installcolumn = createActionColumn();

    tableViewerCreator.init(inputList);
    addInstallButtons();
    layoutData = new GridData(GridData.FILL_BOTH);
    tableViewerCreator.getTable().setLayoutData(layoutData);
    tableViewerCreator.getTable().pack();

    Composite footComposite = new Composite(composite, SWT.NONE);
    layoutData = new GridData(GridData.FILL_HORIZONTAL);
    footComposite.setLayoutData(layoutData);
    layout = new GridLayout();
    layout.numColumns = 2;
    footComposite.setLayout(layout);

    final Link moreInfor = new Link(footComposite, SWT.NONE);
    layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.widthHint = 200;
    moreInfor.setText(Messages.getString("ExternalModulesInstallDialog_MoreInfor")); // $NON-NLS-1$
    moreInfor.setLayoutData(layoutData);
    moreInfor.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            //
            // Program.launch(Messages.getString("download.external.dialog.help.url"));
            // //$NON-NLS-1$
            openURL(Messages.getString("download.external.dialog.help.url")); // $NON-NLS-1$
          }
        });
    setupColumnSortListener();
    createFooter(composite);
    setTitle(title);
    return composite;
  }
  /**
   * Creates the control.
   *
   * @param parent The parent composite
   * @return The created control
   */
  public Control createControl(Composite parent) {
    _group = new Group(parent, SWT.NONE);
    _group.setFont(parent.getFont());
    _group.setLayout(_wizardPage.initGridLayout(new GridLayout(2, false), true));
    _group.setText(Messages.NewBlackBerryProjectWizardPageOne_JREGroup_title);

    _useProjectRE.doFillIntoGrid(_group, 1);
    Combo comboControl = _RECombo.getComboControl(_group);
    comboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

    Control[] controls = _useDefaultRE.doFillIntoGrid(_group, 1);
    // Fixed IDT 233814, make sure there is enough room to display the label if user change
    // default JRE from java to BB
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.minimumWidth = 260;
    controls[0].setLayoutData(gd);
    _preferenceLink = new Link(_group, SWT.NONE);
    _preferenceLink.setFont(_group.getFont());
    _preferenceLink.setText(Messages.NewBlackBerryProjectWizardPageOne_JREGroup_link_description);
    _preferenceLink.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
    _preferenceLink.addSelectionListener(this);

    setDefaultButtonState();

    return _group;
  }
Example #9
0
    @Override
    protected Control createDialogArea(final Composite parent) {
      final Composite composite = (Composite) super.createDialogArea(parent);

      final Link url1 = new Link(composite, SWT.BORDER);
      url1.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));

      url1.setText(message);

      return composite;
    }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
   */
  protected Control createContents(Composite parent) {
    Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0);
    link = new Link(comp, SWT.NONE);
    link.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
    link.setFont(comp.getFont());
    link.setText(PDEUIMessages.CompilersPreferencePage_configure_project_specific_settings);
    link.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            HashSet set = new HashSet();
            try {
              IJavaProject[] projects =
                  JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
              IProject project = null;
              for (int i = 0; i < projects.length; i++) {
                project = projects[i].getProject();
                try {
                  if (project.hasNature(PDE.PLUGIN_NATURE)
                      && fBlock.hasProjectSpecificSettings(project)) {
                    set.add(projects[i]);
                  }
                } catch (CoreException ce) {
                  // do nothing ignore the project
                }
              }
            } catch (JavaModelException jme) {
              // ignore
            }
            ProjectSelectionDialog psd = new ProjectSelectionDialog(getShell(), set);
            if (psd.open() == IDialogConstants.OK_ID) {
              HashMap data = new HashMap();
              data.put(NO_LINK, Boolean.TRUE);
              PreferencesUtil.createPropertyDialogOn(
                      getShell(),
                      ((IJavaProject) psd.getFirstResult()).getProject(),
                      "org.eclipse.pde.internal.ui.properties.compilersPropertyPage", //$NON-NLS-1$
                      new String[] {"org.eclipse.pde.internal.ui.properties.compilersPropertyPage"},
                      data)
                  .open(); //$NON-NLS-1$
            }
          }
        });
    fBlock =
        new PDECompilersConfigurationBlock(null, (IWorkbenchPreferenceContainer) getContainer());
    fBlock.createControl(comp);

    // Initialize with data map in case applyData was called before createContents
    applyData(fPageData);

    return comp;
  }
  /**
   * Creates the Quartz controls.
   *
   * @param parent the parent
   * @param editorStyle true to use the editor style, false for wizards
   */
  public void createControls(final Composite parent, boolean editorStyle) {

    Label l =
        SwtFactory.createLabel(
            parent, Messages.cronExpression, "A CRON expression to schedule service invocations");
    if (editorStyle) l.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));

    this.cronText = SwtFactory.createSimpleTextField(parent, true);

    Link cronLink = new Link(parent, SWT.NONE);
    cronLink.setText("<A>" + Messages.cronHelp + "</A>");
    cronLink.setLayoutData(new GridData(SWT.RIGHT, SWT.DEFAULT, true, false, 2, 1));
    cronLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            try {
              final IWebBrowser browser =
                  PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser();
              browser.openURL(
                  new URL(
                      "http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger"));

            } catch (Exception ex) {
              PetalsQuartzPlugin.log(ex, IStatus.ERROR);
              new ErrorDialog(
                      parent.getShell(),
                      Messages.couldNotOpenEditorTitle,
                      Messages.couldNotOpenEditorMessage,
                      new Status(IStatus.ERROR, PetalsQuartzPlugin.PLUGIN_ID, ex.getMessage()),
                      0)
                  .open();
            }
          }
        });

    // The message skeleton
    l =
        SwtFactory.createLabel(
            parent, Messages.content, "A XML message to send to the target service");
    GridDataFactory.swtDefaults().indent(0, 5).span(2, 1).applyTo(l);
    if (editorStyle) l.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));

    this.msgText = SwtFactory.createXmlTextViewer(parent);
    GridDataFactory.swtDefaults()
        .align(SWT.FILL, SWT.FILL)
        .grab(true, true)
        .span(2, 1)
        .applyTo(this.msgText.getParent());
  }
 /*
  * Creates a help link. This is used when there is no help image
  * available.
  */
 private Link createLocalizationLink(Composite parent) {
   Link link = new Link(parent, SWT.WRAP | SWT.NO_FOCUS);
   ((GridLayout) parent.getLayout()).numColumns++;
   link.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false));
   link.setText("<a>" + IDialogConstants.HELP_LABEL + "</a>"); // $NON-NLS-1$ //$NON-NLS-2$
   link.setToolTipText(IDialogConstants.HELP_LABEL);
   link.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(SelectionEvent e) {
           localizationPressed();
         }
       });
   return link;
 }
  private void createSwitchEditorControl(final TabbedPropertySheetWidgetFactory widgetFactory) {
    ((GridLayout) control.getLayout()).numColumns++;
    final Link switchControl = new Link(mc, SWT.NONE);
    switchControl.setLayoutData(GridDataFactory.fillDefaults().indent(15, 0).create());
    switchControl.setText(Messages.switchEditorCondition);
    switchControl.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(final SelectionEvent e) {
            switchEditorType();
          }
        });
  }
 private static void createLinkToGlobal(final Composite ancestor, Composite parent) {
   Link fLink = new Link(parent, SWT.NONE);
   fLink.setText("<A>Configure Workspace Settings...</A>");
   fLink.setLayoutData(new GridData());
   SelectionAdapter sl =
       new SelectionAdapter() {
         @Override
         public void widgetSelected(SelectionEvent e) {
           PreferencesUtil.createPreferenceDialogOn(ancestor.getShell(), PREFERENCE_ID, null, null)
               .open();
         }
       };
   fLink.addSelectionListener(sl);
 }
  @Override
  public void createControl(Composite parent) {

    setTitle("Identify Maven dependencies");

    initImages();

    Composite container = new Composite(parent, SWT.NONE);
    container.setEnabled(true);
    setControl(container);

    GridLayout layout = new GridLayout(3, false);
    layout.marginLeft = 12;
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    setMessage(MESSAGE);

    createWarning(container);

    displayDependenciesTable(container);

    Link remoteRepoPrefsLink = new Link(container, SWT.NONE);
    remoteRepoPrefsLink.setText("Manage <a>remote repositories</a> used to identify dependencies.");
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
    remoteRepoPrefsLink.setLayoutData(gd);
    remoteRepoPrefsLink.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            openRemoteRepoPrefs();
          }

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

    deleteJars = dialogSettings.getBoolean("isDeleteJars");
    deleteJarsBtn =
        addCheckButton(container, "Delete original references from project", deleteJars);
    deleteJarsBtn.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            deleteJars = deleteJarsBtn.getSelection();
          }
        });

    runIdentificationJobs(null);
  }
Example #16
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();
  }
Example #17
0
    @Override
    public void createControl(Composite parent) {
      Color background = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);

      Composite composite = new Composite(parent, SWT.NONE);
      composite.setLayout(new GridLayout(1, false));

      composite.setBackground(background);

      Link link = new Link(composite, SWT.NONE);
      link.setText(SearchMessages.SearchView_empty_search_label);
      link.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
      link.setBackground(background);

      fControl = composite;
    }
  private Link createHelpLink(Composite parent) {
    Link link = new Link(parent, SWT.WRAP | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    link.setText("<a>" + IDialogConstants.HELP_LABEL + "</a>"); // $NON-NLS-1$ //$NON-NLS-2$
    link.setToolTipText(IDialogConstants.HELP_LABEL);
    link.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            helpPressed();
          }
        });
    return link;
  }
 private void addLink(Composite composite, String text, int indent) {
   GridData gd;
   final Link link = new Link(composite, SWT.NONE);
   link.setText(text);
   gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
   gd.widthHint = 300; // don't get wider initially
   gd.horizontalSpan = 2;
   gd.horizontalIndent = indent;
   link.setLayoutData(gd);
   link.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(SelectionEvent e) {
           PreferencesUtil.createPreferenceDialogOn(link.getShell(), e.text, null, null);
         }
       });
 }
Example #20
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*/
           }
         }
       });
 }
Example #21
0
  @Override
  protected Control createHelpControl(Composite parent) {
    toolkit.adapt(parent, false, false);
    Link link = new Link(parent, SWT.WRAP | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    link.setText(UIText.CommitDialog_OpenStagingViewLink);
    link.setToolTipText(UIText.CommitDialog_OpenStagingViewToolTip);
    link.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            openStagingViewLinkClicked();
          }
        });

    toolkit.adapt(link, false, false);
    return link;
  }
  Text createPackageField(Composite composite, final Text folder) {

    final Text pkg = createPackageField(composite);

    new Label(composite, SWT.NONE);

    Link link = new Link(composite, SWT.NONE);
    link.setText("<a>Create new Ceylon package with descriptor...</a>");
    GridData kgd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    kgd.horizontalSpan = 3;
    kgd.grabExcessHorizontalSpace = true;
    link.setLayoutData(kgd);
    link.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            NewPackageWizard wiz = openPackageWizard();
            IPackageFragment pfr = wiz.getPackageFragment();
            if (pfr != null) {
              sourceDir = wiz.getSourceFolder();
              String folderName = sourceDir.getPath().toPortableString();
              folder.setText(folderName);
              pkg.setText(pfr.getElementName());
              packageFragment = pfr;
              setPageComplete(isComplete());
            }
            if (!packageNameIsLegal()) {
              setErrorMessage(getIllegalPackageNameMessage());
            } else if (sourceDir == null) {
              setErrorMessage(getSelectSourceFolderMessage());
            } else if (!unitNameIsLegal()) {
              setErrorMessage(getIllegalUnitNameMessage());
            } else {
              setErrorMessage(null);
            }
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    return pkg;
  }
  private Control createLinkControl(Composite composite) {
    Link link = new Link(composite, SWT.WRAP | SWT.RIGHT);
    link.setText(DialogsMessages.SortMembersMessageDialog_description);
    link.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            openMembersSortOrderPage();
          }
        });
    link.setToolTipText(DialogsMessages.SortMembersMessageDialog_link_tooltip);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gridData.widthHint =
        convertHorizontalDLUsToPixels(
            IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); // convertWidthInCharsToPixels(60);
    link.setLayoutData(gridData);
    link.setFont(composite.getFont());

    return link;
  }
Example #24
0
  @Override
  public void updateLabel() {
    ISearchResultPage page = getActivePage();
    String label = ""; // $NON-NLS-1$
    if (page != null) {
      label = LegacyActionTools.escapeMnemonics(page.getLabel());
    }
    if (!fPageContent.isDisposed()) {
      if (label.length() == 0) {
        if (fDescriptionComposite != null) {
          fDescriptionComposite.dispose();
          fDescriptionComposite = null;
          fPageContent.layout();
        }
      } else {
        if (fDescriptionComposite == null) {
          fDescriptionComposite = new Composite(fPageContent, SWT.NONE);
          fDescriptionComposite.moveAbove(null);

          GridLayout layout = new GridLayout();
          layout.marginHeight = 0;
          layout.marginWidth = 0;
          layout.verticalSpacing = 0;
          fDescriptionComposite.setLayout(layout);
          fDescriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

          fDescription = new Link(fDescriptionComposite, SWT.NONE);
          GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
          gridData.horizontalIndent = 5;
          fDescription.setLayoutData(gridData);
          fDescription.setText(label);

          Label separator = new Label(fDescriptionComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
          separator.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
          fPageContent.layout();
        } else {
          fDescription.setText(label);
        }
      }
    }
  }
 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();
           }
         }
       });
 }
  /**
   * Create Network group
   *
   * @param parent parent composite
   */
  @SuppressWarnings("unchecked")
  private void createNetworkGroup(Composite parent) {

    // Makes the network preferences dialog manager
    PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();

    IPreferenceNode networkNode = null;

    for (IPreferenceNode node :
        (List<IPreferenceNode>) manager.getElements(PreferenceManager.PRE_ORDER)) {
      if (node.getId().equals(PROXY_PREFERENCE_PAGE_ID)) {
        networkNode = node;
        break;
      }
    }
    prefMan = new PreferenceManager();
    if (networkNode != null) {
      prefMan.addToRoot(networkNode);
    }

    Link downloadText = new Link(parent, SWT.WRAP);
    downloadText.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            // Do nothing
          }

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

    String linkText =
        Messages.bind(Messages.NetworkLinkText, Messages.NetworkLinkText, Messages.NetworkLinkLink);

    downloadText.setText(linkText);
    downloadText.update();
    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    downloadText.setLayoutData(gridData);
  }
Example #27
0
    public LayoutGroup(Composite composite) {
      final int numColumns = 3;

      fStdRadio = new SelectionButtonDialogField(SWT.RADIO);
      fStdRadio.setLabelText(PHPUIMessages.LayoutGroup_OptionBlock_ProjectSrc); // $NON-NLS-1$
      fStdRadio.setDialogFieldListener(this);

      fSrcBinRadio = new SelectionButtonDialogField(SWT.RADIO);
      fSrcBinRadio.setLabelText(PHPUIMessages.LayoutGroup_OptionBlock_SrcResources); // $NON-NLS-1$
      fSrcBinRadio.setDialogFieldListener(this);

      // getting Preferences default choice
      boolean useSrcBin =
          PreferenceConstants.getPreferenceStore()
              .getBoolean(PreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ);

      fSrcBinRadio.setSelection(useSrcBin);
      fStdRadio.setSelection(!useSrcBin);

      // createContent
      fGroup = new Group(composite, SWT.NONE);
      fGroup.setFont(composite.getFont());
      fGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      fGroup.setLayout(initGridLayout(new GridLayout(numColumns, false), true));
      fGroup.setText(PHPUIMessages.LayoutGroup_OptionBlock_Title); // $NON-NLS-1$

      fStdRadio.doFillIntoGrid(fGroup, 3);
      LayoutUtil.setHorizontalGrabbing(fStdRadio.getSelectionButton(null));

      fSrcBinRadio.doFillIntoGrid(fGroup, 2);

      fPreferenceLink = new Link(fGroup, SWT.NONE);
      fPreferenceLink.setText(PHPUIMessages.ToggleLinkingAction_link_description); // $NON-NLS-1$
      fPreferenceLink.setLayoutData(new GridData(SWT.END, SWT.BEGINNING, true, false));
      fPreferenceLink.addSelectionListener(this);
      fPreferenceLink.setEnabled(true);

      updateEnableState();
    }
  /**
   * 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;
  }
Example #29
0
  private void initResourceLabel(
      final Composite parent, final Action loadAction, final Action toggleAction) {
    resourceLabel = new Link(parent, SWT.WRAP);
    resourceLabel.setText(GRAPH_NONE);
    resourceLabel.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            processEvent(loadAction, toggleAction, GRAPH_NONE, e);
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            processEvent(loadAction, toggleAction, GRAPH_NONE, e);
          }

          private void processEvent(
              final Action loadFileAction,
              final Action toggleAction,
              final String label,
              SelectionEvent e) {
            /*
             * As we use a single string for the links for localization, we
             * don't compare specific strings but say the first link
             * triggers the loadAction, else the toggleAction:
             */
            if (label.replaceAll("<a>", "").startsWith(e.text)) { // $NON-NLS-1$ //$NON-NLS-2$
              loadFileAction.run();
            } else {
              // toggle as if the button was pressed, then run the action:
              toggleAction.setChecked(!toggleAction.isChecked());
              toggleAction.run();
            }
          }
        });
    resourceLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  }
  @Override
  protected Control createContents(Composite parent) {

    Link textEditorsLink = new Link(parent, 0);
    textEditorsLink.setLayoutData(
        GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 0).create());
    textEditorsLink.setText("See '<a>Text Editors</a>' for general editor preferences.");
    textEditorsLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            createPreferenceDialogOn(
                getShell(), "org.eclipse.ui.preferencePages.GeneralTextEditor", null, null);
          }
        });

    Link colorsAndFontsLink = new Link(parent, 0);
    colorsAndFontsLink.setLayoutData(
        GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 0).create());
    colorsAndFontsLink.setText(
        "See '<a>Colors and Fonts</a>' to customize appearance and syntax highlighting.");
    colorsAndFontsLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            createPreferenceDialogOn(
                getShell(),
                CeylonPlugin.COLORS_AND_FONTS_PAGE_ID,
                null,
                "selectFont:" + CeylonPlugin.EDITOR_FONT_PREFERENCE);
          }
        });

    Link annotationsLink = new Link(parent, 0);
    annotationsLink.setLayoutData(
        GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 0).create());
    annotationsLink.setText("See '<a>Annotations</a>' to customize annotation appearance.");
    annotationsLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            createPreferenceDialogOn(
                getShell(), "org.eclipse.ui.editors.preferencePages.Annotations", null, null);
          }
        });

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    composite.setLayout(new GridLayout(1, true));

    Control contents = super.createContents(composite);

    Link completionLink = new Link(parent, 0);
    completionLink.setLayoutData(
        GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 0).create());
    completionLink.setText("See '<a>Completion</a>' for preferences related to completion.");
    completionLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            createPreferenceDialogOn(getShell(), CeylonCompletionPreferencePage.ID, null, null);
          }
        });

    Link refactoringLink = new Link(parent, 0);
    refactoringLink.setLayoutData(
        GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 0).create());
    refactoringLink.setText("See '<a>Refactoring</a>' for preferences related to refactoring.");
    refactoringLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            createPreferenceDialogOn(getShell(), CeylonRefactoringPreferencePage.ID, null, null);
          }
        });

    Link saveLink = new Link(parent, 0);
    saveLink.setLayoutData(
        GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 0).create());
    saveLink.setText("See '<a>Save Actions</a>' to enable save actions.");
    saveLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            createPreferenceDialogOn(getShell(), CeylonSaveActionsPreferencePage.ID, null, null);
          }
        });

    return contents;
  }