Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Text


      if (entity instanceof IBookMark) {
        Label feedLabel = new Label(container, SWT.None);
        feedLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
        feedLabel.setText(Messages.GeneralPropertyPage_LINK);

        fFeedInput = new Text(container, SWT.BORDER);
        fFeedInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        fFeedInput.setText(((IBookMark) entity).getFeedLinkReference().getLinkAsText());
        ((GridData) fFeedInput.getLayoutData()).widthHint = fSite.getHorizontalPixels(IDialogConstants.ENTRY_FIELD_WIDTH);

        /* Name */
        Label nameLabel = new Label(container, SWT.None);
        nameLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
        nameLabel.setText(Messages.GeneralPropertyPage_NAME);

        Composite nameContainer = new Composite(container, Application.IS_MAC ? SWT.NONE : SWT.BORDER);
        nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
        if (!Application.IS_MAC)
          nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

        fNameInput = new Text(nameContainer, Application.IS_MAC ? SWT.BORDER : SWT.NONE);
        OwlUI.makeAccessible(fNameInput, nameLabel);
        fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
        fNameInput.setText(getName(entity));

        ToolBar grabTitleBar = new ToolBar(nameContainer, SWT.FLAT);
        OwlUI.makeAccessible(grabTitleBar, Messages.GeneralPropertyPage_LOAD_NAME);
        if (!Application.IS_MAC)
          grabTitleBar.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

        ToolItem grabTitleItem = new ToolItem(grabTitleBar, SWT.PUSH);
        grabTitleItem.setImage(OwlUI.getImage(fSite.getResourceManager(), "icons/etool16/info.gif")); //$NON-NLS-1$
        grabTitleItem.setToolTipText(Messages.GeneralPropertyPage_LOAD_NAME);
        grabTitleItem.addSelectionListener(new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            onGrabTitle();
          }
        });
      }

      /* Other */
      else {

        /* Name */
        Label nameLabel = new Label(container, SWT.None);
        nameLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
        nameLabel.setText(Messages.GeneralPropertyPage_NAME);

        fNameInput = new Text(container, SWT.BORDER);
        OwlUI.makeAccessible(fNameInput, nameLabel);
        fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        fNameInput.setText(getName(entity));
      }
    }
View Full Code Here


    textIndent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    textIndent.setLayout(new GridLayout(1, false));
    ((GridLayout) textIndent.getLayout()).marginLeft = 10;
    ((GridLayout) textIndent.getLayout()).marginBottom = 10;

    fFeedLinkInput = new Text(textIndent, SWT.BORDER);
    OwlUI.makeAccessible(fFeedLinkInput, fFeedByLinkButton);
    fFeedLinkInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    GC gc = new GC(fFeedLinkInput);
    gc.setFont(JFaceResources.getDialogFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    int entryFieldWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.ENTRY_FIELD_WIDTH);
    gc.dispose();

    ((GridData) fFeedLinkInput.getLayoutData()).widthHint = entryFieldWidth; //Required to avoid large spanning dialog for long Links
    fFeedLinkInput.setFocus();

    if (StringUtils.isSet(fInitialLink) && !fInitialLink.equals(URIUtils.HTTP)) {
      fFeedLinkInput.setText(fInitialLink);
      fFeedLinkInput.selectAll();
      onLinkChange();
    } else {
      fFeedLinkInput.setText(URIUtils.HTTP);
      fFeedLinkInput.setSelection(URIUtils.HTTP.length());
    }

    fFeedLinkInput.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        getContainer().updateButtons();
        onLinkChange();
      }
    });

    fLoadTitleFromFeedButton = new Button(textIndent, SWT.CHECK);
    fLoadTitleFromFeedButton.setText(Messages.FeedDefinitionPage_USE_TITLE_OF_FEED);
    fLoadTitleFromFeedButton.setSelection(loadTitleFromFeed);
    fLoadTitleFromFeedButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        getContainer().updateButtons();
      }
    });

    /* 2) Feed by Keyword */
    fFeedByKeywordButton = new Button(container, SWT.RADIO);
    fFeedByKeywordButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fFeedByKeywordButton.setText(Messages.FeedDefinitionPage_CREATE_KEYWORD_FEED);
    fFeedByKeywordButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        fKeywordInput.setEnabled(fFeedByKeywordButton.getSelection());

        if (fKeywordInput.isEnabled())
          hookKeywordAutocomplete();

        fKeywordInput.setFocus();
        getContainer().updateButtons();
      }
    });

    textIndent = new Composite(container, SWT.NONE);
    textIndent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    textIndent.setLayout(new GridLayout(1, false));
    ((GridLayout) textIndent.getLayout()).marginLeft = 10;

    fKeywordInput = new Text(textIndent, SWT.BORDER);
    OwlUI.makeAccessible(fKeywordInput, fFeedByKeywordButton);
    fKeywordInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fKeywordInput.setEnabled(false);
    fKeywordInput.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
View Full Code Here

      Composite nameContainer = new Composite(control, SWT.BORDER);
      nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
      nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
      nameContainer.setBackground(control.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

      fNameInput = new Text(nameContainer, SWT.SINGLE);
      OwlUI.makeAccessible(fNameInput, nameLabel);
      fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
      fNameInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          setErrorMessage(null);
View Full Code Here

  GridData indexGd = new GridData(); indexGd.grabExcessHorizontalSpace = false; indexGd.horizontalAlignment = GridData.FILL;
  CLabel indexLabel = new CLabel(composite, SWT.LEFT); indexLabel.setText("Lucene index dir.: ");
  indexLabel.setBackground( labelColors, new int[] {100} );
  indexLabel.setLayoutData(indexGd);

  final Text indexText = new Text(composite, SWT.SINGLE | SWT.BORDER);
  indexText.setText( ( (CrawlConfigWizard) getWizard() ).crawlConfig.getIndexDir() );
  if (indexText.getText().length() == 0)
   indexText.setText(Constants.MUSTRU_HOME + Constants.fs + "data" + Constants.fs + "index");
  GridData indexTextGd = new GridData(); indexTextGd.horizontalAlignment = GridData.BEGINNING;
  indexTextGd.minimumWidth = 350; indexTextGd.grabExcessHorizontalSpace = true;
  indexText.setEditable(false);
  indexText.setLayoutData(indexTextGd);

  Button indexButton = new Button(composite, SWT.PUSH); indexButton.setText("Browse");
  GridData indexButtonGd = new GridData(); indexButtonGd.horizontalAlignment = GridData.BEGINNING;
  indexButtonGd.grabExcessHorizontalSpace = false;
  indexButton.setLayoutData(indexButtonGd);
  indexButton.addListener( SWT.Selection, new Listener() {
   public void handleEvent(Event e)
   {
    DirectoryDialog dd = new DirectoryDialog(composite.getShell());
    dd.setMessage("Please select the Lucene index directory");
    String dir = dd.open();
    if (dir != null)
      { indexText.setText(dir);( (CrawlConfigWizard) getWizard() ).crawlConfig.setIndexDir(dir); }
   }
  });

  //*-- description of the Lucene index dir.
  GridData indexDescrGd = new GridData(); indexDescrGd.grabExcessHorizontalSpace = true;
  indexDescrGd.horizontalAlignment = GridData.FILL; indexDescrGd.horizontalSpan = 3;
  indexDescrGd.widthHint = 350;
  Text indexDescrText = new Text(composite,  SWT.LEFT | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
  indexDescrText.setEditable(false);
  indexDescrText.setText("The Lucene index directory is where one or more indexes will be stored. If there are " + Constants.NEWLINE +
    "sub-directories in this directory, a multisearcher will be created to scan all index. Otherwise, a " + Constants.NEWLINE +
  "single index reader will be used. The files in this directory can become quite large.");
  indexDescrText.setLayoutData(indexDescrGd);

  //*-- add the database directory selector
  GridData dbGd = new GridData(); dbGd.grabExcessHorizontalSpace = false; dbGd.horizontalAlignment = GridData.FILL;
  CLabel dbLabel = new CLabel(composite, SWT.LEFT); dbLabel.setText("Berkeley DB dir.: ");
  dbLabel.setBackground( labelColors, new int[] {100} );
  dbLabel.setLayoutData(dbGd);

  final Text dbText = new Text(composite, SWT.SINGLE | SWT.BORDER);
  dbText.setText( ( (CrawlConfigWizard) getWizard() ).crawlConfig.getDbDir() );
  if (dbText.getText().length() == 0)
   dbText.setText(Constants.MUSTRU_HOME + Constants.fs + "data" + Constants.fs + "bdb");
  GridData dbTextGd = new GridData(); dbTextGd.horizontalAlignment = GridData.BEGINNING;
  dbTextGd.minimumWidth = 350; dbTextGd.grabExcessHorizontalSpace = true;
  dbText.setEditable(false);
  dbText.setLayoutData(dbTextGd);

  Button dbButton = new Button(composite, SWT.PUSH); dbButton.setText("Browse");
  GridData dbButtonGd = new GridData(); dbButtonGd.horizontalAlignment = GridData.BEGINNING;
  dbButtonGd.grabExcessHorizontalSpace = false;
  dbButton.setLayoutData(dbButtonGd);
  dbButton.addListener( SWT.Selection, new Listener() {
   public void handleEvent(Event e)
   {
    DirectoryDialog dd = new DirectoryDialog(composite.getShell());
    dd.setMessage("Please select the Berekeley DB directory");
    String dir = dd.open();
    if (dir != null
    { dbText.setText(dir); ( (CrawlConfigWizard) getWizard() ).crawlConfig.setDbDir(dir); }
   }
  });

  //*-- description of the Berkeley DB dir.
  GridData dbDescrGd = new GridData(); dbDescrGd.grabExcessHorizontalSpace = true;
  dbDescrGd.horizontalAlignment = GridData.FILL; dbDescrGd.horizontalSpan = 3;
  dbDescrGd.widthHint = 350;
  Text dbDescrText = new Text(composite,  SWT.LEFT | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
  dbDescrText.setEditable(false);
  dbDescrText.setText("The Berkeley database directory contains the log and data files for the database. " + Constants.NEWLINE +
  "For a large database, there will be many files and sufficient space will be required in this directory.");
  dbDescrText.setLayoutData(dbDescrGd);

  //*-- add the web directory selector
  GridData webGd = new GridData(); webGd.grabExcessHorizontalSpace = false; webGd.horizontalAlignment = GridData.FILL;
  CLabel webLabel = new CLabel(composite, SWT.LEFT); webLabel.setText("Web Server Root dir.: ");
  webLabel.setBackground( labelColors, new int[] {100} );
  webLabel.setLayoutData(dbGd);

  final Text webText = new Text(composite, SWT.SINGLE | SWT.BORDER);
  webText.setText( ( (CrawlConfigWizard) getWizard() ).crawlConfig.getWebDir() );
  GridData webTextGd = new GridData(); webTextGd.horizontalAlignment = GridData.BEGINNING;
  webTextGd.minimumWidth = 350; webTextGd.grabExcessHorizontalSpace = true;
  webText.setEditable(false);
  webText.setLayoutData(webTextGd);

  Button webButton = new Button(composite, SWT.PUSH); webButton.setText("Browse");
  GridData webButtonGd = new GridData(); webButtonGd.horizontalAlignment = GridData.BEGINNING;
  webButtonGd.grabExcessHorizontalSpace = false;
  webButton.setLayoutData(dbButtonGd);
  webButton.addListener( SWT.Selection, new Listener() {
   public void handleEvent(Event e)
   {
    DirectoryDialog dd = new DirectoryDialog(composite.getShell());
    dd.setMessage("Please select the Web server root directory");
    String dir = dd.open();
    if (dir != null
    { webText.setText(dir); ( (CrawlConfigWizard) getWizard() ).crawlConfig.setWebDir(dir); }
   }
  });

  //*-- description of the Web server dir
  GridData webDescrGd = new GridData(); webDescrGd.grabExcessHorizontalSpace = true;
  webDescrGd.horizontalAlignment = GridData.FILL; webDescrGd.horizontalSpan = 3;
  webDescrGd.widthHint = 350;
  Text webDescrText = new Text(composite,  SWT.LEFT | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
  webDescrText.setEditable(false);
  webDescrText.setText("OPTIONAL: If you are running a Web server, you can enter the root directory for " + Constants.NEWLINE +
  "HTML files here. ");
  webDescrText.setLayoutData(dbDescrGd);

  setControl(composite);
}
View Full Code Here

    lFolderData.widthHint = 300;
    lFolderData.horizontalSpan = 3;
    folderLabel.setLayoutData(lFolderData);
    folderLabel.setText(Messages.getString("downloadpanel.folder.select"));

    mDirectoryField = new Text(autoReloadContainer, SWT.SINGLE | SWT.BORDER);
    lFolderData.widthHint = 300;
    lFolderData.horizontalSpan = 2;
    mDirectoryField.setLayoutData(lFolderData);
    mDirectoryField.setText(fGlobalScope
        .getString(DefaultPreferences.PODCAST_DIRECTORY));
View Full Code Here

          break;
        }

          /* Type: Enumeration */
        case ISearchValueType.ENUM: {
          final Text text = new Text(inputField, SWT.BORDER);
          text.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = text.getText();

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Provide Auto-Complete Field */
          hookAutoComplete(text, field.getSearchValueType().getEnumValues());

          /* Show UI Hint that Content Assist is available */
          ControlDecoration controlDeco = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
          controlDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
          controlDeco.setDescriptionText("Content Assist Available (Press Arrow-Down Key)");
          controlDeco.setShowOnlyOnFocus(true);

          /* Pre-Select input if given */
          String inputValue = (input != null ? input.toString() : null);
          if (inputValue != null)
            text.setText(inputValue);

          /* Update Input Value */
          fInputValue = text.getText();

          break;
        }

          /* Type: Number */
        case ISearchValueType.NUMBER:
        case ISearchValueType.INTEGER: {
          final Spinner spinner = new Spinner(inputField, SWT.BORDER);
          spinner.setMinimum(0);
          spinner.setMaximum(1000);
          spinner.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = spinner.getSelection();

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Pre-Select input if given */
          Object presetInput = (input == null) ? fInputValue : input;
          if (presetInput != null && presetInput instanceof Integer)
            spinner.setSelection((Integer) presetInput);

          /* Update Input Value */
          fInputValue = spinner.getSelection();

          break;
        }

          /* Type: String */
        case ISearchValueType.STRING:
        case ISearchValueType.LINK: {
          final Text text = new Text(inputField, SWT.BORDER);
          text.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = text.getText();

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Provide auto-complete for Categories, Authors and Feeds */
          if (field.getId() == INews.CATEGORIES || field.getId() == INews.AUTHOR || field.getId() == INews.FEED) {
            final Pair<SimpleContentProposalProvider, ContentProposalAdapter> pair = hookAutoComplete(text, null);

            /* Load proposals in the Background */
            JobRunner.runDelayedInBackgroundThread(new Runnable() {
              public void run() {
                if (!text.isDisposed()) {
                  Set<String> values = null;
                  if (field.getId() == INews.CATEGORIES)
                    values = fDaoService.getCategoryDAO().loadAllNames();
                  else if (field.getId() == INews.AUTHOR)
                    values = fDaoService.getPersonDAO().loadAllNames();
                  else if (field.getId() == INews.FEED)
                    values = Controller.getDefault().getCacheService().getFeedLinks();

                  /* Apply Proposals */
                  if (!text.isDisposed())
                    applyProposals(values, pair.getFirst(), pair.getSecond());
                }
              }
            });

            /* Show UI Hint that Content Assist is available */
            ControlDecoration controlDeco = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
            controlDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
            controlDeco.setDescriptionText("Content Assist Available (Press Arrow-Down Key)");
            controlDeco.setShowOnlyOnFocus(true);
          }

          /* Pre-Select input if given */
          Object presetInput = (input == null && fInputValue instanceof String) ? fInputValue : input;
          if (presetInput != null)
            text.setText(presetInput.toString());

          /* Update Input Value */
          fInputValue = text.getText();

          break;
        }
      }
    }
View Full Code Here

      }
    });

    fUseInternalBrowser.setSelection(!fUseDefaultExternalBrowser.getSelection() && !fUseCustomExternalBrowser.getSelection());

    fCustomBrowserInput = new Text(browserGroup, SWT.BORDER);
    fCustomBrowserInput.setEnabled(fUseCustomExternalBrowser.getSelection());
    fCustomBrowserInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));

    String customBrowserValue = fGlobalScope.getString(DefaultPreferences.CUSTOM_BROWSER_PATH);
    if (customBrowserValue != null)
View Full Code Here

    manager.add(quickSearch);
    manager.createControl(searchContainer);

    /* Input for the Search */
    fSearchInput = new Text(searchContainer, SWT.BORDER | SWT.SINGLE | SWT.SEARCH);
    fSearchInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    fSearchInput.setMessage(fFeedView.getFilter().getSearchTarget().getName());

    /* Register this Input Field to Context Service */
    Controller.getDefault().getContextService().registerInputField(fSearchInput);
View Full Code Here

    Composite nameContainer = new Composite(container, SWT.BORDER);
    nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
    nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_WHITE));

    fNameInput = new Text(nameContainer, SWT.SINGLE);
    fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));

    /* Prefill Name out of Conditions if provided */
    if (fInitialSearchConditions != null && !fInitialSearchConditions.isEmpty()) {
      fNameInput.setText(ModelUtils.getName(fInitialSearchConditions, fInitialMatchAllConditions));
View Full Code Here

      textChanged();
  }

  /* Input Field for typing into the Filter */
  private void createFilterText(Composite parent) {
    fFilterText = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
    fFilterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));

    /* Set Message */
    if (fPatternFilter.getSearchTarget() == SearchTarget.NAME)
      fFilterText.setMessage("Name");
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Text

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.