本文整理汇总了Java中org.eclipse.pde.core.plugin.IPluginModelBase类的典型用法代码示例。如果您正苦于以下问题:Java IPluginModelBase类的具体用法?Java IPluginModelBase怎么用?Java IPluginModelBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IPluginModelBase类属于org.eclipse.pde.core.plugin包,在下文中一共展示了IPluginModelBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
@Override
public void execute ( final IProject project, final IPluginModelBase model, final IProgressMonitor monitor ) throws CoreException
{
monitor.beginTask ( "Creating client", 5 );
super.execute ( project, model, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
final Map<String, String> properties = new HashMap<> ();
properties.put ( "pluginId", this.pluginId ); //$NON-NLS-1$
properties.put ( "version", this.version ); //$NON-NLS-1$
properties.put ( "mavenVersion", this.version.replaceFirst ( "\\.qualifier$", "-SNAPSHOT" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
createParentProject ( project, properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
createProductProject ( project, properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
createFeatureProject ( project, properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
addFilteredResource ( project, "pom.xml", getResource ( "app-pom.xml" ), "UTF-8", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
}
示例2: split
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
private void split ( final Map<String, Bundle> all, final Set<Bundle> targetResult, final Set<Bundle> workspaceResult )
{
final Set<IPluginModelBase> workspaceSet = new HashSet<> ( Arrays.asList ( PluginRegistry.getWorkspaceModels () ) );
for ( final Bundle b : all.values () )
{
final IPluginModelBase model = PluginRegistry.findModel ( b.name );
if ( workspaceSet.contains ( model ) )
{
workspaceResult.add ( b );
}
else
{
targetResult.add ( b );
}
}
}
示例3: createExtension
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
/**
* Creates the extension. Note that the <code>id</code> attribute is optional and thus not created.
*
* @param catalog
* the catalog for which to crate the extension content.
* @param extensionId
* the extension id, may be <code>null</code>
* @param pluginModel
* the model
* @return the plugin extension
* @throws CoreException
* a core exception
*/
protected IPluginExtension createExtension(final CheckCatalog catalog, final String extensionId, final IPluginModelBase pluginModel) throws CoreException {
IPluginExtension newExtension = pluginModel.getFactory().createExtension();
newExtension.setPoint(getExtensionPointId());
if (extensionId != null) {
newExtension.setId(extensionId);
}
if (getExtensionPointName(catalog) != null) {
newExtension.setName(getExtensionPointName(catalog));
}
// Add contents to the extension
for (final IPluginObject p : getElements(catalog, newExtension)) {
newExtension.add(p);
}
return newExtension;
}
示例4: findExtensions
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
/**
* Finds extensions of given {@link ExtensionType extension type} in given {@link IPluginModelBase plugin model}.
* If {@code type} is {@link ExtensionType#ALL}, all extensions which may be mapped to {@link ExtensionType} are
* returned. (They must have an ID pattern as defined in {@link #getExtensionId(CheckCatalog, ExtensionType)}).
*
* @param pluginModel
* the plugin in which to find the extensions
* @param catalogName
* qualified catalog name
* @param type
* the extension type to be looked up
* @return a collection of extensions in the plugin.xml that match given extension type
*/
private Collection<IPluginExtension> findExtensions(final IPluginModelBase pluginModel, final QualifiedName catalogName, final ExtensionType type) {
IPluginExtension[] pluginExtensions = pluginModel.getPluginBase().getExtensions();
final String extensionId = getExtensionId(catalogName, type);
final String point = getExtensionHelper(type) == null ? null : getExtensionHelper(type).getExtensionPointId();
return Collections2.filter(Arrays.asList(pluginExtensions), new Predicate<IPluginExtension>() {
@Override
public boolean apply(final IPluginExtension extension) {
final String currentExtensionId = extension.getId();
if (type == ExtensionType.ALL) {
if (currentExtensionId == null) {
return getAllExtensionPointIds().contains(extension.getPoint());
} else {
final int pos = currentExtensionId.lastIndexOf('.');
return pos != -1 && getAllExtensionPointIds().contains(extension.getPoint()) && Strings.equal(currentExtensionId.substring(0, pos), extensionId);
}
} else {
return Strings.equal(currentExtensionId, extensionId) && Strings.equal(extension.getPoint(), point);
}
}
});
}
示例5: updateExtensions
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
/**
* Update check catalog extensions if necessary.
*
* @param catalog
* the catalog
* @param pluginModel
* the plugin model
* @param monitor
* the monitor
* @throws CoreException
* the core exception
*/
public void updateExtensions(final CheckCatalog catalog, final IPluginModelBase pluginModel, final IProgressMonitor monitor) throws CoreException {
QualifiedName catalogName = nameProvider.apply(catalog);
Collection<IPluginExtension> catalogExtensions = findExtensions(pluginModel, catalogName, ExtensionType.ALL);
// Update extensions as appropriate
for (IPluginExtension extension : catalogExtensions) {
if (!hasGrammar(catalog)) {
pluginModel.getPluginBase().remove(extension); // no extensions for Catalogs without valid grammar
continue; // nothing more to do if no grammar is available
} else {
for (ICheckExtensionHelper helper : getExtensionHelpers()) { // TODO getExtensionHelper using extension.getPoint() would make this more efficient
helper.updateExtension(catalog, extension);
}
}
}
}
示例6: addExtensions
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
/**
* Add check catalog extensions if not already existing.
*
* @param catalog
* the catalog
* @param pluginModel
* the plugin model
* @param monitor
* the monitor
* @throws CoreException
* the core exception
*/
public void addExtensions(final CheckCatalog catalog, final IPluginModelBase pluginModel, final IProgressMonitor monitor) throws CoreException {
QualifiedName catalogName = nameProvider.apply(catalog);
Collection<IPluginExtension> catalogExtensions = findExtensions(pluginModel, catalogName, ExtensionType.ALL);
Iterable<ExtensionType> registeredExtensionTypes = findExtensionTypes(catalogExtensions);
if (hasGrammar(catalog)) {
for (ExtensionType type : ExtensionType.values()) {
ICheckExtensionHelper helper = getExtensionHelper(type);
if (helper == null) {
continue;
}
if (!Iterables.contains(registeredExtensionTypes, type)) {
helper.addExtensionToPluginBase(pluginModel, catalog, type, getExtensionId(nameProvider.apply(catalog), type));
}
}
}
}
示例7: sortAllExtensions
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
/**
* Sorts the plug-in extensions alphabetically by extension point ID and then by extension ID (and name in case the IDs are equal or null).
*
* @param pluginModel
* the plugin model
* @param monitor
* the monitor
* @throws CoreException
* the core exception
*/
public void sortAllExtensions(final IPluginModelBase pluginModel, final IProgressMonitor monitor) throws CoreException {
Ordering<IPluginExtension> ordering = Ordering.from((a, b) -> ComparisonChain.start().compare(a.getPoint(), b.getPoint()).compare(a.getId(), b.getId(), Ordering.natural().nullsLast()).compare(a.getName(), b.getName(), Ordering.natural().nullsLast()).result());
List<IPluginExtension> catalogExtensions = Lists.newArrayList(findAllExtensions(pluginModel));
List<IPluginExtension> orderedExtensions = ordering.sortedCopy(catalogExtensions);
if (catalogExtensions.equals(orderedExtensions)) {
return;
}
for (int i = 0; i < orderedExtensions.size(); i++) {
IPluginExtension expected = orderedExtensions.get(i);
IPluginExtension actual = catalogExtensions.get(i);
if (!Objects.equals(actual, expected)) {
// IExtensions#swap() doesn't work; see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506831
// pluginModel.getExtensions().swap(expected, actual);
for (int j = i; j < catalogExtensions.size(); j++) {
pluginModel.getExtensions().remove(catalogExtensions.get(j));
}
for (int j = i; j < orderedExtensions.size(); j++) {
pluginModel.getExtensions().add(orderedExtensions.get(j));
}
break;
}
}
}
示例8: handleOpen
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
private void handleOpen() {
for (Object selection : getViewerSelection()) {
IFeatureModel featureModel = FeatureSupport.toFeatureModel(selection);
if (featureModel != null) {
FeatureEditor.openFeatureEditor(featureModel);
continue;
}
IPluginModelBase pluginModel = PluginSupport.toPluginModel(selection);
if (pluginModel != null) {
ManifestEditor.openPluginEditor(pluginModel);
continue;
}
IProductModel productModel = ProductSupport.toProductModel(selection);
if (productModel != null) {
ProductSupport.openProductEditor(productModel);
}
}
}
示例9: handleRename
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
private void handleRename() {
IFeatureModel selectedFeatureModel = getSelectedEditableFeatureModel();
if (selectedFeatureModel != null) {
RefactoringSupport.renameFeature(selectedFeatureModel, getSite().getShell());
}
IPluginModelBase selectedPluginModel = getSelectedEditablePluginModel();
if (selectedPluginModel != null) {
RefactoringSupport.renamePlugin(selectedPluginModel, getSite().getShell());
}
IProductModel selectedProductModel = getSelectedEditableProductModel();
if (selectedProductModel != null) {
RefactoringSupport.renameProduct(selectedProductModel, getSite().getShell());
}
}
示例10: runWithEvent
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
@Override
public void runWithEvent(Event event) {
ISelection selection = selectionProvider.getSelection();
Collection<IProductModel> productModels = ProductSupport.toProductModels(selection);
Collection<IFeatureModel> featureModels = FeatureSupport.toFeatureModels(selection);
Collection<IPluginModelBase> pluginModels = PluginSupport.toPluginModels(selection);
Collection<IProject> projects = new HashSet<IProject>();
addUnderlyingResources(projects, productModels);
addUnderlyingResources(projects, featureModels);
addUnderlyingResources(projects, pluginModels);
String[] fileData = new String[projects.size()];
int i = 0;
for (IProject project : projects) {
fileData[i++] = project.getLocation().toOSString();
}
String textData = getTextData(productModels, featureModels, pluginModels);
Object[] data = { projects.toArray(new IResource[projects.size()]), textData, fileData };
Transfer[] dataTypes = { ResourceTransfer.getInstance(), TextTransfer.getInstance(), FileTransfer.getInstance() };
clipboard.setContents(data, dataTypes);
}
示例11: getTextData
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
private String getTextData(Collection<IProductModel> productModels, Collection<IFeatureModel> featureModels,
Collection<IPluginModelBase> pluginModels) {
StringBuilder textData = new StringBuilder();
for (IProductModel productModel : productModels) {
textData.append(productModel.getProduct().getId());
textData.append("\n");
}
for (IFeatureModel featureModel : featureModels) {
textData.append(featureModel.getFeature().getId());
textData.append("\n");
}
for (IPluginModelBase pluginModel : pluginModels) {
textData.append(pluginModel.getPluginBase().getId());
textData.append("\n");
}
return textData.toString();
}
示例12: addIncludedPlugins
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
public static void addIncludedPlugins(final IFeatureModel parentModel,
final Collection<IPluginModelBase> pluginModelsToInclude) {
SafeRunnable.run(new SafeRunnable() {
@Override
public void run() throws Exception {
IFeature feature = parentModel.getFeature();
Collection<IFeaturePlugin> includes = new TreeSet<IFeaturePlugin>(IDENTIFIABLE_COMPARATOR);
includes.addAll(Arrays.asList(feature.getPlugins()));
feature.removePlugins(feature.getPlugins());
for (IPluginModelBase pluginModelToInclude : pluginModelsToInclude) {
includes.add(createInclude(parentModel, pluginModelToInclude));
}
feature.addPlugins(includes.toArray(new IFeaturePlugin[includes.size()]));
((IEditableModel) parentModel).save();
}
});
}
示例13: renamePlugin
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
public static void renamePlugin(final IPluginModelBase pluginModel, final String newName) {
/*
* Wait until the plugin model has been updated post-project-rename so
* that it isn't stale.
*/
final PluginModelManager modelManager = PluginSupport.getManager();
modelManager.addPluginModelListener(new IPluginModelListener() {
@Override
public void modelsChanged(PluginModelDelta delta) {
IPluginModelBase replacement = getReplacement(delta, pluginModel);
if (replacement != null) {
internalRenamePlugin(replacement, newName);
modelManager.removePluginModelListener(this);
}
}
});
IProject project = getProject(pluginModel);
renameProject(project, newName);
}
示例14: getReplacement
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
private static IPluginModelBase getReplacement(PluginModelDelta delta, IPluginModelBase pluginModel) {
boolean foundRemoved = false;
for (ModelEntry removed : delta.getRemovedEntries()) {
if (removed.getId().equals(pluginModel.getPluginBase().getId())) {
foundRemoved = true;
}
}
if (foundRemoved) {
for (ModelEntry added : delta.getAddedEntries()) {
if (added.getId().equals(pluginModel.getPluginBase().getId())) {
return added.getModel();
}
}
}
return null;
}
示例15: internalRenamePlugin
import org.eclipse.pde.core.plugin.IPluginModelBase; //导入依赖的package包/类
public static void internalRenamePlugin(final IPluginModelBase pluginModel, final String newName) {
Job renamePluginJob = new WorkspaceJob("Renaming Plugin") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
// rename plugin
setPluginId(pluginModel, newName);
// update references
String oldName = pluginModel.getPluginBase().getId();
updatePluginReferences(oldName, newName);
return Status.OK_STATUS;
}
};
renamePluginJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
renamePluginJob.schedule();
}