Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspace


  protected void openInCasEditor(IPath resultPath) {
    if (resultPath == null) {
      return;
    }
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IFile file = workspace.getRoot().getFileForLocation(resultPath);

    if (file != null && !file.isSynchronized(IResource.DEPTH_ZERO)) {
      try {
        file.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
      } catch (CoreException e) {
View Full Code Here


    }
    final JCasGenThrower jCasGenThrower = new JCasGenThrower();

    try {

      final IWorkspace workspace = ResourcesPlugin.getWorkspace();
      final Jg jg = new Jg();
      final TypeDescription[] types = mergedTypeSystemDescription.getTypes();
      final String outputDirectory = getPrimarySourceFolder().getLocation().toOSString();
      final String inputFile = file.getLocation().toOSString(); // path to descriptor file
      IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
        public void run(IProgressMonitor progressMonitor) {
          try {
            jg.mainForCde(new MergerImpl(), new JCasGenProgressMonitor(progressMonitor),
                    jCasGenThrower, inputFile, outputDirectory, types, (CASImpl) getCurrentView());
          } catch (IOException e) {
            Utility.popMessage(Messages.getString("MultiPageEditor.25"), //$NON-NLS-1$
                    Messages.getString("MultiPageEditor.26") //$NON-NLS-1$
                            + getMessagesToRootCause(e), MessageDialog.ERROR);
          }
        }
      };
      workspace.run(runnable, monitor);
      getPrimarySourceFolder().refreshLocal(IResource.DEPTH_INFINITE, null);

      String jcasMsg = jCasGenThrower.getMessage();
      if (null != jcasMsg && jcasMsg.length() > 0) {
        Utility.popMessage(Messages.getString("MultiPageEditor.JCasGenErrorTitle"), //$NON-NLS-1$
View Full Code Here

    public static void refreshProject(Project project) throws Exception {
        Workspace ws = getWorkspace();
        if (ws == null) {
            return;
        }
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        IWorkspaceRoot root = workspace.getRoot();
        IProject p = root.getProject(project.getName());
        refreshProject(p);
    }
View Full Code Here

        try {
            getContainer().run(false, false, new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    try {
                        IWorkspace ws = ResourcesPlugin.getWorkspace();
                        ws.run(operation, monitor);

                        if (monitor.isCanceled())
                            throw new InterruptedException();
                    } catch (CoreException e) {
                        throw new InvocationTargetException(e);
View Full Code Here

  public static void refreshProject(Project project) throws Exception {
    Workspace ws = getWorkspace();
    if (ws == null) {
      return;
    }
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceRoot root = workspace.getRoot();
    IProject p  = root.getProject(project.getName());
    refreshProject(p);
  }
View Full Code Here

        IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(Workspace.CNFDIR);
        project.open(monitor);
    }

    protected void importCnf(IProgressMonitor monitor) throws CoreException {
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        IPath location = operation.getLocation();
        IContainer container = workspace.getRoot().getContainerForLocation(location);
        if (container == null) {
            IProjectDescription projDesc = workspace.loadProjectDescription(location.append(IProjectDescription.DESCRIPTION_FILE_NAME));
            IProject project = workspace.getRoot().getProject(Workspace.CNFDIR);
            project.create(projDesc, monitor);
            project.open(monitor);
        } else if (container.getType() == IResource.PROJECT) {
            IProject project = (IProject) container;
            if (project.exists()) {
View Full Code Here

        if (!(each instanceof IEditorPart)) return new IFile[] {};
        IEditorInput input = ((IEditorPart) each).getEditorInput();
        if (!(input instanceof IPathEditorInput)) return new IFile[] {};
        IPathEditorInput pathInput = (IPathEditorInput) input;
//      System.out.println(pathInput.getPath());
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        return workspace.getRoot().findFilesForLocation(pathInput.getPath());
    }   
View Full Code Here

                if (path == null) {
                    return;
                }

                IWorkspace workspace = ResourcesPlugin.getWorkspace();
                final IFile newFile = workspace.getRoot().getFile(path);

                WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
                    public void execute(final IProgressMonitor monitor)
                            throws CoreException {
                        try {
View Full Code Here

    }
    final JCasGenThrower jCasGenThrower = new JCasGenThrower();

    try {

      final IWorkspace workspace = ResourcesPlugin.getWorkspace();
      final Jg jg = new Jg();
      final TypeDescription[] types = mergedTypeSystemDescription.getTypes();
      final String outputDirectory = getPrimarySourceFolder().getLocation().toOSString();
      final String inputFile = file.getLocation().toOSString(); // path to descriptor file
      IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
        public void run(IProgressMonitor progressMonitor) {
          try {
            jg.mainForCde(new MergerImpl(), new JCasGenProgressMonitor(progressMonitor),
                    jCasGenThrower, inputFile, outputDirectory, types, (CASImpl) getCurrentView(),
                    getProject().getLocationURI().getPath(),
                    limitJCasGenToProjectScope,
                    mergedTypesAddingFeatures);
          } catch (IOException e) {
            Utility.popMessage(Messages.getString("MultiPageEditor.25"), //$NON-NLS-1$
                    Messages.getString("MultiPageEditor.26") //$NON-NLS-1$
                            + getMessagesToRootCause(e), MessageDialog.ERROR);
          }
        }
      };
      workspace.run(runnable, monitor);
      getPrimarySourceFolder().refreshLocal(IResource.DEPTH_INFINITE, null);

      String jcasMsg = jCasGenThrower.getMessage();
      if (null != jcasMsg && jcasMsg.length() > 0) {
        Utility.popMessage(Messages.getString("MultiPageEditor.JCasGenErrorTitle"), //$NON-NLS-1$
View Full Code Here

  }

  public Object run(Object object) {
    try {
      final String[] arguments = (String[]) object;
      final IWorkspace workspace = ResourcesPlugin.getWorkspace();
      final Jg jg = new Jg();
      IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
        public void run(IProgressMonitor progressMonitor) throws CoreException {
          jg.main0(arguments, new MergerImpl(), null, // no progressMonitor,
                  new EP_LogThrowErrorImpl());
        }
      };
      workspace.run(runnable, null);
      return Integer.valueOf(0);
    } catch (Exception exception) {
      exception.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IWorkspace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.