本文整理匯總了Java中org.eclipse.swt.custom.CTabItem.getText方法的典型用法代碼示例。如果您正苦於以下問題:Java CTabItem.getText方法的具體用法?Java CTabItem.getText怎麽用?Java CTabItem.getText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.custom.CTabItem
的用法示例。
在下文中一共展示了CTabItem.getText方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: saveScript
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private static void saveScript() {
CTabItem currTabItem = getCurrentTab();
if (currTabItem != null) {
String fileName = currTabItem.getText();
if (fileName.contains("*")) {
fileName = fileName.substring(1, fileName.length());
String path = (String) getCurrentTab().getData(fileName);
StyledText text = (StyledText) getCurrentTab().getControl();
String strContent = removeTabKey(text.getText());
try {
FileUtility.writeFile(path, strContent, false);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
getCurrentTab().setText(fileName);
}
}
}
示例2: takeSnapShot
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private static void takeSnapShot() {
String picPath = null;
if (isRecording == false) {
MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
box.setMessage("請在錄製界麵截圖!");
box.open();
return;
}
CTabItem currentTab = getCurrentTab();
if (currentTab == null)
picPath = ".\\workspace";
else {
String tabName = currentTab.getText();
if (tabName.startsWith("*"))
tabName = tabName.substring(1, tabName.length());
//picPath = ".\\workspace\\" + (String)htTab.get((String)currentTab.getData(tabName)) +"\\Pictures";
picPath = ".\\workspace\\"
+ ((String) currentTab.getData(tabName)).substring(0,
((String) currentTab.getData(tabName)).indexOf("\\")) + "\\Pictures";
}
SaveScreen saveScreen = new SaveScreen(shell, SWT.CLOSE);
String choice = saveScreen.open();
if (choice != null && !choice.trim().equals(""))
try {
// takeSnapshoot(new File(".\\workspace\\"+choice));
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: getCurrentProject
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
public static String getCurrentProject() {
CTabItem ti = getCurrentTab();
if (ti != null) {
String scriptName = ti.getText();
if (scriptName.startsWith("*")) {
scriptName = scriptName.substring(1, scriptName.length());
}
String path = ti.getData(scriptName).toString();
String prjName = path.substring(0, path.indexOf("\\"));
return prjName;
}
return "";
}
示例4: removeTabItem
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private static void removeTabItem(String tabName) {
for (int i = 0; i < tabContent.getItemCount(); i++) {
CTabItem item = tabContent.getItem(i);
String name = item.getText();
if (name.contains("*")) {
if (name.substring(1, name.length()).equals(tabName)) {
item.dispose();
}
} else {
if (name.equals(tabName)) {
item.dispose();
}
}
}
}
示例5: exitPrompt
import org.eclipse.swt.custom.CTabItem; //導入方法依賴的package包/類
private static boolean exitPrompt() {
for (int i = 0; i < tabContent.getItemCount(); i++) {
CTabItem item = tabContent.getItem(i);
String name = item.getText();
if (name.contains("*")) {
int iChoice = showNotification("是否保存?", SWT.ICON_QUESTION | SWT.YES | SWT.NO
| SWT.CANCEL);
if (iChoice == SWT.YES) {
StyledText text = (StyledText) item.getControl();
name = name.substring(1, name.length());
try {
FileUtility.saveAllScripts((String) item.getData(name), item.getText(),
text.getText());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
} else if (iChoice == SWT.CANCEL) {
return false;
}
}
}
//if(htLog.size()>0)
// return false;
if (isRecording) {
showNotification("請關閉錄製功能!", SWT.ICON_WARNING | SWT.YES);
return false;
}
return true;
}