Package org.eclipse.jface.fieldassist

Examples of org.eclipse.jface.fieldassist.ControlDecoration


        definitionLabel = new Label(this, SWT.LEFT);
        definitionLabel.setText("Definition");
        definitionLabel.setLayoutData("cell 0 6 2 1, width pref!,left");

        feedbackDecorator = new ControlDecoration(definitionLabel, SWT.RIGHT | SWT.TOP);

        name = new Text(this, SWT.SINGLE | SWT.BORDER);
        name.setEditable(true);
        name.setText("");
        name.setLayoutData("cell 0 7 2 1");
View Full Code Here


     * This method will make use of an associated ControlDecoration if available.
     * </p>
     */
    protected void feedback(String warning){
        if( input != null && input.getFeedback() != null ){
            ControlDecoration feedback = input.getFeedback();
           
            feedback.setDescriptionText(warning);
           
            FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
            FieldDecoration errorDecoration = decorations.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
            feedback.setImage(errorDecoration.getImage());
            feedback.show();
        }
        Control control = getControl();
        if (control != null && !control.isDisposed()) {
            control.setToolTipText(warning);
        }
View Full Code Here

     * </p>
     */
    protected void feedback(String warning, boolean isRequired){
        if( isRequired ){
            if( input != null && input.getFeedback() != null ){
                ControlDecoration feedback = input.getFeedback();
               
                feedback.setDescriptionText(warning);
               
                FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
                if( isRequired ){
                    FieldDecoration requiredDecoration = decorations.getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED);
                    feedback.setImage(requiredDecoration.getImage());
                } else {
                    FieldDecoration warningDecoration = decorations.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING );
                    feedback.setImage(warningDecoration.getImage());
                }
                feedback.show();
            }
            Control control = getControl();
            if (control != null && !control.isDisposed()) {
                control.setToolTipText(warning);
            }
View Full Code Here

     * This method will make use of an associated ControlDecoration if available.
     * </p>
     */
    protected void feedback(String error, Throwable exception){
        if( input != null && input.getFeedback() != null ){
            ControlDecoration feedback = input.getFeedback();
           
            feedback.setDescriptionText(error);
            FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
            FieldDecoration warningDecoration = decorations.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
            feedback.setImage(warningDecoration.getImage());
            feedback.show();
        }
        Control control = getControl();
        if (control != null && !control.isDisposed()) {
            control.setToolTipText(error+":"+exception);
        }
View Full Code Here

     * @return
     */
    public void createFeatureTypeNameText( Composite parent, Object layoutData ) {
       
        nameText = new Text(parent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        errorDecorator = new ControlDecoration(nameText, SWT.TOP|SWT.LEFT);
        Image image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEC_FIELD_ERROR);
        errorDecorator.setImage(image);
       
        if (viewer != null) {
            SimpleFeatureType input = ((SimpleFeatureType) viewer.getInput());
View Full Code Here

        Label label = new Label(markComposite, SWT.NONE);
        label.setText("Marker Type");
       
        markerTypeCombo = new ComboExpressionViewer(markComposite, SWT.SINGLE);
        markerTypeCombo.getControl().setLayoutData(new TableWrapData(TableWrapData.LEFT));
        markerTypeDecoration = new ControlDecoration(label, SWT.LEFT | SWT.TOP);
        markerTypeDecoration.hide();
        markerTypeCombo.getControl().setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
       
        Composite additionalComposite = new Composite(markComposite, SWT.NONE);
        additionalComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
View Full Code Here

        Label label = new Label(parent, SWT.NONE);
        label.setText(labelText);

        final Text text = new Text(parent, textStyle);

        final ControlDecoration decoration = new ControlDecoration(text, SWT.TOP | SWT.LEFT);
        ImageRegistry imageRegistry = CatalogUIPlugin.getDefault().getImageRegistry();
        Image image = imageRegistry.get(REQUIRED_DECORATION);
        if (image == null) {
            image = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.WARNING_OVR).createImage();
            imageRegistry.put(REQUIRED_DECORATION, image);
        }
        decoration.setImage(image);
        decoration.setDescriptionText(localization.requiredField);
        decoration.show();

        text.addListener(SWT.Modify, new Listener(){

            public void handleEvent( Event event ) {
                getContainer().updateButtons();
                boolean valid = isValid(text);
                if (text.getText().trim().equals("") && valid) { //$NON-NLS-1$
                    decoration.show();
                } else {
                    decoration.hide();
                }
            }

        });
View Full Code Here

      inputPatternTextData.top = top2;
      inputPatternTextData.right = new FormAttachment(1000, 1000, -65);
      inputPatternText.setLayoutData(inputPatternTextData);
      inputPatternText.setText(".+\\.xmi");

      decoFileFilterPattern = new ControlDecoration(this.inputPatternText, SWT.TOP | SWT.LEFT);
      Image imageError = FieldDecorationRegistry.getDefault()
              .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();
      decoFileFilterPattern.setDescriptionText("PatternSyntaxException for this regular expression.");
      decoFileFilterPattern.setImage(imageError);
      decoFileFilterPattern.hide();
      inputPatternText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          // without that listener, the text fields forget the
          // last change when leaving with tab! don't know why!
          // we also MUST call getText() otherwise the changes in
          // the field are lost (what is this???!!)
          Text t = (Text) e.widget;
          decoFileFilterPattern.hide();
        }
      });

      // next row

      FormAttachment top3 = new FormAttachment(labelFileFilter, 10);
      labelTypeSystem = new Label(this, SWT.NONE);
      FormData label3LData = new FormData();
      label3LData.width = 70;
      label3LData.left = new FormAttachment(0, 1000, 12);
      label3LData.top = top3;
      labelTypeSystem.setLayoutData(label3LData);
      labelTypeSystem.setText("Type System:");

      typeSystemFileText = new Text(this, SWT.SINGLE | SWT.BORDER);
      FormData preFileTexLData = new FormData();
      preFileTexLData.width = 150;
      preFileTexLData.left = new FormAttachment(labelTypeSystem, 10);
      preFileTexLData.top = top3;
      preFileTexLData.right = new FormAttachment(1000, 1000, -65);
      typeSystemFileText.setLayoutData(preFileTexLData);
      typeSystemFileText.setText("");
      typeSystemFileText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          // without that listener, the text fields forget the
          // last change when leaving with tab! don't know why!
          // we also MUST call getText() otherwise the changes in
          // the field are lost (what is this???!!)
          Text t = (Text) e.widget;
          t.getText();
        }
      });

      fileChooseButton = new Button(this, SWT.PUSH | SWT.CENTER);
      FormData fileChooseButtoLData = new FormData();
      fileChooseButtoLData.width = 25;
      fileChooseButtoLData.height = 25;
      fileChooseButtoLData.top = top3;
      fileChooseButtoLData.right = new FormAttachment(1000, 1000, -35);
      fileChooseButton.setLayoutData(fileChooseButtoLData);
      Image icon = getImage("prepFolder");
      fileChooseButton.setImage(icon);
      fileChooseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
          FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
          fd.setText("Choose Type System Descriptor or Ruta Script");
          String[] filterExt = { "*.ruta", "*.*" };
          fd.setFilterExtensions(filterExt);
          String file = fd.open();
          if (file != null) {
            typeSystemFileText.setText(file);
          }
        }
      });

      // next row: query rules

      FormAttachment top4 = new FormAttachment(labelTypeSystem, 10);
      Composite compositeQueryRules = new Composite(this, SWT.CENTER);
      FormData compData = new FormData();
      // compData.width = 300;
      compData.height = 100;
      compData.left = new FormAttachment(0, 1000, 10);
      compData.top = top4;
      compData.right = new FormAttachment(1000, 1000, -10);
      // compData.left = new FormAttachment(0, 1000, 12);
      // compData.top = new FormAttachment(0, 1000, 70);
      // compData.bottom = new FormAttachment(0, 1000, -10);
      // compData.right = new FormAttachment(1000, 1000, -10);
      // compData.width = 109;
      // composite1.setSize(500, 500);
      compositeQueryRules.setLayoutData(compData);
      compositeQueryRules.setLayout(new FillLayout());
      IDLTKUILanguageToolkit toolkit = DLTKUILanguageManager.getLanguageToolkit(RutaLanguageToolkit
              .getDefault().getNatureId());
      final ScriptTextTools textTools = toolkit.getTextTools();
      IPreferenceStore store = toolkit.getCombinedPreferenceStore();
      viewer = new ScriptSourceViewer(compositeQueryRules, null, null, false, SWT.H_SCROLL
              | SWT.V_SCROLL | SWT.BORDER, store);

      ScriptSourceViewerConfiguration configuration = textTools.createSourceViewerConfiguraton(
              store, (ITextEditor) null);
      viewer.configure(configuration);
      setInformation("");
      compositeQueryRules.layout();

      viewer.addTextListener(new ITextListener() {

        public void textChanged(TextEvent arg0) {
          setRutaQuerySyntaxError(false);
        }
      });

      decoQueryRules = new ControlDecoration(compositeQueryRules, SWT.TOP | SWT.LEFT);
      decoQueryRules.setDescriptionText("Could not run query, maybe illegal Ruta rule syntax.");
      decoQueryRules.setImage(imageError);
      decoQueryRules.hide();
      // TODO
      // inputPatternText.addModifyListener(new ModifyListener() {
View Full Code Here

  public ToolNameValidator(){
    super();
  }
  public ToolNameValidator(Text text) {
    this();
    this.decoration = new ControlDecoration(text,
        SWT.LEFT | SWT.TOP);
    this.decoration.setDescriptionText(INVALID_TOOL_NAME);
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
        .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
    this.decoration.setImage(fieldDecoration.getImage());
View Full Code Here

                .grab(true, true).indent(9, 0).create());
            t.setLayoutData(GridDataFactory.fillDefaults()
                .grab(false, true).create());
            ts.setTopIndex(0);
            final ToolItem ma = new ToolItem(t, SWT.DROP_DOWN);
            controlDecoration = new ControlDecoration(ts, SWT.TOP
                | SWT.LEFT);
            FieldDecoration dec = FieldDecorationRegistry
                .getDefault()
                .getFieldDecoration(
                    FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
View Full Code Here

TOP

Related Classes of org.eclipse.jface.fieldassist.ControlDecoration

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.