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


Java Plugin类代码示例

本文整理汇总了Java中org.eclipse.core.runtime.Plugin的典型用法代码示例。如果您正苦于以下问题:Java Plugin类的具体用法?Java Plugin怎么用?Java Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createLinkedProject

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
public IProject createLinkedProject(String projectName, Plugin plugin, IPath linkPath) throws CoreException {
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	IProject project = workspace.getRoot().getProject(projectName);

	IProjectDescription desc = workspace.newProjectDescription(projectName);
	File file = getFileInPlugin(plugin, linkPath);
	IPath projectLocation = new Path(file.getAbsolutePath());
	if (Platform.getLocation().equals(projectLocation))
		projectLocation = null;
	desc.setLocation(projectLocation);

	project.create(desc, NULL_MONITOR);
	if (!project.isOpen())
		project.open(NULL_MONITOR);

	return project;
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:18,代码来源:EclipseResourceHelper.java

示例2: disposePreferenceStoreListener

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
/**
 * Dispose the receiver.
 */
private void disposePreferenceStoreListener() {

	IEclipsePreferences root = (IEclipsePreferences) Platform
			.getPreferencesService().getRootNode().node(
					Plugin.PLUGIN_PREFERENCE_SCOPE);
	try {
		if (!(root.nodeExists(nodeQualifier))) {
			return;
		}
	} catch (BackingStoreException e) {
		return;// No need to report here as the node won't have the
		// listener
	}

	IEclipsePreferences preferences = getStorePreferences();
	if (preferences == null) {
		return;
	}
	if (preferencesListener != null) {
		preferences.removePreferenceChangeListener(preferencesListener);
		preferencesListener = null;
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:27,代码来源:ScopedPreferenceStore.java

示例3: resolve

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
public URI resolve(Object context, URI classpathUri) {
    if (context instanceof Plugin) {
        context = ((Plugin) context).getBundle();
    }
    if (!(context instanceof Bundle)) {
        throw new IllegalArgumentException("Context must implement Bundle");
    }
    Bundle bundle = (Bundle) context;
    try {
        if (ClasspathUriUtil.isClasspathUri(classpathUri)) {
            URI result = findResourceInBundle(bundle, classpathUri);
	if (classpathUri.fragment() != null)
		result = result.appendFragment(classpathUri.fragment());
	return result;
        }
    } catch (Exception exc) {
        throw new ClasspathUriResolutionException(exc);
    }
    return classpathUri;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:21,代码来源:BundleClasspathUriResolver.java

示例4: disposePreferenceStoreListener

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
/**
 * Dispose the preference store listener.
 */
private void disposePreferenceStoreListener() {

	IEclipsePreferences root = (IEclipsePreferences) Platform
			.getPreferencesService().getRootNode().node(
					Plugin.PLUGIN_PREFERENCE_SCOPE);
	try {
		if (!(root.nodeExists(nodeQualifier))) {
			return;
		}
	} catch (BackingStoreException e) {
		return;// No need to report here as the node won't have the
		// listener
	}

	IEclipsePreferences preferences = getStorePreferences();
	if (preferences == null) {
		return;
	}
	if (preferencesListener != null) {
		preferences.removePreferenceChangeListener(preferencesListener);
		preferencesListener = null;
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:27,代码来源:FixedScopedPreferenceStore.java

示例5: extractJar

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
protected static void extractJar(
    Plugin plugin, String pathInPluginJar, String pathInStateLocation)
    throws IOException {
  IPath pluginStateLocation = plugin.getStateLocation();
  File fileInStateLocation = pluginStateLocation.append(
      pathInStateLocation).toFile();
  fileInStateLocation.delete();

  FileOutputStream os = null;
  InputStream is = FileLocator.openStream(
      plugin.getBundle(), new Path(pathInPluginJar), false);

  try {
    os = new FileOutputStream(fileInStateLocation);

    byte[] buf = new byte[2048];
    int bytesRead = 0;
    while ((bytesRead = is.read(buf)) != -1) {
      os.write(buf, 0, bytesRead);
    }
  } finally {
    closeStreams(is, os);
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:AbstractGwtPlugin.java

示例6: flushCache

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
/**
 * Flushes any cached logging messages
 */
public static void flushCache()
{
	caching = false;

	for (Map.Entry<Plugin, List<IStatus>> entry : earlyMessageCache.entrySet())
	{
		for (IStatus status : entry.getValue())
		{
			StatusLevel severity = getStatusLevel(status.getSeverity());
			if (status.getSeverity() == IStatus.ERROR || isOutputEnabled(entry.getKey(), severity, null))
			{
				log(entry.getKey(), status.getSeverity(), status.getMessage(), null, status.getException());
			}
		}
	}

	earlyMessageCache.clear();
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:22,代码来源:IdeLog.java

示例7: isOutputEnabled

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
/**
 * Are we currently outputting items of this severity and this scope? Use this method if you want to check before
 * actually composing an error message.
 * 
 * @return
 */
public static boolean isOutputEnabled(Plugin plugin, StatusLevel severity, String scope)
{
	if (!isSeverityEnabled(severity))
	{
		return false;
	}
	try
	{
		if (!Platform.inDebugMode())
		{
			return true;
		}
	}
	catch (Exception e)
	{
		// ignore. May happen if we're running unit tests outside IDE
	}

	return isScopeEnabled(scope);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:27,代码来源:IdeLog.java

示例8: buildMessage

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
/**
 * Constructs the message to log
 * 
 * @param plugin
 * @param severity
 * @param message
 * @param scope
 * @param th
 * @return
 */
public static String buildMessage(Plugin plugin, int severity, String message, String scope, Throwable th)
{
	if (scope == null)
	{
		scope = StringUtil.EMPTY;
	}

	String version;
	if (EclipseUtil.isStandalone())
	{
		version = EclipseUtil.getProductVersion();
	}
	else
	{
		version = EclipseUtil.getStudioVersion();
	}
	return MessageFormat.format("(Build {0}) {1} {2} {3}", //$NON-NLS-1$
			version, getLabel(severity), scope, message);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:30,代码来源:IdeLog.java

示例9: findTestData

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
/**
 * Finds a URL for test data checked into a local data-test directory.
 * Should work if Run As a JUnit Test or JUnit Plugin Test,
 * as well as Bamboo.  (For Bamboo, remember to check the box for the data-test folder
 * in the plugin's build.xml editor)
 * @param yourPlugin -- use something like Activator.getDefault()
 * @param filePath -- e.g. "data-test/foo.xml" (use slash URL separator, not platform-specific File.separator).
 * @return URL (hint: call openStream)
 * @throws FileNotFoundException
 * @see SharedTestData for large data files you don't want checked out and delivered with the product
 */
public static URL findTestData(Plugin yourPlugin, String filePath) throws FileNotFoundException {
	URL url;
	try {
		if (yourPlugin==null) {
			url = new File(filePath).toURI().toURL();
		} else {
			url = FileLocator.find(yourPlugin.getBundle(),
					new Path(filePath),
					null);
		}
	} catch (IOException e) {
		throw(new FileNotFoundException(filePath + " (" + e.toString() + ")"));
	}
	if (url==null) {
		throw new FileNotFoundException("Can't find URL " + filePath);
	}
	return url;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:30,代码来源:TestUtil.java

示例10: listURLContents

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
/**
 * @param yourPlugin -- use something like Activator.getDefault()
 * @param directoryPath -- e.g. "data-test/" (use slash URL separator, not platform-specific File.separator).
 * @return Listing of directory as a List of URLs.
 * @throws FileNotFoundException
 * @see SharedTestData for large data files you don't want checked out and delivered with the product
 */
public static List<URL> listURLContents(Plugin yourPlugin, String directoryPath) throws FileNotFoundException {
	List<URL> toRet = new ArrayList<URL>();
	if (yourPlugin == null) {
		File dirFile = new File(directoryPath);
		for (File child : dirFile.listFiles()) {
			try {
				toRet.add(child.toURI().toURL());
			} catch (MalformedURLException e) {
				throw(new FileNotFoundException(directoryPath + " (" + e.toString() + ")"));
			}
		}
	} else {
		Bundle bundle = yourPlugin.getBundle();
		Enumeration entryPaths = bundle.getEntryPaths(directoryPath);
		while (entryPaths.hasMoreElements()) {
			String entryPath = (String) entryPaths.nextElement();
			toRet.add(bundle.getEntry(entryPath));
		}
	}
	return toRet;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:29,代码来源:TestUtil.java

示例11: getPlugin

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
/**
 * Gets the plugin based on the project
 * @param project Project to look for the language plugin for
 * @return Language plugin for the current project
 */
public Plugin getPlugin(IScriptProject project) {
    String ssVersion=CorePreferencesSupport.getInstance().getProjectSpecificPreferencesValue(SilverStripePreferences.SILVERSTRIPE_VERSION, SilverStripeVersion.getDefaultVersion(), project.getProject());
    
    IConfigurationElement languageProvider=SilverStripeVersion.getLanguageDefinition(ssVersion);
    if(languageProvider!=null) {
        Object o;
        try {
            o = languageProvider.createExecutableExtension("activator");
            if(o instanceof AbstractUIPlugin) {
                return (AbstractUIPlugin) o;
            }
        } catch (CoreException e) {
            e.printStackTrace();
        }
    }
    
    return SilverStripePDTPlugin.getDefault();
}
 
开发者ID:UndefinedOffset,项目名称:eclipse-silverstripedt,代码行数:24,代码来源:DefaultLanguageModelProvider.java

示例12: createLinkedFile

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
public IFile createLinkedFile(IContainer container, IPath linkPath, Plugin plugin, IPath linkedFileTargetPath)
		throws CoreException {
	File file = getFileInPlugin(plugin, linkedFileTargetPath);
	IFile iFile = container.getFile(linkPath);
	iFile.createLink(new Path(file.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
	return iFile;
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:8,代码来源:EclipseResourceHelper.java

示例13: createLinkedFolder

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
public IFolder createLinkedFolder(IContainer container, IPath linkPath, Plugin plugin, IPath linkedFolderTargetPath)
		throws CoreException {
	File file = getFileInPlugin(plugin, linkedFolderTargetPath);
	IFolder iFolder = container.getFolder(linkPath);
	iFolder.createLink(new Path(file.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
	return iFolder;
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:8,代码来源:EclipseResourceHelper.java

示例14: getFileInPlugin

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
public File getFileInPlugin(Plugin plugin, IPath path) throws CoreException {
	try {
		URL installURL = plugin.getBundle().getEntry(path.toString());
		URL localURL = FileLocator.toFileURL(installURL);
		return new File(localURL.getFile());
	} catch (IOException e) {
		throw new PathException(IStatus.ERROR, path, "cannot get file in plugin", e);
	}
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:10,代码来源:EclipseResourceHelper.java

示例15: writeToPrefs

import org.eclipse.core.runtime.Plugin; //导入依赖的package包/类
public static void writeToPrefs( String prefName, byte[] prefData){
   try {
      Plugin pl = (Plugin) CoreContext.getContext().getObject("p");
      Preferences prefs = pl.getPluginPreferences();

      String str64 = new String(Base64.encodeBase64(prefData), "UTF8");
      prefs.setValue(prefName, str64);
      pl.savePluginPreferences();

   } catch (UnsupportedEncodingException e) {
      ExceptionHandler.handle(e);
   } catch (Exception ignore) {
      ExceptionHandler.handle(ignore);
   }
}
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:16,代码来源:BaseUtils.java


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