亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pmpeditor.java

?? 自己建立的項目
?? JAVA
字號:
package com.swtSample.text;

import java.io.IOException;
import java.util.Stack;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.printing.*;
import org.eclipse.swt.widgets.*;

/**
 * This program demonstrates StyledText
 */
public class PmpEditor {
  // The number of operations that can be undone
  private static final int UNDO_LIMIT = 500;

  // Contains a reference to this application
  private static PmpEditor app;

  // Contains a reference to the main window
  private Shell shell;

  // Displays the file
  private StyledText st;

  // The full path of the current file
  private String filename;

  // The font for the StyledText
  private Font font;

  // The label to display statistics
  private Label status;

  // The print options and printer
  private StyledTextPrintOptions options;
  private Printer printer;

  // The stack used to store the undo information
  private Stack changes;

  // Flag to set before performing an undo, so the undo
  // operation doesn't get stored with the rest of the undo
  // information
  private boolean ignoreUndo = false;

  // Syntax data for the current extension
  private SyntaxData sd;

  // Line style listener
  private PmpeLineStyleListener lineStyleListener;

  /**
   * Gets the reference to this application
   * 
   * @return HexEditor
   */
  public static PmpEditor getApp() {
    return app;
  }

  /**
   * Constructs a PmpEditor
   */
  public PmpEditor() {
    app = this;
    changes = new Stack();

    // Set up the printing options
    options = new StyledTextPrintOptions();
    options.footer = StyledTextPrintOptions.SEPARATOR
        + StyledTextPrintOptions.PAGE_TAG + StyledTextPrintOptions.SEPARATOR
        + "Confidential";
  }

  /**
   * Runs the application
   */
  public void run() {
    Display display = new Display();
    shell = new Shell(display);

    // Choose a monospaced font
    font = new Font(display, "Terminal", 12, SWT.NONE);

    createContents(shell);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    font.dispose();
    display.dispose();
    if (printer != null)
      printer.dispose();
  }

  /**
   * Creates the main window's contents
   * 
   * @param shell the main window
   */
  private void createContents(Shell shell) {
    // Set the layout and the menu bar
    shell.setLayout(new FormLayout());
    shell.setMenuBar(new PmpEditorMenu(shell).getMenu());

    // Create the status bar
    status = new Label(shell, SWT.BORDER);
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    data.height = status.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    status.setLayoutData(data);

    // Create the styled text
    st = new StyledText(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    data = new FormData();
    data.left = new FormAttachment(0);
    data.right = new FormAttachment(100);
    data.top = new FormAttachment(0);
    data.bottom = new FormAttachment(status);
    st.setLayoutData(data);

    // Set the font
    st.setFont(font);

    // Add Brief delete next word
    // Use SWT.MOD1 instead of SWT.CTRL for portability
    st.setKeyBinding('k' | SWT.MOD1, ST.DELETE_NEXT);

    // Add vi end of line (kind of)
    // Use SWT.MOD1 instead of SWT.CTRL for portability
    // Use SWT.MOD2 instead of SWT.SHIFT for portability
    // Shift+4 is $
    st.setKeyBinding('4' | SWT.MOD1 | SWT.MOD2, ST.LINE_END);

    // Handle key presses
    st.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent event) {
        // Update the status bar
        updateStatus();
      }
    });

    // Handle text modifications
    st.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent event) {
        // Update the status bar
        updateStatus();

        // Update the comments
        if (lineStyleListener != null) {
          lineStyleListener.refreshMultilineComments(st.getText());
          st.redraw();
        }
      }
    });

    // Store undo information
    st.addExtendedModifyListener(new ExtendedModifyListener() {
      public void modifyText(ExtendedModifyEvent event) {
        if (!ignoreUndo) {
          // Push this change onto the changes stack
          changes.push(new TextChange(event.start, event.length,
              event.replacedText));
          if (changes.size() > UNDO_LIMIT) changes.remove(0);
        }
      }
    });

    // Update the title bar and the status bar
    updateTitle();
    updateStatus();
  }

  /**
   * Opens a file
   */
  public void openFile() {
    FileDialog dlg = new FileDialog(shell);
    String temp = dlg.open();
    if (temp != null) {
      try {
        // Get the file's contents
        String text = PmpeIoManager.getFile(temp);

        // File loaded, so save the file name
        filename = temp;

        // Update the syntax properties to use
        updateSyntaxData();

        // Put the new file's data in the StyledText
        st.setText(text);

        // Update the title bar
        updateTitle();

        // Delete any undo information
        changes.clear();
      } catch (IOException e) {
        showError(e.getMessage());
      }
    }
  }

  /**
   * Saves a file
   */
  public void saveFile() {
    if (filename == null) {
      saveFileAs();
    } else {
      try {
        // Save the file and update the title bar based on the new file name
        PmpeIoManager.saveFile(filename, st.getText().getBytes());
        updateTitle();
      } catch (IOException e) {
        showError(e.getMessage());
      }
    }
  }

  /**
   * Saves a file under a different name
   */
  public void saveFileAs() {
    SafeSaveDialog dlg = new SafeSaveDialog(shell);
    if (filename != null) {
      dlg.setFileName(filename);
    }
    String temp = dlg.open();
    if (temp != null) {
      filename = temp;

      // The extension may have changed; update the syntax data accordingly
      updateSyntaxData();
      saveFile();
    }
  }

  /**
   * Prints the document to the default printer
   */
  public void print() {
    if (printer == null)
      printer = new Printer();
    options.header = StyledTextPrintOptions.SEPARATOR + filename
        + StyledTextPrintOptions.SEPARATOR;
    st.print(printer, options).run();
  }

  /**
   * Cuts the current selection to the clipboard
   */
  public void cut() {
    st.cut();
  }

  /**
   * Copies the current selection to the clipboard
   */
  public void copy() {
    st.copy();
  }

  /**
   * Pastes the clipboard's contents
   */
  public void paste() {
    st.paste();
  }

  /**
   * Selects all the text
   */
  public void selectAll() {
    st.selectAll();
  }

  /**
   * Undoes the last change
   */
  public void undo() {
    // Make sure undo stack isn't empty
    if (!changes.empty()) {
      // Get the last change
      TextChange change = (TextChange) changes.pop();

      // Set the flag. Otherwise, the replaceTextRange call will get placed
      // on the undo stack
      ignoreUndo = true;

      // Replace the changed text
      st.replaceTextRange(change.getStart(), change.getLength(), change
          .getReplacedText());

      // Move the caret
      st.setCaretOffset(change.getStart());

      // Scroll the screen
      st.setTopIndex(st.getLineAtOffset(change.getStart()));
      ignoreUndo = false;
    }
  }

  /**
   * Toggles word wrap
   */
  public void toggleWordWrap() {
    st.setWordWrap(!st.getWordWrap());
  }

  /**
   * Gets the current word wrap settings
   * 
   * @return boolean
   */
  public boolean getWordWrap() {
    return st.getWordWrap();
  }

  /**
   * Shows an about box
   */
  public void about() {
    MessageBox mb = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
    mb.setMessage("Poor Man's Programming Editor");
    mb.open();
  }

  /**
   * Updates the title bar
   */
  private void updateTitle() {
    String fn = filename == null ? "Untitled" : filename;
    shell.setText(fn + " -- PmPe");
  }

  /**
   * Updates the status bar
   */
  private void updateStatus() {
    // Show the offset into the file, the total number of characters in the file,
    // the current line number (1-based) and the total number of lines
    StringBuffer buf = new StringBuffer();
    buf.append("Offset: ");
    buf.append(st.getCaretOffset());
    buf.append("\tChars: ");
    buf.append(st.getCharCount());
    buf.append("\tLine: ");
    buf.append(st.getLineAtOffset(st.getCaretOffset()) + 1);
    buf.append(" of ");
    buf.append(st.getLineCount());
    status.setText(buf.toString());
  }

  /**
   * Updates the syntax data based on the filename's extension
   */
  private void updateSyntaxData() {
    // Determine the extension of the current file
    String extension = "";
    if (filename != null) {
      int pos = filename.lastIndexOf(".");
      if (pos > -1 && pos < filename.length() - 2) {
        extension = filename.substring(pos + 1);
      }
    }

    // Get the syntax data for the extension
    sd = SyntaxManager.getSyntaxData(extension);

    // Reset the line style listener
    if (lineStyleListener != null) {
      st.removeLineStyleListener(lineStyleListener);
    }
    lineStyleListener = new PmpeLineStyleListener(sd);
    st.addLineStyleListener(lineStyleListener);

    // Redraw the contents to reflect the new syntax data
    st.redraw();
  }

  /**
   * Shows an error message
   * 
   * @param error the text to show
   */
  private void showError(String error) {
    MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
    mb.setMessage(error);
    mb.open();
  }

  /**
   * The application entry point
   * 
   * @param args the command line arguments
   */
  public static void main(String[] args) {
    new PmpEditor().run();
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
视频一区欧美精品| 一区二区国产视频| 精品一区二区综合| 精品日韩欧美在线| 国产不卡视频在线观看| 国产欧美日产一区| 91在线视频播放地址| 一区二区三区四区不卡在线| 欧美三级乱人伦电影| 免费久久99精品国产| 久久精品欧美一区二区三区不卡| 国产成人精品免费在线| 最新中文字幕一区二区三区| 欧亚洲嫩模精品一区三区| 日韩av一级电影| 欧美韩国日本不卡| 91美女福利视频| 奇米精品一区二区三区在线观看一 | 蜜臀av国产精品久久久久| 欧美xxx久久| eeuss鲁一区二区三区| 亚洲国产成人tv| 久久久国际精品| 色婷婷精品大在线视频| 美女性感视频久久| 欧美高清在线一区二区| 欧美亚男人的天堂| 国产精品69久久久久水密桃| 亚洲精品成人精品456| 日韩欧美成人一区二区| av成人老司机| 美女视频黄 久久| 亚洲图片另类小说| 久久久久免费观看| 欧美男女性生活在线直播观看| 精品一区二区av| 一区二区国产视频| 国产欧美日韩在线视频| 欧美精品日韩综合在线| av亚洲精华国产精华| 奇米色777欧美一区二区| 国产精品不卡在线| 久久综合九色欧美综合狠狠| 在线区一区二视频| 国产成人精品影视| 精品在线播放免费| 午夜精品在线视频一区| 国产精品久久久久一区二区三区共| 91精品国产福利在线观看| 99久久久久久| 国产精品一区二区不卡| 日本不卡不码高清免费观看| 伊人婷婷欧美激情| 自拍视频在线观看一区二区| 久久蜜臀中文字幕| 精品欧美一区二区久久| 欧美三级蜜桃2在线观看| 91色九色蝌蚪| 99热这里都是精品| 成人一级黄色片| 九九久久精品视频| 麻豆国产精品一区二区三区| 午夜精品成人在线| 亚洲大片在线观看| 亚洲小说欧美激情另类| 亚洲欧美一区二区三区极速播放 | 国产精品素人视频| 久久久综合视频| 精品91自产拍在线观看一区| 4hu四虎永久在线影院成人| 精品视频在线免费看| 日本乱人伦一区| 色狠狠一区二区| 91捆绑美女网站| 在线欧美日韩国产| 欧美在线色视频| 欧美日韩视频一区二区| 欧美日韩国产成人在线免费| 精品视频1区2区3区| 欧美日韩国产在线播放网站| 欧美在线免费视屏| 在线电影一区二区三区| 56国语精品自产拍在线观看| 日韩欧美在线1卡| 亚洲精品在线免费播放| 久久久精品综合| 亚洲国产精品二十页| 中文字幕一区二区视频| 亚洲色图在线播放| 亚洲一区二区三区爽爽爽爽爽| 亚洲一二三区在线观看| 爽好久久久欧美精品| 麻豆91免费观看| 国产高清精品网站| 91网址在线看| 欧美久久久久免费| 久久综合中文字幕| 国产精品久久久久久久久久免费看| 亚洲欧美一区二区三区极速播放| 亚洲国产aⅴ天堂久久| 日韩高清不卡一区二区| 国产一二精品视频| 91一区一区三区| 欧美丰满美乳xxx高潮www| 精品999久久久| 亚洲色图欧美偷拍| 日本视频一区二区三区| 福利视频网站一区二区三区| 色天使色偷偷av一区二区| 欧美高清视频一二三区 | 图片区小说区国产精品视频| 日本欧美一区二区三区乱码| 国产精品资源网站| 精品视频在线看| 国产视频亚洲色图| 日韩高清在线观看| av在线一区二区三区| 欧美一区二区在线看| 最新中文字幕一区二区三区 | 尤物视频一区二区| 狠狠久久亚洲欧美| 欧美丝袜自拍制服另类| 国产亚洲一二三区| 亚洲成av人片| 91视频观看免费| 久久女同精品一区二区| 亚洲va天堂va国产va久| 成人国产精品免费网站| 欧美mv日韩mv国产| 亚洲一区二区三区四区中文字幕 | 麻豆成人久久精品二区三区红| av在线不卡电影| 久久蜜桃一区二区| 日本vs亚洲vs韩国一区三区 | 91猫先生在线| 久久婷婷色综合| 五月综合激情日本mⅴ| 99re成人在线| 国产欧美精品区一区二区三区| 日韩电影免费在线| 欧亚洲嫩模精品一区三区| 中文字幕免费不卡在线| 国产真实乱对白精彩久久| 欧美男女性生活在线直播观看| 亚洲人成在线播放网站岛国 | 精品中文字幕一区二区小辣椒| 91久久久免费一区二区| 国产精品热久久久久夜色精品三区 | 国产高清精品网站| 欧美va亚洲va在线观看蝴蝶网| 亚洲.国产.中文慕字在线| 在线看一区二区| 亚洲视频一区二区在线观看| 成人aaaa免费全部观看| 日本一区二区在线不卡| 国内精品嫩模私拍在线| 精品久久国产字幕高潮| 免费的成人av| 日韩欧美中文字幕一区| 麻豆精品一区二区| 欧美videos中文字幕| 激情图片小说一区| 精品三级在线观看| 国产一区二区三区黄视频| 久久免费电影网| 国产乱子伦视频一区二区三区| 精品999在线播放| 国产大陆a不卡| 国产日本欧美一区二区| 不卡视频免费播放| 亚洲免费在线视频| 欧美在线啊v一区| 午夜欧美大尺度福利影院在线看| 欧美巨大另类极品videosbest| 日韩**一区毛片| 欧美成人综合网站| 国产原创一区二区| 日本一区免费视频| 91视频在线看| 亚洲mv在线观看| 欧美一区二区二区| 国产麻豆精品theporn| 国产香蕉久久精品综合网| 99久久精品免费精品国产| 亚洲精品日日夜夜| 91精品国产麻豆| 国产激情视频一区二区三区欧美| 国产精品欧美一级免费| 在线观看91视频| 久久精品免费观看| 中文字幕第一区第二区| 91福利在线免费观看| 免费在线一区观看| 亚洲国产激情av| 欧美日韩一区久久| 国产呦萝稀缺另类资源| 亚洲美女在线国产| 精品剧情v国产在线观看在线| 成人黄页在线观看| 亚洲成人激情av|