/**
   * 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);
  }
  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);
          }
        });
  }
  /*
   * (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;
  }
  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);
  }
  /**
   * 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;
  }
Ejemplo n.º 6
0
  public void createPartControl(Composite parent) {
    Composite top = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    top.setLayout(layout);
    // top banner
    Composite banner = new Composite(top, SWT.NONE);
    banner.setLayoutData(
        new GridData(
            GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false));
    layout = new GridLayout();
    layout.marginHeight = 5;
    layout.marginWidth = 10;
    layout.numColumns = 2;
    banner.setLayout(layout);

    // setup bold font
    Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);

    Label l = new Label(banner, SWT.WRAP);
    l.setText("Subject:");
    l.setFont(boldFont);
    l = new Label(banner, SWT.WRAP);
    l.setText("This is a message about the cool Eclipse RCP!");

    l = new Label(banner, SWT.WRAP);
    l.setText("From:");
    l.setFont(boldFont);

    final Link link = new Link(banner, SWT.NONE);
    link.setText("<a>[email protected]</a>");
    link.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            MessageDialog.openInformation(
                getSite().getShell(),
                "Not Implemented",
                "Imagine the address book or a new message being created now.");
          }
        });

    l = new Label(banner, SWT.WRAP);
    l.setText("Date:");
    l.setFont(boldFont);
    l = new Label(banner, SWT.WRAP);
    l.setText("10:34 am");
    // message contents
    Text text = new Text(top, SWT.MULTI | SWT.WRAP);
    text.setText(
        "This RCP Application was generated from the PDE Plug-in Project wizard. This sample shows how to:\n"
            + "- add a top-level menu and toolbar with actions\n"
            + "- add keybindings to actions\n"
            + "- create views that can't be closed and\n"
            + "  multiple instances of the same view\n"
            + "- perspectives with placeholders for new views\n"
            + "- use the default about dialog\n"
            + "- create a product definition\n");
    text.setLayoutData(new GridData(GridData.FILL_BOTH));
  }
Ejemplo n.º 7
0
  @Override
  protected org.eclipse.swt.widgets.Control createContents(
      org.eclipse.swt.widgets.Composite parent) {
    org.eclipse.swt.widgets.Composite settingComposite =
        new org.eclipse.swt.widgets.Composite(parent, org.eclipse.swt.SWT.NONE);
    org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
    org.eclipse.swt.layout.GridData gd;
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    gd = new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.BEGINNING);
    settingComposite.setLayout(layout);
    settingComposite.setLayoutData(gd);
    org.eclipse.swt.widgets.Link link =
        new org.eclipse.swt.widgets.Link(settingComposite, org.eclipse.swt.SWT.NONE);
    link.setText(
        "Go to <A href=\"http://www.emftext.org\">www.emftext.org</A> for more information.");
    link.setSize(140, 40);
    link.addSelectionListener(
        new org.eclipse.swt.events.SelectionListener() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            if (e.text.startsWith("http")) org.eclipse.swt.program.Program.launch(e.text);
          }

          public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {}
        });
    return settingComposite;
  }
Ejemplo n.º 8
0
  private void createControl(final Composite parent) {

    Composite comp = new Composite(parent, SWT.NONE);

    GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.BEGINNING).applyTo(comp);
    GridLayoutFactory.fillDefaults()
        .numColumns(isCentered ? 1 : 2)
        .margins(margin.x, margin.y)
        .applyTo(comp);

    updateStatusLabel = new Link(comp, SWT.NO_FOCUS);
    if (backgroundColor != null) {
      comp.setBackground(backgroundColor);
      updateStatusLabel.setBackground(backgroundColor);
    }
    updateStatusLabel.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          @Override
          public void widgetSelected(SelectionEvent e) {
            ExternalBrowserUtil.openInExternalBrowser(UpdateCore.getChangeLogUrl());
          }
        });

    GridDataFactory.fillDefaults()
        .align(isCentered ? SWT.CENTER : SWT.FILL, SWT.CENTER)
        .grab(true, false)
        .applyTo(updateStatusLabel);

    updateStatusButton = new Button(comp, SWT.PUSH);
    updateStatusButton.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    GridDataFactory.fillDefaults()
        .align(SWT.CENTER, SWT.CENTER)
        .indent(0, 3)
        .applyTo(updateStatusButton);

    updateStatusButton.addSelectionListener(
        new SelectionListener() {

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

          @Override
          public void widgetSelected(SelectionEvent e) {
            performAction(e);
          }
        });
  }
 protected void createLink(Composite composite, String linkText) {
   Link link = new Link(composite, SWT.NONE);
   link.setText(linkText);
   link.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(SelectionEvent e) {
           ShowSecurityPreferencesAction action = new ShowSecurityPreferencesAction();
           action.run();
         }
       });
 }
  /*
   * (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;
  }
 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 createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    final TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    _panel = factory.createComposite(parent);
    _panel.setLayout(new GridLayout(3, false));

    _newBPELLink = new Link(_panel, SWT.NONE);
    _newBPELLink.setText("<a>BPEL File:</a>");
    _newBPELLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            openFile();
          }
        });

    _bpelFileText = factory.createText(_panel, "", SWT.READ_ONLY);
    _bpelFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _bpelFileText.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent event) {
            final QName newValue =
                _bpelFileText.getText().length() == 0
                    ? null
                    : QName.valueOf(_bpelFileText.getText());
            if (!_updating
                && ((newValue == null && _implementation.getProcess() != null)
                    || (newValue != null && !newValue.equals(_implementation.getProcess())))) {
              wrapOperation(
                  new Runnable() {
                    public void run() {
                      _implementation.setProcess(newValue);
                    }
                  });
            }
          }
        });

    _browseBPELButton = factory.createButton(_panel, "Browse...", SWT.PUSH);
    _browseBPELButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            handleBrowse();
          }
        });
  }
Ejemplo n.º 13
0
  /**
   * 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());
  }
  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();
          }
        });
  }
Ejemplo n.º 15
0
 /*
  * 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;
 }
  @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);
  }
Ejemplo n.º 17
0
  private void createTextEditorLink(Composite appearanceComposite) {

    // Link to general text editor prefs from Eclipse - they can set tabs/spaces/whitespace drawing,
    // etc
    Link link = new Link(appearanceComposite, SWT.NONE);
    link.setText(Messages.EditorsPreferencePage_GeneralTextEditorPrefLink);
    link.addSelectionListener(
        new SelectionAdapter() {

          public void widgetSelected(SelectionEvent e) {
            ((IWorkbenchPreferenceContainer) getContainer())
                .openPage(GENERAL_TEXT_EDITOR_PREF_ID, null);
          }
        });
  }
  private Link createLink(Composite composite, String text) {
    Link link = new Link(composite, SWT.NONE);
    link.setFont(composite.getFont());
    link.setText("<A>" + text + "</A>"); // $NON-NLS-1$//$NON-NLS-2$
    link.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            openLink();
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            openLink();
          }
        });
    return link;
  }
  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);
         }
       });
 }
Ejemplo n.º 21
0
  @Override
  protected Control createCustomArea(final Composite parent) {
    final Link link = new Link(parent, SWT.NONE);
    GridDataFactory.fillDefaults().indent(0, 20).applyTo(link);
    link.setText(
        "Go to preferences page: <a href=\"" + preferenceId + "\">'" + preferenceName + "'</a>");
    link.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(final SelectionEvent e) {
            PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, null).open();
            close();
          }
        });
    return link;
  }
 private void addCharacterEncodingLabel(Composite composite) {
   final Link link = new Link(composite, SWT.NONE);
   try {
     link.setText(
         "Default source file encoding:  "
             + getSelectedProject().getDefaultCharset()
             + " <a>(Change...)</a>");
     link.addSelectionListener(
         new SelectionAdapter() {
           @Override
           public void widgetSelected(SelectionEvent e) {
             IWorkbenchPreferenceContainer container =
                 (IWorkbenchPreferenceContainer) getContainer();
             container.openPage("org.eclipse.ui.propertypages.info.file", null);
           }
         });
     getWorkspace()
         .addResourceChangeListener(
             encodingListener =
                 new IResourceChangeListener() {
                   @Override
                   public void resourceChanged(IResourceChangeEvent event) {
                     if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
                       Display.getDefault()
                           .asyncExec(
                               new Runnable() {
                                 public void run() {
                                   try {
                                     if (!link.isDisposed()) {
                                       link.setText(
                                           "Default source file encoding:   "
                                               + getSelectedProject().getDefaultCharset()
                                               + " <a>(Change...)</a>");
                                     }
                                   } catch (CoreException e) {
                                     e.printStackTrace();
                                   }
                                 }
                               });
                     }
                   }
                 });
   } catch (CoreException e) {
     e.printStackTrace();
   }
 }
  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;
  }
Ejemplo n.º 24
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;
  }
  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;
  }
  /**
   * 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);
  }
Ejemplo n.º 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();
    }
    public void createControl(Composite parent) {

      Composite control = new Composite(parent, SWT.NONE);
      GridLayoutFactory.swtDefaults().applyTo(control);

      Link link = new Link(control, SWT.NONE);
      link.setText(
          "Review requests may be created for specific SCM plugins.\n\nPlease visit the <a>SCM integrations wiki</a> for more details.");
      link.addSelectionListener(
          new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {

              WorkbenchUtil.openUrl(
                  "https://github.com/rombert/ereviewboard/wiki/SCM-Integrations",
                  IWorkbenchBrowserSupport.AS_EXTERNAL);
            }

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

      setControl(control);
    }
Ejemplo n.º 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;
  }