List of usage examples for org.eclipse.jdt.core IMethod getPath
IPath getPath();
From source file:com.feup.contribution.druid.tester.DruidTester.java
License:Open Source License
private void copyMethod(String unitpath, IMethod method) { String path = method.getPath().toOSString(); String newdir = path.substring(path.indexOf('/') + 1); newdir = newdir.substring(newdir.indexOf('/')); String newfile = newdir.substring(newdir.lastIndexOf('/') + 1); newdir = newdir.substring(0, newdir.lastIndexOf('/') + 1); String workspacepath = Platform.getLocation().toOSString(); new File("/tmp/druid/" + newdir).mkdirs(); File source = new File(workspacepath + unitpath + newdir, newfile); File dest = new File("/tmp/druid/" + newdir, newfile); try {/*from www .j av a 2 s . c o m*/ copy(source, dest); } catch (IOException e) { DruidPlugin.getPlugin().logException(e); } }
From source file:org.jboss.tools.seam.internal.core.validation.SeamCoreValidator.java
License:Open Source License
private void validateDestroyMethod(ISeamComponent component) { if (component.isStateless()) { ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration(); Set<ISeamComponentMethod> methods = javaDeclaration.getMethodsByType(SeamComponentMethodType.DESTROY); if (methods == null) { return; }//from w w w. j av a2 s .co m for (ISeamComponentMethod method : methods) { IMethod javaMethod = (IMethod) method.getSourceMember(); String methodName = javaMethod.getElementName(); if (javaDeclaration.getSourcePath().equals(javaMethod.getPath())) { validationContext.addLinkedCoreResource(SHORT_ID, component.getName(), javaDeclaration.getSourcePath(), true); ITextSourceReference methodNameLocation = getNameLocation(method); addError(SeamValidationMessages.DESTROY_METHOD_BELONGS_TO_STATELESS_SESSION_BEAN, SeamPreferences.DESTROY_METHOD_BELONGS_TO_STATELESS_SESSION_BEAN, new String[] { methodName }, methodNameLocation, method.getResource(), DESTROY_METHOD_BELONGS_TO_STATELESS_SESSION_BEAN_MESSAGE_ID); } } } }
From source file:org.jboss.tools.seam.internal.core.validation.SeamCoreValidator.java
License:Open Source License
private void validateMethodOfUnknownComponent(SeamComponentMethodType methodType, ISeamJavaComponentDeclaration declaration, String message, String preferenceKey, int message_id) { Set<ISeamComponentMethod> methods = declaration.getMethodsByType(methodType); if (methods != null && !methods.isEmpty()) { for (ISeamComponentMethod method : methods) { IMethod javaMethod = (IMethod) method.getSourceMember(); String methodName = javaMethod.getElementName(); if (declaration.getSourcePath().equals(javaMethod.getPath())) { ITextSourceReference methodNameLocation = getNameLocation(method); addError(message, preferenceKey, new String[] { methodName }, methodNameLocation, method.getResource(), message_id); validationContext.addUnnamedCoreResource(SHORT_ID, declaration.getSourcePath()); }//from www . ja v a 2 s.c o m } } else { validationContext.removeUnnamedCoreResource(SHORT_ID, declaration.getSourcePath()); } }
From source file:org.key_project.keyide.ui.editor.KeYEditor.java
License:Open Source License
/** * {@inheritDoc}/* w w w . ja va 2s. c om*/ */ @Override public void doSaveAs() { Shell shell = getSite().getWorkbenchWindow().getShell(); SaveAsDialog dialog = new SaveAsDialog(shell); dialog.setTitle("Save Proof"); IEditorInput input = getEditorInput(); if (input instanceof ProofOblInputEditorInput) { IMethod method = ((ProofOblInputEditorInput) input).getMethod(); IPath methodPath = method.getPath(); methodPath = methodPath.removeLastSegments(1); String name = getCurrentProof().name().toString(); name = ResourceUtil.validateWorkspaceFileName(name); name = name + "." + KeYUtil.PROOF_FILE_EXTENSION; methodPath = methodPath.append(name); IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(methodPath); dialog.setOriginalFile(file); } else if (input instanceof FileEditorInput) { FileEditorInput in = (FileEditorInput) input; IFile file = in.getFile(); dialog.setOriginalFile(file); } dialog.create(); dialog.open(); IPath path = dialog.getResult(); save(path); }