當前位置: 首頁>>代碼示例>>Java>>正文


Java Program.execute方法代碼示例

本文整理匯總了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);
            }
        }
    }
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:22,代碼來源:CommonReportAction.java

示例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;
}
 
開發者ID:elexis,項目名稱:elexis-3-core,代碼行數:25,代碼來源:ExternalLink.java

示例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());
	}
}
 
開發者ID:elexis,項目名稱:elexis-3-base,代碼行數:28,代碼來源:NotesDetail.java

示例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());
	}
}
 
開發者ID:elexis,項目名稱:elexis-3-base,代碼行數:21,代碼來源:DocHandle.java

示例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();
  }
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:33,代碼來源:BrowserUtilities.java

示例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());
	}
}
 
開發者ID:elexis,項目名稱:elexis-3-core,代碼行數:44,代碼來源:DisplayLabDokumenteDialog.java

示例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;
}
 
開發者ID:elexis,項目名稱:elexis-3-base,代碼行數:39,代碼來源:CdaMessage.java

示例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());
		}
	}
}
 
開發者ID:elexis,項目名稱:elexis-3-base,代碼行數:18,代碼來源:Desktop.java


注:本文中的org.eclipse.swt.program.Program.execute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。