Examples of ITextEditor


Examples of org.eclipse.ui.texteditor.ITextEditor

    /*
     * @see IAction#run()
     */
    public void run() {

      ITextEditor editor= getTextEditor();
      if (editor == null)
        return;

      IEncodingSupport encodingSupport= (IEncodingSupport) editor.getAdapter(IEncodingSupport.class);
      if (encodingSupport == null)
        return;

      String title= TextEditorMessages.Editor_ConvertEncoding_Custom_dialog_title;
      String message= TextEditorMessages.Editor_ConvertEncoding_Custom_dialog_message;
      IInputValidator inputValidator = new IInputValidator() {
        public String isValid(String newText) {
          return (newText == null || newText.length() == 0) ? " " : null; //$NON-NLS-1$
        }
      };

      String initialValue= encodingSupport.getEncoding();
      if (initialValue == null)
        initialValue= encodingSupport.getDefaultEncoding();
      if (initialValue == null)
        initialValue= ""; //$NON-NLS-1$

      InputDialog d= new InputDialog(editor.getSite().getShell(), title, message, initialValue, inputValidator);
      if (d.open() == Window.OK)
        encodingSupport.setEncoding(d.getValue());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.