Java Code Examples for org.eclipse.pde.core.plugin.IPluginModelBase#getUnderlyingResource()

The following examples show how to use org.eclipse.pde.core.plugin.IPluginModelBase#getUnderlyingResource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReportLauncherUtils.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private static String getOSGiPath( )
{
	ModelEntry entry = PDECore.getDefault( )
			.getModelManager( )
			.findEntry( "org.eclipse.osgi" ); //$NON-NLS-1$
	if ( entry != null && entry.getActiveModels( ).length > 0 )
	{
		IPluginModelBase model = entry.getActiveModels( )[0];
		if ( model.getUnderlyingResource( ) != null )
		{
			return model.getUnderlyingResource( )
					.getLocation( )
					.removeLastSegments( 2 )
					.toOSString( );
		}
		return model.getInstallLocation( );
	}
	return null;
}
 
Example 2
Source File: ScriptDebugUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @param model
 * @param libraryName
 * @return
 */
public static IPath getPath( IPluginModelBase model, String libraryName )
{
	IResource resource = model.getUnderlyingResource( );
	if ( resource != null )
	{
		IResource jarFile = resource.getProject( ).findMember( libraryName );
		return ( jarFile != null ) ? jarFile.getFullPath( ) : null;
	}
	File file = new File( model.getInstallLocation( ), libraryName );
	return file.exists( ) ? new Path( file.getAbsolutePath( ) ) : null;
}
 
Example 3
Source File: ReportAdvancedLauncherTab.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param model
 * @param checked
 */
// should update later
private void handleCheckStateChanged( IPluginModelBase model,
		boolean checked )
{
	if ( model.getUnderlyingResource( ) == null )
	{
		if ( checked )
		{
			fNumExternalChecked += 1;
		}
		else
		{
			fNumExternalChecked -= 1;
		}
	}
	else
	{
		if ( model instanceof IProject )
		{
			try
			{
				if ( ( (IProject) model ).hasNature( REPORTPROJECTKID ) )
				{
					fNumWorkspaceBIRTChecked += checked ? 1 : -1;
				}
				else if ( ( (IProject) model ).hasNature( JavaCore.NATURE_ID ) )
				{
					fNumWorkspaceJavaChecked += checked ? 1 : -1;
				}
			}
			catch ( CoreException e )
			{
				logger.log( Level.SEVERE, e.getMessage( ), e );
			}

			fNumWorkspaceChecked = fNumWorkspaceBIRTChecked
					+ fNumWorkspaceJavaChecked;

		}
	}
	adjustGroupState( );
}