本文整理了Java中org.eclipse.core.runtime.Platform.getProduct()
方法的一些代码示例,展示了Platform.getProduct()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getProduct()
方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getProduct
[英]Returns the product which was selected when running this Eclipse instance or null
if none
[中]返回运行此Eclipse实例时选择的产品,如果没有,则返回null
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
protected IProduct getProduct() {
if (product == null)
product = Platform.getProduct();
return product;
}
代码示例来源:origin: org.eclipse.core/runtime
private void initValues() {
if (initialized)
return;
initialized = true;
IProduct product = Platform.getProduct();
if (product == null) {
if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
InternalPlatform.message("Product not available to set product default preference overrides."); //$NON-NLS-1$
return;
}
productID = product.getId();
if (productID == null) {
if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
InternalPlatform.message("Product ID not available to apply product-level preference defaults."); //$NON-NLS-1$
return;
}
customizationBundle = product.getDefiningBundle();
if (customizationBundle == null) {
if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
InternalPlatform.message("Bundle not available to apply product-level preference defaults for product id: " + productID); //$NON-NLS-1$
return;
}
customizationValue = product.getProperty(PRODUCT_KEY);
if (customizationValue == null) {
if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES)
InternalPlatform.message("Product : " + productID + " does not define preference customization file. Using legacy file: plugin_customization.ini"); //$NON-NLS-1$//$NON-NLS-2$
customizationValue = LEGACY_PRODUCT_CUSTOMIZATION_FILENAME;
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
public boolean canEnableSimilarDeclarationUpdating() {
IProduct product= Platform.getProduct();
if (product != null) {
String property= product.getProperty("org.eclipse.jdt.ui.refactoring.handlesSimilarDeclarations"); //$NON-NLS-1$
if ("false".equalsIgnoreCase(property)) //$NON-NLS-1$
return false;
}
return true;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.help
public InputStream getHelpDataFile(String filePath) throws IOException {
IProduct product = Platform.getProduct();
Bundle definingBundle = product != null ? product.getDefiningBundle() : null;
URL entry = definingBundle != null ? definingBundle.getEntry(filePath) : null;
if(entry == null) {
throw new IOException("No entry to '"+filePath+"' could be found or caller does not have the appropriate permissions.");//$NON-NLS-1$ //$NON-NLS-2$
}
return entry.openStream();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
@Override
public boolean canEnableSimilarDeclarationUpdating() {
IProduct product= Platform.getProduct();
if (product != null) {
String property= product.getProperty("org.eclipse.jdt.ui.refactoring.handlesSimilarDeclarations"); //$NON-NLS-1$
if ("false".equalsIgnoreCase(property)) //$NON-NLS-1$
return false;
}
return true;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
public boolean canEnableSimilarDeclarationUpdating() {
IProduct product= Platform.getProduct();
if (product != null) {
String property= product.getProperty("org.eclipse.jdt.ui.refactoring.handlesSimilarDeclarations"); //$NON-NLS-1$
if ("false".equalsIgnoreCase(property)) //$NON-NLS-1$
return false;
}
return true;
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
@Override
public boolean canEnableSimilarDeclarationUpdating() {
IProduct product = Platform.getProduct();
if (product != null) {
String property = product.getProperty("org.eclipse.jdt.ui.refactoring.handlesSimilarDeclarations"); //$NON-NLS-1$
if ("false".equalsIgnoreCase(property)) {
return false;
}
}
return true;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.help
private boolean filterByProduct(String productId) {
IProduct product = Platform.getProduct();
if (product != null) {
return !productId.equals(product.getId());
}
return true;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
/**
* Returns an instance that describes this plugin's product (formerly "primary
* plugin").
* @return ProductInfo the product info for the receiver
*/
private ProductInfo getProductInfo() {
if (productInfo == null) {
productInfo = new ProductInfo(Platform.getProduct());
}
return productInfo;
}
代码示例来源:origin: net.sourceforge.eclipsejaas/net.sourceforge.eclipsejaas
public static String getProperty(String propertyName)
{
String property = Platform.getProduct().getProperty(propertyName);
if (property == null)
{
property = System.getProperty(propertyName);
}
return property;
}
代码示例来源:origin: org.eclipse/org.eclipse.pde.core
private String getProductPlugin() {
IProduct product = Platform.getProduct();
if (product != null) {
Bundle plugin = product.getDefiningBundle();
if (plugin != null) {
return plugin.getSymbolicName();
}
}
return PLATFORM_PLUGIN;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.discovery
public static Dictionary<Object, Object> createEnvironment() {
Dictionary<Object, Object> environment = new Hashtable<Object, Object>(System.getProperties());
// add the installed Mylyn version to the environment so that we can
// have
// connectors that are filtered based on version of Mylyn
IProduct product = Platform.getProduct();
if (product != null) {
environment.put("org.eclipse.product.id", product.getId()); //$NON-NLS-1$
}
return environment;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core
private String getProductPlugin() {
IProduct product = Platform.getProduct();
if (product != null) {
Bundle plugin = product.getDefiningBundle();
if (plugin != null) {
return plugin.getSymbolicName();
}
}
return PLATFORM_PLUGIN;
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
/**
* Returns the title that the dialog (or splash) should have.
*
* @return the window title
* @since 3.4
*/
public static String getWindowTitle() {
String productName = null;
IProduct product = Platform.getProduct();
if (product != null) {
productName = product.getName();
}
if (productName == null) {
productName = IDEWorkbenchMessages.ChooseWorkspaceDialog_defaultProductName;
}
return productName;
}
代码示例来源:origin: org.eclipse/org.eclipse.help.ui
private void load() {
IConfigurationElement [] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.help.base.activitySupport");//$NON-NLS-1$
if (elements.length==1 && elements[0].getName().equals("support")) //$NON-NLS-1$
config = elements[0];
else if (elements.length>0) {
IProduct product = Platform.getProduct();
if (product==null) return;
String productId = product.getId();
for (int i=0; i<elements.length; i++) {
IConfigurationElement element = elements[i];
if (element.getAttribute("productId").equals(productId)) { //$NON-NLS-1$
config = element;
break;
}
}
}
}
private IConfigurationElement getChild(String name) {
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
String productName = ""; //$NON-NLS-1$
IProduct product = Platform.getProduct();
if (product != null && product.getName() != null)
productName = product.getName();
newShell.setText(NLS.bind(
WorkbenchMessages.InstallationDialog_ShellTitle, productName));
}
代码示例来源:origin: org.eclipse.equinox.p2.ui.sdk/scheduler
public ImportFromInstallationPage_c(ProvisioningUI ui, ProvisioningOperationWizard wizard, boolean firstTime) {
super("importfrominstancepage", ui, wizard); //$NON-NLS-1$
setTitle(firstTime ? ProvUIMessages.ImportFromInstallationPage_DIALOG_TITLE_FIRSTRUN : ProvUIMessages.ImportFromInstallationPage_DIALOG_TITLE);
setDescription(NLS.bind(ProvUIMessages.ImportFromInstallationPage_DIALOG_DESCRIPTION, Platform.getProduct().getName()));
}
代码示例来源:origin: org.eclipse.equinox.p2.ui.sdk/scheduler
public ImportFromInstallationPage_c(ProvisioningUI ui, ImportFromInstallationWizard_c wizard, IProfile toImportFrom, boolean firstTime) {
super("importfrominstancepage", ui, wizard); //$NON-NLS-1$
setTitle(firstTime ? ProvUIMessages.ImportFromInstallationPage_DIALOG_TITLE_FIRSTRUN : ProvUIMessages.ImportFromInstallationPage_DIALOG_TITLE);
setDescription(NLS.bind(firstTime ? ProvUIMessages.ImportFromInstallationPage_DIALOG_DESCRIPTION_FIRSTRUN : ProvUIMessages.ImportFromInstallationPage_DIALOG_DESCRIPTION, Platform.getProduct().getName()));
toBeImportedProfile = toImportFrom;
}
代码示例来源:origin: org.eclipse.equinox.p2/ui
/**
* Prompt the user for restart or apply profile changes.
*
* @param parent the parent shell of the dialog, or <code>null</code> if none
* @param mustRestart indicates whether the user must restart to get the
* changes. If <code>false</code>, then the user may choose to apply
* the changes to the running profile rather than restarting.
* @return one of PROFILE_IGNORE (do nothing), PROFILE_APPLYCHANGES
* (attempt to apply the changes), or PROFILE_RESTART (restart the system).
*/
public static int promptForRestart(Shell parent, boolean mustRestart) {
String title = ProvUIMessages.PlatformUpdateTitle;
IProduct product = Platform.getProduct();
String productName = product != null && product.getName() != null ? product.getName() : ProvUIMessages.ApplicationInRestartDialog;
String message = NLS.bind(mustRestart ? ProvUIMessages.PlatformRestartMessage : ProvUIMessages.OptionalPlatformRestartMessage, productName);
ApplyProfileChangesDialog dialog = new ApplyProfileChangesDialog(parent, title, message, mustRestart);
if (dialog.open() == Window.CANCEL)
return PROFILE_IGNORE;
return dialog.returnCode;
}
代码示例来源:origin: org.eclipse.equinox.p2/ui
protected UpdateSingleIUPage(UpdateOperation operation, ProvisioningUI ui) {
super("UpdateSingleIUPage", ui, null); //$NON-NLS-1$
setTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
IProduct product = Platform.getProduct();
String productName = product != null && product.getName() != null ? product.getName() : ProvUIMessages.ApplicationInRestartDialog;
setDescription(NLS.bind(ProvUIMessages.UpdateSingleIUPage_SingleUpdateDescription, productName));
Assert.isNotNull(operation);
Assert.isTrue(operation.hasResolved());
Assert.isTrue(operation.getSelectedUpdates().length == 1);
Assert.isTrue(operation.getResolutionResult().isOK());
this.operation = operation;
}
内容来源于网络,如有侵权,请联系作者删除!