@Override protected Object getData(final Locale locale) { final Properties properties = new Properties(); final IProduct product = Platform.getProduct(); if (product == null) { properties.setProperty( Messages.getString("PlatformProductProvider.ProductProperty", locale), //$NON-NLS-1$ Messages.getString("PlatformProductProvider.UndefinedProduct", locale)); //$NON-NLS-1$ } else { properties.setProperty( Messages.getString("PlatformProductProvider.NameProperty", locale), //$NON-NLS-1$ product.getName()); properties.setProperty(Messages.getString("PlatformProductProvider.IdProperty", locale), product.getId()); //$NON-NLS-1$ properties.setProperty( Messages.getString("PlatformProductProvider.ApplicationProperty", locale), //$NON-NLS-1$ product.getApplication()); properties.setProperty( Messages.getString("PlatformProductProvider.DefinePluginProperty", locale), //$NON-NLS-1$ product.getDefiningBundle().getSymbolicName()); } return properties; }
public synchronized static String getStudioPrefix() { // Cache this value! if (fgPrefix == null) { fgPrefix = APTANA_STUDIO_PREFIX; IProduct product = Platform.getProduct(); if (product != null) { String name = product.getProperty("studioPrefix"); //$NON-NLS-1$ if (!StringUtil.isEmpty(name)) { fgPrefix = name; } } } return fgPrefix; }
@Override public Object getImage(Object object) { IProduct product = Platform.getProduct(); if (product == null) { return null; } Bundle bundle = product.getDefiningBundle(); String name = ((EObject)object).eClass().getName(); Path relativePath = new Path("icons/"+name+".png"); URL pluginRelativeURL = FileLocator.find(bundle, relativePath, null); if (pluginRelativeURL != null) { try { return FileLocator.resolve(pluginRelativeURL); } catch (IOException e) { // okay } } return null; }
public void preWindowOpen( ) { IWorkbenchWindowConfigurer configurer = getWindowConfigurer( ); configurer.setShowCoolBar( true ); configurer.setShowStatusLine( true ); String title = null; IProduct product = Platform.getProduct( ); if ( product != null ) { title = product.getName( ); } if ( title == null ) { title = DesignerWorkbenchMessages.Workbench_title; } configurer.setTitle( title ); }
/** * Obtains URLs to product image * * @return String[] with URLs as Strings or null */ private static String[] getProductImageURLs( ) { IProduct product = Platform.getProduct( ); if ( product != null ) { String url = product.getProperty( "windowImages" ); //$NON-NLS-1$ if ( url != null && url.length( ) > 0 ) { return url.split( ",\\s*" ); //$NON-NLS-1$ } url = product.getProperty( "windowImage" ); //$NON-NLS-1$ if ( url != null && url.length( ) > 0 ) { return new String[]{ url }; } } return null; }
/** * Returns the bundle that launched the application that this class runs in. * * @return the defining bundle */ private Bundle getApplicationBundle() { IProduct product = Platform.getProduct(); if (product != null) { return product.getDefiningBundle(); } else { return Platform.getBundle(ECLIPSE_RUNTIME_BULDEID); } }
@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)); }
public static String getProductName() { IProduct product = Platform.getProduct(); if (product != null) { String name = product.getName(); if (!StringUtil.isEmpty(name)) { return name; } } return APTANA_STUDIO; }
private Bundle getProductBundle() { IProduct product = Platform.getProduct(); if (product != null) { return product.getDefiningBundle(); } return null; }
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; }
/** * Obtains name of the Eclipse product * * @return String */ public static String getProductName() { IProduct product = Platform.getProduct(); if (product == null) { return ""; //$NON-NLS-1$ } String name = product.getName(); return name == null ? "" : name; //$NON-NLS-1$ }
public List<DownloadableCordovaEngine> getDownloadableEngines() throws CoreException { AbstractEngineRepoProvider provider = new NpmBasedEngineRepoProvider(); IProduct product = Platform.getProduct(); if (product != null) { String productId = Platform.getProduct().getId(); List<CordovaEngineRepoProvider> providerProxies = HybridCore.getCordovaEngineRepoProviders(); for (CordovaEngineRepoProvider providerProxy : providerProxies) { if (productId.equals(providerProxy.getProductId())) { provider = providerProxy.createProvider(); } } } return provider.getEngines(); }
public List<DownloadableCordovaEngine> getDownloadableEngines(String platformId) throws CoreException { AbstractEngineRepoProvider provider = new NpmBasedEngineRepoProvider(); IProduct product = Platform.getProduct(); if (product != null) { String productId = Platform.getProduct().getId(); List<CordovaEngineRepoProvider> providerProxies = HybridCore.getCordovaEngineRepoProviders(); for (CordovaEngineRepoProvider providerProxy : providerProxies) { if (productId.equals(providerProxy.getProductId())) { provider = providerProxy.createProvider(); } } } return provider.getEngines(platformId); }
public Object start(IApplicationContext context) throws Exception { OpenDocumentEventProcessor openDocProcessor = new OpenDocumentEventProcessor(); Display display = PlatformUI.createDisplay(); display.addListener(SWT.OpenDocument, openDocProcessor); try { IProduct product = Platform.getProduct(); String id = product.getId(); String hsVersion = ""; if (id.equals("net.heartsome.cat.te.tmx_editor_product")) { hsVersion = "F"; } System.getProperties().put("TSVersion", "88"); System.getProperties().put("TSEdition", hsVersion); String versionDate = System.getProperty("date", ""); String version = System.getProperty("version", ""); System.getProperties().put("TSVersionDate", version + "." + versionDate); checkCleanValue(); int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor(openDocProcessor)); if (returnCode == PlatformUI.RETURN_RESTART) return IApplication.EXIT_RESTART; else return IApplication.EXIT_OK; } finally { display.dispose(); } }
/** * Pop up a message dialog to request the restart of the workbench */ private void requestRestart(String rePreference) { String reMessage = EmacsPlusActivator.getString("EmacsPlusPref_RestartMessage"); //$NON-NLS-1$ IProduct product = Platform.getProduct(); String productName = product != null && product.getName() != null ? product.getName() : EmacsPlusActivator.getString("EmacsPlusPref_DefaultProduct"); //$NON-NLS-1$ final String msg = String.format(reMessage, productName,rePreference); final String reTitle = EmacsPlusActivator.getString("EmacsPlusPref_RestartTitle"); //$NON-NLS-1$ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { if (PlatformUI.getWorkbench().isClosing()) return; // yes == 0, no == 1 MessageDialog dialog = new MessageDialog(getDefaultShell(),reTitle,null,msg, MessageDialog.QUESTION , new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0); if (dialog.open() != Window.CANCEL) { if (dialog.getReturnCode() == 0) { // restart workbench PlatformUI.getWorkbench().restart(); } } } }); }
/** * Returns with {@code true} if all the followings are {@code true} * <p> * <ul> * <li>The {@link Platform#isRunning() platform is running}.</li> * <li>The platforms runs a {@link IProduct product}.</li> * <li>The platforms runs the N4JS IDE product and it is configured to include built-in libraries.</li> * <ul> * <li>The N4JS IDE runs in production mode {@code OR}</li> * <li>The N4JS IDE runs in either {@link Platform#inDebugMode() debug mode} or {@link Platform#inDevelopmentMode() * development mode} and the {@link #INCLUDES_BUILT_INS_SYSTEM_PROPERTY} is configured to be {@code true}</li> * </ul> * </ul> * Otherwise returns with {@code false} and neither built-in libraries nor local git repository for the N4JS * definition files has to be set up . * * @return {@code true} if the infrastructure is required for the built-in and NPM support. */ public static boolean requiresInfrastructureForLibraryManager() { if (Platform.isRunning()) { final IProduct product = Platform.getProduct(); if (null != product) { if (parseBoolean(product.getProperty(INCLUDES_BUILT_INS_PRODUCT_PROPERTY))) { // Runs in *non-production* mode and the system property is NOT set to include the built-ins. if ((inDebugMode() || inDevelopmentMode()) && !parseBoolean(System.getProperty(INCLUDES_BUILT_INS_SYSTEM_PROPERTY))) { return false; } return true; } } } return false; }
public void init(Shell splash) { super.init(splash); String progressRectString = null; String messageRectString = null; String foregroundColorString = null; IProduct product = Platform.getProduct(); if (product != null) { progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT); foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR); } Rectangle progressRect = StringConverter.asRectangle(progressRectString, new Rectangle(10, 10, 300, 15)); setProgressRect(progressRect); Rectangle messageRect = StringConverter.asRectangle(messageRectString, new Rectangle(10, 35, 300, 15)); setMessageRect(messageRect); int foregroundColorInteger; try { foregroundColorInteger = Integer.parseInt(foregroundColorString, 16); } catch (Exception ex) { foregroundColorInteger = 0xD2D7FF; // off white } setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8, foregroundColorInteger & 0xFF)); // the following code will be removed for release time String[] mappings = loadMappings(product.getDefiningBundle()); StringBuilder sbId = new StringBuilder(); if (mappings.length >= 2) { String version = mappings[0]; String timestamp = mappings[1]; if (!version.startsWith("$") && !timestamp.startsWith("$")) { sbId.append(version); sbId.append("."); sbId.append(timestamp); } else { sbId.append("Unknown Build"); } } else { sbId.append("Unknown Build"); } String eclipseBaseVersion = ""; if (mappings.length >= 3) { eclipseBaseVersion = mappings[2]; if (eclipseBaseVersion.startsWith("$")) { eclipseBaseVersion = "Unknown Eclipse Base Version"; } } Label idLabel = new Label(getContent(), SWT.LEFT); idLabel.setForeground(getForeground()); idLabel.setBounds(new Rectangle(390, 105, 220, 40)); idLabel.setText(sbId.toString()); idLabel.setData(CSSSWTConstants.CSS_ID_KEY, CSS_ID_SPLASH_BUILD_ID); Label basedOnLabel = new Label(getContent(), SWT.LEFT); basedOnLabel.setForeground(getForeground()); basedOnLabel.setBounds(new Rectangle(190, 105, 220, 40)); basedOnLabel.setText(eclipseBaseVersion); basedOnLabel.setData(CSSSWTConstants.CSS_ID_KEY, CSS_ID_SPLASH_BUILD_ID); toString(); }
public static boolean isEclipseIdeRunning(){ IProduct product = Platform.getProduct(); if (product == null) return false; // ("Eclipse SDK".equals(product.getName())); return "org.eclipse.sdk.ide".equals(product.getId()) && "org.eclipse.ui.ide.workbench".equals(product.getApplication()); }
private String computeTitle() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); IWorkbenchPage currentPage = configurer.getWindow().getActivePage(); IEditorPart activeEditor = null; if (currentPage != null) { activeEditor = lastActiveEditor; } String title = null; IProduct product = Platform.getProduct(); if (product != null) { title = product.getName(); } if (title == null) { title = ""; //$NON-NLS-1$ } if (currentPage != null) { if (activeEditor != null) { lastEditorTitle = activeEditor.getTitleToolTip(); title = NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle, lastEditorTitle, title); } IPerspectiveDescriptor persp = currentPage.getPerspective(); String label = ""; //$NON-NLS-1$ if (persp != null) { label = persp.getLabel(); } IAdaptable input = currentPage.getInput(); if (input != null && !input.equals(wbAdvisor.getDefaultPageInput())) { label = currentPage.getLabel(); } if (label != null && !label.equals("")) { //$NON-NLS-1$ title = NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle, label, title); } } String workspaceLocation = wbAdvisor.getWorkspaceLocation(); if (workspaceLocation != null) { title = NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle, title, workspaceLocation); } // Bug 284447: Prepend workspace name to the title String workspaceName = IDEWorkbenchPlugin.getDefault().getPreferenceStore().getString( IDEInternalPreferences.WORKSPACE_NAME); if (workspaceName != null && workspaceName.length() > 0) { title = NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle, workspaceName, title); } return title; }
private void openWelcomeEditors(IWorkbenchWindow window) { if (IDEWorkbenchPlugin.getDefault().getPreferenceStore().getBoolean( IDEInternalPreferences.WELCOME_DIALOG)) { // show the welcome page for the product the first time the // workbench opens IProduct product = Platform.getProduct(); if (product == null) { return; } AboutInfo productInfo = new AboutInfo(product); URL url = productInfo.getWelcomePageURL(); if (url == null) { return; } IDEWorkbenchPlugin.getDefault().getPreferenceStore().setValue( IDEInternalPreferences.WELCOME_DIALOG, false); openWelcomeEditor(window, new WelcomeEditorInput(productInfo), null); } else { // Show the welcome page for any newly installed features List<AboutInfo> welcomeFeatures = new ArrayList<AboutInfo>(); for (Iterator<Entry<String, AboutInfo>> it = wbAdvisor.getNewlyAddedBundleGroups().entrySet().iterator(); it .hasNext();) { Entry<String, AboutInfo> entry = it.next(); AboutInfo info = (AboutInfo) entry.getValue(); if (info != null && info.getWelcomePageURL() != null) { welcomeFeatures.add(info); // activate the feature plug-in so it can run some install // code String pi = info.getBrandingBundleId(); if (pi != null) { // Start the bundle if there is one Bundle bundle = Platform.getBundle(pi); if (bundle != null) { try { bundle.start(Bundle.START_TRANSIENT); } catch (BundleException exception) { StatusManager.getManager().handle( new Status(IStatus.ERROR, IDEApplication.PLUGIN_ID, "Failed to load feature", exception)); //$NON-NLS-1$ } } } } } int wCount = getWorkbench().getWorkbenchWindowCount(); for (int i = 0; i < welcomeFeatures.size(); i++) { AboutInfo newInfo = (AboutInfo) welcomeFeatures.get(i); String id = newInfo.getWelcomePerspectiveId(); // Other editors were already opened in postWindowRestore(..) if (id == null || i >= wCount) { openWelcomeEditor(window, new WelcomeEditorInput(newInfo), id); } } } }
/** * Retrieves the product version from the Platform aboutText property * * @return */ public static String getProductVersion() { String version = null; try { IProduct product = Platform.getProduct(); if (product != null) { String aboutText = product.getProperty("aboutText"); //$NON-NLS-1$ if (!StringUtil.isEmpty(aboutText)) { String pattern = "Version: (.*)\n"; //$NON-NLS-1$ Pattern p = Pattern.compile(pattern); Matcher m = p.matcher(aboutText); boolean found = m.find(); if (!found) { // fall back to trying to match build # p = Pattern.compile("build: (.*)\n"); //$NON-NLS-1$ m = p.matcher(aboutText); found = m.find(); } if (found) { version = m.group(1); } } } } catch (Exception e) { // ignore } if (StringUtil.isEmpty(version)) { // falls back to the branding plugin version return getStudioVersion(); } return version; }
@Override public void init(final Shell splash) { super.init(splash); // keep the splash handler to be used outside of this splash handlers TourbookPlugin.setSplashHandler(this); String progressRectString = null; String messageRectString = null; // String foregroundColorString = null; final IProduct product = Platform.getProduct(); if (product != null) { progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT); // foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR); } // set progressbar position Rectangle progressRect = parseRect(progressRectString); if (progressRect == null) { progressRect = new Rectangle(10, 0, 300, 15); } setProgressRect(progressRect); // set message position Rectangle messageRect = parseRect(messageRectString); if (messageRect == null) { messageRect = new Rectangle(10, 25, 300, 15); } setMessageRect(messageRect); // set message color int foregroundColorInteger; // try { // // debug color // foregroundColorInteger = Integer.parseInt(foregroundColorString, 16); // } catch (final Exception ex) { // // production color, debug is not using this color // foregroundColorInteger = 0x2d84f6; // } // foregroundColorInteger = 0x2d84f6; // foregroundColorInteger = 0x2a7ce7; foregroundColorInteger = 0xffffff; setForeground(new RGB( (foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8, foregroundColorInteger & 0xFF)); // final String buildId = "Version " + System.getProperty("eclipse.buildId", "Unknown Version"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ getContent().addPaintListener(new PaintListener() { @Override public void paintControl(final PaintEvent e) { onPaint(e); } }); }
@Override public String f(final IProduct product) { return product.getName(); }
@Override public String f(final IProduct product) { return product.getId(); }
public static Option<IProduct> getProduct() { return Option.fromNull(Platform.getProduct()); }
/** * Create shell images */ private static Image[] createImages( ) { String[] productImageURLs = getProductImageURLs( ); if ( productImageURLs != null ) { ArrayList shellImgs = new ArrayList( ); for ( int i = 0; i < productImageURLs.length; i++ ) { if ( "".equals( productImageURLs[i] ) ) //$NON-NLS-1$ { continue; } URL imageURL = null; try { imageURL = new URL( productImageURLs[i] ); } catch ( MalformedURLException mue ) { // must be a path relative to the product bundle IProduct product = Platform.getProduct( ); if ( product != null ) { Bundle productBundle = product.getDefiningBundle( ); if ( productBundle != null ) { imageURL = Platform.find( productBundle, new Path( productImageURLs[i] ) ); } } } Image image = null; if ( imageURL != null ) { String key = imageURL.toString( ); if (CorePlugin.getDefault( ).getImageRegistry( ).get( key ) != null) { image = CorePlugin.getDefault( ).getImageRegistry( ).get( key ); } else { image = ImageDescriptor.createFromURL( imageURL ) .createImage( ); CorePlugin.getDefault( ).getImageRegistry( ).put( key, image ); } } if ( image != null ) { shellImgs.add( image ); } } return (Image[]) shellImgs.toArray( new Image[shellImgs.size( )] ); } return new Image[0]; }
protected IProduct getProduct() { if (product == null) { product = Platform.getProduct(); } return product; }