zoukankan      html  css  js  c++  java
  • Eclipse Common API

    Platform runtime

    Defines the extension point and plug-in model. It dynamically discovers plug-ins and maintains information about the plug-ins and their extension points in a platform registry. Plug-ins are started up when required according to user operation of the platform. The runtime is implemented using the OSGi framework.

    Resource management (workspace)

    Defines API for creating and managing resources (projects, files, and folders) that are produced by tools and kept in the file system.

    Workbench UI

    Implements the user cockpit for navigating the platform. It defines extension points for adding UI components such as views or menu actions.  It supplies additional toolkits (JFace and SWT) for building user interfaces. The UI services are structured so that a subset of the UI plug-ins can be used to build rich client applications that are independent of the resource management and workspace model. IDE-centric plug-ins define additional functionality for navigating and manipulating resources.

    Help system

    Defines extension points for plug-ins to provide help or other documentation as browsable books.

    Team support

    Defines a team programming model for managing and versioning resources. 

    Debug support

    Defines a language independent debug model and UI classes for building debuggers and launchers.

    Other utilities

    Other utility plug-ins supply functionality such as searching and comparing resources, performing builds using XML configuration files, and dynamically updating the platform from a server.
    • PlatformUI
    • 1 public static IWorkbench getWorkbench() {
      2         if (Workbench.getInstance() == null) {
      3             // app forgot to call createAndRunWorkbench beforehand
      4             throw new IllegalStateException(WorkbenchMessages.PlatformUI_NoWorkbench); 
      5         }
      6         return Workbench.getInstance();
      7     }
    • 1 public static Display createDisplay() {
      2         return Workbench.createDisplay();
      3 }
      1 public static IPreferenceStore getPreferenceStore() {
      2         return PrefUtil.getAPIPreferenceStore();
      3  }
    • IWorkbench
    •  1 public interfaceIWorkbench extends IAdaptable, IServiceLocator {
       2     public Display getDisplay();
       3     public IProgressService getProgressService();
       4     public void addWorkbenchListener(IWorkbenchListener listener);
       5     public void removeWorkbenchListener(IWorkbenchListener listener);
       6     public void addWindowListener(IWindowListener listener);
       7     public void removeWindowListener(IWindowListener listener);
       8     public boolean close();
       9     public IWorkbenchWindow getActiveWorkbenchWindow();
      10     public IEditorRegistry getEditorRegistry();
      11     public IWorkbenchOperationSupport getOperationSupport();
      12     public IPerspectiveRegistry getPerspectiveRegistry();
      13     public PreferenceManager getPreferenceManager();
      14     public IPreferenceStore getPreferenceStore();
      15     public ISharedImages getSharedImages();
      16     public int getWorkbenchWindowCount();
      17     public IWorkbenchWindow[] getWorkbenchWindows();
      18     public IWorkingSetManager getWorkingSetManager();
      19     public ILocalWorkingSetManager createLocalWorkingSetManager();
      20     public IWorkbenchWindow openWorkbenchWindow(String perspectiveId,
      21             IAdaptable input) throws WorkbenchException;
      22     public IWorkbenchWindow openWorkbenchWindow(IAdaptable input)
      23             throws WorkbenchException;
      24     public boolean restart();
      25     public IWorkbenchPage showPerspective(String perspectiveId,
      26             IWorkbenchWindow window) throws WorkbenchException;
      27     public IWorkbenchPage showPerspective(String perspectiveId,
      28             IWorkbenchWindow window, IAdaptable input)
      29             throws WorkbenchException;
      30     public IDecoratorManager getDecoratorManager();
      31     public boolean saveAllEditors(boolean confirm);
      32     public IElementFactory getElementFactory(String factoryId);
      33     IWorkbenchActivitySupport getActivitySupport();
      34     IWorkbenchCommandSupport getCommandSupport();
      35     IWorkbenchContextSupport getContextSupport();
      36     public IThemeManager getThemeManager();
      37     public IIntroManager getIntroManager();
      38     public IWorkbenchHelpSystem getHelpSystem();
      39     public IWorkbenchBrowserSupport getBrowserSupport();
      40     public boolean isStarting();
      41     public boolean isClosing();
      42     public IExtensionTracker getExtensionTracker();
      43     public IViewRegistry getViewRegistry();
      44     public IWizardRegistry getNewWizardRegistry();
      45     public IWizardRegistry getImportWizardRegistry();
      46     public IWizardRegistry getExportWizardRegistry();
      47     public boolean saveAll(IShellProvider shellProvider,
      48             IRunnableContext runnableContext, ISaveableFilter filter,
      49             boolean confirm);
      50     public IShellProvider getModalDialogShellProvider();
      51 }
    • IWorkbenchWindow
    •  1 public interfaceIWorkbenchWindow extends IPageService, IRunnableContext,
       2         IServiceLocator, IShellProvider {
       3     public boolean close();
       4     public IWorkbenchPage getActivePage();
       5     public IWorkbenchPage[] getPages();
       6     public IPartService getPartService();
       7     public ISelectionService getSelectionService();
       8     public Shell getShell();
       9     public IWorkbench getWorkbench();
      10     public boolean isApplicationMenu(String menuId);
      11     public IWorkbenchPage openPage(String perspectiveId, IAdaptable input)
      12             throws WorkbenchException;
      13     public IWorkbenchPage openPage(IAdaptable input) throws WorkbenchException;
      14     public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException;
      15     public void setActivePage(IWorkbenchPage page);
      16     public IExtensionTracker getExtensionTracker();
      17 }
    • Platform
    •   1 public final class Platform {
        2     public static final String PI_RUNTIME = "org.eclipse.core.runtime";
        3     public static final String PT_APPLICATIONS = "applications";
        4     public static final String PT_ADAPTERS = "adapters";
        5     public static final String PT_PREFERENCES =  "preferences"; 
        6     public static final String PT_PRODUCT = "products"; 
        7     public static final String OPTION_STARTTIME = PI_RUNTIME + "/starttime";
        8     public static final String PREF_PLATFORM_PERFORMANCE = "runtime.performance";
        9     public static final String PREF_LINE_SEPARATOR = "line.separator"; 
       10     public static final int MIN_PERFORMANCE = 1;
       11     public static final int MAX_PERFORMANCE = 5;
       12     public static final int PARSE_PROBLEM = 1;
       13     public static final int PLUGIN_ERROR = 2;
       14     public static final int INTERNAL_ERROR = 3;
       15     public static final int FAILED_READ_METADATA = 4;
       16     public static final int FAILED_WRITE_METADATA = 5;
       17     public static final int FAILED_DELETE_METADATA = 6;
       18     public static final String OS_WIN32 = "win32";
       19     public static final String OS_LINUX = "linux";
       20     public static final String OS_AIX = "aix";//$NON-NLS-1$
       21     ..............
       22     private Platform() {
       23         super();
       24     }
       25     public static IAdapterManager getAdapterManager() {
       26         return InternalPlatform.getDefault().getAdapterManager();
       27     }
       28 
       29     public static String[] getCommandLineArgs() {
       30         return InternalPlatform.getDefault().getCommandLineArgs();
       31     }
       32     public static IContentTypeManager getContentTypeManager() {
       33         return InternalPlatform.getDefault().getContentTypeManager();
       34     }
       35     public static String getDebugOption(String option) {
       36         return InternalPlatform.getDefault().getOption(option);
       37     }
       38     public static IPath getLocation() throws IllegalStateException {
       39         return InternalPlatform.getDefault().getLocation();
       40     }
       41     public static IPath getLogFileLocation() {
       42         return InternalPlatform.getDefault().getMetaArea().getLogLocation();
       43     }
       44     public static Plugin getPlugin(String id) {
       45         try {
       46             IPluginRegistry registry = getPluginRegistry();
       47             if (registry == null)
       48                 throw new IllegalStateException();
       49             IPluginDescriptor pd = registry.getPluginDescriptor(id);
       50             if (pd == null)
       51                 return null;
       52             return pd.getPlugin();
       53         } catch (CoreException e) {
       54             // TODO log the exception
       55         }
       56         return null;
       57     }
       58     public static IPluginRegistry getPluginRegistry() {
       59         Bundle compatibility = InternalPlatform.getDefault().getBundle(CompatibilityHelper.PI_RUNTIME_COMPATIBILITY);
       60         if (compatibility == null)
       61             throw new IllegalStateException();
       62 
       63         Class oldInternalPlatform = null;
       64         try {
       65             oldInternalPlatform = compatibility.loadClass("org.eclipse.core.internal.plugins.InternalPlatform"); //$NON-NLS-1$
       66             Method getPluginRegistry = oldInternalPlatform.getMethod("getPluginRegistry", null); //$NON-NLS-1$
       67             return (IPluginRegistry) getPluginRegistry.invoke(oldInternalPlatform, null);
       68         } catch (Exception e) {
       69             //Ignore the exceptions, return null
       70         }
       71         return null;
       72 
       73     }
       74     public static void removeLogListener(ILogListener listener) {
       75         InternalPlatform.getDefault().removeLogListener(listener);
       76     }
       77     public static IExtensionRegistry getExtensionRegistry() {
       78         return RegistryFactory.getRegistry();
       79     }
       80     public static IPath getStateLocation(Bundle bundle) {
       81         return InternalPlatform.getDefault().getStateLocation(bundle);
       82     }
       83     public static long getStateStamp() {
       84         return InternalPlatform.getDefault().getStateTimeStamp();
       85     }
       86     public static ILog getLog(Bundle bundle) {
       87         return InternalPlatform.getDefault().getLog(bundle);
       88     }
       89     public static ResourceBundle getResourceBundle(Bundle bundle) throws MissingResourceException {
       90         return InternalPlatform.getDefault().getResourceBundle(bundle);
       91     }
       92     public static String getResourceString(Bundle bundle, String value) {
       93         return InternalPlatform.getDefault().getResourceString(bundle, value);
       94     }
       95     public static String getResourceString(Bundle bundle, String value, ResourceBundle resourceBundle) {
       96         return InternalPlatform.getDefault().getResourceString(bundle, value, resourceBundle);
       97     }
       98     public static String getOSArch() {
       99         return InternalPlatform.getDefault().getOSArch();
      100     }
      101     public static String getNL() {
      102         return InternalPlatform.getDefault().getNL();
      103     }
      104     public static String getNLExtensions() {
      105         return InternalPlatform.getDefault().getNLExtensions();
      106     }
      107     public static String getOS() {
      108         return InternalPlatform.getDefault().getOS();
      109     }
      110     public static String getWS() {
      111         return InternalPlatform.getDefault().getWS();
      112     }ring[] getApplicationArgs() {
      113         return InternalPlatform.getDefault().getApplicationArgs();
      114     }
      115     public static PlatformAdmin getPlatformAdmin() {
      116         return InternalPlatform.getDefault().getPlatformAdmin();
      117     }
      118     public static Location getInstanceLocation() {
      119         return InternalPlatform.getDefault().getInstanceLocation();
      120     }
      121     public static IBundleGroupProvider[] getBundleGroupProviders() {
      122         return InternalPlatform.getDefault().getBundleGroupProviders();
      123     }tic IPreferencesService getPreferencesService() {
      124         return InternalPlatform.getDefault().getPreferencesService();
      125     }
      126     public static IProduct getProduct() {
      127         return InternalPlatform.getDefault().getProduct();
      128     }
      129     public static void registerBundleGroupProvider(IBundleGroupProvider provider) {
      130         InternalPlatform.getDefault().registerBundleGroupProvider(provider);
      131     }
      132     public static void unregisterBundleGroupProvider(IBundleGroupProvider provider) {
      133         InternalPlatform.getDefault().unregisterBundleGroupProvider(provider);
      134     }
      135     public static Location getConfigurationLocation() {
      136         return InternalPlatform.getDefault().getConfigurationLocation();
      137     }
      138     public static Location getUserLocation() {
      139         return InternalPlatform.getDefault().getUserLocation();
      140     }
      141     public static Location getInstallLocation() {
      142         return InternalPlatform.getDefault().getInstallLocation();
      143     }
      144     public static boolean isFragment(Bundle bundle) {
      145         return InternalPlatform.getDefault().isFragment(bundle);
      146     }
      147     public static Bundle[] getFragments(Bundle bundle) {
      148         return InternalPlatform.getDefault().getFragments(bundle);
      149     }
      150     public static Bundle getBundle(String symbolicName) {
      151         return InternalPlatform.getDefault().getBundle(symbolicName);
      152     }
      153     public static Bundle[] getBundles(String symbolicName, String version) {
      154         return InternalPlatform.getDefault().getBundles(symbolicName, version);
      155     }
      156     public static Bundle[] getHosts(Bundle bundle) {
      157         return InternalPlatform.getDefault().getHosts(bundle);
      158     }
      159     public static boolean isRunning() {
      160         return InternalPlatform.getDefault().isRunning();
      161     }
      162     public static String[] knownOSArchValues() {
      163         return InternalPlatform.getDefault().knownOSArchValues();
      164     }
      165     public static String[] knownOSValues() {
      166         return InternalPlatform.getDefault().knownOSValues();
      167     }
      168     public static Map knownPlatformLineSeparators() {
      169         Map result = new HashMap();
      170         result.put(LINE_SEPARATOR_KEY_MAC_OS_9, LINE_SEPARATOR_VALUE_CR);
      171         result.put(LINE_SEPARATOR_KEY_UNIX, LINE_SEPARATOR_VALUE_LF);
      172         result.put(LINE_SEPARATOR_KEY_WINDOWS, LINE_SEPARATOR_VALUE_CRLF);
      173         return result;
      174     }
      175     public static String[] knownWSValues() {
      176         return InternalPlatform.getDefault().knownWSValues();
      177     }
      178     public static boolean inDebugMode() {
      179         return PlatformActivator.getContext().getProperty("osgi.debug") != null; //$NON-NLS-1$
      180     }
      181     public static boolean inDevelopmentMode() {
      182         return PlatformActivator.getContext().getProperty("osgi.dev") != null; //$NON-NLS-1$
      183     }
      184 }
    • ResourcesPlugin
    •  1 public final class ResourcesPlugin extends Plugin {     
       2     public static final String PT_NATURES = "natures"; 
       3     public static final String PT_MARKERS = "markers";
       4     public static final String PT_FILE_MODIFICATION_VALIDATOR = "fileModificationValidator"; //$NON-NLS-1$
       5     public static final String PT_MOVE_DELETE_HOOK = "moveDeleteHook"; //$NON-NLS-1$
       6     public static final String PT_TEAM_HOOK = "teamHook"; //$NON-NLS-1$
       7     public static final String PT_REFRESH_PROVIDERS = "refreshProviders"; //$NON-NLS-1$
       8     ...........
       9     public static final String PREF_ENCODING = "encoding"; //$NON-NLS-1$
      10     public static final String PREF_APPLY_FILE_STATE_POLICY = PREF_DESCRIPTION_PREFIX + "applyfilestatepolicy"; //$NON-NLS-1$
      11 
      12     
      13     private static Workspace workspace = null;
      14     private ServiceRegistration<IWorkspace> workspaceRegistration;
      15     public ResourcesPlugin() {
      16         plugin = this;
      17     }
      18     private static void constructWorkspace() throws CoreException {
      19         new LocalMetaArea().createMetaArea();
      20     }
      21     public static String getEncoding() {
      22         String enc = getPlugin().getPluginPreferences().getString(PREF_ENCODING);
      23         if (enc == null || enc.length() == 0) {
      24             enc = System.getProperty("file.encoding"); //$NON-NLS-1$
      25         }
      26         return enc;
      27     }
      28     public static IWorkspace getWorkspace() {
      29         if (workspace == null)
      30             throw new IllegalStateException(Messages.resources_workspaceClosed);
      31         return workspace;
      32     }
      33     public void stop(BundleContext context) throws Exception {
      34         super.stop(context);
      35         if (workspace == null)
      36             return;
      37         workspaceRegistration.unregister();
      38         // save the preferences for this plug-in
      39         getPlugin().savePluginPreferences();
      40         workspace.close(null);
      41 
      42         // Forget workspace only if successfully closed, to
      43         // make it easier to debug cases where close() is failing.
      44         workspace = null;
      45         workspaceRegistration = null;
      46     }
      47     public void start(BundleContext context) throws Exception {
      48         super.start(context);
      49         if (!new LocalMetaArea().hasSavedWorkspace()) {
      50             constructWorkspace();
      51         }
      52         Workspace.DEBUG = ResourcesPlugin.getPlugin().isDebugging();
      53         // Remember workspace before opening, to
      54         // make it easier to debug cases where open() is failing.
      55         workspace = new Workspace();
      56         PlatformURLResourceConnection.startup(workspace.getRoot().getLocation());
      57         initializePreferenceLookupOrder();
      58         IStatus result = workspace.open(null);
      59         if (!result.isOK())
      60             getLog().log(result);
      61         workspaceRegistration = context.registerService(IWorkspace.class, workspace, null);
      62     }
      63     private void initializePreferenceLookupOrder() {
      64         PreferencesService service = PreferencesService.getDefault();
      65         String[] original = service.getDefaultDefaultLookupOrder();
      66         List<String> newOrder = new ArrayList<String>();
      67         // put the project scope first on the list
      68         newOrder.add(ProjectScope.SCOPE);
      69         for (String entry : original)
      70             newOrder.add(entry);
      71         service.setDefaultDefaultLookupOrder(newOrder.toArray(new String[newOrder.size()]));
      72     }
      73 } 
    • IWorkspace
    •  1 public interface IWorkspace extends IAdaptable {
       2     public static final int AVOID_UPDATE = 1;
       3     public static final Object VALIDATE_PROMPT = FileModificationValidationContext.VALIDATE_PROMPT;
       4     public static final String SERVICE_NAME = IWorkspace.class.getName();
       5     public void addResourceChangeListener(IResourceChangeListener listener);
       6     public void addResourceChangeListener(IResourceChangeListener listener, int eventMask);
       7     public ISavedState addSaveParticipant(Plugin plugin, ISaveParticipant participant) throws CoreException;
       8     public ISavedState addSaveParticipant(String pluginId, ISaveParticipant participant) throws CoreException;
       9     public void build(int kind, IProgressMonitor monitor) throws CoreException;
      10     public void build(IBuildConfiguration[] buildConfigs, int kind, boolean buildReferences, IProgressMonitor monitor) throws CoreException;
      11     public void checkpoint(boolean build);
      12     public IProject[][] computePrerequisiteOrder(IProject[] projects);
      13     public final class ProjectOrder {
      14         public ProjectOrder(IProject[] projects, boolean hasCycles, IProject[][] knots) {
      15             this.projects = projects;
      16             this.hasCycles = hasCycles;
      17             this.knots = knots;
      18         }
      19         public IProject[] projects;
      20         public boolean hasCycles;
      21         public IProject[][] knots;
      22     }
      23     public ProjectOrder computeProjectOrder(IProject[] projects);
      24     public IStatus copy(IResource[] resources, IPath destination, boolean force, IProgressMonitor monitor) throws CoreException;
      25     public IStatus copy(IResource[] resources, IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException;
      26     public IStatus delete(IResource[] resources, boolean force, IProgressMonitor monitor) throws CoreException;
      27     public IStatus delete(IResource[] resources, int updateFlags, IProgressMonitor monitor) throws CoreException;
      28     public void deleteMarkers(IMarker[] markers) throws CoreException;
      29     public void forgetSavedTree(String pluginId);
      30     public IFilterMatcherDescriptor[] getFilterMatcherDescriptors();
      31     public IFilterMatcherDescriptor getFilterMatcherDescriptor(String filterMatcherId);
      32     public IProjectNatureDescriptor[] getNatureDescriptors();
      33     public IProjectNatureDescriptor getNatureDescriptor(String natureId);
      34     public Map<IProject,IProject[]> getDanglingReferences();
      35     public IWorkspaceDescription getDescription();
      36     public IWorkspaceRoot getRoot();
      37     public IResourceRuleFactory getRuleFactory();
      38     public ISynchronizer getSynchronizer();
      39     public boolean isAutoBuilding();
      40     public boolean isTreeLocked();
      41     public IProjectDescription loadProjectDescription(IPath projectDescriptionFile) throws CoreException;
      42     public IProjectDescription loadProjectDescription(InputStream projectDescriptionFile) throws CoreException;
      43     public IStatus move(IResource[] resources, IPath destination, boolean force, IProgressMonitor monitor) throws CoreException;
      44     public IStatus move(IResource[] resources, IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException;
      45     public IBuildConfiguration newBuildConfig(String projectName, String configName);
      46     public IProjectDescription newProjectDescription(String projectName);
      47     public void removeResourceChangeListener(IResourceChangeListener listener);
      48     public void removeSaveParticipant(Plugin plugin);    
      49     public void removeSaveParticipant(String pluginId);
      50     public void run(IWorkspaceRunnable action, ISchedulingRule rule, int flags, IProgressMonitor monitor) throws CoreException;
      51     public void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException;
      52     public IStatus save(boolean full, IProgressMonitor monitor) throws CoreException;
      53     public void setDescription(IWorkspaceDescription description) throws CoreException;
      54     public void setWorkspaceLock(WorkspaceLock lock);
      55     public String[] sortNatureSet(String[] natureIds);
      56     public IStatus validateEdit(IFile[] files, Object context);
      57     public IStatus validateFiltered(IResource resource);
      58     public IStatus validateLinkLocation(IResource resource, IPath location);
      59     public IStatus validateLinkLocationURI(IResource resource, URI location);
      60     public IStatus validateName(String segment, int typeMask);
      61     public IStatus validateNatureSet(String[] natureIds);
      62     public IStatus validatePath(String path, int typeMask);
      63     public IStatus validateProjectLocation(IProject project, IPath location);
      64     public IStatus validateProjectLocationURI(IProject project, URI location);
      65     public IPathVariableManager getPathVariableManager();
      66 }
    • fsdg
  • 相关阅读:
    (原创)批处理中变量的用法
    (收藏)Android 的各种listener and states event
    (转)Android 、BlackBerry 文本对齐方式对比
    (转)Android中尺寸单位杂谈
    批处理文章集锦
    Launch custom android application from android browser
    【原创】我的批处理命令例子
    Android文字居中
    (转)androd之绘制文本(FontMetrics)
    (批处理之二):setlocal enabledelayedexpansion (详解)
  • 原文地址:https://www.cnblogs.com/iiiDragon/p/3318704.html
Copyright © 2011-2022 走看看