org.eclipse.jface.viewers.ILabelProviderListener#org.eclipse.core.runtime.Platform源码实例Demo

下面列出了org.eclipse.jface.viewers.ILabelProviderListener#org.eclipse.core.runtime.Platform 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

private IJavadocCompletionProcessor[] getContributedProcessors() {
	if (fSubProcessors == null) {
		try {
			IExtensionRegistry registry= Platform.getExtensionRegistry();
			IConfigurationElement[] elements=	registry.getConfigurationElementsFor(JavaUI.ID_PLUGIN, PROCESSOR_CONTRIBUTION_ID);
			IJavadocCompletionProcessor[] result= new IJavadocCompletionProcessor[elements.length];
			for (int i= 0; i < elements.length; i++) {
				result[i]= (IJavadocCompletionProcessor) elements[i].createExecutableExtension("class"); //$NON-NLS-1$
			}
			fSubProcessors= result;
		} catch (CoreException e) {
			JavaPlugin.log(e);
			fSubProcessors= new IJavadocCompletionProcessor[0];
		}
	}
	return fSubProcessors;
}
 
源代码2 项目: birt   文件: OpenJavaSourceAction.java
private String getPath( String fileName )
{
	Bundle bundle = Platform.getBundle( ChartExamplesPlugin.ID );
	Path relativePath = new Path( "/src/org/eclipse/birt/chart/examples/view/models/" + fileName + JAVA_EXTENSION ); //$NON-NLS-1$
	URL relativeURL = FileLocator.find( bundle, relativePath, null );

	String absolutePath = null;
	try
	{
		URL absoluteURL = FileLocator.toFileURL( relativeURL );
		String tmp = absoluteURL.getPath( );
		absolutePath = tmp.substring( 0, tmp.lastIndexOf( "/" ) ); //$NON-NLS-1$		
	}
	catch ( IOException io )
	{
		io.printStackTrace( );
	}
	return absolutePath;
}
 
源代码3 项目: bonita-studio   文件: CustomPopupMenuExtender.java
public CustomPopupMenuExtender(final String id, final MenuManager menu,
        final ISelectionProvider prov, final IWorkbenchPart part, IEclipseContext context,
        final boolean includeEditorInput) {
    super();
    this.menu = menu;
    this.selProvider = prov;
    this.part = part;
    this.context = context;
    this.modelPart = part.getSite().getService(MPart.class);
    if (includeEditorInput) {
        bitSet |= INCLUDE_EDITOR_INPUT;
    }
    menu.addMenuListener(this);
    if (!menu.getRemoveAllWhenShown()) {
        menuWrapper = new SubMenuManager(menu);
        menuWrapper.setVisible(true);
    }
    createModelFor(id);
    addMenuId(id);

    Platform.getExtensionRegistry().addRegistryChangeListener(this);
}
 
源代码4 项目: tesb-studio-se   文件: ExtensionPointsReader.java
private void readRegisteredBundleClasspaths() {
    final IConfigurationElement[] configurationElements = Platform.getExtensionRegistry()
        .getConfigurationElementsFor(BUNDLE_CLASSPATH_EXT);
    for (IConfigurationElement e : configurationElements) {
        final String cmpName = e.getAttribute(NAME);
        final ExBundleClasspath bc =
            new ExBundleClasspath(e.getAttribute(PARAMETER), Boolean.parseBoolean(e.getAttribute(OPTIONAL)));
        parsePredicates(bc, e);

        Collection<ExBundleClasspath> attributeSet = componentBundleClasspaths.get(cmpName);
        if (attributeSet == null) {
            attributeSet = new ArrayList<ExBundleClasspath>();
            componentBundleClasspaths.put(cmpName, attributeSet);
        }
        attributeSet.add(bc);
    }
}
 
源代码5 项目: dartboard   文件: PubListener.java
/**
 * Retrieves all registered PubService extensions
 * 
 * All services that have the priority attribute set to true, are at the
 * beginning of the resulting list.
 * 
 * @return a List of all PubService extensions
 */
public static LinkedList<IPubService> getPubServices() {
	LinkedList<IPubService> pubServices = new LinkedList<IPubService>();
	IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
	for (IConfigurationElement e : extensionRegistry.getExtensionPoint(GlobalConstants.PUB_SERVICE_EXTENSION_POINT)
			.getConfigurationElements()) {
		try {
			IPubService pubService = (IPubService) e.createExecutableExtension(EXTENSION_CLASS);
			boolean priority = Boolean.valueOf(e.getAttribute(EXTENSION_PRIORITY));
			if (priority) {
				pubServices.add(0, pubService);
			} else {
				pubServices.add(pubService);
			}
		} catch (CoreException e1) {
			e1.printStackTrace();
		}
	}
	return pubServices;
}
 
源代码6 项目: translationstudio8   文件: AbstractSelfHelpUI.java
private boolean useExternalBrowser(String url) {
	// On non Windows platforms, use external when modal window is displayed
	if (!Constants.OS_WIN32.equalsIgnoreCase(Platform.getOS())) {
		Display display = Display.getCurrent();
		if (display != null) {
			if (insideModalParent(display))
				return true;
		}
	}

	// Use external when no help frames are to be displayed, otherwise no
	// navigation buttons.
	if (url != null) {
		if (url.indexOf("?noframes=true") > 0 //$NON-NLS-1$
				|| url.indexOf("&noframes=true") > 0) { //$NON-NLS-1$
			return true;
		}
	}
	return false;
}
 
源代码7 项目: tmxeditor8   文件: TmImporter.java
/**
 * 加载记忆库匹配实现 ;
 */
private void runExtension() {
	IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
			TMIMPORTER_EXTENSION_ID);
	try {
		for (IConfigurationElement e : config) {
			final Object o = e.createExecutableExtension("class");
			if (o instanceof ITmImporter) {
				ISafeRunnable runnable = new ISafeRunnable() {

					public void handleException(Throwable exception) {
						logger.error(Messages.getString("importer.TmImporter.logger1"), exception);
					}

					public void run() throws Exception {
						tmImporter = (ITmImporter) o;
					}
				};
				SafeRunner.run(runnable);
			}
		}
	} catch (CoreException ex) {
		logger.error(Messages.getString("importer.TmImporter.logger1"), ex);
	}
}
 
源代码8 项目: erflute   文件: ExtendPopupMenu.java
public static List<ExtendPopupMenu> loadExtensions(MainDiagramEditor editor) throws CoreException {
    final List<ExtendPopupMenu> extendPopupMenuList = new ArrayList<>();

    final IExtensionRegistry registry = Platform.getExtensionRegistry();
    final IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT_ID);

    if (extensionPoint != null) {
        for (final IExtension extension : extensionPoint.getExtensions()) {
            for (final IConfigurationElement configurationElement : extension.getConfigurationElements()) {
                final ExtendPopupMenu extendPopupMenu = ExtendPopupMenu.createExtendPopupMenu(configurationElement, editor);
                if (extendPopupMenu != null) {
                    extendPopupMenuList.add(extendPopupMenu);
                }
            }
        }
    }
    return extendPopupMenuList;
}
 
源代码9 项目: EasyShell   文件: Resource.java
public String getFullQualifiedName() {
    if (resource != null) {
        Bundle bundle = Platform.getBundle("org.eclipse.jdt.core");
        if (bundle != null) {
            IJavaElement element = JavaCore.create(resource);
            if (element instanceof IPackageFragment) {
                return ((IPackageFragment)element).getElementName();
            } else if (element instanceof ICompilationUnit) {
                IType type = ((ICompilationUnit)element).findPrimaryType();
                if (type != null) {
                    return type.getFullyQualifiedName();
                }
            }
        }
    }
    return getFullQualifiedPathName();
}
 
@Override public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
	if (IS_NODE_RESOURCE_PROPERTY.equals(property)) {
		IResource resource = Adapters.adapt(receiver, IResource.class);
		if (resource == null) {
			return false;
		}
		if (resource instanceof IFile) {
			IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
			IContentType jsContentType = contentTypeManager.getContentType("org.eclipse.wildwebdeveloper.js");
			IContentType tsContentType = contentTypeManager.getContentType("org.eclipse.wildwebdeveloper.ts");
			try (
				InputStream content = ((IFile) resource).getContents();
			) {
				List<IContentType> contentTypes = Arrays.asList(contentTypeManager.findContentTypesFor(content, resource.getName()));
				return contentTypes.contains(jsContentType) || contentTypes.contains(tsContentType);
			} catch (Exception e) {
				return false;
			}
		}
	}
	return false;
}
 
源代码11 项目: wildwebdeveloper   文件: Utils.java
/**
 * Provisions a project that's part of the "testProjects"
 * @param folderName the folderName under "testProjects" to provision from
 * @return the provisioned project
 * @throws CoreException
 * @throws IOException
 */
public static IProject provisionTestProject(String folderName) throws CoreException, IOException {
	URL url = FileLocator.find(Platform.getBundle("org.eclipse.wildwebdeveloper.tests"),
			Path.fromPortableString("testProjects/" + folderName), null);
	url = FileLocator.toFileURL(url);
	File folder = new File(url.getFile());
	if (folder.exists()) {
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("testProject" + System.nanoTime());
		project.create(null);
		project.open(null);
		java.nio.file.Path sourceFolder = folder.toPath();
		java.nio.file.Path destFolder = project.getLocation().toFile().toPath();

		Files.walk(sourceFolder).forEach(source -> {
			try {
				Files.copy(source, destFolder.resolve(sourceFolder.relativize(source)), StandardCopyOption.REPLACE_EXISTING);
			} catch (IOException e) {
				e.printStackTrace();
			}
		});
		project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
		return project;
	}
	return null;
}
 
源代码12 项目: APICloud-Studio   文件: EclipseUtil.java
public boolean accept(File dir, String name)
{
	IPath path = Path.fromOSString(dir.getAbsolutePath()).append(name);
	name = path.removeFileExtension().lastSegment();
	String ext = path.getFileExtension();
	if (Platform.OS_MACOSX.equals(Platform.getOS()))
	{
		if (!"app".equals(ext)) //$NON-NLS-1$
		{
			return false;
		}
	}
	for (String launcherName : LAUNCHER_NAMES)
	{
		if (launcherName.equalsIgnoreCase(name))
		{
			return true;
		}
	}
	return false;
}
 
源代码13 项目: elexis-3-core   文件: ExternalContributions.java
private static void instantiate(){
	IConfigurationElement[] config =
		Platform.getExtensionRegistry().getConfigurationElementsFor(
			Activator.PLUGIN_ID + ".ExternalMaintenance");
	if (config.length == 0)
		return;
	for (IConfigurationElement e : config) {
		try {
			Object o = e.createExecutableExtension("MaintenanceCode");
			if (o instanceof ExternalMaintenance) {
				ext.add((ExternalMaintenance) o);
			}
		} catch (CoreException e1) {
			Status status =
				new Status(IStatus.WARNING, Activator.PLUGIN_ID, e1.getLocalizedMessage());
			StatusManager.getManager().handle(status, StatusManager.SHOW);
		}
		
	}
	
}
 
源代码14 项目: gemfirexd-oss   文件: DerbyClasspathContainer.java
public DerbyClasspathContainer() {
    List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
    Bundle bundle = Platform.getBundle(CommonNames.CORE_PATH);
    Enumeration en = bundle.findEntries("/", "*.jar", true);
    String rootPath = null;
    try { 
        rootPath = FileLocator.resolve(FileLocator.find(bundle, new Path("/"), null)).getPath();
    } catch(IOException e) {
        Logger.log(e.getMessage(), IStatus.ERROR);
    }
    while(en.hasMoreElements()) {
        IClasspathEntry cpe = JavaCore.newLibraryEntry(new Path(rootPath+'/'+((URL)en.nextElement()).getFile()), null, null);
        entries.add(cpe);
    }    
    IClasspathEntry[] cpes = new IClasspathEntry[entries.size()];
    _entries = (IClasspathEntry[])entries.toArray(cpes);
}
 
源代码15 项目: eclipsegraphviz   文件: LogUtils.java
public static void log(Supplier<IStatus> statusSupplier) {
    IStatus status = statusSupplier.get();
    if (!Platform.isRunning()) {
        System.err.println(status.getMessage());
        if (status.getException() != null)
            status.getException().printStackTrace();
        if (status.isMultiStatus())
            for (IStatus child : status.getChildren())
                log(child);
        return;
    }
    Bundle bundle = Platform.getBundle(status.getPlugin());
    if (bundle == null) {
        String thisPluginId = LogUtils.class.getPackage().getName();
        bundle = Platform.getBundle(thisPluginId);
        Platform.getLog(bundle).log(
                new Status(IStatus.WARNING, thisPluginId, "Could not find a plugin " + status.getPlugin()
                        + " for logging as"));
    }
    Platform.getLog(bundle).log(status);
}
 
源代码16 项目: APICloud-Studio   文件: UIPlugin.java
private void updateInitialPerspectiveVersion()
{
	// updates the initial stored version so that user won't get a prompt on a new workspace
	boolean hasStartedBefore = Platform.getPreferencesService().getBoolean(PLUGIN_ID,
			IPreferenceConstants.IDE_HAS_LAUNCHED_BEFORE, false, null);
	if (!hasStartedBefore)
	{
		IEclipsePreferences prefs = (EclipseUtil.instanceScope()).getNode(PLUGIN_ID);
		prefs.putInt(IPreferenceConstants.PERSPECTIVE_VERSION, WebPerspectiveFactory.VERSION);
		prefs.putBoolean(IPreferenceConstants.IDE_HAS_LAUNCHED_BEFORE, true);
		try
		{
			prefs.flush();
		}
		catch (BackingStoreException e)
		{
			IdeLog.logError(getDefault(), Messages.UIPlugin_ERR_FailToSetPref, e);
		}
	}
}
 
源代码17 项目: tmxeditor8   文件: AbstractSelfHelpUI.java
private boolean useExternalBrowser(String url) {
	// On non Windows platforms, use external when modal window is displayed
	if (!Constants.OS_WIN32.equalsIgnoreCase(Platform.getOS())) {
		Display display = Display.getCurrent();
		if (display != null) {
			if (insideModalParent(display))
				return true;
		}
	}

	// Use external when no help frames are to be displayed, otherwise no
	// navigation buttons.
	if (url != null) {
		if (url.indexOf("?noframes=true") > 0 //$NON-NLS-1$
				|| url.indexOf("&noframes=true") > 0) { //$NON-NLS-1$
			return true;
		}
	}
	return false;
}
 
源代码18 项目: tracecompass   文件: GdbTrace.java
@Override
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> type) throws TmfTraceException {
    try {
        String tracedExecutable = resource.getPersistentProperty(EXEC_KEY);
        if (tracedExecutable == null) {
            throw new TmfTraceException(Messages.GdbTrace_ExecutableNotSet);
        }

        String defaultGdbCommand = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
                IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,
                IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT, null);

        fGdbTpRef = new DsfGdbAdaptor(this, defaultGdbCommand, path, tracedExecutable);
        fNbFrames = getNbFrames();
    } catch (CoreException e) {
        throw new TmfTraceException(Messages.GdbTrace_FailedToInitializeTrace, e);
    }

    super.initTrace(resource, path, type);
}
 
/**
 * Return the location for the project. If we are using defaults then return the workspace root so that core creates
 * it with default values.
 * 
 * @return String
 */
public String getProjectLocation()
{
	if (isDefault())
	{
		return Platform.getLocation().toOSString();
	}
	return locationPathField.getText();
}
 
源代码20 项目: APICloud-Studio   文件: PreferenceUtils.java
/**
 * @param direction
 *            indicates if this is for upload or download permissions
 * @return true if the new files and folders should update their permissions to specific permissions after
 *         transferring, false if they should maintain the source permissions
 */
public static boolean getSpecificPermissions(PermissionDirection direction)
{
	switch (direction)
	{
		case UPLOAD:
			return Platform.getPreferencesService().getBoolean(CoreIOPlugin.PLUGIN_ID,
					IPreferenceConstants.UPLOAD_SPECIFIC_PERMISSIONS, true, null);
		case DOWNLOAD:
			return Platform.getPreferencesService().getBoolean(CoreIOPlugin.PLUGIN_ID,
					IPreferenceConstants.DOWNLOAD_SPECIFIC_PERMISSIONS, true, null);
	}
	return true;
}
 
源代码21 项目: dawnsci   文件: PlottingFactory.java
@SuppressWarnings("unchecked")
private static final <T> IPlottingSystem<T> createPlottingSystem(final String plottingSystemId) throws CoreException {
	
       IConfigurationElement[] systems = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.dawnsci.plotting.api.plottingClass");
       for (IConfigurationElement ia : systems) {
		if (ia.getAttribute("id").equals(plottingSystemId)) return (IPlottingSystem<T>)ia.createExecutableExtension("class");
	}
	
       return null;
}
 
源代码22 项目: birt   文件: CategoryPageGenerator.java
public CategoryPageGenerator( )
{
	if ( factory == null )
	{
		factory = (ICategoryProviderFactory) Platform.getAdapterManager( )
				.getAdapter( this, ICategoryProviderFactory.class );
		if ( factory == null )
		{
			factory = CategoryProviderFactory.getInstance( );
		}
	}
}
 
源代码23 项目: thym   文件: HybridUI.java
public static List<PlatformImage> getPlatformImages(){
  	IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(PlatformImage.EXTENSION_POINT_ID);
  	List<PlatformImage> images = new ArrayList<PlatformImage>();
  	for (int i = 0; i < configurationElements.length; i++) {
	PlatformImage image = new PlatformImage(configurationElements[i]);
	images.add(image);
}
  	return images;
  }
 
源代码24 项目: http4e   文件: ResourceUtils.java
public static InputStream getBundleResourceStream2( String pluginID, String uri) throws IOException{
   if (Utils.isIDE()) {
      return FileLocator.openStream(Platform.getBundle(pluginID), new Path(uri), false);
   } else {
      return new FileInputStream(uri);
   }
}
 
/**
 * Creates a new project creation wizard page.
 *
 * @param pageName the name of this page
 */
public NewProjectNameAndLocationWizardPage(String pageName) {
    super(pageName);
    setTitle("PyDev Project");
    setDescription("Create a new PyDev Project.");
    setPageComplete(false);
    initialLocationFieldValue = Platform.getLocation();
    customLocationFieldValue = ""; //$NON-NLS-1$

    fWorkingSetGroup = new WorkingSetGroup();
    setWorkingSets(new IWorkingSet[0]);
}
 
源代码26 项目: ADT_Frontend   文件: AbapGitStagingLabelProvider.java
/**
 * Method to overlay an image with another
 */
private Image decorateImage(Image baseImage, String overlayImagePath) {
	Bundle bundle = Platform.getBundle(AbapGitUIPlugin.PLUGIN_ID);
	URL fullPathString = BundleUtility.find(bundle, overlayImagePath);
	DecorationOverlayIcon doi = new DecorationOverlayIcon(//
			baseImage, ImageDescriptor.createFromURL(fullPathString), IDecoration.BOTTOM_RIGHT);
	return doi.createImage();
}
 
源代码27 项目: APICloud-Studio   文件: BuildContext.java
protected IContentType[] getContentTypes() throws CoreException
{
	// TODO Cache this?
	IProject theProject = getProject();
	if (theProject != null)
	{
		IContentTypeMatcher matcher = theProject.getContentTypeMatcher();
		return matcher.findContentTypesFor(getName());
	}

	IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	if (ArrayUtil.isEmpty(projects))
	{
		return Platform.getContentTypeManager().findContentTypesFor(getName());
	}

	for (IProject project : projects)
	{
		try
		{
			IContentType[] type = project.getContentTypeMatcher().findContentTypesFor(getName());
			if (type != null)
			{
				return type;
			}
		}
		catch (CoreException e)
		{
			IdeLog.logError(IndexPlugin.getDefault(), e);
		}
	}
	return NO_CONTENT_TYPES;
}
 
源代码28 项目: tlaplus   文件: ToolboxIntroPart.java
@Override
public void widgetSelected(SelectionEvent se) {

	final String spec = (String) se.widget.getData(specKey);
	final String zip = (String) se.widget.getData(zipKey);

	final URL resource = StandaloneActivator.getDefault().getBundle().getResource(zip);
	final Location instanceLocation = Platform.getInstanceLocation();

	try {
		// Force-open the getting started guide that new users should read.
		final Map<String, String> params = new HashMap<>();
		params.put("org.lamport.tla.toolbox.doc.contents.param",
				"/org.lamport.tla.toolbox.doc/html/gettingstarted/gettingstarted.html");
		runCommand("org.lamport.tla.toolbox.doc.contents", params);
		
		// TODO If the zip is large, this will block the main/UI thread.
		final File destDir = ZipUtil.unzip(resource.openStream(),
				new File(instanceLocation.getURL().getFile() + File.separator + spec.replaceFirst(".tla$", "")),
				true);

		params.clear();
		params.put("toolbox.command.spec.new.param", destDir.getAbsolutePath() + File.separator + spec);
		runCommand("toolbox.command.spec.new", params);
		
	} catch (IOException ex) {
		StandaloneActivator.getDefault().logError(ex.getMessage(), ex);
	}
}
 
源代码29 项目: APICloud-Studio   文件: BuildPathManager.java
public void processElement(IConfigurationElement element)
{
	// get extension pt's bundle
	IExtension extension = element.getDeclaringExtension();
	String pluginId = extension.getNamespaceIdentifier();
	Bundle bundle = Platform.getBundle(pluginId);

	// grab the item's display name
	String name = element.getAttribute(ATTR_NAME);

	// get the item's URI, resolved to a local file
	String resource = element.getAttribute(ATTR_PATH);
	URL url = FileLocator.find(bundle, new Path(resource), null);

	// add item to master list
	URI localFileURI = ResourceUtil.resourcePathToURI(url);

	if (localFileURI != null)
	{
		addBuildPath(name, localFileURI);
	}
	else
	{
		// @formatter:off
		String message = MessageFormat.format(
			Messages.BuildPathManager_UnableToConvertURLToURI,
			url.toString(),
			ELEMENT_BUILD_PATH,
			BUILD_PATHS_ID,
			pluginId
		);
		// @formatter:on

		IdeLog.logError(BuildPathCorePlugin.getDefault(), message);
	}
}
 
源代码30 项目: tesb-studio-se   文件: WSDLPopulationUtilTest.java
/**
 * Test method for {@link org.talend.repository.services.utils.WSDLPopulationUtil#loadWSDL(java.lang.String)}.
 *
 * To validate an imported XSD/WSDL type files. TESB-19040
 */
@Test
public void testLoadWSDL() {
    Bundle b = Platform.getBundle("org.talend.esb.repository.services.test");
    try {
        URL url = FileLocator.toFileURL(FileLocator.find(b, new Path("resources"), null)); //$NON-NLS-1$
        WSDLPopulationUtil wsdlPopulationUtil = new WSDLPopulationUtil();
        wsdlPopulationUtil.loadWSDL("file://" + url.getPath() + "/client_wsdl/cliente-v1_1.wsdl");
        Assert.assertNotNull(wsdlPopulationUtil
                .getXSDSchemaFromNamespace("http://www.supervielle.com.ar/xsd/Integracion/common/commonTypes-v1"));
    } catch (IOException e) {
        e.printStackTrace();
        fail("Test testGetTemplateURL() method failure.");
    }
}