APISonar


org.eclipse.jdt.internal.ui.JavaPlugin.log

> org > eclipse > jdt > internal > ui > JavaPlugin > log
org APIs eclipse APIs jdt APIs internal APIs ui APIs JavaPlugin APIs log APIs

Example 1
public InputStream getContents(Object element) {
        try {
            return zipFile.getInputStream((ZipEntry)element);
        } catch (IOException e) {
            JavaPlugin.log(e);
            return null;
        }
    }
Example 2
private boolean pomIsValid(String path) {
        try {
            Model.readFrom(new File(workspacePath, path));
        } catch (Exception e) {
            JavaPlugin.log(e);
            return false;
        }
        return true;
    }
Example 3
protected void updateProms() {
        try {
            if (projectToUpdate.size() == 0) {
                return;
            }
            Set<String> projects = new HashSet<>(projectToUpdate);
            projectToUpdate.clear();
            IWorkspace workspace = eclipseWorkspaceProvider.get();
            List<IProject> projectsList =
                    projects.stream().map(project -> workspace.getRoot().getProject(project)).collect(Collectors.toList());
            mavenWorkspace.update(projectsList);
        } catch (Throwable t) {
            JavaPlugin.log(t);
        }
    }
Example 4
private void openErrorDialog(Exception e) {
//		Shell shell= getTextViewer().getTextWidget().getShell();
//		MessageDialog.openError(shell, JavaTextMessages.ParameterGuessingProposal_error_msg, e.getMessage());
		JavaPlugin.log(e);
	}
Example 5
private String computeReplacementChoices(String name) {
        if (shouldDoGuessing()) {
            try {
                choices = guessParameters(paramName.toCharArray());
            } catch (JavaModelException e) {
                paramNamePosition = null;
                choices = null;
                JavaPlugin.log(e);
                openErrorDialog(e);
            }
        }
        return computeReplacementString(name);
    }
Example 6
private String evaluateTemplate(Template template, CodeTemplateContext context) {
    TemplateBuffer buffer;
    try {
      buffer = context.evaluate(template);
    } catch (BadLocationException e) {
      JavaPlugin.log(e);
      return ""; // $NON-NLS-1$
    } catch (TemplateException e) {
      JavaPlugin.log(e);
      return ""; // $NON-NLS-1$
    }
    if (buffer == null) return ""; // $NON-NLS-1$

    return buffer.getString();
  }
Example 7
public static void store(ContentAssistHistory history, String filePath) throws CoreException {
    try (FileOutputStream stream = new FileOutputStream(filePath)) {
      new ReaderWriter().store(history, new StreamResult(stream));

    } catch (IOException e) {
      JavaPlugin.log(e);
    }
  }
Example 8
public static ContentAssistHistory load(String filePath) throws CoreException {
    File file = new File(filePath);
    if (file.exists()) {
      try (FileInputStream stream = new FileInputStream(file)) {
        return new ReaderWriter().load(new InputSource(stream));
      } catch (IOException e) {
        JavaPlugin.log(e);
      }
    }
    return null;
  }
Example 9
public RefactoringStatus validateNewName(String newName) {
    INameUpdating updating = getNameUpdating();
    updating.setNewElementName(newName);
    try {
      return updating.checkNewElementName(newName);
    } catch (CoreException e) {
      JavaPlugin.log(e);
      return RefactoringStatus.createFatalErrorStatus(
          "An unexpected exception occurred. See the error log for more details.");
    }
  }
Example 10
public static String format(int kind, String source, int indentationLevel, String lineSeparator, Map<String, String> options) {
		TextEdit edit= format2(kind, source, indentationLevel, lineSeparator, options);
		if (edit == null) {
			return source;
		} else {
			Document document= new Document(source);
			try {
				edit.apply(document, TextEdit.NONE);
			} catch (BadLocationException e) {
				JavaPlugin.log(e); // bug in the formatter
				Assert.isTrue(false, "Formatter created edits with wrong positions: " + e.getMessage()); //$NON-NLS-1$
			}
			return document.get();
		}
	}
Example 11
private boolean validateTemplate(Template template) {
    String contextTypeId = template.getContextTypeId();
    if (!contextExists(contextTypeId)) return false;

    if (getRegistry() != null) {
      try {
        getRegistry().getContextType(contextTypeId).validate(template.getPattern());
      } catch (TemplateException e) {
        JavaPlugin.log(e);
        return false;
      }
    }
    return true;
  }
Example 12
public boolean filters(JavaElementMatch match) {
        Object element = match.getElement();
        if (element instanceof IMember) {
            try {
                return !JdtFlags.isPublic((IMember)element);
            } catch (JavaModelException e) {
                JavaPlugin.log(e);
            }
        }
        return false;
    }
Example 13
public void apply(IDocument document, char trigger, int offset) {
		try {
			super.apply(document, trigger, offset);

			if (fImportRewrite != null && fImportRewrite.hasRecordedChanges()) {
				int oldLen= document.getLength();
				fImportRewrite.rewriteImports(new NullProgressMonitor()).apply(document, TextEdit.UPDATE_REGIONS);
				setReplacementOffset(getReplacementOffset() + document.getLength() - oldLen);
			}
		} catch (CoreException e) {
			JavaPlugin.log(e);
		} catch (BadLocationException e) {
			JavaPlugin.log(e);
		}
	}
Example 14
private void doCreateChange(IProgressMonitor pm) throws CoreException {
		try {
			pm.beginTask(RefactoringCoreMessages.ExtractTempRefactoring_checking_preconditions, 1);
			try {
				createTempDeclaration();
			} catch (CoreException exception) {
				JavaPlugin.log(exception);
			}
			addReplaceExpressionWithTemp();
		} finally {
			pm.done();
		}
	}
Example 15
public static String asFormattedString(ASTNode node, int indent, String lineDelim, Map<String, String> options) {
        String unformatted = asString(node);
        TextEdit edit = CodeFormatterUtil.format2(node, unformatted, indent, lineDelim, options);
        if (edit != null) {
            Document document = new Document(unformatted);
            try {
                edit.apply(document, TextEdit.NONE);
            } catch (BadLocationException e) {
                JavaPlugin.log(e);
            }
            return document.get();
        }
        return unformatted; // unknown node
    }
Example 16
private Image getImageForType(IType type) {
    ImageDescriptor imageName = JavaPluginImages.DESC_OBJS_CLASS; // default
    try {
      if (type.isAnnotation()) {
        imageName = JavaPluginImages.DESC_OBJS_ANNOTATION;
      } else if (type.isInterface()) {
        imageName = JavaPluginImages.DESC_OBJS_INTERFACE;
      }
    } catch (JavaModelException e) {
      JavaPlugin.log(e);
    }
    return JavaPluginImages.get(imageName);
  }
Example 17
public void apply(IDocument document) {
		try {
			performChange(/*JavaPlugin.getActivePage().getActiveEditor(),*/ document);
		} catch (CoreException e) {
//			ExceptionHandler.handle(e, CorrectionMessages.ChangeCorrectionProposal_error_title,
//									CorrectionMessages.ChangeCorrectionProposal_error_message);
			JavaPlugin.log(e);
		}
	}
Example 18
private void releaseDocument(IDocument document) {
		if (document != null) {
			document.removeDocumentListener(this);
			document.removePositionUpdater(fPositionUpdater);
			try {
				document.removePositionCategory(getPositionCategory());
			} catch (BadPositionCategoryException e) {
				// Should not happen
				JavaPlugin.log(e);
			}
		}
	}
Example 19
public Refactoring createRefactoring(final RefactoringStatus status) throws CoreException {
		Refactoring refactoring= null;
		final String id= getID();
		final RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(id);
		if (contribution != null) {
			if (contribution instanceof JavaRefactoringContribution) {
				JavaRefactoringContribution javaContribution= (JavaRefactoringContribution) contribution;
				refactoring= javaContribution.createRefactoring(this, status);
			} else
				JavaPlugin.log(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), 0, MessageFormat.format(DescriptorMessages.JavaRefactoringDescriptor_no_resulting_descriptor, new Object[] { id}), null));
		}
		return refactoring;
	}
Example 20
boolean addMatch(Match match, IMatchPresentation participant) {
        Object element = match.getElement();
        if (fElementsToParticipants.get(element) != null) {
            // TODO must access the participant id / label to properly report the error.
            JavaPlugin.log(new Status(IStatus.WARNING, JavaPlugin.getPluginId(), 0, "A second search participant was found for an element",
                                      null)); //$NON-NLS-1$
            return false;
        }
        fElementsToParticipants.put(element, participant);
        addMatch(match);
        return true;
    }
Example 21
private void checkArgName() {
		String fieldName= fField.getElementName();
		boolean isStatic= true;
		try {
			isStatic= JdtFlags.isStatic(fField);
		} catch (JavaModelException e) {
			JavaPlugin.log(e);
		}
		if ( (isStatic && fArgName.equals(fieldName) && fieldName.equals(fField.getDeclaringType().getElementName()))
				|| JavaConventionsUtil.validateIdentifier(fArgName, fField).getSeverity() == IStatus.ERROR) {
			fArgName= "_" + fArgName; //$NON-NLS-1$
		}
	}
Example 22
private FinishResult internalPerformFinish(PerformChangeOperation op) {
        op.setUndoManager(RefactoringCore.getUndoManager(), refactoring.getName());
        try {
            ResourcesPlugin.getWorkspace().run(op, new NullProgressMonitor());
        } catch (CoreException e) {
            JavaPlugin.log(e);
            return FinishResult.createException();
        }
        return FinishResult.createOK();
    }
Example 23
public static void delete(final IResource elem) throws CoreException {
        IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
            public void run(IProgressMonitor monitor) throws CoreException {
                try {
                    elem.delete(true, monitor);
                } catch (CoreException e) {
                    JavaPlugin.log(e);
                    throw e;
                }
            }
        };
        ResourcesPlugin.getWorkspace().run(runnable, null);
    }
Example 24
static void setReadOnly(IResource resource, boolean readOnly) {
    ResourceAttributes resourceAttributes = resource.getResourceAttributes();
    if (resourceAttributes == null) // not supported on this platform for this resource
    return;

    resourceAttributes.setReadOnly(readOnly);
    try {
      resource.setResourceAttributes(resourceAttributes);
    } catch (CoreException e) {
      JavaPlugin.log(e);
    }
  }
Example 25
protected int getDescriptorFlags() {
    int flags =
        JavaRefactoringDescriptor.JAR_MIGRATION
            | JavaRefactoringDescriptor.JAR_REFACTORING
            | RefactoringDescriptor.STRUCTURAL_CHANGE;
    try {
      if (!Flags.isPrivate(fMethod.getFlags())) flags |= RefactoringDescriptor.MULTI_CHANGE;
      final IType declaring = fMethod.getDeclaringType();
      if (declaring.isAnonymous() || declaring.isLocal())
        flags |= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
    } catch (JavaModelException exception) {
      JavaPlugin.log(exception);
    }
    return flags;
  }