当前位置: 首页>>代码示例>>Java>>正文


Java Program.findProgram方法代码示例

本文整理汇总了Java中org.eclipse.swt.program.Program.findProgram方法的典型用法代码示例。如果您正苦于以下问题:Java Program.findProgram方法的具体用法?Java Program.findProgram怎么用?Java Program.findProgram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.program.Program的用法示例。


在下文中一共展示了Program.findProgram方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadImage

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
public Image loadImage(File file) {
if (OSExplorer.getInstance().isRoot(file)) {
    return loadImage("drive.png");
} else if (file.isDirectory()) {
    return loadImage("folder.png");
} else {
    String extension = OSExplorer.getInstance().getExtension(file);
    if (extension.equals("")) {
	return loadImage("file.png");
    } else {
	Program program = Program.findProgram(extension);
	if (program == null) {
	    return loadImage("file.png");
	} else {
	    return loadImage(program);
	}
    }
}
   }
 
开发者ID:Cavallinux,项目名称:jisocreator,代码行数:20,代码来源:ImageUtils.java

示例2: launchURL

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
private static void launchURL(String s) {
	Program program = Program.findProgram(".html");
	if (program != null && program.getName().contains("Chrome")) {
		try {
			Field field = Program.class.getDeclaredField("command");
			field.setAccessible(true);
			String command = (String) field.get(program);
			command = command.replaceAll("%[1lL]", s);
			command = command.replace(" --", "");
			PluginInitializer.getDefaultInterface().getUtilities().createProcess(command + " -incognito");
		} catch (Exception e1) {
			e1.printStackTrace();
			Utils.launch(s);
		}
	} else {
		Utils.launch(s);
	}
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:19,代码来源:SearchSubsUtils.java

示例3: isProgramInstalled

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
@Override
public boolean
isProgramInstalled(
	String extension,
	String name )
{
	if ( !extension.startsWith( "." )){

		extension = "." + extension;
	}

	Program program = Program.findProgram( extension );

	return( program == null ? false:(program.getName().toLowerCase(Locale.US)
		.contains(name.toLowerCase(Locale.US))));
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:17,代码来源:UIFunctionsImpl.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: getSystemEditorImageDescriptor

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
/**
 * Return the image descriptor of the system editor that is registered with
 * the OS to edit files of this type. <code>null</code> if none can be
 * found.
 */
private ImageDescriptor getSystemEditorImageDescriptor(String extension) {
	Program externalProgram = null;
	if (extension != null) {
		externalProgram = Program.findProgram(extension);
	}
	if (externalProgram == null) {
		return null;
	}
	return new EditorImageDescriptor(externalProgram);
}
 
开发者ID:angelozerr,项目名称:jsbuild-eclipse,代码行数:16,代码来源:BuildFileOpenWithMenu.java

示例9: 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

示例10: getImage

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
@Override
public Image getImage(Object element) {
	if (element instanceof ProjectResource) {
		ProjectResource proResource = (ProjectResource) element;
		String fileName = proResource.getLabel();
		if (proResource.isProject()) {
			return projectImg;
		} else if (proResource.isFolder()) {
			return folderImg;
		} else if (fileName.endsWith(".hsxliff")) {
			return hsXLiffImg;
		} else if (fileName.endsWith(".html")) {
			return htmlImg;
		} else {
			int index = fileName.lastIndexOf(".");
			if (index != -1) {
				String extension = fileName.substring(index, fileName.length());
				if (imgMap.containsKey(extension)) {
					return imgMap.get(extension);
				}
				Program program = Program.findProgram(extension);
				if (program != null) {
					ImageData imageData = program.getImageData();
					if (imageData != null) {
						Image img = new Image(getShell().getDisplay(), imageData);
						imgMap.put(extension, img);
						return img;
					}
				}
			}
		}
	}
	return defaultImg;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:35,代码来源:ImportProjectWizardPage2.java

示例11: isProgramInstalled

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
public boolean 
isProgramInstalled(
	String extension, 
	String name ) 
{
	if ( !extension.startsWith( "." )){
		
		extension = "." + extension;
	}
	
	Program program = Program.findProgram( extension );
	
	return( program == null ? false:(program.getName().toLowerCase(Locale.US).indexOf( name.toLowerCase(Locale.US)) != -1));
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:15,代码来源:UIFunctionsImpl.java

示例12: getImage

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
@Override
public Image getImage(Object element) {
	if (element instanceof ProjectResource) {
		ProjectResource proResource = (ProjectResource) element;
		String fileName = proResource.getLabel();
		if (proResource.isProject()) {
			return projectImg;
		}else if (proResource.isFolder()) {
			return folderImg;
		}else if (fileName.endsWith(".hsxliff")) {
			return hsXLiffImg;
		}else if (fileName.endsWith(".html")) {
			return htmlImg;
		}else {
			int index = fileName.lastIndexOf(".");
			if (index != -1) {
				String extension = fileName.substring(index, fileName.length());
				if (imgMap.containsKey(extension)) {
					return imgMap.get(extension);
				}
				Program program = Program.findProgram(extension);
				if (program != null) {
					ImageData imageData = program.getImageData();
					if (imageData != null) {
						Image img = new Image(getShell().getDisplay(), imageData);
						imgMap.put(extension, img);
						return img;
					}
				}
			}
		}
	}
	return defaultImg;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:35,代码来源:ImportProjectWizardPage2.java

示例13: getFileType

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
public String getFileType(File file) {
String extension = getExtension(file);
if (extension.equals("Folder")) {
    return "Folder";
} else if (extension.equals("")) {
    return "File";
} else {
    Program program = Program.findProgram(extension);
    if (program == null) {
	return "File " + extension;
    } else {
	return program.getName();
    }
}
   }
 
开发者ID:Cavallinux,项目名称:jisocreator,代码行数:16,代码来源:OSExplorer.java

示例14: createMailTreeItems

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
private void createMailTreeItems(TreeItem currentRoot, SmtpMessagePart part)
{
	if (part != null && part.getParts() != null)
	{
		Iterator<SmtpMessagePart> it = part.getParts().iterator();
		while (it.hasNext())
		{
			SmtpMessagePart p = it.next();
			TreeItem item = new TreeItem(currentRoot, SWT.NONE);
			item.setText(p.getContentType());
			item.setData(p);

			if (SmimeUtilities.isEnvelopedData(p))
				item.setImage(SWTHelper.loadImage("smime.gif")); //$NON-NLS-1$
			else if (isSigned && "application/pkcs7-signature".equals(p.getContentType()))
				item.setImage(SWTHelper.loadImage("smime_sig.gif")); //$NON-NLS-1$
			else if (p.getFileName() != null && p.getFileName().lastIndexOf('.') > -1)
			{
				String fileName = p.getFileName();
				String ext = fileName.substring(fileName.lastIndexOf('.')); //$NON-NLS-1$
				Program program = Program.findProgram(ext);

				if (program != null && program.getImageData() != null)
					item.setImage(new Image(SWTHelper.getDisplay(), program.getImageData()));
				else
					item.setImage(SWTHelper.loadImage("attach.gif")); //$NON-NLS-1$
			}
			else
				item.setImage(SWTHelper.loadImage("part.gif")); //$NON-NLS-1$

			createMailTreeItems(item, p);
			item.setExpanded(true);
		}
	}
}
 
开发者ID:edeoliveira,项目名称:Mailster,代码行数:36,代码来源:OutLineView.java

示例15: 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


注:本文中的org.eclipse.swt.program.Program.findProgram方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。