本文整理匯總了Java中org.eclipse.swt.program.Program.execute方法的典型用法代碼示例。如果您正苦於以下問題:Java Program.execute方法的具體用法?Java Program.execute怎麽用?Java Program.execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.program.Program
的用法示例。
在下文中一共展示了Program.execute方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createCompleteMessageDialog
import org.eclipse.swt.program.Program; //導入方法依賴的package包/類
/**
*
* void
*/
protected void createCompleteMessageDialog() {
boolean result = MessageDialog.openConfirm(getShell(),
UMLMessage.MESSAGE_COMPLETE_DOCUMENT_CREATION,//"문서산출물 생성완료",
fileLocation +
UMLMessage.MESSAGE_DOCUMENT_HAS_BEEN_CREATED);//" 문서가 생성되었습니다. 생성된 문서를 보시겠습니까?");
if( result ) {
File file = new File(fileLocation);
if( file.exists() ) {
Program program = Program.findProgram(file.getName().substring(file.getName().lastIndexOf(UICoreConstant.PROJECT_CONSTANTS__DOT)));
if (null != program) {
String string = file.getAbsolutePath().toString();
program.execute(string);
}
}
}
}
示例2: doXRef
import org.eclipse.swt.program.Program; //導入方法依賴的package包/類
public boolean doXRef(String refProvider, String refID){
try {
int r = refID.lastIndexOf('.');
String ext = ""; //$NON-NLS-1$
if (r != -1) {
ext = refID.substring(r + 1);
}
Program proggie = Program.findProgram(ext);
if (proggie != null) {
proggie.execute(refID);
} else {
if (Program.launch(refID) == false) {
Runtime.getRuntime().exec(refID);
}
}
} catch (Exception ex) {
ElexisStatus status =
new ElexisStatus(ElexisStatus.ERROR, Hub.PLUGIN_ID, ElexisStatus.CODE_NONE,
Messages.ExternalLink_CouldNotStartFile, ex);
StatusManager.getManager().handle(status);
}
return true;
}
示例3: execute
import org.eclipse.swt.program.Program; //導入方法依賴的package包/類
/**
* Run a program to view an external file
*
* @param filename
*/
public void execute(String filename){
try {
int r = filename.lastIndexOf('.');
String ext = ""; //$NON-NLS-1$
if (r != -1) {
ext = filename.substring(r + 1);
}
Program proggie = Program.findProgram(ext);
if (proggie != null) {
proggie.execute(filename);
} else {
if (Program.launch(filename) == false) {
Runtime.getRuntime().exec(filename);
}
}
} catch (Exception ex) {
ExHandler.handle(ex);
SWTHelper.showError(Messages.NotesDetail_couldNotLaunch, ex.getMessage());
}
}
示例4: execute
import org.eclipse.swt.program.Program; //導入方法依賴的package包/類
public void execute(){
try {
String ext = StringConstants.SPACE; //""; //$NON-NLS-1$
File temp = createTemporaryFile(null);
Program proggie = Program.findProgram(ext);
if (proggie != null) {
proggie.execute(temp.getAbsolutePath());
} else {
if (Program.launch(temp.getAbsolutePath()) == false) {
Runtime.getRuntime().exec(temp.getAbsolutePath());
}
}
} catch (Exception ex) {
ExHandler.handle(ex);
SWTHelper.showError(Messages.DocHandle_runErrorHeading, ex.getMessage());
}
}
示例5: launchBrowser
import org.eclipse.swt.program.Program; //導入方法依賴的package包/類
/**
* Launches the browser with the given name. This method does not use the Eclipse browser methods to launch the
* browser since they do not properly pass quoted strings as a single argument.
*/
public static void launchBrowser(String browserName, String url) throws CoreException, IOException {
IBrowserDescriptor browser = findBrowser(browserName);
if (browser == null) {
throw new CoreException(
StatusUtilities.newErrorStatus("Could not find browser \"" + browserName + "\".", CorePlugin.PLUGIN_ID));
}
// SystemBrowserDescriptors have no info in them...
if (browser instanceof SystemBrowserDescriptor) {
Program p = Program.findProgram("html");
boolean launched = false;
if (p != null) {
launched = p.execute(url);
}
if (!launched) {
String msg = "Could not launch the default " + "browser, please configure a browser in "
+ "Preferences -> General -> Web Browsers";
MessageBox mb = new MessageBox(Display.getCurrent().getActiveShell());
mb.setMessage(msg);
mb.open();
throw new CoreException(StatusUtilities.newErrorStatus(msg, CorePlugin.PLUGIN_ID));
}
} else {
List<String> command = computeCommandLine(browser, url);
new ProcessBuilder(command).start();
}
}
示例6: openDocument
import org.eclipse.swt.program.Program; //導入方法依賴的package包/類
/**
* Opens a document in a system viewer
*
* @param document
*/
private void openDocument(String docName){
Patient patient = ElexisEventDispatcher.getSelectedPatient();
try {
if (this.docManager != null) {
java.util.List<IOpaqueDocument> documentList =
this.docManager.listDocuments(patient, null, docName, null, new TimeSpan(
this.date, this.date), null);
if (documentList == null || documentList.size() == 0) {
throw new IOException(MessageFormat.format("Dokument {0} nicht vorhanden!",
docName));
}
int counter = 0;
for (IOpaqueDocument document : documentList) {
String ext = FileTool.getExtension(docName);
File temp = File.createTempFile("lab" + counter, "doc." + ext); //$NON-NLS-1$ //$NON-NLS-2$
temp.deleteOnExit();
byte[] b = document.getContentsAsBytes();
if (b == null) {
throw new IOException("Dokument ist leer!");
}
FileOutputStream fos = new FileOutputStream(temp);
fos.write(b);
fos.close();
Program proggie = Program.findProgram(FileTool.getExtension(ext));
if (proggie != null) {
proggie.execute(temp.getAbsolutePath());
} else {
if (Program.launch(temp.getAbsolutePath()) == false) {
Runtime.getRuntime().exec(temp.getAbsolutePath());
}
}
counter++;
}
}
} catch (Exception ex) {
SWTHelper.showError("Fehler beim Öffnen des Dokumentes", ex.getMessage());
}
}
示例7: execute
import org.eclipse.swt.program.Program; //導入方法依賴的package包/類
/**
* currently all files are opened, if multiple we have not yet a selection possiblity
*
* @return
*/
public boolean execute(){
String files[] = this.getFiles();
if (files != null && files.length > 0) {
for (String file : files) {
int pos = file.lastIndexOf(".");
String ext = "";
if (pos > 0) {
ext = file.substring(pos);
}
if (ext != null) {
ext = ext.trim();
}
String path = getPath(file);
if (path != null) {
path = path.trim();
}
try {
Program program = Program.findProgram(ext);
if (program != null) {
program.execute(path);
} else {
if (Program.launch(path) == false) {
Runtime.getRuntime().exec(path);
}
}
} catch (Exception ex) {
ExHandler.handle(ex);
}
}
return true;
}
return false;
}
示例8: open
import org.eclipse.swt.program.Program; //導入方法依賴的package包/類
/**
* Opens a directory or file. JDK 1.6: Desktop.getDesktop().open(directory);
*/
public static void open(File dirOrFile) throws IOException{
Program proggie = null;
if (dirOrFile.isFile()) {
String ext = UtilFile.getFileExtension(dirOrFile.getName());
proggie = Program.findProgram(ext);
}
if (proggie != null) {
proggie.execute(dirOrFile.getAbsolutePath());
} else {
if (Program.launch(dirOrFile.getAbsolutePath()) == false) {
Runtime.getRuntime().exec(dirOrFile.getAbsolutePath());
}
}
}