0
我是eclipse插件開發的新手。我創建了一個插件,用於從文件夾&加載一個unicode保存的文本文件,並將其顯示在對話框&上,並將其設置爲標籤。如果是,用英語,一切工作正常。但是,如果我嘗試加載任何其他語言的文本,它顯示爲空。我怎麼能通過這個。Eclipse插件顯示任何語言的文本
這裏是如何我在對話框中顯示它的一些代碼:
Shell shell = Display.getCurrent().getActiveShell();
// Loading the file by creating the assets folder & Temp.txt file inside
// Eclipse Plugin
URL url = FileLocator.find(bundle, new Path("assets/Temp.txt"), null);
URL fileUrl = null;
try {
fileUrl = FileLocator.toFileURL(url);
} catch (IOException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
File file = new File(fileUrl.getPath());
String Message = "";
try {
if (file.exists()) {
BufferedReader in = new BufferedReader(
new FileReader(file));
String str;
while ((str = in.readLine()) != null) {
if (str.contains(LanguageSelected)) {
System.out.println(str);
Message = Message + "\n" + str;
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
// Creating the dialog
Shell dialog = new Shell(shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
...
// Adding Label to dialog
Label LabelMessage = new Label(dialog, SWT.LEFT);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 6;
// Adding Message to the dialog
LabelMessage.setLayoutData(data);
LabelMessage.setBackground(new Color(null, 255, 255, 255)); // White
LabelMessage.setText(Message);
包括一些代碼 – HaveNoDisplayName 2014-12-05 14:00:30
您沒有包含足夠的信息,任何人都無法幫助您。你如何加載文件?你如何顯示它? – 2014-12-05 14:06:14
請檢查,我已編輯它。 – 2014-12-05 14:16:28