Java Code Examples for org.eclipse.core.resources.IResource

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/explorer/s3/dnd/.

Source file: UploadDropAssistant.java

  22 
vote

public static File getFileToDrop(TransferData transfer){
  File f=null;
  if (LocalSelectionTransfer.getTransfer().isSupportedType(transfer)) {
    IStructuredSelection selection=(IStructuredSelection)LocalSelectionTransfer.getTransfer().nativeToJava(transfer);
    IResource resource=(IResource)selection.getFirstElement();
    f=resource.getLocation().toFile();
  }
 else   if (FileTransfer.getInstance().isSupportedType(transfer)) {
    String[] files=(String[])FileTransfer.getInstance().nativeToJava(transfer);
    f=new File(files[0]);
  }
  return f;
}
 

Example 2

From project bel-editor, under directory /org.openbel.editor.core/src/org/openbel/editor/core/builder/.

Source file: BELCompileBuilder.java

  22 
vote

@Override public boolean visit(IResourceDelta delta) throws CoreException {
  IResource resource=delta.getResource();
switch (delta.getKind()) {
case IResourceDelta.ADDED:
    checkXML(resource);
  break;
case IResourceDelta.REMOVED:
break;
case IResourceDelta.CHANGED:
checkXML(resource);
break;
}
return true;
}
 

Example 3

From project bel-editor, under directory /org.openbel.editor.core/src/org/openbel/editor/core/builder/.

Source file: BELProjectBuilder.java

  22 
vote

/** 
 * {@inheritDoc}
 */
@Override public boolean visit(IResourceDelta delta) throws CoreException {
  IResource resource=delta.getResource();
switch (delta.getKind()) {
case ADDED:
    checkXML(resource);
  break;
case REMOVED:
break;
case CHANGED:
checkXML(resource);
break;
}
return true;
}
 

Example 4

From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/editors/.

Source file: BioPEPAEditor.java

  22 
vote

public void init(IEditorSite site,IEditorInput input) throws PartInitException {
  super.init(site,input);
  IResource resource=(IResource)input.getAdapter(IResource.class);
  model=BioPEPAPlugin.getDefault().getBioPEPAManager().getModel(resource);
  BioPEPAPlugin.getDefault().getBioPEPAManager().editorOpened(this);
  checkPerspective(site.getPage());
}
 

Example 5

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/wizards/.

Source file: NewSpectrumWizard.java

  22 
vote

/** 
 * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
public boolean performFinish(){
  IResource parentFolder=filePage.getSelectedFolder();
  CMLSpectrum spec=createNewCMLSpectrum();
  try {
    createNewSpectrum(filePage.getFileName(),filePage.getExtension(),parentFolder,spec);
  }
 catch (  Exception e) {
    LogUtils.handleException(e,logger,net.bioclipse.spectrum.Activator.PLUGIN_ID);
  }
  return true;
}
 

Example 6

From project bndtools, under directory /bndtools.core/src/bndtools/builder/.

Source file: NewBuilder.java

  22 
vote

private static File getFileForPath(IPath path){
  File file;
  IResource resource=ResourcesPlugin.getWorkspace().getRoot().findMember(path);
  if (resource != null && resource.exists())   file=resource.getLocation().toFile();
 else   file=path.toFile();
  return file;
}
 

Example 7

From project bndtools, under directory /bndtools.core/src/bndtools/builder/.

Source file: NewBuilder.java

  22 
vote

private IResource getBuildMarkerTargetResource(){
  IProject project=getProject();
  IResource bndFile=project.getFile(Project.BNDFILE);
  if (bndFile == null || !bndFile.exists())   return project;
  return bndFile;
}
 

Example 8

From project bundlemaker, under directory /main/org.bundlemaker.core.jdt/src/org/bundlemaker/core/jdt/content/.

Source file: EntryHelper.java

  22 
vote

/** 
 * <p> </p>
 * @param path
 * @return
 */
private IPath makeAbsolute(IPath path){
  if (path == null) {
    return path;
  }
  if (ResourcesPlugin.getWorkspace().getRoot().findMember(path) != null) {
    IResource resource=ResourcesPlugin.getWorkspace().getRoot().findMember(path);
    path=resource.getRawLocation();
  }
  return path;
}
 

Example 9

From project bundlemaker, under directory /main/org.bundlemaker.core.jdt/src/org/bundlemaker/core/jdt/internal/parser/.

Source file: JdtParserFactory.java

  22 
vote

/** 
 * <p> </p>
 * @return
 */
private boolean createAssociatedJavaProject(IBundleMakerProject bundleMakerProject){
  if (!JdtProjectHelper.hasAssociatedJavaProject(bundleMakerProject)) {
    return true;
  }
  IProject project=JdtProjectHelper.getAssociatedJavaProjectAsProject(bundleMakerProject);
  IResource resource=bundleMakerProject.getProject().findMember(BundleMakerCore.PROJECT_DESCRIPTION_PATH);
  return resource.getLocalTimeStamp() > project.getLocalTimeStamp();
}
 

Example 10

From project ccw, under directory /ccw.core/src/java/ccw/editors/clojure/.

Source file: ClojureEditor.java

  22 
vote

/** 
 * @return the project, or null if unknown (case when clojure file open from a Jar via a JarEditorInput, etc.)
 */
public IProject getProject(){
  IResource resource=(IResource)getEditorInput().getAdapter(IResource.class);
  if (resource != null) {
    return resource.getProject();
  }
 else {
    return null;
  }
}
 

Example 11

From project ccw, under directory /ccw.core/src/java/ccw/launching/.

Source file: LaunchUtils.java

  22 
vote

static public List<IFile> getFilesToLaunchList(ILaunchConfiguration config) throws CoreException {
  List<IFile> selectedFiles=new ArrayList<IFile>();
  for (  String path : config.getAttribute(LaunchUtils.ATTR_FILES_LAUNCHED_AT_STARTUP,"").split("\n")) {
    IResource rc=ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
    if (rc instanceof IFile) {
      selectedFiles.add((IFile)rc);
    }
  }
  return selectedFiles;
}
 

Example 12

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/editor/.

Source file: ProblemMarkerManager.java

  22 
vote

public boolean visit(IResourceDelta delta) throws CoreException {
  IResource res=delta.getResource();
  if (res instanceof IProject && delta.getKind() == IResourceDelta.CHANGED) {
    IProject project=(IProject)res;
    if (!project.isAccessible()) {
      return false;
    }
  }
  checkInvalidate(delta,res);
  return true;
}
 

Example 13

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/explorer/.

Source file: PackageExplorerPart.java

  22 
vote

private boolean revealElementOrParent(Object element){
  if (revealAndVerify(element))   return true;
  element=getVisibleParent(element);
  if (element != null) {
    if (revealAndVerify(element))     return true;
    if (element instanceof IJavaElement) {
      IResource resource=((IJavaElement)element).getResource();
      if (resource != null) {
        if (revealAndVerify(resource))         return true;
      }
    }
  }
  return false;
}
 

Example 14

From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala.editor/src-gen/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/model/scala/presentation/.

Source file: ScalaModelWizard.java

  21 
vote

/** 
 * The framework calls this to create the contents of the wizard. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override public void addPages(){
  newFileCreationPage=new ScalaModelWizardNewFileCreationPage("Whatever",selection);
  newFileCreationPage.setTitle(ScalaEditorPlugin.INSTANCE.getString("_UI_ScalaModelWizard_label"));
  newFileCreationPage.setDescription(ScalaEditorPlugin.INSTANCE.getString("_UI_ScalaModelWizard_description"));
  newFileCreationPage.setFileName(ScalaEditorPlugin.INSTANCE.getString("_UI_ScalaEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
  addPage(newFileCreationPage);
  if (selection != null && !selection.isEmpty()) {
    Object selectedElement=selection.iterator().next();
    if (selectedElement instanceof IResource) {
      IResource selectedResource=(IResource)selectedElement;
      if (selectedResource.getType() == IResource.FILE) {
        selectedResource=selectedResource.getParent();
      }
      if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
        newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
        String defaultModelBaseFilename=ScalaEditorPlugin.INSTANCE.getString("_UI_ScalaEditorFilenameDefaultBase");
        String defaultModelFilenameExtension=FILE_EXTENSIONS.get(0);
        String modelFilename=defaultModelBaseFilename + "." + defaultModelFilenameExtension;
        for (int i=1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
          modelFilename=defaultModelBaseFilename + i + "."+ defaultModelFilenameExtension;
        }
        newFileCreationPage.setFileName(modelFilename);
      }
    }
  }
  initialObjectCreationPage=new ScalaModelWizardInitialObjectCreationPage("Whatever2");
  initialObjectCreationPage.setTitle(ScalaEditorPlugin.INSTANCE.getString("_UI_ScalaModelWizard_label"));
  initialObjectCreationPage.setDescription(ScalaEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
  addPage(initialObjectCreationPage);
}
 

Example 15

From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.webapp.editor/src-gen/org/eclipse/acceleo/tutorial/webapp/presentation/.

Source file: WebappModelWizard.java

  21 
vote

/** 
 * The framework calls this to create the contents of the wizard. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override public void addPages(){
  newFileCreationPage=new WebappModelWizardNewFileCreationPage("Whatever",selection);
  newFileCreationPage.setTitle(WebappEditorPlugin.INSTANCE.getString("_UI_WebappModelWizard_label"));
  newFileCreationPage.setDescription(WebappEditorPlugin.INSTANCE.getString("_UI_WebappModelWizard_description"));
  newFileCreationPage.setFileName(WebappEditorPlugin.INSTANCE.getString("_UI_WebappEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
  addPage(newFileCreationPage);
  if (selection != null && !selection.isEmpty()) {
    Object selectedElement=selection.iterator().next();
    if (selectedElement instanceof IResource) {
      IResource selectedResource=(IResource)selectedElement;
      if (selectedResource.getType() == IResource.FILE) {
        selectedResource=selectedResource.getParent();
      }
      if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
        newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
        String defaultModelBaseFilename=WebappEditorPlugin.INSTANCE.getString("_UI_WebappEditorFilenameDefaultBase");
        String defaultModelFilenameExtension=FILE_EXTENSIONS.get(0);
        String modelFilename=defaultModelBaseFilename + "." + defaultModelFilenameExtension;
        for (int i=1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
          modelFilename=defaultModelBaseFilename + i + "."+ defaultModelFilenameExtension;
        }
        newFileCreationPage.setFileName(modelFilename);
      }
    }
  }
  initialObjectCreationPage=new WebappModelWizardInitialObjectCreationPage("Whatever2");
  initialObjectCreationPage.setTitle(WebappEditorPlugin.INSTANCE.getString("_UI_WebappModelWizard_label"));
  initialObjectCreationPage.setDescription(WebappEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
  addPage(initialObjectCreationPage);
}
 

Example 16

From project acceleo-webapp-generator, under directory /plugins/org.obeonetwork.pim.gen.backbone.model.editor/src-gen/org/obeonetwork/pim/gen/backbone/model/backbone/presentation/.

Source file: BackboneModelWizard.java

  21 
vote

/** 
 * The framework calls this to create the contents of the wizard. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override public void addPages(){
  newFileCreationPage=new BackboneModelWizardNewFileCreationPage("Whatever",selection);
  newFileCreationPage.setTitle(BackboneEditorPlugin.INSTANCE.getString("_UI_BackboneModelWizard_label"));
  newFileCreationPage.setDescription(BackboneEditorPlugin.INSTANCE.getString("_UI_BackboneModelWizard_description"));
  newFileCreationPage.setFileName(BackboneEditorPlugin.INSTANCE.getString("_UI_BackboneEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
  addPage(newFileCreationPage);
  if (selection != null && !selection.isEmpty()) {
    Object selectedElement=selection.iterator().next();
    if (selectedElement instanceof IResource) {
      IResource selectedResource=(IResource)selectedElement;
      if (selectedResource.getType() == IResource.FILE) {
        selectedResource=selectedResource.getParent();
      }
      if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
        newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
        String defaultModelBaseFilename=BackboneEditorPlugin.INSTANCE.getString("_UI_BackboneEditorFilenameDefaultBase");
        String defaultModelFilenameExtension=FILE_EXTENSIONS.get(0);
        String modelFilename=defaultModelBaseFilename + "." + defaultModelFilenameExtension;
        for (int i=1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
          modelFilename=defaultModelBaseFilename + i + "."+ defaultModelFilenameExtension;
        }
        newFileCreationPage.setFileName(modelFilename);
      }
    }
  }
  initialObjectCreationPage=new BackboneModelWizardInitialObjectCreationPage("Whatever2");
  initialObjectCreationPage.setTitle(BackboneEditorPlugin.INSTANCE.getString("_UI_BackboneModelWizard_label"));
  initialObjectCreationPage.setDescription(BackboneEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
  addPage(initialObjectCreationPage);
}
 

Example 17

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/explorer/s3/dnd/.

Source file: DownloadDropAssistant.java

  21 
vote

protected IStatus doDrop(Object aTarget,IStructuredSelection s3ObjectSelection){
  if (!(aTarget instanceof IResource)) {
    return Status.CANCEL_STATUS;
  }
  IResource resource=(IResource)aTarget;
  if (resource instanceof IFile) {
    resource=resource.getParent();
  }
  final IResource dropFolder=resource;
  final S3ObjectSummary s3object=(S3ObjectSummary)s3ObjectSelection.getFirstElement();
  final File f=dropFolder.getLocation().toFile();
  if (!f.exists())   return Status.CANCEL_STATUS;
  String fileName=getOutputFileName(s3object,f);
  if (fileName == null || fileName.length() == 0) {
    return Status.CANCEL_STATUS;
  }
  final File outputFile=new File(fileName);
  new DownloadObjectJob("Downloading " + s3object.getKey(),s3object,dropFolder,outputFile).schedule();
  return Status.OK_STATUS;
}
 

Example 18

From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/.

Source file: BioPEPAManager.java

  21 
vote

public void editorClosed(BioPEPAEditor editor){
  BioPEPAModel model=editor.getModel();
  Integer count=editorCount.get(model);
  if (count == 1) {
    editorCount.remove(model);
    IResource resource=null;
    for (    Map.Entry<IResource,BioPEPAModel> me : map.entrySet())     if (me.getValue() == model) {
      resource=me.getKey();
      break;
    }
    map.remove(resource);
    model.dispose();
  }
 else {
    editorCount.put(model,count - 1);
  }
}
 

Example 19

From project bioclipse.seneca, under directory /plugins/net.bioclipse.seneca/src/net/bioclipse/seneca/actions/.

Source file: SjsFileContentProvider.java

  21 
vote

public Object[] getChildren(Object parentElement){
  ArrayList<IResource> childElements=new ArrayList<IResource>();
  if (parentElement instanceof IContainer && ((IContainer)parentElement).isAccessible()) {
    IContainer container=(IContainer)parentElement;
    try {
      for (int i=0; i < container.members().length; i++) {
        IResource resource=container.members()[i];
        if (resource instanceof IFile && isSjs((IFile)resource)) {
          childElements.add(resource);
        }
 else         if (resource instanceof IContainer && resource.isAccessible() && containsMolecules((IContainer)resource)) {
          childElements.add(resource);
        }
      }
    }
 catch (    CoreException e) {
      LogUtils.handleException(e,logger,net.bioclipse.chemoinformatics.Activator.PLUGIN_ID);
    }
catch (    IOException e) {
      LogUtils.handleException(e,logger,net.bioclipse.chemoinformatics.Activator.PLUGIN_ID);
    }
  }
  return childElements.toArray();
}
 

Example 20

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.nmrshiftdb/src/net/bioclipse/nmrshiftdb/wizards/.

Source file: PredictWizard.java

  21 
vote

/** 
 * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
public boolean performFinish(){
  try {
    String filename=displayPage.getFileName();
    IResource parentFolder=displayPage.getSelectedFolder();
    IFile target=ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(parentFolder.getFullPath().toOSString() + File.separator + filename+ (filename.indexOf("." + SpectrumEditor.CML_TYPE) == -1 ? "." + SpectrumEditor.CML_TYPE : "")));
    int answer=SWT.YES;
    if (target.exists()) {
      MessageBox mb=new MessageBox(this.getShell(),SWT.ICON_WARNING | SWT.YES | SWT.NO);
      mb.setMessage("The file " + filename + " already exists. Do you want to overwrite it?");
      mb.setText("File already exists");
      answer=mb.open();
    }
    if (answer == SWT.YES) {
      if (displayPage.getCmlbutton().getSelection()) {
        CMLSpectrum cmlElement=displayPage.spectrum;
        NewSpectrumWizard.createNewSpectrum(filename,SpectrumEditor.CML_TYPE,parentFolder,cmlElement);
      }
 else {
        filename=displayPage.getFileName() + "." + SpectrumEditor.CML_TYPE;
        CMLCml cml=new CMLCml();
        cml.appendChild(provmol.toCML());
        displayPage.getSpectrum().detach();
        cml.appendChild(displayPage.getSpectrum());
        net.bioclipse.specmol.Activator.getDefault().getJavaSpecmolManager().saveSpecmol(new JumboSpecmol(cml),ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(parentFolder.getFullPath().toOSString() + File.separator + filename)));
      }
    }
    return true;
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    MessageBox messageBox=new MessageBox(getShell(),SWT.ICON_WARNING);
    messageBox.setMessage("We could not create the file");
    messageBox.setText("Resource creation impossible");
    messageBox.open();
  }
  return false;
}
 

Example 21

From project bpelunit, under directory /tycho/net.bpelunit.framework.client.eclipse/src/net/bpelunit/framework/client/eclipse/dialog/field/.

Source file: FileSelector.java

  21 
vote

/** 
 * Opens a dialog and lets the user select a file from the current project. The code attempts to find the file "currentFile" which is assumed to be relative to the current directory and select it. The returned file name is relative to the current directory.
 * @param shell shell
 * @param preSelectFile a file path and name to preselect
 * @param validator file validator for the file dialog
 * @param filter filters objects in the selection dialog
 * @param project project to be displayed in selection dialog
 * @param directory directory to be pre-selected in the selection dialog
 * @return
 */
public static String getFile(Shell shell,String preSelectFile,ISelectionStatusValidator validator,ViewerFilter filter,IProject project,IContainer directory){
  String path=null;
  IFile file=null;
  if (preSelectFile != null) {
    IResource res=directory.findMember(preSelectFile);
    if (res != null && res.exists() && res instanceof IFile)     file=(IFile)res;
  }
  IFile newFile=selectFile(shell,"File selection","Select a file.",filter,project,file);
  if (newFile != null) {
    IPath projPath=newFile.getProjectRelativePath();
    if (directory.getProjectRelativePath().isPrefixOf(projPath))     projPath=projPath.removeFirstSegments(directory.getProjectRelativePath().segmentCount());
    path=projPath.toString();
  }
  return path;
}
 

Example 22

From project bpelunit, under directory /tycho/net.bpelunit.framework.client.eclipse/src/net/bpelunit/framework/client/eclipse/launch/.

Source file: BPELLaunchMainTab.java

  21 
vote

/** 
 * Show a dialog that lists all main types
 */
protected void handleSearchButtonSelected(){
  ElementTreeSelectionDialog dialog=new ElementTreeSelectionDialog(getShell(),new WorkbenchLabelProvider(),new WorkbenchContentProvider());
  dialog.setTitle("Select a .bpts file:");
  dialog.setMessage("Select the .bpts file to run:");
  dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
  dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
  dialog.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      if (element instanceof IFile) {
        IFile file=(IFile)element;
        if (!file.getFileExtension().equals("bpts"))         return false;
      }
      return true;
    }
  }
);
  dialog.setAllowMultiple(false);
  dialog.setValidator(new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      if ((selection != null) && (selection.length > 0)) {
        Object first=selection[0];
        if (first instanceof IFile) {
          IFile file=(IFile)first;
          if (file.getFileExtension().equals("bpts"))           return Status.OK_STATUS;
        }
      }
      return new Status(IStatus.ERROR,BPELUnitActivator.getUniqueIdentifier(),-1,"Select a .bpts file.",null);
    }
  }
);
  if (dialog.open() == IDialogConstants.OK_ID) {
    IResource resource=(IResource)dialog.getFirstResult();
    if (!(resource instanceof IFile) || !resource.getFileExtension().equals("bpts")) {
      MessageDialog.openError(this.getShell(),"BPELUnit Test Suite","Must select a file with a .bpts ending");
    }
 else {
      fSuiteText.setText(resource.getProjectRelativePath().toString());
    }
  }
}
 

Example 23

From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/.

Source file: BPMN2DiagramWizard.java

  21 
vote

/** 
 * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
@Override public boolean performFinish(){
  final String fileName=page.getFileName();
  final IResource container=page.getDiagramContainer();
  IRunnableWithProgress op=new IRunnableWithProgress(){
    @Override public void run(    IProgressMonitor monitor) throws InvocationTargetException {
      try {
        IPath path=container.getFullPath().append(fileName);
        IFolder folder=null;
        BPMN2DiagramCreator factory=new BPMN2DiagramCreator();
        folder=BPMN2DiagramCreator.getTempFolder(path);
        factory.setDiagramFile(BPMN2DiagramCreator.getTempFile(path,folder));
        factory.setDiagramFolder(folder);
        factory.createDiagram();
      }
 catch (      CoreException e) {
        throw new InvocationTargetException(e);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    getContainer().run(true,false,op);
  }
 catch (  InterruptedException e) {
    return false;
  }
catch (  InvocationTargetException e) {
    Throwable realException=e.getTargetException();
    MessageDialog.openError(getShell(),"Error",realException.getMessage());
    return false;
  }
  return true;
}
 

Example 24

From project CBCJVM, under directory /eclipse/src/cbclipse/builder/.

Source file: CBCBuilder.java

  21 
vote

public boolean visit(IResourceDelta delta) throws CoreException {
  IResource resource=delta.getResource();
  try {
switch (delta.getKind()) {
case IResourceDelta.ADDED:
      handleAdd(resource);
    break;
case IResourceDelta.REMOVED:
  handleRemove(resource);
break;
case IResourceDelta.CHANGED:
handleChange(resource);
break;
}
}
 catch (CommunicationException e) {
throw new CoreException(new Status(IStatus.ERROR,BUILDER_ID,"Communication with CBC failed, not downloaded",new RuntimeException()));
}
return true;
}
 

Example 25

From project adt-cdt, under directory /com.android.ide.eclipse.adt.cdt/src/com/android/ide/eclipse/adt/cdt/internal/.

Source file: NDKManager.java

  19 
vote

public static void addNativeSupport(final IProject project,Map<String,String> templateArgs,IProgressMonitor monitor) throws CoreException {
  TemplateCore template=TemplateEngine.getDefault().getTemplateById("AddNDKSupport");
  Map<String,String> valueStore=template.getValueStore();
  valueStore.put("projectName",project.getName());
  valueStore.putAll(templateArgs);
  template.executeTemplateProcesses(monitor,false);
  project.refreshLocal(IResource.DEPTH_INFINITE,new SubProgressMonitor(monitor,10));
}
 

Example 26

From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/.

Source file: BPMN2DiagramCreator.java

  19 
vote

/** 
 * Check if the given folder is empty. This is true if it contains no files, or only empty folders.
 * @param container - folder to check
 * @return true if the folder is empty.
 */
public static boolean isEmptyFolder(IContainer container){
  try {
    IResource[] members=container.members();
    for (    IResource res : members) {
      int type=res.getType();
      if (type == IResource.FILE || type == IResource.PROJECT || type == IResource.ROOT)       return false;
      if (!isEmptyFolder((IContainer)res))       return false;
    }
  }
 catch (  CoreException e) {
    return false;
  }
  return true;
}
 

Example 27

From project CBCJVM, under directory /eclipse/src/cbclipse/builder/.

Source file: CBCBuilder.java

  19 
vote

public boolean visit(IResource resource){
  try {
    handleAdd(resource);
  }
 catch (  CommunicationException e) {
    e.printStackTrace();
  }
  return true;
}